1import{a as gn}from"./chunk-XI3DERXW.js";import{a as yn}from"./chunk-JVQG3VTE.js";import{a as hn,b as Pe}from"./chunk-XT3252JG.js";import{a as N}from"./chunk-3FODBYIQ.js";import{b as tn}from"./chunk-WNDPZO2Y.js";import{a as Dn}from"./chunk-BALHMWRH.js";import{a as Bt}from"./chunk-7DNSHQFI.js";import{a as bn}from"./chunk-FZ3T72KF.js";import{a as Sn}from"./chunk-YH7FTGHQ.js";import{a as Ji,b as Yi}from"./chunk-CPZFJYCU.js";import{a as Nt}from"./chunk-7THL3Y32.js";import{E as Y,H as pn,L as _n,V as Qt,b as an,d as rn,g as ln,h as sn,q as dn}from"./chunk-WPRT4K6N.js";import"./chunk-GNCYTUDV.js";import{a as ye}from"./chunk-AQ7PSC44.js";import{a as qi,b as Lt,c as ke,d as Wi,e as Qe}from"./chunk-BZPCOA7E.js";import"./chunk-7DNSNCTX.js";import"./chunk-Y5QHNG76.js";import"./chunk-5DBVKRPS.js";import"./chunk-SV6HILEX.js";import"./chunk-AVG3WWNI.js";import"./chunk-4QTXSGWG.js";import"./chunk-ZE7JEIUT.js";import"./chunk-6MSUZAYQ.js";import{a as Mi,b as be}from"./chunk-A6BWWNTH.js";import{a as Gi}from"./chunk-TL42QQNS.js";import{a as He}from"./chunk-JNYVZYJ4.js";import{a as En}from"./chunk-6TYCFI4G.js";import{a as fn,b as Cn,e as tt,j as vn}from"./chunk-QTN6CETX.js";import"./chunk-GBJZUMIE.js";import"./chunk-NDM5632L.js";import"./chunk-ERDG3YQD.js";import"./chunk-ALA2R7EV.js";import{a as et}from"./chunk-ZXLY5T4Y.js";import{a as kt}from"./chunk-YGH5DAT5.js";import"./chunk-B33GVRO2.js";import{a as kn}from"./chunk-TT7KELWJ.js";import{a as Ze}from"./chunk-3ULIYWL6.js";import{a as un,b as xn}from"./chunk-Q4MQTTKL.js";import{b as en}from"./chunk-LKIAXD6G.js";import"./chunk-QAOKN53P.js";import"./chunk-7IAA4VLQ.js";import{a as on}from"./chunk-QKODQHUE.js";import{a as mn}from"./chunk-VYUQRSNG.js";import{a as cn}from"./chunk-OYGM7DME.js";import"./chunk-QOOM4IJQ.js";import"./chunk-WERSRGK2.js";import"./chunk-MJAW66WA.js";import"./chunk-5V6CGZB6.js";import"./chunk-U42M2UDL.js";import"./chunk-KN727XMG.js";import"./chunk-T7Z4AMLI.js";import"./chunk-5VFPQPYC.js";import"./chunk-JILTLMIZ.js";import"./chunk-DLZSNDPV.js";import"./chunk-FQ5Z4AI7.js";import{a as Ht}from"./chunk-ZQQTRF6E.js";import"./chunk-AIJA2BLZ.js";import{a as nn}from"./chunk-SBWMP37V.js";import{a as Ki,b as zi}from"./chunk-3LC6WUK4.js";import"./chunk-Y2SACVAR.js";import"./chunk-3VPO4ZKE.js";import"./chunk-RXKCASCS.js";import"./chunk-NUXDYLT4.js";import"./chunk-JIIZYIHB.js";import"./chunk-GBMNCAKO.js";import"./chunk-PMV5UJBD.js";import{b as Ut}from"./chunk-EL7A36AS.js";import{a as Xe}from"./chunk-JOKOC2WT.js";import{a as Qi,b as Rt}from"./chunk-AIHLEMCN.js";import{c as Xi}from"./chunk-U4BPK6O4.js";import"./chunk-TJVD6GVN.js";import"./chunk-JMK6MVHG.js";import{a as Zi}from"./chunk-E2NUWJAL.js";import"./chunk-5SGE6NEO.js";import{a as Ft}from"./chunk-E6N4NTHZ.js";import"./chunk-TCOJAZWD.js";import"./chunk-K3Z54U74.js";import"./chunk-YAGWJNOX.js";import"./chunk-YUAEW6DN.js";import{a as Ue}from"./chunk-4KEXHIKN.js";import"./chunk-NSZJCKIU.js";import"./chunk-QHX2QRDK.js";import{a as Ye,d as At}from"./chunk-CHSTJ4UU.js";import{b as Ai}from"./chunk-JZNF4MYL.js";import{a as Li}from"./chunk-7REE6FCH.js";import"./chunk-PUZPIDVM.js";import{a as Mt}from"./chunk-FO6RSKI7.js";import"./chunk-SBOAMFMP.js";import"./chunk-FUSUZSLZ.js";import{a as ve,b as ge}from"./chunk-QH3HH3BG.js";import"./chunk-HOAY7V7Z.js";import"./chunk-J7BDNTS3.js";import"./chunk-F5MWH2WG.js";import{e as J}from"./chunk-FBL7G3LD.js";import"./chunk-LFCV52ZK.js";import"./chunk-VDTICQXI.js";import"./chunk-NNVD6EWQ.js";import{a as Vi}from"./chunk-UFSACXCI.js";import{a as Fi}from"./chunk-262EJ3PM.js";import"./chunk-KJSAPWO5.js";import{a as Vt}from"./chunk-Z3YKIM2G.js";import{a as Ot}from"./chunk-6LVG3AJL.js";import"./chunk-HMWANN7P.js";import"./chunk-LLCQLQX7.js";import{a as Ui,b as Hi}from"./chunk-MK5M43RY.js";import"./chunk-DFMU7OPD.js";import"./chunk-YU3UZ3YG.js";import"./chunk-VXDIBCKO.js";import"./chunk-3FMJ2IGL.js";import"./chunk-Z4N5M7GF.js";import{a as ji}from"./chunk-GWCGR7FC.js";import"./chunk-KH6EL23Q.js";import{a as Bi}from"./chunk-77CBT5G6.js";import"./chunk-D6XIV6DQ.js";import"./chunk-QFIH6JQW.js";import{b as $i}from"./chunk-4WYIJOHJ.js";import{b as Oi}from"./chunk-53QJVJEJ.js";import"./chunk-3CNNJAIH.js";import"./chunk-PVZ5E6C4.js";import"./chunk-5OL2QAZ4.js";import{a as Ri,b as Ni}from"./chunk-AHHG7NNI.js";import{c as Je}from"./chunk-V6HUKMMQ.js";import"./chunk-535XSUHN.js";import"./chunk-2OEDVHTN.js";import{a as Fe}from"./chunk-F5WFXET3.js";import{a as Ii}from"./chunk-DONAAPX5.js";import"./chunk-63QLPR5K.js";import"./chunk-UU232UL2.js";import"./chunk-7MWVCLDY.js";import"./chunk-XWD65C7E.js";import"./chunk-MW5RTTXB.js";import"./chunk-Q5EBYCLM.js";import"./chunk-4QPQIRMU.js";import"./chunk-EOVJRDAN.js";import"./chunk-FILO7TIS.js";import{a as ze}
1from"./chunk-75OA7QS4.js";import"./chunk-CSCP3ZTJ.js";import{a as qe,b as We}from"./chunk-MTSAZTVR.js";import"./chunk-ASETCLUR.js";import"./chunk-WNQ4N7RJ.js";import{b as fe}from"./chunk-7MEILHIE.js";import{a as K}from"./chunk-G4XKTR23.js";import{c as Yt}from"./chunk-ZWLUA43H.js";import"./chunk-HXDZ72GQ.js";import"./chunk-H2UYTWBE.js";import{a as Ei}from"./chunk-32LAIJWW.js";import"./chunk-NRJNLGPZ.js";import{b as It}from"./chunk-FJNY3YCS.js";import"./chunk-42KLYNQJ.js";import"./chunk-LMPIDVVC.js";import{a as Ti}from"./chunk-O4S5RAMO.js";import{k as Ge,l as wi,m as Ke}from"./chunk-7RIQHS27.js";import"./chunk-UVTFM2CB.js";import"./chunk-PD73N3RP.js";import"./chunk-3UUSYTLR.js";import"./chunk-KWU7YDJI.js";import"./chunk-KQNYRKYJ.js";import{a as je}from"./chunk-FSFJIT6H.js";import"./chunk-RVYBXY7M.js";import{a as wt}from"./chunk-6CGN4C4Z.js";import"./chunk-SKOPRTU6.js";import{c as Ce,d as he}from"./chunk-SMTOFR4W.js";import{c as Le}from"./chunk-7CA2QT7E.js";import"./chunk-VRQJEEON.js";import{a as yt,b as St}from"./chunk-DJAISFD4.js";import{a as Be,b as $e}from"./chunk-QBG2AFW3.js";import"./chunk-E3YEN5V4.js";import"./chunk-V6Z2JOJI.js";import"./chunk-GP2Y5EBK.js";import{a as Pt,b as Tt}from"./chunk-QWBQW4TP.js";import{a as Dt}from"./chunk-2IY6D564.js";import{A as Pi,E as ie,d as De,f as we,g as Ie,i as ht,k as Z,m as Me,p as vt,s as Ve,t as Ae,v as mi,y as Oe}from"./chunk-BL5X7LEL.js";import"./chunk-USTFUPXV.js";import{Uc as Et,eh as z,fh as q,gh as W,jb as ne,kb as oe}from"./chunk-NCNN7TJ7.js";import{a as R}from"./chunk-BHJUQJ35.js";import"./chunk-555PDMZK.js";import"./chunk-TSCJWBEN.js";import{f as Re}from"./chunk-WH7NK76V.js";import"./chunk-SGVLNALP.js";import{$h as xe,Ah as gi,Aj as Di,Ch as I,Dh as Ee,Eh as bi,Fe as re,Fh as H,Gh as ue,Hh as Ne,Ih as ee,Ii as Si,Jh as ki,Kh as yi,Lg as S,Lh as G,Mb as f,R as me,U as X,Vi as g,X as Wt,bg as xi,ed as gt,f as $,hg as fi,hi as te,l as _i,lg as Ci,nj as bt,oh as vi,rj as Jt,tj as st,u as j,zg as hi}from"./chunk-O3WROL2M.js";import{$a as ot,A as ni,Aa as se,Ac as d,Bc as _,Cc as w,Dc as M,Hc as de,Ic as pe,Jc as ce,Oc as lt,Pb as m,Rb as u,Sc as Ct,Tb as at,Tc as pi,Ub as P,Uc as ci,Vb as T,Wb as p,Xb as r,Xc as V,Yb as a,Yc as _e,Zb as x,Zc as L,_a as xt,ba as ut,bc as ai,cc as ri,eb as n,fa as b,gc as k,ka as h,kc as C,la as v,mc as l,nb as Se,qc as li,rc as si,sa as U,sc as di,tb as O,ub as ft,wa as oi,xc as rt,yb as F,yc as A,zc as Te}from"./chunk-WMRJX23E.js";import"./chunk-UIGZEDL5.js";import"./chunk-HNIQUNPL.js";import{c as ui}from"./chunk-LJZ7ZJF4.js";import{a as Q,b as mt,h as ii,i as B}from"./chunk-FBFWB55K.js";var In=ii(Pi());var Pn=(t,s)=>s.value,Nn=(t,s)=>s.key;function Fn(t,s){if(t&1){let e=k();r(0,"app-save-cancel-footer",7),C("cancelClick",function(){h(e);let o=l();return v(o.onClosing())})("saveClick",function(){h(e);let o=l();return v(o.save())}),a()}if(t&2){let e=l();p("dirtyForm",e.form)("gaEvent","pickup_drop_save_event")("isOnPopup",!1)("isVisibleHr",!1)("isSaving",e.isSaving)("useSubmitBehavior",!1)("saveText",e.isCreate?"common_schedule":"common_save")("savingText",e.isCreate?"common_scheduling":"saving")}}function Un(t,s){t&1&&x(0,"app-skeleton-loader",5),t&2&&p("rows",7)("columns",2)}function Hn(t,s){t&1&&x(0,"app-business-context-banner",9)}function Bn(t,s){if(t&1&&x(0,"app-server-error",10),t&2){let e=l(2);p("errorResponse",e.errorResponse)("form",e.form)}}function $n(t,s){if(t&1&&(r(0,"span",11),x(1,"i",38),d(2),a()),t&2){let e=l(2);n(2),M("",e.formatMessage("pickup_drop_scheduling_for")," ",e.bookingSourceLabel)}}function jn(t,s){if(t&1){let e=k();r(0,"dx-button",39),C("onClick",function(){let o=h(e).$implicit,c=l(2);return v(c.onTypeToggle(o.value))}),a()}if(t&2){let e,i,o=s.$implicit,c=l(2);p("text",o.text)("icon",o.icon)("type",((e=c.form.get("type"))==null?null:e.value)===o.value?"default":"normal")("stylingMode",((i=c.form.get("type"))==null?null:i.value)===o.value?"contained":"outlined")}}function Gn(t,s){if(t&1){let e=k();r(0,"dx-button",40),C("onClick",function(){let o=h(e).$implicit,c=l(2);return v(c.onModeToggle(o.value))}),a()}if(t&2){let e,i,o=s.$implicit,c=l(2);p("text",o.text)("type",((e=c.form.get("mode"))==null?null:e.value)===o.value?"default":"normal")("stylingMode",((i=c.form.get("mode"))==null?null:i.value)===o.value?"contained":"outlined")}}function Kn(t,s){if(t&1){let e=k();r(0,"app-control-container",19)(1,"dx-select-box",41),C("onValueChanged",function(o){h(e);let c=l(2);return v(c.onLinkedRecordChanged(o.value))}),a()()}if(t&2){let e=l(2);p("label",e.formatMessage("pickup_drop_linked_job")),n(),p("dataSource",e.linkedJobSource)("displayExpr",e.jobDisplay)("searchEnabled",!0)("showClearButton",!0)("placeholder",e.formatMessage("pickup_drop_linked_job_placeholder"))}}function zn(t,s){if(t&1&&(r(0,"app-control-container",19),x(1,"dx-text-box",42),a()),t&2){let e=l(2);p("label",e.formatMessage("pickup_drop_linked_record")),n(),p("value",e.linkedRecordLabel)("readOnly",!0)}}function qn(t,s){t&1&&x(0,"i",49)}function Wn(t,s){t&1&&x(0,"i",50)}function Jn(t,s){if(t&1&&(r(0,"div",52),d(1),V(2,"dateFormat"),a()),t&2){let e=l().$implicit;n(),_(L(2,1,e.at,"datetime"))}}function Yn(t,s){if(t&1&&x(0,"div",53),t&2){let e=l().$implicit;p("ngClass",e.done?"bg-primary":"bg-secondary-subtle")}}function Qn(t,s){if(t&1&&(r(0,"div",47)(1,"span",48),m(2,qn,1,0,"i",49)(3,Wn,1,0,"i",50),a(),r(4,"div",51),d(5),a(),m(6,Jn,3,4,"div",52),a(),m(7,Yn,1,1,"div",53)),t&2){let e=s.$implicit,i=s.$index,o=s.$count;n(),p("ngClass",e.done?"bg-primary border-primary text-white":e.current?"border-primary text-primary":"border-secondary-subtle text-muted"),n(),u(e.done?2:e.current?3:-1),n(2),p("ngClass",e.done||e.current?"fw-semibold":"text-muted"),n(),_(e.label),n(),u(e.at?6:-1),n(),u(i!==o-1?7:-1)}}function Xn(t,s){if(t&1&&(r(0,"div",46),P(1,Qn,8,6,null,null,Nn),a()),t&2){let e=l(3);n(),T(e.statusSteps)}}function Zn(t,s){if(t&1&&(r(0,"div",20)(1,"div",43)(2,"span",44),d(3),a(),x(4,"app-pickup-drop-status-tag",45),a(),m(5,Xn,3,0,"div",46),a()),t&2){let e=l(2);n(3),w("",e.formatMessage("common_status"),":"),n(),p("status",e.pickupDrop==null?null:e.pickupDrop.status)("type",e.pickupDrop==null?null:e.pickupDrop.type),n(),u(e.statusSteps.length?5:-1)}}function eo(t,s){if(t&1){let e=k();r(0,"app-control-container",21)(1,"app-party-selector",54),C("itemClick",function(o){h(e);let c=l(2);return v(c.onCustomerSelect(o))}),a()()}if(t&2){let e,i=l(2);p("errorMsg",i.formatMessage("common_error_messages_customer_required"))("label",i.counterpartyLabel),n(),p("customerId",i.form.getRawValue().id?(e=i.form.getRawValue())==null?null:e.user_id:null)("entity",i.ENTITIES.PICKUP_DROP.name)("formControl",i.form.controls.user_id
1)("isCardLayout",!0)("isEditMode",!0)("isRequiredAddress",!0)("isVisibleAddAction",!0)}}function to(t,s){if(t&1&&(r(0,"app-control-container",26),x(1,"dx-text-box",55),a()),t&2){let e=l(2);p("label",e.formatMessage("common_parts")),n(),p("value",e.partsText)("readOnly",!0)("placeholder",e.formatMessage("pickup_drop_sale_parts_hint"))}}function io(t,s){if(t&1&&x(0,"dxi-button",57),t&2){let e=l(3);p("options",e.addDeviceTypeOption)}}function no(t,s){if(t&1&&(r(0,"app-control-container",27)(1,"dx-select-box",56),m(2,io,1,1,"dxi-button",57),a()()),t&2){let e=l(2);p("errorMsg",e.formatMessage("device_type_required_warning"))("label",e.formatMessage("device_type_name")),n(),p("noDataText",e.formatMessage("common_no_options_add_new"))("dataSource",e.deviceTypes)("placeholder",e.formatMessage("placeholder_select_device_type_pickup")),n(),u(e.canInlineCreate(e.ENTITIES.DEVICE_TYPE.name)?2:-1)}}function oo(t,s){if(t&1&&(r(0,"small",30),x(1,"i",58),d(2),a()),t&2){let e=l(2);n(2),M("",e.formatMessage("pickup_drop_arrival_window"),": ",e.windowLabel)}}function ao(t,s){if(t&1){let e=k();r(0,"app-control-container",31)(1,"dx-button",59),C("onClick",function(){h(e);let o=l(2);return v(o.suggestNearest())}),a(),x(2,"app-employee-dropdown",60),a()}if(t&2){let e=l(2);p("errorMsg",e.formatMessage("common_assignee_required"))("label",e.formatMessage("common_assignee"))("tooltipText","pickup_assigned_user_id"),n(),p("text",e.formatMessage("pickup_drop_suggest_nearest")),n(),p("entity",e.entity)}}function ro(t,s){if(t&1&&(r(0,"app-control-container",61),x(1,"dx-select-box",62),a(),r(2,"app-control-container",63),x(3,"dx-text-box",64),a()),t&2){let e=l(2);p("label",e.formatMessage("delivery_provider_label")),n(),p("dataSource",e.deliveryProviders)("placeholder",e.formatMessage("delivery_provider_placeholder")),n(),p("label",e.formatMessage("common_tracking_id")),n(),p("placeholder",e.formatMessage("delivery_placeholder_tracking_id"))}}function lo(t,s){t&1&&x(0,"app-section-title",12),t&2&&p("title","pickup_drop_charges_notifications")}function so(t,s){if(t&1&&x(0,"dxi-button",57),t&2){let e=l(4);p("options",e.addTaxOption)}}function po(t,s){if(t&1&&(r(0,"app-control-container",71)(1,"dx-select-box",72),m(2,so,1,1,"dxi-button",57),a()()),t&2){let e=l(3);p("label",e.formatMessage("common_tax")),n(),p("noDataText",e.formatMessage("common_no_options_add_new"))("dataSource",e.taxes)("displayExpr",e.taxDisplay)("showClearButton",!0)("placeholder",e.formatMessage("common_tax")),n(),u(e.canCreateTax()?2:-1)}}function co(t,s){if(t&1&&x(0,"app-switch-btn",73),t&2){let e=l(3);p("isEditMode",!0)("label",e.formatMessage("pickup_drop_charge_tax_inclusive"))}}function _o(t,s){if(t&1&&(r(0,"span",70),d(1),x(2,"app-money",74),a()),t&2){let e=l(3);n(),w("",e.formatMessage("total"),": "),n(),p("value",e.chargeTotal)}}function mo(t,s){if(t&1&&(r(0,"app-control-container",65),x(1,"dx-number-box",66),a(),F(2,po,3,7,"app-control-container",67),r(3,"div",68),F(4,co,1,2,"app-switch-btn",69),m(5,_o,3,2,"span",70),a()),t&2){let e,i=l(2);p("label",i.formatMessage("pickup_drop_transport_charge")),n(),p("min",0)("placeholder",i.formatMessage("pickup_drop_transport_charge")),n(4),u((e=i.form.get("charges"))!=null&&e.value?5:-1)}}function uo(t,s){if(t&1&&x(0,"app-user-notification-channel",36),t&2){let e=l(2);p("form",e.form)}}function xo(t,s){if(t&1){let e=k();r(0,"div",37)(1,"app-save-cancel-footer",75),C("cancelClick",function(){h(e);let o=l(2);return v(o.onClosing())}),a()()}if(t&2){let e=l(2);n(),p("dirtyForm",e.form)("gaEvent","pickup_drop_save_event")("isOnPopup",!0)("confirmOnCancel",!0)("isVisibleHr",!1)("isSaving",e.isSaving)("saveText",e.isCreate?"common_schedule":"common_save")("savingText",e.isCreate?"common_scheduling":"saving")}}function fo(t,s){if(t&1){let e=k();r(0,"form",8),C("ngSubmit",function(){h(e);let o=l();return v(o.save())}),m(1,Hn,1,0,"app-business-context-banner",9),m(2,Bn,1,2,"app-server-error",10),m(3,$n,3,2,"span",11),x(4,"app-section-title",12),r(5,"div",13)(6,"app-control-container",14)(7,"div",15),P(8,jn,1,4,"dx-button",16,Pn),a()(),r(10,"app-control-container",17)(11,"div",15),P(12,Gn,1,3,"dx-button",18,Pn),a()(),m(14,Kn,2,6,"app-control-container",19),m(15,zn,2,3,"app-control-container",19),m(16,Zn,6,4,"div",20),a(),x(17,"app-section-title",12),r(18,"div",13),m(19,eo,2,9,"app-control-container",21),r(20,"app-control-container",22)(21,"app-restricted-content",23),x(22,"app-mobile-number",24)(23,"app-error",25),a()(),m(24,to,2,4,"app-control-container",26)(25,no,3,6,"app-control-container",27),a(),x(26,"app-section-title",12),r(27,"div",13)(28,"app-control-container",28),x(29,"dx-date-box",29)(30,"app-error",25),m(31,oo,3,2,"small",30),a(),m(32,ao,3,5,"app-control-container",31),m(33,ro,4,5),a(),x(34,"app-section-title",12)(35,"app-address",32),m(36,lo,1,1,"app-section-title",12),r(37,"div",13),m(38,mo,6,4),r(39,"app-control-container",33)(40,"app-quick-reply-dropdown",34),C("itemClick",function(o){h(e);let c=l();return v(c.quickReplyValue(o))}),a(),x(41,"app-textarea",35),a()(),m(42,uo,1,1,"app-user-notification-channel",36),m(43,xo,2,8,"div",37),a()}if(t&2){let e=l();p("formGroup",e.form),n(),u(e.isCreate?1:-1),n(),u(e.errorResponse?2:-1),n(),u(e.bookingSourceLabel?3:-1),n(),p("title","pickup_drop_type_status"),n(2),p("label",e.formatMessage("common_type")),n(2),T(e.visibleTypeToggleItems),n(2),p("label",e.formatMessage("pickup_drop_mode")),n(2),T(e.modeList),n(2),u(e.bookingSource===e.ENTITIES.JOB.name&&e.linkedJobSource?14:-1),n(),u(e.showPartsField?15:-1),n(),u(e.form.getRawValue().id&&e.isEmployee?16:-1),n(),p("title","pickup_drop_customer_device"),n(2),u(e.isEmployee?19:-1),n(),p("errorMsg",e.formatMessage("common_mobile_number_required"))("label",e.formatMessage("common_mobile")),n(),p("applyLock",!1)("permission",e.PERMISSION_LIST.CUSTOMER_VIEW_CONTACT_INFORMATION),n(),p("formControl",e.form.controls.mobile_number)("form",e.form),n(),p("displayError",e.form.get("mobile_number").invalid&&e.form.get("mobile_number").touched&&e.form.get("mobile_number").errors.invalidPhoneNumber)("errorMsg",e.formatMessage("common_invali
1d_mobile")),n(),u(e.showPartsField?24:25),n(2),p("title","pickup_drop_schedule_assignment"),n(2),p("errorMsg",e.formatMessage("common_error_messages_date_required"))("label",e.formatMessage("common_schedule_on")),n(),p("dateSerializationFormat",e.DATETIME_SERIALIZATION_FORMAT)("displayFormat",e.tenantService.dxDateTimeFormat())("disabledDates",e.disabledDates)("min",e.today)("placeholder",e.formatMessage("common_select_from_calendar")),n(),p("displayError",e.form.get("scheduled_on").invalid&&e.form.get("scheduled_on").touched&&e.form.controls.scheduled_on.getError("outsideBusinessHours"))("errorMsg",e.form.controls.scheduled_on.getError("outsideBusinessHours")),n(),u(e.windowLabel?31:-1),n(),u(e.isEmployee&&!e.isCourier?32:-1),n(),u(e.isCourier?33:-1),n(),p("title","user_address_details"),n(),p("hideHeader",!0)("isAddressOptional",!1)("parentForm",e.form),n(),u(e.enableCharges?36:-1),n(2),u(e.enableCharges?38:-1),n(),p("errorMsg",e.formatMessage("common_error_messages_description_required"))("label",e.formatMessage("common_description")),n(2),p("formControl",e.form.controls.comment)("quickReply",e.quickReply),n(),u(e.isEmployee?42:-1),n(),u(e.isMobileDevice?43:-1)}}var ct=(()=>{class t{canInlineCreate(e){return this.inlineCreateService.canCreate(e)}canCreateTax(){return this.inlineCreateService.canCreate(g.TAX.name)}get isMobileDevice(){return this.userDeviceService.isMobileDevice()}constructor(e,i,o,c,y,D){this.service=e,this.deviceTypeService=i,this.customerService=o,this.deliveryProviderService=c,this.jobService=y,this.taxService=D,this.inlineCreateService=b(Ft),this.addDeviceTypeOption=this.inlineCreateService.buttonOptions({entity:g.DEVICE_TYPE.name,onCreated:E=>{this.deviceTypes=[E,...this.deviceTypes??[]],this.form?.patchValue({device_type_id:E.id})}}),this.addTaxOption=this.inlineCreateService.buttonOptions({entity:g.TAX.name,onCreated:E=>{this.taxes=[E,...this.taxes??[]],this.form?.patchValue({tax_id:E.id})}}),this.formatMessage=f,this.entityCreatedService=b(Cn),this.isVisiblePopup=!1,this.isCreate=!0,this.pickupDropSaveClick=new U,this.pickupDropCancelClick=new U,this.ENTITIES=g,this.generalSettingDataService=b(wt),this.geoLocationService=b(ye),this.formService=b(Ge),this.router=b(X),this.userSessionService=b(fe),this.tenantService=b(ie),this.activatedRouter=b(me),this.userDeviceService=b(Re),this.toastNotificationService=b(R),this.saleService=b(tt),this.purchaseService=b(Bt),this.today=this.tenantService.today(),this.isEmployee=this.userSessionService.isEmployee(),this.currentUser=this.userSessionService.currentUser(),this.SETTINGS=gi,this.DATETIME_SERIALIZATION_FORMAT=gt,this.entity=g.PICKUP_DROP,this.pickupDropList=I,this.pickupDropToggleItems=[{value:I[0].text,text:f("pickup_drop_type_pickup"),icon:"fa-thin fa-arrow-up-from-bracket"}
1,{value:I[1].text,text:f("pickup_drop_type_drop"),icon:"fa-thin fa-arrow-down-to-bracket"}],this.visibleTypeToggleItems=this.pickupDropToggleItems,this.modeList=bi.map(E=>({value:E.value,text:f(E.text)})),this.isSaving=!1,this.deliveryProviders=[],this.customerId=null,this.isBusinessHourSet=oi(this.generalSettingDataService.getGeneralSettingByKey(this.SETTINGS.GENERAL_SETTINGS.ENABLE_BUSINESS_HOURS)),this.disabledDates=Mi.getDisabledDates(this.isBusinessHourSet(),this.tenantService?.config()?.business_hours),this.PERMISSION_LIST=xe,this.bookingSource=null,this.linkableId=null,this.linkedRecordLabel=null,this.partsText=null,this.useTimeWindow=this.isSettingOn(G.USE_TIME_WINDOW),this.windowMinutes=+this.generalSettingDataService.getGeneralSettingByKey(G.DEFAULT_WINDOW_MINUTES)||60,this.enableCharges=this.isSettingOn(G.ENABLE_CHARGES),this.chargeDefaultTaxId=+this.generalSettingDataService.getGeneralSettingByKey(G.CHARGE_DEFAULT_TAX_ID)||null,this.chargeTaxInclusive=this.isSettingOn(G.CHARGE_TAX_INCLUSIVE),this.taxes=[],this.SOURCE_LABEL={[g.JOB.name]:"pickup_drop_source_job",[g.CONTACT_US.name]:"pickup_drop_source_self_checkin",[g.SALE.name]:"pickup_drop_source_sale",[g.PURCHASE.name]:"pickup_drop_source_purchase",[g.OUTSOURCED_JOB.name]:"pickup_drop_source_outsource"},this.SOURCE_DIRECTION={[g.CONTACT_US.name]:I[0].text,[g.PURCHASE.name]:I[0].text,[g.SALE.name]:I[1].text,[g.OUTSOURCED_JOB.name]:I[1].text},this.KNOWN_SOURCES=[g.JOB.name,g.CONTACT_US.name,g.SALE.name,g.PURCHASE.name,g.OUTSOURCED_JOB.name]}get isCourier(){return this.form?.get("mode")?.value===Ee.COURIER}ngOnInit(){this.deviceTypeService.getList().subscribe({next:i=>{this.deviceTypes=i},error:i=>{console.error(i)}}),this.deliveryProviderService.getListByQuery().subscribe({next:i=>{this.deliveryProviders=i,this.applyDefaultProvider()},error:i=>{console.error(i)}}),this.enableCharges&&this.taxService.getAll().subscribe({next:i=>{this.taxes=i},error:i=>{console.error(i)}});let e=this.activatedRouter.snapshot.paramMap.get("id");e?(this.isCreate=!1,this.service.getById(+e).subscribe({next:i=>{this.pickupDrop=new be(i),this.initForm()},error:i=>{this.toastNotificationService.error("notification_pickup_drop_not_found"),this.router.navigate(["/pickupDrops/list"])}})):(this.isCreate=!0,this.initForm())}initForm(){this.customerId=+this.activatedRouter.snapshot.paramMap.get("customer_id")||+this.activatedRouter.snapshot.queryParamMap.get("customer_id"),!this.customerId&&!this.isEmployee&&(this.customerId=this.currentUser.id),this.form=be.getForm(new be(this.isCreate?{}:this.pickupDrop),this.isBusinessHourSet(),this.tenantService?.config()?.business_hours),this.form.contains("linkable_type")||(this.form.addControl("linkable_type",new Z(this.pickupDrop?.linkable_type||null)),this.form.addControl("linkable_id",new Z(this.pickupDrop?.linkable_id||null))),!this.isCreate&&this.pickupDrop?.destination_lat&&this.pickupDrop?.destination_lng&&(this.coordinates={lat:+this.pickupDrop.destination_lat,lng:+this.pickupDrop.destination_lng});let e=this.pickupDrop?.items?.[0]?.device_type?.id??this.pickupDrop?.items?.[0]?.device_type_id??this.pickupDrop?.device_type?.id??this.pickupDrop?.device_type_id;!this.isCreate&&e&&this.form.patchValue({device_type_id:e}),this.enableCharges&&!this.form.contains("charges")&&(this.form.addControl("charges",new Z(this.pickupDrop?.charges||null)),this.form.addControl("tax_id",new Z(this.pickupDrop?.tax_id??(this.isCreate?this.chargeDefaultTaxId:null))),this.form.addControl("is_rate_including_tax",new Z(this.isCreate?this.chargeTaxInclusive:!!this.pickupDrop?.is_rate_including_tax))),this.customerId&&this.customerService.getById(this.customerId).subscribe({next:i=>{this.form.patchValue({user_id:this.customerId,mobile_number:i.mobile_number,mobile_country_code:i.mobile_country_code}),this.applyCustomerAddress(i,!1),this.form.get("user_id").disable()},error:i=>{console.error(i)}}),this.isCreate?this.applyBookingSource():this.bookingSource=this.pickupDrop?.linkable_type??null,this.applyStructuredAddress(),this.applyTypeToggleFilter(),this.setupPartsField()}applyStructuredAddress(){let e=this.form.get("address")?.value,i=typeof e=="string"?Wi(e):{},o=Ye.getForm(new Ye(i),!1);o.get("address_line").setValidators(De.required),this.form.setControl("address",o)}applyBookingSource(){let e=this.activatedRouter.snapshot.queryParamMap;this.bookingSource=e.get("source");let i=this.SOURCE_DIRECTION[this.bookingSource];i&&this.form.patchValue({type:i}),this.linkableId=+e.get("linkableId")||null,this.KNOWN_SOURCES.includes(this.bookingSource)&&this.linkableId&&this.form.patchValue({linkable_type:this.bookingSource,linkable_id:this.linkableId}),this.bookingSource===g.JOB.name&&(this.linkedJobSource=new Vt({key:"id",paginate:!0,pageSize:Ci,load:o=>{let c=o.take||25,y=o.skip||0;return this.jobService.getJobListByQuery({search_term:o.searchValue??"",per_page:c,page:Math.floor(y/c)+1}).toPromise().then(D=>{let E=Array.isArray(D)?D:D?.data??[];return{data:E,totalCount:Array.isArray(D)?E.length:D?.total}})},byKey:o=>this.jobService.getById(o).toPromise()}))}setupPartsField(){if(!this.showPartsField)return;let e=this.form.get("device_type_id");e?.clearValidators(),e?.updateValueAndValidity(),this.form.contains("parts")||this.form.addControl("parts",new Z([]));let i=this.linkableId??this.pickupDrop?.linkable_id??null;if(!i)return;(this.bookingSource===g.SALE.name?this.saleService.getById(i):this.purchaseService.getById(i)).subscribe({next:c=>{this.linkedRecordLabel=this.bookingSource===g.SALE.name?c?.sale_number??null:c?.purchase_number??null;let y=c?.partables??[],D=new Set,E=[];for(let ae of y)ae?.part_id&&!D.has(ae.part_id)&&(D.add(ae.part_id),E.push(ae.name));this.partsText=E.join(", ")},error:c=>{console.error(c)}})}jobDisplay(e){if(!e)return"";let i=e.formatted_job_number||e.job_number||"#"+e.id;return e.user?.name?i+" \xB7 "+e.user.name:i}taxDisplay(e){return e?e.name+" ("+e.rate+"%)":""}onTypeToggle(e){e&&this.form.patchValue({type:e})}onModeToggle(e){e&&(this.form.patchValue({mode:e}),this.applyDefaultProvider())}
1applyDefaultProvider(){if(!this.isCourier||!this.deliveryProviders.length||this.form?.get("provider_id")?.value)return;let e=this.deliveryProviders.find(i=>i.name?.toLowerCase()===vi.SHIPROCKET.toLowerCase());this.form.patchValue({provider_id:(e??this.deliveryProviders[0]).id})}onLinkedRecordChanged(e){this.form.patchValue({linkable_id:e||null,linkable_type:e?this.bookingSource:null})}get chargeTotal(){let e=+this.form?.get("charges")?.value||0;if(!e)return 0;let i=this.taxes.find(o=>o.id===this.form?.get("tax_id")?.value)?.rate||0;return this.form?.get("is_rate_including_tax")?.value?+e.toFixed(2):+(e+e*i/100).toFixed(2)}get counterpartyLabel(){return this.bookingSource===g.PURCHASE.name?f("common_supplier"):this.bookingSource===g.OUTSOURCED_JOB.name?f("pickup_drop_vendor"):f("common_customer")}applyTypeToggleFilter(){this.bookingSource===g.PURCHASE.name?this.visibleTypeToggleItems=this.pickupDropToggleItems.filter(e=>e.value===I[0].text):this.bookingSource===g.SALE.name&&(this.visibleTypeToggleItems=this.pickupDropToggleItems.filter(e=>e.value===I[1].text))}get showPartsField(){return this.bookingSource===g.SALE.name||this.bookingSource===g.PURCHASE.name}isSettingOn(e){let i=this.generalSettingDataService.getGeneralSettingByKey(e);return i===!0||i==="true"||i===1||i==="1"}get bookingSourceLabel(){let e=this.SOURCE_LABEL[this.bookingSource];return e?f(e):""}get pageTitle(){return this.isCreate?f("create_new_pickup_drop"):f("common_edit")+" PD-"+(this.pickupDrop?.id??"")}get tenantTimeFormat(){return(hi.find(i=>i.id===this.tenantService?.config()?.date_time_format)?.format??fi).match(/(hh|HH):mm(:ss)?(\s*A)?/i)?.[0]??"hh:mm A"}get windowLabel(){let e=this.form?.get("scheduled_on")?.value;if(!this.useTimeWindow||!e)return"";let i=new Date(e);if(isNaN(i.getTime()))return"";let o=new Date(i.getTime()+this.windowMinutes*6e4),c=y=>(0,In.default)(y).format(this.tenantTimeFormat);return c(i)+" \u2013 "+c(o)}onClosing(){this.form?.reset(),this.pickupDrop=null,this.router.navigate(["pickupDrops/list"])}get addressText(){let e=this.form.getRawValue()?.address;return e&&typeof e=="object"?Lt(e):ke(e)}ensureDestinationCoordinates(e){return B(this,null,function*(){if(!(e.destination_lat&&e.destination_lng||!e.address))try{let i=yield this.geoLocationService.getAddressCoordinates(e.address);e.destination_lat=i.lat,e.destination_lng=i.lng}catch(i){}})}openEntityCreated(){this.entityCreatedService.show({config:fn[g.PICKUP_DROP.name],entityId:this.pickupDrop?.id,summary:[{label:f("job_name"),value:this.pickupDrop?.job?.job_number},{label:f("common_customer"),value:this.pickupDrop?.job?.user?.name}].filter(e=>!!e.value)})}save(){return B(this,null,function*(){if(this.form.valid){this.isSaving=!0;let e=mt(Q({},this.form.getRawValue()),{address:this.addressText});yield this.ensureDestinationCoordinates(e);let i=e.id?this.service.update(e):this.service.create(e),o=e.id;i.subscribe({next:c=>{o?this.toastNotificationService.success("notification_pickup_drop_update_success"):this.toastNotificationService.success("notification_pickup_schedule_success"),this.pickupDrop=new be(c),this.isVisiblePopup=!1,this.pickupDropSaveClick.emit(this.pickupDrop),o?this.router.navigate(["/pickupDrops/details",o]):this.openEntityCreated()},error:()=>{this.isSaving=!1,this.toastNotificationService.error("notification_pickup_schedule_error")},complete:()=>{this.isSaving=!1}})}else this.formService.validateFormFields(this.form)})}suggestNearest(){return B(this,null,function*(){if((!this.coordinates?.lat||!this.coordinates?.lng)&&(yield this.resolveCoordinatesFromAddress()),!this.coordinates?.lat||!this.coordinates?.lng){this.toastNotificationService.error("pickup_drop_select_address_for_nearest");return}this.service.getNearestExecutive(this.coordinates.lat,this.coordinates.lng).subscribe({next:e=>{let i=e?.[0];i?.user?.id?(this.form.patchValue({assigned_user_id:i.user.id}),this.toastNotificationService.success("pickup_drop_nearest_assigned")):this.toastNotificationService.info("pickup_drop_no_nearby_executive")},error:()=>this.toastNotificationService.error("common_something_went_wrong")})})}stepLabel(e){return f("pickup_drop_track_step_"+e)}get statusSteps(){let e=S,i=this.pickupDrop;if(this.isCreate||!i)return[];let o=i.mode===Ee.COURIER?[e.SCHEDULED,e.ASSIGNED,e.IN_TRANSIT,e.COMPLETED]:[e.SCHEDULED,e.ASSIGNED,e.EN_ROUTE,e.ARRIVED,e.COMPLETED],c={[e.SCHEDULED]:i.scheduled_on??i.created_at,[e.EN_ROUTE]:i.en_route_at,[e.IN_TRANSIT]:i.en_route_at,[e.ARRIVED]:i.arrived_at,[e.COMPLETED]:i.completed_at},y=o.indexOf(i.status?.name);return o.map((D,E)=>({key:D,label:this.stepLabel(D),done:y>=0?E<y:!!c[D],current:E===y,at:c[D]}))}resolveCoordinatesFromAddress(){return B(this,null,function*(){let e=this.addressText;if(e)try{this.coordinates=yield this.geoLocationService.getAddressCoordinates(e)}catch(i){}})}onCustomerSelect(e){e&&(this.form.patchValue({mobile_number:e?.mobile_number,mobile_country_code:e?.mobile_country_code}),this.applyCustomerAddress(e))}applyCustomerAddress(e,i=!0){let o=this.form.get("address");if(o instanceof ht){let y=e?.address_line?e:e?.address;if(!y?.address_line||!i&&o.get("address_line").value)return;o.patchValue({address_line:y.address_line??null,city:y.city??null,state:y.state??null,zip_code:y.zip_code??null});return}let c=this.customerAddressText(e);c&&(i||!o?.value)&&this.form.patchValue({address:c})}customerAddressText(e){let i=e?.address_line?e:e?.address;return i?.address_line?qi(i):""}quickReplyValue(e){this.quickReply=xn(e),this.form.patchValue({comment:this.quickReply})}static{this.\u0275fac=function(i){return new(i||t)(Se(N),Se(Mt),Se(bt),Se(hn),Se(Ze),Se(mn))}}static{this.\u0275cmp=O({type:t,selectors:[["app-pickup-and-drop-detail"]],inputs:{isVisiblePopup:"isVisiblePopup",isCreate:"isCreate",pickupDrop:"pickupDrop"},outputs:{pickupDropSaveClick:"pickupDropSaveClick",pickupDropCancelClick:"pickupDropCancelClick"},decls:8,vars:7,consts:[[1,"container-fluid","app-workspace"],["entityLabel","pickup_drop",3,"mobileHeaderOnly","recordTitle","isEditing"],["heading","",1,"fs-page-title","fw-semibold"],["ngProjectAs","[actions]",5,["","actions",""]],[3,"dirtyForm","gaEvent","isOnPopup","isVisibleHr","isSaving","useSubmitBehavior","saveText","savingText"],["type","form",3,"rows","columns"],[3,"formGroup"],[3,"cancelClick","
1saveClick","dirtyForm","gaEvent","isOnPopup","isVisibleHr","isSaving","useSubmitBehavior","saveText","savingText"],[3,"ngSubmit","formGroup"],["entity","pickup_drop"],[1,"mb-2",3,"errorResponse","form"],[1,"badge","rounded-pill","theme-badge","px-3","py-2","mb-2"],[1,"mt-3",3,"title"],[1,"row"],["name","type",1,"col-sm-6","col-md-6","col-lg-6",3,"label"],[1,"d-flex","align-items-center","gap-2","flex-wrap"],[3,"text","icon","type","stylingMode"],["name","mode",1,"col-sm-6","col-md-6","col-lg-6",3,"label"],[3,"text","type","stylingMode"],["name","linkable_id",1,"col-sm-6","col-md-6","col-lg-6",3,"label"],[1,"col-12","mt-2"],["name","user_id",1,"col-12","col-md-6",3,"errorMsg","label"],["name","mobile_number",1,"col-sm-6","col-md-6","col-lg-6",3,"errorMsg","label"],[3,"applyLock","permission"],[3,"formControl","form"],[3,"displayError","errorMsg"],["name","parts",1,"col-sm-6","col-md-6","col-lg-6",3,"label"],["name","device_type_id",1,"col-sm-6","col-md-6","col-lg-6",3,"errorMsg","label"],["name","scheduled_on",1,"col-sm-6","col-md-6","col-lg-6",3,"errorMsg","label"],["formControlName","scheduled_on","type","datetime",3,"dateSerializationFormat","displayFormat","disabledDates","min","placeholder"],[1,"text-muted","d-block","mt-1"],["name","assigned_user_id",1,"col-sm-6","col-md-6","col-lg-6",3,"errorMsg","label","tooltipText"],["columnClass","col-sm-6 col-md-6 col-lg-6",3,"hideHeader","isAddressOptional","parentForm"],["name","comment",1,"col-sm-12","col-md-12","col-lg-12",3,"errorMsg","label"],["labelAction","",3,"itemClick"],[3,"formControl","quickReply"],[3,"form"],[1,"app-form-actions-sticky"],[1,"fa-thin","fa-link","me-1"],[3,"onClick","text","icon","type","stylingMode"],[3,"onClick","text","type","stylingMode"],["formControlName","linkable_id","valueExpr","id",3,"onValueChanged","dataSource","displayExpr","searchEnabled","showClearButton","placeholder"],[3,"value","readOnly"],[1,"d-flex","align-items-center","gap-2","mb-3"],[1,"text-muted","small"],[3,"status","type"],[1,"d-flex","align-items-start","overflow-auto","pb-1"],[1,"d-flex","flex-column","align-items-center","text-center","app-padd-width-104px","app-padd-flex-0-0-auto"],[1,"rounded-circle","d-inline-flex","align-items-center","justify-content-center","border","border-2","app-padd-box-26",3,"ngClass"],[1,"fa-solid","fa-check","fs-11"],[1,"fa-solid","fa-circle","app-padd-fs-0-4375rem"],[1,"small","mt-2",3,"ngClass"],[1,"text-muted","mt-1","fs-11"],[1,"flex-grow-1","app-padd-height-2px","app-padd-margin-top-12px","app-padd-min-width-12px",3,"ngClass"],[3,"itemClick","customerId","entity","formControl","isCardLayout","isEditMode","isRequiredAddress","isVisibleAddAction"],[3,"value","readOnly","placeholder"],["displayExpr","name","formControlName","device_type_id","valueExpr","id",3,"noDataText","dataSource","placeholder"],["location","after","name","inlineCreate",3,"options"],[1,"fa-thin","fa-clock","me-1"],["labelAction","","stylingMode","text","type","default",3,"onClick","text"],["formControlName","assigned_user_id","placeholder","common_assignee_placeholder",3,"entity"],["name","provider_id",1,"col-sm-6","col-md-6","col-lg-6",3,"label"],["displayExpr","name","formControlName","provider_id","valueExpr","id",3,"dataSource","placeholder"],["name","tracking_id",1,"col-sm-6","col-md-6","col-lg-6",3,"label"],["formControlName","tracking_id",3,"placeholder"],["name","charges",1,"col-sm-6","col-md-6","col-lg-6",3,"label"],["formControlName","charges","format","#0.##",3,"min","placeholder"],["class","col-sm-6 col-md-6 col-lg-6","name","tax_id",3,"label",4,"appGstOnly"],[1,"col-12","d-flex","align-items-center","justify-content-between","flex-wrap","gap-2","mb-3"],["formControlName","is_rate_including_tax",3,"isEditMode","label",4,"appGstOnly"],[1,"fw-semibold"],["name","tax_id",1,"col-sm-6","col-md-6","col-lg-6",3,"label"],["valueExpr","id","formControlName","tax_id",3,"noDataText","dataSource","displayExpr","showClearButton","placeholder"],["formControlName","is_rate_including_tax",3,"isEditMode","label"],[3,"value"],[3,"cancelClick","dirtyForm","gaEvent","isOnPopup","confirmOnCancel","isVisibleHr","isSaving","saveText","savingText"]],template:function(i,o){i&1&&(r(0,"div",0)(1,"app-page-header",1)(2,"span",2),d(3),a(),ai(4,3),m(5,Fn,1,8,"app-save-cancel-footer",4),ri(),a(),m(6,Un,1,2,"app-skeleton-loader",5),m(7,fo,44,46,"form",6),a()),i&2&&(n(),p("mobileHeaderOnly",o.isMobileDevice)("recordTitle",o.isCreate?"":"PD-"+(o.pickupDrop==null?null:o.pickupDrop.id))("isEditing",!o.isCreate),n(2),_(o.pageTitle),n(2),u(o.form&&!o.isMobileDevice?5:-1),n(),u(!o.form&&!o.isCreate?6:-1),n(),u(o.form?7:-1))},dependencies:[cn,Nt,ze,en,Je,$i,Vi,Ke,z,W,q,$e,Be,Et,Tt,Pt,Y,Ut,Qi,It,wi,ge,ve,Xe,At,Fi,Hi,Ui,on,un,Ht,et,Oe,Me,we,Ie,vt,Ae,Ve,j,$,J,K],styles:[".app-padd-width-104px[_ngcontent-%COMP%]{width:104px}.app-padd-flex-0-0-auto[_ngcontent-%COMP%]{flex:0 0 auto}.app-padd-box-26[_ngcontent-%COMP%]{width:26px;height:26px}.app-padd-fs-0-4375rem[_ngcontent-%COMP%]{font-size:.4375rem}.app-padd-height-2px[_ngcontent-%COMP%]{height:2px}.app-padd-margin-top-12px[_ngcontent-%COMP%]{margin-top:12px}.app-padd-min-width-12px[_ngcontent-%COMP%]{min-width:12px}"]})}}return t})();
1var Co=()=>({class:"pdx-handover-wrapper"}),ho=t=>({"aria-label":t}),vo=(t,s)=>[t,s],Vn=(t,s)=>s.id,Mn=(t,s)=>s.label,Zt=(t,s)=>s.key;function go(t,s){if(t&1&&(r(0,"div",15)(1,"span"),d(2),a(),r(3,"b"),d(4),a()()),t&2){let e=s.$implicit,i=l(6);n(2),_(i.deviceLabel(e)),n(2),_(i.formatMessage("pickup_drop_line_status_"+(e.line_status===i.LINE_STATUS.EXCLUDED?"excluded":"not_available")))}}function bo(t,s){if(t&1&&(r(0,"div",15)(1,"span"),d(2),a(),r(3,"b"),d(4),a()(),P(5,go,5,2,"div",15,Vn)),t&2){let e=l(5);n(2),_(e.formatMessage("devices")),n(2),_(e.formatMessage("pickup_drop_collected_of",e.collectedCount.toString(),e.items.length.toString())),n(),T(e.notCollectedItems)}}function ko(t,s){if(t&1&&(r(0,"div",15)(1,"span"),d(2),a(),r(3,"b"),d(4),a()()),t&2){let e=l(5);n(2),_(e.formatMessage("devices")),n(2),_(e.items.length)}}function yo(t,s){if(t&1&&(r(0,"div",15)(1,"span"),d(2),a(),r(3,"b"),x(4,"i",16),a()()),t&2){let e=l(5);n(2),_(e.formatMessage("payment_collected"))}}function So(t,s){if(t&1&&(r(0,"div",11),m(1,bo,7,2)(2,ko,5,2,"div",15),r(3,"div",15)(4,"span"),d(5),a(),r(6,"b"),d(7),a()(),m(8,yo,5,1,"div",15),a()),t&2){let e=l(4);n(),u(e.isBulk?1:2),n(4),_(e.formatMessage("pickup_drop_proof_label")),n(2),_(e.proofSummary),n(),u(e.codCollected?8:-1)}}function Do(t,s){if(t&1){let e=k();r(0,"div",5)(1,"div",6)(2,"div",7),x(3,"i",8),a()(),r(4,"div",9),d(5),a(),r(6,"div",10),d(7),a(),m(8,So,9,4,"div",11),r(9,"div",12),d(10),a()(),r(11,"div",13)(12,"dx-button",14),C("onClick",function(){h(e);let o=l(3);return v(o.finish())}),a()()}if(t&2){let e=l(3);A("pdx-done--warn",e.doneVariant!==e.DONE_VARIANT.COMPLETE),n(3),p("ngClass",e.doneVariant===e.DONE_VARIANT.COMPLETE?"fa-check":e.doneVariant===e.DONE_VARIANT.RESCHEDULED?"fa-calendar-clock":"fa-triangle-exclamation"),n(2),_(e.doneVariant===e.DONE_VARIANT.RESCHEDULED?e.formatMessage("pickup_drop_rescheduled"):e.doneVariant===e.DONE_VARIANT.LOGGED?e.formatMessage("pickup_drop_marked_missed"):e.isPickup?e.formatMessage("pickup_drop_picked_up"):e.formatMessage("pickup_drop_delivered")),n(2),M("",e.task.user==null?null:e.task.user.name," \xB7 ",e.task.device_type==null?null:e.task.device_type.name),n(),u(e.doneVariant===e.DONE_VARIANT.COMPLETE?8:-1),n(2),_(e.doneVariant===e.DONE_VARIANT.COMPLETE?e.formatMessage("pickup_drop_done_note"):e.formatMessage("pickup_drop_missed_note")),n(2),p("text",e.formatMessage("pickup_drop_back_to_route"))}}function Eo(t,s){t&1&&x(0,"i",24)}function Po(t,s){if(t&1&&(r(0,"span"),d(1),a(),m(2,Eo,1,0,"i",24)),t&2){let e=s.$implicit,i=s.$index,o=l(5);A("on",i===o.stepIndex),n(),_(o.formatMessage("pickup_drop_step_"+e)),n(),u(i<o.flow.length-1?2:-1)}}function To(t,s){if(t&1&&(r(0,"div",20),P(1,Po,3,4,null,null,at),a()),t&2){let e=l(4);n(),T(e.flow)}}function wo(t,s){t&1&&x(0,"i",16)}function Io(t,s){if(t&1){let e=k();r(0,"button",30),C("click",function(){let o=h(e).$implicit,c=l(6);return v(c.chooseFailReason(o))}),d(1),m(2,wo,1,0,"i",16),a()}if(t&2){let e=s.$implicit,i=l(6);A("on",i.failReason===e),n(),w(" ",i.formatMessage(e)," "),n(),u(i.failReason===e?2:-1)}}function Mo(t,s){if(t&1&&(r(0,"div",25),x(1,"i",26),d(2),a(),r(3,"div",27),d(4),a(),r(5,"div",28),P(6,Io,3,4,"button",29,at),a()),t&2){let e=l(5);n(2),w(" ",e.formatMessage("pickup_drop_failed_note")),n(2),_(e.formatMessage("pickup_drop_what_happened")),n(2),T(e.failReasons)}}function Vo(t,s){if(t&1){let e=k();r(0,"button",36),C("click",function(){let o=h(e).$index,c=l(6);return v(c.reschedDayIdx=o)}),d(1),a()}if(t&2){let e=s.$implicit,i=s.$index,o=l(6);A("on",o.reschedDayIdx===i),n(),_(o.formatMessage(e.label))}}function Ao(t,s){if(t&1){let e=k();r(0,"button",37),C("click",function(){let o=h(e).$implicit,c=l(6);return v(c.reschedSlot=o)}),d(1),a()}if(t&2){let e=s.$implicit,i=l(6);A("on",i.reschedSlot===e),n(),_(e.label)}}function Oo(t,s){if(t&1&&(r(0,"div",31),d(1),a(),r(2,"div",27),d(3),a(),r(4,"div",32),P(5,Vo,2,3,"button",33,Mn),a(),r(7,"div",27),d(8),a(),r(9,"div",34),P(10,Ao,2,3,"button",35,Mn),a()),t&2){let e=l(5);n(),_(e.formatMessage("pickup_drop_reschedule_hint")),n(2),_(e.formatMessage("pickup_drop_day")),n(2),T(e.reschedDays),n(3),_(e.formatMessage("pickup_drop_time_slot")),n(2),T(e.reschedSlots)}}function Lo(t,s){if(t&1&&m(0,Mo,8,2)(1,Oo,12,3),t&2){let e=l(4);u(e.failStep===e.FAIL_STEP.FAILED?0:1)}}function Ro(t,s){if(t&1&&(r(0,"div",31),d(1),a()),t&2){let e=l(6);n(),_(e.formatMessage("pickup_drop_proof_no_items_hint"))}}function No(t,s){if(t&1&&(x(0,"div",41),r(1,"div",42),x(2,"i",16),a(),r(3,"span",43),d(4),a()),t&2){let e=l(),i=e.$implicit,o=e.$index,c=l(7);p("ngStyle",c.photoBg(c.items[0],i.key,o)),n(4),_(c.formatMessage(i.text))}}function Fo(t,s){if(t&1&&(x(0,"i",44),r(1,"span",43),d(2),a()),t&2){let e=l().$implicit,i=l(7);n(2),_(i.formatMessage(e.text))}}function Uo(t,s){if(t&1){let e=k();r(0,"button",40),C("click",function(){let o=h(e).$implicit,c=l(7);return v(c.openPhoto(0,o.key))}),m(1,No,5,2)(2,Fo,3,1),a()}if(t&2){let e=s.$implicit,i=l(7);
1A("taken",i.items[0].photoPreviews[e.key]||i.items[0].photos[e.key]),n(),u(i.items[0].photoPreviews[e.key]||i.items[0].photos[e.key]?1:2)}}function Ho(t,s){if(t&1){let e=k();r(0,"button",47),C("click",function(){let o=h(e).$implicit,c=l(8);return v(c.toggleTag(c.items[0],o))}),d(1),a()}if(t&2){let e=s.$implicit,i=l(8);A("on",i.isTagSelected(i.items[0],e)),n(),_(i.conditionTagLabel(e))}}function Bo(t,s){if(t&1&&(r(0,"div",27),d(1),a(),r(2,"div",45),P(3,Ho,2,3,"button",46,at),a()),t&2){let e=l(7);n(),_(e.formatMessage("pickup_drop_condition_notes")),n(2),T(e.conditionTags)}}function $o(t,s){if(t&1&&(r(0,"div",31),d(1),a(),r(2,"div",38),P(3,Uo,3,3,"button",39,Zt),a(),m(5,Bo,5,1)),t&2){let e=l(6);n(),_(e.formatMessage("pickup_drop_proof_hint")),n(2),T(e.photoSlots),n(2),u(e.requireCondition?5:-1)}}function jo(t,s){t&1&&x(0,"i",16)}function Go(t,s){if(t&1&&d(0),t&2){let e=l().$index;w(" ",e+1," ")}}function Ko(t,s){if(t&1&&(r(0,"span",60),d(1),a()),t&2){let e=l().$implicit,i=l(7);p("ngClass",i.lineStatusClass(e.line_status)),n(),_(i.lineStatusLabel(e.line_status))}}function zo(t,s){t&1&&x(0,"i",61)}function qo(t,s){if(t&1&&(x(0,"div",41),r(1,"div",42),x(2,"i",16),a(),r(3,"span",43),d(4),a()),t&2){let e=l(),i=e.$implicit,o=e.$index,c=l(2).$implicit,y=l(7);p("ngStyle",y.photoBg(c,i.key,o)),n(4),_(y.formatMessage(i.text))}}function Wo(t,s){if(t&1&&(x(0,"i",44),r(1,"span",43),d(2),a()),t&2){let e=l().$implicit,i=l(9);n(2),_(i.formatMessage(e.text))}}function Jo(t,s){if(t&1){let e=k();r(0,"button",40),C("click",function(){let o=h(e).$implicit,c=l(2).$index,y=l(7);return v(y.openPhoto(c,o.key))}),m(1,qo,5,2)(2,Wo,3,1),a()}if(t&2){let e=s.$implicit,i=l(2).$implicit;A("taken",i.photoPreviews[e.key]||i.photos[e.key]),n(),u(i.photoPreviews[e.key]||i.photos[e.key]?1:2)}}function Yo(t,s){if(t&1){let e=k();r(0,"button",47),C("click",function(){let o=h(e).$implicit,c=l(3).$implicit,y=l(7);return v(y.toggleTag(c,o))}),d(1),a()}if(t&2){let e=s.$implicit,i=l(3).$implicit,o=l(7);A("on",o.isTagSelected(i,e)),n(),_(o.conditionTagLabel(e))}}function Qo(t,s){if(t&1&&(r(0,"div",27),d(1),a(),r(2,"div",45),P(3,Yo,2,3,"button",46,at),a()),t&2){let e=l(9);n(),_(e.formatMessage("pickup_drop_condition")),n(2),T(e.conditionTags)}}function Xo(t,s){if(t&1){let e=k();r(0,"button",65),C("click",function(){let o=h(e).$implicit,c=l(2).$implicit,y=l(7);return v(y.chooseStatus(c,o.key))}),x(1,"i",8),d(2),a()}if(t&2){let e=s.$implicit,i=l(2).$implicit,o=l(7);p("ngClass",ci(3,vo,e.cls,i.line_status===e.key?"on":"")),n(),p("ngClass",e.icon),n(),w("",o.formatMessage(e.label)," ")}}function Zo(t,s){if(t&1&&(r(0,"div",62)(1,"div",38),P(2,Jo,3,3,"button",39,Zt),a(),m(4,Qo,5,1),r(5,"div",27),d(6),a(),r(7,"div",63),P(8,Xo,3,6,"button",64,Zt),a()()),t&2){let e=l(8);n(2),T(e.photoSlots),n(2),u(e.requireCondition?4:-1),n(2),_(e.formatMessage("pickup_drop_mark_device")),n(2),T(e.statusOptions)}}function ea(t,s){if(t&1){let e=k();r(0,"div",54)(1,"button",55),C("click",function(){let o=h(e).$implicit,c=l(7);return v(c.toggleDevice(o))}),r(2,"span",56),m(3,jo,1,0,"i",16)(4,Go,1,1),a(),r(5,"div",57)(6,"div",58),d(7),a(),r(8,"div",59),d(9),a()(),m(10,Ko,2,2,"span",60)(11,zo,1,0,"i",61),a(),m(12,Zo,10,2,"div",62),a()}if(t&2){let e=s.$implicit,i=l(7);A("open",i.openItemId===e.id)("done",e.line_status),n(3),u(e.line_status?3:4),n(4),_((e.device_type==null?null:e.device_type.name)||i.formatMessage("common_device")),n(2),_(e.serial_number||"\u2014"),n(),u(e.line_status?10:11),n(2),u(i.openItemId===e.id?12:-1)}}function ta(t,s){if(t&1&&(r(0,"div",31),d(1),a(),r(2,"div",48)(3,"div",49),x(4,"div",50),a(),r(5,"span",51),d(6),a()(),r(7,"div",52),P(8,ea,13,9,"div",53,Vn),a()),t&2){let e=l(6);n(),_(e.formatMessage("pickup_drop_proof_bulk_hint")),n(3),rt("width",e.proofProgress,"%"),n(2),M("",e.proofDoneCount," / ",e.items.length),n(2),T(e.items)}}function ia(t,s){if(t&1&&m(0,Ro,2,1,"div",31)(1,$o,6,2)(2,ta,10,5),t&2){let e=l(5);u(e.items.length?e.isBulk?2:1:0)}}function na(t,s){t&1&&x(0,"i",16)}function oa(t,s){if(t&1&&x(0,"app-money",69),t&2){let e=l(6);p("value",e.task.cod_amount||0)}}function aa(t,s){if(t&1&&(r(0,"div",66)(1,"div",67),d(2),a(),r(3,"div",68),m(4,na,1,0,"i",16)(5,oa,1,1,"app-money",69),a(),r(6,"div",70),d(7
1),a()(),r(8,"div",71),d(9),a()),t&2){let e=l(5);n(2),_(e.formatMessage("pickup_drop_amount_due")),n(2),u(e.codCollected?4:5),n(3),_(e.task.device_type==null?null:e.task.device_type.name),n(2),_(e.formatMessage("pickup_drop_cod_help"))}}function ra(t,s){if(t&1&&(r(0,"div",72)(1,"div",73),x(2,"i",16),a(),r(3,"div",74),d(4),a(),r(5,"div",75),d(6),a()()),t&2){let e=l(6);n(4),_(e.formatMessage("pickup_drop_otp_verified")),n(2),_(e.formatMessage(e.flow.includes("signature")?"pickup_drop_otp_verified_sign_next":"pickup_drop_otp_verified_help"))}}function la(t,s){if(t&1){let e=k();r(0,"dx-button",80),C("onClick",function(){h(e);let o=l(7);return v(o.sendOtp())}),a()}if(t&2){let e=l(7);p("text",e.formatMessage("pickup_drop_send_otp"))}}function sa(t,s){if(t&1){let e=k();r(0,"div",81)(1,"app-otp-input",82),C("otpComplete",function(o){h(e);let c=l(7);return v(c.onOtpComplete(o))}),a()(),r(2,"dx-button",83),C("onClick",function(){h(e);let o=l(7);return v(o.sendOtp())}),a()}if(t&2){let e=l(7);n(),p("length",6)("hasError",e.otpError),n(),p("text",e.formatMessage("pickup_drop_resend_otp"))}}function da(t,s){if(t&1&&(r(0,"div",72)(1,"div",76),x(2,"i",77),a(),r(3,"div",78),d(4),a(),r(5,"div",75),d(6),a(),m(7,la,1,1,"dx-button",79)(8,sa,3,3),a()),t&2){let e=l(6);n(4),_(e.formatMessage("pickup_drop_otp_ask")),n(2),_(e.formatMessage("pickup_drop_otp_help")),n(),u(e.otpSent?8:7)}}function pa(t,s){if(t&1&&m(0,ra,7,2,"div",72)(1,da,9,3,"div",72),t&2){let e=l(5);u(e.otpVerified?0:1)}}function ca(t,s){if(t&1&&(r(0,"div",86),x(1,"i",87),d(2),a()),t&2){let e=l(6);n(2),w(" ",e.formatMessage("signature_saved_successfully"))}}function _a(t,s){if(t&1){let e=k();r(0,"div",31),d(1),a(),r(2,"div",84)(3,"app-signature",85),C("signatureSaveClick",function(o){h(e);let c=l(5);return v(c.onSignatureSave(o))}),a()(),m(4,ca,3,1,"div",86)}if(t&2){let e=l(5);n(),_(e.formatMessage("pickup_drop_signature_help")),n(3),u(e.signatureSaved?4:-1)}}function ma(t,s){if(t&1&&(m(0,ia,3,1),m(1,aa,10,4),m(2,pa,2,1),m(3,_a,5,2)),t&2){let e=l(4);u(e.currentStep==="proof"?0:-1),n(),u(e.currentStep==="cod"?1:-1),n(),u(e.currentStep==="otp"?2:-1),n(),u(e.currentStep==="signature"?3:-1)}}function ua(t,s){if(t&1){let e=k();r(0,"dx-button",89),C("onClick",function(){h(e);let o=l(5);return v(o.goReschedule())}),a(),r(1,"dx-button",90),C("onClick",function(){h(e);let o=l(5);return v(o.logAndReturn())}),a()}if(t&2){let e=l(5);p("text",e.formatMessage("pickup_drop_reschedule_title"))("disabled",!e.failReason||e.submitting),n(),p("text",e.formatMessage("pickup_drop_log_return"))("disabled",!e.failReason||e.submitting)}}function xa(t,s){if(t&1){let e=k();r(0,"dx-button",91),C("onClick",function(){h(e);let o=l(5);return v(o.confirmReschedule())}),a()}if(t&2){let e=l(5);p("text",e.formatMessage("pickup_drop_confirm_reschedule"))("disabled",!e.reschedSlot||e.submitting)}}function fa(t,s){if(t&1&&m(0,ua,2,4)(1,xa,1,2,"dx-button",88),t&2){let e=l(4);u(e.failStep===e.FAIL_STEP.FAILED?0:1)}}function Ca(t,s){if(t&1){let e=k();r(0,"dx-button",93),C("onClick",function(){h(e);let o=l(5);return v(o.openCod())}),a()}if(t&2){let e=l(5);p("text",e.formatMessage("common_collect_payment"))}}function ha(t,s){if(t&1){let e=k();m(0,Ca,1,1,"dx-button",92),r(1,"dx-button",90),C("onClick",function(){h(e);let o=l(4);return v(o.advance())}),a()}if(t&2){let e=l(4);u(!e.codCollected&&e.task.cod_amount>0?0:-1),n(),p("text",e.codCollected?e.formatMessage("continue"):e.formatMessage("common_skip"))("disabled",e.submitting||!e.canProceed)}}function va(t,s){if(t&1){let e=k();r(0,"dx-button",94),C("onClick",function(){h(e);let o=l(4);return v(o.advance())}),a()}if(t&2){let e=l(4);p("type",e.isLastStep?"success":"default")("icon",e.isLastStep?"fa-thin fa-check":"fa-thin fa-arrow-right")("text",e.footerLabel)("disabled",!e.canProceed||e.submitting)}}function ga(t,s){if(t&1){let e=k();r(0,"div",17)(1,"dx-button",18),C("onClick",function(){h(e);let o=l(3);return v(o.back())}),a(),r(2,"div",19),d(3),a()(),m(4,To,3,0,"div",20),r(5,"div",21),m(6,Lo,2,1)(7,ma,4,4),a(),r(8,"div",22),m(9,fa,2,1)(10,ha,2,3)(11,va,1,4,"dx-button",23),a()}if(t&2){let e=l(3);n(),p("elementAttr",pi(6,ho,e.formatMessage("common_back")))("hint",e.formatMessage("common_back")),n(2),_(e.stepTitle),n(),u(e.mode!==e.HANDOVER_MODE.FAILED?4:-1),n(2),u(e.mode===e.HANDOVER_MODE.FAILED?6:7),n(3),u(e.mode===e.HANDOVER_MODE.FAILED?9:e.currentStep==="cod"?10:11)}}function ba(t,s){if(t&1&&(r(0,"div",4),m(1,Do,13,9)(2,ga,12,8),a()),t&2){let e=l(2);n(),u(e.currentStep==="done"?1:2)}}function ka(t,s){if(t&1){let e=k();r(0,"app-file-upload-popup",95),C("fileUploadSave",function(o){h(e);let c=l(2);return v(c.onPhotoSave(o))})("fileUploadClose",function(){h(e);let o=l(2);return v(o.onPhotoClose())}),a()}if(t&2){let e=l(2);p("isVisiblePopup",!0)("isMultipleUploads",!1)("isOnlySingleImageAttachmentAllowed",!0)("accept",e.UPLOAD_ACCEPT.IMAGES)}}function ya(t,s){if(t&1){let e=k();r(0,"app-add-payment-popup",96),C("addPaymentSave",function(){h(e);let o=l(2);return v(o.onCodSave())})("addPaymentClose",function(){h(e);let o=l(2);return v(o.onCodClose())}),a()}if(t&2){let e=l(2);p("isVisiblePopup",!0)("entityType",e.codEntityType)("entity",e.codEntity)("isCreate",!0)}}function Sa(t,s){if(t&1){let e=k();r(0,"dx-popup",0),C("onHiding",function(){h(e);let o=l();return v(o.close())}),F(1,ba,3,1,"div",1),a(),m(2,ka,1,4,"app-file-upload-popup",2),m(3,ya,1,4,"app-add-payment-popup",3)}if(t&2){let e=l();p("visible",!0)("fullScreen",!0)("showTitle",!1)("dragEnabled",!1)("hideOnOutsideClick",!1)("shading",!1)("wrapperAttr",Ct(10,Co)),n(),p("dxTemplateOf","content"),n(),u(e.isPhotoPopupVisible?2:-1),n(),u(e.isCodPopupVisible&&e.codEntity?3:-1)}}var it=(()=>{class t{constructor(){this.UPLOAD_ACCEPT=Di,this.formatMessage=f,this.service=b(N),this.attachmentService=b(Li),this.signatureService=b(yn),this.jobService=b(Ze),this.saleService=b(tt),this.generalSetting=b(wt),this.geoLocationService=b(ye),this.toast=b(R),this.task=null,this.isVisible=!1,this.mode=H.COMPLETE,this.completed=new U,this.closed=new U,this.HANDOVER_MODE=H,this.FAIL_STEP=ue,this.DONE_VARIANT=Ne,this.failStep=ue.FAILED,this.failReason=null,this.reschedDayIdx=0,this.reschedSlot=null,this.doneVariant=Ne.COMPLETE,this.failReasons=["pickup_drop_reason_no_answer","pickup_drop_reason_wrong_address","pickup_drop_reason_come_later","pickup_drop_reason_not_ready","pickup_drop_reason_payment"],this.reschedDays=[{label:"pickup_drop_day_today",offset:0},{label:"pickup_drop_day_tomorrow",offset:1},{label:"pickup_drop_day_after",offset:2}],this.reschedSlots=[{label:"10\u201312",hour:10},{label:"12\u20132",hour:12},{label:"2\u20134",hour:14},{label:"4\u20136",hour:16},{label:"6\u20138",hour:18}],this.photoSlots=ki,this.conditionTags=yi,this.LINE_STATUS=ee,this.photoColors=["#2563EB","#06B6D4","#6366F1","#0E9F5B"],this.statusOptions=[{key:ee.COLLECTED,cls:"collected",icon:"fa-circle-check",label:"pickup_drop_line_status_collected"},{key:ee.NOT_AVAILABLE,cls:"unavailable",icon:"fa-circle-xmark",label:"pickup_drop_line_status_not_available"},{key:ee.EXCLUDED,cls:"excluded",icon:"fa-ban",label:"pickup_drop_line_status_excluded"}],this.flow=[],this.stepIndex=0,this.done=!1,this.items=[],this.submitting=!1,this.openItemId=null,this.otpSent=!1,this.otpVerified=!1,this.otpError=!1,this.signatureSaved=!1,this.isCodPopupVisible=!1,this.codEntity=null,this.co
1dCollected=!1,this.requirePhoto=!1,this.requireCondition=!1,this.requireCod=!1,this.isPhotoPopupVisible=!1,this.photoTarget=null}lineStatusClass(e){return this.statusOptions.find(i=>i.key===e)?.cls??""}lineStatusLabel(e){let i=this.statusOptions.find(o=>o.key===e);return i?f(i.label):e}get proofSummary(){let e=[];return this.isPickup&&e.push(f("pickup_drop_photos")),this.flow.includes("otp")&&e.push(f("pickup_drop_step_otp")),this.flow.includes("signature")&&e.push(f("pickup_drop_step_signature")),e.join(" \xB7 ")}ngOnChanges(){!this.isVisible||!this.task||this.buildState()}get isPickup(){return this.task?.type==="Pickup"}get isBulk(){return this.items.length>1}get showCod(){return!this.isPickup&&this.task?.cod_amount>0}get codEntityType(){return this.task?.linkable_type===g.SALE.name?g.SALE.name:g.JOB.name}get codService(){return this.task?.linkable_type===g.SALE.name?this.saleService:this.jobService}get currentStep(){return this.done?"done":this.flow[this.stepIndex]}get stepTitle(){if(this.mode===H.FAILED)return this.failStep===ue.RESCHEDULE?f("pickup_drop_reschedule_title"):f("pickup_drop_failed_title");switch(this.currentStep){case"proof":return f("pickup_drop_step_proof_title");case"cod":return f("common_collect_payment");case"otp":return f("pickup_drop_step_otp_title");case"signature":return f("pickup_drop_step_signature_title");default:return f("pickup_drop_handover_title")}}get proofDoneCount(){return this.items.filter(e=>!!e.line_status).length}get collectedCount(){return this.items.filter(e=>(e.line_status||ee.COLLECTED)===ee.COLLECTED).length}get notCollectedItems(){return this.items.filter(e=>e.line_status&&e.line_status!==ee.COLLECTED)}conditionTagLabel(e){return f("pickup_drop_condition_"+(e??"").toLowerCase().replace(/\s+/g,"_"))}deviceLabel(e){return e?.device_type?.name??f("common_device")}get proofProgress(){return this.items.length?this.proofDoneCount/this.items.length*100:0}get isLastStep(){return this.stepIndex===this.flow.length-1}get canProceed(){return this.currentStep==="proof"?this.items.length?this.isBulk?this.proofDoneCount===this.items.length:!this.requirePhoto||this.photoCount(this.items[0])>=2:!0:this.currentStep==="otp"?this.otpVerified:this.currentStep==="signature"?this.signatureSaved:this.currentStep==="cod"?this.codCollected||!this.requireCod||!(this.task?.cod_amount>0):!0}get footerLabel(){return this.currentStep==="proof"&&this.isBulk&&this.proofDoneCount<this.items.length?f("pickup_drop_devices_left",String(this.items.length-this.proofDoneCount)):this.currentStep==="proof"&&!this.isBulk&&this.items.length&&this.requirePhoto&&this.photoCount(this.items[0])<2?f("pickup_drop_proof_min_photos"):this.isLastStep?f("pickup_drop_complete_handover"):f("continue")}
1photoCount(e){return Object.values(e.photos).filter(i=>i!==null).length}isTagSelected(e,i){return e.tags.includes(i)}toggleTag(e,i){let o=e.tags.indexOf(i);o>=0?e.tags.splice(o,1):e.tags.push(i)}toggleDevice(e){this.openItemId=this.openItemId===e.id?null:e.id}chooseStatus(e,i){e.line_status=i;let o=this.items.find(c=>c.id!==e.id&&!c.line_status);this.openItemId=o?o.id:null}openPhoto(e,i){this.photoTarget={itemIndex:e,slot:i},this.isPhotoPopupVisible=!0}onPhotoSave(e){let i=e?.attachments?.[0];if(this.isPhotoPopupVisible=!1,!i||!this.photoTarget)return;let{itemIndex:o,slot:c}=this.photoTarget,y=this.items[o];y.photoPreviews[c]=URL.createObjectURL(i),this.attachmentService.uploadFile(i,y.id,g.PICKUP_DROP_ITEM.name).subscribe({next:D=>{let E=new Set(y.knownAttachmentIds),ae=(D?.attachments??[]).find(_t=>!E.has(_t.id));ae&&(y.photos[c]=ae.id,y.knownAttachmentIds.push(ae.id))},error:()=>{y.photoPreviews[c]=null,this.toast.error("notification_update_error")}})}onPhotoClose(){this.isPhotoPopupVisible=!1}photoBg(e,i,o){return e.photoPreviews[i]?{"background-image":"url("+e.photoPreviews[i]+")","background-size":"cover","background-position":"center"}:{background:"linear-gradient(135deg,"+this.photoColors[o]+",#0007)"}}sendOtp(){this.service.sendOtp(this.task.id).subscribe({next:()=>{this.otpSent=!0,this.toast.success("pickup_drop_otp_sent")},error:e=>this.toast.error(e?.error?.errors?.otp?.[0]??"notification_update_error")})}onOtpComplete(e){this.otpVerified||this.service.verifyOtp(this.task.id,e).subscribe({next:()=>{this.otpVerified=!0,this.otpError=!1,this.toast.success("pickup_drop_otp_verified")},error:()=>{this.otpError=!0}})}onSignatureSave(e){e&&this.signatureService.saveSignature({signaturable_type:g.PICKUP_DROP.name,signaturable_id:this.task.id,customer_signature:e}).subscribe({next:()=>{this.signatureSaved=!0,this.toast.success("signature_saved_successfully")},error:()=>this.toast.error("notification_update_error")})}openCod(){(this.codEntityType===g.JOB.name?this.jobService.getDetailById(this.task.linkable_id):this.saleService.getById(this.task.linkable_id)).subscribe({next:i=>
1{this.codEntity=i,this.isCodPopupVisible=!0},error:()=>this.toast.error("notification_update_error")})}onCodClose(){this.isCodPopupVisible=!1,this.codEntity=null}onCodSave(){this.isCodPopupVisible=!1,this.codEntity=null,this.codCollected=!0,this.toast.success("payment_collected")}back(){if(this.mode===H.FAILED){this.failStep===ue.RESCHEDULE?this.failStep=ue.FAILED:this.close();return}this.stepIndex>0?this.stepIndex--:this.close()}advance(){if(this.canAdvance()){if(this.stepIndex<this.flow.length-1){this.stepIndex++;return}this.complete()}}close(){this.closed.emit()}finish(){this.completed.emit()}chooseFailReason(e){this.failReason=e}goReschedule(){if(!this.failReason){this.toast.error("pickup_drop_missed_reason_required");return}this.failStep=ue.RESCHEDULE}logAndReturn(){return B(this,null,function*(){if(!this.failReason){this.toast.error("pickup_drop_missed_reason_required");return}let e=yield this.geoLocationService.getDefaultOriginLocation();this.submitting=!0,this.service.transition(this.task.id,{to:S.FAILED,reason:this.failReason,lat:e.lat,lng:e.lng}).subscribe({next:()=>{this.submitting=!1,this.doneVariant=Ne.LOGGED,this.done=!0},error:i=>{this.submitting=!1,this.toast.error(i?.error?.errors?.to?.[0]??"notification_update_error")}})})}confirmReschedule(){return B(this,null,function*(){if(!this.reschedSlot){this.toast.error("pickup_drop_slot_required");return}let e=yield this.geoLocationService.getDefaultOriginLocation(),i=this.computeReschedDate();this.submitting=!0,this.service.reschedule(this.task.id,{reason:this.failReason,lat:e.lat,lng:e.lng,scheduled_on:i}).subscribe({next:()=>{this.submitting=!1,this.doneVariant=Ne.RESCHEDULED,this.done=!0},error:o=>{this.submitting=!1,this.toast.error(o?.error?.errors?.reason?.[0]??o?.error?.errors?.scheduled_on?.[0]??"notification_update_error")}})})}computeReschedDate(){let e=new Date;e.setDate(e.getDate()+this.reschedDays[this.reschedDayIdx].offset),e.setHours(this.reschedSlot.hour,0,0,0);let i=o=>String(o).padStart(2,"0");return`${e.getFullYear()}-${i(e.getMonth()+1)}-${i(e.getDate())}T${i(e.getHours())}:00:00`}canAdvance(){if(this.currentStep==="proof"){if(this.isBulk){if(this.proofDoneCount<this.items.length)return this.toast.error("pickup_drop_proof_devices_left"),!1}else if(this.items.length&&this.requirePhoto&&this.photoCount(this.items[0])<2)return this.toast.error("pickup_drop_proof_min_photos"),!1}return this.currentStep==="otp"&&!this.otpVerified?(this.toast.error("pickup_drop_otp_required"),!1):this.currentStep==="signature"&&!this.signatureSaved?(this.toast.error("pickup_drop_signature_required"),!1):!0}complete(){this.submitting=!0;let e={items:this.items.map(i=>({id:i.id,line_status:i.line_status||ee.COLLECTED,serial_number:i.serial_number,imei:i.imei,photos:i.photos,tags:i.tags}))};this.service.captureProof(this.task.id,e).subscribe({next:()=>{this.service.transition(this.task.id,{to:S.COMPLETED}).subscribe({next:()=>{this.submitting=!1,this.done=!0},error:i=>{this.submitting=!1,this.toast.error(i?.error?.errors?.to?.[0]??"notification_update_error")}})},error:i=>{this.submitting=!1,this.toast.error(i?.error?.errors?.items?.[0]??"notification_update_error")}})}buildState(){this.requirePhoto=this.settingOn(G.REQUIRE_PHOTO),this.requireCondition=this.settingOn(G.REQUIRE_CONDITION_CHECKLIST),this.requireCod=this.settingOn(G.REQUIRE_COD_COLLECTION);let e=this.settingOn(G.REQUIRE_OTP),i=this.settingOn(G.REQUIRE_SIGNATURE);this.items=(this.task.items??[]).map(o=>({id:o.id,device_type:o.device_type,serial_number:o.serial_number??"",imei:o.imei??"",line_status:null,photos:{front:null,back:null,screen_on:null,serial_imei:null},photoPreviews:{front:null,back:null,screen_on:null,serial_imei:null},tags:[],knownAttachmentIds:(o.attachments??[]).map(c=>c.id)})),this.flow=[],this.isPickup?this.flow.push("proof"):this.showCod&&this.flow.push("cod"),e&&this.flow.push("otp"),i&&this.flow.push("signature"),this.flow.length||this.flow.push("proof"),this.openItemId=this.items.length===1?this.items[0].id:this.items[0]?.id??null,this.items.length===1&&(this.items[0].line_status=ee.COLLECTED),this.stepIndex=0,this.done=!1,this.doneVariant=Ne.COMPLETE,this.otpSent=!1,this.otpVerified=!1,this.otpError=!1,this.signatureSaved=!1,this.codCollected=!1,this.submitting=!1,this.isCodPopupVisible=!1,this.codEntity=null,this.isPhotoPopupVisible=!1,this.failStep=ue.FAILED,this.failReason=null,this.reschedDayIdx=0,this.reschedSlot=null}settingOn(e){let i=String(this.generalSetting.getGeneralSettingByKey(e));return i==="1"||i==="true"}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=O({type:t,selectors:[["app-pickup-drop-handover"]],inputs:{task:"task",isVisible:"isVisible",mode:"mode"},outputs:{completed:"completed",closed:"closed"},features:[se],decls:1,vars:1,consts:[[3,"onHiding","visible","fullScreen","showTitle","dragEnabled","hideOnOutsideClick","
1shading","wrapperAttr"],["class","pdx-task vh-100 overflow-auto",4,"dxTemplate","dxTemplateOf"],[3,"isVisiblePopup","isMultipleUploads","isOnlySingleImageAttachmentAllowed","accept"],[3,"isVisiblePopup","entityType","entity","isCreate"],[1,"pdx-task","vh-100","overflow-auto"],[1,"pdx-done"],[1,"pdx-done-ck"],[1,"inner"],[1,"fa-thin",3,"ngClass"],[1,"pdx-done-title"],[1,"pdx-done-sub"],[1,"pdx-done-sum"],[1,"pdx-done-note"],[1,"pdx-foot"],["width","100%","stylingMode","contained","type","default","icon","fa-thin fa-arrow-right",3,"onClick","text"],[1,"pdx-done-row"],[1,"fa-thin","fa-check"],[1,"pdx-bar"],["stylingMode","outlined","type","normal","icon","fa-thin fa-arrow-left",1,"app-icon-button","flex-shrink-0",3,"onClick","elementAttr","hint"],[1,"pdx-bar-title"],[1,"pdx-steps"],[1,"pdx-body"],[1,"pdx-foot","sticky-bottom"],["width","100%","stylingMode","contained",3,"type","icon","text","disabled"],[1,"fa-thin","fa-chevron-right"],[1,"pdx-note","pdx-note--danger"],[1,"fa-thin","fa-triangle-exclamation"],[1,"pdx-sectlabel"],[1,"pdx-reasons"],[1,"pdx-reason",3,"on"],[1,"pdx-reason",3,"click"],[1,"pdx-hint"],[1,"pdx-days"],[1,"pdx-day",3,"on"],[1,"pdx-slots"],[1,"pdx-slot",3,"on"],[1,"pdx-day",3,"click"],[1,"pdx-slot",3,"click"],[1,"pdx-photos"],[1,"pdx-photo",3,"taken"],[1,"pdx-photo",3,"click"],[1,"ov",3,"ngStyle"],[1,"ck"],[1,"lab"],[1,"fa-thin","fa-camera"],[1,"pdx-tags"],[1,"pdx-tag",3,"on"],[1,"pdx-tag",3,"click"],[1,"pdx-bulk-prog-wrap"],[1,"pdx-bulk-prog"],[1,"pdx-bulk-prog-fill"],[1,"pdx-bulk-prog-txt"],[1,"pdx-devlist"],[1,"card","theme-secondary-bg","pdx-devcard",3,"open","done"],[1,"card","theme-secondary-bg","pdx-devcard"],[1,"pdx-devcard-head",3,"click"],[1,"pdx-dev-idx"],[1,"pdx-dev-meta"],[1,"nm"],[1,"sn"],[1,"pdx-dev-stat",3,"ngClass"],[1,"fa-thin","fa-chevron-down","pdx-dev-chev"],[1,"pdx-devcard-body"],[1,"pdx-statusbtns","d-flex","gap-2"],[1,"pdx-statusbtn",3,"ngClass"],[1,"pdx-statusbtn",3,"click","ngClass"],[1,"pdx-cod-hero"],[1,"pdx-cod-cap"],[1,"amt"],[3,"value"],[1,"pdx-cod-cap","mt-1"],[1,"pdx-hint","mt-3"],[1,"text-center"],[1,"pdx-otp-done-ck"],[1,"pdx-otp-h","mt-3"],[1,"pdx-otp-sub"],[1,"pdx-otp-ico"],[1,"fa-thin","fa-shield-check"],[1,"pdx-otp-h"],["stylingMode","contained","type","default","icon","fa-thin fa-paper-plane",1,"mt-3",3,"text"],["stylingMode","contained","type","default","icon","fa-thin fa-paper-plane",1,"mt-3",3,"onClick","text"],[1,"my-3"],[3,"otpComplete","length","hasError"],["stylingMode","text","type","default",3,"onClick","text"],[1,"pdx-sign"],[3,"signatureSaveClick"],[1,"pdx-otp-ok"],[1,"fa-thin","fa-circle-check"],["width","100%","stylingMode","contained","type","default","icon","fa-thin fa-check",3,"text","disabled"],["width","100%","stylingMode","contained","type","default","icon","fa-thin fa-calendar-clock",3,"onClick","text","disabled"],["width","100%","stylingMode","outlined","type","normal",3,"onClick","text","disabled"],["width","100%","stylingMode","contained","type","default","icon","fa-thin fa-check",3,"onClick","text","disabled"],["width","100%","stylingMode","contained","type","default","icon","fa-thin fa-receipt",3,"text"],["width","100%","stylingMode","contained","type","default","icon","fa-thin fa-receipt",3,"onClick","text"],["width","100%","stylingMode","contained",3,"onClick","type","icon","text","disabled"],[3,"fileUploadSave","fileUploadClose","isVisiblePopup","isMultipleUploads","isOnlySingleImageAttachmentAllowed","accept"],[3,"addPaymentSave","addPaymentClose","isVisiblePopup","entityType","entity","isCreate"]],template:function(i,o){i&1&&m(0,Sa,4,11),i&2&&u(o.isVisible&&o.task?0:-1)},dependencies:[he,Ce,ne,z,W,q,Ii,tn,Ai,vn,j,$,_i,oe,J],styles:[`@charset "UTF-8";.pdx-handover-wrapper .dx-popup-content{padding:0;overflow:hidden;height:100%}.pdx-handover-wrapper .dx-popup-normal{border-radius:0}.pdx-task{position:fixed;inset:0;background:var(--bg-secondary);display:flex;flex-direction:column;font-family:var(--bp-font-sans, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);color:var(--primary-text)}.pdx-bar{display:flex;align-items:center;gap:10px;padding:10px 12px;padding-top:calc(10px + var(--safe-area-top, 0px));background:var(--primary-bg);border-bottom:1px solid var(--theme-border-color);flex:none}.pdx-bar-title{margin:0;font-size:var(--bp-text-md);font-weight:700;flex:1}.pdx-body{flex:1;min-height:0;overflow-y:auto;padding:14px}.pdx-foot{flex:none;padding:12px 14px calc(16px + var(--safe-area-bottom, 0px));background:var(--primary-bg);border-top:1px solid var(--theme-border-color);display:flex;flex-direction:column;gap:9px}.pdx-hint{font-size:var(--bp-text-sm);color:var(--bp-text-muted);margin-bottom:12px;line-height:1.5}.pdx-hint b{color:var(--bp-brand-600)}.pdx-steps{display:flex;align-items:center;flex-wrap:wrap;gap:7px;flex:none;padding:10px 14px;background:var(--primary-bg);border-bottom:1px solid var(--theme-border-color);font-size:var(--bp-text-xs);color:var(--bp-text-muted);font-weight:600}.pdx-steps .on{color:var(--bp-brand-600);font-weight:700}.pdx-steps i{font-size:.625rem}.pdx-photos{display:grid;grid-template-columns:1fr 1fr;gap:10px}.pdx-photo{aspect-ratio:1;border-radius:var(--bp-radius-md);border:2px dashed var(--theme-border-color);background:var(--primary-bg);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;color:var(--bp-text-muted);position:relative;overflow:hidden;cursor:pointer;padding:0}.pdx-photo.taken{border:none;color:#fff}.pdx-photo.taken .ov{position:absolute;inset:0;background-size:cover;background-position:center}.pdx-photo.taken .ov:after{content:"";position:absolute;inset:0;background:#0f172a4d}.pdx-photo .lab{font-size:var(--bp-text-xs);font-weight:600;position:relative;z-index:1}.pdx-photo .ck{width:32px;height:32px;border-radius:50%;background:#ffffff40;display:grid;place-items:center;position:relative;z-index:1}.pdx-photo i{font-size:1.375rem}.pdx-sectlabel{font-weight:700;font-size:var(--bp-text-sm);margin:18px 0 10px}.pdx-tags{display:flex;flex-wrap:wrap;gap:8px}
1.pdx-tag{border:1.5px solid var(--theme-border-color);background:var(--primary-bg);color:var(--bp-text-secondary);border-radius:var(--bp-radius-pill);padding:8px 13px;font-size:var(--bp-text-sm);font-weight:600;cursor:pointer}.pdx-tag.on{background:var(--bp-brand-600);color:#fff;border-color:var(--bp-brand-600)}.pdx-statusbtn{flex:1;border:1.5px solid var(--theme-border-color);background:var(--primary-bg);border-radius:var(--bp-radius-md);padding:11px 6px;font-weight:700;font-size:var(--bp-text-xs);color:var(--bp-text-secondary);display:flex;flex-direction:column;align-items:center;gap:4px;cursor:pointer}.pdx-statusbtn i{font-size:.9375rem}.pdx-statusbtn.on.collected{border-color:var(--bp-success-500);background:color-mix(in srgb,var(--bp-success-500) 10%,transparent);color:var(--bp-success-700)}.pdx-statusbtn.on.unavailable{border-color:var(--bp-warning-500);background:color-mix(in srgb,var(--bp-warning-500) 12%,transparent);color:var(--bp-warning-700)}.pdx-statusbtn.on.excluded{border-color:var(--bp-neutral-400);background:var(--bg-secondary);color:var(--primary-text)}.pdx-bulk-prog-wrap{display:flex;align-items:center;gap:10px;margin:10px 0 16px}.pdx-bulk-prog{flex:1;height:7px;background:var(--bg-secondary);border-radius:var(--bp-radius-pill);overflow:hidden}.pdx-bulk-prog-fill{height:100%;background:var(--bp-success-500);border-radius:var(--bp-radius-pill);transition:width .25s var(--bp-ease)}.pdx-bulk-prog-txt{font-size:var(--bp-text-xs);font-weight:700;color:var(--bp-text-secondary);white-space:nowrap}.pdx-devlist{display:flex;flex-direction:column;gap:10px}.pdx-devcard{overflow:hidden}.pdx-devcard.open{border-color:var(--bp-brand-500);box-shadow:0 0 0 3px var(--bp-focus-ring)}.pdx-devcard-head{width:100%;display:flex;align-items:center;gap:11px;padding:12px 13px;border:none;background:transparent;text-align:left;cursor:pointer}.pdx-dev-idx{width:26px;height:26px;flex:none;border-radius:50%;background:var(--bg-secondary);color:var(--bp-text-secondary);display:grid;place-items:center;font-weight:700;font-size:var(--bp-text-xs)}.pdx-devcard.done .pdx-dev-idx{background:var(--bp-success-500);color:#fff}.pdx-dev-meta{flex:1;min-width:0}.pdx-dev-meta .nm{font-weight:600;font-size:var(--bp-text-sm);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.pdx-dev-meta .sn{font-size:var(--bp-text-2xs);color:var(--bp-text-muted)}.pdx-dev-stat{font-size:var(--font-micro);font-weight:700;padding:4px 10px;border-radius:var(--bp-radius-pill);white-space:nowrap}.pdx-dev-stat.collected{background:color-mix(in srgb,var(--bp-success-500) 14%,transparent);color:var(--bp-success-700)}.pdx-dev-stat.unavailable{background:color-mix(in srgb,var(--bp-warning-500) 16%,transparent);color:var(--bp-warning-700)}.pdx-dev-stat.excluded{background:var(--bg-secondary);color:var(--bp-text-muted)}.pdx-dev-chev{color:var(--bp-text-muted);font-size:var(--font-body)}.pdx-devcard-body{padding:0 13px 14px}.pdx-devcard-body .pdx-photo i{font-size:1.125rem}.pdx-devcard-body .pdx-photo .lab{font-size:var(--font-micro)}.pdx-otp-ico{width:56px;height:56px;border-radius:50%;background:var(--bp-pill-brand-bg);color:var(--bp-brand-600);display:grid;place-items:center;font-size:1.625rem;margin:6px auto 12px}.pdx-otp-h{font-size:var(--bp-text-lg);font-weight:700}.pdx-otp-sub{font-size:var(--bp-text-sm);color:var(--bp-text-muted);margin-top:6px;line-height:1.5}.pdx-otp-ok{color:var(--bp-success-600);font-weight:700;font-size:var(--bp-text-sm);margin-top:12px}.pdx-otp-done-ck{font-size:2.125rem;color:#fff;display:grid;width:76px;height:76px;margin:6px auto 0;box-shadow:0 0 0 12px color-mix(in srgb,var(--bp-success-500) 12%,transparent),0 10px 26px color-mix(in srgb,var(--bp-success-500) 35%,transparent);
1animation:pdxPop .4s cubic-bezier(.2,1.4,.4,1);border-radius:50%;background:var(--bp-success-500);place-items:center}.pdx-sign{position:relative;background:var(--primary-bg);border:2px solid var(--theme-border-color);border-radius:var(--bp-radius-lg);min-height:200px;overflow:hidden;padding-top:16px}.pdx-cod-hero{background:var(--bp-warning-600);color:#fff;border-radius:var(--bp-radius-lg);padding:20px;text-align:center;box-shadow:0 10px 24px color-mix(in srgb,var(--bp-warning-500) 40%,transparent)}.pdx-cod-hero .amt{font-size:2.375rem;font-weight:700;margin-top:3px}.pdx-cod-cap{font-size:var(--bp-text-sm);opacity:.9}.pdx-done{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:30px 24px;background:var(--bp-success-700);color:#fff}.pdx-done-ck{width:88px;height:88px;border-radius:50%;background:#fff3;display:grid;place-items:center;animation:pdxPop .4s cubic-bezier(.2,1.4,.4,1)}.pdx-done-ck .inner{width:60px;height:60px;border-radius:50%;background:#fff;display:grid;place-items:center;font-size:2.125rem;color:var(--bp-success-600)}@keyframes pdxPop{0%{transform:scale(.4);opacity:0}
1to{transform:scale(1);opacity:1}}.pdx-done-title{font-size:var(--bp-text-2xl);font-weight:700;margin-top:22px}.pdx-done-sub{font-size:var(--bp-text-sm);opacity:.9;margin-top:6px}.pdx-done-sum{background:#ffffff24;border-radius:var(--bp-radius-lg);padding:14px 16px;width:100%;margin-top:22px;display:flex;flex-direction:column;gap:9px}.pdx-done-row{display:flex;justify-content:space-between;font-size:var(--bp-text-sm)}.pdx-done-row span{opacity:.85}.pdx-done-note{font-size:var(--bp-text-xs);opacity:.85;margin-top:16px}.pdx-done--warn{background:var(--bp-warning-700)}.pdx-done--warn .inner{color:var(--bp-warning-600)}.pdx-note{font-size:var(--bp-text-sm);border-radius:var(--bp-radius-md);padding:10px 12px;display:flex;gap:8px;margin-bottom:4px}.pdx-note--danger{background:color-mix(in srgb,var(--bp-danger-500) 10%,transparent);border:1px solid color-mix(in srgb,var(--bp-danger-500) 35%,transparent);color:var(--bp-danger-700)}.pdx-reasons{display:flex;flex-direction:column;gap:10px}.pdx-reason{width:100%;text-align:left;border:1.5px solid var(--theme-border-color);background:var(--primary-bg);border-radius:var(--bp-radius-md);padding:14px;font-size:var(--bp-text-sm);font-weight:600;color:var(--primary-text);display:flex;justify-content:space-between;align-items:center;cursor:pointer}.pdx-reason.on{border-color:var(--bp-danger-500);background:color-mix(in srgb,var(--bp-danger-500) 8%,transparent);color:var(--bp-danger-700)}.pdx-days{display:flex;gap:10px}.pdx-day{flex:1;border:1.5px solid var(--theme-border-color);background:var(--primary-bg);color:var(--primary-text);border-radius:var(--bp-radius-md);padding:12px 6px;font-weight:700;font-size:var(--bp-text-sm);cursor:pointer}.pdx-day.on{border-color:transparent;background:var(--bp-brand-600);color:#fff}.pdx-slots{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}.pdx-slot{border:1.5px solid var(--theme-border-color);background:var(--primary-bg);color:var(--primary-text);border-radius:var(--bp-radius-md);padding:13px 6px;font-weight:700;font-size:var(--bp-text-sm);cursor:pointer}.pdx-slot.on{border-color:transparent;background:var(--bp-brand-600);color:#fff} 2`],encapsulation:2})}}return t})();var Ea=(t,s)=>s.id,Pa=(t,s)=>s.to;function Ta(t,s){t&1&&(r(0,"div",12),x(1,"dx-load-indicator",16),a()),t&2&&(n(),p("height",40)("width",40))}function wa(t,s){if(t&1&&(r(0,"div",13),x(1,"i",17),r(2,"div"),d(3),a()()),t&2){let e=l();n(3),_(e.formatMessage("pickup_drop_my_route_empty"))}}function Ia(t,s){if(t&1&&(r(0,"span",29),d(1),V(2,"dateFormat"),a()),t&2){let e=l().$implicit;n(),_(L(2,1,e.scheduled_on,"datetime"))}}function Ma(t,s){if(t&1&&(r(0,"div",30),d(1),a()),t&2){let e=l().$implicit,i=l(2);n(),_(i.deviceName(e))}}function Va(t,s){if(t&1&&(d(0),V(1,"address")),t&2){let e=l().$implicit;w(" \xB7 ",_e(1,1,e.address)," ")}}function Aa(t,s){if(t&1){let e=k();r(0,"a",37),C("click",function(){h(e);let o=l().$implicit,c=l(2);return v(c.navigateToStop(o))}),x(1,"i",38),d(2),a()}if(t&2){let e=l(3);n(2),_(e.formatMessage("pickup_drop_navigate"))}}function Oa(t,s){if(t&1&&(r(0,"a",35),x(1,"i",39),d(2),a()),t&2){let e=l().$implicit,i=l(2);p("href","tel:"+e.mobile_number,ot),n(2),_(i.formatMessage("call"))}}function La(t,s){if(t&1){let e=k();r(0,"dx-button",41),C("onClick",function(){let o=h(e).$implicit,c=l(2).$implicit,y=l(2);return v(y.handleAction(c,o.to))}),a()}if(t&2){let e=s.$implicit,i=l(4);p("icon",e.icon)("text",i.formatMessage(e.label))("disabled",i.submitting)}}function Ra(t,s){if(t&1&&(r(0,"div",36),P(1,La,1,3,"dx-button",40,Pa),a()),t&2){let e=l().$implicit,i=l(2);n(),T(i.validActions(e))}}function Na(t,s){if(t&1&&(r(0,"div",22)(1,"div",23)(2,"div",24),d(3),a()(),r(4,"div",25)(5,"div",26)(6,"span",27),x(7,"i",28),d(8),a(),m(9,Ia,3,4,"span",29),a(),m(10,Ma,2,1,"div",30),r(11,"div",31),d(12),m(13,Va,2,3),a(),r(14,"div",32),x(15,"app-pickup-drop-status-tag",33),m(16,Aa,3,1,"a",34),m(17,Oa,3,2,"a",35),a(),m(18,Ra,3,0,"div",36),a()()),t&2){let e=s.$implicit,i=s.$index,o=l(2);n(2),A("next",i===o.nextIndex),n(),_(i+1),n(),A("next",i===o.nextIndex),n(2),A("app-route-stop-type--drop",e.type!=="Pickup"),n(),p("ngClass",e.type==="Pickup"?"fa-arrow-up-from-bracket":"fa-arrow-down-to-bracket"),n(),w("",o.typeLabel(e.type)," "),n(),u(e.scheduled_on?9:-1),n(),u(o.deviceName(e)?10:-1),n(2),_(e.user==null?null:e.user.name),n(),u(e.address?13:-1),n(2),p("status",e.status)("type",e.type),n(),u(e.address?16:-1),n(),u(e.mobile_number?17:-1),n(),u(o.validActions(e).length?18:-1)}}function Fa(t,s){if(t&1&&(r(0,"div",18)(1,"span"),d(2),a(),r(3,"span",19),d(4),a()(),r(5,"div",20),x(6,"div",21),P(7,Na,19,18,"div",22,Ea),a()),t&2){let e=l();n(2),_(e.formatMessage("pickup_drop_todays_route")),n(2),M("",e.tasks.length," ",e.formatMessage("pickup_drop_stops")),n(3),T(e.tasks)}}function Ua(t,s){if(t&1){let e=k();r(0,"div",14)(1,"dx-button",42),C("onClick",function(){h(e);let o=l();return v(o.startNext())}),a()()}if(t&2){let e=l();n(),p("text",e.formatMessage("pickup_drop_start_next_stop"))}}var jt=(()=>{class t{constructor(){this.formatMessage=f,this.service=b(N),this.session=b(fe),this.toast=b(R),this.router=b(X),this.route=b(me),this.geoLocationService=b(ye),this.tasks=[],this.loading=!0,this.submitting=!1,this.isHandoverVisible=!1,this.handoverTask=null,this.handoverMode=H.COMPLETE,this.refreshing=!1,this.visibilityHandler=()=>{document.hidden||this.refresh()},this.actions=[{to:S.EN_ROUTE,icon:"fa-thin fa-route",label:"pickup_drop_action_on_the_way"},{to:S.ARRIVED,icon:"fa-thin fa-location-dot",label:"pickup_drop_action_arrived"},{to:S.COMPLETED,icon:"fa-thin fa-circle-check",label:"pickup_drop_action_complete"},{to:S.FAILED,icon:"fa-thin fa-circle-xmark",label:"pickup_drop_action_missed"}
2]}get userName(){return this.session.currentUser()?.name??""}get userInitials(){let e=this.userName.trim();if(!e)return"";let i=e.split(/\s+/);return(i[0][0]+(i[1]?.[0]??"")).toUpperCase()}get greeting(){let e=new Date().getHours();return e<12?f("greeting_morning"):e<17?f("greeting_afternoon"):f("greeting_evening")}get pickupCount(){return this.tasks.filter(e=>e.type==="Pickup").length}get dropCount(){return this.tasks.filter(e=>e.type!=="Pickup").length}get codTotal(){return this.tasks.reduce((e,i)=>e+(+i.cod_amount||0),0)}get nextIndex(){let e=this.tasks.findIndex(i=>i?.status?.name===S.EN_ROUTE||i?.status?.name===S.ARRIVED);return e>=0?e:this.tasks.findIndex(i=>!this.isTerminalStatus(i?.status?.name))}isTerminalStatus(e){return e===S.COMPLETED||e===S.CANCELLED||e===S.FAILED}get nextTask(){return this.tasks[this.nextIndex]??null}ngOnInit(){document.body.classList.add("my-route-page"),this.load(),this.pollSubscription=ni(xi).subscribe(()=>this.refresh()),document.addEventListener("visibilitychange",this.visibilityHandler),ui.isNativePlatform()&&En.addListener("appStateChange",e=>{e.isActive&&this.refresh()}).then(e=>{this.appStateListener=e})}ngOnDestroy(){document.body.classList.remove("my-route-page"),this.pollSubscription?.unsubscribe(),this.cancelRefresh(),document.removeEventListener("visibilitychange",this.visibilityHandler),this.appStateListener?.remove()}deviceName(e){return Pe(e)}typeLabel(e){return f(e===I[1].text?"pickup_drop_type_drop":"pickup_drop_type_pickup")}validActions(e){let i=(e?.allowed_transitions||[]).map(o=>typeof o=="string"?o:o.key);return this.actions.filter(o=>i.includes(o.to))}navigateToStop(e){if(!e?.address){this.toast.error("error_address_not_found");return}this.geoLocationService.getAddressCoordinates(e.address).then(i=>{this.router.navigate(["pickupDrop/map"],{queryParams:{lat:i.lat,lng:i.lng,customerId:e.user_id,pickupDropId:e.id,customerPhoneNumber:e.mobile_number,stopMode:1}})}).catch(()=>this.toast.error("error_address_not_found"))}startNext(){this.nextTask&&this.navigateToStop(this.nextTask)}handleAction(e,i){if(i===S.FAILED){this.openHandover(e,H.FAILED);return}if(i===S.COMPLETED&&e.mode===Ee.DOORSTEP){this.openHandover(e,H.COMPLETE);return}let o=i===S.EN_ROUTE?()=>this.navigateToStop(e):void 0;this.callTransition(e.id,i,{},o)}onHandoverCompleted(){this.isHandoverVisible=!1,this.handoverTask=null,this.load()}onHandoverClosed(){this.isHandoverVisible=!1,this.handoverTask=null}openHandover(e,i){this.handoverTask=e,this.handoverMode=i,this.isHandoverVisible=!0}load(){this.cancelRefresh(),this.loading=!0,this.service.getMyRoute().subscribe({next:e=>{this.tasks=e??[],this.loading=!1,this.maybeRunPendingAction()},error:()=>{this.loading=!1,this.toast.error("notification_update_error")}})}refresh(){this.refreshing||this.submitting||this.isHandoverVisible||(this.refreshing=!0,this.refreshSubscription=this.service.getMyRoute().subscribe({next:e=>{this.tasks=e??[],this.refreshing=!1},error:()=>{this.refreshing=!1}}))}cancelRefresh(){this.refreshSubscription?.unsubscribe(),this.refreshSubscription=void 0,this.refreshing=!1}maybeRunPendingAction(){let e=this.route.snapshot.queryParams,i=+e.act,o=e.to;if(!i||!o)return;let c=this.tasks.find(y=>y.id===i);this.router.navigate([],{relativeTo:this.route,queryParams:{},replaceUrl:!0}),c?this.handleAction(c,o):this.toast.error("notification_pickup_drop_not_found")}callTransition(e,i,o,c){this.submitting||(this.submitting=!0,this.service.transition(e,Q({to:i},o)).subscribe({next:()=>{this.submitting=!1,this.toast.success("pickup_drop_status_updated"),(c??(()=>this.load()))()},error:y=>{this.submitting=!1,this.toast.error(y?.error?.errors?.to?.[0]??"notification_update_error")}}))}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=O({type:t,selectors:[["app-pickup-drop-my-route"]],decls:37,vars:16,consts:[[1,"app-route"],[1,"app-route-hero"],[1,"app-route-hero-top"],[1,"app-route-hero-greeting"],[1,"app-route-hero-name"],[1,"app-route-hero-avatar"],[1,"app-route-hero-stats"],[1,"app-route-stat"],[1,"app-route-stat-value"],[1,"app-route-stat-label"],["digits","1.0-0",3,"value"],[1,"app-route-body"],[1,"d-flex","justify-content-center","py-5"],[1,"app-route-empty"],[1,"app-route-cta","theme-secondary-bg","border-top"],[3,"completed","closed","isVisible","task","mode"],[3,"height","width"],[1,"fa-thin","fa-route"],[1,"app-route-list-head"],[1,"app-route-list-count"],[1,"app-route-timeline"],[1,"app-route-timeline-line"],[1,"app-route-stop"],[1,"app-route-stop-marker"],[1,"app-route-stop-bullet"],[1,"card","theme-secondary-bg","app-route-stop-card"],[1,"d-flex","align-items-center","justify-content-between","gap-2","mb-2"],[1,"badge","rounded-pill","d-inline-flex","align-items-center","gap-1","app-route-stop-type"],[1,"fa-thin",3,"ngClass"],[1,"app-route-stop-time"],[1,"app-route-stop-device"],[1,"app-route-stop-party"],[1,"app-route-stop-tags"],[3,"status","type"],["appA11yClick","","role","button",1,"app-route-stop-link"],[1,"app-route-stop-link",3,"href"],[1,"app-route-stop-actions"],["appA11yClick","","role","button",1,"app-route-stop-link",3,"click"],[1,"fa-thin","fa-diamond-turn-right"],[1,"fa-thin","fa-phone"],["stylingMode","outlined","type","default",1,"flex-fill",3,"icon","text","disabled"],["stylingMode","outlined","type","default",1,"flex-fill",3,"onClick","icon","text","disabled"],["width","100%","stylingMode","contained","type","default","icon","fa-thin fa-diamond-turn-right",3,"onClick","text"]],template:function(i,o){i&1&&(r(0,"div",0)(1,"div",1)(2,"div",2)(3,"div")(4,"div",3),d(5),a(),r(6,"div",4),d(7),a()(),r(8,"div",5),d(9),a()(),r(10,"div",6)(11,"div",7)(12,"div",8),d(13),a(),r(14,"div",9),d(15),a()(),r(16,"div",7)(17,"div",8),d(18),a(),r(19,"div",9),d(20),a()(),r(21,"div",7)(22,"div",8),d(23),a(),r(24,"div",9),d(25),a()(),r(26,"div",7)(27,"div",8),x(28,"app-money",10),a(),r(29,"div",9),d(30),a()()()(),r(31,"div",11),m(32,Ta,2,2,"div",12)(33,wa,4,1,"div",13)(34,Fa,9,3),a(),m(35,Ua,2,1,"div",14),a(),r(36,"app-pickup-drop-handover",15),C("completed",function(){return o.onHandoverCompleted()})("closed",function(){return o.onHandoverClosed()}),a()),i&2&&(n(5),w("",o.greeting,","),n(2),_(o.userName),n(2),_(o.userInitials
2),n(4),_(o.tasks.length),n(2),_(o.formatMessage("pickup_drop_stops")),n(3),_(o.pickupCount),n(2),_(o.formatMessage("pickup_drop_pickups")),n(3),_(o.dropCount),n(2),_(o.formatMessage("pickup_drop_drops")),n(3),p("value",o.codTotal),n(2),_(o.formatMessage("pickup_drop_cod")),n(2),u(o.loading?32:o.tasks.length?34:33),n(3),u(!o.loading&&(o.nextTask!=null&&o.nextTask.address)?35:-1),n(),p("isVisible",o.isHandoverVisible)("task",o.handoverTask)("mode",o.handoverMode))},dependencies:[St,yt,Y,z,W,q,it,j,$,Dt,J,K,Qe],styles:['@charset "UTF-8";.app-route[_ngcontent-%COMP%]{display:flex;flex-direction:column}.app-route-hero[_ngcontent-%COMP%]{background:var(--bp-brand-700);color:#fff;padding:16px;border-radius:0 0 16px 16px}.app-route-hero-top[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between}.app-route-hero-greeting[_ngcontent-%COMP%]{font-size:.6875rem;opacity:.85}.app-route-hero-name[_ngcontent-%COMP%]{font-size:1.25rem;font-weight:700;letter-spacing:-.01em}.app-route-hero-avatar[_ngcontent-%COMP%]{width:40px;height:40px;border-radius:50%;background:#ffffff2e;display:grid;place-items:center;font-weight:700;font-size:.875rem}.app-route-hero-stats[_ngcontent-%COMP%]{display:flex;gap:8px;margin-top:14px}.app-route-stat[_ngcontent-%COMP%]{flex:1;background:#ffffff21;border-radius:var(--bp-radius-md);padding:9px 10px}.app-route-stat-value[_ngcontent-%COMP%]{font-size:1rem;font-weight:700;font-variant-numeric:tabular-nums}.app-route-stat-label[_ngcontent-%COMP%]{font-size:.625rem;opacity:.8;margin-top:1px}.app-route-body[_ngcontent-%COMP%]{padding:14px 14px calc(var(--bp-bottom-nav-height) + 3.5rem)}.app-route-list-head[_ngcontent-%COMP%]{display:flex;align-items:baseline;justify-content:space-between;margin-bottom:12px;font-weight:700;font-size:var(--font-body);color:var(--primary-text)}.app-route-list-count[_ngcontent-%COMP%]{font-size:.6875rem;color:var(--bp-text-muted);font-weight:600}.app-route-empty[_ngcontent-%COMP%]{text-align:center;color:var(--bp-text-muted);padding:48px 16px}.app-route-empty[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:2rem;display:block;margin-bottom:10px}.app-route-timeline[_ngcontent-%COMP%]{position:relative}.app-route-timeline-line[_ngcontent-%COMP%]{position:absolute;left:19px;top:10px;bottom:30px;width:2px;background:var(--theme-border-color)}.app-route-stop[_ngcontent-%COMP%]{display:flex;gap:12px;margin-bottom:12px;position:relative}.app-route-stop-marker[_ngcontent-%COMP%]{width:40px;flex:none;display:flex;justify-content:center;z-index:1}.app-route-stop-bullet[_ngcontent-%COMP%]{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;font-weight:700;font-size:.875rem;font-variant-numeric:tabular-nums;background:var(--primary-bg);color:var(--bp-text-muted);border:2px solid var(--theme-border-color)}.app-route-stop-bullet.next[_ngcontent-%COMP%]{background:var(--bp-brand-600);color:#fff;border:none;box-shadow:0 6px 16px color-mix(in srgb,var(--bp-brand-600) 35%,transparent)}.app-route-stop-card[_ngcontent-%COMP%]{flex:1;padding:11px 13px;min-width:0}.app-route-stop-type[_ngcontent-%COMP%]{color:var(--bp-brand-600);background:var(--bp-pill-brand-bg)}.app-route-stop-type--drop[_ngcontent-%COMP%]{color:var(--bp-success-600);background:var(--bp-pill-success-bg)}.app-route-stop-card.next[_ngcontent-%COMP%]{border-color:var(--bp-brand-500);box-shadow:0 0 0 3px var(--bp-focus-ring)}.app-route-stop-time[_ngcontent-%COMP%]{font-size:var(--font-micro);color:var(--bp-text-muted);font-weight:600;white-space:nowrap}.app-route-stop-device[_ngcontent-%COMP%]{font-weight:600;font-size:var(--font-body)}.app-route-stop-party[_ngcontent-%COMP%]{font-size:.6875rem;color:var(--bp-text-muted);margin-top:2px}.app-route-stop-tags[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin-top:9px;flex-wrap:wrap}.app-route-stop-link[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:5px;font-size:.75rem;font-weight:600;color:var(--bp-brand-600);background:var(--bp-pill-brand-bg);padding:5px 11px;border-radius:var(--bp-radius-pill);text-decoration:none}.app-route-stop-actions[_ngcontent-%COMP%]{display:flex;gap:8px;margin-top:11px}.app-route-cta[_ngcontent-%COMP%]{position:fixed;left:0;right:0;bottom:var(--bp-bottom-nav-height);z-index:999}']})}}return t})();var Ha=()=>["ref","customer"],Ba=(t,s)=>s.key,$a=(t,s)=>s.value;
2function ja(t,s){if(t&1){let e=k();r(0,"div",2)(1,"span",5),x(2,"i",6),a(),r(3,"div")(4,"h3",7),d(5),a(),r(6,"p",8),d(7),a()(),r(8,"div",9)(9,"dx-button",10),C("onClick",function(){h(e);let o=l();return v(o.scheduleAnother())}),a(),r(10,"dx-button",11),C("onClick",function(){h(e);let o=l();return v(o.close())}),a()()()}if(t&2){let e=l();n(5),M("",e.typeLabel(e.typeValue)," ",e.formatMessage("pickup_drop_scheduled_done")),n(2),_(e.formatMessage("pickup_drop_customer_notified_short")),n(2),p("text",e.formatMessage("pickup_drop_schedule_another")),n(),p("text",e.formatMessage("common_done"))}}function Ga(t,s){if(t&1){let e=k();r(0,"div",16)(1,"button",17),C("click",function(){let o=h(e).$implicit,c=l(2);return v(c.pick(o.key))}),r(2,"span",22),x(3,"i",23),a(),r(4,"span",20),d(5),a(),r(6,"span",21),d(7),a()()()}if(t&2){let e=s.$implicit,i=l(2);n(2),rt("background",e.color+"22")("color",e.color),n(),p("ngClass",e.icon),n(2),_(i.formatMessage(e.label)),n(2),_(i.formatMessage(e.desc))}}function Ka(t,s){if(t&1){let e=k();r(0,"dx-scroll-view",3)(1,"div",12)(2,"h5",13),d(3),a(),r(4,"p",14),d(5),a()(),r(6,"div",15),P(7,Ga,8,7,"div",16,Ba),r(9,"div",16)(10,"button",17),C("click",function(){h(e);let o=l();return v(o.createWithoutSource())}),r(11,"span",18),x(12,"i",19),a(),r(13,"span",20),d(14),a(),r(15,"span",21),d(16),a()()()()()}if(t&2){let e=l();n(3),_(e.formatMessage("pickup_drop_source_question")),n(2),_(e.formatMessage("pickup_drop_source_hint")),n(2),T(e.sources),n(7),_(e.formatMessage("pickup_drop_source_none")),n(2),_(e.formatMessage("pickup_drop_source_none_desc"))}}function za(t,s){if(t&1){let e=k();r(0,"dx-button",48),C("onClick",function(){let o=h(e).$implicit,c=l(2);return v(c.onTypeToggle(o.value))}),a()}if(t&2){let e,i,o=s.$implicit,c=l(2);p("text",o.text)("icon",o.icon)("type",((e=c.form.get("type"))==null?null:e.value)===o.value?"default":"normal")("stylingMode",((i=c.form.get("type"))==null?null:i.value)===o.value?"contained":"outlined")}}function qa(t,s){if(t&1&&(r(0,"span",54),d(1),a()),t&2){let e=l().$implicit;n(),_(e.title)}}function Wa(t,s){if(t&1&&(r(0,"span",59),d(1),V(2,"dateFormat"),a()),t&2){let e=l(2).$implicit;n(),w("\xB7 ",_e(2,1,e.date))}}function Ja(t,s){if(t&1&&(r(0,"div",55),d(1),m(2,Wa,3,3,"span",59),a()),t&2){let e=l().$implicit;n(),w(" ",e.customer),n(),u(e.date?2:-1)}}function Ya(t,s){if(t&1&&(r(0,"div",57),x(1,"app-money",60),a()),t&2){let e=l().$implicit;n(),p("value",e.amount)}}function Qa(t,s){if(t&1&&(r(0,"span",58),d(1),a()),t&2){let e=l().$implicit;n(),_(e.status)}}function Xa(t,s){if(t&1&&(r(0,"div")(1,"div",51)(2,"div",52)(3,"div",31)(4,"span",53),d(5),a(),m(6,qa,2,1,"span",54),a(),m(7,Ja,3,2,"div",55),a(),r(8,"div",56),m(9,Ya,2,1,"div",57),m(10,Qa,2,1,"span",58),a()()()),t&2){let e=s.$implicit;n(5),_(e.ref),n(),u(e.title?6:-1),n(),u(e.customer||e.date?7:-1),n(2),u(e.amount?9:-1),n(),u(e.status?10:-1)}}function Za(t,s){if(t&1){let e=k();r(0,"app-control-container",33)(1,"dx-select-box",49),C("onValueChanged",function(o){h(e);let c=l(2);return v(c.onLinkedValueChanged(o))}),F(2,Xa,11,5,"div",50),a()()}if(t&2){let e=l(2);p("errorMsg",e.formatMessage("common_required"))("label",e.linkedLabel),n(),p("dataSource",e.linkedDataSource)("value",e.selectedLinkedId)("placeholder",e.linkedPlaceholder)("searchEnabled",!0)("minSearchLength",1)("searchExpr",Ct(12,Ha))("searchTimeout",300)("showDataBeforeSearch",!0)("noDataText",e.formatMessage("pickup_drop_no_records")),n(),p("dxTemplateOf","item")}}function er(t,s){if(t&1&&x(0,"dx-text-box",35),t&2){let e=l(2);p("value",e.linkedCustomerName)("readOnly",!0)("placeholder",e.formatMessage("common_customer"))}}function tr(t,s){if(t&1){let e=k();r(0,"app-party-selector",61),C("itemClick",function(o){h(e);let c=l(2);return v(c.onCustomerSelect(o))}),a()}if(t&2){let e=l(2);p("entity",e.ENTITIES.PICKUP_DROP.name)("formControl",e.form.controls.user_id)("isCardLayout",!0)("isEditMode",!0)("isRequiredAddress",!0)("isVisibleAddAction",!0)}}function ir(t,s){if(t&1&&(r(0,"app-control-container",39),x(1,"dx-text-box",35),a()),t&2){let e=l(2);p("label",e.formatMessage("common_parts")),n(),p("value",e.linkedPartsLabel)("readOnly",!0)("placeholder",e.formatMessage("pickup_drop_sale_parts_hint"))}}function nr(t,s){if(t&1&&x(0,"dxi-button",64),t&2){let e=l(3);p("options",e.addDeviceTypeOption)}}function or(t,s){if(t&1&&x(0,"dxi-button",64),t&2){let e=l(3);p("options",e.addDeviceBrandOption)}}function ar(t,s){if(t&1&&x(0,"dxi-button",64),t&2){let e=l(3);p("options",e.addDeviceModelOption)}}function rr(t,s){if(t&1&&(r(0,"app-control-container",62)(1,"dx-select-box",63),m(2,nr,1,1,"dxi-button",64),a()(),r(3,"app-control-container",65)(4,"dx-select-box",66),m(5,or,1,1,"dxi-button",64),a()(),r(6,"app-control-container",67)(7,"dx-select-box",68),m(8,ar,1,1,"dxi-button",64),a()()),t&2){let e=l(2);p("errorMsg",e.formatMessage("device_type_required_warning"))("label",e.formatMessage("device_type_name")),n(),p("noD
2ataText",e.formatMessage("common_no_options_add_new"))("dataSource",e.deviceTypes)("placeholder",e.formatMessage("placeholder_select_device_type_pickup")),n(),u(e.canInlineCreate(e.ENTITIES.DEVICE_TYPE.name)?2:-1),n(),p("label",e.formatMessage("device_brand_name")),n(),p("noDataText",e.formatMessage("common_no_options_add_new"))("dataSource",e.deviceBrandList)("placeholder",e.formatMessage("device_brand_name"))("searchEnabled",!0),n(),u(e.canInlineCreate(e.ENTITIES.DEVICE_BRAND.name)?5:-1),n(),p("label",e.formatMessage("device_model")),n(),p("noDataText",e.formatMessage("common_no_options_add_new"))("dataSource",e.deviceModelList)("placeholder",e.formatMessage("device_model"))("searchEnabled",!0),n(),u(e.canInlineCreate(e.ENTITIES.DEVICE_MODEL.name)?8:-1)}}function lr(t,s){if(t&1){let e=k();r(0,"form",4)(1,"dx-scroll-view",3)(2,"div",24)(3,"div",25)(4,"span",22),x(5,"i",23),a(),r(6,"div",26)(7,"div",27),d(8),a(),r(9,"div",21),d(10),a()(),r(11,"dx-button",28),C("onClick",function(){h(e);let o=l();return v(o.changeSource())}),a()()(),r(12,"div",29)(13,"app-control-container",30)(14,"div",31),P(15,za,1,4,"dx-button",32,$a),a()(),m(17,Za,3,13,"app-control-container",33),r(18,"app-control-container",34),m(19,er,1,3,"dx-text-box",35)(20,tr,1,6,"app-party-selector",36),a(),r(21,"app-control-container",37),x(22,"app-mobile-number",38),a(),m(23,ir,2,4,"app-control-container",39)(24,rr,9,18),r(25,"app-control-container",40),x(26,"app-employee-dropdown",41),a(),r(27,"app-control-container",42),x(28,"dx-date-box",43),a(),x(29,"app-address",44),r(30,"div",45),x(31,"app-user-notification-channel",46),a()()(),r(32,"app-save-cancel-footer",47),C("cancelClick",function(){h(e);let o=l();return v(o.changeSource())})("saveClick",function(){h(e);let o=l();return v(o.save())}),a()()}if(t&2){let e=l();p("formGroup",e.form),n(4),rt("background",e.selectedSrc.color+"22")("color",e.selectedSrc.color),n(),p("ngClass",e.selectedSrc.icon),n(3),_(e.formatMessage(e.selectedSrc.label)),n(2),_(e.formatMessage(e.selectedSrc.desc)),n(),p("text",e.formatMessage("common_change")),n(2),p("label",e.formatMessage("common_type")),n(2),T(e.pickupDropToggleItems),n(2),u(e.hasLinkedPicker?17:-1),n(),p("errorMsg",e.formatMessage("common_error_messages_customer_required"))("label",e.formatMessage("common_customer")),n(),u(e.linkedCustomerName?19:20),n(2),p("errorMsg",e.formatMessage("common_mobile_number_required"))("label",e.formatMessage("common_mobile")),n(),p("formControl",e.form.controls.mobile_number)("form",e.form),n(),u(e.isPartsSource?23:24),n(2),p("label",e.formatMessage("common_assignee")),n(),p("entity",e.entity),n(),p("errorMsg",e.formatMessage("common_error_messages_date_required"))("label",e.formatMessage("common_schedule_on")),n(),p("dateSerializationFormat",e.DATETIME_SERIALIZATION_FORMAT)("displayFormat",e.tenantService.dxDateTimeFormat())("min",e.today)("pickerType","calendar")("placeholder",e.formatMessage("common_select_from_calendar")),n(),p("isAddressOptional",!1)("parentForm",e.form),n(2),p("form",e.form),n(),p("isOnPopup",!0)("isSaving",e.isSaving)("useSubmitBehavior",!1)}}var Gt=(()=>{class t{constructor(){this.inlineCreateService=b(Ft),this.addDeviceTypeOption=this.inlineCreateService.buttonOptions({entity:g.DEVICE_TYPE.name,onCreated:e=>{this.deviceTypes=[e,...this.deviceTypes??[]],this.form?.patchValue({device_type_id:e.id})}}),this.addDeviceBrandOption=this.inlineCreateService.buttonOptions({entity:g.DEVICE_BRAND.name,seed:()=>({device_type_id:this.form?.getRawValue()?.device_type_id}),onCreated:e=>{this.allDeviceBrandList=[e,...this.allDeviceBrandList??[]],this.deviceBrandList=[e,...this.deviceBrandList??[]],this.form?.patchValue({device_brand_id:e.id})}}),this.addDeviceModelOption=this.inlineCreateService.buttonOptions({entity:g.DEVICE_MODEL.name,seed:()=>({device_type_id:this.form?.getRawValue()?.device_type_id,device_brand_id:this.form?.getRawValue()?.device_brand_id}),onCreated:e=>{this.allDeviceModelList=[e,...this.allDeviceModelList??[]],this.deviceModelList=[e,...this.deviceModelList??[]],this.form?.patchValue({device_model_id:e.id})}}),this.formatMessage=f,this.ENTITIES=g,this.pickupDropList=I,this.entity=g.PICKUP_DROP,this.DATETIME_SERIALIZATION_FORMAT=gt,this.service=b(N),this.jobService=b(Ze),this.saleService=b(tt),this.purchaseService=b(Bt),this.contactUsService=b(gn),this.deviceTypeService=b(Mt),this.dataService=b(Bi),this.customerService=b(bt),this.geoLocationService=b(ye),this.toast=b(R),this.formService=b(Ge),this.router=b(X),this.tenantService=b(ie),this.isVisible=!1,this.closed=new U,this.saved=new U,this.step=1,this.today=this.tenantService.today(),this.drawerPosition={my:"right",at:"right",of:window},this.selectedSource=null,this.isSaving=!1,this.isDone=!1,this.deviceTypes=[],this.linkedParts=[],this.allDeviceBrandList=[],this.deviceBrandList=[],this.allDeviceModelList=[],this.deviceModelList=[],this.linkedDataSource=null,this.selectedLinkedId=null,this.linkedCustomerName=null,this.SOURCE_DIRECTION={[g.CONTACT_US.name]:I[0].text,[g.PURCHASE.name]:I[0].text,[g.SALE.name]:I[1].text,[g.OUTSOURCED_JOB.name]:I[1].text},this.SOURCE_PICKERS={[g.JOB.name]:{service:this.jobService,label:"pickup_drop_linked_job",placeholder:"pickup_drop_linked_job_placeholder",card:e=>({ref:e.formatted_job_number||e.job_number||"#"+e.id,title:this.deviceLabel(e),customer:e.user?.name??null,date:e.created_at,
2status:e.status?.name??e.status,amount:e.total_amount??null})},[g.SALE.name]:{service:this.saleService,label:"pickup_drop_linked_sale",placeholder:"pickup_drop_linked_sale_placeholder",card:e=>({ref:e.sale_number||"#"+e.id,title:null,customer:e.user?.name??null,date:e.created_at,status:e.status?.name??e.status,amount:e.total_amount??null})},[g.PURCHASE.name]:{service:this.purchaseService,label:"pickup_drop_linked_purchase",placeholder:"pickup_drop_linked_purchase_placeholder",card:e=>({ref:e.purchase_number||"#"+e.id,title:e.party_invoice_number?"#"+e.party_invoice_number:null,customer:e.part_supplier?.name??e.supplier?.name??e.user?.name??null,date:e.created_at,status:e.status?.name??e.status,amount:e.total_amount??null})},[g.CONTACT_US.name]:{service:this.contactUsService,label:"pickup_drop_linked_self_checkin",placeholder:"pickup_drop_linked_self_checkin_placeholder",card:e=>({ref:"#"+e.id,title:this.deviceLabel(e),customer:e.name??null,date:e.created_at,status:e.status??null,amount:null})}},this.sources=[{key:g.JOB.name,label:"pickup_drop_source_job",desc:"pickup_drop_source_job_desc",icon:"fa-thin fa-ticket",color:"#2563eb"},{key:g.CONTACT_US.name,label:"pickup_drop_source_self_checkin",desc:"pickup_drop_source_self_checkin_desc",icon:"fa-thin fa-laptop-mobile",color:"#06b6d4"},{key:g.SALE.name,label:"pickup_drop_source_sale",desc:"pickup_drop_source_sale_desc",icon:"fa-thin fa-cart-shopping",color:"#10b981"},{key:g.PURCHASE.name,label:"pickup_drop_source_purchase",desc:"pickup_drop_source_purchase_desc",icon:"fa-thin fa-store",color:"#f59e0b"}],this.ALL_TOGGLE_ITEMS=[{value:I[0].text,text:f("pickup_drop_type_pickup"),icon:"fa-thin fa-arrow-up-from-bracket"}
2,{value:I[1].text,text:f("pickup_drop_type_drop"),icon:"fa-thin fa-arrow-down-to-bracket"}],this.pickupDropToggleItems=this.ALL_TOGGLE_ITEMS}canInlineCreate(e){return this.inlineCreateService.canCreate(e)}ngOnChanges(e){e.isVisible&&this.isVisible&&this.reset()}get selectedSrc(){return this.sources.find(e=>e.key===this.selectedSource)}get currentPicker(){return this.SOURCE_PICKERS[this.selectedSource]??null}get hasLinkedPicker(){return!!this.currentPicker}get linkedLabel(){return this.currentPicker?f(this.currentPicker.label):""}get linkedPlaceholder(){return this.currentPicker?f(this.currentPicker.placeholder):""}get typeValue(){return this.form?.get("type")?.value}get isPartsSource(){return this.selectedSource===g.SALE.name||this.selectedSource===g.PURCHASE.name}get linkedPartsLabel(){return this.linkedParts.map(e=>e?.name).filter(Boolean).join(", ")}applyToggleItems(){this.selectedSource===g.SALE.name?this.pickupDropToggleItems=this.ALL_TOGGLE_ITEMS.filter(e=>e.value===I[1].text):this.selectedSource===g.PURCHASE.name?this.pickupDropToggleItems=this.ALL_TOGGLE_ITEMS.filter(e=>e.value===I[0].text):this.pickupDropToggleItems=this.ALL_TOGGLE_ITEMS}onTypeToggle(e){e&&this.form.patchValue({type:e})}typeLabel(e){return f(e===I[1].text?"pickup_drop_type_drop":"pickup_drop_type_pickup")}pick(e){this.selectedSource=e,this.applyDirection(),this.applyToggleItems(),this.applyDeviceRequirement(),this.applyCustomerRequirement(),this.applyLinkedRequirement(),this.selectedLinkedId=null,this.linkedCustomerName=null,this.linkedParts=[],this.form.patchValue({linkable_type:null,linkable_id:null}),this.linkedDataSource=this.currentPicker?this.buildLinkedDataSource(this.currentPicker):null,this.step=2}applyDeviceRequirement(){let e=this.form.get("device_type_id"),i=this.selectedSource===g.SALE.name||this.selectedSource===g.PURCHASE.name;e.setValidators(i?[]:[De.required]),e.updateValueAndValidity()}applyCustomerRequirement(){let e=this.form.get("user_id"),i=this.selectedSource===g.CONTACT_US.name;e.setValidators(i?[]:[De.required]),e.updateValueAndValidity()}applyLinkedRequirement(){let e=this.form.get("linkable_id");e.setValidators(this.currentPicker?[De.required]:[]),e.updateValueAndValidity()}changeSource(){this.step=1}createWithoutSource(){this.close(),this.router.navigate(["/"+re+"/add"])}onLinkedValueChanged(e){let i=e?.value??null;this.selectedLinkedId=i,i?(this.form.patchValue({linkable_id:i,linkable_type:this.selectedSource}),this.autofillFromRecord(i)):(this.form.patchValue({linkable_id:null,linkable_type:null}),this.linkedCustomerName=null,this.linkedParts=[])}onCustomerSelect(e){this.form.patchValue({mobile_number:e?.mobile_number,mobile_country_code:e?.mobile_country_code}),this.patchAddressGroup(e)}patchAddressGroup(e){let i=e?.address??e,o=this.form.get("address");o instanceof ht&&i&&o.patchValue({address_line:i.address_line??null,city:i.city??null,state:i.state??null,zip_code:i.zip_code??null})}autofillFromRecord(e){let i=this.currentPicker;i&&i.service.getById(e).subscribe({next:o=>{let c=o?.data??o,y={};this.isPartsSource&&(this.linkedParts=Array.isArray(c?.partables)?c.partables:[]);let D=c?.user_id??c?.user?.id??c?.part_supplier_id??null;if(D&&(y.user_id=D,this.linkedCustomerName=null),this.form.patchValue(y),this.applyDeviceSelection(c),D)this.customerService.getById(D).subscribe({next:E=>this.onCustomerSelect(E?.data??E),error:()=>{}});else{let E=c?.user??null;this.linkedCustomerName=this.selectedSource===g.CONTACT_US.name?c?.name??null:null,this.form.patchValue({mobile_number:E?.mobile_number??c?.mobile_number??this.form.get("mobile_number")?.value,mobile_country_code:E?.mobile_country_code??c?.mobile_country_code??this.form.get("mobile_country_code")?.value}),this.patchAddressGroup(E??c)}},error:()=>{}})}save(){return B(this,null,function*(){if(this.form.invalid){this.formService.validateFormFields(this.form);return}this.isSaving=!0;let e=this.form.getRawValue(),i=e.address,o=i&&typeof i=="object"?Lt(i):ke(i),c=e.destination_lat,y=e.destination_lng;if((!c||!y)&&o)try{let D=yield this.geoLocationService.getAddressCoordinates(o);c=D.lat,y=D.lng}catch(D){}this.service.create(mt(Q({},e),{address:o,destination_lat:c,destination_lng:y})).subscribe({next:()=>{this.isSaving=!1,this.isDone=!0,this.saved.emit()},error:()=>{this.isSaving=!1,this.toast.error("notification_pickup_schedule_error")}})})}scheduleAnother(){this.reset()}
2close(){this.closed.emit()}reset(){this.step=1,this.selectedSource=null,this.isDone=!1,this.isSaving=!1,this.linkedDataSource=null,this.selectedLinkedId=null,this.linkedCustomerName=null,this.linkedParts=[],this.pickupDropToggleItems=this.ALL_TOGGLE_ITEMS,this.form=be.getForm(new be({}));let e=Ye.getForm(new Ye({}),!1);e.get("address_line").setValidators(De.required),this.form.setControl("address",e),this.form.addControl("linkable_type",new Z(null)),this.form.addControl("linkable_id",new Z(null)),this.form.patchValue({mode:Ee.DOORSTEP}),this.deviceBrandList=[],this.deviceModelList=[],this.wireDeviceCascade(),this.deviceTypes.length||this.deviceTypeService.getList().subscribe({next:i=>this.deviceTypes=i,error:()=>{}}),this.allDeviceBrandList.length||this.dataService.getLookups().subscribe({next:i=>{this.allDeviceBrandList=i.device_brands??[],this.allDeviceModelList=i.device_models??[],this.refreshDeviceLists()},error:()=>{}})}applyDeviceSelection(e){e?.device_type_id&&(this.form.patchValue({device_type_id:e.device_type_id}),e?.device_brand_id&&this.form.patchValue({device_brand_id:e.device_brand_id}),e?.device_model_id&&this.form.patchValue({device_model_id:e.device_model_id}))}refreshDeviceLists(){let e=this.form?.get("device_type_id")?.value,i=this.form?.get("device_brand_id")?.value;this.deviceBrandList=e?this.allDeviceBrandList.filter(o=>o.device_type_id===e):[],this.deviceModelList=i?this.allDeviceModelList.filter(o=>o.device_brand_id===i&&o.device_type_id===e):[]}wireDeviceCascade(){this.form.get("device_type_id").valueChanges.subscribe(e=>{this.deviceBrandList=this.allDeviceBrandList.filter(i=>i.device_type_id===e),this.deviceModelList=[],this.form.patchValue({device_brand_id:null,device_model_id:null},{emitEvent:!1})}),this.form.get("device_brand_id").valueChanges.subscribe(e=>{let i=this.form.get("device_type_id").value;this.deviceModelList=this.allDeviceModelList.filter(o=>o.device_brand_id===e&&o.device_type_id===i),this.form.patchValue({device_model_id:null},{emitEvent:!1})})}applyDirection(){let e=this.SOURCE_DIRECTION[this.selectedSource];e&&this.form.patchValue({type:e})}deviceLabel(e){return[e?.device_type?.name,e?.device_brand?.name??e?.custom_brand_name,e?.device_model?.name??e?.custom_model_name].filter(Boolean).join(" ")||null}buildLinkedDataSource(e){return new Vt({key:"id",paginate:!0,pageSize:20,load:i=>{let o=i.take||20,c=i.skip||0,y={search_term:(i.searchValue??"").trim(),per_page:o,page:Math.floor(c/o)+1};return(typeof e.service.getJobListByQuery=="function"?e.service.getJobListByQuery(y):e.service.getListByQuery(y)).toPromise().then(E=>({data:(Array.isArray(E)?E:E?.data??[]).map(_t=>Q({id:_t.id},e.card(_t))),totalCount:Array.isArray(E)?void 0:E?.total})).catch(()=>({data:[],totalCount:0}))},byKey:i=>e.service.getById(i).toPromise().then(o=>{let c=o?.data??o;return c?Q({id:c.id},e.card(c)):null}).catch(()=>null)})}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=O({type:t,selectors:[["app-pickup-drop-schedule"]],inputs:{isVisible:"isVisible"},outputs:{closed:"closed",saved:"saved"},features:[se],decls:5,vars:5,consts:[[3,"hidden","bodyPadding","scrollable","title","visible"],["id","pickup-drop-schedule",1,"d-flex","flex-column","h-100","px-3","pt-3","min-height-0"],[1,"d-flex","flex-grow-1","flex-column","align-items-center","justify-content-center","text-center","gap-3","py-5"],[1,"flex-grow-1","min-height-0"],[1,"d-flex","flex-column","h-100",3,"formGroup"],[1,"rounded-circle","bg-success-subtle","text-success","d-inline-flex","align-items-center","justify-content-center","p-4"],[1,"fa-thin","fa-circle-check","fs-1"],[1,"mb-1","fw-bold"],[1,"text-muted","mb-0"],[1,"d-flex","gap-2","mt-2"],["stylingMode","outlined","type","default",3,"onClick","text"],["stylingMode","contained","type","default",3,"onClick","text"],[1,"mb-3"],[1,"fw-bold","mb-1"],[1,"text-muted","small","mb-0"],[1,"row","row-cols-1","row-cols-sm-2","g-3"],[1,"col"],["type","button",1,"card","theme-secondary-bg","w-100","h-100","text-start","p-3","d-flex","flex-column","align-items-start","gap-2",3,"click"],[1,"rounded","d-inline-flex","align-items-center","justify-content-center","p-2","bg-secondary-subtle","text-secondary"],[1,"fa-thin","fa-link-slash"],[1,"fw-bold"],[1,"text-muted","small"],[1,"rounded","d-inline-flex","align-items-center","justify-content-center","p-2"],[3,"ngClass"],[1,"card","theme-secondary-bg","mb-3"],[1,"card-body","d-flex","align-items-center","gap-3","py-2"],[1,"flex-grow-1"],[1,"fw-semibold"],["stylingMode","text","type","default","icon","fa-thin fa-arrow-left",3,"onClick","text"],[1,"row"],["name","type",1,"col-12",3,"label"],[1,"d-flex","align-items-center","gap-2","flex-wrap"],[3,"text","icon","type","stylingMode"],["name","linkable_id",1,"col-12",3,"errorMsg","label"],["name","user_id",1,"col-sm-6",3,"errorMsg","label"],[3,"value","readOnly","placeholder"],[3,"entity","formControl","isCardLayout","isEditMode","isRequiredAddress","isVisibleAddAction"],["name","mobile_number",1,"col-sm-6",3,"errorMsg","label"],[3,"formControl","form"],["name","device_type_id",1,"col-sm-6",3,"label"],["name","assigned_user_id",1,"col-sm-6",3,"label"],["formControlName","assigned_user_id","placeholder","common_assignee_placeholder",3,"entity"],["name","scheduled_on",1,"col-12",3,"errorMsg","label"],["formControlName","scheduled_on","type","datetime",3,"dateSerializationFormat","displayFormat","min","pickerType","placeholder"],["columnClass","col-sm-6",3,"isAddressOptional","parentForm"],[1,"col-12"],[3,"form"],["cancelLabel","common_back","saveText","common_schedule","savingText","common_scheduling",3,"cancelClick","
2saveClick","isOnPopup","isSaving","useSubmitBehavior"],[3,"onClick","text","icon","type","stylingMode"],["valueExpr","id","displayExpr","ref","searchMode","contains",3,"onValueChanged","dataSource","value","placeholder","searchEnabled","minSearchLength","searchExpr","searchTimeout","showDataBeforeSearch","noDataText"],[4,"dxTemplate","dxTemplateOf"],[1,"d-flex","align-items-start","justify-content-between","gap-2"],[1,"min-width-0"],[1,"fw-bold","text-primary"],[1,"small","fw-semibold","text-truncate"],[1,"text-muted","small","text-truncate"],[1,"text-end","flex-shrink-0"],[1,"fw-semibold","small"],[1,"badge","theme-badge"],[1,"ms-1"],["digits","1.0-0",3,"value"],[3,"itemClick","entity","formControl","isCardLayout","isEditMode","isRequiredAddress","isVisibleAddAction"],["name","device_type_id",1,"col-sm-6",3,"errorMsg","label"],["displayExpr","name","formControlName","device_type_id","valueExpr","id",3,"noDataText","dataSource","placeholder"],["location","after","name","inlineCreate",3,"options"],["name","device_brand_id",1,"col-sm-6",3,"label"],["displayExpr","name","formControlName","device_brand_id","valueExpr","id",3,"noDataText","dataSource","placeholder","searchEnabled"],["name","device_model_id",1,"col-sm-6",3,"label"],["displayExpr","name","formControlName","device_model_id","valueExpr","id",3,"noDataText","dataSource","placeholder","searchEnabled"]],template:function(i,o){i&1&&(r(0,"app-drawer",0),C("hidden",function(){return o.close()}),r(1,"div",1),m(2,ja,11,5,"div",2)(3,Ka,17,4,"dx-scroll-view",3)(4,lr,33,34,"form",4),a()()),i&2&&(p("bodyPadding",!1)("scrollable",!1)("title",o.formatMessage("pickup_drop_schedule"))("visible",o.isVisible),n(2),u(o.isDone?2:o.step===1?3:o.form?4:-1))},dependencies:[_n,z,W,q,ne,We,qe,Ke,$e,Be,Et,Tt,Pt,Ut,It,Xe,ge,ve,At,et,Je,j,$,Oe,Me,we,Ie,vt,Ae,Ve,oe,J,K],encapsulation:2})}}return t})();function sr(t,s){t&1&&x(0,"app-skeleton-loader",3),t&2&&p("rows",4)("columns",2)}function dr(t,s){if(t&1&&(r(0,"app-control-container",22),x(1,"app-textarea",23),a()),t&2){let e=l(4);p("label",e.formatMessage("pickup_drop_reason"))}}function pr(t,s){if(t&1&&(r(0,"app-control-container",18),x(1,"app-employee-dropdown",19),a(),r(2,"app-control-container",20),x(3,"dx-select-box",21),a(),m(4,dr,2,1,"app-control-container",22)),t&2){let e=l(3);p("label",e.formatMessage("common_assignee")),n(),p("showClearButton",!1),n(),p("label",e.formatMessage("update_status")),n(),p("items",e.statusOptions)("showClearButton",!0)("placeholder",e.formatMessage("pickup_drop_status_keep_current")),n(),u(e.showReason?4:-1)}}function cr(t,s){if(t&1&&(r(0,"app-control-container",15),x(1,"dx-date-box",24),a()),t&2){let e=l(3);p("label",e.formatMessage("pickup_drop_new_schedule")),n(),p("width","100%")("min",e.minDate)("displayFormat",e.tenantService.dxDateTimeFormat())}}function _r(t,s){if(t&1&&x(0,"app-user-notification-channel",16),t&2){let e=l(3);p("form",e.form)}}function mr(t,s){if(t&1){let e=k();r(0,"form",5),C("ngSubmit",function(){h(e);let o=l(2);return v(o.save())}),r(1,"dx-scroll-view",6)(2,"div",7)(3,"div",8)(4,"span",9),d(5),a(),x(6,"app-pickup-drop-status-tag",10),a(),r(7,"div",11)(8,"div",12)(9,"div",13),d(10),a(),r(11,"div"),d(12),a()(),r(13,"div",12)(14,"div",13),d(15),a(),r(16,"div"),d(17),a()(),r(18,"div",12)(19,"div",13),d(20),a(),r(21,"div"),d(22),V(23,"dateFormat"),a()(),r(24,"div",12)(25,"div",13),d(26),a(),r(27,"div"),d(28),a()()()(),r(29,"div",14),m(30,pr,5,7)(31,cr,2,4,"app-control-container",15),a(),m(32,_r,1,1,"app-user-notification-channel",16),a(),r(33,"app-save-cancel-footer",17),C("cancelClick",function(){h(e);let o=l(2);return v(o.onClose())}),a()()}if(t&2){let e=l(2);p("formGroup",e.form),n(5),M("",e.formatMessage(e.record.type==="Drop"?"pickup_drop_type_drop":"pickup_drop_type_pickup")," #",e.record.id),n(),p("status",e.record.status)("type",e.record.type),n(4),_(e.formatMessage("pickup_drop_contact")),n(2),_((e.record.user==null?null:e.record.user.n
2ame)||e.record.mobile_number||"\u2014"),n(3),_(e.formatMessage("common_device")),n(2),_((((e.record.items==null||e.record.items[0]==null?null:e.record.items[0].device_type)||e.record.device_type)==null?null:((e.record.items==null||e.record.items[0]==null?null:e.record.items[0].device_type)||e.record.device_type).name)||"\u2014"),n(3),_(e.formatMessage("pickup_drop_scheduled_col")),n(2),_(L(23,17,e.record.scheduled_on,"datetime")),n(4),_(e.formatMessage("common_assignee")),n(2),_((e.record.assigned_user==null?null:e.record.assigned_user.display_name)??(e.record.assigned_user==null?null:e.record.assigned_user.name)??e.formatMessage("unassigned")),n(2),u(e.isReschedule?31:30),n(2),u(e.isReschedule?-1:32),n(),p("isOnPopup",!0)("isSaving",e.isSaving)}}function ur(t,s){if(t&1&&(r(0,"div",2),m(1,sr,1,2,"app-skeleton-loader",3)(2,mr,34,20,"form",4),a()),t&2){let e=l();n(),u(e.isLoading||!e.form?1:2)}}var nt=(()=>{class t{constructor(){this.formatMessage=f,this.fb=b(mi),this.service=b(N),this.toast=b(R),this.formService=b(Ge),this.tenantService=b(ie),this.isVisible=!1,this.mode="assign",this.closed=new U,this.saved=new U,this.STATUS=S,this.record=null,this.statusOptions=[],this.isLoading=!1,this.isSaving=!1,this.minDate=this.tenantService.today(),this.deskExcludedStatuses=[this.STATUS.COMPLETED,this.STATUS.FAILED,this.STATUS.RESCHEDULED,this.STATUS.ASSIGNED]}get isReschedule(){return this.mode==="reschedule"}get title(){return f(this.isReschedule?"pickup_drop_reschedule":"pickup_drop_update_assignee_status")}ngOnChanges(e){e.isVisible&&this.isVisible&&this.recordId&&this.load()}load(){this.record=null,this.statusOptions=[],this.isLoading=!0,this.form=this.fb.group({assigned_user_id:[null],to:[null],reason:[null],scheduled_on:[null],is_send_mail:[!1],is_send_sms:[!1],is_send_app:[!1],is_send_whatsapp:[!1]}),this.service.getById(this.recordId).subscribe({next:e=>{this.record=e,this.statusOptions=(e?.allowed_transitions??[]).filter(i=>!this.deskExcludedStatuses.includes(i.key)),this.form.patchValue({assigned_user_id:e?.assigned_user_id??null}),this.isLoading=!1},error:()=>{this.isLoading=!1,this.toast.error("notification_update_error"),this.onClose()}})}get selectedStatus(){return this.form?.get("to")?.value??null}get showReason(){return this.selectedStatus===this.STATUS.CANCELLED}get showSchedule(){return this.selectedStatus===this.STATUS.RESCHEDULED}get notifyChannels(){let e=this.form.value;return{is_send_mail:!!e.is_send_mail,is_send_sms:!!e.is_send_sms,is_send_app:!!e.is_send_app,is_send_whatsapp:!!e.is_send_whatsapp}}onClose(){this.isVisible=!1,this.closed.emit()}save(){let e=this.form.value;if(this.isReschedule){if(!e.scheduled_on){this.formService.validateFormFields(this.form),this.toast.warning("pickup_drop_schedule_required");return}this.isSaving=!0,this.service.reschedule(this.recordId,{scheduled_on:e.scheduled_on,expected_status_id:this.record?.status_id}).subscribe({next:()=>{this.toast.success("pickup_drop_rescheduled"),this.saved.emit()},error:()=>this.toast.error("notification_update_error")}).add(()=>this.isSaving=!1);return}let i=e.assigned_user_id!==(this.record?.assigned_user_id??null);if(!e.to&&!i){this.toast.warning("pickup_drop_no_changes");return}if(e.to===this.STATUS.ASSIGNED&&!e.assigned_user_id){this.toast.warning("pickup_drop_executive_required");return}if(this.showReason&&!e.reason){this.formService.validateFormFields(this.form),this.toast.warning("pickup_drop_reason_required");return}if(this.showSchedule&&!e.scheduled_on){this.toast.warning("pickup_drop_schedule_required");return}this.isSaving=!0,(e.to?this.service.transition(this.recordId,{to:e.to,expected_status_id:this.record?.status_id,assigned_user_id:e.assigned_user_id??void 0,reason:e.reason??void 0,scheduled_on:e.scheduled_on??void 0}):this.service.assign(this.recordId,Q({assigned_user_id:e.assigned_user_id},this.notifyChannels))).subscribe({next:()=>{this.toast.success(e.to?"pickup_drop_status_updated":"notification_assignee_update_success"),this.saved.emit()},error:()=>this.toast.error("notification_update_error")}).add(()=>this.isSaving=!1)}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=O({type:t,selectors:[["app-pickup-drop-assign-popup"]],inputs:{recordId:"recordId",isVisible:"isVisible",mode:"mode"},outputs:{closed:"closed",saved:"saved"},features:[se],decls:2,vars:6,consts:[["appPhoneMode","","id","pickup-drop-assign-popup",3,"onHidden","visibleChange","visible","width","maxWidth","maxHeight","title"],["class","d-flex flex-column h-100",4,"dxTemplate","dxTemplateOf"],[1,"d-flex","flex-column","h-100"],["type","form",3,"rows","columns"],[1,"d-flex","flex-column","h-100",3,"formGroup"],[1,"d-flex","flex-column","h-100",3,"ngSubmit","formGroup"],[1,"flex-grow-1","min-height-0"],[1,"card","theme-secondary-bg","border-0","rounded-3","p-3","mb-3"],[1,"d-flex","align-items-center","justify-content-between","mb-2"],[1,"fw-bold"],[3,"status","type"],[1,"row","g-2","small"],[1,"col-6"],[1,"text-muted"],[1,"row"],["name","scheduled_on",1,"col-12",3,"label"],[3,"form"],[3,"cancelClick","isOnPopup","isSaving"],["name","assigned_user_id",1,"col-12",3,"label"],["formControlName","assigned_user_id","placeholder","pickup_drop_select_assignee",3,"showClearButton"],["name","to",1,"col-12","mt-2",3,"label"],["formControlName","to","displayExpr","display_name","valueExpr","key",3,"items","showClearButton","placeholder"],["name","reason",1,"col-12","mt-2",3,"label"],["formControlName","reason"],["type","datetime","formControlName","scheduled_on","dateSerializationFormat","yyyy-MM-ddTHH:mm:ss","pickerType","calendar",3,"width","min","displayFormat"]],template:function(i,o){i&1&&(r(0,"dx-popup",0),C("onHidden",function(){return o.onClose()}),ce("visibleChange",function(y){return pe(o.isVisible,y)||(o.isVisible=y),y}),F(1,ur,3,1,"div",1),a()),i&2&&(de("visible",o.isVisible),p("width","95vw")("maxWidth",600)("maxHeight","90vh")("title",o.title),n(),p("dxTemplateOf","content"))},dependencies:[je,he,Ce,ne,ze,We,qe,Y,Ke,Xe,$e,Be,Ht,ge,ve,et,Je,Oe,Me,we,Ie,Ae,Ve,oe,K],encapsulation:2})}}return t})();var xr=(t,s)=>s.key;function fr(t,s){t&1&&x(0,"app-skeleton-loader",3),t&2&&p("rows",5)("columns",1)}
2function Cr(t,s){if(t&1&&(r(0,"div",5)(1,"div",11)(2,"span",12),d(3),a(),x(4,"app-pickup-drop-status-tag",13),a(),r(5,"div",14)(6,"div",15)(7,"div",16),d(8),a(),r(9,"div"),d(10),a()(),r(11,"div",15)(12,"div",16),d(13),a(),r(14,"div"),d(15),a()(),r(16,"div",15)(17,"div",16),d(18),a(),r(19,"div"),d(20),a()(),r(21,"div",15)(22,"div",16),d(23),a(),r(24,"div"),d(25),V(26,"dateFormat"),a()()()()),t&2){let e=l(3);n(3),M("",e.formatMessage(e.record.type==="Drop"?"pickup_drop_type_drop":"pickup_drop_type_pickup")," #",e.record.id),n(),p("status",e.record.status)("type",e.record.type),n(4),_(e.formatMessage("pickup_drop_contact")),n(2),_((e.record.user==null?null:e.record.user.name)||e.record.mobile_number||"\u2014"),n(3),_(e.formatMessage("common_device")),n(2),_((((e.record.items==null||e.record.items[0]==null?null:e.record.items[0].device_type)||e.record.device_type)==null?null:((e.record.items==null||e.record.items[0]==null?null:e.record.items[0].device_type)||e.record.device_type).name)||"\u2014"),n(3),_(e.formatMessage("common_assignee")),n(2),_((e.record.assigned_user==null?null:e.record.assigned_user.display_name)??(e.record.assigned_user==null?null:e.record.assigned_user.name)??e.formatMessage("unassigned")),n(3),_(e.formatMessage("pickup_drop_scheduled_col")),n(2),_(L(26,12,e.record.scheduled_on,"datetime"))}}function hr(t,s){if(t&1&&(r(0,"div",6)(1,"div")(2,"div",17),d(3),a(),r(4,"div",18),d(5),a()(),r(6,"div",19)(7,"div",17),d(8),a(),r(9,"div",12),d(10),a()()()),t&2){let e=l(3);n(3),_(e.formatMessage("pickup_drop_est_arrival")),n(2),M("",e.eta.minutes," ",e.formatMessage("pickup_drop_minutes")),n(3),_(e.formatMessage("distance")),n(2),M("",e.eta.distance_km," ",e.formatMessage("pickup_drop_km"))}}function vr(t,s){if(t&1&&(r(0,"div",7),d(1),a()),t&2){let e=l(4);n(),_(e.formatMessage("pickup_drop_track_no_live"))}}function gr(t,s){if(t&1&&(x(0,"div",20),m(1,vr,2,1,"div",7)),t&2){let e=l(3);n(),u(e.hasLiveLocation?-1:1)}}function br(t,s){if(t&1&&(r(0,"div",7),d(1),a()),t&2){let e=l(3);n(),_(e.formatMessage("pickup_drop_track_no_location"))}}function kr(t,s){if(t&1&&(r(0,"span",24),d(1),V(2,"dateFormat"),a()),t&2){let e=l().$implicit;n(),_(L(2,1,e.at,"datetime"))}}function yr(t,s){if(t&1&&(r(0,"div",22),x(1,"i",23),r(2,"span"),d(3),a(),m(4,kr,3,4,"span",24),a()),t&2){let e=s.$implicit,i=l(4);n(),A("text-success",e.done)("text-muted",!e.done),n(),A("fw-bold",e.current),n(),_(i.journeyLabel(e.key)),n(),u(e.at?4:-1)}}function Sr(t,s){if(t&1&&(r(0,"div",8)(1,"div",21),d(2),a(),P(3,yr,5,8,"div",22,xr),a()),t&2){let e=l(3);n(2),_(e.formatMessage("pickup_drop_journey")),n(),T(e.journey)}}function Dr(t,s){if(t&1){let e=k();r(0,"dx-scroll-view",4),m(1,Cr,27,15,"div",5),m(2,hr,11,6,"div",6),m(3,gr,2,1)(4,br,2,1,"div",7),m(5,Sr,5,1,"div",8),a(),r(6,"div",9)(7,"dx-button",10),C("onClick",function(){h(e);let o=l(2);return v(o.onClose())}),a()()}if(t&2){let e=l(2);n(),u(e.record?1:-1),n(),u(e.eta?2:-1),n(),u(e.hasLiveLocation||e.destination?3:4),n(2),u(e.journey!=null&&e.journey.length?5:-1),n(2),p("text",e.formatMessage("close"))}}function Er(t,s){if(t&1&&(r(0,"div",2),m(1,fr,1,2,"app-skeleton-loader",3)(2,Dr,8,5),a()),t&2){let e=l();n(),u(e.isLoading&&!e.record?1:2)}}var Kt=(()=>{class t{constructor(){this.formatMessage=f,this.service=b(N),this.mapsLoader=b(ji),this.toast=b(R),this.isVisible=!1,this.closed=new U,this.isLoading=!1,this.record=null,this.liveLocation=null,this.destination=null,this.eta=null,this.journey=[],this.map=null,this.courierMarker=null,this.destinationMarker=null,this.routePolyline=null,this.directionsService=null,this.lastRouteOrigin=null,this.lastRouteDest=null,this.routeEta=null,this.serverEta=null,this.pollTimer=null,this.isFetching=!1,this.journeyLabelKeys={[S.SCHEDULED]:"pickup_drop_journey_scheduled",[S.EN_ROUTE]:"pickup_drop_journey_en_route",[S.ARRIVED]:"pickup_drop_journey_arrived",[S.COMPLETED]:"pickup_drop_journey_completed",[S.FAILED]:"pickup_drop_journey_failed"}}static{this.POLL_INTERVAL_MS=15e3}static{this.MAP_ELEMENT_ID="pickup-drop-track-map"}ngOnChanges(e){e.isVisible&&(this.isVisible&&this.recordId?(this.load(!0),this.startPolling()):this.stop())}ngOnDestroy(){this.stop()}journeyLabel(e){return f(this.journeyLabelKeys[e]??e)}get hasLiveLocation(){return this.liveLocation!==null}
2onClose(){this.isVisible=!1,this.stop(),this.closed.emit()}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>this.load(!1),t.POLL_INTERVAL_MS)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}stop(){this.stopPolling(),this.map=null,this.courierMarker=null,this.destinationMarker=null,this.routePolyline=null,this.directionsService=null,this.lastRouteOrigin=null,this.lastRouteDest=null,this.routeEta=null,this.serverEta=null}load(e){this.isFetching||!this.recordId||(this.isFetching=!0,e&&(this.isLoading=!0),this.service.getTrack(this.recordId).subscribe({next:i=>{this.record=i?.pickup_drop??null,this.liveLocation=i?.live_location??null,this.destination=i?.destination??null,this.serverEta=i?.eta??null,this.eta=this.serverEta?this.routeEta??this.serverEta:null,this.journey=i?.journey??[],this.isLoading=!1,this.renderMapSoon()},error:()=>{this.isLoading=!1,e&&this.toast.error("notification_update_error")}}).add(()=>this.isFetching=!1))}renderMapSoon(){setTimeout(()=>this.renderMap(),0)}renderMap(){return B(this,null,function*(){if(!this.liveLocation&&!this.destination)return;let e=document.getElementById(t.MAP_ELEMENT_ID);if(!e)return;try{yield this.mapsLoader.load()}catch(c){return}let i=this.liveLocation?{lat:+this.liveLocation.latitude,lng:+this.liveLocation.longitude}:null,o=this.destination?{lat:+this.destination.latitude,lng:+this.destination.longitude}:null;if(this.map||(this.map=new google.maps.Map(e,{zoom:14,center:i??o,disableDefaultUI:!0,zoomControl:!0})),o&&(this.destinationMarker?this.destinationMarker.setPosition(o):this.destinationMarker=new google.maps.Marker({map:this.map,position:o,title:f("pickup_drop_destination")})),i&&(this.courierMarker?this.courierMarker.setPosition(i):this.courierMarker=new google.maps.Marker({map:this.map,position:i,title:f("pickup_drop_executive"),icon:{path:google.maps.SymbolPath.CIRCLE,scale:8,fillColor:"#2563eb",fillOpacity:1,strokeColor:"#ffffff",strokeWeight:2}})),i&&o){this.drawRoute(i,o);let c=new google.maps.LatLngBounds;c.extend(i),c.extend(o),this.map.fitBounds(c,60)}else this.map.setCenter(i??o)})}drawRoute(e,i){if(!this.map||this.lastRouteOrigin&&this.lastRouteDest&&Yt.metersBetween(e,this.lastRouteOrigin)<30&&Yt.metersBetween(i,this.lastRouteDest)<30&&this.routePolyline?.getPath()?.getLength())return;this.directionsService??=new google.maps.DirectionsService,this.routePolyline??=new google.maps.Polyline({map:this.map,strokeColor:"#2563eb",strokeOpacity:.85,strokeWeight:5});let o=this.routePolyline;this.directionsService.route({origin:e,destination:i,travelMode:google.maps.TravelMode.DRIVING},(c,y)=>{if(y!==google.maps.DirectionsStatus.OK||!c?.routes?.[0])return;o.setPath(c.routes[0].overview_path),this.lastRouteOrigin=e,this.lastRouteDest=i;let D=c.routes[0].legs?.[0];D&&(this.routeEta={minutes:Math.round(D.duration.value/60),distance_km:Math.round(D.distance.value/10)/100},this.serverEta&&(this.eta=this.routeEta))})}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=O({type:t,selectors:[["app-pickup-drop-track-popup"]],inputs:{recordId:"recordId",isVisible:"isVisible"},outputs:{closed:"closed"},features:[se],decls:2,vars:6,consts:[["appPhoneMode","","id","pickup-drop-track-popup",3,"onHidden","visibleChange","visible","width","maxWidth","maxHeight","title"],["class","d-flex flex-column h-100",4,"dxTemplate","dxTemplateOf"],[1,"d-flex","flex-column","h-100"],["type","form",3,"rows","columns"],[1,"flex-grow-1","min-height-0"],[1,"card","theme-secondary-bg","border-0","rounded-3","p-3","mb-3"],[1,"card","theme-secondary-bg","border-0","rounded-3","p-3","mb-3","d-flex","flex-row","align-items-center","justify-content-between"],[1,"text-muted","small","mb-3"],[1,"mb-2"],[1,"d-flex","justify-content-end","pt-2"],["stylingMode","contained","type","normal",3,"onClick","text"],[1,"d-flex","align-items-center","justify-content-between","mb-2"],[1,"fw-bold"],[3,"status","type"],[1,"row","g-2","small"],[1,"col-6"],[1,"text-muted"],[1,"text-muted","small"],[1,"fw-bold","fs-5"],[1,"text-end"],["id","pickup-drop-track-map",1,"rounded-3","mb-3","app-pdtp-width-100","app-pdtp-height-260px"],[1,"text-muted","small","mb-2"],[1,"d-flex","align-items-center","gap-2","py-1"],[1,"fa-solid","fa-circle","app-pdtp-fs-0-5rem"],[1,"text-muted","small","ms-auto"]],template:function(i,o){i&1&&(r(0,"dx-popup",0),C("onHidden",function(){return o.onClose()}),ce("visibleChange",function(y){return pe(o.isVisible,y)||(o.isVisible=y),y}),F(1,Er,3,1,"div",1),a()),i&2&&(de("visible",o.isVisible),p("width","95vw")("maxWidth",600)("maxHeight","90vh")("title",o.formatMessage("pickup_drop_track")),n(),p("dxTemplateOf","content"))},dependencies:[je,he,Ce,ne,ze,We,qe,Y,z,W,q,oe,K],styles:["[_nghost-%COMP%]{display:block}.app-pdtp-width-100[_ngcontent-%COMP%]{width:100%}.app-pdtp-height-260px[_ngcontent-%COMP%]{height:260px}.app-pdtp-fs-0-5rem[_ngcontent-%COMP%]{font-size:.5rem}"]})}}return t})();var Pr=(t,s)=>s.id;function Tr(t,s){if(t&1&&d(0),t&2){let e=l().$implicit;w(" \xB7 ",e.user.name," ")}}function wr(t,s){if(t&1&&(r(0,"span",23),x(1,"i",25),d(2),a()),t&2){let e=l().$implicit;n(2),_(e.assigned_user.display_name??e.assigned_user.name)}
2}function Ir(t,s){if(t&1&&(r(0,"span",24),x(1,"i",26),d(2),a()),t&2){let e=l(4);n(2),_(e.formatMessage("pickup_drop_tap_to_assign"))}}function Mr(t,s){if(t&1){let e=k();r(0,"div",16)(1,"button",17),C("click",function(){let o=h(e).$implicit,c=l(3);return v(c.openRow(o))}),r(2,"div",18)(3,"span",19),d(4),a(),x(5,"app-pickup-drop-status-tag",20),a(),r(6,"div",21),d(7),m(8,Tr,1,1),a(),r(9,"div",22),m(10,wr,3,1,"span",23)(11,Ir,3,1,"span",24),a()()()}if(t&2){let e=s.$implicit,i=l(3);n(),p("ngClass",(e.status==null?null:e.status.name)===i.STATUS.FAILED?"border-danger":"border-warning"),n(3),_(i.attentionRef(e)),n(),p("status",e.status)("type",e.type),n(2),_(i.attentionDevice(e)),n(),u(e.user!=null&&e.user.name?8:-1),n(2),u(e.assigned_user!=null&&e.assigned_user.name?10:11)}}function Vr(t,s){if(t&1&&(r(0,"div",12)(1,"div",13),x(2,"i",14),d(3),a(),r(4,"div",15),P(5,Mr,12,7,"div",16,Pr),a()()),t&2){let e=l(2);n(3),_(e.formatMessage("pickup_drop_attention_queue")),n(2),T(e.attention)}}function Ar(t,s){if(t&1){let e=k();r(0,"div",6),x(1,"app-metric-card",7)(2,"app-metric-card",8)(3,"app-metric-card",9),r(4,"app-metric-card",10),C("cardClick",function(){h(e);let o=l();return v(o.toggleOverdue())}),a(),x(5,"app-metric-card",11),a(),m(6,Vr,7,1,"div",12)}if(t&2){let e=l();n(),p("value",e.stats.scheduled_today),n(),p("value",e.stats.on_the_way)("hint",e.stats.on_the_way?"pickup_drop_live":""),n(),p("value",e.stats.missed)("valueTone",e.stats.missed?"danger":"default")("hint",e.stats.missed?"pickup_drop_needs_action":""),n(),p("value",e.stats.overdue)("hint",e.overdueActive?"pickup_drop_filtered":"")("clickable",!0),n(),p("value",e.stats.cod_on_road)("isCurrency",!0),n(),u(e.attention.length?6:-1)}}function Or(t,s){if(t&1&&x(0,"app-user-badge",31),t&2){let e=l().$implicit,i=l();p("entity",i.ENTITIES.CUSTOMER)("iconOnly",!0)("isClickable",!1)("user",e.user)}}function Lr(t,s){if(t&1&&(r(0,"div",33),d(1),a()),t&2){let e=l().$implicit;n(),_(e.user.name)}}function Rr(t,s){if(t&1&&(r(0,"div",29),d(1),a()),t&2){let e=l().$implicit,i=l();n(),_(i.attentionDevice(e))}}function Nr(t,s){if(t&1&&(r(0,"div",29),d(1),V(2,"address"),a()),t&2){let e=l().$implicit;n(),_(_e(2,1,e.address))}}function Fr(t,s){if(t&1&&(r(0,"div",40),C("click",function(i){return i.stopPropagation()}),x(1,"app-contact-actions",45),a()),t&2){let e=l().$implicit,i=l();n(),p("entityId",e.id)("entityType",i.ENTITIES.PICKUP_DROP.name)("user",e)}}function Ur(t,s){if(t&1&&(r(0,"div",47),x(1,"i",23)(2,"span",50),V(3,"safe"),a()),t&2){let e=l(2).$implicit,i=l();n(),Te(i.ACTION_ICONS.COMMENT.light),n(),p("innerHTML",L(3,3,e.comment,"html"),xt)}}function Hr(t,s){if(t&1&&(r(0,"div",47),x(1,"i",23),r(2,"span",39),d(3),a()()),t&2){let e=l(2).$implicit,i=l();n(),Te(i.UI_ICONS.CLOCK.light),n(2),_(i.attemptSummary(e))}}function Br(t,s){if(t&1&&(r(0,"div",48)(1,"span",51),d(2),a(),r(3,"span"),d(4),a()()),t&2){let e=l(2).$implicit,i=l();n(2),_(i.formatMessage("pickup_drop_mode")),n(2),_(i.modeLabel(e))}}function $r(t,s){if(t&1&&(r(0,"div",48)(1,"span",51),d(2),a(),r(3,"span"),d(4),a()()),t&2){let e=l(2).$implicit,i=l();n(2),_(i.formatMessage("common_tracking_id")),n(2),_(e.tracking_id)}}function jr(t,s){if(t&1&&(r(0,"div",48)(1,"span",51),d(2),a(),x(3,"app-money",52),a()),t&2){let e=l(2).$implicit,i=l();n(2),_(i.formatMessage("pickup_drop_transport_charge")),n(),p("value",e.charges)}}function Gr(t,s){if(t&1&&(r(0,"div",48)(1,"span",51),d(2),a(),x(3,"app-money",52),a()),t&2){let e=l(2).$implicit,i=l();n(2),_(i.formatMessage("common_total_amount")),n(),p("value",e.total_amount)}}function Kr(t,s){if(t&1&&(x(0,"hr",35),r(1,"div",46),m(2,Ur,4,6,"div",47),m(3,Hr,4,3,"div",47),m(4,Br,5,2,"div",48),m(5,$r,5,2,"div",48),m(6,jr,4,2,"div",48),m(7,Gr,4,2,"div",48),a(),x(8,"app-card-details",49)),t&2){let e=l().$implicit,i=l();n(2),u(e.comment?2:-1),n(),u(i.attemptSummary(e)?3:-1),n(),u(i.modeLabel(e)?4:-1),n(),u(e.tracking_id?5:-1),n(),u(e.charges?6:-1),n(),u(e.total_amount?7:-1),n(),p("sections",i.pickupDropDetailSections(e))}}function zr(t,s){if(t&1&&(r(0,"span",39),d(1),a()),t&2){let e=l().$implicit;n(),w("\xB7 ",e.assigned_user.display_name??e.assigned_user.name)}
2}function qr(t,s){if(t&1&&(r(0,"span",41),x(1,"app-money",52),a()),t&2){let e=l().$implicit;n(),p("value",e.cod_amount)}}function Wr(t,s){if(t&1){let e=k();r(0,"div",27)(1,"div",28)(2,"span",29),d(3),a(),x(4,"app-pickup-drop-status-tag",20),a(),r(5,"div",30),m(6,Or,1,4,"app-user-badge",31),r(7,"div",32),m(8,Lr,2,1,"div",33),m(9,Rr,2,1,"div",29),m(10,Nr,3,3,"div",29),a(),m(11,Fr,2,3,"div",34),a(),m(12,Kr,9,7),x(13,"hr",35),r(14,"div",36)(15,"div",37),x(16,"app-due-date-format",38),m(17,zr,2,1,"span",39),a(),r(18,"div",40),C("click",function(o){return o.stopPropagation()}),m(19,qr,2,1,"span",41),r(20,"app-card-expand-button",42),C("toggle",function(){let o=h(e).$implicit,c=l();return v(c.expanded.toggle(o.id))}),a(),r(21,"app-context-menu",43),C("contextMenuItemClick",function(o){h(e);let c=l();return v(c.onContextMenuItemClick(o))}),r(22,"app-sheet-header",44),x(23,"app-pickup-drop-status-tag",20),a()()()()()}if(t&2){let e=s.$implicit,i=l();n(3),M(" ",i.attentionRef(e)," \xB7 ",i.formatMessage(e.type==="Drop"?"pickup_drop_type_drop":"pickup_drop_type_pickup")," "),n(),p("status",e.status)("type",e.type),n(2),u(i.isEmployee()&&e.user?6:-1),n(2),u(i.isEmployee()&&(e.user!=null&&e.user.name)?8:-1),n(),u(i.attentionDevice(e)?9:-1),n(),u(e.address?10:-1),n(),u(i.isEmployee()?11:-1),n(),u(i.expanded.has(e.id)?12:-1),n(4),p("dateTime",e.scheduled_on)("entity",i.entity)("isDateTime",!0)("status",e.status),n(),u(i.isEmployee()&&(e.assigned_user!=null&&e.assigned_user.name)?17:-1),n(2),u(e.cod_amount>0?19:-1),n(),p("expanded",i.expanded.has(e.id)),n(),p("contextMenuItems",i.contextMenuItems)("entityName",i.entity.name)("entity",e)("mobileSheet",!0)("showDocuments",!0),n(),p("entity",i.ENTITIES.CUSTOMER)("subtitle",i.attentionRef(e))("title",i.isEmployee()?e.user==null?null:e.user.name:"")("user",i.isEmployee()?e.user:null),n(),p("status",e.status)("type",e.type)}}var zt=(()=>{class t{constructor(){this.SETTINGS_SURFACES=dn,this.formatMessage=f,this.service=b(N),this.router=b(X),this.activatedRoute=b(me),this.toast=b(R),this.entity=g.PICKUP_DROP,this.ENTITIES=g,this.isEmployee=b(fe).isEmployee,this.userDeviceService=b(Re),this.tenantService=b(ie),this.businessContext=b(Zi),this.STATUS=S,this.expanded=new bn,this.detailSectionsCache=new WeakMap,this.UI_ICONS=st,this.ACTION_ICONS=Jt,this.stats={scheduled_today:0,on_the_way:0,missed:0,overdue:0,unassigned:0,cod_on_road:0},this.attention=[],this.overdueActive=!1,this.gridParams={},this.isScheduleVisible=!1,this.PICKUP_DROP_CONTEXT_MENU_LIST=te,this.contextMenuItems=[],this.currentRecord=null,this.isAssignPopupVisible=!1,this.assignPopupMode="assign",this.isTrackPopupVisible=!1,this.trackableStatuses=[S.EN_ROUTE,S.ARRIVED],this.reschedulableStatuses=[S.SCHEDULED,S.ASSIGNED,S.RESCHEDULED,S.FAILED],this.employeeOnlyColumns=["user","mobile_number","assigned_user"],this.allColumns=[{dataField:"type",caption:f("common_type"),width:65,allowSorting:!1,calculateCellValue:e=>f(e.type==="Drop"?"pickup_drop_type_drop":"pickup_drop_type_pickup")},{dataField:"linkable_id",caption:f("pickup_drop_linked_to"),cellTemplate:"pickupDropJobIdLinkTemplate",width:70,allowSorting:!1,alignment:"left"},{dataField:"user",caption:f("pickup_drop_contact"),cellTemplate:"userTemplate",allowSorting:!1,width:this.isMobileDevice?void 0:100},{dataField:"mobile_number",caption:f("mobile_number"),cellTemplate:"phoneTemplate",allowSorting:!1,width:90},{dataField:"device_type.name",caption:f("common_device"),width:90,allowSorting:!1,calculateCellValue:e=>Pe(e)},{dataField:"address",caption:f("common_address"),minWidth:155,allowSorting:!1,calculateCellValue:e=>ke(e?.address)},{dataField:"scheduled_on",caption:f("pickup_drop_scheduled_col"),cellTemplate:"dueDateTimeTemplate",width:70,allowSorting:!1},{dataField:"assigned_user",caption:f("common_assignee"),cellTemplate:"employeeTemplate",allowSorting:!1,width:110},{dataField:"cod_amount",caption:f("pickup_drop_cod"),cellTemplate:"currencyTemplate",allowSorting:!1,alignment:"right",width:105},{dataField:"status",caption:f("common_status"),cellTemplate:"pickupDropStatusTemplate",width:100,allowSorting:!1},{name:"actions",caption:"",cellTemplate:"actionTemplate",allowSorting:!1,alignment:"center",showInColumnChooser:!1}],this.columns=this.allColumns.filter(e=>this.isEmployee()||!this.employeeOnlyColumns.includes(e.dataField))}get isMobileDevice(){return this.userDeviceService.isMobileDevice()}get hasTenantPickupDrops(){return(this.tenantService.config()?.entity_counts?.pickup_drops||0)>0}
2ngOnInit(){this.buildContextMenu(),this.isEmployee()&&(this.loadSummary(),this.loadAttention()),this.openScheduleFromQueryParam()}openScheduleFromQueryParam(){this.activatedRoute.snapshot.queryParamMap.has("schedule")&&(this.isScheduleVisible=!0,this.router.navigate([],{relativeTo:this.activatedRoute,queryParams:{schedule:null},queryParamsHandling:"merge",replaceUrl:!0}))}buildContextMenu(){this.contextMenuItems=[{name:te.ASSIGN,icon:Jt.EDIT.light,visible:this.isEmployee(),locale_key:f("common_assign"),isDisabled:e=>this.isTerminal(e)},{name:te.RESCHEDULE,icon:st.CALENDAR.light,visible:this.isEmployee(),locale_key:f("pickup_drop_reschedule"),isDisabled:e=>!this.isReschedulable(e)},{name:te.TRACK,icon:st.LOCATION.light,visible:!0,locale_key:f("pickup_drop_track"),isDisabled:e=>!this.isTrackable(e)},{name:te.COPY_TRACKING_LINK,icon:st.LINK.light,visible:!0,locale_key:f("pickup_drop_copy_tracking_link"),isDisabled:e=>!this.isTrackable(e)}]}isTerminal(e){let i=e?.status?.name;return i===S.COMPLETED||i===S.CANCELLED}isTrackable(e){return this.trackableStatuses.includes(e?.status?.name)}isReschedulable(e){return this.reschedulableStatuses.includes(e?.status?.name)}onContextMenuItemClick(e){switch(this.currentRecord=e.entity,e.action){case te.ASSIGN:this.assignPopupMode="assign",this.isAssignPopupVisible=!0;break;case te.RESCHEDULE:this.assignPopupMode="reschedule",this.isAssignPopupVisible=!0;break;case te.TRACK:this.isTrackPopupVisible=!0;break;case te.COPY_TRACKING_LINK:this.copyTrackingLink(e.entity?.id);break}}onTrackPopupClosed(){this.isTrackPopupVisible=!1,this.currentRecord=null}copyTrackingLink(e){e&&this.service.getById(e).subscribe({next:i=>{let o=i?.tracking_url;if(!o){this.toast.error("notification_update_error");return}navigator.clipboard?.writeText(o).then(()=>this.toast.success("pickup_drop_tracking_link_copied"),()=>this.toast.error("notification_update_error"))},error:()=>this.toast.error("notification_update_error")})}onAssignPopupClosed(){this.isAssignPopupVisible=!1,this.currentRecord=null}onAssignSaved(){this.isAssignPopupVisible=!1,this.currentRecord=null,this.grid?.getData(),this.loadSummary(),this.loadAttention()}toggleOverdue(){this.overdueActive=!this.overdueActive,this.rebuildGridParams(),this.grid?.getData()}onFiltersCleared(){this.overdueActive=!1,this.rebuildGridParams(),this.grid?.getData()}rebuildGridParams(){this.gridParams=this.overdueActive?{overdue:!0}:{}}schedule(){this.isScheduleVisible=!0}onScheduleClosed(){this.isScheduleVisible=!1}onScheduleSaved(){this.grid?.getData(),this.loadSummary(),this.loadAttention()}openRow(e){this.router.navigate(["/"+re+"/details",e?.id])}loadAttention(){this.service.getAttention().subscribe({next:e=>this.attention=e?.data??e??[],error:()=>{}})}attentionRef(e){let i=e?.linkable;return i?.formatted_job_number||i?.job_number||i?.sale_number||i?.purchase_number||i?.name||(e?.linkable_id?"#"+e.linkable_id:f("pickup_drop_walk_in"))}attentionDevice(e){return Pe(e)}modeLabel(e){return e?.mode?f("pickup_drop_mode_"+e.mode):""}pickupDropDetailSections(e){let i=this.detailSectionsCache.get(e);if(i)return i;let o=[{titleKey:"common_schedule",rows:[{labelKey:"pickup_drop_journey_en_route",value:e?.en_route_at,type:"datetime"},{labelKey:"pickup_drop_journey_arrived",value:e?.arrived_at,type:"datetime"},{labelKey:"pickup_drop_journey_completed",value:e?.completed_at,type:"datetime"},{labelKey:"pickup_drop_otp_verified",value:e?.otp_verified_at,type:"datetime"},{labelKey:"common_created_on",value:e?.created_at,type:"datetime"}]},{titleKey:"common_contact",rows:[{labelKey:"common_mobile_number",value:this.isEmployee()?[e?.mobile_country_code,e?.mobile_number].filter(Boolean).join(" "):null}]},{titleKey:"pickup_drop_settings_charges",rows:[{labelKey:"common_sub_total",value:e?.sub_total,type:"money"},...this.businessContext.isGstEnabled()?[{labelKey:this.tenantService.taxCodeKey(),value:e?.tax_code}]:[],...this.businessContext.isGstEnabled()?[{labelKey:"common_tax_amount",value:e?.tax_amount,type:"money"}]:[]]}];return this.detailSectionsCache.set(e,o),o}attemptSummary(e){let i=[],o=+e?.attempt_count||0;if(o){let c=f(e?.type==="Drop"?"pickup_drop_type_drop":"pickup_drop_type_pickup").toLowerCase();i.push(f(o===1?"pickup_drop_attempt_count_one":"pickup_drop_attempts_count",String(o),c))}return e?.failure_reason&&i.push(f(e.failure_reason)),i.join(" \xB7 ")}loadSummary(){this.service.getSummary().subscribe({next:e=>{this.stats=e?.stats??this.stats},error:()=>this.toast.error("notification_update_error")})}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=O({type:t,selectors:[["app-pickup-drop-board"]],viewQuery:function(i,o){if(i&1&&li(Qt,5),i&2){let c;si(c=di())&&(o.grid=c.first)}},decls:7,vars:22,consts:[[1,"pdb","pt-0","pt-md-3"],[3,"dataGridRowClick","contextMenuItemClick","dataGridAddNewClick","filtersCleared","settingsSurface","service","entity","columns","additionalParams","columnAutoWidth","emitRowCl
2ick","contextMenuItems","isVisibleTitle","keepSearchToolbar","isVisibleEditAction","isVisibleDeleteAction","isVisibleAddAction","searchPanelPlaceholderText","hasTenantData"],["appCardTemplate",""],[3,"closed","saved","isVisible"],[3,"closed","saved","recordId","isVisible","mode"],[3,"closed","recordId","isVisible"],[1,"app-metric-grid","app-metric-grid-5","mb-3","d-none","d-md-grid"],["label","pickup_drop_kpi_scheduled_today","icon","fa-thin fa-calendar",3,"value"],["label","pickup_drop_on_the_way_label","icon","fa-thin fa-route",3,"value","hint"],["label","pickup_drop_action_missed","icon","fa-thin fa-triangle-exclamation","tone","danger",3,"value","valueTone","hint"],["label","pickup_drop_overdue","icon","fa-thin fa-clock-rotate-left","tone","warning",3,"cardClick","value","hint","clickable"],["label","pickup_drop_cod_on_road","icon","fa-thin fa-sack-dollar","tone","warning",3,"value","isCurrency"],[1,"mb-3"],[1,"text-uppercase","text-muted","fw-bold","small","mb-2"],[1,"fa-thin","fa-bell","me-2"],[1,"row","row-cols-1","row-cols-md-2","row-cols-xl-3","g-2"],[1,"col"],["type","button",1,"card","theme-secondary-bg","w-100","h-100","text-start","p-2","border-0","border-start","border-3","shadow-sm","rounded-3",3,"click","ngClass"],[1,"d-flex","align-items-center","justify-content-between","gap-2","mb-1"],[1,"fw-bold","text-primary","small"],[3,"status","type"],[1,"small","text-truncate"],[1,"small","mt-1"],[1,"text-muted"],[1,"text-warning"],[1,"fa-thin","fa-user","me-1"],[1,"fa-thin","fa-user-plus","me-1"],[1,"app-card"],[1,"d-flex","align-items-center","justify-content-between","gap-2","mb-2"],[1,"fs-label","text-muted","text-truncate"],[1,"d-flex","align-items-start","gap-2"],[3,"entity","iconOnly","isClickable","user"],[1,"flex-grow-1","min-width-0"],[1,"fs-subsection","fw-bold","text-truncate"],[1,"d-flex","align-items-center","gap-2","flex-shrink-0"],[1,"my-2"],[1,"d-flex","align-items-center","justify-content-between","gap-2"],[1,"d-flex","align-items-center","gap-2","min-width-0","fs-label","text-muted"],[3,"dateTime","entity","isDateTime","status"],[1,"text-truncate"],[1,"d-flex","align-items-center","gap-2","flex-shrink-0",3,"click"],[1,"fs-label","fw-bold"],[3,"toggle","expanded"],[3,"contextMenuItemClick","contextMenuItems","entityName","entity","mobileSheet","showDocuments"],[3,"entity","subtitle","title","user"],[3,"entityId","entityType","user"],[1,"d-flex","flex-column","gap-2"],[1,"d-flex","align-items-center","gap-2","min-width-0","fs-body-sm"],[1,"d-flex","align-items-center","justify-content-between","gap-2","fs-body-sm"],[3,"sections"],[1,"app-line-clamp-1",3,"innerHTML"],[1,"text-muted","text-truncate"],[3,"value"]],template:function(i,o){i&1&&(r(0,"div",0),m(1,Ar,7,12),r(2,"app-data-grid",1),C("dataGridRowClick",function(y){return o.openRow(y)})("contextMenuItemClick",function(y){return o.onContextMenuItemClick(y)})("dataGridAddNewClick",function(){return o.schedule()})("filtersCleared",function(){return o.onFiltersCleared()}),F(3,Wr,24,28,"ng-template",2),a()(),r(4,"app-pickup-drop-schedule",3),C("closed",function(){return o.onScheduleClosed()})("saved",function(){return o.onScheduleSaved()}),a(),r(5,"app-pickup-drop-assign-popup",4),C("closed",function(){return o.onAssignPopupClosed()})("saved",function(){return o.onAssignSaved()}),a(),r(6,"app-pickup-drop-track-popup",5),C("closed",function(){return o.onTrackPopupClosed()}),a()),i&2&&(n(),u(o.isEmployee()?1:-1),n(),p("settingsSurface",o.SETTINGS_SURFACES.PICKUP_DROP)("service",o.service)("entity",o.entity)("columns",o.columns)("additionalParams",o.gridParams)("columnAutoWidth",!1)("emitRowClick",!0)("contextMenuItems",o.contextMenuItems)("isVisibleTitle",!0)("keepSearchToolbar",!0)("isVisibleEditAction",!1)("isVisibleDeleteAction",!1)("isVisibleAddAction",o.isEmployee())("searchPanelPlaceholderText","pickup_drop_search_pickups")("hasTenantData",o.hasTenantPickupDrops),n(2),p("isVisible",o.isScheduleVisible),n(),p("recordId",o.currentRecord==null?null:o.currentRecord.id)("isVisible",o.isAssignPopupVisible)("mode",o.assignPopupMode),n(),p("recordId",o.currentRecord==null?null:o.currentRecord.id)("isVisible",o.isTrackPopupVisible))},dependencies:[Sn,Y,Qt,Rt,kn,J,Yi,pn,Ji,sn,rn,Gt,nt,Kt,j,$,an,Qe,Ot],styles:["[_nghost-%COMP%]{display:block}"]})}}return t})();var ti=ii(Pi());var Jr=(t,s)=>s.key,Yr=(t,s)=>s.id;function Qr(t,s){t&1&&(r(0,"div",0),x(1,"dx-load-indicator",2),a()),t&2&&(n(),p("height",40)("width",40))}function Xr(t,s){if(t&1){let e=k();r(0,"a",48),C("click",function(){h(e);let o=l(3);return v(o.openLinked())}),d(1),a()}if(t&2){let e=l(3);n(),_(e.sourceRef)}}function Zr(t,s){if(t&1&&(r(0,"b"),d(1),a()),t&2){let e=l(3);n(),_(e.sourceRef)}}function el(t,s){if(t&1&&(r(0,"span",15),d(1),m(2,Xr,2,1,"a",47)(3,Zr,2,1,"b"),a()),t&2){let e=l(2);n(),w("",e.formatMessage("pickup_drop_linked_to")," "),n(),u(e.linkedRoute?2:3)}}function tl(t,s){if(t&1){let e=k();r(0,"dx-button",49),C("onClick",function(){h(e);let o=l(2);return v(o.copyTrackingLink())}),a()}if(t&2){let e=l(2);p("text",e.formatMessage("pickup_drop_copy_tracking_link"))}}function il(t,s){if(t&1){let e=k();r(0,"dx-button",50),C("onClick",function(){h(e);let o=l(2);
2return v(o.trackLive())}),a()}if(t&2){let e=l(2);p("text",e.formatMessage("pickup_drop_track_live"))}}function nl(t,s){if(t&1){let e=k();r(0,"dx-button",51),C("onClick",function(){h(e);let o=l(2);return v(o.edit())}),a()}if(t&2){let e=l(2);p("text",e.formatMessage("common_edit"))}}function ol(t,s){if(t&1){let e=k();r(0,"dx-drop-down-button",52),C("onItemClick",function(o){h(e);let c=l(2);return v(c.transition(o.itemData.to))}),a()}if(t&2){let e=l(2);p("items",e.validTransitions)("text",e.formatMessage("update_status"))}}function al(t,s){if(t&1&&(r(0,"span",55),d(1),a()),t&2){let e=l(3);n(),_(e.attemptLabel)}}function rl(t,s){if(t&1&&(r(0,"div",24),x(1,"i",53),r(2,"span",54),d(3),a(),m(4,al,2,1,"span",55),r(5,"span",56),d(6),a()()),t&2){let e=l(2);n(3),_(e.formatMessage("pickup_drop_marked_missed")),n(),u(e.detail.attempt_count?4:-1),n(2),w("\xB7 ",e.formatMessage(e.detail.failure_reason))}}function ll(t,s){if(t&1&&(r(0,"div",25),d(1),a()),t&2){let e=l(2);n(),_(e.formatMessage("pickup_drop_rescheduled"))}}function sl(t,s){if(t&1&&(r(0,"div",25),d(1),a()),t&2){let e=l(2);n(),M("",e.isPickup?e.formatMessage("pickup_drop_on_the_way_full"):e.formatMessage("pickup_drop_out_for_delivery")," \xB7 ",e.formatMessage("pickup_drop_live_location_shared"))}}function dl(t,s){if(t&1&&(r(0,"div",26),d(1),a()),t&2){let e=l(2);n(),_(e.formatMessage("pickup_drop_executive_arrived"))}}function pl(t,s){if(t&1&&(r(0,"div",26),d(1),a()),t&2){let e=l(2);n(),_(e.formatMessage("pickup_drop_shipped_courier"))}}function cl(t,s){t&1&&x(0,"i",61)}function _l(t,s){t&1&&x(0,"i",62)}function ml(t,s){if(t&1&&x(0,"div",65),t&2){let e=l().$implicit;p("ngClass",e.done?"bg-primary":"bg-secondary-subtle")}}function ul(t,s){if(t&1&&(r(0,"div",59)(1,"span",60),m(2,cl,1,0,"i",61)(3,_l,1,0,"i",62),a(),r(4,"div",63),d(5),a(),r(6,"div",64),d(7),a()(),m(8,ml,1,1,"div",65)),t&2){let e=s.$implicit,i=s.$index,o=s.$count,c=l(3);n(),p("ngClass",e.done?"bg-primary border-primary text-white":e.current?"border-primary text-primary":"border-secondary-subtle text-muted"),n(),u(e.done?2:e.current?3:-1),n(2),p("ngClass",e.done||e.current?"fw-semibold":"text-muted"),n(),_(e.label),n(2),_(c.stepTime(e.key)||(e.done||e.current?"":c.formatMessage("pending"))),n(),u(i!==o-1?8:-1)}}function xl(t,s){if(t&1&&(r(0,"div",10)(1,"div",37)(2,"div",10)(3,"div",31),d(4),a(),r(5,"div",57),d(6),a()(),r(7,"div",58),P(8,ul,9,6,null,null,Jr),a()()()),t&2){let e=l(2);n(4),_(e.formatMessage("pickup_drop_status_journey")),n(2),_(e.currentStatusLabel),n(2),T(e.statusSteps)}}function fl(t,s){if(t&1&&x(0,"app-user-badge",67),t&2){let e=l(3);p("iconOnly",!0)("user",e.detail.user)("size",e.iconSizes.HEADER)("isClickable",!1)}}function Cl(t,s){if(t&1&&(r(0,"div",71),x(1,"i",73),r(2,"a",74),d(3),a(),x(4,"app-copy-to-clipboard",75),a()),t&2){let e=l(3);n(2),p("href",lt("tel:",e.contactNumber),ot),n(),M("",e.contactCountryCode," ",e.contactNumber),n(),p("textToBeCopied",e.contactCountryCode+" "+e.contactNumber)}}function hl(t,s){if(t&1){let e=k();r(0,"div",72)(1,"app-dx-outline-button",76),C("onClickEvent",function(){h(e);let o=l(3);return v(o.callContact())}),a(),x(2,"app-send-whats-app-btn",77),a()}if(t&2){let e=l(3);n(),p("isVisibleIcon",!0),n(),p("entityId",e.detail.id)("entityName",e.ENTITIES.PICKUP_DROP.name)("mobileNumber",e.contactNumber)("mobileCountryCode",e.contactCountryCode)}}function vl(t,s){if(t&1&&(r(0,"div",28)(1,"div",29)(2,"div",30)(3,"div",31),d(4),a()(),r(5,"div",66),m(6,fl,1,4,"app-user-badge",67),r(7,"div",68)(8,"div",69),d(9),a(),r(10,"div",70),d(11),a()()(),m(12,Cl,5,5,"div",71),m(13,hl,3,5,"div",72),a()()),t&2){let e=l(2);n(4),_(e.formatMessage("common_customer")),n(2),u(e.detail.user?6:-1),n(3),_((e.detail.user==null?null:e.detail.user.name)||"\u2014"),n(2),_(e.formatMessage("common_customer")),n(),u(e.contactNumber?12:-1),n(),u(e.contactNumber?13:-1)}}function gl(t,s){if(t&1){let e=k();r(0,"a",78),C("click",function(){h(e);let o=l(2);return v(o.openReassign())}),x(1,"i",79),d(2),a()}if(t&2){let e=l(2);n(2),_(e.formatMessage("common_assign"))}}function bl(t,s){if(t&1&&(r(0,"div",71),x(1,"i",73),r(2,"a",74),d(3),a(),x(4,"app-copy-to-cl
2ipboard",75),a()),t&2){let e=l(3);n(2),p("href",lt("tel:",e.executiveNumber),ot),n(),M("",e.executiveCountryCode," ",e.executiveNumber),n(),p("textToBeCopied",e.executiveCountryCode+" "+e.executiveNumber)}}function kl(t,s){if(t&1){let e=k();r(0,"app-dx-outline-button",76),C("onClickEvent",function(){h(e);let o=l(3);return v(o.callExecutive())}),a()}t&2&&p("isVisibleIcon",!0)}function yl(t,s){if(t&1){let e=k();r(0,"app-dx-outline-button",82),C("onClickEvent",function(){h(e);let o=l(3);return v(o.trackLive())}),a()}t&2&&p("isVisibleIcon",!0)}function Sl(t,s){if(t&1&&(r(0,"div",66),x(1,"app-user-badge",67),r(2,"div",68)(3,"div",69),d(4),a(),r(5,"div",70),d(6),a()()(),m(7,bl,5,5,"div",71),r(8,"div",72),m(9,kl,1,1,"app-dx-outline-button",80),m(10,yl,1,1,"app-dx-outline-button",81),a()),t&2){let e=l(2);n(),p("iconOnly",!0)("user",e.detail.assigned_user)("size",e.iconSizes.HEADER)("isClickable",!1),n(3),_(e.detail.assigned_user.display_name??e.detail.assigned_user.name),n(2),_(e.formatMessage("pickup_drop_delivery_executive")),n(),u(e.executiveNumber?7:-1),n(2),u(e.executiveNumber?9:-1),n(),u(e.canTrackLive?10:-1)}}function Dl(t,s){if(t&1){let e=k();r(0,"app-dx-outline-button",85),C("onClickEvent",function(){h(e);let o=l(3);return v(o.openReassign())}),a()}t&2&&p("isVisibleIcon",!0)}function El(t,s){if(t&1&&(r(0,"div",33)(1,"div",83),d(2),a(),m(3,Dl,1,1,"app-dx-outline-button",84),a()),t&2){let e=l(2);n(2),_(e.formatMessage("unassigned")),n(),u(e.isEmployee()?3:-1)}}function Pl(t,s){if(t&1&&(r(0,"div",39)(1,"span",8),d(2),a(),r(3,"b"),d(4),a()()),t&2){let e=l(2);n(2),_(e.formatMessage("pickup_drop_mode")),n(2),_(e.modeLabel)}}function Tl(t,s){if(t&1){let e=k();r(0,"a",87),C("click",function(){h(e);let o=l(3);return v(o.openLinked())}),d(1),a()}if(t&2){let e=l(3);n(),_(e.sourceRef)}}function wl(t,s){if(t&1&&(r(0,"b"),d(1),a()),t&2){let e=l(3);n(),_(e.sourceRef)}}function Il(t,s){if(t&1&&(r(0,"div",39)(1,"span",8),d(2),a(),m(3,Tl,2,1,"a",86)(4,wl,2,1,"b"),a()),t&2){let e=l(2);n(2),_(e.sourceLabel),n(),u(e.linkedRoute?3:4)}}function Ml(t,s){if(t&1&&(r(0,"div",39)(1,"span",8),d(2),a(),r(3,"b"),d(4),V(5,"dateFormat"),a()()),t&2){let e=l(2);n(2),_(e.formatMessage("pickup_drop_when")),n(2),_(L(5,2,e.detail.scheduled_on,"datetime"))}}function Vl(t,s){if(t&1&&(r(0,"div",39)(1,"span",8),d(2),a(),r(3,"b"),d(4),a()()),t&2){let e=l(2);n(2),_(e.formatMessage("delivery_provider_label")),n(2),_(e.detail.provider.name)}}function Al(t,s){if(t&1&&(r(0,"div",39)(1,"span",8),d(2),a(),r(3,"b"),d(4),a()()),t&2){let e=l(2);n(2),_(e.formatMessage("common_tracking_id")),n(2),_(e.detail.tracking_id)}}function Ol(t,s){if(t&1&&(r(0,"div",39)(1,"span",8),d(2),a(),r(3,"b"),x(4,"app-money",88),a()()),t&2){let e=l(2);n(2),_(e.formatMessage("pickup_drop_transport_charge")),n(2),p("value",e.detail.charges)}}function Ll(t,s){if(t&1&&(r(0,"div",39)(1,"span",8),d(2),a(),r(3,"b",89),x(4,"app-money",88),a()()),t&2){let e=l(2);n(2),_(e.formatMessage("pickup_drop_cod")),n(2),p("value",e.detail.cod_amount)}}function Rl(t,s){t&1&&x(0,"div",92)}function Nl(t,s){if(t&1&&(r(0,"div",97),d(1),a()),t&2){let e=l().$implicit,i=l(3);n(),_(i.activitySubtitle(e))}}function Fl(t,s){if(t&1&&(r(0,"div",90)(1,"div",91)(2,"div"),x(3,"i"),a(),m(4,Rl,1,0,"div",92),a(),r(5,"div",93)(6,"div",94)(7,"span",95),d(8),a(),r(9,"span",96),d(10),V(11,"dateFormat"),a()(),m(12,Nl,2,1,"div",97),r(13,"div",64),d(14),a()()()),t&2){let e=s.$implicit,i=s.$index,o=s.$count,c=l(3);n(2),Te(lt("",c.activityColor(e)," rounded-circle d-flex align-items-center justify-content-center app-pddp-box-32 app-pddp-z-index-1")),n(),Te(lt("fa-thin ",c.activityIcon(e)," text-white app-pddp-fs-font-body-sm")),n(),u(i!==o-1?4:-1),n(4),_(c.activityTitle(e)),n(2),_(L(11,11,e.created_at,"datetime")),n(2),u(c.activitySubtitle(e)?12:-1),n(2),_((e.causer==null?null:e.causer.name)||c.formatMessage("system"))}}function Ul(t,s){if(t&1&&(r(0,"div",42),P(1,Fl,15,14,"div",90,Yr),a()),t&2){let e=l(2);n(),T(e.detail.activities)}}function Hl(t,s){if(t&1&&(r(0,"div",15),d(1),a()),t&2){let e=l(2);n(),_(e.formatMessage("pickup_drop_no_activity"))}}function Bl(t,s){if(t&1){let e=k();r(0,"div",10)(1,"div",37)(2,"div",38),x(3,"i",98),d(4),a(),r(5,"div",99),d(6),V(7,"address"),a(),r(8,"div",100)(9,"a",101),C("click",function(){h(e);let o=l(2);return v(o.openMaps())}),d(10),a()()()()}if(t&2){let e=l(2);n(4),_(e.formatMessage("common_address")),n(2),_(_e(7,3,e.detail.address)),n(4),w("",e.formatMessage("pickup_drop_open_maps")," \u2197")}}function $l(t,s){if(t&1&&(r(0,"div",10)(1,"div",37)(2,"div",38),d(3),a(),x(4,"div",102),V(5,"safe"),a()()),t&2){let e=l(2);n(3),_(e.formatMessage("common_notes")),n(),p("innerHTML",L(5,2,e.detail.comment,"html"),xt)}}function jl(t,s){if(t&1){let e=k();r(0,"div",106),d(1),a(),r(2,"div",107),d(3),a(),r(4,"dx-date-box",108),ce("valueChange",function(o){h(e);let c=l(3);return pe(c.rescheduleOn,o)||(c.rescheduleOn=o),v(o)}),a()}if(t&2){let e=l(3);n(),_(e.formatMessage("pickup_drop_reschedule_hint")),n(2),_(e.formatMessage("pickup_drop_new_schedule")),n(),de("value",e.rescheduleOn),p("width","100%")("min",e.minDate)("displayFormat",e.tenantService.dxDateTimeFormat())}}function Gl(t,s){if(t&1){let e=k();r(0,"div",106),d(1),a(),r(2,"div",107),d(3),a(),r(4,"dx-text-area",109),ce("valueChange",function(o){h(e);let c=l(3);return pe(c.statusReason,o)||(c.statusReason=o),v(o)}),a()}if(t&2){let e=l(3);n(),_(e.formatMessage("pickup_drop_cancel_confirm")),n(2),_(e.formatMessage("pickup_drop_reason")),n(),de("value",e.statusReason),p("height",90)("autoResizeEnabled",!0)}}function Kl(t,s){if(t&1){let e=k();r(0,"div"),m(1,jl,5,6)(2,Gl,5,5),r(3,"div",103)(4,"dx-button",104),C("onClick",function(){h(e);let o=l(2);return v(o.closeStatusPopup())}),a(),r(5,"dx-button",105),C("onClick",function(){h(e);let o=l(2);return v(o.confirmStatusChange())}),a()()()}if(t&2){let e=l(2);n(),u(e.pendingStatus===e.STATUS.RESCHEDULED?1:2),n(3),p("text",e.formatMessage("common_cancel")),n(),p("type",e.pendingStatus===e.STATUS.CANCELLED?"danger":"default")("text",e.pen
2dingStatus===e.STATUS.RESCHEDULED?e.formatMessage("pickup_drop_reschedule"):e.formatMessage("common_confirm"))("disabled",e.isSavingStatus)}}function zl(t,s){if(t&1){let e=k();r(0,"div",1)(1,"div",3)(2,"app-page-header",4),C("editClick",function(){h(e);let o=l();return v(o.edit())}),a(),r(3,"div",5)(4,"a",6),C("click",function(){h(e);let o=l();return v(o.back())}),x(5,"i",7),d(6),a(),r(7,"span",8),d(8,"/"),a(),r(9,"span",9),d(10),a()(),r(11,"div",10)(12,"div",11)(13,"span",12),x(14,"i",13),d(15),a(),x(16,"app-pickup-drop-status-tag",14),m(17,el,4,2,"span",15),a(),r(18,"div",16)(19,"div")(20,"h3",17),d(21),a(),r(22,"div",15),d(23),V(24,"dateFormat"),a()(),r(25,"div",18),m(26,tl,1,1,"dx-button",19),m(27,il,1,1,"dx-button",20),x(28,"app-entity-documents-button",21),m(29,nl,1,1,"dx-button",22),m(30,ol,1,2,"dx-drop-down-button",23),a()()(),m(31,rl,7,3,"div",24)(32,ll,2,1,"div",25)(33,sl,2,2,"div",25)(34,dl,2,1,"div",26)(35,pl,2,1,"div",26),m(36,xl,10,2,"div",10),r(37,"div",27),m(38,vl,14,6,"div",28),r(39,"div",28)(40,"div",29)(41,"div",30)(42,"div",31),d(43),a(),m(44,gl,3,1,"a",32),a(),m(45,Sl,11,9)(46,El,4,2,"div",33),a()()(),r(47,"div",34)(48,"div",35)(49,"div",36)(50,"div",37)(51,"div",38),d(52),a(),r(53,"div",39)(54,"span",8),d(55),a(),r(56,"b"),d(57),a()(),m(58,Pl,5,2,"div",39),r(59,"div",39)(60,"span",8),d(61),a(),r(62,"b"),d(63),a()(),m(64,Il,5,2,"div",39),m(65,Ml,6,5,"div",39),r(66,"div",39)(67,"span",8),d(68),a(),r(69,"b"),d(70),a()(),m(71,Vl,5,2,"div",39),m(72,Al,5,2,"div",39),m(73,Ol,5,2,"div",39),m(74,Ll,5,2,"div",39),a()()(),r(75,"div",35)(76,"div",36)(77,"div",40)(78,"div",41),d(79),a(),m(80,Ul,3,0,"div",42)(81,Hl,2,1,"div",15),a()()()(),m(82,Bl,11,5,"div",10),m(83,$l,6,5,"div",10),r(84,"dx-popup",43),ce("visibleChange",function(o){h(e);let c=l();return pe(c.statusPopupVisible,o)||(c.statusPopupVisible=o),v(o)}),C("onHidden",function(){h(e);let o=l();return v(o.closeStatusPopup())}),F(85,Kl,6,5,"div",44),a(),r(86,"app-pickup-drop-assign-popup",45),C("closed",function(){h(e);let o=l();return v(o.onReassignClosed())})("saved",function(){h(e);let o=l();return v(o.onReassignSaved())}),a(),r(87,"app-pickup-drop-handover",46),C("completed",function(){h(e);let o=l();return v(o.onHandoverCompleted())})("closed",function(){h(e);let o=l();return v(o.onHandoverClosed())}),a()()()}if(t&2){let e=l();n(2),p("mobileHeaderOnly",!0)("recordTitle","PD-"+e.detail.id)("canEdit",e.isEmployee()),n(),A("d-none",e.isMobileDevice),n(3),w("",e.formatMessage("pickup_drops")," "),n(4),w("PD-",e.detail.id),n(4),p("ngClass",e.isPickup?"fa-arrow-up-from-bracket":"fa-arrow-down-to-bracket"),n(),w("",e.typeLabel(e.detail.type)," "),n(),p("status",e.detail.status)("type",e.detail.type),n(),u(e.detail.linkable_id?17:-1),n(4),_(e.pageTitle),n(2),M("",e.formatMessage("pickup_drop_created")," ",L(24,58,e.detail.created_at,"datetime")),n(3),u(e.detail.tracking_url?26:-1),n(),u(e.canTrackLive?27:-1),n(),p("entityId",e.detail.id)("entityType",e.ENTITIES.PICKUP_DROP.name)("showLabel",!e.isMobileDevice),n(),u(e.isEmployee()&&!e.isMobileDevice?29:-1),n(),u(e.isEmployee()&&e.validTransitions.length?30:-1),n(),u((e.detail.status==null?null:e.detail.status.name)===e.STATUS.FAILED?31:(e.detail.status==null?null:e.detail.status.name)===e.STATUS.RESCHEDULED?32:(e.detail.status==null?null:e.detail.status.name)===e.STATUS.EN_ROUTE?33:(e.detail.status==null?null:e.detail.status.name)===e.STATUS.ARRIVED?34:(e.detail.status==null?null:e.detail.status.name)===e.STATUS.IN_TRANSIT?35:-1),n(5),u((e.detail.status==null?null:e.detail.status.name)!==e.STATUS.CANCELLED?36:-1),n(2),u(e.isEmployee()?38:-1),n(5),_(e.formatMessage("pickup_drop_executive")),n(),u(e.isEmployee()&&(e.detail.assigned_user!=null&&e.detail.assigned_user.name)?44:-1),n(),u(e.detail.assigned_user!=null&&e.detail.assigned_user.name?45:46),n(7),_(e.formatMessage("common_details")),n(3),_(e.formatMessage("common_type")),n(2),_(e.typeLabel(e.detail.type)),n(),u(e.modeLabel?58:-1),n(3),_(e.formatMessage("common_device")),n(2),_(e.deviceName||"\u2014"),n(),u(e.detail.linkable_id?64:-1),n(),u(e.detail.scheduled_on?65:-1),n(3),_(e.formatMessage("common_assignee")),n(2),_((e.detail.assigned_user==null?null:e.detail.assigned_user.display_name)??(e.detail.assigned_user==null?null:e.detail.assigned_user.name)??e.formatMessage("unassigned")),n(),u(e.detail.provider!=null&&e.detail.provider.name?71:-1),n(),u(e.detail.tracking_id?72:-1),n(),u(e.detail.charges?73:-1),n(),u(e.detail.cod_amount>0?74:-1),n(5),_(e.formatMessage("pickup_drop_activity")),n(),u(e.detail.activities!=null&&e.detail.activities.length?80:81),n(2),u(e.detail.address?82:-1),n(),u(e.detail.comment?83:-1),n(),de("visible",e.statusPopupVisible),p("width","95vw")("maxWidth",480)("height","auto")("title",e.statusPopupTitle)("showCloseButton",!0),n(),p("dxTemplateOf","content"),n(),p("recordId",e.detail.id)("isVisible",e.reassignPopupVisible),n(),p("isVisible",e.isHandoverVisible)("task",e.detail)("mode",e.handoverMode)}}var qt=(()=>{class t{constructor(){this.formatMessage=f,this.ENTITIES=g,this.service=b(N),this.toast=b(R),this.router=b(X),this.route=b(me),this.isEmployee=b(fe).isEmployee,this.tenantService=b(ie),this.userDeviceService=b(Re),this.nativeLink=b(Ei),this.STATUS=S,this.iconSizes=Si,this.detail=null,this.loading=!0,this.validTransitions=[],this.statusPopupVisible=!1,this.pendingStatus=null,this.rescheduleOn=null,this.statusReason=null,this.isSavingStatus=!1,this.reassignPopupVisible=!1,this.isHandoverVisible=!1,this.handoverMode=H.COMPLETE,this.minDate=this.tenantService.today(),this.id=null}get isMobileDevice(){return this.userDeviceService.isMobileDevice()}
2ngOnInit(){if(this.id=+this.route.snapshot.paramMap.get("id"),!this.id){this.router.navigate(["/"+re+"/list"]);return}this.load()}get isPickup(){return this.detail?.type==="Pickup"}computeValidTransitions(){return(this.detail?.allowed_transitions||[]).map(i=>typeof i=="string"?i:i.key).map(i=>({to:i,label:this.statusLabel(i)}))}get sourceRef(){let e=this.detail?.linkable,i=e?.formatted_job_number||e?.job_number||e?.sale_number||e?.purchase_number;return i||(this.detail?.linkable_id?"#"+this.detail.linkable_id:f("pickup_drop_walk_in"))}get sourceLabel(){let i={[g.JOB.name]:"pickup_drop_source_job",[g.CONTACT_US.name]:"pickup_drop_source_self_checkin",[g.SALE.name]:"pickup_drop_source_sale",[g.PURCHASE.name]:"pickup_drop_source_purchase",[g.OUTSOURCED_JOB.name]:"pickup_drop_source_outsource"}[this.detail?.linkable_type];return i?f(i):f("pickup_drop_walk_in")}get linkedRoute(){let e=this.detail?.linkable_id;if(!e)return null;switch(this.detail?.linkable_type){case g.JOB.name:return["/jobs",e];case g.SALE.name:return["/sales",e];case g.PURCHASE.name:return["/purchases",e];default:return null}}get deviceName(){return Pe(this.detail)}typeLabel(e){return f(e===I[1].text?"pickup_drop_type_drop":"pickup_drop_type_pickup")}get modeLabel(){return this.detail?.mode?f("pickup_drop_mode_"+this.detail.mode):""}stepLabel(e){return f("pickup_drop_track_step_"+e)}get statusSteps(){let e=S,i=this.detail?.mode==="courier"?[e.SCHEDULED,e.ASSIGNED,e.IN_TRANSIT,e.COMPLETED]:[e.SCHEDULED,e.ASSIGNED,e.EN_ROUTE,e.ARRIVED,e.COMPLETED],o={[e.SCHEDULED]:!!(this.detail?.scheduled_on??this.detail?.created_at),[e.EN_ROUTE]:!!this.detail?.en_route_at,[e.ARRIVED]:!!this.detail?.arrived_at,[e.IN_TRANSIT]:!!this.detail?.en_route_at,[e.COMPLETED]:!!this.detail?.completed_at},c=i.indexOf(this.detail?.status?.name);return i.map((y,D)=>({key:y,label:this.stepLabel(y),done:c>=0?D<c:!!o[y],current:D===c}))}get customerName(){return this.detail?.user?.name??""}get pageTitle(){let e=(this.modeLabel+" "+this.typeLabel(this.detail?.type)).trim();
2return f("pickup_drop_detail_title",e,this.customerName||f("common_customer"))}get currentStatusLabel(){return this.detail?.status?.display_name||this.statusLabel(this.detail?.status?.name)}get attemptLabel(){let e=+this.detail?.attempt_count||0,i=(this.isPickup?f("pickup_drop_type_pickup"):f("pickup_drop_type_drop")).toLowerCase();return f(e===1?"pickup_drop_attempt_count_one":"pickup_drop_attempts_count",String(e),i)}stepTimestamp(e){let i=S;return{[i.SCHEDULED]:this.detail?.scheduled_on??this.detail?.created_at,[i.EN_ROUTE]:this.detail?.en_route_at,[i.IN_TRANSIT]:this.detail?.en_route_at,[i.ARRIVED]:this.detail?.arrived_at,[i.COMPLETED]:this.detail?.completed_at}[e]??null}stepTime(e){let i=this.stepTimestamp(e);if(!i)return"";let o=this.tenantService.timezone();ti.default.tz.zone(o)===null&&(o="UTC");let c=ti.default.utc(i).tz(o);return c.isValid()?c.format("h:mm A"):""}get contactNumber(){return this.detail?.user?.mobile_number??this.detail?.mobile_number??""}get contactCountryCode(){return this.detail?.user?.mobile_country_code??this.detail?.mobile_country_code??""}get executiveNumber(){return this.detail?.assigned_user?.mobile_number??""}get executiveCountryCode(){return this.detail?.assigned_user?.mobile_country_code??""}get whatsAppNumber(){return(this.contactCountryCode+this.contactNumber).replace(/[^0-9]/g,"")}get mapsUrl(){return this.nativeLink.mapsSearchUrl(ke(this.detail?.address))}get canTrackLive(){let e=this.detail?.status?.name;return!!this.detail?.assigned_user?.id&&(e===S.EN_ROUTE||e===S.ARRIVED)}statusLabel(e){return(e??"").replace(/_/g," ").replace(/\b\w/g,i=>i.toUpperCase())}activityTitle(e){let i=e?.properties?.to;return e?.description==="status_changed"&&i?f("pickup_drop_activity_status")+" "+this.statusLabel(i):this.statusLabel(e?.description??"")}activitySubtitle(e){let i=e?.properties??{};if(i.reason)return f(i.reason);if(e?.description==="created")return this.detail?.linkable_id?f("pickup_drop_activity_linked",this.sourceRef):"";if(e?.description==="status_changed"){let c={[this.STATUS.ARRIVED]:"pickup_drop_executive_arrived",[this.STATUS.IN_TRANSIT]:"pickup_drop_shipped_courier",[this.STATUS.COMPLETED]:"pickup_drop_activity_completed_desc"}[i.to];return c?f(c):""}return""}activityIcon(e){return e?.description==="status_changed"?"fa-arrows-rotate":{created:"fa-plus-circle",assigned:"fa-user-cog",rescheduled:"fa-rotate",cancelled:"fa-trash"}[e?.description]||"fa-pen-to-square"}activityColor(e){if(e?.description==="status_changed"){let o=e?.properties?.to;return o===this.STATUS.COMPLETED?"bg-success":o===this.STATUS.FAILED||o===this.STATUS.CANCELLED?"bg-danger":"bg-primary"}return{created:"bg-primary",assigned:"bg-info",cancelled:"bg-danger",rescheduled:"bg-warning"}[e?.description]||"bg-secondary"}trackLive(){let e=this.detail?.assigned_user;this.router.navigate(["/pickupDrop/map"],{queryParams:{employee:JSON.stringify({id:e.id,name:e.name}),pickupDropId:this.detail?.id,customerId:this.detail?.user?.id,customerPhoneNumber:this.contactNumber}})}copyTrackingLink(){let e=this.detail?.tracking_url;e&&navigator.clipboard?.writeText(e).then(()=>this.toast.success("pickup_drop_tracking_link_copied"),()=>this.toast.error("notification_update_error"))}edit(){this.router.navigate(["/"+re+"/edit",this.detail?.id])}back(){this.router.navigate(["/"+re+"/list"])}openLinked(){this.linkedRoute&&this.router.navigate(this.linkedRoute)}callContact(){this.contactNumber&&window.open("tel:"+this.contactNumber,"_self")}callExecutive(){this.executiveNumber&&window.open("tel:"+this.executiveNumber,"_self")}openReassign(){this.reassignPopupVisible=!0}onReassignClosed(){this.reassignPopupVisible=!1}onReassignSaved(){this.reassignPopupVisible=!1,this.load()}onHandoverCompleted(){this.isHandoverVisible=!1,this.load()}onHandoverClosed(){this.isHandoverVisible=!1}openWhatsApp(){this.nativeLink.openWhatsApp(this.whatsAppNumber)}openMaps(){window.open(this.mapsUrl,"_blank")}transition(e){if(e===this.STATUS.RESCHEDULED||e===this.STATUS.CANCELLED){this.pendingStatus=e,this.rescheduleOn=null,this.statusReason=null,this.statusPopupVisible=!0;return}if(e===this.STATUS.COMPLETED||e===this.STATUS.FAILED){this.handoverMode=e===this.STATUS.FAILED?H.FAILED:H.COMPLETE,this.isHandoverVisible=!0;return}this.service.transition(this.id,{to:e,expected_status_id:this.detail?.status_id}).subscribe({next:()=>{this.toast.success("pickup_drop_status_updated"),this.load()},error:i=>this.toast.error(i?.error?.errors?.to?.[0]??"notification_update_error")})}get statusPopupTitle(){return f(this.pendingStatus===this.STATUS.RESCHEDULED?"pickup_drop_reschedule":"pickup_drop_cancel_title")}closeStatusPopup(){this.statusPopupVisible=!1,this.pendingStatus=null}confirmStatusChange(){if(this.pendingStatus===this.STATUS.RESCHEDULED){if
2(!this.rescheduleOn){this.toast.warning("pickup_drop_schedule_required");return}this.isSavingStatus=!0,this.service.reschedule(this.id,{scheduled_on:this.rescheduleOn,expected_status_id:this.detail?.status_id}).subscribe({next:()=>{this.toast.success("pickup_drop_rescheduled"),this.closeStatusPopup(),this.load()},error:e=>this.toast.error(e?.error?.errors?.scheduled_on?.[0]??"notification_update_error")}).add(()=>this.isSavingStatus=!1);return}if(!this.statusReason){this.toast.warning("pickup_drop_reason_required");return}this.isSavingStatus=!0,this.service.transition(this.id,{to:this.STATUS.CANCELLED,reason:this.statusReason,expected_status_id:this.detail?.status_id}).subscribe({next:()=>{this.toast.success("pickup_drop_status_updated"),this.closeStatusPopup(),this.load()},error:e=>this.toast.error(e?.error?.errors?.reason?.[0]??"notification_update_error")}).add(()=>this.isSavingStatus=!1)}load(){this.loading=!0,this.service.getById(this.id).subscribe({next:e=>{this.detail=e?.data??e,this.validTransitions=this.computeValidTransitions(),this.loading=!1},error:()=>{this.loading=!1,this.toast.error("notification_pickup_drop_not_found"),this.router.navigate(["/"+re+"/list"])}})}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=O({type:t,selectors:[["app-pickup-drop-detail-page"]],decls:2,vars:1,consts:[[1,"d-flex","justify-content-center","align-items-center","py-5"],[1,"container-fluid","p-0","pt-3"],[3,"height","width"],[1,"mx-auto","app-pddp-max-width-1160px"],["entityLabel","pickup_drop",3,"editClick","mobileHeaderOnly","recordTitle","canEdit"],[1,"d-flex","align-items-center","gap-2","small","mb-3"],["appA11yClick","","role","button",1,"text-muted","text-decoration-none","d-inline-flex","align-items-center","gap-1","cursor-pointer",3,"click"],[1,"fa-thin","fa-chevron-left"],[1,"text-muted"],[1,"fw-semibold"],[1,"mb-4"],[1,"d-flex","align-items-center","flex-wrap","gap-2","mb-2"],[1,"badge","rounded-pill","theme-badge","px-3","py-2"],[1,"fa-thin","me-1",3,"ngClass"],[3,"status","type"],[1,"text-muted","small"],[1,"d-flex","flex-wrap","align-items-start","justify-content-between","gap-3"],[1,"mb-1","fw-bold"],[1,"d-flex","flex-wrap","gap-2"],["stylingMode","outlined","type","default","icon","fa-thin fa-link",3,"text"],["stylingMode","outlined","type","default","icon","fa-thin fa-location-crosshairs",3,"text"],[3,"entityId","entityType","showLabel"],["stylingMode","contained","type","default","icon","fa-thin fa-pen",3,"text"],["displayExpr","label","keyExpr","to","icon","fa-thin fa-arrows-rotate","stylingMode","contained","type","default",3,"items","text"],[1,"alert","alert-danger","d-flex","flex-wrap","align-items-center","gap-2","rounded-3","px-3","py-2","mb-4"],[1,"alert","alert-warning","py-2","px-3","small","mb-4"],[1,"alert","alert-info","py-2","px-3","small","mb-4"],[1,"row","g-4","mb-4"],[1,"col-md-6"],[1,"app-card","h-100"],[1,"d-flex","align-items-center","justify-content-between","mb-3"],[1,"app-subgroup-label"],["appA11yClick","","role","button",1,"small","text-decoration-none","cursor-pointer"],[1,"text-center","py-3"],[1,"row","g-3","mb-4"],[1,"col-lg-6"],[1,"h-100"],[1,"py-2"],[1,"app-subgroup-label","mb-2"],[1,"d-flex","justify-content-between","py-1","small"],[1,"py-2","d-flex","flex-column"],[1,"app-subgroup-label","mb-3","flex-shrink-0"],[1,"flex-grow-1","overflow-y-auto","min-height-0","app-pddp-max-height-240px"],["appPhoneMode","",3,"visibleChange","onHidden","visible","width","maxWidth","height","title","showCloseButton"],[4,"dxTemplate","dxTemplateOf"],["mode","assign",3,"closed","saved","recordId","isVisible"],[3,"completed","closed","isVisible","task","mode"],["appA11yClick","","role","button",1,"fw-semibold","text-decoration-underline","cursor-pointer"],["appA11yClick","","role","button",1,"fw-semibold","text-decoration-underline","cursor-pointer",3,"click"],["stylingMode","outlined","type","default","icon","fa-thin fa-link",3,"onClick","text"],["stylingMode","outlined","type","default","icon","fa-thin fa-location-crosshairs",3,"onClick","text"],["stylingMode","contained","type","default","icon","fa-thin fa-pen",3,"onClick","text"],["displayExpr","label","keyExpr","to","icon","fa-thin fa-arrows-rotate","stylingMode","contained","type","default",3,"onItemClick","items","text"],[1,"fa-solid","fa-circle-xmark"],[1,"fw-bold"],[1,"badge","rounded-pill","bg-danger","text-white"],[1,"flex-grow-1","small","fw-medium"],[1,"fw-semibold","mt-1"],[1,"d-flex","align-items-start","overflow-auto"],[1,"d-flex","flex-column","align-items-center","text-center","app-pddp-width-72px","app-pddp-flex-0-0-auto"],[1,"rounded-circle","d-inline-flex","align-items-center","justify-content-center","border","border-2","app-pddp-box-30",3,"ngClass"],[1,"fa-solid","fa-check","small"],[1,"fa-solid","fa-circle","app-pddp-fs-0-5rem"],[1,"small","mt-2",3,"ngClass"],[1,"text-muted","mt-1","fs-11"],[1,"flex-grow-1","app-pddp-height-2px","app-pddp-margin-top-14px","app-pddp-min-width-12px",3,"ngClass"],[1,"d-flex","align-items-center","gap-3","mb-3"],[3,"iconOnly","user","size","isClickable"],[1,"flex-grow-1","text-truncate","app-pddp-min-width-0"],[1,"fw-semibold","text-truncate"],[1,"small","text-muted"],[1,"d-flex","align-items-center","bg-theme","theme-border","rounded","px-3","py-2","mb-2"],[1,"d-flex","flex-wrap","gap-2","mt-3"],[1,"fa-thin","fa-phone","text-muted","me-2"],[1,"text-decoration-none","flex-grow-1","text-truncate",3,"href"],[3,"textToBeCopied"],["buttonType","default","icon","fa-thin fa-phone","text","call",3,"onClickEvent","isVisibleIcon"],[3,"entityId","entityName","mobileNumber","mobileCountryCode"],["appA11yClick","","role","button",1,"small","text-decoration-none","cursor-pointer",3,"click"],[1,"fa-thin","fa-arrows-rotate","me-1"],["buttonType","default","icon","fa-thin fa-phone","text","call",3,"isVisibleIcon"],["buttonType","normal","icon","fa-thin fa-location-crosshairs","text","pickup_drop_track",3,"isVisibleIcon"],["buttonType","normal","icon","fa-thin fa-location-crosshairs","text","pickup_drop_track",3,"onClickEvent","isVisibleIcon"],[1,"text-muted","mb-3"],["buttonType","default","icon","fa-thin fa-user-plus","text","common_assign",3,"isVisibleIcon"],["buttonType","default","icon","fa-thin fa-user-plus","text","common_assign",3,"onClickEvent","isVisibleIcon"],["appA11yClick","","role","button",1,"f
2w-bold","text-decoration-underline","cursor-pointer"],["appA11yClick","","role","button",1,"fw-bold","text-decoration-underline","cursor-pointer",3,"click"],[3,"value"],[1,"text-warning"],[1,"d-flex","gap-2","position-relative"],[1,"position-relative","d-flex","flex-column","align-items-center","flex-shrink-0","app-pddp-width-36px"],[1,"position-absolute","app-pddp-top-34px","app-pddp-bottom-neg4px","app-pddp-left-50","app-pddp-transform-translatex-50","app-pddp-width-1px","app-pddp-bg-theme-border-color-dee2e6"],[1,"flex-grow-1","pb-4"],[1,"d-flex","justify-content-between","align-items-start","gap-2"],[1,"fw-bold","small"],[1,"text-muted","text-nowrap","fs-11"],[1,"text-muted","small","mt-1"],[1,"fa-thin","fa-location-dot","me-2"],[1,"small"],[1,"d-flex","flex-wrap","align-items-center","gap-2","mt-2","small"],["appA11yClick","","role","button",1,"fw-medium","text-info","text-decoration-none","cursor-pointer",3,"click"],[1,"small",3,"innerHTML"],[1,"d-flex","justify-content-end","gap-2","mt-3"],["stylingMode","outlined","type","normal",3,"onClick","text"],["stylingMode","contained",3,"onClick","type","text","disabled"],[1,"small","mb-3"],[1,"text-muted","small","mb-2"],["type","datetime","dateSerializationFormat","yyyy-MM-ddTHH:mm:ss","pickerType","calendar",3,"valueChange","value","width","min","displayFormat"],[3,"valueChange","value","height","autoResizeEnabled"]],template:function(i,o){i&1&&m(0,Qr,2,2,"div",0)(1,zl,88,61,"div",1),i&2&&u(o.loading||!o.detail?0:1)},dependencies:[je,St,yt,ne,Nt,Y,z,W,q,ln,nn,zi,Ki,Rt,Oi,Ti,Xi,he,Ce,ge,ve,Ni,Ri,nt,it,Dt,j,$,oe,J,K,Qe,Ot],styles:[".app-pddp-max-width-1160px[_ngcontent-%COMP%]{max-width:1160px}.app-pddp-width-72px[_ngcontent-%COMP%]{width:72px}.app-pddp-flex-0-0-auto[_ngcontent-%COMP%]{flex:0 0 auto}.app-pddp-box-30[_ngcontent-%COMP%]{width:30px;height:30px}.app-pddp-fs-0-5rem[_ngcontent-%COMP%]{font-size:.5rem}.app-pddp-height-2px[_ngcontent-%COMP%]{height:2px}.app-pddp-margin-top-14px[_ngcontent-%COMP%]{margin-top:14px}.app-pddp-min-width-12px[_ngcontent-%COMP%]{min-width:12px}.app-pddp-min-width-0[_ngcontent-%COMP%]{min-width:0}.app-pddp-max-height-240px[_ngcontent-%COMP%]{max-height:240px}.app-pddp-width-36px[_ngcontent-%COMP%]{width:36px}.app-pddp-box-32[_ngcontent-%COMP%]{width:32px;height:32px}.app-pddp-z-index-1[_ngcontent-%COMP%]{z-index:1}.app-pddp-fs-font-body-sm[_ngcontent-%COMP%]{font-size:var(--font-body-sm)}.app-pddp-top-34px[_ngcontent-%COMP%]{top:34px}.app-pddp-bottom-neg4px[_ngcontent-%COMP%]{bottom:-4px}.app-pddp-left-50[_ngcontent-%COMP%]{left:50%}.app-pddp-transform-translatex-50[_ngcontent-%COMP%]{transform:translate(-50%)}.app-pddp-width-1px[_ngcontent-%COMP%]{width:1px}.app-pddp-bg-theme-border-color-dee2e6[_ngcontent-%COMP%]{background-color:var(--theme-border-color, #dee2e6)}"]})}}return t})();var ql=[{path:"",component:Dn,children:[{path:"list",component:zt,canActivate:[Fe,Ue,Le,He],data:{entity:g.PICKUP_DROP,permissions:{only:[xe.PICKUP_DROP_LIST],redirectTo:"/dashboards"}},title:()=>f("pickup_drops")},{path:"myRoute",component:jt,canActivate:[Fe,kt,Ue,Le,He],data:{entity:g.PICKUP_DROP,permissions:{only:[xe.PICKUP_DROP_LIST],redirectTo:"/pickupDrops/list"}},title:()=>f("route_title_my_route")},{path:"add",component:ct,canActivate:[Fe,kt,Ue,Le,He],data:{header:{title:"create_new_pickup_drop"},entity:g.PICKUP_DROP,permissions:{only:[xe.PICKUP_DROP_WRITE],redirectTo:"/pickupDrops/list"}},title:()=>f("create_new_pickup_drop")},{path:"details/:id",component:qt,canActivate:[Fe,Ue,Le,He],data:{entity:g.PICKUP_DROP,permissions:{only:[xe.PICKUP_DROP_LIST],redirectTo:"/pickupDrops/list"}},title:()=>f("route_title_pickup_and_drop_details")},{path:"edit/:id",component:ct,canActivate:[Fe,kt,Ue,Le,He],data:{entity:g.PICKUP_DROP,permissions:{only:[xe.PICKUP_DROP_WRITE],redirectTo:"/pickupDrops/list"}},title:()=>f("route_title_edit_pickup_and_drop")},{path:"",redirectTo:"list",pathMatch:"full"},{path:"**",redirectTo:"/errors/404"}]}],On=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=ft({type:t})}
2static{this.\u0275inj=ut({imports:[Wt.forChild(Gi(ql)),Wt]})}}return t})();var Nm=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=ft({type:t})}static{this.\u0275inj=ut({imports:[On,ct,jt,it,zt,Gt,qt,nt,Kt]})}}return t})();export{Nm as PickupAndDropModule};
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.