PageSourceSearch

https://mytracksoftware.com/chunk-ES3JP42A.js

js mytracksoftware.com collected 2026-10-08 17:09:27 UTC 80,525 bytes, 1 lines download raw bytes

1import{a as Je}from"./chunk-NSB55TQQ.js";import{a as Ke}from"./chunk-WEMO4HOO.js";import{a as Ze}from"./chunk-ALCTHUUR.js";import"./chunk-AS6BC4OJ.js";import{a as We}from"./chunk-4PLAMQ7J.js";import{a as je}from"./chunk-B77MZDE7.js";import"./chunk-CBC34OC2.js";import{a as Ye}from"./chunk-3XTQ6TTI.js";import{a as d,b as K}from"./chunk-OHZXVWME.js";import{a as P}from"./chunk-K6SPPEPZ.js";import"./chunk-CWNX4Y6X.js";import{a as qe}from"./chunk-LOSZH6LX.js";import{a as $e}from"./chunk-SC7OIAJ7.js";import"./chunk-OT7D67RG.js";import"./chunk-L22N5WJT.js";import{c as He}from"./chunk-VGGK7HQB.js";import"./chunk-J6WHBBPP.js";import"./chunk-MKF6QG6V.js";import"./chunk-HOI7JMLX.js";import"./chunk-B3XBM5MD.js";import"./chunk-XGLRQSSV.js";import"./chunk-DAOPRFTB.js";import"./chunk-MVFZ4W5S.js";import{a as Fe,b as Pe}from"./chunk-QPO6AB24.js";import"./chunk-T2LKHT2R.js";import{a as Te}from"./chunk-AV7BHVMF.js";import"./chunk-ECX4OUPM.js";import"./chunk-D5ZZMR3T.js";import{a as Be}from"./chunk-LB7GZ4RS.js";import"./chunk-MN2O4OIW.js";import{a as D,k as Me,l as xe,m as B}from"./chunk-XJIYDCB7.js";import"./chunk-OOAKO2NW.js";import"./chunk-CW3A6GGH.js";import"./chunk-LLNDO5TI.js";import"./chunk-LK2H5GWW.js";import"./chunk-LLNUHMNV.js";import"./chunk-QUSGVUOF.js";import"./chunk-CJPLD6EO.js";import"./chunk-PDZ2GFID.js";import{a as fe}from"./chunk-O7GVHEWQ.js";import{a as Ve}from"./chunk-4W4OTVCU.js";import{a as ve}from"./chunk-UBZHVILN.js";import"./chunk-WECRXZVT.js";import"./chunk-SXSN5XUL.js";import"./chunk-XGQFJQG5.js";import"./chunk-7MFB5OWF.js";import"./chunk-TH4X4PKG.js";import"./chunk-C6BZFLMK.js";import"./chunk-IDHC3I6D.js";import"./chunk-TVZI3GRT.js";import{a as rt}from"./chunk-EMD5D3CD.js";import{f as Se}from"./chunk-P7NG7HPQ.js";import"./chunk-CZPI7VJ5.js";import{j as ze}from"./chunk-4VN4MCU7.js";import{a as ke}from"./chunk-7GVDXUAU.js";import"./chunk-4J4X5EMA.js";import{c as Ue}from"./chunk-ECECGNR4.js";import"./chunk-2IWGUN3K.js";import{a as pe}from"./chunk-NCZHNS3C.js";import"./chunk-GO7UHMBF.js";import"./chunk-5DDWRNUO.js";import{a as Z,da as c,fa as he,u as Ie,va as Ge}from"./chunk-6ZVTRFTL.js";import"./chunk-P76QNSQL.js";import{A as ce,d as L,h as oe,l as _,n as ne,s as le}from"./chunk-Z34FZIQM.js";import"./chunk-SM5FSVVY.js";import"./chunk-TDDXVLK3.js";import{Aa as be,Ab as de,Ba as u,Ea as ee,Ec as ge,Fa as h,Gb as Oe,Ja as te,Qa as O,Wa as Ne,Ya as y,Yb as me,cb as x,gb as ie,la as Ee,pc as W,uc as z,vc as V}from"./chunk-XVA3MWZK.js";import"./chunk-IJOWPJZI.js";import{d as ue,e as U}from"./chunk-U32DLQYF.js";import{Ac as Le,Bc as N,Dc as _e,Ga as re,Kb as G,Lb as M,Mc as A,Nc as R,Qb as f,Rb as v,Sb as T,Tb as C,U as we,_b as X,bb as p,cc as k,ec as b,ha as m,mb as se,oa as J,pa as Q,rb as F,tc as $,ua as Ae,uc as Y,wa as j,wb as q,yc as Re,zc as ye}from"./chunk-FCFRADKE.js";import{a as l,h as at,j as Ce}from"./chunk-XHGXIXF6.js";var Qe=(()=>{class o{constructor(){this.uiUtilitiesService=m(Se),this.allocationService=m(K),this.acceptanceService=m(P),this.modalService=m(ge),this.mathService=m(pe),this.viewRef=m(se),this.dateTimeService=m(Ge),this.mciTranslateService=m(ue),this.mciGridService=m(fe),this.notificationBarService=m(Ue),this.commonService=m(ve),this.hasRevokedException=!1,this.canViewRates=!1,this.activityCodesEnabled=!1,this.close=new j,this.columnDefs=[],this.customFields=[],this.costObjects=new Map,this.canViewGLAccount=!1,this.takeUntilDestroyed=be,this.destroyRef=m(Ae)}ngOnInit(){this.getTranslations(),this.selectedRowData?.state?.name===D.accepted&&(this.canDelete=!1),this.commonService.getScreenNamePermissions(y.GL_ACCOUNT_ALLOCATIONS).subscribe(e=>{this.canViewGLAccount=e?.[0]?.data?.view??!1,this.columnDefinition()}),this.selectedRowData?.classification.id===h.MATERIAL&&(this.selectedRowData.allocationid?(this.gridDataView=[],this.columnDefinition()):this.acceptanceService.getAcceptanceAllocationsForResource(this.selectedRowData).subscribe(e=>{this.uiUtilitiesService.handleResponse(e)&&(this.customFields=this.mciGridService.prepareDynamicCustomFieldColumnDefs(e[0]?.data,"name","name","format"),this.gridDataView=e[0]?.data,this.checkCostObject(this.gridDataView),this.hasRevokedException=this.gridDataView?.some(a=>a.exceptions&&a.exceptions?.isrevoked===!0),this.gridDataView.forEac
1h(a=>{a.attachments=this.uiUtilitiesService.formatStringWithMultipleArray(a.attachments)}),this.gridDataView.length>0&&this.columnDefinition())}))}getTranslations(){this.entity=this.mciTranslateService.getTranslation("L.Allocation").toLocaleLowerCase(),this.entityPlural=this.mciTranslateService.getTranslation("L.Allocations").toLocaleLowerCase(),this.yesValue=this.mciTranslateService.getTranslation("L.Yes"),this.noValue=this.mciTranslateService.getTranslation("L.No"),this.noRatesViewPermission=this.mciTranslateService.getTranslation("M.No_Permission_Rates")}openDeleteDialog(e){let a=this.modalService.openConfirmActionModal(e,this.entity,this.entityPlural,u.DELETE,W.ASYNC_CONFIRM),i=this.mciTranslateService.getTranslation("L.Resource_Allocation");a.componentInstance.confirmAction$.pipe(this.takeUntilDestroyed(this.destroyRef)).subscribe(t=>{t===u.DELETE&&this.allocationService.deleteequipmentAllocation(e?.allocationid,e?.classification).subscribe(r=>{a.close(),r[0].success?(this.close.emit(),this.notificationBarService.showNotificationMessage(this.mciTranslateService.getTranslation("M.Entity_Deleted",{entity:i}),"")):this.notificationBarService.showNotificationMessage(this.mciTranslateService.getTranslation("M.Entity_Could_Not_Be_Deleted",{entity:i}))})})}columnDefinition(){let e=[{field:"exceptions",headerName:this.mciTranslateService.getTranslation(O.EXCEPTION),cellRenderer:"exceptionIconCell",context:{excludeExcelExport:!1,isAutoSize:!0}}],i=[...[{field:"workdate",headerName:this.mciTranslateService.getTranslation("L.Timesheet_Date"),type:"rightAligned",filter:"agDateColumnFilter",valueGetter:t=>this.dateTimeService.toLocalizedDateFormat(t.data.workdate),filterParams:{comparator:this.dateTimeService.localizedDateFilterComparator},comparator:this.dateTimeService.localizedDateComparator,context:{isAutoSize:!0}},{field:"timesheetreference",headerName:this.mciTranslateService.getTranslation("L.Timesheet_Ref"),filter:"agTextColumnFilter"},{field:"revoketimesheetref",headerName:this.mciTranslateService.getTranslation("L.Revoked_Timesheet_Num"),context:{displayFieldName:""},type:"rightAligned",cellRenderer:t=>t?.data?.revoketimesheetref,filterParams:{valueGetter:t=>t.data?.revoketimesheetref}},{field:"state",headerName:this.mciTranslateService.getTranslation("L.State"),cellRenderer:"globalStatesCellRenderer"},{field:"allocated.description",headerName:this.mciTranslateService.getTranslation("L.Description"),filter:"agTextColumnFilter"},{field:"agreement.name",headerName:this.mciTranslateService.getTranslation("L.Agreement"),filter:"agTextColumnFilter"},{field:"area.name",headerName:this.mciTranslateService.getTranslation("L.Area_ID"),filter:"agTextColumnFilter",context:{isAutoSize:!0}},{field:"glaccount.code",headerName:this.mciTranslateService.getTranslation("L.GL_Account"),filter:"agTextColumnFilter",cellRenderer:t=>t.value||c,sortable:!0,context:{isAutoSize:!0},hide:!this.canViewGLAccount},{field:"activitycode.name",headerName:this.mciTranslateService.getTranslation("L.Activity_Code"),filter:"agTextColumnFilter",cellRenderer:t=>t.value||c,sortable:!0,context:{isAutoSize:!0},hide:!this.activityCodesEnabled},{field:"costobject.purchaseorder.name",headerName:this.mciTranslateService.getTranslation("L.Purchase_Order"),filter:"agTextColumnFilter",hide:!this.costObjects.has("purchaseorder")},{field:"costobject.purchaseorderline.name",headerName:this.mciTranslateService.getTranslation("L.Purchase_Order_Line"),filter:"agTextColumnFilter",hide:!this.costObjects.has("purchaseorderline")},{field:"costobject.labelname",headerName:this.mciTranslateService.getTranslation("L.Cost_Object_Type"),filter:"agTextColumnFilter",hide:!this.costObjects.has("costobject")},{field:"costobject.name",headerName:this.mciTranslateService.getTranslation("L.Cost_Object"),filter:"agTextColumnFilter",hide:!this.costObjects.has("costobject")},{field:"costobject.operation.name",headerName:this.mciTranslateService.getTranslation("L.Operations_Or_Activity"),filter:"agTextColumnFilter",hide:!this.costObjects.has("operations")},{field:"costobject.suboperation.name",headerName:this.mciTranslateService.getTranslation("L.SubOperations_Or_Element"),filter:"agTextColumnFilter",hide:!this.costOb
1jects.has("suboperations")},l({field:"allocated.rate",headerName:this.mciTranslateService.getTranslation("L.Rates"),cellRenderer:"materialToolTip",cellRendererParams:t=>{let r={simpleTooltip:!0};return r.value=this.mathService.formatNumber(t.value),this.canViewRates?r.suffix=t?.data.currencyabbr:r.tooltip=this.noRatesViewPermission,r},valueGetter:t=>this.canViewRates?this.getCurrencyCellValueGetter(t,t?.data?.allocated?.rate):c,tooltipComponentParams:{hide:!this.canViewRates,customValueCb:t=>{let r=t?.value,s=t?.data?.currencyabbr;return`${r} ${s}`}}},this.mciGridService.getBaseNumericColumnDefinition(!0)),l({field:"quantity",headerName:this.mciTranslateService.getTranslation("L.Units"),cellRenderer:t=>this.mathService.formatNumber(t?.value),valueGetter:t=>this.mathService.roundDisplay(t?.data?.quantity??0,!1)},this.mciGridService.getBaseDecimalColumnDefinition()),l({field:"markup",headerName:this.mciTranslateService.getTranslation("L.Markup"),cellRenderer:"materialToolTip",cellRendererParams:t=>{let r={simpleTooltip:!0};return r.value=this.mathService.formatNumber(t.value),this.canViewRates?r.suffix=t?.data.currencyabbr:r.tooltip=this.noRatesViewPermission,r},valueGetter:this.canViewRates?t=>this.getCurrencyCellValueGetter(t,t?.data?.markup):c,tooltipComponentParams:{hide:!this.canViewRates,customValueCb:t=>{let r=t?.value,s=t?.data?.currencyabbr;return`${r} ${s}`}}},this.mciGridService.getBaseNumericColumnDefinition(!0)),l({field:"tax",headerName:this.mciTranslateService.getTranslation("L.Tax"),filter:"agTextColumnFilter",type:"rightAligned",cellRenderer:"materialToolTip",cellRendererParams:t=>{let r={simpleTooltip:!0};return r.value=this.mathService.formatNumber(t.value),this.canViewRates?r.suffix=t.data?.currencyabbr:r.tooltip=this.noRatesViewPermission,r},valueGetter:this.canViewRates?t=>this.getCurrencyCellValueGetter(t,t?.data?.tax):c,tooltipComponentParams:{hide:!this.canViewRates,customValueCb:t=>{let r=t?.value,s=t?.data?.currencyabbr;return`${r} ${s}`}}},this.mciGridService.getBaseNumericColumnDefinition(!0)),{field:"isnonbillable",headerName:this.mciTranslateService.getTranslation("L.Non_Billable"),valueFormatter:t=>t?.value===!0?this.yesValue:this.noValue},{field:"isfixedfee",headerName:this.mciTranslateService.getTranslation("L.Lump_Sum"),valueFormatter:t=>t?.value===!0?this.yesValue:this.noValue},{field:"issubcontractor",headerName:this.mciTranslateService.getTranslation("L.Sub_Contractor"),valueFormatter:t=>t?.value===!0?this.yesValue:this.noValue},{field:"comment",cellRenderer:"commentCell",headerName:this.mciTranslateService.getTranslation(O.COMMENT)},{field:"attachment",headerName:this.mciTranslateService.getTranslation("L.Attachment"),cellRenderer:"materialGridIcon",headerClass:"ag-center-aligned-header",cellClass:"ag-center-aligned-cell",cellRendererParams:{icon:"attach_file",isDisplayValue:!0,propertyName:"attachmentdata",displayValueCb:t=>t?.data?.attachments?.length,clickEvent:t=>{if(t.attachments){let r=t.attachments,s={id:t.id,attachmentData:r};this.modalService.openAttachmentModal(this.viewRef,s,this.mciTranslateService.getTranslation("L.Material_Allocation"),this.actionType,this.permissions,!0)}}},context:{isAutoSize:!0},resizable:!1},l({field:"allocated.totalcost",headerName:this.mciTranslateService.getTranslation("L.Total_Cost"),cellRenderer:"materialToolTip",cellRendererParams:t=>{let r={simpleTooltip:!0};return r.value=this.mathService.formatNumber(t.value),this.canViewRates?r.suffix=t.data?.currencyabbr:r.tooltip=this.noRatesViewPermission,r},valueGetter:this.canViewRates?t=>this.mathService.roundDisplay(t?.data?.allocated?.totalcost??0,!1):c,tooltipComponentParams:{hide:!this.canViewRates,customValueCb:t=>{let r=t?.value,s=t?.data?.currencyabbr;return`${r} ${s}`}}},this.mciGridService.getBaseNumericColumnDefinition(!0))]];this.hasRevokedException&&this.mciGridService.insertColumns(i,i.findIndex(t=>t.field==="state"),e),this.columnDefs=[...i,...this.customFields]}getCurrencyCellRenderer(e){let a=this.mathService.formatNumber(e.value);return this.mciGridService.cellWithSuffix(a,e?.data.currencyabbr)}getCurrencyCellValueGetter(e,a){let i;return!e?.data?.isnonbillable&&!e?.data?.isfixedfee&&!e?.data?.issubcontractor?i=a??0:i=0,this.mathService.roundDisplay(i,!1)}getStringRender(e){return e!==""?e:c}checkCostObject(e){e.forEach(a=>
1{a?.costobject?.purchaseorder?.id&&this.costObjects.set("purchaseorder","purchaseorder"),a?.costobject?.purchaseorderline?.id&&this.costObjects.set("purchaseorderline","purchaseorderline"),a?.costobject?.operation?.id&&this.costObjects.set("operations","operations"),a?.costobject?.suboperation?.id&&this.costObjects.set("suboperations","suboperations"),a?.costobject?.id&&this.costObjects.set("costobject","costobject")})}static{this.\u0275fac=function(a){return new(a||o)}}static{this.\u0275cmp=F({type:o,selectors:[["app-overview-acceptance-grid-material"]],inputs:{actionType:"actionType",selectedRowData:"selectedRowData",canDelete:"canDelete",canViewRates:"canViewRates",activityCodesEnabled:"activityCodesEnabled"},outputs:{close:"close"},decls:9,vars:15,consts:[[1,"mci-ui-drawer-section"],[1,"row"],[1,"col"],[1,"mci-ui-card-flat-border","remove-margin"],[3,"showCheckboxColumn","columnDefinition","gridData","isSliderGrid","showAddButton","showGridStatusButton","showHeadersAlways","showSelectedRowCount","fileName"]],template:function(a,i){a&1&&(v(0,"div",0)(1,"h6"),$(2),A(3,"mciTranslate"),T(),v(4,"div",1)(5,"div",2)(6,"div",3),C(7,"app-common-data-grid",4),A(8,"mciTranslate"),T()()()()),a&2&&(p(2),Y(R(3,11,"L.Allocation_Details")),p(5),f("fileName",N(R(8,13,"L.Material_Allocation_Details")))("showCheckboxColumn",!1)("columnDefinition",i.columnDefs)("gridData",i.gridDataView)("isSliderGrid",!0)("showAddButton",!1)("showGridStatusButton",!1)("showHeadersAlways",!0)("showSelectedRowCount",!1))},dependencies:[B,U],encapsulation:2})}}return o})();var Xe=(()=>{class o{constructor(){this.uiUtilitiesService=m(Se),this.acceptanceService=m(P),this.viewRef=m(se),this.modalService=m(ge),this.mathService=m(pe),this.mciTranslateService=m(ue),this.mciGridService=m(fe),this.commonService=m(ve),this.hasRevokedException=!1,this.canViewRates=!1,this.activityCodesEnabled=!1,this.deleteAllocation=new j,this.columnDefs=[],this.hasHours=[],this.customFields=[],this.canViewGLAccount=!1}ngOnInit(){this.getTranslations(),this.selectedRowData.state?.code===D.accepted&&(this.canDelete=!1),this.selectedRowData.classification.id===h.LABOR&&(this.selectedRowData.allocationid?(this.gridDataView=[],this.columnDefinition()):this.acceptanceService.getAcceptanceAllocationsForResource(this.selectedRowData).subscribe(e=>{this.uiUtilitiesService.handleResponse(e)&&(this.customFields=this.mciGridService.prepareDynamicCustomFieldColumnDefs(e[0]?.data,"name","name","format"),this.gridDataView=e[0]?.data,this.hasRevokedException=this.gridDataView?.some(a=>a.exceptions&&a.exceptions?.isrevoked===!0),this.gridDataView.forEach(a=>{a.attachments=this.uiUtilitiesService.formatStringWithMultipleArray(a.attachments)}),this.gridDataView.length>0&&(this.checkHours(),this.columnDefinition()))})),this.commonService.getScreenNamePermissions(y.GL_ACCOUNT_ALLOCATIONS).subscribe(e=>{this.canViewGLAccount=e?.[0]?.data?.view??!1,this.columnDefinition()})}getTranslations(){this.entity=this.mciTranslateService.getTranslation("L.Allocation").toLocaleLowerCase(),this.entityPlural=this.mciTranslateService.getTranslation("L.Allocations").toLocaleLowerCase()}checkHours(){let e;this.gridDataView.forEach(a=>{for(let i=0;i<15;i++){switch(i){case 0:e="st";break;case 1:e="ot";break;case 2:e="dt";break;default:e=`r${i+1}`;break}this.hasHours[i]||(this.hasHours[i]=a.hours[e]>0)}})}openDeleteDialog(e){this.modalService.openConfirmActionModal(e,this.entity,this.entityPlural,u.DELETE).afterClosed().subscribe(i=>{i===u.DELETE&&(this.gridDataView=[],this.deleteAllocation.emit(e))})}columnDefinition(){let e=[{field:"exceptions",headerName:this.mciTranslateService.getTranslation(O.EXCEPTION),cellRenderer:"exceptionIconCell",context:{excludeExcelExport:!1,isAutoSize:!0}}],a=[{field:"state",headerName:this.mciTranslateService.getTranslation("L.State"),cellRenderer:"globalStatesCellRenderer"},{field:"agreement.name",headerName:this.mciTranslateService.getTranslation("L.Agreement"),filter:"agTextColumnFilter"},{field:"skill.name",headerName:this.mciTranslateService.getTranslation("L.Skill"),filter:"agTextColumnFilter"}
1,{field:"costobject.ordertype.name",headerName:this.mciTranslateService.getTranslation("L.Order_Type"),filter:"agTextColumnFilter",valueGetter:t=>this.uiUtilitiesService.getOrderTypeTranslation(t?.data?.costobject?.ordertype?.name)},{field:"costobject.purchaseorder.name",headerName:this.mciTranslateService.getTranslation("L.Purchase_Order"),filter:"agTextColumnFilter"},{field:"costobject.purchaseorderline.name",headerName:this.mciTranslateService.getTranslation("L.Purchase_Order_Line"),filter:"agTextColumnFilter",cellRenderer:t=>t.value||c},{field:"costobject.labelname",headerName:this.mciTranslateService.getTranslation("L.Cost_Object_Type"),filter:"agTextColumnFilter",cellRenderer:t=>t.value||c},{field:"costobject.name",headerName:this.mciTranslateService.getTranslation("L.Cost_Object"),filter:"agTextColumnFilter",cellRenderer:t=>t.value||c},{field:"costobject.operation.name",headerName:this.mciTranslateService.getTranslation("L.Operation_Or_Activity"),filter:"agTextColumnFilter",cellRenderer:t=>t.value||c},{field:"costobject.suboperation.name",headerName:this.mciTranslateService.getTranslation("L.Sub_Operation_Or_Element"),filter:"agTextColumnFilter",cellRenderer:t=>t.value||c},{field:"area.name",headerName:this.mciTranslateService.getTranslation("L.Area_ID"),filter:"agTextColumnFilter",context:{isAutoSize:!0}},{field:"glaccount.code",headerName:this.mciTranslateService.getTranslation("L.GL_Account"),filter:"agTextColumnFilter",cellRenderer:t=>t.value||c,sortable:!0,context:{isAutoSize:!0},hide:!this.canViewGLAccount},{field:"activitycode.name",headerName:this.mciTranslateService.getTranslation("L.Activity_Code"),filter:"agTextColumnFilter",cellRenderer:t=>t.value||c,sortable:!0,context:{isAutoSize:!0},hide:!this.activityCodesEnabled}],i=[l({field:"hours.st",headerName:this.mciTranslateService.getTranslation("L.ST"),hide:!this.hasHours[0],valueGetter:t=>this.mathService.roundDisplay(t?.data?.hours?.st??0,!1),cellRenderer:t=>this.mathService.formatNumber(t?.value)},this.mciGridService.getBaseDecimalColumnDefinition()),l({field:"hours.ot",headerName:this.mciTranslateService.getTranslation("L.OT"),hide:!this.hasHours[1],valueGetter:t=>this.mathService.roundDisplay(t?.data?.hours?.ot??0,!1),cellRenderer:t=>this.mathService.formatNumber(t?.value)},this.mciGridService.getBaseDecimalColumnDefinition()),l({field:"hours.dt",headerName:this.mciTranslateService.getTranslation("L.DT"),hide:!this.hasHours[2],valueGetter:t=>this.mathService.roundDisplay(t?.data?.hours?.dt??0,!1),cellRenderer:t=>this.mathService.formatNumber(t?.value)},this.mciGridService.getBaseDecimalColumnDefinition()),l({field:"hours.r4",headerName:this.mciTranslateService.getTranslation("L.R4"),hide:!this.hasHours[3],valueGetter:t=>this.mathService.roundDisplay(t?.data?.hours?.r4??0,!1),cellRenderer:t=>this.mathService.formatNumber(t?.value)},this.mciGridService.getBaseDecimalColumnDefinition()),l({field:"hours.r5",headerName:this.mciTranslateService.getTranslation("L.R5"),hide:!this.hasHours[4],valueGetter:t=>this.mathService.roundDisplay(t?.data?.hours?.r5??0,!1),cellRenderer:t=>this.mathService.formatNumber(t?.value)},this.mciGridService.getBaseDecimalColumnDefinition()),l({field:"hours.r6",headerName:this.mciTranslateService.getTranslation("L.R6"),hide:!this.hasHours[5],valueGetter:t=>this.mathService.roundDisplay(t?.data?.hours?.r6??0,!1),cellRenderer:t=>this.mathService.formatNumber(t?.value)},this.mciGridService.getBaseDecimalColumnDefinition()),l({field:"hours.r7",headerName:this.mciTranslateService.getTranslation("L.R7"),hide:!this.hasHours[6],valueGetter:t=>this.mathService.roundDisplay(t?.data?.hours?.r7??0,!1),cellRenderer:t=>this.mathService.formatNumber(t?.value)},this.mciGridService.getBaseDecimalColumnDefinition()),l({field:"hours.r8",headerName:this.mciTranslateService.getTranslation("L.R8"),hide:!this.hasHours[7],valueGetter:t=>this.mathService.roundDisplay(t?.data?.hours?.r8??0,!1),cellRenderer:t=>this.mathService.formatNumber(t?.value)},this.mciGridService.getBaseDecimalColumnDefinition()),l({field:"hours.r9",headerName:this.mciTranslateService.getTranslation("L.R9"),hide:!this.hasHours[8],valueGetter:t=>this.mathService.roundDisplay(t?.data?.hours?.r9??0,!1),cellRenderer:t=>this.mathService.formatNumber(t?.value)},this.mciGridService.getBaseDecimalColumnDefinition()),l({field:"hours.r10",headerName:this.mciTranslateService.getTranslation("L.R10"),hide:!this.hasHours[9],valueGetter:t=>this.mathService.roundDisplay(t?.data?.hours?.r10??0,!1),cellRenderer:t=>this.mathService.formatNumber(t?.value)},this.mciGridService.getBaseDecimalColumnDefinition()),l({field:"hours.r11",headerName:this.mciTranslateService.getTranslation("L.R11"),hide:!this.hasHours[10],valueGetter:t=>this.mathService.roundDisplay(t?.data?.hours?.r11??0,!1),cellRenderer:t=>this.mathService.formatNumber(t?.value)},this.mciGridService.getBaseDecimalColumnDefinition()),l({field:"hours.r12",headerName:this.mciTranslateService.getTranslation("L.R12"),hide:!this.hasHours[11],valueGetter:t=>this.mathService.roundDisplay(t?.data?.hours?.r12??0,!1),cellRenderer:t=>this.mathService.formatNumber(t?.value)},this.mciGridService.getBaseDecimalColumnDefinition()),l({field:"hours.r13",headerName:this.mciTranslateService.getTranslation("L.R13"),hide:!this.hasHours[12],valueGetter:t=>this.mathService.roundDisplay(t?.data?.hours?.r13??0,!1),cellRenderer:t=>this.mathService.formatNumber(t?.value)},this.mciGridService.getBaseDecimalColumnDefinition()),l({field:"hours.r14",headerName:this.mciTranslateService.getTranslation("L.R14"),hide:!this.hasHours[13],valueGetter:t=>this.mathService.roundDisplay(t?.data?.hours?.r14??0,!1),cellRenderer:t=>this.mathService.formatNumber(t?.value)},this.mciGridService.getBaseDecimalColumnDefinition()),l({field:"hours.r15",headerName:this.mciTranslateService.getTranslation("L.R15"),hide:!this.hasHours[14],valueGetter:t=>this.mathService.roundDisplay(t?.data?.hours?.r15??0,!1),cellRenderer:t=>this.mathService.formatNumber(t?.value)},this.mciGridService.getBaseDecimalColumnDefinition()),l({field:"allocated.extra",headerName:this.mciTranslateService.getTranslation("L.Other_Charge"),type:"rightAligned",cellRenderer:t=>{let r=this.mathService.formatNumber(t?.value??0),s=t?.data?.currency?.code;return this.mciGridService.cellWithSuffix(r,s)},valueGetter:t=>this.mathService.roundDisplay(t?.data?.allocated?.extra??0,!1)},this.mciGridService.getBaseDecimalColumnDefinition()),{field:"isnonbillable",headerName:this.mciTranslateService.getTranslation("L.Non_Billable"),cellRenderer:"gridSwitch",headerClass:"ag-center-aligned-header",cellClass:"ag-center-aligned-cell",cellRendererParams:{canActivate:!0,canDeactivate:!0},context:{isMenuEvent:!1,isAutoSize:!0},resizable:!1},{field:"isfixedfee",headerName:this.mciTranslateService.getTranslation("L.Lump_Sum"),cellRenderer:"gridSwitch",headerClass:"ag-center-aligned-header",cellClass:"ag-center-aligned-cell",cellRendererParams:{canActivate:!0,canDeactivate:!0},context:{isMenuEvent:!1,isAutoSize:!0},resizable:!1},{field:"issubcontractor",headerName:this.mciTranslateService.getTranslation("L.Sub_Contractor"),cellRenderer:"gridSwitch",headerClass:"ag-center-aligned-header",cellClass:"ag-center-aligned-cell",cellRendererParams:{canActivate:!0,canDeactivate:!0},context:{isMenuEvent:!1,isAutoSize:!0},resizable:!1},{field:"comment",cellRenderer:"commentCell",headerName:this.mciTranslateService.getTranslation(O.COMMENT)},{field:"attachment",headerName:this.mciTranslateService.getTranslation("L.Attachment"),headerClass:"ag-center-aligned-header",cellClass:"ag-center-aligned-cell",cellRenderer:"materialGridIcon",cellRendererParams:{icon:"attach_file",isDisplayValue:!0,propertyName:"attachmentdata",displayValueCb:t=>t?.data?.attachments?.length??0,clickEvent:t=>{if(t.attachments){let r={id:t.resource.id,attachmentData:t?.attachments};this.modalService.openAttachmentModal(this.viewRef,r,this.mciTranslateService.getTranslation("L.Labor_Allocation"),this.actionType,this.permissions,!0)}}},context:{isAutoSize:!0},resizable:!1},{field:"timesheetreference",headerName:this.mciTranslateService.getTranslation("L.Timesheet_Ref"),filter:"agTextColumnFilter",type:"rightAligned",cellRenderer:t=>t.value||c},{field:"revoketimesheetref",headerName:this.mciTranslateService.getTranslation("L.Revoked_Timesheet_Num"),filter:"agTextColumnFilter",type:"rightAligned",cellRenderer:t=>t.value||c}];this.columnDefs=[...this.hasRevokedException?e:[],...a,...this.customFields,...i]}static{this.\u0275fac=function(a){return new(a||o)}}static{this.\u0275cmp=F({type:o,selectors:[["app-overview-acceptance-grid-labor"]],inputs:{actionType:"actionType",selectedRowData:"selectedRowData",canDelete:"
1canDelete",canViewRates:"canViewRates",activityCodesEnabled:"activityCodesEnabled"},outputs:{deleteAllocation:"deleteAllocation"},decls:10,vars:19,consts:[[3,"disableRates","organizationId","resourceId","workDate"],[1,"mci-ui-drawer-section"],[1,"row"],[1,"col"],[1,"mci-ui-card-flat-border","remove-margin"],[3,"showCheckboxColumn","columnDefinition","gridData","isSliderGrid","showAddButton","showGridStatusButton","showHeadersAlways","showSelectedRowCount","fileName"]],template:function(a,i){a&1&&(C(0,"app-labor-pay-details",0),v(1,"div",1)(2,"h6"),$(3),A(4,"mciTranslate"),T(),v(5,"div",2)(6,"div",3)(7,"div",4),C(8,"app-common-data-grid",5),A(9,"mciTranslate"),T()()()()),a&2&&(f("disableRates",!i.canViewRates)("organizationId",i.selectedRowData==null||i.selectedRowData.vendor==null?null:i.selectedRowData.vendor.id)("resourceId",i.selectedRowData==null?null:i.selectedRowData.id)("workDate",i.selectedRowData==null?null:i.selectedRowData.workdate),p(3),Y(R(4,15,"L.Allocation_Details")),p(5),f("fileName",N(R(9,17,"L.Labor_Allocation_Details")))("showCheckboxColumn",!1)("columnDefinition",i.columnDefs)("gridData",i.gridDataView)("isSliderGrid",!0)("showAddButton",!1)("showGridStatusButton",!1)("showHeadersAlways",!0)("showSelectedRowCount",!1))},dependencies:[je,B,U],encapsulation:2})}}return o})();var et=(()=>{class o extends Te{constructor(){super(...arguments),this.allocationService=m(K),this.acceptanceService=m(P),this.equipmentAllocationService=m(Ye),this.canViewRates=!1,this.activityCodesEnabled=!1,this.close=new j,this.hasHours=[],this.customFields=[],this.payDetailsData={},this.hasRevokedException=!1,this.canViewGLAccount=!1}ngOnInit(){this.selectedRowData?.state?.name===D.accepted&&(this.canDelete=!1),this.commonService.getScreenNamePermissions(y.GL_ACCOUNT_ALLOCATIONS).subscribe(e=>{this.canViewGLAccount=e?.[0]?.data?.view??!1,this.columnDefinition()}),this.noRatesViewPermission=this.mciTranslateService.getTranslation("M.No_Permission_Rates"),this.initializeForm(),this.getTranslations(),this.acceptanceService.getAcceptanceAllocationsForResource(this.selectedRowData).subscribe(e=>{if(this.uiUtilitiesService.handleResponse(e)){this.rowData=e[0]?.data[0],this.payDetailsData={agreement:this.rowData?.agreement,type:this.rowData?.type,group:this.rowData?.group,nethours:this.rowData?.nethours,base:this.rowData?.allocations.reduce((t,r)=>t+r.basehours,0),over:this.rowData?.allocations.reduce((t,r)=>t+r.overhours,0),idle:this.rowData?.allocations.reduce((t,r)=>t+r.idlehours,0),weeklystartdate:this.rowData?.weeklystartdate,weeklycumulativehours:this.rowData?.weeklycumulativehours,monthlystartdate:this.rowData?.monthlystartdate,monthlycumulativebase:this.rowData?.monthlycumulativebase,otherchargestotal:this.rowData?.allocations.reduce((t,r)=>t+r.extracharges,0),currencyabbr:this.selectedRowData?.currencyabbr,preapproval:this.rowData?.preapproval},this.rowData?.allocations?.forEach(t=>{t.consolidatedattachments=this.uiUtilitiesService.formatStringWithMultipleArray(t.consolidatedattachments),t.totalFiles=t?.consolidatedattachments?.length??0});let a=this.getRequestPayload(this.rowData),i=0;this.equipmentAllocationService.getAllocatedEquipments(a).subscribe({next:t=>{if(t&&t[0].data){let r=t[0].data.filter(s=>s.resource?.name===this.rowData?.name);r.forEach(s=>{s.consolidatedattachments=this.rowData.allocations[i].consolidatedattachments,s.totalFiles=this.rowData.allocations[i].consolidatedattachments?.length??0,s.attachmentmetadata=this.rowData.allocations[i].attachmentmetadata,s.attachmentscount=this.rowData.allocations[i].attachmentscount}),this.gridDataView=r,this.hasRevokedException=this.gridDataView?.some(s=>s.exceptions&&s.exceptions?.isrevoked===!0),this.customFields=this.mciGridService.prepareDynamicCustomFieldColumnDefs(this.gridDataView,"name","name","format"),this.initializeForm(),this.columnDefinition()}}})}})}getRequestPayload(e){return e?{statecodes:[],organizationids:e?.organization?.id!==null?[e?.organization?.id]:[],agreementids:e?.agreement?.id!=null?[e?.agreement?.id]:[],groupids:e?.group?.id!==null?[e?.group?.id]:[],typeids:e?.type?.id!==null?[e?.type?.id]:[],uniqueids:[],startdate:e.workdate,enddate:e.workdate}:{}}getTranslations(){this.entity=this.mciTranslateService.getTranslation("L.Allocation").toLocaleLowerCase(),this.entityPlural=this.mciTranslateService.getTranslation("L.Allocations").toLocaleLowerCase(),this.hrsAbbr=this.mciTranslateService.getTranslation("L.Hours_Abbr")}
1openDeleteDialog(e){let a=this.modalService.openConfirmActionModal(e,this.entity,this.entityPlural,u.DELETE,W.ASYNC_CONFIRM),i=this.mciTranslateService.getTranslation("L.Resource_Allocation");a.componentInstance.confirmAction$.pipe(this.takeUntilDestroyed(this.destroyRef)).subscribe(t=>{t===u.DELETE&&this.allocationService.deleteequipmentAllocation(e.allocationid,e.classification).subscribe(r=>{a.close(),r[0].success?this.notificationBarService.showNotificationMessage(this.mciTranslateService.getTranslation("M.Entity_Deleted",{entity:i}),""):this.notificationBarService.showNotificationMessage(this.mciTranslateService.getTranslation("M.Entity_Could_Not_Be_Deleted",{entity:i}))})})}initializeForm(){this.form=this.formBuilder.group({onsite:new _(this.rowData?.onsitehours?`${this.rowData?.onsitehours} ${this.hrsAbbr}`:"",L.required),organization:new _(this.rowData?.organization?.name??"",L.required),agreement:new _(this.rowData?.agreement?.name??"",L.required),group:new _(this.rowData?.group?.name??"",L.required),type:new _(this.rowData?.type?.name??"",L.required)})}onSave(){}columnDefinition(){let e=[{field:"exceptions",headerName:this.mciTranslateService.getTranslation(O.EXCEPTION),cellRenderer:"exceptionIconCell",context:{excludeExcelExport:!1,isAutoSize:!0}}],i=[...[{field:"workdate",headerName:this.mciTranslateService.getTranslation("L.Timesheet_Date"),type:"rightAligned",valueGetter:()=>this.dateTimeService.toLocalizedDateFormat(this.selectedRowData.workdate),filter:"agDateColumnFilter",filterParams:{comparator:this.dateTimeService.localizedDateFilterComparator},comparator:this.dateTimeService.localizedDateComparator,context:{isAutoSize:!0}},{field:"timesheetreference",headerName:this.mciTranslateService.getTranslation("L.Timesheet_Ref"),filter:"agTextColumnFilter"},{field:"revoketimesheetref",headerName:this.mciTranslateService.getTranslation("L.Revoked_Timesheet_Num"),type:"rightAligned",cellRenderer:t=>t?.data?.revoketimesheetref,filterParams:{valueGetter:t=>t.data?.revoketimesheetref},context:{displayFieldName:""}},{field:"allocationstate",headerName:this.mciTranslateService.getTranslation("L.State"),cellRenderer:"globalStatesCellRenderer",cellRendererParams:t=>({stateCode:t.data?.allocationstate?.code}),filterValueGetter:t=>t.data.allocationstate.name},{field:"agreement.name",headerName:this.mciTranslateService.getTranslation("L.Agreement"),filter:"agTextColumnFilter"},{field:"area.name",headerName:this.mciTranslateService.getTranslation("L.Area_ID"),filter:"agTextColumnFilter",context:{isAutoSize:!0}},{field:"glaccount.name",headerName:this.mciTranslateService.getTranslation("L.GL_Account"),filter:"agTextColumnFilter",cellRenderer:t=>t.value||c,sortable:!0,context:{isAutoSize:!0},hide:!this.canViewGLAccount},{field:"activitycode.name",headerName:this.mciTranslateService.getTranslation("L.Activity_Code"),filter:"agTextColumnFilter",cellRenderer:t=>t.value||c,sortable:!0,context:{isAutoSize:!0},hide:!this.activityCodesEnabled},{headerName:this.mciTranslateService.getTranslation("L.Order_Type"),field:"costobject.ordertype.name",filter:"agTextColumnFilter",valueGetter:t=>this.uiUtilitiesService.getOrderTypeTranslation(t?.data?.costobject?.ordertype?.name)},{headerName:this.mciTranslateService.getTranslation("L.Purchase_Order"),field:"costobject.purchaseorder.name",filter:"agTextColumnFilter"},{headerName:this.mciTranslateService.getTranslation("L.PO_Line"),field:"costobject.purchaseorderline.name",filter:"agTextColumnFilter"},{headerName:this.mciTranslateService.getTranslation("L.Cost_Object_Type"),field:"costobject.type",filter:"agTextColumnFilter"},{headerName:this.mciTranslateService.getTranslation("L.Cost_Object"),field:"costobject.name",filter:"agTextColumnFilter"},{headerName:this.mciTranslateService.getTranslation("L.Operations_Or_Activity"),field:"costobject.operation.name",filter:"agTextColumnFilter"},{headerName:this.mciTranslateService.getTranslation("L.SubOperations_Or_Element"),field:"costobject.suboperation.name",filter:"agTextColumnFilter"},...this.customFields,l({headerName:this.mciTranslateService.getTranslation("L.Base_Hours"),field:"allocated.hours.hourly",valueGetter:t=>this.mathService.roundDisplay(t?.data?.allocated?.hours?.hourly??0,!1),cellRenderer:t=>{let r=this.mathService.formatNumber(t?.value);return this.mciGridService.cellWithSuffix(r,this.hrsAbbr)}},this.mciGridService.getBaseDecimalColumnDefinition()),l(l({headerName:this.mciTranslateService.getTranslation("L.Base_Rate"),field:"rate.hourly",valueGetter:t=>this.canViewRates?this.mathService.roundDisplay(t?.data?.rate?.hourly??0,!1):c,cellRenderer:"materialToolTip",cellRendererParams:t=>{let r={simpleTooltip:!0};return r.value=this.mathService.formatNumber(t.value),this.canViewRates?r.suffix=this.getCurrencySuffix(t):r.tooltip=this.noRatesViewPermission,r},tooltipComponentParams:{hide:!this.canViewRates,customValueCb:t=>{let r=t?.value,s=this.getCurrencySuffix(t);return`${r} ${s}`}}},this.mciGridService.getBaseNumericColumnDefinition(!0)),this.mciGridService.getDecimalColumnFilterParams()),l({headerName:this.mciTranslateService.getTranslation("L.Over_Hours"),field:"allocated.hours.overrate",valueGetter:t=>this.mathService.roundDisplay(t?.data?.allocated?.hours?.overrate??0,!1),cellRenderer:t=>{let r=this.mathService.formatNumber(t?.value);return this.mciGridService.cellWithSuffix(r,this.hrsAbbr)}},this.mciGridService.getBaseDecimalColumnDefinition()),l(l({headerName:this.mciTranslateService.getTranslation("L.Over_Rate"),field:"rate.overrate",valueGetter:t=>this.canViewRates?this.mathService.roundDisplay(t?.data?.rate?.overrate??0,!1):c,cellRenderer:"materialToolTip",cellRendererParams:t=>{let r={simpleTooltip:!0};return r.value=this.mathService.formatNumber(t.value),this.canViewRates?r.suffix=this.getCurrencySuffix(t):r.tooltip=this.noRatesViewPermission,r},tooltipComponentParams:{hide:!this.canViewRates,customValueCb:t=>{let r=t?.value,s=this.getCurrencySuffix(t);return`${r} ${s}`}}},this.mciGridService.getBaseNumericColumnDefinition(!0)),this.mciGridService.getDecimalColumnFilterParams()),l({headerName:this.mciTranslateService.getTranslation("L.Idle_Hours"),field:"allocated.hours.idle",valueGetter:t=>this.mathService.roundDisplay(t?.data?.allocated?.hours?.idle??0,!1),cellRenderer:t=>{let r=this.mathService.formatNumber(t?.value);return this.mciGridService.cellWithSuffix(r,this.hrsAbbr)}},this.mciGridService.getBaseDecimalColumnDefinition()),l(l({headerName:this.mciTranslateService.getTranslation("L.Idle_Rate"),field:"rate.idle",valueGetter:t=>this.canViewRates?this.mathService.roundDisplay(t?.data?.rate?.idle??0,!1):c,cellRenderer:"materialToolTip",cellRendererParams:t=>{let r={simpleTooltip:!0};return r.value=this.mathService.formatNumber(t.value),this.canViewRates?r.suffix=this.getCurrencySuffix(t):r.tooltip=this.noRatesViewPermission,r},tooltipComponentParams:{hide:!this.canViewRates,customValueCb:t=>{let r=t?.value,s=this.getCurrencySuffix(t);return`${r} ${s}`}}},this.mciGridService.getBaseNumericColumnDefinition(!0)),this.mciGridService.getDecimalColumnFilterParams()),l({field:"allocated.othercharges",headerName:this.mciTranslateService.getTranslation("L.Other_Charge"),cellRenderer:t=>{let r=this.mathService.formatNumber(t?.value),s=t?.data?.currency?.code;return this.mciGridService.cellWithSuffix(r,s)},valueGetter:t=>this.mathService.roundDisplay(t?.data?.allocated?.othercharges??0,!1)},this.mciGridService.getBaseDecimalColumnDefinition()),{field:"isnonbillable",headerName:this.mciTranslateService.getTranslation("L.Non_Billable"),cellRenderer:"gridSwitch",headerClass:"ag-center-aligned-header",cellClass:"ag-center-aligned-cell",cellRendererParams:{canActivate:!0,canDeactivate:!0},context:{isMenuEvent:!1,isAutoSize:!0},resizable:!1},{field:"islumpsum",headerName:this.mciTranslateService.getTranslation("L.Lump_Sum"),cellRenderer:"gridSwitch",headerClass:"ag-center-aligned-header",cellClass:"ag-center-aligned-cell",cellRendererParams:{canActivate:!0,canDeactivate:!0},context:{isMenuEvent:!1,isAutoSize:!0},resizable:!1},{field:"issubcontractor",headerName:this.mciTranslateService.getTranslation("L.Sub_Contractor"),cellRenderer:"gridSwitch",headerClass:"ag-center-aligned-header",cellClass:"ag-center-aligned-cell",cellRendererParams:{canActivate:!0,canDeactivate:!0},context:{isMenuEvent:!1,isAutoSize:!0},resizable:!1},{field:"comment",cellRenderer:"commentCell",headerName:this.mciTranslateService.getTranslation(O.COMMENT)},l({headerName:this.mciTranslateService.getTranslation("L.Total"),field:"activity.totalHours",filter:"agTextColumnFilter",cellRenderer:t=>{let r=this.mathService.formatNumber(t.value);return this.mciGridService.cellWithSuffix(r,this.hrsAbbr)},valueGetter:t=>{let r=(t?.data?.allocated?.hours?.hourly??0)+(t?.data?.allocated?.hours?.idle??0)+(t?.data?.allocated?.hours?.overrate??0);return this.mathService.roundDisplay(r,!1)}},this.mciGridService.getBaseDecimalColumnDefinition()),{headerName:this.mciTranslateService.getTranslation("L.Attachment"),cellRenderer:"materialGridIcon",headerClass:"ag-center-aligned-header",cellClass:"ag-center-aligned-cell",field:"attachmentscount",filter:"agNumberColumnFilter",editable:!1,
1cellRendererParams:{icon:"attach_file",isDisplayValue:!0,propertyName:"attachmentscount",displayValueCb:t=>t?.data?.totalFiles,clickEvent:t=>{if(t?.consolidatedattachments?.length){let r={id:t?.resource?.id,attachmentData:t?.consolidatedattachments};this.modalService.openAttachmentModal(this.viewRef,r,this.mciTranslateService.getTranslation("L.Equipment_Allocation"),this.actionType,this.permissions,!1)}}},comparator:this.compareService.consolidatedAttachmentComparator,context:{isAutoSize:!0},resizable:!1}]];this.hasRevokedException&&this.mciGridService.insertColumns(i,i.findIndex(t=>t.field==="allocationstate"),e),this.columnDefs=[...i,...this.customFields]}getCurrencyCellRenderer(e){let a=this.mathService.formatNumber(e?.value),i=e?.data?.currency;return this.mciGridService.cellWithSuffix(a,i)}getCurrencySuffix(e){let a=e.data?.currency?.code,t=this.uiUtilitiesService.site$.value.currency?.abbr??"";return a||t}getStringRender(e){return e!==""?e:c}static{this.\u0275fac=(()=>{let e;return function(i){return(e||(e=re(o)))(i||o)}})()}static{this.\u0275cmp=F({type:o,selectors:[["app-overview-acceptance-grid-equipment"]],inputs:{actionType:"actionType",selectedRowData:"selectedRowData",canDelete:"canDelete",canViewRates:"canViewRates",activityCodesEnabled:"activityCodesEnabled"},outputs:{close:"close"},features:[q],decls:11,vars:17,consts:[["autocomplete","off","id","equipmentacceptanceForm",3,"formGroup"],[3,"payDetailsData"],[1,"mci-ui-drawer-section"],[1,"row"],[1,"col"],[1,"mci-ui-card-flat-border","remove-margin"],[3,"showCheckboxColumn","columnDefinition","gridData","isSliderGrid","showAddButton","showGridStatusButton","showHeadersAlways","showSelectedRowCount","fileName"]],template:function(a,i){a&1&&(v(0,"form",0),C(1,"equipment-pay-details",1),v(2,"div",2)(3,"h6"),$(4),A(5,"mciTranslate"),T(),v(6,"div",3)(7,"div",4)(8,"div",5),C(9,"app-common-data-grid",6),A(10,"mciTranslate"),T()()()()()),a&2&&(f("formGroup",i.form),p(),f("payDetailsData",i.payDetailsData),p(3),Y(R(5,13,"L.Allocation_Details")),p(5),f("fileName",N(R(10,15,"L.Equipment_Allocation_Details")))("showCheckboxColumn",!1)("columnDefinition",i.columnDefs)("gridData",i.gridDataView)("isSliderGrid",!0)("showAddButton",!1)("showGridStatusButton",!1)("showHeadersAlways",!0)("showSelectedRowCount",!1))},dependencies:[ce,ne,oe,le,We,B,U],encapsulation:2})}}return o})();function ot(o,H){if(o&1&&(C(0,"drawer-header-dynamic-content",1),A(1,"localizedDate")),o&2){let e=b();f("subTitle2",_e("",e.subTitle?"| ":"","",R(1,4,e.subTitle)))("globalStateCode",e.rowData==null||e.rowData.state==null?null:e.rowData.state.code)}}function nt(o,H){if(o&1&&(C(0,"mci-form-control",8),A(1,"mciTranslate")),o&2){let e=b(3);f("labelName",N(R(1,5,"L.Pre_Approval_#")))("actionType",e.ACTIONS.VIEW)("form",e.form)("typeOfControl",e.CONTROL_TYPE.TEXT_INPUT)}}function lt(o,H){if(o&1&&(v(0,"div",5)(1,"div",6),C(2,"mci-form-control",7),A(3,"mciTranslate"),T(),v(4,"div",6),G(5,nt,2,7,"mci-form-control",8),T()(),v(6,"div",9)(7,"div",10),C(8,"app-lumpsum-project-details",11,0),T()()),o&2){let e=b(2);p(2),f("labelName",N(R(3,12,"L.Scope")))("actionType",e.actionType)("form",e.form)("maxlength",50)("required",!0)("typeOfControl",e.CONTROL_TYPE.TEXT_INPUT),p(3),M(!(e.rowData==null||e.rowData.preapproval==null)&&e.rowData.preapproval.reference?5:-1),p(3),f("fullScreenDrawer",!1)("showHeaderTitle",!0)("projectId",e.rowData==null?null:e.rowData.projectid)("showAcceptanceRates",e.acceptancePermissions.ratesViewPermission)}}function ct(o,H){if(o&1){let e=X();v(0,"form",2),G(1,lt,10,14),v(2,"div",3)(3,"app-lumpsum-allocations",4),k("deleteAllocation",function(i){J(e);let t=b();return Q(t.deleteAllocation(i))}),T()()()}if(o&2){let e=b();f("formGroup",e.form),p(),M(e.showProjectDetails?1:-1),p(2),f("actionType",e.actionType)("canDelete",e.permissions==null?null:e.permissions.canDelete)("showAcceptanceRates",e.acceptancePermissions.ratesViewPermission)("selectedRowData",e.rowData)("gridOnly",!1)}}function dt(o,H){if(o&1){let e=X();v(0,"form",2)(1,"div",9)(2,"div",6),C(3,"mci-form-control",12),A(4,"mciTranslate"),T(),v(5,"div",6),C(6,"mci-form-control",13),A(7,"mciTranslate"),T()(),v(8,"div",9)(9,"div",6),C(10,"mci-form-control",14),A(11,"mciTranslate"),T()(),v(12,"div",3),C(13,"material-pay-detail
1s",15),T(),v(14,"div",9)(15,"div",6)(16,"app-overview-acceptance-grid-material",16),k("deleteAllocation",function(i){J(e);let t=b();return Q(t.deleteAllocation(i))}),T()()()()}if(o&2){let e=b();f("formGroup",e.form),p(3),f("labelName",N(R(4,32,"L.Resource_Name")))("actionType",e.actionType)("form",e.form)("maxlength",50)("required",!0)("typeOfControl",e.CONTROL_TYPE.TEXT_INPUT),p(3),f("labelName",N(R(7,34,"L.Organization")))("actionType",e.actionType)("form",e.form)("maxlength",50)("required",!0)("typeOfControl",e.CONTROL_TYPE.TEXT_INPUT),p(4),f("labelName",N(R(11,36,"L.Timesheet_Date")))("actionType",e.actionType)("form",e.form)("maxlength",50)("required",!0)("typeOfControl",e.CONTROL_TYPE.DATE),p(3),f("description",e.rowData==null?null:e.rowData.description)("organizationId",e.rowData==null||e.rowData.vendor==null?null:e.rowData.vendor.id)("resourceId",e.rowData==null?null:e.rowData.id)("showAcceptanceRates",e.acceptancePermissions.ratesViewPermission)("workDate",e.rowData==null?null:e.rowData.workdate),p(3),f("actionType",e.actionType)("canViewRates",e.acceptancePermissions.ratesViewPermission)("canDelete",e.permissions==null?null:e.permissions.canDelete)("selectedRowData",e.rowData)("activityCodesEnabled",e.acceptancePermissions.activityCodesEnabled)}}function mt(o,H){if(o&1){let e=X();v(0,"div")(1,"app-overview-acceptance-grid-labor",16),k("deleteAllocation",function(i){J(e);let t=b();return Q(t.deleteAllocation(i))}),T()()}if(o&2){let e=b();p(),f("actionType",e.actionType)("canViewRates",e.acceptancePermissions.ratesViewPermission)("canDelete",e.permissions==null?null:e.permissions.canDelete)("selectedRowData",e.rowData)("activityCodesEnabled",e.acceptancePermissions.activityCodesEnabled)}}function ht(o,H){if(o&1){let e=X();v(0,"div")(1,"app-overview-acceptance-grid-equipment",16),k("deleteAllocation",function(i){J(e);let t=b();return Q(t.deleteAllocation(i))}),T()()}if(o&2){let e=b();p(),f("actionType",e.actionType)("canViewRates",e.acceptancePermissions.ratesViewPermission)("canDelete",e.permissions==null?null:e.permissions.canDelete)("selectedRowData",e.rowData)("activityCodesEnabled",e.acceptancePermissions.activityCodesEnabled)}}var tt=(()=>{class o extends Te{constructor(){super(...arguments),this.acceptanceService=m(P),this.modal=m(Ee),this.allocationService=m(K),this.isLabor=!1,this.isMaterial=!1,this.isEquipment=!1,this.isLumpSum=!1,this.showProjectDetails=!1,this.acceptancePermissions={},this.subTitle=""}ngOnInit(){this.drawerService.formConfig$.pipe(this.takeUntilDestroyed(this.destroyRef)).subscribe(e=>{if(e!=null){let{rowData:a,actionType:i,permissions:t,extraData:r}=e;this.rowData=a,this.actionType=i,this.permissions=t,this.acceptancePermissions=r,this.subTitle=this.rowData?.workdate??"";let s=[{action:u.CLOSE,style:this.rowData?.state?.code===d.ACCEPTED||this.rowData?.state?.code===d.AUTHORIZED||this.rowData?.state?.code===d.PARTIALLY_AUTHORIZED?V.PRIMARY:V.SECONDARY,position:z.RIGHT,visible:this.actionType===u.VIEW},{action:u.ACCEPT,style:V.PRIMARY,position:z.RIGHT,useFormDirtyForDisabled:!0,visible:this.permissions?.canAssign&&(this.rowData?.state?.code===d.ALLOCATED&&this.rowData?.classification.id===h.LABOR&&this.acceptancePermissions?.laborAcceptPermission||this.rowData?.state?.code===d.ALLOCATED&&this.rowData?.classification.id===h.EQUIPMENT&&this.acceptancePermissions?.equipmentAcceptPermission||this.rowData?.state?.code===d.ALLOCATED&&this.rowData?.classification.id===h.MATERIAL&&this.acceptancePermissions?.materialAcceptPermission||this.rowData?.state?.code===d.ALLOCATED&&this.rowData?.classification.id===h.LUMP_SUM&&this.acceptancePermissions?.lumpSumAcceptPermission||this.rowData?.state?.code===d.AUTHORIZED_UNACCEPTED)},{action:u.UNACCEPT,style:V.GHOST_DESTRUCTIVE,position:z.LEFT,visible:this.permissions?.canUnassign&&(this.rowData?.state?.code===d.ACCEPTED||this.rowData?.state?.code===d.AUTHORIZED||this.rowData?.state?.code===d.PARTIALLY_AUTHORIZED)}];this.updateFooterButton(s),this.getTranslations(),this.drawerService.drawer$.value.form?this.form=this.drawerService.drawer$.value.form:this.initializeForm()}}),this.drawerService.drawerFooterAction$.pipe(this.takeUntilDestroyed(this.destroyRef)).subscribe(e=>{if(e!=null)switch(e){case this.ACTIONS.CLOSE:this.onFormClose(!1,!1,!1,W.ASYNC_CONFIRM);break;case this.ACTIONS.ACCEPT:case this.ACTIONS.UNACCEPT:case this.ACTIONS.SAVE:this.onSave();break}}),this.rowData?.state.code===d.ALLOCATED||this.rowData?.state.code===d.AUTHORIZED_UNACCEPTED?this.stateType=D.accepted:(this.rowData?.state.code===d.ACCEPTED||this.rowData?.state.code===d.AUTHORIZED||this.rowData?.state.code===d.PARTIALLY_AUTHORIZED)&&(this.stateType=D.unaccepted)}initializeForm(){switch(this.form=this.formBuilder.group({resourcename:new _(this.rowData?.name??"",L.required),organizationname:new _(this.rowData?.vendor.name??"",L.required),classificationname:new _(this.rowData?.classification.name??"",L.required),costname:new _(this.rowData?.description??"",L.required),scope:new _(this.rowData?.scope??"",L.required),timesheetdate:new _(this.datePipe.transform(this.rowData?.workdate,Ne.DATE)??"",L.required),approvalrequestreference:new _(this.rowData?.approvalrequestreference??"",L.required)}),this.showProjectDetails=!1,this.rowData?.classification.id){case h.LABOR:this.isLabor=!0;break;case h.MATERIAL:this.isMaterial=!0;break;case h.EQUIPMENT:this.isEquipment=!0;break;case h.LUMP_SUM:this.isLumpSum=!0,this.showProjectDetails=this.rowData?.projectid!==null;break}}getTranslations(){this.entity=this.mciTranslateService.getTranslation("L.Allocate_Job_Hour"),this.entityPlural=this.mciTranslateService.getTranslation("L.Allocate_Job_Hour_plural")}deleteAllocation(e){this.form.markAsDirty(),this.allocationToDelete=e.allocationid;let a=[{action:u.CLOSE,style:V.SECONDARY,position:z.RIGHT,visible:this.actionType===u.VIEW},{action:u.SAVE,style:V.PRIMARY,position:z.RIGHT,visible:this.permissions?.canAssign&&(this.rowData?.state?.code===d.ALLOCATED||this.rowData?.state?.code===d.REJECTED_AND_UNACCEPTED)},{action:u.UNACCEPT,style:V.GHOST_DESTRUCTIVE,position:z.LEFT,visible:this.permissions.canUnassign&&(this.rowData?.state?.code===d.ACCEPTED||this.rowData?.state?.code===d.REVIEWED_AND_REJECTED||this.rowData?.state?.code===d.REJECTED)}];this.updateFooterButton(a)}onSave(){if(this.allocationToDelete)this.entity=this.mciTranslateService.getTranslation("L.Resource"),this.allocationService.deleteequipmentAllocation(this.allocationToDelete,this.rowData?.classification).subscribe({next:e=>{this.closeDiscardDialog(),e[0].success?(this.form.markAsPristine(),this.notificationBarService.showNotificationMessage(this.mciTranslateService.getTranslation("M.Entity_Deleted",{entity:this.entity}),""),this.drawerService.requestToReloadTableAfterDrawerAction(!0),this.onFormClose()):(this.onFormHasErrors(),this.notificationBarService.showNotificationMessage(this.mciTranslateService.getTranslation("M.Entity_Could_Not_Be_Deleted",{entity:this.entity})))},error:()=>{this.closeDiscardDialog(),this.onFormHasErrors()}});else{let e=[];e.push({id:this.rowData?.id,state:this.stateType,code:this.rowData?.state.code,workdate:this.rowData?.workdate,vendor:this.rowData.vendor,site:this.rowData.site,classification:this.rowData?.classification?.id,description:this.rowData?.description??"",group:this.rowData?.group??null,agreement:this.rowData?.agreement??null,allocationids:this.rowData?.allocationids}),this.acceptanceService.updateAllocationState(e).subscribe({next:a=>{if(this.closeDiscardDialog(),a?.[0]?.errors?.[0]?.message===Z&&!a?.[0]?.data?.length){this.notificationBarService.showNotificationMessage(this.mciTranslateService.getTranslation(Z),""),this.onFormHasErrors();return}a[0]?.success&&a[0]?.data.length?a[0].data.forEach(i=>
1{i.issuccess===!0?this.notificationBarService.showNotificationMessage(this.stateType===D.accepted?this.mciTranslateService.getTranslation("M.Activity_Accepted"):this.mciTranslateService.getTranslation("M.Activity_Unaccepted")):this.notificationBarService.showNotificationMessage(`1 ${this.mciTranslateService.getTranslation("L.Unchanged")}.`),this.drawerService.requestToReloadTableAfterDrawerAction(!0),this.onFormClose()}):(this.notificationBarService.showNotificationMessage(this.mciTranslateService.getTranslation("M.Entity_Could_Not_Be_Updated",{entity:this.mciTranslateService.getTranslation("L.State")}),""),this.onFormHasErrors()),this.showGridUnacceptButton=!1,this.showGridAcceptButton=!1},error:()=>{this.closeDiscardDialog(),this.onFormHasErrors()}})}}updateFooterButton(e){this.uiUtilitiesService.updateDrawerFooterButtons(e,this.form)}static{this.\u0275fac=(()=>{let e;return function(i){return(e||(e=re(o)))(i||o)}})()}static{this.\u0275cmp=F({type:o,selectors:[["app-overview-acceptance-form"]],features:[q],decls:5,vars:5,consts:[["lumpsumProjectDetailsRef",""],[3,"globalStateCode","subTitle2"],["autocomplete","off","id","acceptanceForm",3,"formGroup"],[1,"mci-ui-drawer-section"],[3,"deleteAllocation","actionType","canDelete","showAcceptanceRates","selectedRowData","gridOnly"],[1,"row","mci-ui-drawer-vertical-bottom-margin"],[1,"col"],["fieldFormControlName","scope",3,"actionType","form","maxlength","required","typeOfControl","labelName"],["fieldFormControlName","approvalrequestreference",3,"actionType","form","typeOfControl","labelName"],[1,"row"],[1,"col","remove-bottom-margin"],[3,"fullScreenDrawer","showHeaderTitle","projectId","showAcceptanceRates"],["fieldFormControlName","resourcename",3,"actionType","form","maxlength","required","typeOfControl","labelName"],["fieldFormControlName","organizationname",3,"actionType","form","maxlength","required","typeOfControl","labelName"],["fieldFormControlName","timesheetdate",3,"actionType","form","maxlength","required","typeOfControl","labelName"],[3,"description","organizationId","resourceId","showAcceptanceRates","workDate"],[3,"deleteAllocation","actionType","canViewRates","canDelete","selectedRowData","activityCodesEnabled"]],template:function(a,i){a&1&&(G(0,ot,2,6,"drawer-header-dynamic-content",1),G(1,ct,4,7,"form",2),G(2,dt,17,38,"form",2),G(3,mt,2,5,"div"),G(4,ht,2,5,"div")),a&2&&(M(!(i.rowData==null||i.rowData.state==null)&&i.rowData.state.code?0:-1),p(),M(i.isLumpSum?1:-1),p(),M(i.isMaterial?2:-1),p(),M(i.isLabor?3:-1),p(),M(i.isEquipment?4:-1))},dependencies:[qe,ce,ne,oe,le,ze,Ze,Je,Ke,Qe,Xe,et,U,ke],encapsulation:2})}}return o})();var it=at(rt());var aa=(()=>{class o extends He{constructor(){super(),this.acceptanceService=m(P),this.personalInformationService=m(Pe),this.filterPersistenceService=m(Be),this.pageSize=10,this.showAddButton=!1,this.updatedCount=0,this.unchangedCount=0,this.canViewRates=!1,this.defaultSelect=!0,this.selectChangeSkipCount=0,this.yesterdayTranslation=this.mciTranslateService.getTranslation("L.Yesterday"),this.classificationList=[{name:ee.LABOR,id:1,displayName:this.mciTranslateService.getTranslation("L.Labor")},{name:ee.MATERIAL,id:2,displayName:this.mciTranslateService.getTranslation("L.Material")},{name:ee.EQUIPMENT,id:3,displayName:this.mciTranslateService.getTranslation("L.Equipment")},{name:ee.LUMP_SUM,id:4,displayName:this.mciTranslateService.getTranslation("L.Lump_Sum")}],this.gridHeight=Ie,this.defaultDateRange={id:x.Yesterday,name:this.yesterdayTranslation},this._customDate={id:x.CustomDate,name:"Custom Date"},this.allowLaborFutureDates=!0,this.allowEquipmentFutureDates=!0,this.allowMaterialFutureDates=!0,this.allowLumpSumFutureDates=!0,this.activityCodesEnabled=!1,this.defaultMilestone=`1 ${this.mciTranslateService.getTranslation("L.Of")} 1`,this.organizationList=[],this.isLoadingAcceptButton=!1,this.isLoadingUnacceptButton=!1,this.filterScreenName="acceptanceListing",this.menuEventCallBack=e=>{e.headerName===O.CONTEXTMENU&&this.contentMenuClick(e.actionType,e.rowData)},this.getOrganizations=e=>Ce(this,null,function*(){let a=yield this.commonService.getFilteredOrganizations(e,[this.selectedLocation],["id","name"]);if(!e){this.organizationList=a.data,this.filterDefinitions[1].inputValues=this.organizationList,this.filterDefinitions[1].totalRecords=a?.totalcount??0,this.filterSectionService.updateAppliedFilterIndicator$.next(null);let i=this.filterDefinitions[1].isMultiSelect,r=this.filterPersistenceService.getFilterState()?.multiOrganization??void 0;if(r){let s;i?s=Array.isArray(r)?r:[r]:s=Array.isArray(r)?r[0]:r,this.filtersForm.controls.organization.setValue(s)}else!i&&this.organizationList.length>0&&this.filtersForm.controls.organization.setValue(this.organizationList[0]);this.reloadGridData()}return a?.data??[]}),this.userId=this.commonUtilitiesService.getTokenData().oid,this.dataFromAllocated=this.router?.getCurrentNavigation()?.extras?.state,this.setupFilterAfterInitObservable(this.onFiltersInitialized.bind(this))}ngOnInit(){this.listingPageGridKey="acceptanceListing",this.initializeFilterSection(),this.mciTranslateService.onLangChange.pipe(this.takeUntilDestroyed(this.destroyRef)).subscribe(()=>{this.getTranslations(),this.setColumnDefs(),this.gridApi?.refreshHeader()}),this.uiUtilitiesService.site$.pipe(this.takeUntilDestroyed(this.destroyRef)).subscribe(e=>{it.default.isEmpty(e)||this.loadLocationSettings(e.location_id)}),this.getTranslations(),this.drawerService.reloadTableAfterDrawerAction$.pipe(this.takeUntilDestroyed(this.destroyRef)).subscribe(e=>{e&&this.reloadGridData()}),this.filterSectionService.applyFilters$.pipe(this.takeUntilDestroyed(this.destroyRef)).subscribe(e=>this.onApplyFilters(e)),this.filterSectionService.resetFilters$.pipe(this.takeUntilDestroyed(this.destroyRef)).subscribe(e=>this.onResetFilters(e))}loadLocationSettings(e){this.settingsService.getLocationSettings(e).subscribe(a=>{if(a[0].success){let i=a[0].data;this.allowLaborFutureDates=i?.settings?.acceptance?.allowlaborfuturedates??!1,this.allowEquipmentFutureDates=i?.settings?.acceptance?.allowequipmentfuturedates??!1,this.allowMaterialFutureDates=i?.settings?.acceptance?.allowmaterialfuturedates??!1,this.allowLumpSumFutureDates=i?.settings?.acceptance?.allowlumpsumfuturedates??!1,this.activityCodesEnabled=i?.settings?.allocation?.activitycodes??!1}}),this.initializeGrid(y.ACCEPTANCE)}getTranslations(){this.entity=this.mciTranslateService.getTranslation("L.Allocate_Job_Hour"),this.entityPlural=this.mciTranslateService.getTranslation("L.Allocate_Job_Hour_plural"),this.fileName=this.mciTranslateService.getTranslation("L.Acceptance_Overview"),this.allocationTranslation=this.mciTranslateService.getTranslation("L.Allocation"),this.allocationsTranslation=this.mciTranslateService.getTranslation("L.Allocations"),this.customDateLabel=this.mciTranslateService.getTranslation("L.Custom_Date"),this.todayLabel=this.mciTranslateService.getTranslation("L.Today"),this.yesterdayLabel=this.yesterdayTranslation}initializeGrid(e){let i={privilegelist:[e,y.ALLOCATIONS_FOR_MATERIAL,y.ALLOCATIONS_FOR_LABOR,y.ALLOCATIONS_FOR_EQUIPMENT,y.RATES_FOR_ACCEPTANCE]};this.loginService.getUserDetails(i).subscribe(t=>
1{if(t[0]?.success&&t[0]?.data?.authorizationinfo?.privileges?.length){let r=t[0]?.data?.authorizationinfo?.privileges,s=new Map(r.map(I=>[I.privilege_Name,I.privilege_Set])),g=I=>s.get(I)??Ve;this.canViewRates=g(y.RATES_FOR_ACCEPTANCE)?.view??!1;let n=g(e),w=g(y.ALLOCATIONS_FOR_MATERIAL),S=g(y.ALLOCATIONS_FOR_LABOR),E=g(y.ALLOCATIONS_FOR_EQUIPMENT);this.canDeleteMaterial=w.delete,this.canDeleteLabor=S.delete,this.canDeleteEquipment=E.delete,this.setPermissionsAndConfigureGrid(n)}})}setColumnDefs(){this.columnDefs=[{headerName:O.CONTEXTMENU,context:{isMenuEvent:!0},cellRendererParams:e=>{let{workdate:a,classification:i,state:t}=e.data,r=E=>new Date(a)>new Date&&!E,s=i.id===h.LABOR,g=i.id===h.EQUIPMENT,n=i.id===h.MATERIAL,w=i.id===h.LUMP_SUM,S=[u.VIEW];return[d.ACCEPTED,d.AUTHORIZED,d.PARTIALLY_AUTHORIZED].includes(t.code)&&this.permissions?.canUnassign?S=[u.VIEW,u.UNACCEPT]:t.code===d.AUTHORIZED_UNACCEPTED&&this.permissions?.canAssign?S=[u.VIEW,u.ACCEPT]:t.code===d.ALLOCATED&&this.permissions?.canAssign&&(s&&r(this.allowLaborFutureDates)||g&&r(this.allowEquipmentFutureDates)||n&&r(this.allowMaterialFutureDates)||w&&r(this.allowLumpSumFutureDates)?S=[u.VIEW]:S=[u.VIEW,u.ACCEPT]),this.popupOptions=S,{buttons:S,menuEvent:({type:E,value:I})=>this.contentMenuClick(E,I)}}},{field:"workdate",headerName:this.mciTranslateService.getTranslation("L.Timesheet_Date"),valueGetter:e=>this.dateTimeService.toLocalizedDateFormat(e.data.workdate),type:"rightAligned",filter:"agDateColumnFilter",filterParams:{comparator:this.dateTimeService.localizedDateFilterComparator},comparator:this.dateTimeService.localizedDateComparator,context:{isAutoSize:!0}},{field:"state",headerName:this.mciTranslateService.getTranslation("L.State"),cellRenderer:"globalStatesCellRenderer"},{field:"name",headerName:this.mciTranslateService.getTranslation("L.Resource_Item"),filter:"agTextColumnFilter",context:{isAutoSize:!0},cellRenderer:e=>e?.value??c,valueGetter:e=>e.data.classification.id===h.LUMP_SUM?null:e.data.name},{field:"laborid",headerName:this.mciTranslateService.getTranslation("L.Labor_Id"),filter:"agTextColumnFilter",cellClass:"stringCell",cellRenderer:e=>e?.value??c},{field:"description",headerName:this.mciTranslateService.getTranslation("L.Description_Or_Scope"),filter:"agTextColumnFilter",flex:1,minWidth:this.mciGridService.getColumnMinWidthByHeader(this.mciTranslateService.getTranslation("L.Description_Or_Scope")),cellRenderer:e=>e?.value||c,valueGetter:e=>e.data.isRetention?`${e.data.retention}% ${this.mciTranslateService.getTranslation(he)}`:e.data.description},{field:"classification.name",headerName:this.mciTranslateService.getTranslation("L.Classification"),filter:"agTextColumnFilter"},{field:"vendor.name",headerName:this.mciTranslateService.getTranslation("L.Organization"),filter:"agTextColumnFilter"},{field:"agreement",headerName:this.mciTranslateService.getTranslation("L.Agreement"),filter:"agTextColumnFilter",cellRenderer:"materialToolTip",cellRendererParams:{field:"name",showDash:!0},valueGetter:e=>this.resolveAgreements(e.data),filterValueGetter:e=>this.resolveAgreements(e.data).map(a=>a.name),comparator:this.compareService.compareNamesArray,context:{displayFieldName:"name",isAutoSize:!0}},{field:"group.name",headerName:this.mciTranslateService.getTranslation("L.Group"),filter:"agTextColumnFilter",cellRenderer:e=>e?.value??c},l({field:"quantity",headerName:this.mciTranslateService.getTranslation("L.Hours_Quantity"),cellRenderer:e=>{if(e?.data?.classification?.id===h.LUMP_SUM)return c;let a=this.getUnit(e),i=this.mathService.formatNumber(e?.value);return this.mciGridService.cellWithSuffix(i,a)},filterValueGetter:e=>e?.data?.classification?.id===h.LUMP_SUM?"":e.data.quantity,valueGetter:e=>this.mathService.roundDisplay(e?.data?.quantity,!1)},this.mciGridService.getBaseDecimalColumnDefinition()),l(l({field:"allocated",headerName:this.mciTranslateService.getTranslation("L.Cost"),cellRenderer:"materialToolTip",cellRendererParams:e=>{let a={simpleTooltip:!0};return a.value=e.value===c?c:this.mathService.formatNumber(e.value),this.canViewRates?a.suffix=e?.data?.currencyabbr:a.tooltip=this.mciTranslateService.getTranslation("M.No_Permission_Rates"),a},valueGetter:e=>this.canViewRates?e?.data?.allocated?.amount:c,tooltipComponentParams:{hide:!this.canViewRates,customValueCb:e=>{let a=e?.value,i=e?.data?.currencyabbr;return`${a} ${i}`}}},this.mciGridService.getBaseNumericColumnDefinition(!0)),this.mciGridService.getDecimalColumnFilterParams()),{field:"projectreference",headerName:this.mciTranslateService.getTranslation("L.Project_Or_Reference"),valueFormatter:e=>e?.value??c},{field:"milestonenumber",headerName:this.mciTranslateService.getTranslation("L.Milestone#"),cellRenderer:e=>e?.data?.classification.id===h.LUMP_SUM&&e?.data?.milestone===this.defaultMilestone?e?.data?.milestone??c:e?.value??c},{field:"hasfieldnotes",headerName:this.mciTranslateService.getTranslation("L.Field_Note"),cellRenderer:"materialGridIcon",headerClass:"ag-center-aligned-header",cellClass:"ag-center-aligned-cell",valueGetter:e=>
1!!e?.data?.fieldnotes,filterValueGetter:e=>e?.data?.fieldnotes?!0:"",cellRendererParams:e=>{let a={};return e.data&&(a={icon:"event_note",propertyName:"fieldnotes",tooltip:this.mciTranslateService.getTranslation("L.Field_Note"),showIconCb:()=>!!e?.data?.fieldnotes,showDash:!e?.data?.fieldnotes,clickEvent:i=>{if(i.fieldnotes){let r=JSON.parse(i.fieldnotes).map(g=>{let n;return g.attachments&&(n=JSON.parse(g.attachments)[0].id),{text:g.text,timestamp:g.timestamp,imageId:n,lat:+g.lat,long:+g.long}}),s={resourceId:i.id,resourceName:i.name,organizationName:i.vendor.name,laborId:i.laborid,positionClass:Oe.BOTTOM_CENTER,fieldNotesDate:e.data.workdate,fieldNotes:r,isVirtualGate:!1,hasCostObject:!1};this.uiUtilitiesService.openFieldNoteDialog(s)}}}),a},context:{isAutoSize:!0},resizable:!1},{field:"timesheetref",headerName:this.mciTranslateService.getTranslation("L.Timesheet_Ref"),filter:"agTextColumnFilter",type:"rightAligned",cellRenderer:e=>e?.value??c}]}onSelectionChanged(e){this.selectedRowData=e,this.showGridUnacceptButton=!1,this.showGridAcceptButton=!1,this.selectedRowData.forEach(i=>{(i.state.code===d.ACCEPTED||i.state.code===d.AUTHORIZED||i.state.code===d.PARTIALLY_AUTHORIZED)&&this.permissions?.canUnassign&&(this.showGridUnacceptButton=!0),i.state.code===d.AUTHORIZED_UNACCEPTED&&this.permissions?.canAssign&&(this.showGridAcceptButton=!0)});let a=e.filter(i=>i.state.code===d.ALLOCATED);if(a.length){let i=a.filter(t=>new Date(t.workdate)<=new Date||new Date(t.workdate)>new Date&&this.allowLaborFutureDates===!0&&h.LABOR===t.classification.id||new Date(t.workdate)>new Date&&this.allowMaterialFutureDates===!0&&h.MATERIAL===t.classification.id||new Date(t.workdate)>new Date&&this.allowLumpSumFutureDates===!0&&h.LUMP_SUM===t.classification.id||new Date(t.workdate)>new Date&&this.allowEquipmentFutureDates===!0&&h.EQUIPMENT===t.classification.id?t:null);a.length===i.length&&this.permissions?.canAssign?this.showGridAcceptButton=!0:this.showGridAcceptButton=!1}}configurePopupOptions(){let e=[{action:u.VIEW,canAct:this.permissions?.canView},{action:u.ACCEPT,canAct:this.permissions?.canAssign},{action:u.UNACCEPT,canAct:this.permissions?.canUnassign}];this.popupOptions=e.filter(a=>a.canAct).map(a=>a.action)}reloadGridData(){let e=this.dateTimeService.getDateRangeFromDateShortcut(this.filtersForm,"timesheetDate"),a={vendorids:[],startdate:e.startDate,enddate:e.endDate,states:this.filtersForm?.controls?.state.value?.map(t=>t.id),classifications:this.filtersForm?.controls?.classification.value?.map(t=>t.name)},i=[];this.filtersForm?.controls?.organization?.value&&(i=Array.isArray(this.filtersForm.controls.organization.value)?this.filtersForm.controls.organization.value:[this.filtersForm.controls.organization.value],a.vendorids=i.map(t=>t.id)),this.acceptanceService.getAcceptanceAllocationsByDate(a).subscribe({next:t=>{if(this.checkIfDataIsRestricted(t),t[0]?.success&&t[0]?.data){let r=t[0].data;r.forEach((s,g)=>{if(s.rowId=`${g+1}`,s.milestone){let n=JSON.parse(s.milestone);s.milestonenumber=`${n.order} ${this.mciTranslateService.getTranslation("L.Of")} ${n.totalmilestones}`}else s.retention&&(s.milestonenumber=this.mciTranslateService.getTranslation(he),s.isRetention=!0)}),this.gridApi?.setGridOption("rowData",r),this.gridData=r,r.forEach((s,g)=>{s?.milestone===null&&s?.classification?.id===h.LUMP_SUM&&s?.estimatetypeid===me.ONE_TIME_PAYMENT&&(this.gridData[g].milestone=this.gridData[g].estimatetypeid===me.ONE_TIME_PAYMENT?this.defaultMilestone:this.mciTranslateService.getTranslation("L.Retention"))}),this.setColumnDefs(),setTimeout(()=>{this.dataFromAllocated&&this.defaultSelect&&(this.selectResourcesOnGrid(),this.defaultSelect=!1)},100)}else this.onAPIError()},error:()=>{this.onAPIError()}})}selectResourcesOnGrid(){let e=this.dataFromAllocated?.rowData?.filter(i=>i.state?.id===ie.ALLOCATED||i.state?.id===ie.AUTHORIZED_UNACCEPTED||i.allocationstate?.id===ie.ALLOCATED||i.allocationstate?.id===ie.AUTHORIZED_UNACCEPTED),a=this.dataFromAllocated?.classification;e?.forEach(i=>{this.gridApi?.forEachNode(t=>{let r=t.data;a===te.LABOR||a===te.EQUIPMENT?this.dateTimeService.toISODateFormat(i?.workdate)===r.workdate&&i?.organization?.id===r.vendor?.id&&i?.resource?.id===r.id&&t.setSelected(!0):a===te.MATERIAL?this.dateTimeService.toISODateFormat(i?.timesheetdate)===r.workdate&&i?.organization?.id===r.vendor?.id&&i?.item?.id===r.id&&i.description===r.description&&t.setSelected(!0):a===te.LUMPSUM&&this.dateTimeService.toISODateFormat(i?.timesheetdate)===r.workdate&&i?.organization?.id===r.vendor?.id&&i?.activityid===r.id&&t.setSelected(!0)})}),this.selectChangeSkipCount=this.gridApi?.getSelectedNodes().length}paginationEvent(e){this.gridApi?.paginationGoToPage(e.pageIndex),this.currentPage=e.pageIndex,e.pageSize!==this.pageSize&&(this.gridApi?.setGridOption("paginationPageSize",e.pageSize),this.pageSize=e.pageSize)}contentMenuClick(e,a){switch(this.actionType=e,e){case u.VIEW:this.permissions.canDelete=!1,this.selectedRowData=a,this.selectedRowData.classification.id===h.EQUIPMENT?this.permissions.canDelete=this.canDeleteEquipment:this.selectedRowData.classification.id===h.LABOR?this.permissions.canDelete=this.canDeleteLabor:this.selectedRowData.classification.id===h.MATERIAL?this.permissions.canDelete=this.canDeleteMaterial:this.selectedRowData.classification.id===h.LUMP_SUM&&(this.permissions.canDelete=!1),this.openDrawerAndSetForm(e);break;case u.ACCEPT:this.stateType=D.accepted,this.updateState([a],this.stateType);break;case u.UNACCEPT:this.stateType=D.unaccepted,this.updateState([a],this.stateType);break;default:break}}openDrawerAndSetForm(e){let a="";this.selectedRowData?.classification?.id===h.LUMP_SUM?this.selectedRowData?.projectid!==null?(a=`${this.selectedRowData?.name}`,this.selectedRowData?.milestone!==null?this.selectedRowData?.estimatetypeid===me.ONE_TIME_PAYMENT?a+=` - ${this.mciTranslateService.getTranslation("L.Milestone")} ${this.defaultMilestone}`:a+=` - ${this.mciTranslateService.getTranslation("L.Milestone")} ${this.selectedRowData?.milestonenumber}`:this.selectedRowData?.retention&&(a+=` - ${this.mciTranslateService.getTranslation(he)}`)):a=`${this.selectedRowData?.name}`:this.selectedRowData?.classification?.id===h.LABOR?a=this.selectedRowData?.laborid?`${this.selectedRowData?.name} (${this.selectedRowData?.laborid})`:`${this.selectedRowData?.name}`:a=`${this.selectedRowData?.name}`;let i=this.getDrawerHeaderLabels(e,a,this.selectedRowData?.classification?.id===h.LUMP_SUM?`${this.selectedRowData?.vendor?.name} | ${this.selectedRowData?.agreement?.name}`:`${this.selectedRowData?.vendor?.name}`),t={laborAcceptPermission:!(new Date(this.selectedRowData?.workdate)>new Date&&!this.allowLaborFutureDates),equipmentAcceptPermission:!(new Date(this.selectedRowData?.workdate)>new Date&&!this.allowEquipmentFutureDates),materialAcceptPermission:!(new Date(this.selectedRowData?.workdate)>new Date&&!this.allowMaterialFutureDates),lumpSumAcceptPermission:!(new Date(this.selectedRowData?.workdate)>new Date&&!this.allowLumpSumFutureDates),ratesViewPermission:this.canViewRates,activityCodesEnabled:this.activityCodesEnabled},r=new xe(e,this.selectedRowData,this.permissions,t),s=new Me(tt,i.title,i.subtitle,null,this.drawerSizesEnum.MEDIUM,null,r);this.drawerService.updateDrawerContent(s),this.drawerService.openDrawer({loadingTimeout:2.25})}onMassAccept(){this.isLoadingAcceptButton=!0,this.stateType=D.accepted,this.updateState(this.selectedRowData,this.stateType)}onMassUnaccept(){this.isLoadingUnacceptButton=!0,this.stateType=D.unaccepted,this.updateState(this.selectedRowData,this.stateType)}updateState(e,a){this.updatedCount=0,this.unchangedCount=0;let i=[],t=this.mciTranslateService.getTranslation("L.Activity"),r=this.mciTranslateService.getTranslation("L.Activities"),s=this.mciTranslateService.getTranslation("L.Accepted"),g=this.mciTranslateService.getTranslation("L.Unaccepted").toLocaleLowerCase();e.forEach(n=>{this.stateType===D.accepted?n.state.code===d.ALLOCATED||n.state.code===d.AUTHORIZED_UNACCEPTED?(i.push({id:n.id,state:this.stateType,code:n.state.code,workdate:n.workdate,vendor:n.vendor,site:n.site,classification:n.classification?.id,description:n.description??"",group:n.group??null,agreement:n.agreement??null,allocationids:n.allocationids}),this.updatedCount++):this.unchangedCount++:this.stateType===D.unaccepted&&(n.state.code===d.ACCEPTED||n.state.code===d.AUTHORIZED||n.state.code===d.PARTIALLY_AUTHORIZED?(i.push({id:n.id,state:this.stateType,code:n.state.code,workdate:n.workdate,vendor:n.vendor,site:n.site,classification:n.classification?.id,description:n.description??"",group:n.group??null,agreement:n.agreement??null,allocationids:n.allocationids}),this.updatedCount++):this.unchangedCount++)}),this.acceptanceService.updateAllocationState(i).subscribe({next:n=>{let w="";if(n?.[0]?.errors?.[0]?.message===Z&&!n?.[0]?.data?.length){this.uiUtilitiesService.showNotificationMessage(this.mciTranslateService.getTranslation(Z),""),this.showGridUnacceptButton=!0,this.showGridAcceptButton=!0,this.isLoadingAcceptButton=!1,this.isLoadingUnacceptButton=!1;return}if(n[0]?.success&&n[0]?.data.length){let S=0,E=0;this.reloadGridData(),this.deselectRows(),n[0].data.forEach(ae=>{ae.issuccess===!0?S++:E++}),E=this.unchangedCount+E;let I=`${this.mciTranslateService.getTranslation("L.And")} ${this.mciTranslateService.getTranslation("M.Entities_Remain_Unchanged",{count:E})}`;if(E>0&&S>0){let ae=S>1?`${S} ${r}`:"";w=a===D.accepted?`${S===1?t:ae} ${s} ${I}`:`${S===1?t:ae} ${g} ${I}`,this.uiUtilitiesService.showNotificationMessage(w,"")}else E>0&&S===0?this.uiUtilitiesService.showNotificationMessage(this.mciTranslateService.getTranslation("M.All_Remain_Unchanged"),""):(a===D.accepted?S>1?w=`${this.mciTranslateService.getTranslation("M.Activity_Accepted_Count",{count:S})}`:w=`${this.mciTranslateService.getTranslation("M.Activity_Accepted")}`:S>1?w=`${this.mciTranslateService.getTranslation("M.Activity_Unaccepted_Count",{count:S})}`:w=`${this.mciTranslateService.getTranslation("M.Activity_Unaccepted")}`,this.uiUtilitiesService.showNotificationMessage(w))}else{let S=this.selectedRows?.length>1?this.allocationsTranslation:this.allocationTranslation;w=this.mciTranslateService.getTranslation("M.Entity_Could_Not_Be_Actioned",{entity:S}),this.uiUtilitiesService.showNotificationMessage(w)}this.showGridUnacceptButton=!0,this.showGridAcceptButton=!0,this.isLoadingAcceptButton=!1,this.isLoadingUnacceptButton=!1},error:()=>{this.showGridUnacceptButton=!0,this.showGridAcceptButton=!0,this.isLoadingAcceptButton=!1,this.isLoadingUnacceptButton=!1}})}initializeFilterSection(){let e,a=[x.Yesterday,x.Today,x.CustomDate],i=!0;this.personalInformationService.getDefaultDateFilter(Fe.ACCEPTANCE,this.userId).subscribe(t=>{e=t,e&&e.selectedvalue&&(this.defaultDateRange={id:parseInt(x[e.selectedvalue]),name:null});let s=this.filterPersistenceService.getFilterState()?.dateByForm.find(w=>w.formName===this.filterScreenName)?.dateShortcut?.id??void 0;s&&(this.defaultDateRange.id=s),i=a.includes(this.defaultDateRange.id);let g=this.globalStatesService.getStatesForAcceptance();this.filterDefinitions=[{labelName:this.mciTranslateService.getTranslation("L.Timesheet_Date"),controlType:this.CONTROL_TYPE.DATE_SHORTCUT,disableAlphabeticalSorting:!0,isMultiSelect:!1,formControlName:"timesheetDate",inputValueLabel:"name",initialValue:this.defaultDateRange,accordionGroupName:this.mciTranslateService.getTranslation("L.Date_Range"),useSession:!0,sessionKey:de.FORM_SPECIFIC},{labelName:this.mciTranslateService.getTranslation("L.Organization"),placeholder:this.mciTranslateService.getTranslation("L.Select_Organizations"),isMultiSelect:i,inputValueLabel:"name",inputValues:this.organizationList,controlType:this.CONTROL_TYPE.PICKER,formControlName:"organization",useSession:!0,sessionKey:i?de.MULTI_ORGANIZATION:de.ORGANIZATION,callbackSearch:this.getOrganizations},{labelName:this.mciTranslateService.getTranslation("L.State"),isMultiSelect:!0,inputValueLabel:"name",inputValues:g,controlType:this.CONTROL_TYPE.PICKER,enableDataLoadingOnScrollOrSearch:!1,formControlName:"state",placeholder:this.mciTranslateService.getTranslation("L.Select_States")},{labelName:this.mciTranslateService.getTranslation("L.Classification"),isMultiSelect:!0,inputValueLabel:"displayName",controlType:this.CONTROL_TYPE.PICKER,enableDataLoadingOnScrollOrSearch:!1,inputValues:this.classificationList,disableAlphabeticalSorting:!0,formControlName:"classification",placeholder:this.mciTranslateService.getTranslation("L.Select_Classifications")}];let n={filterDefinitions:this.filterDefinitions,showAdvancedFilterButton:!0,associatedGridId:this.listingPageGridKey,alertLargeTimesheetDateFilter:!0};this.filterSectionService.initialize(n)})}onFiltersInitialized(e){this.filtersForm=e,this.getModelValues(this.uiUtilitiesService.site$.value,!0),this.uiUtilitiesService.site$.pipe(we(1),this.takeUntilDestroyed(this.destroyRef)).subscribe(a=>{a&&this.getModelValues(a,!1)}),this.filterSectionService.filterChanged$.pipe(this.takeUntilDestroyed(this.destroyRef)).subscribe(a=>{a.formControlName==="organization"&&this.filtersForm.controls.organization.setValue(a.selectedValue),a.formControlName==="timesheetDate"&&(this.filterDefinitions[1].useSession=!1,this.filterDefinitions[0].useSession=!1,this.setOrganizationFilterControl(1,a),this.filterDefinitions[1].useSession=!0,this.filterDefinitions[0].useSession=!0)})}getModelValues(e,a){this.selectedLocation=e?.location_id,this.dataFromAllocated&&a&&this.defaultFilterValues(),a||this.filtersForm.controls.organization.reset(),this.getOrganizations()}defaultFilterValues(){let e=this.dataFromAllocated?.filterData;e&&(this.filtersForm.get("timesheetDate")?.patchValue(e.timesheetDate),this.filtersForm.get("organization")?.patchValue([e.organization]),this.filtersForm.get("customDate")?.patchValue(e.customDate),this.filtersForm.get("customStartDate")?.patchValue(e.customStartDate),this.filtersForm.get("customEndDate")?.patchValue(e.customEndDate))}onResetFilters(e){this.filtersForm.reset({filterSort:this.defaultFilterSort,timesheetDate:{id:x.Yesterday},organization:[],state:[],classification:[]}),this.filtersForm.controls.organization.reset(),this.filterSectionService.afterReset$.next(null),e&&this.reloadGridData()}getUnit(e){let a="";return["Labor","Equipment"].includes(e?.data?.classification?.name)?a=this.mciTranslateService.getTranslation("L.Hours_Abbr"):a=e?.data?.unit??"",a}getRowIdCallBack(e){return e.data?.rowId}resolveAgreements(e){let a=e?.agreements,i=[];
1if(typeof a=="string")try{i=a?JSON.parse(a):[]}catch(t){i=[]}else Array.isArray(a)&&(i=a);return i.length?i:e?.agreement?[e.agreement]:[]}static{this.\u0275fac=function(a){return new(a||o)}}static{this.\u0275cmp=F({type:o,selectors:[["app-overview-acceptance"]],features:[q],decls:5,vars:20,consts:[[1,"mci-ui-card-flat"],["associatedGridId","acceptanceListing",3,"isDataRestrictedChange","isDataRestricted","showLongDateAlertForDataRestriction","formName","totalFilterCount"],[1,"mci-ui-card-flat-border"],[1,"mci-ui-table"],[3,"gridReady","massAcceptEvent","massUnacceptEvent","onRowSelect","rowDataUpdated","columnDefinition","fileName","gridData","gridHeight","key","loadWithSelectedRows","selectChangeSkipCount","showAddButton","showGridAcceptButton","showGridDeleteButton","showGridStatusButton","showGridUnacceptButton","isLoadingAcceptButton","isLoadingUnacceptButton","getRowIdCB","stateColumn"]],template:function(a,i){a&1&&(v(0,"div",0)(1,"app-filter-section",1),Le("isDataRestrictedChange",function(r){return ye(i.isDataRestricted,r)||(i.isDataRestricted=r),r}),T(),v(2,"div",2)(3,"div",3)(4,"app-common-data-grid",4),k("gridReady",function(r){return i.onGridReady(r)})("massAcceptEvent",function(){return i.onMassAccept()})("massUnacceptEvent",function(){return i.onMassUnaccept()})("onRowSelect",function(r){return i.onSelectionChanged(r)})("rowDataUpdated",function(r){return i.onRowDataUpdated(r)}),T()()()()),a&2&&(p(),Re("isDataRestricted",i.isDataRestricted),f("showLongDateAlertForDataRestriction",!0)("formName",i.listingPageGridKey)("totalFilterCount",4),p(3),f("columnDefinition",i.columnDefs)("fileName",i.fileName)("gridData",i.gridData)("gridHeight",i.gridHeight)("key",i.listingPageGridKey)("loadWithSelectedRows",(i.dataFromAllocated==null||i.dataFromAllocated.rowData==null?null:i.dataFromAllocated.rowData.length)>0)("selectChangeSkipCount",i.selectChangeSkipCount)("showAddButton",i.showAddButton)("showGridAcceptButton",i.showGridAcceptButton)("showGridDeleteButton",!1)("showGridStatusButton",!1)("showGridUnacceptButton",i.showGridUnacceptButton)("isLoadingAcceptButton",i.isLoadingAcceptButton)("isLoadingUnacceptButton",i.isLoadingUnacceptButton)("getRowIdCB",i.getRowIdCallBack)("stateColumn","state"))},dependencies:[$e,B],encapsulation:2})}}return o})();export{aa as OverviewAcceptanceComponent};

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.