PageSourceSearch

https://app.intoaec.ai/_next/static/chunks/3279-fae3997e0bb95dac.js

js intoaec.ai collected 2026-10-04 04:54:27 UTC 132,148 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3279],{772084:function(e,t,a){var i=a(564836);t.Z=void 0;var l=i(a(753564)),n=a(785893);t.Z=(0,l.default)((0,n.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8m.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"}),"AccessTimeOutlined")},280779:function(e,t,a){var i=a(564836);t.Z=void 0;var l=i(a(753564)),n=a(785893);t.Z=(0,l.default)((0,n.jsx)("path",{d:"M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5zm4-3H19v1h1.5V11H19v2h-1.5V7h3zM9 9.5h1v-1H9zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4zm10 5.5h1v-3h-1z"}),"PictureAsPdf")},781143:function(e,t,a){a.d(t,{Z:function(){return l}});var i=a(785893);function l(e){return(0,i.jsxs)("svg",{viewBox:"0 0 18 13",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,i.jsx)("path",{d:"M11.5983 3.69472C12.4749 4.19063 13.0134 4.86055 13.1766 5.65447C13.2492 6.58005 12.9763 7.36735 12.1097 8.06942C11.4544 8.58572 10.4932 8.94655 9.51588 8.99258C9.3802 8.99565 9.24488 8.99671 9.10913 8.99657C9.07308 8.99655 9.07308 8.99655 9.03631 8.99653C8.63594 8.99544 8.27078 8.97059 7.89003 8.88178C7.86518 8.87615 7.84033 8.87053 7.81473 8.86474C7.29598 8.7445 6.84416 8.56201 6.43167 8.30453C6.4022 8.28712 6.37273 8.2697 6.34237 8.25175C5.73461 7.88028 5.34238 7.38062 5.11914 6.83519C5.10674 6.80617 5.09433 6.77715 5.08155 6.74725C4.82474 6.01654 5.0103 5.20548 5.52504 4.55646C6.10153 3.86761 6.96249 3.41609 8.02291 3.18346C9.27028 2.96295 10.576 3.13144 11.5983 3.69472ZM8.80151 4.26384C8.80151 4.3764 8.80151 4.48896 8.80151 4.60494C8.73044 4.61305 8.73044 4.61305 8.65795 4.62134C8.36165 4.66962 8.14009 4.79114 7.97092 4.97104C7.7898 5.18996 7.76095 5.42686 7.84104 5.67661C7.95359 5.90284 8.15923 6.07237 8.45757 6.18026C8.70203 6.24973 8.9539 6.25873 9.21395 6.26779C9.41619 6.27702 9.53042 6.28684 9.67652 6.38914C9.81809 6.53212 9.81474 6.66499 9.7859 6.83519C9.70671 6.9555 9.62442 7.01593 9.45777 7.07134C9.33674 7.08341 9.21748 7.08352 9.09546 7.08281C9.06333 7.08334 9.03121 7.08386 8.99811 7.0844C8.79251 7.08429 8.67233 7.06549 8.50983 6.96638C8.37164 6.84978 8.37766 6.72027 8.364 6.57281C8.17149 6.57281 7.97899 6.57281 7.78065 6.57281C7.80111 6.85983 7.87556 7.10802 8.1817 7.30748C8.37596 7.41861 8.55852 7.46109 8.80151 7.49115C8.80151 7.60371 8.80151 7.71627 8.80151 7.83225C8.99401 7.83225 9.18651 7.83225 9.38485 7.83225C9.38485 7.71968 9.38485 7.60712 9.38485 7.49115C9.43147 7.48628 9.47809 7.48141 9.52613 7.47639C9.8505 7.42345 10.0798 7.27829 10.2542 7.07943C10.3988 6.87158 10.4173 6.64534 10.3455 6.41927C10.2322 6.1932 10.0273 6.02378 9.72879 5.91583C9.48432 5.84636 9.23245 5.83736 8.97241 5.8283C8.77017 5.81906 8.65593 5.80925 8.50983 5.70694C8.36826 5.56396 8.37161 5.4311 8.40046 5.26089C8.47964 5.14058 8.56194 5.08015 8.72859 5.02475C8.84961 5.01267 8.96888 5.01257 9.0909 5.01327C9.13908 5.01248 9.13908 5.01248 9.18824 5.01168C9.39385 5.01179 9.51403 5.0306 9.67652 5.
11297C9.81471 5.2463 9.8087 5.37581 9.82236 5.52328C10.0149 5.52328 10.2074 5.52328 10.4057 5.52328C10.3852 5.23625 10.3108 4.98807 10.0047 4.78861C9.8104 4.67747 9.62784 4.63499 9.38485 4.60494C9.38485 4.49238 9.38485 4.37981 9.38485 4.26384C9.19235 4.26384 8.99984 4.26384 8.80151 4.26384Z"}),(0,i.jsx)("path",{d:"M8.79837 9.38712C8.83992 9.39002 8.88146 9.39291 8.92427 9.3959C8.98989 9.4011 8.98989 9.4011 9.05684 9.4064C9.10048 9.40971 9.14411 9.41303 9.18907 9.41644C9.55729 9.4455 9.9247 9.47954 10.2919 9.51464C10.3208 9.51739 10.3498 9.52015 10.3796 9.523C11.2288 9.6045 12.0026 9.71686 12.7868 9.97524C13.4918 10.2046 14.1167 10.1764 14.9267 10.1936C14.9267 10.8776 14.9267 11.5616 14.9267 12.2664C13.9629 12.2746 13.9629 12.2746 13.6627 12.2766C13.1984 12.2807 12.754 12.2925 12.3017 12.3713C12.2628 12.378 12.2239 12.3848 12.1839 12.3917C11.7956 12.4593 11.4084 12.5298 11.0213 12.6011C10.8973 12.6239 10.7732 12.6464 10.649 12.6687C10.58 12.6812 10.5111 12.6941 10.4422 12.7069C9.9989 12.7865 9.64822 12.7644 9.20168 12.7032C9.1775 12.6999 9.15332 12.6966 9.12841 12.6932C8.99977 12.6755 8.87123 12.6576 8.74274 12.6393C8.63893 12.6247 8.53502 12.6107 8.43089 12.5972C7.71631 12.5049 7.1307 12.3652 6.50015 12.1003C6.36455 12.0436 6.22692 11.9897 6.08904 11.9359C5.99393 11.8988 5.8991 11.8613 5.8043 11.8237C5.58231 11.7367 5.35776 11.6533 5.13296 11.5701C4.78082 11.4398 4.42906 11.309 4.08018 11.1742C4.04754 11.1618 4.0149 11.1494 3.98127 11.1366C3.78198 11.0589 3.61615 10.9861 3.50367 10.8397C3.45911 10.7172 3.45972 10.6218 3.52418 10.5035C3.62284 10.3894 3.69716 10.3251 3.87895 10.2862C4.16182 10.2491 4.41949 10.332 4.68326 10.3984C4.78459 10.4238 4.88629 10.4482 4.98816 10.4724C5.33767 10.5561 5.68465 10.644 6.02988 10.7364C7.64116 11.1666 8.87294 11.2796 10.4787 10.797C10.3711 10.7553 10.2678 10.7291 10.1497 10.7065C10.0951 10.696 10.0951 10.696 10.0394 10.6853C10.0003 10.6779 9.96119 10.6704 9.92089 10.6628C9.83779 10.6467 9.75468 10.6306 9.67159 10.6145C9.54082 10.5893 9.41002 10.5642 9.27916 10.5392C9.1527 10.515 9.02636 10.4905 8.90004 10.466C8.84169 10.455 8.84169 10.455 8.78217 10.4438C8.49253 10.3872 8.24503 10.3297 8.07245 10.1411C7.98209 10.024 7.97528 9.9044 7.99953 9.77374C8.06726 9.61892 8.17951 9.52298 8.36412 9.43264C8.51872 9.38739 8.63285 9.37516 8.79837 9.38712Z"}),(0,i.jsx)("path",{d:"M15.968 9.77149C16.0313 9.7715 16.0313 9.7715 16.0958 9.7715C16.1402 9.77164 16.1845 9.77177 16.2301 9.77191C16.2709 9.77194 16.3116 9.77196 16.3536 9.77199C16.506 9.77213 16.6584 9.77249 16.8108 9.77283C17.3217 9.77364 17.3217 9.77364 17.843 9.77447C17.843 10.7356 17.843 11.6967 17.843 12.6869C17.4918 12.6891 17.1407 12.6913 16.7789 12.6935C16.6682 12.6944 16.5576 12.6954 16.4436 12.6964C16.3558 12.6967 16.268 12.697 16.1803 12.6972C16.1348 12.6977 16.0893 12.6982 16.0424 12.6988C15.9987 12.6988 15.9551 12.6988 15.9101 12.6988C15.8534 12.6992 15.8534 12.6992 15.7955 12.6995C15.6558 12.6825 15.6013 12.6606 15.5096 12.582C15.4828 12.4967 15.4851 12.4131 15.4866 12.326C15.4864 12.3001 15.4861 12.2741 15.4858 12.2474C15.4852 12.1616 15.4859 12.0758 15.4867 11.99C15.4867 11.9304 15.4866 11.8708 15.4864 11.8112C15.4863 11.6862 15.4869 11.5613 15.4879 11.4364C15.4891 11.2761 15.4889 11.1159 15.4882 10.9557C15.4878 10.8326 15.4881 10.7095 15.4887 10.5865C15.4889 10.5274 15.4889 10.4683 15.4886 10.4092C15.4884 10.3266 15.4892 10.2441 15.4902 10.1616C15.4899 10.1371 15.4897 10.1126 15.4895 10.0874C15.4929 9.92232 15.4929 9.92232 15.5769 9.83883C15.7084 9.77501 15.8135 9.77125 15.968 9.77149ZM16.3846 11.5062C16.3846 11.6447 16.3846 11.7833 16.3846 11.926C16.5772 11.926 16.7697 11.926 16.968 11.926C16.968 11.7875 16.968 11.6489 16.968 11.5062C16.7755 11.5062 16.583 11.5062 16.3846 11.5062Z"}),(0,i.jsx)("path",{d:"M1.54575 0.0390625C1.65793 0.0750635 1.73471 0.11607 1.82124 0.178534C1.8588
11 0.205466 1.85881 0.205466 1.89714 0.232943C1.93778 0.262469 1.93778 0.262469 1.97924 0.292592C2.00806 0.313329 2.03689 0.334066 2.06659 0.355432C2.16184 0.424022 2.25684 0.492796 2.35184 0.561573C2.41782 0.609159 2.48383 0.656734 2.54984 0.704298C2.70583 0.816732 2.86164 0.929283 3.01739 1.04189C3.19473 1.17011 3.37228 1.29817 3.54985 1.42623C3.91506 1.6896 4.28 1.95316 4.64477 2.21684C4.75066 2.18027 4.82456 2.14587 4.90596 2.08462C4.93684 2.06179 4.93684 2.06179 4.96834 2.0385C4.9894 2.02267 5.01045 2.00684 5.03214 1.99053C5.07422 1.95892 5.11647 1.92741 5.1589 1.89604C5.17744 1.88208 5.19599 1.86812 5.2151 1.85374C5.26457 1.82327 5.26457 1.82327 5.33749 1.82327C5.36364 2.02493 5.38958 2.22661 5.41537 2.4283C5.42417 2.49686 5.43301 2.56542 5.4419 2.63397C5.45469 2.73271 5.46732 2.83145 5.47991 2.93019C5.48589 2.97592 5.48589 2.97592 5.49199 3.02257C5.5112 3.17455 5.52431 3.32366 5.51978 3.47628C5.01856 3.45939 4.51994 3.4296 4.02041 3.39592C3.94611 3.39098 3.87182 3.38604 3.79752 3.38111C3.61811 3.36919 3.43871 3.35717 3.25932 3.34509C3.25932 3.26637 3.25932 3.26637 3.30618 3.22371C3.32756 3.20874 3.34895 3.19376 3.37098 3.17833C3.39401 3.16201 3.41704 3.14569 3.44077 3.12888C3.46511 3.11202 3.48945 3.09516 3.51454 3.07778C3.53888 3.06062 3.56323 3.04345 3.58831 3.02577C3.64855 2.98334 3.70904 2.94111 3.76975 2.89904C3.71973 2.81831 3.66275 2.76305 3.57595 2.70078C3.551 2.68275 3.52605 2.66472 3.50035 2.64615C3.473 2.62665 3.44564 2.60716 3.41746 2.58707C3.38865 2.56633 3.35983 2.54558 3.33014 2.52421C3.23484 2.45566 3.13927 2.38729 3.0437 2.31892C2.97758 2.27143 2.91147 2.22393 2.84538 2.17642C2.68915 2.06417 2.53276 1.95203 2.37629 1.83995C2.19813 1.71232 2.02017 1.58454 1.84223 1.45675C1.47627 1.19393 1.11005 0.931293 0.743652 0.668781C0.805579 0.573777 0.878954 0.512859 0.983199 0.438786C1.03219 0.40378 1.03219 0.40378 1.08218 0.368066C1.11635 0.343916 1.15052 0.319767 1.18572 0.294886C1.22053 0.270095 1.25533 0.245291 1.29011 0.220476C1.37516 0.159885 1.46038 0.0994202 1.54575 0.0390625Z"}),(0,i.jsx)("path",{d:"M17.2225 0.197875C17.2274 0.389422 17.2082 0.576423 17.1827 0.76702C17.1766 0.813692 17.1766 0.813692 17.1704 0.861307C17.1575 0.959952 17.1445 1.05858 17.1314 1.15721C17.1226 1.2244 17.1138 1.29158 17.105 1.35876C17.0836 1.52282 17.062 1.68686 17.0402 1.85089C16.9118 1.80737 16.8288 1.75731 16.7286 1.68423C16.6978 1.66191 16.6671 1.63959 16.6353 1.61659C16.6035 1.59325 16.5717 1.56991 16.5389 1.54587C16.5066 1.52233 16.4742 1.49879 16.4408 1.47453C16.3609 1.41643 16.2812 1.35821 16.2017 1.29988C16.0117 1.4142 15.8344 1.53434 15.6598 1.66065C15.6324 1.68037 15.605 1.7001 15.5767 1.72043C15.4869 1.7851 15.3972 1.84987 15.3074 1.91464C15.2449 1.95971 15.1823 2.00479 15.1197 2.04985C14.9556 2.16807 14.7916 2.28637 14.6276 2.40468C14.46 2.52556 14.2923 2.64636 14.1246 2.76718C13.796 3.00393 13.4675 3.24077 13.1391 3.47766C13.0067 3.43316 12.9224 3.37958 12.8201 3.30383C12.791 3.28239 12.7618 3.26094 12.7318 3.23885C12.7098 3.22241 12.6878 3.20597 12.6652 3.18904C12.7152 3.10831 12.7722 3.05305 12.859 2.99078C12.8839 2.97275 12.9089 2.95473 12.9346 2.93615C12.9756 2.90691 12.9756 2.90691 13.0174 2.87707C13.0463 2.85633 13.0751 2.83559 13.1048 2.81421C13.2001 2.74566 13.2956 2.67729 13.3912 2.60893C13.4573 2.56144 13.5234 2.51394 13.5895 2.46643C13.7458 2.35417 13.9022 2.24204 14.0586 2.12995C14.2368 2.00233 14.4147 1.87455 14.5927 1.74676C14.9586 1.48393 15.3249 1.2213 15.6913 0.958785C15.6564 0.929325 15.6215 0.899888 15.5866 0.87046C15.5671 0.854065 15.5477 0.837669 15.5277 0.820777C15.4652 0.769098 15.3998 0.72061 15.3315 0.672931C15.2956 0.647539 15.2956 0.647539 15.2589 0.621633C15.2091 0.586741 15.1592 0.551895 15.1093 0.51709C15.0857 0.500331 15.062 0.483572 15.0376 0.466305C15.016 0.45126 14.9945 0.436215 14.9724 0.420714C14.9256 0.381543 14.9256 0.381543 14.9256 0.329066C15.2 0.310228 15.4744 0.291562 15.7488 0.273015C15.842 0.266691 15.9353 0.260329 16.0285 0.253926C16.1629 0.244704 16.2973 0.235625 16.4317 0.226573C16.4937 0.222268 16.4937 0.222268 16.5571 0.217877C16.7801 0.203007 16.9986 0.194902 17.2225 0.197875Z"})]})}a(667294)},346763:function(e,t,a){var i=a(785893);a(667294),t.Z=e=>(0,i.jsxs)("svg",{...e,viewBox:"0 0 80 81",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("circle",{cx:"39.998",cy:"40.7188",r:"40",fill:"#00E540","fill-opacity":"0.25"}),(0,i.jsx)("circle",{cx:"39.9981",cy:"40.3936",r:"24.6358",fill:"#00E540"}),(0,i.jsx)("path",{d:"M51.4675 32.5938L35.6969 48.7586L28.5283 41.411",stroke:"white","stroke-width":"3.75","stroke-linecap":"round","stroke-linejoin":"round"})]})},896941:function(e,t,a){var i=a(785893);a(667294),t.Z=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",...e,id:"Layer_1","data-name":"Layer 1",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{d:"M1.288,11.985c-.82-.117-1.39-.877-1.272-1.697C.854,4.423,6.00
17,0,12,0c2.981,0,5.78,1.098,7.959,3.041l1.334-1.334c.63-.63,1.707-.184,1.707,.707V7c0,.552-.448,1-1,1h-4.586c-.891,0-1.337-1.077-.707-1.707l1.131-1.131c-1.615-1.384-3.663-2.162-5.838-2.162C7.49,3,3.614,6.315,2.985,10.712c-.107,.748-.749,1.288-1.483,1.288-.071,0-.142-.005-.214-.015Zm21.424,.03c-.817-.117-1.579,.453-1.697,1.273-.628,4.396-4.504,7.712-9.015,7.712-2.175,0-4.223-.779-5.837-2.163l1.13-1.13c.63-.63,.184-1.707-.707-1.707H2c-.552,0-1,.448-1,1v4.586c0,.891,1.077,1.337,1.707,.707l1.334-1.334c2.179,1.942,4.978,3.041,7.959,3.041,5.994,0,11.146-4.423,11.985-10.288,.117-.82-.453-1.58-1.273-1.697ZM12,6c-.829,0-1.5,.671-1.5,1.5v4.231c0,.508,.257,.982,.684,1.259l3,1.945c.253,.163,.535,.241,.815,.241,.491,0,.973-.241,1.26-.684,.45-.695,.252-1.625-.442-2.075l-2.316-1.501v-3.416c0-.829-.671-1.5-1.5-1.5Z"})})},426488:function(e,t,a){var i=a(785893);a(667294),t.Z=e=>(0,i.jsx)("svg",{...e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{d:"M3.21907 14.3982C3.21907 12.8336 4.4914 11.5607 6.05529 11.5607C7.61917 11.5607 8.89278 12.8335 8.89278 14.3982C8.89278 15.9628 7.61991 17.2344 6.05529 17.2344C4.4907 17.2344 3.21907 15.9621 3.21907 14.3982ZM22.5051 18.7059C21.7597 20.0687 20.1234 21.0915 17.8978 21.5858C15.8638 22.0374 13.597 21.9903 11.642 21.4601V19.2786C11.642 17.7042 10.3817 16.4192 8.81658 16.3767C9.21766 15.819 9.45485 15.1359 9.45485 14.3982C9.45485 13.6808 9.23095 13.015 8.85014 12.4659C9.72605 11.2667 10.9261 9.99609 12.4212 8.68523H17.6303C20.067 10.8223 21.6925 12.8192 22.4615 14.6212C23.1239 16.1735 23.1384 17.5478 22.5051 18.7059ZM17.3538 15.9773C16.9456 15.4507 16.13 15.1983 15.3066 14.9736V11.9161C15.8819 11.9982 16.6216 12.3084 17.2085 13.244C17.2909 13.3755 17.4644 13.4153 17.5959 13.3328C17.7274 13.2503 17.7671 13.0768 17.6846 12.9453C17.105 12.0214 16.2588 11.46 15.3066 11.349V10.4346C15.3066 10.2794 15.1808 10.1536 15.0256 10.1536C14.8704 10.1536 14.7446 10.2794 14.7446 10.4346V11.3358C14.7416 11.3359 14.7384 11.3362 14.7354 11.3364C13.7204 11.4073 12.808 11.97 12.4649 12.7365C12.2154 13.2941 12.2979 13.885 12.6976 14.4006C13.1062 14.9268 13.9215 15.1792 14.7446 15.4038V18.4614C14.1693 18.3792 13.4298 18.0688 12.8427 17.1335C12.7602 17.0021 12.5867 16.9624 12.4553 17.0449C12.3238 17.1274 12.2842 17.3009 12.3667 17.4323C12.9465 18.356 13.7928 18.9173 14.7446 19.0284V19.943C14.7446 20.0982 14.8704 20.2241 15.0256 20.2241C15.1808 20.2241 15.3066 20.0982 15.3066 19.943V19.0419C15.3101 19.0417 15.3136 19.0415 15.3171 19.0412C16.3318 18.9701 17.2437 18.4075 17.5866 17.6413C17.836 17.0836 17.7533 16.4927 17.3538 15.9773ZM15.3066 15.5567V18.4783C16.0963 18.4138 16.8201 17.978 17.0734 17.4117C17.2365 17.0472 17.1798 16.6703 16.9095 16.3217C16.6308 15.962 15.987 15.7464 15.3066 15.5567ZM12.9779 12.966C12.8148 13.3305 12.8714 13.7073 13.1416 14.0559C13.4207 14.4154 14.0642 14.6309 14.7445 14.8206V11.8993C13.9549 11.964 13.2312 12.3998 12.9779 12.966ZM11.6323 4.39647C12.0353 4.71281 12.6347 5.18363 13.1985 6.13412H16.8477C17.3983 5.17098 18.0136 4.54778 18.4276 4.12919C18.6582 3.89608 18.9451 3.60592 18.9304 3.50795C18.9274 3.48789 18.8901 3.37581 18.4512 3.14031C18.3517 3.08716 18.0145 3.00166 17.6241 2.90266C16.8011 2.69397 15.5574 2.37864 14.1119 1.79955C13.3576 1.49716 12.4832 2.01109 11.5131 3.32678L11.5074 3.33456C11.2791 3.64563 11.1775 3.8605 11.2057 3.97267C11.2336 4.08358 11.4095 4.22162 11.6323 4.39647ZM11.64 8.12321H18.4112C18.8986 8.12321 19.1168 7.76483 19.1168 7.40968C19.1168 7.05457 18.8986 6.69614 18.4112 6.69614H11.64C11.1526 6.69614 10.9344 7.05457 10.9344 7.40968C10.9344 7.76483 11.1525 8.12321 11.64 8.12321ZM8.73665 16.9367H8.31189C7.71115 17.4709 6.92063 17.7964 6.0552 17.7964C5.18972 17.7964 4.3999 17.4709 3.79934 16.9367H3.37381C2.08175 16.9367 1.03057 17.9873 1.03057 19.2786V22.2849H11.0799V19.2786C11.0799 17.9873 10.0287 16.9367 8.73665 16.9367Z",fill:"black"})})},803279:function(e,t,a){a.r(t),a.d(t,{default:function(){return ae}});var i=a(785893),l=a(937082),n=a(540480),r=a(232186),o=a(95442),s=a(298969),d=a(869320),c=a(667294),u=a(894036),m=a(665250),p=a(450905),h=a(254339),x=a(254675),v=a(730737),f=a(55198),g=a(659499),j=a(621629),T=a(729101),y=a(380224),C=a(383054),b=a(202302),I=a(459258),S=a(654902),w=a(718984),Z=a(716055),N=a(727484),E=a.n(N),k=a(811163),P=a(424270),A=a(762708),D=a(4538),M=a(137491),V=a(556143),R=a(809304),L=a(76517),z=a(859370),U=a(673442),O=a(331812),_=a(378380),H=a(92399),W=
1a(433299),Y=a(891444),F=a(757632),q=a(498029);function B(){let{NEXT_PUBLIC_LEADMANAGER_ENDPOINT:e}=(0,h.k)(),{post:t}=(0,p.m)(e+"/project-timesheets"),{data:a}=(0,W.useSession)(),i=(0,q.D)({mutationFn:async e=>{let i={organizationId:null==a?void 0:a["custom:organization_id"],organizationType:null==a?void 0:a["custom:organization_type"],...e,eventType:"SPLIT_TIMESHEET"},l=await t(i);if((null==l?void 0:l.code)==="TIMESHEET_CREATED")return l;throw Error("Error splitting timesheet")}}),l=async e=>{try{return await i.mutateAsync(e)}catch(e){return console.error("Network error:",e),null}};return{loading:i.isPending,error:i.error instanceof Error?i.error.message:"",splitProjectTimeSheet:l}}var G=a(287066);function K(){let{NEXT_PUBLIC_MEETANDNOTE_ENDPOINT:e}=(0,h.k)(),{data:t}=(0,W.useSession)(),a=(0,q.D)({mutationFn:async a=>{var i,l;let{file:n,filePath:r,eventSource:o}=a,s=new FormData,d=n.name||"file",c=d.includes(".")&&null!==(l=d.split(".").pop())&&void 0!==l?l:"";return s.append("file",n,d),s.append("fileExtension",c),s.append("filePath",r),s.append("eventType","ADD_MEDIA"),s.append("eventSource",o),(null===(i=(await G.Z.post(e+"/upload",s,{headers:{"Content-Type":"multipart/form-data",Authorization:"Bearer ".concat(null==t?void 0:t.IdToken)}})).data.body[0])||void 0===i?void 0:i.uri)||null},onError:e=>{console.error("Error uploading file to S3:",e)}}),i=async function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"TIMESHEETS";try{return await a.mutateAsync({file:e,filePath:t,eventSource:i})}catch(e){return null}};return{isUploading:a.isPending,uploadAttachment:i}}var $=a(280779),Q=a(567421),J=a(420428),X=a(504697),ee=a(612698),et=a(727790),ea=a(100123),ei=a(17237),el=a(555570),en=a(695513),er=a(535780),eo=a(573208),es=a(236422);let ed=e=>{switch(e){case"CLOCKED_IN":case"CLOCKED_OUT":case"CLOCKED_OUT_OUTSIDE_LOCATION":return e;case"CLOCK_IN_CLOCK_OUT":return"CLOCKED_OUT";default:return null}};var ec=e=>{let{open:t,handleClose:a,timesheet:n,editTimeSheet:r,scope:m="project",onTimesheetChanged:p}=e,h="organization"===m,{usersData:x,refetchUsers:f,isUsersFetching:g}=(0,l.h)(),{t:j}=(0,Q.$G)(),{isCreator:C,isApprover:I}=(0,X.i)(),{localizationValue:S,toLocalizedDayjs:N,getCurrentLocalizedDay:E,startOfLocalizedDayTimestamp:k,buildLocalizedDateTime:P,dateFormat:q}=(0,v.Z)(),[G,ec]=(0,c.useState)(null),[eu,em]=(0,c.useState)(null),[ep,eh]=(0,c.useState)(null),[ex,ev]=(0,c.useState)(null),[ef,eg]=(0,c.useState)(""),[ej,eT]=(0,c.useState)(""),[ey,eC]=(0,c.useState)(""),[eb,eI]=(0,c.useState)(),[eS,ew]=(0,c.useState)(""),[eZ,eN]=(0,c.useState)(null),[eE,ek]=(0,c.useState)(null),[eP,eA]=(0,c.useState)(!1),[eD,eM]=(0,c.useState)(),[eV,eR]=(0,c.useState)(),eL=j("common.timePeriod.hr"),[ez,eU]=(0,c.useState)([]),[eO,e_]=(0,c.useState)([]),[eH,eW]=(0,c.useState)([]),[eY,eF]=(0,c.useState)([]),[eq,eB]=(0,c.useState)(!1),[eG,eK]=(0,c.useState)({}),[e$,eQ]=(0,c.useState)(),{splitProjectTimeSheet:eJ,loading:eX}=B(),{projectSplits:e0,projectNames:e1,projectNamesLoading:e2,refetchProjectNames:e5,projectNamesFetching:e6,handleAddProjectSplit:e4,handleRemoveProjectSplit:e3,handleProjectSplitChange:e8,getProjectSplitPayload:e7,validateProjectSplits:e9,hydrateProjectSplits:te}=(0,en.D)(h,N),tt=C&&!I,ta=tt?j("common.request",{defaultValue:"Request"}):j("common.update"),ti=e=>{if(null==e||""===e)return null;let t=Number(e);if(!Number.isFinite(t))return null;if(t>=0&&t<1440)return t;let a=N(t);return a?60*a.hour()+a.minute():null},tl=e=>(e||[]).map(e=>{var t,a;return{projectId:(null==e?void 0:e.projectId)||"",scheduleId:(null==e?void 0:null===(t=e.linkedSchedule)||void 0===t?void 0:t.scheduleId)||(null==e?void 0:e.scheduleId)||"",scheduleName:(null==e?void 0:null===(a=e.linkedSchedule)||void 0===a?void 0:a.scheduleName)||(null==e?void 0:e.scheduleName)||"",chargeabilityType:(null==e?void 0:e.chargeabilityType)||"",startTime:ti(null==e?void 0:e.startTime),endTime:ti(null==e?void 0:e.endTime)}}),{leadData:tn}=(0,H.qD)(),{data:tr}=(0,W.useSession)(),to={projectId:null==tn?void 0:tn.projectId,mode:"DAY",startDate:G,organizationUserId:null==eD?void 0:eD.userId},{data:ts,isLoading:td,refetch:tc}=(0,J.Ok)(to,h||!(null==eD?void 0:eD.userId)||!G),tu=(0,c.useMemo)(()=>{let e=(ts||[]).filter(e=>{var t;if(!(null==eD?void 0:eD.userId))return!0;let a=null===(t=e.workers)||void 0===t?void 0:t.find(e=>e.organizationUserId===eD.userId);return!a||!a.attendanceRecords||0===a.attendanceRecords.length||a.attendanceRecords.some(e=>"ABSENT"===e.shiftWorkerStatus)});return eE&&!e.some(e=>e.generatedShiftId===eE.generatedShiftId)?[eE,...e]:e},[ts,null==eD?void 0:eD.userId,eE]);(0,c.useEffect)(()=>{!h&&(null==eD?void 0:eD.userId)&&G&&tc()},[h,null==eD?void 0:eD.userId]);let{uploadAttachment:tm}=K(),tp=(0,c.useMemo)(()=>(null==eD?void 0:eD.userId)&&!x.some(e=>e.userId===eD.userId)?[...x,eD]:x,[eD,x]);(0,c.useEffect)(()=>
1{if(S){var e;let t=null!==(e=(0,T.LY)(S,"CURRENCY","SYMBOL"))&&void 0!==e?e:"";t&&eQ(t)}},[S]);let th=null!==eu&&null!==ep&&ep<eu,tx=e=>{if(null==e||""===e)return null;if("number"==typeof e&&Number.isFinite(e))return e;if("string"==typeof e){let t=e.trim();if(!t)return null;if(/^\d+$/.test(t)){let e=Number(t);return Number.isFinite(e)?e:null}}let t=N(e);return t?t.valueOf():null},tv=async()=>{var e,t,i,l,o,s;if(eA(!0),!G||null===ep||null===eu||!eD||!h&&!eS){Y.Am.error(j("toast.pleaseFillAllTheMandatoryFields")),eA(!1);return}let d=ez.reduce((e,t)=>e+(t.durationValue?Number(t.durationValue):0),0),c=null!=ex?ex:0,u=Math.min(d,c),m=Math.max(c-u,0),x=tl(e0),v=tl(null==n?void 0:n.projectSplits),f=JSON.stringify(x)!==JSON.stringify(v),g=G?k(G):null;if(eu===ep){Y.Am.error(j("timeTracking.sameStartAndEndTimeNotAllowed",{defaultValue:"Start time and end time cannot be the same"})),eA(!1);return}let T=(0,er.WB)({baseDate:G,minutes:eu,buildLocalizedDateTime:P}),y=(0,er.WB)({baseDate:G,minutes:ep,buildLocalizedDateTime:P,shouldAdvanceDay:th}),C=(0,er.W5)({breakTimes:ez,workingStartTime:T,workingEndTime:y});if(!C.isValid){"sameTime"===C.reason?Y.Am.error(j("timeTracking.breakTimeSameStartAndEndNotAllowed",{defaultValue:"Break start time and end time cannot be the same"})):"outsideWorkingHours"===C.reason?Y.Am.error(j("timeTracking.breakTimeWithinWorkingHours",{defaultValue:"Break time must be within working hours"})):Y.Am.error(j("toast.pleaseFillAllTheMandatoryFields")),eA(!1);return}if(!e9(c,eu,ep)){eA(!1);return}let b=(null==n?void 0:n.userId)!==(null==eD?void 0:eD.userId)||(null==n?void 0:n.date)!==g,I=((null==n?void 0:n.projectSplits)||[]).reduce((e,t)=>{if(!(null==t?void 0:t.isConvertedToExpense))return e;let a=Number(t.totalTimeLogged);if(Number.isFinite(a))return e+a;let i=Number(t.startTime),l=Number(t.endTime);return Number.isFinite(i)&&Number.isFinite(l)?e+Math.max(l-i,0):e},0);if(h&&c<I){Y.Am.error(j("timeTracking.organizationTimesheetDurationBelowConvertedSplits")),eA(!1);return}let S=[];eY&&eY.length>0&&(S=await tg()||[]);let w=[...eO,...S],Z=ej!==ey,N=S.length>0||w.length!==eH.length||w.some((e,t)=>e!==eH[t]),E=ed(n.status),A={timesheetId:n.timesheetId,organizationId:null==tr?void 0:tr["custom:organization_id"],organizationType:null==tr?void 0:tr["custom:organization_type"],...h?{}:{projectId:null==tn?void 0:tn.projectId,leadId:null==tn?void 0:null===(e=tn.lead)||void 0===e?void 0:e.leadId,chargeabilityType:eS,scheduleId:(null==eZ?void 0:eZ.scheduleId)||null,scheduleName:(null==eZ?void 0:eZ.scheduleName)||null},userId:eD.userId,username:eD.name,date:g,startTime:T,endTime:y,totalTimeLogged:c,totalBreakTime:u,totalProductiveTime:m,...Z?{description:ej}:{},workType:eb,workTypeId:null,costRate:eV?Number(eV):null,costType:eL,...N?{attachments:w}:{},...!h&&{isConvertedToExpense:!!n.isConvertedToExpense,billsAndExpensesId:null!==(t=n.billsAndExpensesId)&&void 0!==t?t:null},status:null!=E?E:"MANUALLY_EDITED",...h?{}:{generatedShiftId:null!==(i=null==eE?void 0:eE.generatedShiftId)&&void 0!==i?i:null,shiftId:null!==(l=null==eE?void 0:eE.shiftId)&&void 0!==l?l:null,shiftName:null!==(s=null!==(o=null==eE?void 0:eE.shiftName)&&void 0!==o?o:null==eE?void 0:eE.generatedShift
1Name)&&void 0!==s?s:null},userBreakTimesByProjectTimeSheet:ez.map(e=>({breakTimeId:e.breakTimeId,startTime:e.startTime,endTime:e.endTime,duration:e.duration,durationValue:e.durationValue}))};try{let e=await r(A);if(e&&h&&(f||b)){let{description:e,attachments:t,...a}=A,i=await eJ({...a,sourceOrganizationTimesheetId:n.timesheetId,status:null!=E?E:"MANUALLY_CREATED",splits:e7(g,P)});(null==i?void 0:i.code)!=="TIMESHEET_CREATED"&&e0.length>0&&Y.Am.warning(j("timeTracking.timesheetUpdatedButSplitError",{defaultValue:"Timesheet updated but failed to create project split"}))}e&&(await (null==p?void 0:p()),Y.Am.success(j("toast.timesheetUpdatedSuccessfully")),a())}catch(e){console.error("Error updating timesheet:",e),Y.Am.error(j("toast.somethingWentWrong"))}finally{eA(!1)}},tf=e=>"string"!=typeof e?"":e.replace(/^"|"$/g,"").replace(/\\/g,"").trim(),tg=async()=>{let e=[],t={};if(eY&&eY.length>0)try{for(let a of eY){let i=h?"".concat(null==tr?void 0:tr["custom:organization_id"],"/").concat(null==tr?void 0:tr["custom:organization_type"],"/TIMESHEETS/organization/").concat(n.timesheetId):"".concat(null==tr?void 0:tr["custom:organization_id"],"/").concat(null==tr?void 0:tr["custom:organization_type"],"/TIMESHEETS/projectId=").concat(null==tn?void 0:tn.projectId,"/").concat(n.timesheetId),l=await tm(a,i,"TASKS");if(l){let i=tf(l);e.push(i),t[i]=URL.createObjectURL(a)}}return eK(e=>({...e,...t})),e}catch(e){console.error("Error uploading files to S3:",e)}return[]},tj=e=>{eU(ez.filter((t,a)=>a!==e))},tT=(e,t)=>{eU(a=>a.map(a=>a.breakTimeId===e?(()=>{let e=(0,er.Us)({value:t,referenceMinutes:eu,date:G,isNightShift:th,getCurrentLocalizedDay:E,buildLocalizedDateTime:P}),i=(0,er.vC)(e,a.endTime);return{...a,startTime:e,duration:null!==i?(0,er.LU)(i):null,durationValue:i}})():a))},ty=(e,t)=>{eU(a=>a.map(a=>a.breakTimeId===e?(()=>{var e;let i=null!==(e=(0,er.vy)({timestamp:a.startTime,toLocalizedDayjs:N}))&&void 0!==e?e:eu,l=(0,er.Us)({value:t,referenceMinutes:i,date:G,isNightShift:th,getCurrentLocalizedDay:E,buildLocalizedDateTime:P}),n=(0,er.vC)(a.startTime,l);return null!==n&&null!==a.startTime&&(l=a.startTime+n),{...a,endTime:l,duration:null!==n?(0,er.LU)(n):null,durationValue:n}})():a))},tC=(e,t)=>{let a=(0,er.VX)(e,t);ev(a.duration),eg(a.durationText)};(0,c.useEffect)(()=>{tC(eu,ep)},[eu,ep]),(0,c.useEffect)(()=>{G&&ez.length>0&&eU(e=>(0,er.bi)({breakItems:e,nextDate:G,startMinutes:eu,isNightShift:th,toLocalizedDayjs:N,buildLocalizedDateTime:P}))},[G,eu,th]),(0,c.useEffect)(()=>{0!==ez.length&&eU(e=>{let t=!1,a=e.map(e=>{let a=(0,er.vC)(e.startTime,e.endTime),i=null!==a?(0,er.LU)(a):null;return e.durationValue!==a||e.duration!==i?(t=!0,{...e,duration:i,durationValue:a}):e});return t?a:e})},[ez]),(0,c.useEffect)(()=>{if(n){var e,t;let a=tx(n.date);ec(null!==a?k(a):null);let i=tx(n.startTime),l=tx(n.endTime),r=null!==i?N(i):null,o=null!==l?N(l):null;em(r?60*r.hour()+r.minute():null),eh(o?60*o.hour()+o.minute():null),ev(Number(n.totalTimeLogged)||0),eg((0,er.LU)(Number(n.totalTimeLogged)||0)||"");let s=n.description||"";eT(s),eC(s),eI(n.workType||""),ew(n.chargeabilityType||""),eN(n.scheduleId?{scheduleId:n.scheduleId,scheduleName:n.scheduleName||"",projectId:n.projectId,projectName:n.projectName||null,parentId:null,scheduleStartDate:0,scheduleEndDate:0,scheduleDuration:0,isMilestone:!1,isPhase:!1,isCompleted:!1,isPaused:!1}:null),eR(null!==(e=n.costRate)&&void 0!==e?e:""),ek(n.generatedShiftId?{generatedShiftId:n.generatedShiftId,shiftId:n.shiftId,shiftName:n.shiftName,generatedShift
1Name:n.shiftName,workers:[]}:null),eM(null!==(t=x.find(e=>e.userId===n.userId))&&void 0!==t?t:n.userId?{userId:n.userId,name:n.username||n.userId}:void 0),n.userBreakTimesByProjectTimeSheet&&eU(n.userBreakTimesByProjectTimeSheet.map(e=>({breakTimeId:e.breakTimeId,startTime:tx(e.startTime),endTime:tx(e.endTime),duration:(0,er.LU)((tx(e.endTime)||0)-(tx(e.startTime)||0)),durationValue:(tx(e.endTime)||0)-(tx(e.startTime)||0)}))),te(n.projectSplits)}},[n,x]);let tb=e=>{if(!e)return"";try{return new URL(e).pathname}catch(t){return e.split("?")[0].split("#")[0]}},tI=e=>{var t;return"pdf"===(null===(t=tb(e).split(".").pop())||void 0===t?void 0:t.toLowerCase())?"pdf":"image"},tS=e=>tb(e).split("/").pop()||"file",tw=async e=>{try{let t=eG[e]||e,a=await fetch(t),i=await a.blob(),l=window.URL.createObjectURL(i),n=document.createElement("a");n.href=l,n.download=tS(e),document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(l)}catch(e){console.error("Error downloading file:",e),Y.Am.error(j("toast.failedToDownloadFile"))}};(0,c.useEffect)(()=>{if(null==n?void 0:n.attachments)try{let e=[];"string"==typeof n.attachments?e=n.attachments.replace(/[{}]/g,"").split(",").map(e=>tf(e)).filter(e=>e&&e.length>0):Array.isArray(n.attachments)?e=n.attachments.map(e=>tf(e)).filter(e=>e&&e.length>0):"object"==typeof n.attachments&&(e=Object.values(n.attachments).map(e=>tf(e)).filter(e=>e&&e.length>0)),e_(e),eW(e)}catch(e){console.error("Error parsing attachments:",e),e_([]),eW([])}else e_([]),eW([])},[null==n?void 0:n.attachments]);let tZ=async()=>{if(eY&&0!==eY.length){eB(!0);try{let e=await tg();if(e.length>0){let t=[...eO,...e];e_(t),eF([])}}catch(e){console.error("Error updating attachments:",e),Y.Am.error(j("toast.failedToUploadAttachments"))}finally{eB(!1)}}};(0,c.useEffect)(()=>{eY&&tZ()},[eY]);let tN=e=>{e_(eO.filter(t=>t!==e))};return(0,y.Z)(),(0,i.jsx)("div",{children:(0,i.jsx)(A.Z,{open:t,onClose:a,children:(0,i.jsx)(D.Z,{direction:"left",in:t,mountOnEnter:!0,unmountOnExit:!0,children:(0,i.jsxs)(o.Z,{sx:{position:"absolute",top:"0",right:"0",width:"80vw",height:"100vh",bgcolor:"background.paper",boxShadow:24,overflowY:"scroll"},className:"boqUI prodandserviceUI",children:[(0,i.jsxs)(o.Z,{sx:{position:"sticky",top:0,zIndex:1e3,bgcolor:"#fff"},children:[(0,i.jsxs)("div",{className:"d-flex justify-content-between my-1",children:[(0,i.jsx)("div",{style:{fontSize:"20px",display:"flex",alignItems:"center"},children:(0,i.jsx)(s.Z,{onClick:a,children:(0,i.jsx)(U.Z,{style:{width:"20px",height:"20px",fill:"#ccc"}})})}),(0,i.jsx)(u.r,{title:j("timeTracking.updateTimeSheet")}),(0,i.jsx)(O.Z,{loading:eP||eX,variant:"contained",className:"btnPrimaryUI",sx:{maxWidth:"100px"},onClick:tv,children:ta})]}),(0,i.jsx)(b.Z,{className:"mt-2 mb-0"})]}),(0,i.jsx)(o.Z,{className:"p-2 pt-0",children:(0,i.jsx)(o.Z,{sx:{backgroundColor:"background.subtle",p:2,pb:3,boxSizing:"border-box"},children:(0,i.jsxs)(o.Z,{component:"section",id:"product information",children:[(0,i.jsxs)(M.ZP,{container:!0,spacing:2,children:[(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsxs)(_.Z,{className:"fw-500 mb-1",children:[j("common.user.one")," ",(0,i.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),tt?(0,i.jsx)(w.Z,{disableClearable:!0,disabled:!0,options:tp.map(e=>({value:e.userId,label:e.name})),value:eD?eD.userId:""}):(0,i.jsx)(ea.Z,{disableClearable:!0,options:tp.map(e=>({value:e.userId,label:e.name}
1)),value:eD?eD.userId:"",onChange:e=>{let t=x.find(t=>t.userId===e);e!==(null==eD?void 0:eD.userId)&&ek(null),eM(t)},isAddNewItem:!0,addItemText:j("common.addNewWithLabel",{label:j("common.user.one")}),onAddItem:e=>(0,ei.H2)(e),onReload:()=>void f(),reloading:g,reloadAriaLabel:j("common.reloadUsers"),showSelectedInList:!0})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsxs)(_.Z,{className:"fw-500 mb-1",children:[j("common.date")," ",(0,i.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,i.jsx)(o.Z,{sx:{position:"relative",width:"100%"},children:(0,i.jsx)(et.AN,{sx:{width:"100%"},slotProps:{textField:{variant:"outlined",fullWidth:!0}},value:G?N(G):null,onChange:e=>{if(e){let t=k(e);t!==G&&ek(null),ec(t),eU(e=>(0,er.bi)({breakItems:e,nextDate:t,startMinutes:eu,isNightShift:th,toLocalizedDayjs:N,buildLocalizedDateTime:P}))}else ec(null),ek(null)},maxDate:E()})})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsxs)(_.Z,{className:"fw-500 mb-1",children:[j("common.startTime")," ",(0,i.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,i.jsx)(et.nH,{value:(0,er.d4)({minutes:eu,date:G,toLocalizedDayjs:N,getCurrentLocalizedDay:E}),onChange:e=>{if(e&&e.isValid()){let t=(0,er.aQ)(e);em(t),eU(e=>(0,er.bi)({breakItems:e,nextDate:G,startMinutes:t,isNightShift:th,toLocalizedDayjs:N,buildLocalizedDateTime:P}))}else em(null)}})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsxs)(_.Z,{className:"fw-500 mb-1",children:[j("common.endTime")," ",(0,i.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,i.jsx)(et.nH,{value:(0,er.d4)({minutes:ep,date:G,toLocalizedDayjs:N,getCurrentLocalizedDay:E}),onChange:e=>
1{e&&e.isValid()?eh((0,er.aQ)(e)):eh(null)}}),th&&(0,i.jsx)(d.Z,{variant:"caption",sx:{color:"primary.main",mt:.5},children:"".concat(j("common.endsOn")," ").concat((0,er.cN)({date:G,toLocalizedDayjs:N,dateFormat:q}))})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsx)(_.Z,{className:"fw-500 mb-1",children:j("common.duration")}),(0,i.jsx)(V.Z,{value:ef,onChange:e=>{eg(e.target.value)},onBlur:()=>{let e=(0,er.Le)(ef);if(null===e){tC(eu,ep);return}ev(e),eg((0,er.LU)(e)||""),null!==eu&&eh((eu+Math.floor(e/6e4))%1440)},placeholder:"0h0m",fullWidth:!0,disabled:null===eu})]})})]}),!h&&(0,i.jsxs)(M.ZP,{container:!0,spacing:2,sx:{mt:0},children:[(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsx)(_.Z,{className:"fw-500 mb-1",children:j("workerManagement.linkedShift")}),(0,i.jsx)(w.Z,{options:td?[]:tu.map(e=>({value:e.generatedShiftId,label:e.generatedShiftName||e.shiftName})),value:eE?eE.generatedShiftId:"",onChange:e=>{ek(tu.find(t=>t.generatedShiftId===e)||null)},disabled:td||!(null==eD?void 0:eD.userId),isLoading:td,placeholder:(null==eD?void 0:eD.userId)?td?j("common.loading",{defaultValue:"Loading..."}):tu.length>0?void 0:ts&&ts.length>0?j("timeTracking.allShiftsHaveTimeTracking",{defaultValue:"All available shifts already have time tracking for this user"}):j("common.noDataFound",{defaultValue:"No shifts found"}):j("workerManagement.noLinkedShift")})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsx)(es.Z,{organizationId:null==tr?void 0:tr["custom:organization_id"],projectId:null==tn?void 0:tn.projectId,value:eZ,onChange:eN,preload:!0})})]}),(0,i.jsxs)(M.ZP,{container:!0,columnSpacing:2,rowSpacing:.5,children:[ez.length>0&&(0,i.jsx)(M.ZP,{item:!0,xs:12,children:(0,i.jsx)(d.Z,{className:"mt-2 mb-1 fs-7 fw-500",sx:{color:"black"},children:j("common.break")})}),ez.map((e,t)=>(0,i.jsx)(M.ZP,{item:!0,xs:12,children:(0,i.jsxs)(M.ZP,{container:!0,columnSpacing:2,rowSpacing:1,alignItems:"flex-end",children:[(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsxs)(d.Z,{variant:"caption",className:"mb-1",children:[j("common.startTime")," ",(0,i.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,i.jsx)(et.nH,{value:e.startTime?N(e.startTime):null,onChange:t=>tT(e.breakTimeId,t)})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsxs)(d.Z,{variant:"caption",className:"mb-1",children:[j("common.endTime")," ",(0,i.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,i.jsx)(et.nH,{value:e.endTime?N(e.endTime):null,onChange:t=>ty(e.breakTimeId,t)})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:3,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsx)(d.Z,{variant:"caption",className:"mb-1",children:j("timeTracking.breakDuration")}),(0,i.jsx)(V.Z,{value:(null==e?void 0:e.duration)||"",placeholder:"0h0m",fullWidth:!0,disabled:!0})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:1,sx:{display:"flex",alignItems:"flex-end",justifyContent:"flex-start",pt:{xs:.5,sm:0}},children:(0,i.jsx)(R.Z,{onClick:()=>tj(t),sx:{mt:0,mb:1,p:.5},children:(0,i.jsx)(U.Z,{width:"12px",height:"12px",fill:"red"})})})]})},e.breakTimeId)),(0,i.jsx)(M.ZP,{item:!0,xs:12,children:(0,i.jsx)(s.Z,{sx:{marginTop:0,marginLeft:0},startIcon:(0,i.jsx)(Z.pOD,{width:"15px",fill:"#3CA2FF"}),onClick:()=>{eU([...ez,{breakTimeId:(0,F.Z)(),startTime:null,endTime:null,duration:null,durationValue:null}])},children:j("timeTracking.addBreakTime")})})]}),(0,i.jsx)(el.Z,{visible:h,organizationId:null==tr?void 0:tr["custom:organization_id"],projectSplits:e0,projectNames:e1,projectNamesLoading:e2,date:G,parentStartTime:eu,parentEndTime:ep,toLocalizedDayjs:N,getCurrentLocalizedDay:E,onAdd:e4,onRemove:e3,onChange:e8,onReloadProjects:e5,projectsReloading:e6,titleClassName:"mb-1 fs-7 fw-500",showLinkedShift:!0,shiftUserId:null==eD?void 0:eD.userId}),(0,i.jsxs)(M.ZP,{container:!0,spacing:2,children:[!h&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsx)(_.Z,{className:"fw-500 mb-1",children:j("timeTracking.workType")}),(0,i.jsx)(V.Z,{fullWidth:!0,value:eb,onChange:e=>{eI(e.target.value)}})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsxs)(_.Z,{className:"fw-500 mb-1",children:[j("timeTracking.chargeability",{defaultValue:"Chargeability"})," ",(0,i.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,i.jsx)(w.Z,{required:!0,options:eo.s.map(e=>({value:e.value,label:j("timeTracking.".concat(e.translationKey))})),value:eS,placeholder:j("timeTracking.selectChargeability",{defaultValue:"Select chargeability"}),onChange:e=>ew(e||"")})]})})]}),(0,i.jsxs)(M.ZP,{item:!0,xs:12,children:[(0,i.jsx)(d.Z,{variant:"body1",sx:{fontWeight:500,mb:1},children:j("timeTracking.wageBreakdown",{defaultValue:"Wage Breakdown"})}),(0,i.jsx)(M.ZP,{container:!0,spacing:2,children:[{label:j("timeTracking.regularWage",{defaultValue:"Regular Wage"}),value:null==n?void 0:n.regularWage},{label:j("timeTracking.overtimeWage",{defaultValue:"Overtime Wage"}),value:null==n?void 0:n.overtimeWage},{label:j("timeTracking.totalWage",{defaultValue:"Total Wage"}),value:null==n?void 0:n.wage}].map(e=>(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsx)(_.Z,{className:"fw-500 mb-1",children:e.label}),(0,i.jsx)(V.Z,{fullWidth:!0,disabled:!0,value:null===e.value||void 0===e.value||""===e.value?"--":(0,ee.QV)(Number(e.value),2),InputProps:{startAdornment:null===e.value||void 0===e.value||""===e.value?void 0:(0,i.jsx)(L.Z,{position:"start",className:"mr-2",children:e$})}})]})},e.label))})]})]}),(0,i.jsxs)(M.ZP,{container:!0,spacing:2,sx:{mt:0},children:[(0,i.jsx)(M.ZP,{item:!0,xs:12,children:(0,i.jsx)(V.Z,{multiline:!0,sx:{width:"100%",border:"none",height:"120px","& .MuiInputBase-root":{height:"100%","& .MuiInputBase-input":{height:"100% !important",overflow:"auto !important"}}},variant:"outlined",InputProps:{disableUnderline:!0}
1,placeholder:j("common.description"),onChange:e=>eT(e.target.value),value:ej})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,children:(0,i.jsx)(d.Z,{className:"fs-7 fw-500",sx:{color:"black"},children:j("common.attachments")})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,children:(0,i.jsx)(o.Z,{children:(0,i.jsxs)(o.Z,{sx:{display:"grid",gridTemplateColumns:"repeat(2, 100px)",gap:2},children:[null==eO?void 0:eO.map((e,t)=>(0,i.jsxs)(o.Z,{sx:{width:"100px",height:"100px",border:"3px dashed #ccc",borderRadius:"8px",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"#fff","&:hover":{borderColor:"#32acff"}},children:[(0,i.jsx)(R.Z,{sx:{position:"absolute",top:"8px",right:"8px",bgcolor:"white",padding:"4px","&:hover":{bgcolor:"white"}},onClick:()=>tN(e),children:(0,i.jsx)(U.Z,{style:{width:"12px"},fill:"red"})}),"image"===tI(e)?(0,i.jsx)("img",{src:eG[e]||e,alt:"Attachment ".concat(t+1),style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"4px"}}):(0,i.jsx)($.Z,{sx:{fontSize:40,color:"#d32f2f"}}),(0,i.jsx)(R.Z,{sx:{position:"absolute",bottom:"8px",right:"8px",bgcolor:"white",padding:"4px","&:hover":{bgcolor:"white"}},onClick:()=>tw(e),children:(0,i.jsx)(Z._8t,{style:{width:"16px"}})})]},t)),eO.length<4&&(0,i.jsxs)(o.Z,{sx:{width:"100px",height:"100px",border:"3px dashed #ccc",borderRadius:"8px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",bgcolor:"#fff",position:"relative","&:hover":{borderColor:"#32acff"}},children:[(0,i.jsx)("input",{type:"file",id:"file-upload",multiple:!0,accept:"image/*,.pdf",style:{position:"absolute",width:"100%",height:"100%",opacity:0,cursor:"pointer"},onChange:e=>{e.target.files&&eF(Array.from(e.target.files))}}),eq?(0,i.jsx)(z.Z,{size:24}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Z.fW1,{style:{width:"41px",height:"41px"}}),(0,i.jsx)(d.Z,{variant:"body2",sx:{color:"#666",fontSize:"12px",textAlign:"center",mt:1},children:j("common.uploadAttachment")}),(0,i.jsx)(d.Z,{variant:"caption",sx:{color:"gray",fontSize:"10px",textAlign:"center"}})]})]})]})})})]})]})})})]})})})})},eu=a(671897),em=a(781143),ep=a(346763),eh=a(936190),ex=a(510285),ev=a.n(ex),ef=a(346291),eg=a(816441),ej=a(501083),eT=a(113736),ey=a(345045),eC=a(298569),eb=a(974887),eI=a(736153);let eS=e=>(null==e?void 0:e.status)==="CLOCKED_IN"||(null==e?void 0:e.endTime)===null||(null==e?void 0:e.endTime)===void 0||(null==e?void 0:e.endTime)==="",ew=e=>(null==e?void 0:e.approvalStatus)==="PENDING_APPROVAL"&&!eS(e),eZ=e=>{let t=null!==e.totalTimeLogged&&void 0!==e.totalTimeLogged&&""!==e.totalTimeLogged,a=Number(e.totalTimeLogged);if(t&&Number.isFinite(a)&&a>=0)return(0,T.Ii)(a);let i=null!==e.hours&&void 0!==e.hours&&""!==e.hours,l=Number(e.hours);return i&&Number.isFinite(l)&&l>=0?(0,T.Ii)(36e5*l):"-"},eN=e=>{let t=null!==e.overtimeDuration&&void 0!==e.overtimeDuration&&""!==e.overtimeDuration,a=Number(e.overtimeDuration);return t&&Number.isFinite(a)&&a>=0?(0,T.Ii)(a):"-"};function eE(e){let{projectSplits:t,parentDate:a,parentUserName:l,isApprover:n,pendingAction:s,formatTime:u,formatWage:m,onApprovalAction:p}=e,{t:h}=(0,Q.$G)(),x=(0,y.Z)(),[v,f]=(0,c.useState)(null),g=n?[{key:"approve",label:h("common.approve",{defaultValue:"Approve"}),icon:(0,i.jsx)(ef.Z,{sx:{fontSize:"18px",color:"success.main"}}),condition:e=>ew(e),loading:e=>(null==s?void 0:s.timesheetId)===(null==e?void 0:e.timesheetId)&&(null==s?void 0:s.action)==="approve"},{key:"reject",label:h("common.reject",{defaultValue:"Reject"}),icon:(0,i.jsx)(eg.Z,{sx:{fontSize:"18px",color:"error.main"}}),condition:e=>ew(e),loading:e=>(null==s?void 0:s.timesheetId)===(null==e?void 0:e.timesheetId)&&(null==s?void 0:s.action)==="reject"}]:[],{menuState:j,openMenu:C,closeMenu:b}=(0,ey.w8)(t,g),I={borderRadius:0,backgroundColor:x.palette.primary.main,border:"none",padding:0,color:x.palette.common.white,margin:0},S=e=>null==e||""===e?"-":m(e);return(0,i.jsx)(i.Fragment,{children:t.map((e,t)=>{var n,s,c,m;let x=null!==(n=e.timesheetId)&&void 0!==n?n:"",y=e.projectName||"-";return(0,i.jsxs)(eb.Z,{sx:{position:"relative","& .MuiTableCell-root":{bgcolor:"background.default",py:2}},onMouseEnter:()=>f(t),onMouseLeave:()=>f(null),children:[(0,i.jsx)(eI.Z,{children:a}),(0,i.jsx)(eI.Z,{children:l}),(0,i.jsx)(eI.Z,{children:(0,i.jsx)(r.Z,{title:y,enterDelay:500,children:(0,i.jsx)(d.Z,{variant:"body2",noWrap:!0,children:y})})}),(0,i.jsx)(eI.Z,{children:null!==(s=u(e.startTime))&&void 0!==s?s:"-"}),(0,i.jsx)(eI.Z,{children:null!==(c=u(e.endTime))&&void 0!==c?c:h("common.onGoing")}),(0,i.jsx)(eI.Z,{children:eZ(e)}),(0,i.jsx)(eI.Z,{children:eN(e)}),(0,i.jsx)(eI.Z,{children:S(e.regularWage)}),(0,i.jsx)(eI.Z,{children:S(e.overtimeWage)}),(0,i.jsx)(eI.Z,{children:S(e.wage)}),(0,i.jsx)(eI.Z,{children:e.status?h("timeTracking.".concat(e.status),{defaultValue:(0,T.C8)(e.status)}):"-"}),(0,i.jsx)(eI.Z,{children:(0,i.jsx)(o.Z,{component:"span",sx:{color:"APPROVED"===e.approvalStatus?"success.main":"PENDING_APPROVAL"===e.approvalStatus?"warning.main":"REJECTED"===e.approvalStatus?"error.main":"text.primary",fontWeight:500},children:e.approvalStatus?(0,T.C8)(e.approvalStatus):"-"})}),(0,i.jsx)(eI.Z,{sx:{position:"sticky",right:0,zIndex:2,width:24,minWidth:24,maxWidth:24,p:0,bgcolor:"background.default"},children:(0,i.jsx)(eC.F,{row:e,index:t,isHovered:v===t,isMenuActive:j.rowIndex===t,menuState:j,actionItems:g,buttonStyle:I,onOpen:C,onClose:b,onRowAction:t=>{("approve"===t||"reject"===t)&&p(t,e)}})})]},x||"".concat(null!==(m=e.projectId)&&void 0!==m?m:"project-split","-").concat(t))})})}E().extend(ev());let ek=e=>Array.from(new Set([e,e.replace(/Y{4}/g,"YY"),"DD/MM/YYYY","DD/MM/YY","MM/DD/YYYY","MM/DD/YY","YYYY-MM-DD","YY-MM-DD"])),eP=e=>e.year()>=1900&&2100>=e.year(),eA=[{paymentMethodId:(0,F.Z)(),paymentName:"CASH"},{paymentMethodId:(0,F.Z)(),paymentName:"CHEQUE"},{paymentMethodId:(0,F.Z)(),paymentName:"BANK_TRANSFER"}],eD=e=>{if(null==e||""===e)return null;if("number"==typeof e&&Number.isFinite(e))return e;if("string"==typeof e){let t=e.trim();if(!t)return null;if(/^\d+$/.test(t)){let e=Number(t);return Number.isFinite(e)?e:null}let a=E()(t);return a.isValid()?a.valueOf():null}if("object"==typeof e){if("function"==typeof e.valueOf){let t=e.valueOf();if("number"==typeof t&&Number.isFinite(t))return t}if("$d"in e){let t=E()(e.$d);return t.isValid()?t.valueOf():null}}return null},eM=e=>(null==e?void 0:e.status)==="PENDING_REQUEST"||(null==e?void 0:e.approvalStatus)==="PENDING_REQUEST"||(null==e?void 0:e.approvalStatus)==="PENDING_APPROVAL",eV=e=>!!(null==e?void 0:e.shiftId),eR=e=>eV(e)?"This timesheet is linked to a shift; its wage is already tracked in Worker Management and cannot be converted to an expense here.":(null==e?void 0:e.approvalStatus)==="PENDING_REQUEST"||(null==e?void 0:e.status)==="PENDING_REQUEST"?"Convert to Expense is disabled 
1while the timesheet is pending request.":(null==e?void 0:e.approvalStatus)==="PENDING_APPROVAL"?"Convert to Expense is disabled until the timesheet is approved.":"";var eL=e=>{var t,a,l,n,r,N,A,D,M,V,R,L,z;let{loading:U,timeSheets:_,deleteTimeSheet:q,editTimeSheet:B,scope:G="project",setCurrentPage:K,setRowsPerPage:$,onTimesheetChanged:J,editProjectTimeSheet:ee}=e,et="organization"===G,[ea,ei]=(0,c.useState)(!1),{popup:el}=(0,m.R)(),{leadData:en}=(0,H.qD)(),{data:er}=(0,W.useSession)(),{isApprover:eo}=(0,X.i)(),{localizationValue:es}=(0,x.W)(),ex=null!=es?es:[],{toLocalizedDayjs:ev,dateFormat:ey}=(0,v.Z)(),[eC,eb]=(0,c.useState)(null),[eI,eS]=(0,c.useState)(null),[ew,eZ]=(0,c.useState)(!1),[eN,eL]=(0,c.useState)(()=>new Set),[ez,eU]=(0,c.useState)(null),{NEXT_PUBLIC_PAYMASTER_ENDPOINT:eO}=(0,h.k)(),{post:e_}=(0,p.m)(eO+"/bills-and-expenses"),[eH,eW]=(0,c.useState)(!1),{t:eY}=(0,Q.$G)(),eF=(0,y.Z)(),eq=e=>Array.isArray(null==e?void 0:e.projectSplits)&&e.projectSplits.some(e=>null==e?void 0:e.isConvertedToExpense),eB=e=>(null==e?void 0:e.approvalStatus)==="REJECTED",eG=e=>(null==e?void 0:e.status)==="CLOCKED_IN"||(null==e?void 0:e.endTime)===null||(null==e?void 0:e.endTime)===void 0||(null==e?void 0:e.endTime)==="",eK=e=>(null==e?void 0:e.approvalStatus)==="PENDING_APPROVAL"&&!eG(e),e$=e=>!!(null==e?void 0:e.isConvertedToExpense),eQ=e=>!!((null==e?void 0:e.isConvertedToExpense)||et&&eq(e)),eJ=e=>(null==e?void 0:e.isConvertedToExpense)?eY("timeTracking.timesheetConvertedToExpenseActionDisabled",{defaultValue:"This timesheet is already converted to expense."}):"",eX=e=>(null==e?void 0:e.isConvertedToExpense)?eY("timeTracking.timesheetConvertedToExpenseActionDisabled",{defaultValue:"This timesheet is already converted to expense."}):eq(e)?eY("timeTracking.organizationTimesheetHasConvertedProjectSplitActionDisabled",{defaultValue:"This organization timesheet has a project split already converted to expense."}):"",e0=e=>{let t=Number(e);return Number.isFinite(t)?String((0,T.Is)(ex,t,{isCurrency:!0})):"-"},e1=e=>{var t,a;return String(null!==(a=null!==(t=null==e?void 0:e.timesheetId)&&void 0!==t?t:null==e?void 0:e.organizationTimesheetId)&&void 0!==a?a:"")},e2=(0,k.useRouter)(),e5=(0,c.useRef)(null);(0,c.useEffect)(()=>{var e;if("TimeTracking"!==(Array.isArray(e2.query.tab)?e2.query.tab[0]:e2.query.tab)){e5.current=null;return}let t=Array.isArray(e2.query.timesheetId)?e2.query.timesheetId[0]:e2.query.timesheetId;if(!t){e5.current=null;return}if(e5.current===t)return;let a=(null!==(e=null==_?void 0:_.timesheets)&&void 0!==e?e:[]).find(e=>e1(e)===t);if(!a)return;e5.current=t,eb(a),ei(!0);let{timesheetId:i,...l}=e2.query;e2.replace({pathname:e2.pathname,query:l},void 0,{shallow:!0})},[e2,e2.query.tab,e2.query.timesheetId,_]);let e6=e=>{let t=e1(e);t&&Array.isArray(null==e?void 0:e.projectSplits)&&eL(e=>{let a=new Set(e);return a.has(t)?a.delete(t):a.add(t),a})};c.useEffect(()=>{if(!et)return;let e=new Set((Array.isArray(null==_?void 0:_.timesheets)?_.timesheets:[]).map(e=>{var t,a;return String(null!==(a=null!==(t=null==e?void 0:e.timesheetId)&&void 0!==t?t:null==e?void 0:e.organizationTimesheetId)&&void 0!==a?a:"")}).filter(Boolean));eL(t=>{let a=new Set([...t].filter(t=>e.has(t)));return a.size===t.size?t:a})},[et,null==_?void 0:_.timesheets]);let e4=async()=>{var e,t,a,i,l;eW(!0);let n=Number(null!==(i=null!==(a=null==eC?void 0:eC.wage)&&void 0!==a?a:null==eC?void 0:eC.costRate)&&void 0!==i?i:0);if(!n||!eI){Y.Am.error(eY("toast.timeSheetConvertToExpense")),eW(!1);return}let r={eventType:"CREATE_BILL_OR_EXPENSE",beId:(0,F.Z)(),...et?{}:{projectId:null==en?void 0:en.projectId,projectName:null==en?void 0:en.projectName,clientName:null==en?void 0:null===(e=en.lead)||void 0===e?void 0:e.leadName},organizationId:null==er?void 0:er["custom:organization_id"],entityType:"TIME_SHEET",entityId:null==eC?void 0:eC.timesheetId,entitySerial:"",totalAmount:n,dueDate:(null==eC?void 0:eC.date)?null==eC?void 0:eC.date:new Date().getTime(),modeOfPayment:null==eI?void 0:eI.paymentName,name:null==en?void 0:null===(t=en.lead)||void 0===t?void 0:t.leadName,receiverName:"",receiverId:"",receiverType:"",senderName:null==er?void 0:er.username,senderId:null==er?void 0:er["custom:organization_id"],senderType:null==er?void 0:er["custom:organization_type"],createdBy:null==er?void 0:er.username,status:"PAID"},o=await e_(r);if(eW(!1),eZ(!1),(null==o?void 0:o.code)==="BILL_OR_EXPENSE_CREATED"){let{attachments:e,description:t,userBreakTimesByProjectTimeSheet:a,userProjectTimesheetSchedules:i,...n}=eC;await B({...n,isConvertedToExpense:!0,billsAndExpensesId:null==o?void 0:null===(l=o.body)||void 0===l?void 0:l.beId})&&(null==J||J()),eS(null),Y.Am.success(eY("toast.expenseCreatedSuccessfully"))}},e3=[{key:"edit",label:eY("common.edit"),icon:(0,i.jsx)(P.Z,{style:{width:"15px",height:"15px",fill:"#000000"}}),condition:e=>(null==e?void 0:e.status)!=="CLOCKED_IN",disabled:e=>e$(e),disabledTooltip:e=>eJ(e)},{key:"delete",label:eY("common.delete"),icon:(0,i.jsx)(Z.pJl,{style:{width:"18px",height:"18px",fill:null==eF?void 0:null===(a=eF.palette)||void 0===a?void 0:null===(t=a.error)||void 0===t?void 0:t.main}}),condition:e=>(null==e?void 0:e.status)!=="CLOCKED_IN",disabled:e=>eQ(e),disabledTooltip:e=>eX(e)},...eo?[{key:"approve",label:eY("common.approve",{defaultValue:"Approve"}),icon:(0,i.jsx)(ef.Z,{sx:{fontSize:"18px",color:"success.main"}}),condition:e=>eK(e)},{key:"reject",label:eY("common.reject",{defaultValue:"Reject"}),icon:(0,i.jsx)(eg.Z,{sx:{fontSize:"18px",color:"error.main"}}),condition:e=>eK(e)}]:[],...et?[]:[{key:"convertExpense",label:eY("common.convertExpense"),icon:(0,i.jsx)(em.Z,{style:{width:"18px",height:"18px",fill:null==eF?void 0:null===(n=eF.palette)||void 0===n?void 0:null===(l=n.primary)||void 0===l?void 0:l.main}}),condition:e=>!(null==e?void 0:e.isConvertedToExpense)&&!eB(e),disabled:e=>eM(e)||eV(e),disabledTooltip:e=>eR(e)},{key:"expenseAlreadyConverted",label:eY("common.convertExpense"),icon:(0,i.jsx)(ep.Z,{style:{width:"18px",height:"18px",fill:null==eF?void 0:null===(N=eF.palette)||void 0===N?void 0:null===(r=N.success)||void 0===r?void 0:r.main}}),condition:e=>null==e?void 0:e.isConvertedToExpense}]],e8=()=>{eZ(!0)},e7=()=>{eZ(!1),eS(null)},e9=(e,t)=>
1{let a=t.timesheetId,l=t.projectId,n="approve"===e;if(eK(t)){if(!a||!l||!ee){Y.Am.error(eY("timeTracking.projectSplitApprovalUpdateFailed",{defaultValue:"Failed to update the project timesheet approval."}));return}el({content:(0,i.jsxs)(C.Z,{children:[(0,i.jsx)(f.fK,{children:(0,i.jsx)(u.r,{title:eY(n?"common.approve":"common.reject",{defaultValue:n?"Approve Timesheet":"Reject Timesheet"})})}),(0,i.jsx)(b.Z,{}),(0,i.jsx)(o.Z,{sx:{my:2},children:(0,i.jsx)(d.Z,{children:eY(n?"confirmation.areYouSureYouWantToApproveTimesheet":"confirmation.areYouSureYouWantToRejectTimesheet",{defaultValue:n?"Are you sure you want to approve this timesheet?":"Are you sure you want to reject this timesheet?"})})})]}),onYes:async()=>{eU({timesheetId:a,action:e});let{attachments:i,description:r,userBreakTimesByProjectTimeSheet:o,userProjectTimesheetSchedules:s,projectSplits:d,...c}=t,u=await ee({...c,timesheetId:a,projectId:l,approvalStatus:n?"APPROVED":"REJECTED"});if(eU(null),!u){Y.Am.error(eY("timeTracking.projectSplitApprovalUpdateFailed",{defaultValue:"Failed to update the project timesheet approval."}));return}await (null==J?void 0:J()),Y.Am.success(eY(n?"toast.timesheetApprovedSuccessfully":"toast.timesheetRejectedSuccessfully",{defaultValue:n?"Timesheet approved successfully":"Timesheet rejected successfully"}))}})}},te=e=>{if(null==e||""===e)return"-";let t=null;if("string"==typeof e){let a=e.trim();if(/^\d+$/.test(a))t=ev(Number(a));else{let e=E()(a,ek(ey),!0);t=e.isValid()?ev(e):ev(a)}}else t=ev(e);return t&&eP(t)?t.format(ey):"-"},tt=e=>{let t=eD(e),a=t?ev(t):null;return a?a.format("hh:mm A"):null},ta=e=>null==e||""===e?"-":e0(e),ti=[{id:"date",label:eY("common.date"),width:"110px",render:e=>te(e.date)},{id:"username",label:eY("common.user.one"),width:"140px"},...et?[{id:"projectSplits",label:eY("common.projects",{defaultValue:"Projects"}),width:"150px",render:e=>{let t=e1(e),a=Array.isArray(null==e?void 0:e.projectSplits)?e.projectSplits.length:0,l=a>0,n=eN.has(t),r=n?eY("timeTracking.collapseProjectSplits",{defaultValue:"Collapse project splits"}):eY("timeTracking.expandProjectSplits",{defaultValue:"Expand project splits"});return(0,i.jsx)(s.Z,{variant:"outlined",size:"small","aria-label":r,"aria-expanded":n,endIcon:n?(0,i.jsx)(ej.Z,{}):(0,i.jsx)(eT.Z,{}),sx:{minWidth:0,textTransform:"none"},disabled:!l,onClick:t=>{t.stopPropagation(),l&&e6(e)},children:"".concat(a," ").concat(eY("common.projects",{defaultValue:"Projects"}))})}}]:[],...et?[]:[{id:"scheduleName",label:eY("timeTracking.linkedSchedule"),width:"180px",render:e=>(null==e?void 0:e.scheduleName)||"-"}],{id:"startTime",label:eY("common.startTime"),width:"110px",render:e=>{var t;return null!==(t=tt(e.startTime))&&void 0!==t?t:"-"}},{id:"endTime",label:eY("common.endTime"),width:"110px",render:e=>{var t;return null!==(t=tt(e.endTime))&&void 0!==t?t:eY("common.onGoing")}},{id:"totalDuration",label:eY("timeTracking.totalDuration",{defaultValue:"Duration"}),width:"120px",render:e=>(0,T.Ii)(e.totalTimeLogged)},{id:"overtimeDuration",label:eY("timeTracking.overtimeDuration",{defaultValue:"Overtime"}),width:"120px",render:e=>(null==e?void 0:e.overtimeDuration)===null||(null==e?void 0:e.overtimeDuration)===void 0?"-":(0,T.Ii)(e.overtimeDuration)},{id:"regularWage",label:eY("timeTracking.regularWage",{defaultValue:"Regular Wage"}),width:"160px",render:e=>ta(null==e?void 0:e.regularWage)},{id:"overtimeWage",label:eY("timeTracking.overtimeWage",{defaultValue:"Overtime Wage"}),width:"160px",render:e=>ta(null==e?void 0:e.overtimeWage)},{id:"wage",label:eY("timeTracking.totalWage",{defaultValue:"Total Wage"}),width:"120px",render:e=>ta(null==e?void 0:e.wage)},...et?[]:[{id:"breakHours",label:eY("common.breakHours"),width:"110px",render:e=>(0,T.Ii)(e.totalBreakTime)}],{id:"status",label:eY("common.status"),width:"180px",isTooltip:et,render:e=>{var t;let a=null!==(t=ed(null==e?void 0:e.status))&&void 0!==t?t:null==e?void 0:e.status;return eY("timeTracking.".concat(a),{defaultValue:(0,T.C8)(a)})}},{id:"approvalStatus",label:eY("timeTracking.approvalStatus"),width:"180px",isTooltip:et,tooltipText:e=>{let t=null==e?void 0:e.approvalStatus;return t?eY("common.".concat({APPROVED:"approved",PENDING_APPROVAL:"pendingApproval",REJECTED:"rejected"}[t]),{defaultValue:(0,T.C8)(t)}):"-"},render:e=>{var t,a,l,n,r,s;let d=null==e?void 0:e.approvalStatus;if(!d)return"-";let c={APPROVED:(null==eF?void 0:null===(a=eF.palette)||void 0===a?void 0:null===(t=a.success)||void 0===t?void 0:t.main)||"green",PENDING_APPROVAL:(null==eF?void 0:null===(n=eF.palette)||void 0===n?void 0:null===(l=n.warning)||void 0===l?void 0:l.main)||"orange",REJECTED:(null==eF?void 0:null===(s=eF.palette)||void 0===s?void 0:null===(r=s.error)||void 0===r?void 0:r.main)||"red"};return(0,i.jsx)(o.Z,{component:"span",sx:{color:c[d]||"text.primary",fontWeight:500},children:eY("common.".concat({APPROVED:"approved",PENDING_APPROVAL:"pendingApproval",REJECTED:"rejected"}[d]),{defaultValue:(0,T.C8)(d)})})}}];return U||(null==_?void 0:_.timesheets)&&0!==_.timesheets.length?(0,i.jsxs)(o.Z,{sx:{flex:1,minHeight:0,width:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},children:[(0,i.jsx)(g.Z,{columns:ti,containerHeight:"100%",data:null!==(L=null==_?void 0:_.timesheets)&&void 0!==L?L:[],loading:U,getRowId:(e,t)=>e1(e)||"timesheet-".concat(t),showRowActions:!0,actionItems:e3,onRowAction:(e,t)=>{if(eb(t),"edit"===e){if(e$(t))return;ei(!0);return}if("delete"===e){if(eQ(t))return;el({content:(0,i.jsxs)(C.Z,{children:[(0,i.jsx)(f.fK,{children:(0,i.jsx)(u.r,{title:eY("common.delete")})}),(0,i.jsx)(b.Z,{}),(0,i.jsxs)(o.Z,{sx:{my:2},children:[(0,i.jsx)(d.Z,{children:eY("toast.deleteTimeSheetConfirmation")}),(null==t?void 0:t.organizationTimesheetId)&&(0,i.jsx)(d.Z,{variant:"body2",color:"error",sx:{mt:1.5,fontWeight:"bold"},children:eY("confirmation.deleteTimesheetSplitWarning",{defaultValue:"This timesheet is linked to an organization timesheet. Deleting it will unlink the project timesheet, and the duration in the organization timesheet will not be automatically adjusted."})})]})]}),onYes:async()=>{await q(t),Y.Am.success(eY("toast.timesheetDeletedSuccessfully"))}});return}if("approve"===e){if(!eK(t))return;el({content:(0,i.jsxs)(C.Z,{children:[(0,i.jsx)(f.fK,{children:(0,i.jsx)(u.r,{title:eY("common.approve",{defaultValue:"Approve Timesheet"})})}),(0,i.jsx)(b.Z,{}),(0,i.jsx)(o.Z,{sx:{my:2},children:(0,i.jsx)(d.Z,{children:eY("confirmation.areYouSureYouWantToApproveTimesheet",{defaultValue:"Are you sure you want to approve this timesheet?"})})})]}),onYes:async()=>{let{attachments:e,description:a,userBreakTimesByProjectTimeSheet:i,userProjectTimesheetSchedules:l,...n}=t;await B({...n,approvalStatus:"APPROVED"})&&(null==J||J(),Y.Am.success(eY("toast.timesheetApprovedSuccessfully",{defaultValue:"Timesheet approved successfully"})))}});return}if("reject"===e){if(!eK(t))return;el({content:(0,i.jsxs)(C.Z,{children:[(0,i.jsx)(f.fK,{children:(0,i.jsx)(u.r,{title:eY("common.reject",{defaultValue:"Reject Timesheet"})})}),(0,i.jsx)(b.Z,{}),(0,i.jsx)(o.Z,{sx:{my:2},children:(0,i.jsx)(d.Z,{children:eY("confirmation.areYouSureYouWantToRejectTimesheet",{defaultValue:"Are you sure you want to reject this timesheet?"})})})]}),onYes:async()=>{let{attachments:e,description:a,userBreakTimesByProjectTimeSheet:i,userProjectTimesheetSchedules:l,...n}=t;await B({...n,approvalStatus:"REJECTED"})&&(null==J||J(),Y.Am.success(eY("toast.timesheetRejectedSuccessfully",{defaultValue:"Timesheet rejected successfully"})))}});return}if("convertExpense"===e){if(eM(t)||eV(t))return;if((null==t?void 0:t.chargeabilityType)==="NON_CHARGEABLE"){el({content:(0,i.jsxs)(C.Z,{children:[(0,i.jsx)(f.fK,{children:(0,i.jsx)(u.r,{title:eY("common.convertExpense",{defaultValue:"Convert to Expense"})})}),(0,i.jsx)(b.Z,{}),(0,i.jsx)(o.Z,{sx:{my:2},children:(0,i.jsx)(d.Z,{children:eY("toast.nonChargeableTimesheetExpenseConfirmation")})})]}),onYes:async()=>{e8()}});return}e8()}},sx:{"& .MuiTable-root":{minWidth:"1560px",...et?{tableLayout:"fixed"}:{}}},renderExpandedRowCells:et?e=>{var t;let a=e1(e),l=Array.isArray(null==e?void 0:e.projectSplits)?e.projectSplits:[];return eN.has(a)&&0!==l.length?(0,i.jsx)(eE,{projectSplits:l,parentDate:te(e.date),parentUserName:null!==(t=e.username)&&void 0!==t?t:"-",isApprover:eo,pendingAction:ez,formatTime:tt,formatWage:e0,onApprovalAction:e9}):null}:void 0}),ew&&(0,i.jsx)(i.Fragment,{children:er&&(0,T.C2)(er,null===eu.LL||void 0===eu.LL?void 0:eu.LL.CLIENT_BILLS_AND_EXPENSES)?(0,i.jsxs)(I.Z,{fullWidth:!0,open:ew,onClose:e7,children:[(0,i.jsxs)(C.Z,{children:[(0,i.jsx)(f.fK,{children:(0,i.jsx)(u.r,{title:eY("common.convertExpense",{defaultValue:"Convert to Expense"})})}),(0,i.jsx)(b.Z,{}),(0,i.jsx)(o.Z,{sx:{my:2},children:(0,i.jsx)(w.Z,{label:eY("common.selectPaymentType"),className:"mt-1",value:(null==eI?void 0:eI.paymentName)||"",onChange:e=>{let t=eA.find(t=>t.paymentName===e);t&&eS(t)},options:(null!=eA?eA:[]).map(e=>({value:e.paymentName,label:eY("paymentType.".concat((0,T.C8)(null==e?void 0:e.paymentName)))}))})})]}),(0,i.jsx)(b.Z,{}),(0,i.jsxs)(S.Z,{className:"d-flex justify-content-center",children:[(0,i.jsx)(s.Z,{variant:"outlined",sx:{color:"red","&.MuiButton-outlined":{borderRadius:"0",boxShadow:"none",width:"200px",height:"50px",borderColor:"red"}},onClick:()=>{eZ(!1),eS(null)},children:eY("common.no")}),(0,i.jsx)(O.Z,{loading:eH,variant:"contained",disabled:null==eI,sx:{marginLeft:"20px","&.Mu
1iButton-contained":{borderRadius:"0",boxShadow:"none",width:"200px",height:"50px"}},onClick:()=>e4(),children:eY("common.yes")})]})]}):(0,i.jsx)(I.Z,{open:ew,onClose:e7,children:(0,i.jsxs)(C.Z,{children:[(0,i.jsx)(f.fK,{children:(0,i.jsx)(u.r,{title:eY("common.convertExpense")})}),(0,i.jsx)(b.Z,{}),(0,i.jsx)(o.Z,{sx:{my:2},children:"You don't have access to convert to expense please contact your admin"}),(0,i.jsx)(s.Z,{onClick:()=>eZ(!1),color:"primary",children:"Close"})]})})}),ea&&(0,i.jsx)(ec,{open:ea,handleClose:()=>{ei(!1),eb(null)},timesheet:eC,editTimeSheet:B,scope:G,onTimesheetChanged:J}),(null===(A=_.timesheets)||void 0===A?void 0:A.length)!=0&&(0,i.jsx)(i.Fragment,{children:(null==_?void 0:null===(D=_.pagination)||void 0===D?void 0:D.totalPages)>0&&(0,i.jsx)(o.Z,{className:"px-2",sx:{flexShrink:0},children:(0,i.jsx)(eh.Z,{totalPage:null!==(z=null==_?void 0:null===(M=_.pagination)||void 0===M?void 0:M.totalPages)&&void 0!==z?z:0,onChangeRowsperPage:e=>{$(e.target.value)},rowsPerPage:null==_?void 0:null===(V=_.pagination)||void 0===V?void 0:V.itemsPerPage,currentPage:null==_?void 0:null===(R=_.pagination)||void 0===R?void 0:R.currentPage,onChangePage:e=>{K(e)}})})})]}):(0,i.jsx)(j.Z,{title:eY("common.noDataFound",{defaultValue:"No Data Found"}),containerStyles:{minHeight:"calc(100dvh - 220px)",width:"100%"}})},ez=a(433691),eU=a(430202),eO=e=>{let{open:t,handleClose:a,onSuccess:n,scope:r="project"}=e,m="organization"===r,{usersData:x,refetchUsers:f,isUsersFetching:g}=(0,l.h)(),{t:j}=(0,Q.$G)(),{isCreator:y,isApprover:C}=(0,X.i)(),{localizationValue:I,toLocalizedDayjs:S,getCurrentLocalizedDay:N,startOfLocalizedDayTimestamp:E,buildLocalizedDateTime:k,dateFormat:P}=(0,v.Z)(),[L,z]=(0,c.useState)(null),[G,$]=(0,c.useState)(null),[ee,ed]=(0,c.useState)(null),[ec,eu]=(0,c.useState)(null),[em,ep]=(0,c.useState)(""),[eh,ex]=(0,c.useState)(""),[ev,ef]=(0,c.useState)(),[eg,ej]=(0,c.useState)(),[eT,ey]=(0,c.useState)(""),[eC,eb]=(0,c.useState)(null),[eI,eS]=(0,c.useState)(!1),[ew,eZ]=(0,c.useState)(),[eN,eE]=(0,c.useState)(),ek=j("common.timePeriod.hr"),[eP,eA]=(0,c.useState)([]),{createTimeSheet:eD}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"project",t="organization"===e,{NEXT_PUBLIC_LEADMANAGER_ENDPOINT:a}=(0,h.k)(),{post:i}=(0,p.m)(a+(t?"/organization-timesheets":"/project-timesheets")),{data:l}=(0,W.useSession)(),{leadData:n}=(0,H.qD)(),r=(0,eU.NL)(),o=(0,q.D)({mutationFn:async e=>{var a,r;let o={eventType:"CREATE_TIMESHEET",organizationId:null==l?void 0:l["custom:organization_id"],organizationType:null==l?void 0:l["custom:organization_type"],...t?{}:{projectId:null==n?void 0:n.projectId,leadId:null==n?void 0:null===(a=n.lead)||void 0===a?void 0:a.leadId,clientName:null==n?void 0:null===(r=n.lead)||void 0===r?void 0:r.leadName,projectName:null==n?void 0:n.projectName},...e},s=await i(o);if((null==s?void 0:s.code)!=="TIMESHEET_CREATED")throw Error("Error creating timesheet");return s},onSuccess:()=>{r.invalidateQueries({queryKey:["timesheets"]}),r.invalidateQueries({queryKey:["timesheet-dashboard"]}),r.invalidateQueries({queryKey:["schedule","timesheets"]})},onError:e=>{console.error("Network error:",e)}}),s=async e=>{try{return await o.mutateAsync(e)}catch(e){return null}};return{loading:o.isPending,error:o.error?o.error.message:"",createTimeSheet:s}}(r),{splitProjectTimeSheet:eM,loading:eV}=B(),{uploadAttachment:eR}=K(),eL=(0,F.Z)(),{leadData:eO}=(0,H.qD)(),{data:e_}=(0,W.useSession)(),[eH,eW]=(0,c.useState)(),[eY,eF]=(0,c.useState)(null),eq=y&&!C,eB=(0,c.useMemo)(()=>x.find(e=>e.userId===(null==e_?void 0:e_.sub)),[null==e_?void 0:e_.sub,x]),{projectSplits:eG,projectNames:eK,projectNamesLoading:e$,refetchProjectNames:eQ,projectNamesFetching:eJ,handleAddProjectSplit:eX,handleRemoveProjectSplit:e0,handleProjectSplitChange:e1,getProjectSplitPayload:e2,validateProjectSplits:e5}=(0,en.D)(m,S),e6=eq?j("common.request",{defaultValue:"Request"}):j("common.create"),e4={projectId:null==eO?void 0:eO.projectId,mode:"DAY",startDate:L,organizationUserId:null==ew?void 0:ew.userId},{data:e3,isLoading:e8,refetch:e7}
1=(0,J.Ok)(e4,m||!(null==ew?void 0:ew.userId)||!L),e9=(null==e3?void 0:e3.filter(e=>{var t;if(!(null==ew?void 0:ew.userId))return!0;let a=null===(t=e.workers)||void 0===t?void 0:t.find(e=>e.organizationUserId===ew.userId);return!a||!a.attendanceRecords||0===a.attendanceRecords.length||a.attendanceRecords.some(e=>"ABSENT"===e.shiftWorkerStatus)}))||[];(0,c.useEffect)(()=>{if(I){var e;let t=null!==(e=(0,T.LY)(I,"CURRENCY","SYMBOL"))&&void 0!==e?e:"";t&&eW(t)}},[I]),(0,c.useEffect)(()=>{eq&&eB&&eZ(eB)},[eB,eq]),(0,c.useEffect)(()=>{eF(null)},[null==ew?void 0:ew.userId]),(0,c.useEffect)(()=>{eF(null)},[L]),(0,c.useEffect)(()=>{!m&&(null==ew?void 0:ew.userId)&&L&&e7()},[m,null==ew?void 0:ew.userId]);let te=null!==G&&null!==ee&&ee<G;(0,c.useEffect)(()=>{L&&eP.length>0&&eA(e=>(0,er.bi)({breakItems:e,nextDate:L,startMinutes:G,isNightShift:te,toLocalizedDayjs:S,buildLocalizedDateTime:k}))},[L,G,te]),(0,c.useEffect)(()=>{0!==eP.length&&eA(e=>{let t=!1,a=e.map(e=>{let a=(0,er.vC)(e.startTime,e.endTime),i=null!==a?(0,er.LU)(a):null;return e.durationValue!==a||e.duration!==i?(t=!0,{...e,duration:i,durationValue:a}):e});return t?a:e})},[eP]);let tt=async()=>{var e,t;let i;if(eS(!0),!L||null===ee||null===G||!(null==ew?void 0:ew.userId)||!m&&!eT){Y.Am.error(j("common.pleaseAddAllMandatoryFields",{defaultValue:"Please fill in all mandatory fields"})),eS(!1);return}let l=eP.reduce((e,t)=>{var a,i;return e+(null!==(i=null!==(a=t.durationValue)&&void 0!==a?a:(0,er.vC)(t.startTime,t.endTime))&&void 0!==i?i:0)},0),r=null!=ec?ec:0,o=Math.min(l,r),s=Math.max(r-o,0),d=L?E(L):null;if(G===ee){Y.Am.error(j("timeTracking.sameStartAndEndTimeNotAllowed",{defaultValue:"Start time and end time cannot be the same"})),eS(!1);return}let c=(0,er.WB)({baseDate:L,minutes:G,buildLocalizedDateTime:k}),u=(0,er.WB)({baseDate:L,minutes:ee,buildLocalizedDateTime:k,shouldAdvanceDay:te}),p=(0,er.W5)({breakTimes:eP,workingStartTime:c,workingEndTime:u});if(!p.isValid){"sameTime"===p.reason?Y.Am.error(j("timeTracking.breakTimeSameStartAndEndNotAllowed",{defaultValue:"Break start time and end time cannot be the same"})):"outsideWorkingHours"===p.reason?Y.Am.error(j("timeTracking.breakTimeWithinWorkingHours",{defaultValue:"Break time must be within working hours"})):Y.Am.error(j("toast.pleaseFillAllTheMandatoryFields")),eS(!1);return}if(!e5(r,G,ee)){eS(!1);return}ev&&ev.length>0&&(i=await ta());let h={eventType:"CREATE_TIMESHEET",timesheetId:eL,organizationId:null==e_?void 0:e_["custom:organization_id"],organizationType:null==e_?void 0:e_["custom:organization_type"],...m?{}:{projectId:null==eO?void 0:eO.projectId,leadId:null==eO?void 0:null===(e=eO.lead)||void 0===e?void 0:e.leadId,clientName:null==eO?void 0:null===(t=eO.lead)||void 0===t?void 0:t.leadName,projectName:null==eO?void 0:eO.projectName,chargeabilityType:eT,scheduleId:(null==eC?void 0:eC.scheduleId)||null,scheduleName:(null==eC?void 0:eC.scheduleName)||null},userId:null==ew?void 0:ew.userId,username:null==ew?void 0:ew.name,date:d,startTime:c,endTime:u,totalTimeLogged:r,totalBreakTime:o,totalProductiveTime:s,userBreakTimesByProjectTimeSheet:eP,description:eh,workType:eg,costRate:eN||"0",costType:ek,attachments:i,...m?{}:{shiftId:null==eY?void 0:eY.shift.shiftId,shiftName:null==eY?void 0:eY.shift.shiftName,generatedShiftId:null==eY?void 0:eY.generatedShiftId}};try{let e=await eD(h);if((null==e?void 0:e.code)==="TIMESHEET_CREATED"&&m&&eG.length>0){let{description:e,attachments:t,...a}=h,i=await eM({...a,sourceOrganizationTimesheetId:eL,splits:e2(d,k)});(null==i?void 0:i.code)!=="TIMESHEET_CREATED"&&Y.Am.warning(j("timeTracking.timesheetCreatedButSplitError",{defaultValue:"Timesheet created but failed to create project split"}))}(null==e?void 0:e.code)==="TIMESHEET_CREATED"?(eS(!1),null==n||n(),a(),Y.Am.success(j("toast.timesheetCreatedSuccessfully"))):(console.error("Error fetching data:"),eS(!1))}catch(e){console.error("Network error:",e),eS(!1)}},ta=async()=>{let e=[];
1if(ev&&ev.length>0)try{for(let t of ev){let a=m?"".concat(null==e_?void 0:e_["custom:organization_id"],"/").concat(null==e_?void 0:e_["custom:organization_type"],"/TIMESHEETS/organization/").concat(eL):"".concat(null==e_?void 0:e_["custom:organization_id"],"/").concat(null==e_?void 0:e_["custom:organization_type"],"/TIMESHEETS/projectId=").concat(null==eO?void 0:eO.projectId,"/").concat(eL),i=await eR(t,a,"TASKS");i?e.push(i):console.log("Failed to upload file to S3.")}return e}catch(e){console.error("Error uploading files to S3:",e)}return[]},ti=e=>{eA(eP.filter((t,a)=>a!==e))},tl=(e,t)=>{eA(a=>a.map(a=>a.breakTimeId===e?(()=>{let e=(0,er.Us)({value:t,referenceMinutes:G,date:L,isNightShift:te,getCurrentLocalizedDay:N,buildLocalizedDateTime:k}),i=(0,er.vC)(e,a.endTime);return{...a,startTime:e,duration:null!==i?(0,er.LU)(i):null,durationValue:i}})():a))},tn=(e,t)=>{eA(a=>a.map(a=>a.breakTimeId===e?(()=>{var e;let i=null!==(e=(0,er.vy)({timestamp:a.startTime,toLocalizedDayjs:S}))&&void 0!==e?e:G,l=(0,er.Us)({value:t,referenceMinutes:i,date:L,isNightShift:te,getCurrentLocalizedDay:N,buildLocalizedDateTime:k}),n=(0,er.vC)(a.startTime,l);return null!==n&&null!==a.startTime&&(l=a.startTime+n),{...a,endTime:l,duration:null!==n?(0,er.LU)(n):null,durationValue:n}})():a))},tr=(e,t)=>{let a=(0,er.VX)(e,t);eu(a.duration),ep(a.durationText)};return(0,c.useEffect)(()=>{tr(G,ee)},[G,ee]),(0,i.jsx)("div",{children:(0,i.jsx)(A.Z,{open:t,onClose:a,children:(0,i.jsx)(D.Z,{direction:"left",in:t,mountOnEnter:!0,unmountOnExit:!0,children:(0,i.jsxs)(o.Z,{sx:{position:"absolute",top:"0",right:"0",width:"80vw",height:"100vh",bgcolor:"background.paper",boxShadow:24,overflowY:"scroll"},className:"boqUI prodandserviceUI",children:[(0,i.jsxs)(o.Z,{sx:{position:"sticky",top:0,zIndex:1e3,bgcolor:"#fff"},children:[(0,i.jsxs)("div",{className:"d-flex justify-content-between my-1",children:[(0,i.jsx)("div",{style:{fontSize:"20px",display:"flex",alignItems:"center"},children:(0,i.jsx)(s.Z,{onClick:a,children:(0,i.jsx)(U.Z,{style:{width:"20px",height:"20px",fill:"#ccc"}})})}),(0,i.jsx)(u.r,{title:j("timeTracking.createTimeSheet")}),(0,i.jsx)(O.Z,{loading:eI||eV,variant:"contained",className:"btnPrimaryUI",sx:{maxWidth:"100px"},onClick:()=>tt(),children:e6})]}),(0,i.jsx)(b.Z,{className:"mt-2 mb-0"})]}),(0,i.jsx)(o.Z,{className:"p-1 pt-0",children:(0,i.jsx)(o.Z,{sx:{backgroundColor:"background.subtle",p:2,pt:1,pb:3,boxSizing:"border-box"},children:(0,i.jsxs)(o.Z,{component:"section",id:"product information",children:[(0,i.jsxs)(M.ZP,{container:!0,spacing:2,children:[(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsxs)(_.Z,{className:"fw-500 mb-1",children:[j("common.user.one")," ",(0,i.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),eq?(0,i.jsx)(w.Z,{disableClearable:!0,disabled:!0,options:x.map(e=>({value:e.userId,label:e.name})),value:ew?ew.userId:""}):(0,i.jsx)(ea.Z,{disableClearable:!0,options:x.map(e=>({value:e.userId,label:e.name}
1)),value:ew?ew.userId:"",onChange:e=>{eZ(x.find(t=>t.userId===e))},isAddNewItem:!0,addItemText:j("common.addNewWithLabel",{label:j("common.user.one")}),onAddItem:e=>(0,ei.H2)(e),onReload:()=>void f(),reloading:g,reloadAriaLabel:j("common.reloadUsers"),showSelectedInList:!0})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsxs)(_.Z,{className:"fw-500 mb-1",children:[j("common.date")," ",(0,i.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,i.jsx)(et.AN,{value:L?S(L):null,onChange:e=>{if(e){let t=E(e);z(t),eA(e=>(0,er.bi)({breakItems:e,nextDate:t,startMinutes:G,isNightShift:te,toLocalizedDayjs:S,buildLocalizedDateTime:k}))}else z(null)},maxDate:N()})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsxs)(_.Z,{className:"fw-500 mb-1",children:[j("common.startTime")," ",(0,i.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,i.jsx)(et.nH,{value:(0,er.d4)({minutes:G,date:L,toLocalizedDayjs:S,getCurrentLocalizedDay:N}),onChange:e=>{if(e&&e.isValid()){let t=(0,er.aQ)(e);$(t),eA(e=>(0,er.bi)({breakItems:e,nextDate:L,startMinutes:t,isNightShift:te,toLocalizedDayjs:S,buildLocalizedDateTime:k}))}else $(null)}})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsxs)(_.Z,{className:"fw-500 mb-1",children:[j("common.endTime")," ",(0,i.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,i.jsx)(et.nH,{value:(0,er.d4)({minutes:ee,date:L,toLocalizedDayjs:S,getCurrentLocalizedDay:N}),onChange:e=>
1{e&&e.isValid()?ed((0,er.aQ)(e)):ed(null)}}),te&&(0,i.jsx)(d.Z,{variant:"caption",sx:{color:"primary.main",mt:.5},children:"".concat(j("common.endsOn")," ").concat((0,er.cN)({date:L,toLocalizedDayjs:S,dateFormat:P}))})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsx)(_.Z,{className:"fw-500 mb-1",children:j("common.duration")}),(0,i.jsx)(V.Z,{value:em,onChange:e=>{ep(e.target.value)},onBlur:()=>{let e=(0,er.Le)(em);if(null===e){tr(G,ee);return}eu(e),ep((0,er.LU)(e)||""),null!==G&&ed((G+Math.floor(e/6e4))%1440)},placeholder:"0h0m",fullWidth:!0,disabled:null===G})]})})]}),!m&&(0,i.jsxs)(M.ZP,{container:!0,spacing:2,sx:{mt:0},children:[(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsxs)(_.Z,{className:"fw-500 mb-1",children:[j("workerManagement.linkShift")," "]}),(0,i.jsx)(w.Z,{options:e8?[]:e9&&e9.length>0?e9.map(e=>({value:e.generatedShiftId,label:e.generatedShiftName||e.shiftName})):[],value:eY?eY.generatedShiftId:"",onCh
1ange:e=>{let t=e9.find(t=>t.generatedShiftId===e);eF(t||null);let a=(0,er.$c)(t);a&&eb(a)},disabled:e8,isLoading:e8,placeholder:e8?j("common.loading",{defaultValue:"Loading..."}):e9&&e9.length>0?void 0:e3&&e3.length>0?j("timeTracking.allShiftsHaveTimeTracking",{defaultValue:"All available shifts already have time tracking for this user"}):j("common.noDataFound",{defaultValue:"No shifts found"})})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsx)(es.Z,{organizationId:null==e_?void 0:e_["custom:organization_id"],projectId:null==eO?void 0:eO.projectId,value:eC,onChange:eb,preload:!0})})]}),(0,i.jsxs)(M.ZP,{container:!0,columnSpacing:2,rowSpacing:.5,children:[eP.length>0&&(0,i.jsx)(M.ZP,{item:!0,xs:12,children:(0,i.jsx)(d.Z,{className:"mt-2 mb-1 fs-7 fw-500",sx:{color:"black"},children:j("common.break")})}),eP.map((e,t)=>(0,i.jsx)(M.ZP,{item:!0,xs:12,children:(0,i.jsxs)(M.ZP,{container:!0,columnSpacing:2,rowSpacing:1,alignItems:"flex-end",children:[(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsxs)(d.Z,{variant:"caption",className:"mb-1",children:[j("common.startTime")," ",(0,i.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,i.jsx)(et.nH,{value:e.startTime?S(e.startTime):null,onChange:t=>tl(e.breakTimeId,t)})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:4,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsxs)(d.Z,{variant:"caption",className:"mb-1",children:[j("common.endTime")," ",(0,i.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,i.jsx)(et.nH,{value:e.endTime?S(e.endTime):null,onChange:t=>tn(e.breakTimeId,t)})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:3,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsx)(d.Z,{variant:"caption",className:"mb-1",children:j("timeTracking.breakDuration")}),(0,i.jsx)(V.Z,{value:e.duration||"",placeholder:"0h0m",fullWidth:!0,disabled:!0})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:1,sx:{display:"flex",alignItems:"flex-end",justifyContent:"flex-start",pt:{xs:.5,sm:0}},children:(0,i.jsx)(R.Z,{onClick:()=>ti(t),sx:{mt:0,mb:1,p:.5},children:(0,i.jsx)(U.Z,{width:"12px",height:"12px",fill:"red"})})})]})},e.breakTimeId)),(0,i.jsx)(M.ZP,{item:!0,xs:12,children:(0,i.jsx)(s.Z,{sx:{marginTop:0,marginLeft:0},startIcon:(0,i.jsx)(Z.pOD,{width:"15px",fill:"#3CA2FF"}),onClick:()=>{eA([...eP,{breakTimeId:(0,F.Z)(),startTime:null,endTime:null,duration:null,durationValue:null}])},children:j("timeTracking.addBreakTime")})})]}),(0,i.jsx)(el.Z,{visible:m,organizationId:null==e_?void 0:e_["custom:organization_id"],projectSplits:eG,projectNames:eK,projectNamesLoading:e$,date:L,parentStartTime:G,parentEndTime:ee,toLocalizedDayjs:S,getCurrentLocalizedDay:N,onAdd:eX,onRemove:e0,onChange:e1,onReloadProjects:eQ,projectsReloading:eJ,titleClassName:"mb-1 fs-7 fw-500",showLinkedShift:!0,shiftUserId:null==ew?void 0:ew.userId}),(0,i.jsx)(M.ZP,{container:!0,spacing:2,children:!m&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsx)(_.Z,{className:"fw-500 mb-1",children:j("timeTracking.workType")}),(0,i.jsx)(V.Z,{fullWidth:!0,value:eg,onChange:e=>{ej(e.target.value)}})]})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,sm:6,children:(0,i.jsxs)(o.Z,{className:"d-flex column",children:[(0,i.jsxs)(_.Z,{className:"fw-500 mb-1",children:[j("timeTracking.chargeability",{defaultValue:"Chargeability"})," ",(0,i.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),(0,i.jsx)(w.Z,{required:!0,options:eo.s.map(e=>({value:e.value,label:j("timeTracking.".concat(e.translationKey))})),value:eT,placeholder:j("timeTracking.selectChargeability",{defaultValue:"Select chargeability"}),onChange:e=>ey(e||"")})]})})]})}),(0,i.jsxs)(M.ZP,{container:!0,spacing:2,sx:{mt:0},children:[(0,i.jsxs)(M.ZP,{item:!0,xs:12,children:[(0,i.jsx)(d.Z,{className:"mb-1 fs-7 fw-500",children:j("common.description")}),(0,i.jsx)(V.Z,{multiline:!0,sx:{width:"100%",border:"none",height:"120px","& .MuiInputBase-root":{height:"100%","& .MuiInputBase-input":{height:"100% !important",overflow:"auto !important"}}},variant:"outlined",InputProps:{disableUnderline:!0}
1,placeholder:j("common.description"),onChange:e=>ex(e.target.value),value:eh})]}),(0,i.jsx)(M.ZP,{item:!0,xs:12,children:(0,i.jsx)(d.Z,{className:"fs-7 fw-500",sx:{color:"black"},children:j("common.attachments")})}),(0,i.jsx)(M.ZP,{item:!0,xs:12,children:(0,i.jsx)(o.Z,{children:(0,i.jsx)(ez.Z,{setAttachment:ef,thumbnailColumns:2})})})]})]})})})]})})})})},e_=a(878551);let eH={timesheets:[],pagination:{}};var eW=a(491407);function eY(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"project",t="organization"===e,{NEXT_PUBLIC_LEADMANAGER_ENDPOINT:a}=(0,h.k)(),{post:i}=(0,p.m)(a+(t?"/organization-timesheets":"/project-timesheets")),{data:l}=(0,W.useSession)(),{leadData:n}=(0,H.qD)(),r=(0,eU.NL)(),o=(0,q.D)({mutationFn:async e=>{var a;let r={eventType:"EDIT_TIMESHEET",organizationId:null==l?void 0:l["custom:organization_id"],...t?{}:{projectId:null==n?void 0:n.projectId,clientName:null==n?void 0:null===(a=n.lead)||void 0===a?void 0:a.leadName,projectName:null==n?void 0:n.projectName},...e},o=await i(r);if((null==o?void 0:o.code)!=="TIMESHEET_UPDATED")throw Error("Error updating timesheet");return!0},onSuccess:()=>{r.invalidateQueries({queryKey:["timesheets"]}),r.invalidateQueries({queryKey:["timesheet-dashboard"]}),r.invalidateQueries({queryKey:["schedule","timesheets"]})},onError:e=>{console.error("Network error:",e)}}),s=async e=>{try{return await o.mutateAsync(e)}catch(e){return!1}};return{loading:o.isPending,data:o.data,error:o.error?o.error.message:"",editTimeSheet:s}}var eF=a(896941),eq=a(426488),eB=e=>(0,i.jsx)("svg",{id:"Layer_1",...e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-name":"Layer 1",children:(0,i.jsx)("path",{d:"m17 10a7 7 0 1 0 7 7 7.008 7.008 0 0 0 -7-7zm2.707 9.707a1 1 0 0 1 -1.414 0l-2-2a1 1 0 0 1 -.293-.707v-3a1 1 0 0 1 2 0v2.586l1.707 1.707a1 1 0 0 1 0 1.414zm-11.233-8.707a5.5 5.5 0 1 1 5.5-5.5 5.506 5.506 0 0 1 -5.5 5.5zm2.882 13h-10.356a1 1 0 0 1 -1-1.011 10.275 10.275 0 0 1 6.553-9.6 6.685 6.685 0 0 1 2.394-.384 9.087 9.087 0 0 0 -.424.995 8.853 8.853 0 0 0 -.523 3 8.983 8.983 0 0 0 3.356 7z"})}),eG=e=>(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",...e,id:"Layer_1","data-name":"Layer 1",viewBox:"0 0 24 24",children:(0,i.jsx)("path",{d:"m23.338,12.345l-10.674,11.655H3c-1.654,0-3-1.346-3-3v-7c0-1.654,1.346-3,3-3h4v-1c-1.654,0-3-1.346-3-3h2c0,.552.449,1,1,1h2.376c.344,0,.624-.28.624-.624,0-.307-.219-.565-.522-.616l-3.285-.547c-1.271-.212-2.193-1.301-2.193-2.589,0-1.447,1.177-2.624,2.624-2.624h.376V0h2v1c1.654,0,3,1.346,3,3h-2c0-.552-.449-1-1-1h-2.376c-.344,0-.624.28-.624.624,0,.307.219.565.522.616l3.285.547c1.271.212,2.193,1.301,2.193,2.589,0,1.447-1.177,2.624-2.624,2.624h-.376v1h2.787c1.22,0,2.213.993,2.213,2.213,0,1.094-.816,2.036-1.9,2.191l-4.241.606.283,1.979,4.241-.606c2.062-.294,3.617-2.087,3.617-4.17,0-.219-.032-.429-.065-.638l3.541-3.737c.455-.5,1.097-.803,1.794-.835.692-.034,1.363.209,1.878.678,1.052.958,1.138,2.602.189,3.665Zm-6.858-5.799l1.414,1.414,2.49-2.49c.397-.397.616-.925.616-1.487s-.219-1.09-.616-1.486L17.936.049l-1.414,1.414,1.536,1.537h-4.058v2h4.026l-1.547,1.546Z"})}),eK=a(870510),e$=a(135023),eQ=a(566336),eJ=e=>{let{isOpen:t,onClose:a,onProceedScratch:l,onProceedUpload:n,showUploadOption:r=!0,isUploading:o,uploadProgress:s}=e,{t:d}=(0,Q.$G)(),c=((0,k.useRouter)().pathname,[{value:"scratch",title:d("timeTrackingProceed.startFromScratch"),icon:(0,i.jsx)(eK.Z,{style:{width:160,height:180}}),description:d("timeTrackingProceed.startFromScratchDescription"),type:"default"},...r?[{value:"upload",title:d("timeTrackingProceed.uploadTemplate"),icon:(0,i.jsx)(e$.Z,{style:{width:160,height:180}}),description:d("timeTrackingProceed.dragAndDropYourFileOrUploadFromYourComputer"),type:"upload",acceptedFileTypes:".xlsx,.xls,.csv",templateLink:"/template/TimeSheetUploadTemplate.xlsx",templateDownloadName:"TimeSheetUploadTemplate.xlsx",templateText:d("timeTrackingProceed.uploadAFileAccordingToThis"),templateLabel:d("timeTrackingProceed.template"),templateUploadSuccessText:d("timeTrackingProceed.templateUploadSucessfully")}]:[]]);return(0,i.jsx)(eQ.Z,{isOpen:t,onClose:a,title:d("timeTrackingProceed.getStart"),subTitle:d("timeTrackingProceed.selectUploadFormat"),options:c,onProceed:(e,t)=>{"scratch"===e?(l(),a()):"upload"===e&&t&&n(t)},isUploading:o,uploadProgress:s,isLoading:!1})},eX=a(684105),e0=a(629387),e1=a.n(e0),e2=a(370178),e5=a.n(e2);E().extend(ev()),E().extend(e5()),E().extend(e1());let e6=e=>e8(e).toLowerCase(),e4=e=>e.toLowerCase().replace(/\s+/g,"").replace(/[_-]/g,""),e3=(e,t)=>
1{let a=t.map(e4);for(let[t,i]of Object.entries(e))if(a.includes(e4(t)))return i;return""},e8=e=>null==e?"":String(e).trim(),e7=e=>{let t=e8(e).toUpperCase().replace(/[\s-]+/g,"_");return"CHARGEABLE"===t?"CHARGEABLE":"NON_CHARGEABLE"===t||"NONCHARGEABLE"===t?"NON_CHARGEABLE":""},e9=e=>e?E()().tz(e):E()(),te=(e,t)=>{let a=E()(e);return a.isValid()?t?a.tz(t):a:null},tt=e=>Array.from(new Set([e,null==e?void 0:e.replace(/Y{4}/g,"YY"),"DD/MM/YYYY","MM/DD/YY","DD/MM/YYYY","DD/MM/YY","D/M/YYYY","D/M/YY","M/D/YYYY","M/D/YY","YYYY-MM-DD","YY-MM-DD","DD-MM-YYYY","DD-MM-YY","MM-DD-YYYY","MM-DD-YY"].filter(Boolean))),ta=e=>/[/-]/.test(e)&&!/^\d{4}-\d{1,2}-\d{1,2}(?:[T\s].*)?$/.test(e),ti=(e,t,a,i)=>{let l="".concat(e,"-").concat(String(t).padStart(2,"0"),"-").concat(String(a).padStart(2,"0"),"T00:00:00");return i?E().tz(l,i):E()(l)},tl=function(e){let{dateFormat:t,organizationTimezone:a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e||""===e)return"";if("number"==typeof e){var i,l,n,r;if(e>1e12)return null!==(l=null===(i=te(Math.trunc(e),a))||void 0===i?void 0:i.startOf("day").valueOf())&&void 0!==l?l:"";if(e>1e9)return null!==(r=null===(n=te(Math.trunc(1e3*e),a))||void 0===n?void 0:n.startOf("day").valueOf())&&void 0!==r?r:"";let t=eX.kS.parse_date_code(e);return t&&t.y&&t.m&&t.d?ti(t.y,t.m,t.d,a).startOf("day").valueOf():""}let o=String(e).trim(),s=E()(o,tt(t),!0);if(s.isValid())return ti(s.year(),s.month()+1,s.date(),a).startOf("day").valueOf();if(ta(o))return"";let d=te(o,a);return(null==d?void 0:d.isValid())?d.startOf("day").valueOf():""},tn=e=>e.trim().replace(/\./g,":").replace(/^(\d{1,2})(\d{2})(am|pm)$/i,"$1:$2 $3").replace(/\s*(am|pm)$/i," $1").toUpperCase(),tr=function(e,t){let{organizationTimezone:a}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null==e||""===e)return"";if("number"==typeof e){var i,l,n,r;if(e>1e12)return null!==(l=null===(i=te(Math.trunc(e),a))||void 0===i?void 0:i.valueOf())&&void 0!==l?l:"";if(e>1e9)return null!==(r=null===(n=te(Math.trunc(1e3*e),a))||void 0===n?void 0:n.valueOf())&&void 0!==r?r:"";let o=eX.kS.parse_date_code(e);if(o){let e=e9(a),i=t?te(Number(t),a):ti(o.y||e.year(),o.m||e.month()+1,o.d||e.date(),a);return i?i.hour(o.H||0).minute(o.M||0).second(Math.floor(o.S||0)).millisecond(0).valueOf():""}return""}let o=tn(String(e)),s=E()(o,["H:mm","HH:mm","H:mm:ss","HH:mm:ss","h:mm A","hh:mm A","h:mm a","hh:mm a","h:mmA","hh:mmA","h:mma","hh:mma","h:m A","hh:m A"],!0);if(s.isValid()){let e=t?te(Number(t),a):e9(a);return e?e.hour(s.hour()).minute(s.minute()).second(s.second()).millisecond(0).valueOf():""}let d=te(o,a);return(null==d?void 0:d.isValid())?d.valueOf():""},to=async(e,t)=>{let a=new FileReader;return a.readAsBinaryString(e),new Promise((e,i)=>{a.onload=a=>{var l;let n=null===(l=a.target)||void 0===l?void 0:l.result;if(!n){i("No data found in file");return}try{let a=eX.ij(n,{type:"binary"}),i=a.SheetNames.find(e=>"template"===e.toLowerCase()||"timesheets"===e.toLowerCase())||a.SheetNames[0],l=a.Sheets[i],r=eX.P6.sheet_to_json(l,{defval:""}).map(e=>{let a=e8(e3(e,["name","user","username","user name","employee name","worker name","name *","Name *","user *"])),i=e8(e3(e,["project","project name","project name *"])),l=e8(e3(e,["schedule","schedule name","linked schedule","linked shift"])),n=e7(e3(e,["chargeability","chargeability type","chargeability *"])),r=tl(e3(e,["date","timesheet date","date *","Date *"]),t),o=tr(e3(e,["start time","starttime","from time","start","start time *","Start Time *"]),r,t),s=tr(e3(e,["end time","endtime","to time","end","end time *","End Time *"]),r,t),d=e8(e3(e,["description","desc","work description","task description","note","notes"]));return{excelUsername:a,excelProjectName:i,excelScheduleName:l,chargeabilityType:n,date:r,startTime:o,endTime:s,description:d}}).filter(e=>e.excelUsername||e.excelProjectName||e.excelScheduleName||e.chargeabilityType||e.date||e.startTime||e.endTime||e.description);e(r)}catch(e){i(e)}},a.onerror=e=>{i(e)}})},ts=e=>Array.from(e.reduce((e,t)=>{let a=e8(t.excelUsername),i=e6(a);return!i||e.has(i)||e.set(i,a),e},new Map).values()),td=e=>Array.from(e.reduce((e,t)=>
1{let a=e8(t.excelProjectName),i=e6(a);return i&&!e.has(i)&&e.set(i,a),e},new Map).values()),tc=(e,t)=>"".concat(e6(e),"::").concat(e6(t)),tu=function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],a=new Map;return e.forEach(e=>{let i=e8(e.excelProjectName),l=e8(e.excelScheduleName);if(!l||t&&!i)return;let n=tc(t?i:"",l);a.has(n)||a.set(n,{key:n,excelProjectName:i,excelScheduleName:l})}),[...a.values()]};var tm=a(950681);let tp=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"project",a="organization"===t,{NEXT_PUBLIC_LEADMANAGER_ENDPOINT:i}=(0,h.k)(),{leadData:l}=(0,H.qD)(),{data:n}=(0,W.useSession)(),{t:r}=(0,Q.$G)(),{dateFormat:o,organizationTimezone:s}=(0,v.Z)(),[d,u]=(0,c.useState)(!1),[m,x]=(0,c.useState)(0),[f,g]=(0,c.useState)(null),[j,T]=(0,c.useState)(!1),[y,C]=(0,c.useState)([]),[b,I]=(0,c.useState)([]),[S,w]=(0,c.useState)({}),[Z,N]=(0,c.useState)([]),[k,P]=(0,c.useState)({}),[A,D]=(0,c.useState)([]),[M,V]=(0,c.useState)({}),[R,L]=(0,c.useState)(!1),{projectNames:z}=(0,tm.q)(a),U=a?"/organization-timesheets":"/project-timesheets",{post:O}=(0,p.m)(i+U),_=(0,eU.NL)(),F=(0,q.D)({mutationFn:e=>O(e),onSuccess:()=>{_.invalidateQueries({queryKey:["timesheets"]}),_.invalidateQueries({queryKey:["timesheet-dashboard"]}),_.invalidateQueries({queryKey:["schedule","timesheets"]})}}),B=()=>r("timeTrackingProceed.localizedUploadFormatHint",{defaultValue:"Expected date format: {{dateFormat}}{{timezoneSuffix}}.",dateFormat:o,timezoneSuffix:s?" | Timezone: ".concat(s):"",interpolation:{escapeValue:!1}}),G=()=>{C([]),I([]),w({}),N([]),P({}),D([]),V({}),L(!1)};return{handleTimeSheetUpload:async e=>{u(!0),x(15);try{let t=await to(e,{dateFormat:o,organizationTimezone:s});if(!(null==t?void 0:t.length))return Y.Am.error(r("timeTrackingProceed.noValidRows",{defaultValue:"No valid timesheet rows found in uploaded file"})+" "+B()),[];if(a){let e=t.map((e,t)=>e.excelProjectName?null:t+2).filter(e=>null!==e);if(e.length>0)return Y.Am.error(r("timeTrackingProceed.projectNameRequiredForRows",{defaultValue:"Project Name is required in Excel row(s): {{rows}}.",rows:e.join(", ")})),[]}let i=ts(t);if(!i.length)return Y.Am.error(r("timeTrackingProceed.noValidRows",{defaultValue:"No valid timesheet rows found in uploaded file"})+" "+B()),[];let l=i.reduce((e,t)=>(e[t]="",e[e6(t)]="",e),{}),n=a?td(t):[],d=n.reduce((e,t)=>(e[t]="",e[e6(t)]="",e),{});return C(t),I(i),w(l),N(n),P(d),D(tu(t,a)),L(!0),x(100),t}catch(e){return console.error("Excel parsing failed:",e),Y.Am.error(r("common.fileUploadFailed",{defaultValue:"File upload failed"})),[]}finally{u(!1),x(0)}},handleMappedTimeSheetUpload:async t=>{if(!y.length)return;u(!0),x(25);let i=new Map(t.map(e=>[e.userId,e]));try{var o,s,d;let t=y.map(e=>{let t=S[e.excelUsername]||S[e6(e.excelUsername)];if(!t)return null;let n=i.get(t);if(!n)return null;let r=a?k[e.excelProjectName]||k[e6(e.excelProjectName)]:null==l?void 0:l.projectId,o=a?z.find(e=>e.projectId===r):r?{projectId:r,projectName:(null==l?void 0:l.projectName)||""}:void 0;if(!o)return null;let s=tc(a?e.excelProjectName:"",e.excelScheduleName),d=e.excelScheduleName?M[s]:null;if("number"!=typeof e.date||"number"!=typeof e.startTime||"number"!=typeof e.endTime)return null;let c=e.endTime<e.startTime?E()(e.endTime).add(1,"day").valueOf():e.endTime,u=Math.max(c-e.startTime,0);return{userId:n.userId,username:n.name,projectId:o.projectId,projectName:o.projectName,scheduleId:(null==d?void 0:d.scheduleId)||null,scheduleName:(null==d?void 0:d.scheduleName)||null,chargeabilityType:e.chargeabilityType,date:Math.trunc(e.date),startTime:Math.trunc(e.startTime),endTime:Math.trunc(c),totalTimeLogged:Math.trunc(u),totalBreakTime:0,totalProductiveTime:Math.max(Math.trunc(u),0),description:e.description||""}}).filter(Boolean);if(!t.length){Y.Am.error(r("timeTrackingProceed.noMappedRows",{defaultValue:"No mapped rows available to upload"}));return}let c=y.length-t.length;c>0&&Y.Am.error(r("timeTrackingProceed.ignoredRowsInfo",{defaultValue:"{{count}} row(s) were ignored due to empty mapping",count:c})),x(70);let u={eventType:"UPLOAD_TIMESHEET",organizationId:null==n?void 0:n["custom:organization_id"],organizationType:null==n?void 0:n["custom:organization_type"],createdBy:null==n?void 0:n.username,...a?{}:{projectId:null==l?void 0:l.projectId,leadId:null==l?void 0:null===(o=l.lead)||void 0===o?void 0:o.leadId,projectName:null==l?void 0:l.projectName,clientName:null==l?void 0:null===(s=l.lead)||void 0===s?void 0:s.leadName},uploadData:t},m=await F.mutateAsync(u);x(100),(null==m?void 0:m.code)==="TIMESHEET_UPLOADED"&&(g(null==m?void 0:null===(d=m.body)||void 0===d?void 0:d.displayResult),T(!0),G(),e&&e())}catch(e){console.error("Upload failed:",e),Y.Am.error(r("common.fileUploadFailed",{defaultValue:"File upload failed"}))}finally{u(!1),x(0)}},isUploading:d,uploadProgress:m,uploadResult:f,showPreview:j,setShowPreview:T,openUserMappingDialog:R,closeUserMappingDialog:()=>{G()},parsedExcelRows:y,excelUserNames:b,excelUserMapping:S,setMappedUserForExcelName:(e,t)=>
1{let a=e6(e);w(i=>({...i,[e]:t||"",[a]:t||""}))},excelProjectNames:Z,excelProjectMapping:k,setMappedProjectForExcelName:(e,t)=>{let a=e6(e);P(i=>({...i,[e]:t||"",[a]:t||""})),V(e=>Object.fromEntries(Object.entries(e).filter(e=>{let[t]=e;return!t.startsWith("".concat(a,"::"))})))},excelScheduleMappings:A,scheduleMapping:M,setMappedSchedule:(e,t)=>{V(a=>({...a,[e]:t}))},projectNames:z,organizationId:null==n?void 0:n["custom:organization_id"],projectId:null==l?void 0:l.projectId,projectName:null==l?void 0:l.projectName,isOrganizationScope:a}};var th=a(714556),tx=a(779710),tv=a(208143),tf=a(187107);let tg=e=>{let{isOrganizationScope:t,excelProjectNames:a,excelScheduleMappings:i}=e,l=["user"];return t&&a.length>0&&l.push("project"),i.length>0&&l.push("schedule"),l.push("summary"),l},tj=e=>e.map(e=>({label:e.name,value:e.userId})),tT=e=>e.map(e=>({label:e.projectName,value:e.projectId})),ty=(e,t)=>e.every(e=>!!t[e]),tC=(e,t)=>e.every(e=>!!t[e]||!!t[e6(e)]),tb=e=>{let{stepId:t,excelUserNames:a,excelUserMapping:i,excelProjectNames:l,excelProjectMapping:n}=e;return"user"===t?ty(a,i):"project"!==t||tC(l,n)},tI={user:"timeTrackingProceed.userMapping",project:"timeTrackingProceed.projectMapping",schedule:"timeTrackingProceed.scheduleMapping",summary:"timeTrackingProceed.summary"},tS={user:"User Mapping",project:"Project Mapping",schedule:"Schedule Mapping",summary:"Summary"},tw=e=>{let{excelProjectName:t,excelProjectMapping:a,isOrganizationScope:i,projectId:l}=e;return i?a[t]||a[e6(t)]||void 0:l},tZ=e=>{var t;let{excelProjectName:a,excelProjectMapping:i,projectNames:l,isOrganizationScope:n,projectName:r}=e;if(!n)return r||"";let o=tw({excelProjectName:a,excelProjectMapping:i,isOrganizationScope:n});return o&&(null===(t=l.find(e=>e.projectId===o))||void 0===t?void 0:t.projectName)||""},tN=e=>{let{parsedExcelRows:t,excelUserMapping:a,usersData:i,excelProjectMapping:l,projectNames:n,scheduleMapping:r,isOrganizationScope:o,projectName:s}=e,d=new Map(i.map(e=>[e.userId,e.name])),c=new Map(n.map(e=>[e.projectId,e.projectName]));return t.map((e,t)=>{var i;let n=a[e.excelUsername]||a[e6(e.excelUsername)],u=n&&d.get(n)||"—",m=tw({excelProjectName:e.excelProjectName,excelProjectMapping:l,isOrganizationScope:o,projectId:void 0}),p=o?m&&c.get(m)||"—":s||"—",h=e.excelScheduleName?tc(o?e.excelProjectName:"",e.excelScheduleName):"",x=h&&(null===(i=r[h])||void 0===i?void 0:i.scheduleName)||"—";return{key:"".concat(e.excelUsername,"-").concat(t),sourceUser:e.excelUsername||"—",mappedUser:u,sourceProject:e.excelProjectName||"—",mappedProject:p,scheduleName:e.excelScheduleName||"—",mappedSchedule:x,dateValue:e.date,startTimeValue:e.startTime,endTimeValue:e.endTime,chargeabilityType:e.chargeabilityType,description:e.description||"—"}})};var tE=a(492238),tk=e=>{let{excelUserNames:t,excelUserMapping:a,userOptions:l,onMapChange:n}=e,{t:r}=(0,Q.$G)();return(0,i.jsxs)(o.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"1fr 1fr"},gap:1.5,alignItems:"center"},children:[(0,i.jsx)(d.Z,{variant:"body2",fontWeight:500,children:r("timeTrackingProceed.sourceUser",{defaultValue:"Source User"})}),(0,i.jsxs)(d.Z,{variant:"body2",fontWeight:500,children:[r("timeTrackingProceed.mappedUser",{defaultValue:"Mapped User"})," ",(0,i.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),t.map(e=>(0,i.jsxs)(c.Fragment,{children:[(0,i.jsx)(tE.Z,{children:e}),(0,i.jsx)(w.Z,{options:l,value:a[e]||"",onChange:t=>n(e,t||null),placeholder:r("timeTrackingProceed.selectUserOptional",{defaultValue:"Select user *"}),size:"small",maxVisibleOptions:4,sx:{width:"100%"}})]},e))]})},tP=e=>{let{excelProjectNames:t,excelProjectMapping:a,projectOptions:l,onProjectMapChange:n}=e,{t:r}=(0,Q.$G)();return(0,i.jsxs)(o.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"1fr 1fr"},gap:1.5,alignItems:"center"},children:[(0,i.jsx)(d.Z,{variant:"body2",fontWeight:500,children:r("timeTrackingProceed.sourceProject",{defaultValue:"Source Project"})}),(0,i.jsxs)(d.Z,{variant:"body2",fontWeight:500,children:[r("timeTrackingProceed.mappedProject",{defaultValue:"Mapped Project"})," ",(0,i.jsx)("span",{className:"requiredUI fs-8",children:"*"})]}),t.map(e=>(0,i.jsxs)(c.Fragment,{children:[(0,i.jsx)(tE.Z,{children:e}),(0,i.jsx)(w.Z,{options:l,value:a[e]||a[e6(e)]||"",onChange:t=>n(e,t||null),placeholder:r("timeTrackingProceed.selectProject",{defaultValue:"Select project *"}),size:"small",maxVisibleOptions:4,sx:{width:"100%"}})]},e))]})},tA=e=>{let{excelScheduleMappings:t,scheduleMapping:a,onScheduleMapChange:l,excelProjectMapping:n,projectNames:s,organizationId:u,projectId:m,projectName:p,isOrganizationScope:h}=e,{t:x}=(0,Q.$G)();return(0,i.jsxs)(o.Z,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"1fr 1fr 1.4fr"},gap:1.5,alignItems:"center"},children:[(0,i.jsx)(d.Z,{variant:"body2",fontWeight:500,children:x("timeTrackingProceed.projectName",{defaultValue:"Project Name"})}),(0,i.jsx)(d.Z,{variant:"body2",fontWeight:500,children:x("timeTrackingProceed.scheduleName",{defaultValue:"Schedule Name"})}),(0,i.jsx)(d.Z,{variant:"body2",fontWeight:500,children:x("timeTrackingProceed.mappedSchedule",{defaultValue:"Mapped Schedule"})}),t.map(e=>{let t=tw({excelProjectName:e.excelProjectName,excelProjectMapping:n,isOrganizationScope:h,projectId:m}),d=tZ({excelProjectName:e.excelProjectName,excelProjectMapping:n,projectNames:s,isOrganizationScope:h,projectName:p}),v=h&&!t,f=(0,i.jsx)(es.Z,{organizationId:u,projectId:t,value:a[e.key]||null,onChange:t=>l(e.key,t),showLabel:!1,size:"small",disabled:v});return(0,i.jsxs)(c.Fragment,{children:[(0,i.jsx)(tE.Z,{children:d||"—"}),(0,i.jsx)(tE.Z,{children:e.excelScheduleName}),v?(0,i.jsx)(r.Z,{title:x("timeTrackingProceed.selectProjectBeforeSchedule",{defaultValue:"Select a project before mapping a schedule."}
1),arrow:!0,children:(0,i.jsx)(o.Z,{component:"span",sx:{display:"block"},children:f})}):f]},e.key)})]})},tD=a(242600),tM=a(513712),tV=a(847884),tR=a(595814),tL=e=>{let{parsedExcelRows:t,excelUserMapping:a,usersData:l,excelProjectMapping:n,projectNames:r,scheduleMapping:o,isOrganizationScope:s,projectName:u}=e,{t:m}=(0,Q.$G)(),{localizationValue:p}=(0,x.W)(),h=(0,c.useMemo)(()=>tN({parsedExcelRows:t,excelUserMapping:a,usersData:l,excelProjectMapping:n,projectNames:r,scheduleMapping:o,isOrganizationScope:s,projectName:u}),[t,a,l,n,r,o,s,u]),v=e=>"number"!=typeof e?"—":(0,T.aw)(p,e,!0)||"—",f=e=>"number"!=typeof e?"—":(0,T.aF)(p,e,!1)||"—";return h.length?(0,i.jsx)(tD.Z,{sx:{maxHeight:360,width:"100%",border:1,borderColor:"divider",borderRadius:1},children:(0,i.jsxs)(tM.Z,{stickyHeader:!0,size:"small",sx:{tableLayout:"fixed",width:"100%"},children:[(0,i.jsx)(tV.Z,{children:(0,i.jsxs)(eb.Z,{children:[(0,i.jsx)(eI.Z,{sx:{width:"15%"},children:m("common.user.one",{defaultValue:"User"})}),(0,i.jsx)(eI.Z,{sx:{width:"15%"},children:m("common.project",{defaultValue:"Project"})}),(0,i.jsx)(eI.Z,{sx:{width:"17%"},children:m("timeTrackingProceed.scheduleName",{defaultValue:"Schedule Name"})}),(0,i.jsx)(eI.Z,{sx:{width:"12%"},children:m("common.date",{defaultValue:"Date"})}),(0,i.jsx)(eI.Z,{sx:{width:"11%"},children:m("common.startTime",{defaultValue:"Start Time"})}),(0,i.jsx)(eI.Z,{sx:{width:"11%"},children:m("common.endTime",{defaultValue:"End Time"})}),(0,i.jsx)(eI.Z,{sx:{width:"19%"},children:m("common.description",{defaultValue:"Description"})})]})}),(0,i.jsx)(tR.Z,{children:h.map(e=>(0,i.jsxs)(eb.Z,{children:[(0,i.jsx)(eI.Z,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.mappedUser}),(0,i.jsx)(eI.Z,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.mappedProject}),(0,i.jsx)(eI.Z,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.mappedSchedule}),(0,i.jsx)(eI.Z,{children:v(e.dateValue)}),(0,i.jsx)(eI.Z,{children:f(e.startTimeValue)}),(0,i.jsx)(eI.Z,{children:f(e.endTimeValue)}),(0,i.jsx)(eI.Z,{sx:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:e.description,children:e.description})]},e.key))})]})}):(0,i.jsx)(d.Z,{variant:"body2",color:"text.secondary",children:m("timeTrackingProceed.noMappedRows",{defaultValue:"No mapped rows available to upload"})})},tz=e=>{var t;let{open:a,excelUserNames:l,excelUserMapping:n,usersData:r,isUploading:u=!1,onClose:m,onMapChange:p,excelProjectNames:h,excelProjectMapping:x,projectNames:v,onProjectMapChange:f,excelScheduleMappings:g,scheduleMapping:j,onScheduleMapChange:T,organizationId:y,projectId:w,projectName:Z,isOrganizationScope:N,parsedExcelRows:E,onConfirm:k}=e,{t:P}=(0,Q.$G)(),[A,D]=(0,c.useState)(0),M=(0,c.useMemo)(()=>tg({isOrganizationScope:N,excelProjectNames:h,excelScheduleMappings:g}),[N,h,g]);(0,c.useEffect)(()=>{a&&D(0)},[a]),(0,c.useEffect)(()=>{A>M.length-1&&D(Math.max(M.length-1,0))},[A,M.length]);let V=null!==(t=M[A])&&void 0!==t?t:"summary",R=A===M.length-1,L=tj(r),z=tT(v),U=ty(l,n
1),_=tC(h,x),H=tb({stepId:V,excelUserNames:l,excelUserMapping:n,excelProjectNames:h,excelProjectMapping:x});return(0,i.jsxs)(I.Z,{open:a,onClose:(e,t)=>{"backdropClick"!==t&&m()},maxWidth:"md",fullWidth:!0,PaperProps:{sx:{maxHeight:"calc(100vh - 32px)"}},children:[(0,i.jsxs)(th.Z,{sx:{px:{xs:2,sm:3},py:2},children:[(0,i.jsx)(d.Z,{variant:"body1",fontWeight:500,children:P("timeTrackingProceed.mapExcelUsersTitle",{defaultValue:"Timesheet Mapping"})}),(0,i.jsx)(d.Z,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:N?P("timeTrackingProceed.mapExcelUsersDescription",{defaultValue:"Map users, projects, and schedules from the uploaded file."}):P("timeTrackingProceed.mapProjectExcelColumnsDescription",{defaultValue:"Map users and schedules from the uploaded file."})})]}),(0,i.jsx)(b.Z,{}),(0,i.jsxs)(C.Z,{sx:{px:{xs:2,sm:3},py:2.5},children:[(0,i.jsx)(tx.Z,{activeStep:A,alternativeLabel:!0,sx:{mb:3},children:M.map(e=>(0,i.jsx)(tv.Z,{children:(0,i.jsx)(tf.Z,{children:P(tI[e],{defaultValue:tS[e]})})},e))}),"user"===V&&(0,i.jsx)(tk,{excelUserNames:l,excelUserMapping:n,userOptions:L,onMapChange:p}),"project"===V&&(0,i.jsx)(tP,{excelProjectNames:h,excelProjectMapping:x,projectOptions:z,onProjectMapChange:f}),"schedule"===V&&(0,i.jsx)(tA,{excelScheduleMappings:g,scheduleMapping:j,onScheduleMapChange:T,excelProjectMapping:x,projectNames:v,organizationId:y,projectId:w,projectName:Z,isOrganizationScope:N}),"summary"===V&&(0,i.jsx)(tL,{parsedExcelRows:E,excelUserMapping:n,usersData:r,excelProjectMapping:x,projectNames:v,scheduleMapping:j,isOrganizationScope:N,projectName:Z})]}),(0,i.jsxs)(S.Z,{sx:{px:{xs:2,sm:3},pb:2.5,gap:1,justifyContent:"space-between"},children:[(0,i.jsx)(s.Z,{variant:"outlined",onClick:m,disabled:u,sx:{minWidth:110},children:P("common.cancel")}),(0,i.jsxs)(o.Z,{sx:{display:"flex",gap:1},children:[A>0&&(0,i.jsx)(s.Z,{variant:"outlined",onClick:()=>{D(e=>Math.max(e-1,0))},disabled:u,sx:{minWidth:110},children:P("common.back",{defaultValue:"Back"})}),R?(0,i.jsx)(O.Z,{variant:"contained",onClick:k,loading:u,disabled:!U||N&&!_||u,sx:{minWidth:140},children:P("common.upload",{defaultValue:"Upload"})}):(0,i.jsx)(s.Z,{variant:"contained",onClick:()=>{H&&!R&&D(e=>Math.min(e+1,M.length-1))},disabled:!H||u,sx:{minWidth:110},children:P("common.next",{defaultValue:"Next"})})]})]})]})},tU=a(923753);let tO={"User ID":"userId",Username:"username",Project:"project","Project Name":"projectName",Chargeability:"chargeability",Date:"date","Start Time":"startTime"},t_={"Chargeability must be Chargeable or Non-chargeable":"invalidChargeability","Cost Rate must be a valid number":"invalidCostRate","Cost Rate cannot be negative":"negativeCostRate","Invalid field: Please enter a valid Cost Type":"invalidCostType","Date must be a valid timestamp":"invalidDate","Future date cannot be accepted":"futureDate","Linked Schedule is not available for the mapped project":"linkedScheduleUnavailable"},tH=(e,t,a,i)=>e.split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let l=t[e];return l?i("".concat(a,".").concat(l),{defaultValue:e}):i("timeTrackingProceed.uploadErrors.unknown",{defaultValue:"Unable to upload this row."})}).join(", "),tW=(e,t)=>"string"==typeof e&&e.trim()?e.split(" | ").map(e=>{let a="Missing required fields:";if(e.startsWith(a)){let i=tH(e.slice(a.length),tO,"timeTrackingProceed.uploadErrors.fields",t);return t("timeTrackingProceed.uploadErrors.missingRequiredFields",{fields:i,defaultValue:"Missing required fields: {{fields}}"})}let i="Invalid fields:";if(e.startsWith(i)){let a=tH(e.slice(i.length),t_,"timeTrackingProceed.uploadErrors.messages",t);return t("timeTrackingProceed.uploadErrors.invalidFields",{errors:a,defaultValue:"Invalid fields: {{errors}}"})}return e.startsWith("Database error:")?t("timeTrackingProceed.uploadErrors.databaseError",{defaultValue:"A database error prevented this row from uploading."}):t("timeTrackingProceed.uploadErrors.unknown",{defaultValue:"Unable to upload this row."})}).join(" | "):t("timeTrackingProceed.uploadErrors.unknown",{defaultValue:"Unable to upload this row."});var tY=e=>{let{open:t,onClose:a,data:l}=e,{t:n}=(0,Q.$G)();if(!l)return null;let r=[];return r=Array.isArray(null==l?void 0:l.dataResult)&&l.dataResult.length>0?l.dataResult.map((e,t)=>{let a=!(null==e?void 0:e.reason);return{rowNo:(null==e?void 0:e.rowNumber)||(null==e?void 0:e.rowNo)||t+1,status:a?"success":"failure",reason:a?n("timeTrackingProceed.timesheetUploaded",{defaultValue:"Timesheet uploaded"}):tW(null==e?void 0:e.reason,n)}}):[...l.successData.map((e,t)=>({rowNo:(null==e?void 0:e.rowNumber)||(null==e?void 0:e.rowNo)||t+1,status:"success",reason:n("timeTrackingProceed.timesheetUploaded",{defaultValue:"Timesheet uploaded"})})),...l.failureData.map((e,t)=>({rowNo:(null==e?void 0:e.rowNumber)||(null==e?void 0:e.rowNo)||l.successData.length+t+1,status:"failure",reason:tW(null==e?void 0:e.reason,n)}))],(0,i.jsx)(tU.Z,{open:t,onClose:a,title:n("timeTrackingProceed.uploadedTimesheets",{defaultValue:"Uploaded Timesheets"}),summaryTitle:n("timeTrackingProceed.timesheetUploadSummary",{defaultValue:"Timesheet Upload Summary"}),uploadStatusTitle:n("timeTrackingProceed.uploadStatus",{defaultValue:"Upload Status"}),total:l.total,successCount:l.successCount,failureCount:l.failureCount,rows:r,statusTranslationPrefix:"timeTrackingProceed",labels:{noOfUploads:n("timeTrackingProceed.noOfUploads",{defaultValue:"No. of Uploads"}),success:n("timeTrackingProceed.success",{defaultValue:"Success"}),failure:n("timeTrackingProceed.failure",{defaultValue:"Failure"}),rowNo:n("timeTrackingProceed.RowNo",{defaultValue:"Row No."}),status:n("timeTrackingProceed.status",{defaultValue:"Status"}),reason:n("timeTrackingProceed.reason",{defaultValue:"Reason"})}})},tF=a(259541),tq=a(361813),tB=a(245573),tG=a(188582),tK=a(684026);function t$(e){var t,a;let{session:l,usersData:n,selectedUser:r,startDate:o,endDate:s,scope:d,selectedChargeability:u,onApply:m,onClear:p}=e,{t:h}=(0,Q.$G)(),[x,v]=(0,c.useState)(""),[f,g]=(0,c.useState)(),[j,T]=(0,c.useState)(),[y,C]=(0,c.useState)("");(0,c.useEffect)(()=>{v(r),g(o),T(s),C(u)},[r,o,s,u]);let b=(null==l?void 0:l.isSuperAdmin)===!0||(null==l?void 0:null===(a=l.featurePermissions)||void 0===a?void 0:null===(t=a.timeTracking)||void 0===t?void 0:t.type)==="APPROVER",I=(0,c.useMemo)(()=>{let e=[];return b&&e.push({kind:"autocomplete",id:"user",label:h("common.user.one"),showSelectedInList:!0,options:n.map(e=>({value:e.userId,label:e.name})),value:x||"",onChange:e=>v(e||"")}),"project"===d&&e.push({kind:"autocomplete",id:"chargeability",label:h("timeTracking.chargeability",{defaultValue:"Chargeability"}),disableSearch:!0,options:eo.s.map(e=>({value:e.value,label:h("timeTracking.".concat(e.translationKey))})),value:y,onChange:e=>C(null!=e?e:"")}
1),e.push({kind:"custom",id:"dateRange",render:()=>(0,i.jsx)(tK.Z,{label:h("common.date"),onApply:(e,t)=>{g(null==e?void 0:e.toDate().getTime()),T(null==t?void 0:t.toDate().getTime())},value:{startDate:f?E()(f):void 0,endDate:j?E()(j):void 0},className:"mt-0 mb-0"})}),e},[b,d,n,x,y,f,j,h]),S=(0,c.useMemo)(()=>!!r||!!o||!!s||!!u,[r,o,s,u]),w=S?"".concat(h("common.filter"),", ").concat(h("schedule.filterMenu.appliedAria",{defaultValue:"filters applied"})):h("common.filter");return(0,i.jsx)(tB.Z,{ariaLabel:w,filters:I,onApply:()=>{m(x,f,j,y)},applied:S,footer:S?(0,i.jsx)(tG.Z,{onClick:()=>{p()}}):null})}var tQ=a(210927),tJ=a(772084),tX=a(373339),t0=a(254263),t1=a(757653),t2=a(137620),t5=a(742124),t6=a(493829),t4=a(726796),t3=a(624124),t8=a(23607),t7=a(459887);function t9(e){var t,a;let{open:l,onClose:r}=e,{t:s}=(0,Q.$G)(),u=(0,k.useRouter)(),{data:m}=(0,W.useSession)(),{clockIn:p,isMutating:h}=(0,t8.J7)(),x=null!==(a=null==m?void 0:m["custom:organization_id"])&&void 0!==a?a:"",v=(0,t3.ve)({organizationId:x,enabled:l}),[f,g]=(0,c.useState)("idle"),[j,T]=(0,c.useState)(null),[y,C]=(0,c.useState)(""),b=(0,c.useCallback)(()=>{if(!("geolocation"in navigator)){g("unsupported");return}g("requesting"),T(null),C(""),navigator.geolocation.getCurrentPosition(e=>{T({latitude:e.coords.latitude,longitude:e.coords.longitude}),g("ready")},e=>{e.code===e.PERMISSION_DENIED?g("denied"):e.code===e.TIMEOUT?g("timeout"):g("unavailable")},{enableHighAccuracy:!0,timeout:1e4,maximumAge:0})},[]);(0,c.useEffect)(()=>{l&&b()},[l,b]);let I=(0,c.useMemo)(()=>{var e,t;return j?(0,t7.Qw)(null!==(t=null===(e=v.data)||void 0===e?void 0:e.body)&&void 0!==t?t:[],j):[]},[j,null===(t=v.data)||void 0===t?void 0:t.body]);(0,c.useEffect)(()=>{var e;if(y||0===I.length)return;let t=I.find(e=>e.isInside);C(null!==(e=null==t?void 0:t.pinLocationId)&&void 0!==e?e:"")},[I,y]);let S=async()=>{if(!j||!y)return;let e=I.find(e=>e.pinLocationId===y);e&&await p({...j,pinLocationId:y,address:e.address})&&r()},w="denied"===f?"timeTracking.locationPermissionDenied":"timeout"===f?"timeTracking.locationRequestTimedOut":"unsupported"===f?"timeTracking.locationUnsupported":"unavailable"===f?"timeTracking.locationUnavailable":null,Z="requesting"===f||v.isLoading;return(0,i.jsx)(t4.H,{open:l,onClose:()=>{h||r()},title:s("timeTracking.clockInTitle"),maxWidth:"sm",dividerAfterTitle:!0,contentSx:{pt:2},secondaryAction:{label:s("common.cancel"),onClick:r,disabled:h},primaryAction:{label:s("timeTracking.clockIn"),onClick:S,loading:h,disabled:h||!j||!y},children:(0,i.jsxs)(n.Z,{spacing:2,children:[(0,i.jsx)(d.Z,{variant:"body2",color:"text.secondary",children:s("timeTracking.clockInLocationDescription")}),Z?(0,i.jsxs)(n.Z,{alignItems:"center",spacing:1,sx:{py:3},children:[(0,i.jsx)(z.Z,{size:24}),(0,i.jsx)(d.Z,{variant:"caption",children:s("timeTracking.gettingCurrentLocation")})]}):null,w?(0,i.jsx)(tX.Z,{severity:"warning",action:(0,i.jsx)(d.Z,{component:"button",variant:"caption",onClick:b,sx:{border:0,bgcolor:"transparent",color:"primary.main",cursor:"pointer"},children:s("timeTracking.retryLocation")}),children:s(w)}):null,!Z&&"ready"===f&&v.isError?(0,i.jsx)(tX.Z,{severity:"error",children:s("timeTracking.clockLocationsLoadFailed")}):null,Z||"ready"!==f||v.isError||0!==I.length?null:(0,i.jsx)(tX.Z,{severity:"info",children:s("timeTracking.noClockLocations")}),I.length>0?(0,i.jsx)(t0.Z,{disablePadding:!0,sx:{display:"grid",gap:1},children:I.map(e=>(0,i.jsxs)(t1.Z,{selected:y===e.pinLocationId,disabled:!e.isInside||h,onClick:()=>C(e.pinLocationId),sx:{border:1,borderColor:"divider"},children:[(0,i.jsx)(t2.Z,{checked:y===e.pinLocationId,disabled:!e.isInside||h,size:"small"}),(0,i.jsxs)(o.Z,{sx:{flex:1,minWidth:0},children:[(0,i.jsx)(d.Z,{variant:"body2",noWrap:!0,children:e.address}),(0,i.jsx)(d.Z,{variant:"caption",color:"text.secondary",children:s("timeTracking.distanceFromLocation",{distance:Math.round(e.distance)})})]}),(0,i.jsx)(t5.Z,{size:"small",color:e.isInside?"success":"default",label:s(e.isInside?"timeTracking.insideLocation":"timeTracking.outsideLocation")})]},e.pinLocationId))}):null,(0,i.jsxs)(d.Z,{component:"button",variant:"body2",onClick:()=>{r(),u.push("/preferences/organization-locations")},sx:{alignSelf:"flex-start",display:"inline-flex",alignItems:"center",gap:.75,border:0,bgcolor:"transparent",color:"primary.main",cursor:"pointer",p:0},children:[(0,i.jsx)(t6.Z,{size:16}),s("timeTracking.manageClockLocations")]})]})})}var ae=e=>{let{scope:t="project"}=e,a="organization"===t,{isCreator:u}=(0,X.i)(),{usersData:m}=(0,l.h)(),v=(0,eU.NL)(),[f,g]=(0,c.useState)(""),[j,y]=(0,c.useState)(),[C,b]=(0,c.useState)(),[I,S]=(0,c.useState)(""),[w,Z]=(0,c.useState)(!1),[N,E]=(0,c.useState)(!1),[P,A]=(0,c.useState)(!1),[D,M]=(0,c.useState)(1),[V,R]=(0,c.useState)(10),L=(0,k.useRouter)(),{loading:z,data:U,error:O,refetch:_}=function(e){var t,a,i,l;let{scope:n="project",selectedUser:r,startDate:o,endDate:s,chargeabilityType:d,currentPage:c,rowsPerPage:u}=e,m="organization"===n,{NEXT_PUBLIC_LEADMANAGER_ENDPOINT:x}=(0,h.k)(),{post:v}=(0,p.m)(x+(m?"/organization-timesheets":"/project-timesheets")),{data:f}=(0,W.useSession)(),g=(0,k.useRouter)(),{leadData:j}=(0,H.qD)(),T=g.query.projectId||(null==j?void 0:j.projectId),y=null==f?void 0:f["custom:organization_id"],C="string"==typeof r?r.trim():null!==(i=null==r?void 0:null===(a=r.userId)||void 0===a?void 0:null===(t=a.trim)||void 0===t?void 0:t.call(a))&&void 0!==i?i:null==r?void 0:r.userId,b=(0,e_.a)({queryKey:["timesheets",n,y,T,C,o,s,d,
1c,u],queryFn:async()=>{let e={eventType:"GET_TIMESHEETS",organizationId:y,...m?{isOrganizationLevel:!0}:{},filters:{...m?{}:{projectId:T},...C?{userId:C}:{},...null!=o?{startDate:o}:{},...null!=s?{endDate:s}:{},...!m&&d?{chargeabilityType:d}:{},pageNumber:c,pageCount:u}},t=await v(e);if((null==t?void 0:t.code)!=="TIMESHEET_RETRIEVED")throw Error("Error fetching timesheets");return t.body},enabled:!!(m||T)});return{loading:b.isLoading,data:null!==(l=b.data)&&void 0!==l?l:eH,error:b.error?b.error.message:"",refetch:b.refetch}}({scope:t,selectedUser:f,startDate:j,endDate:C,chargeabilityType:I,currentPage:D,rowsPerPage:V}),{data:F}=(0,W.useSession)(),{activeSession:B,isLoading:G}=(0,t8.J7)(),{localizationValue:K}=(0,x.W)(),{dashboardData:$,refetch:J}=function(e){let{scope:t="project",selectedUser:a,startDate:i,endDate:l,chargeabilityType:n}=e,r="organization"===t,{NEXT_PUBLIC_LEADMANAGER_ENDPOINT:o}=(0,h.k)(),{post:s}=(0,p.m)(o+(r?"/organization-timesheets":"/project-timesheets")),{data:d}=(0,W.useSession)(),c=(0,k.useRouter)(),{leadData:u}=(0,H.qD)(),m=c.query.projectId||(null==u?void 0:u.projectId),x=null==d?void 0:d["custom:organization_id"],v=(0,e_.a)({queryKey:["timesheet-dashboard",t,x,m,a,i,l,n],queryFn:async()=>{let e={eventType:"FETCH_TIMESHEET_DASHBOARD",organizationId:x,...r?{isOrganizationLevel:!0}:{},filters:{...r?{}:{projectId:m},userId:a,startDate:i,endDate:l,...n?{chargeabilityType:n}:{}}},t=await s(e);if((null==t?void 0:t.code)!=="TIMESHEET_PROJECT_DASHBOARD_DATA_RETRIEVED")throw Error("Error fetching timesheets");return t.body},enabled:!!(!r&&m)});return{loading:v.isLoading,dashboardData:v.data,error:v.error?v.error.message:"",refetch:v.refetch}}({scope:t,selectedUser:f,startDate:j,endDate:C,chargeabilityType:I}),{editTimeSheet:ee}=eY(t),{editTimeSheet:et}=eY("project"),{NEXT_PUBLIC_LEADMANAGER_ENDPOINT:ea}=(0,h.k)(),{post:ei}=(0,p.m)(ea+"/fetch"),{handleTimeSheetUpload:el,handleMappedTimeSheetUpload:en,isUploading:er,uploadProgress:eo,uploadResult:es,showPreview:ed,setShowPreview:ec,openUserMappingDialog:eu,closeUserMappingDialog:em,parsedExcelRows:ep,excelUserNames:eh,excelUserMapping:ex,setMappedUserForExcelName:ev,excelProjectNames:ef,excelProjectMapping:eg,setMappedProjectForExcelName:ej,excelScheduleMappings:eT,scheduleMapping:ey,setMappedSchedule:eC,projectNames:eb,organizationId:eI,projectId:eS,projectName:ew,isOrganizationScope:eZ}=tp(()=>{_(),a||J()},t),[eN,eE]=(0,c.useState)(),{t:ek}=(0,Q.$G)();(0,c.useEffect)(()=>{if(K){var e;let t=null!==(e=(0,T.LY)(K,"CURRENCY","SYMBOL"))&&void 0!==e?e:"";t&&eE(t)}},[K]),(0,c.useEffect)(()=>{v.prefetchQuery({queryKey:tm.S,queryFn:async()=>{let e=await ei({eventType:"GET_PROJECT_NAMES"});if((null==e?void 0:e.code)!=="PROJECTS_RETRIEVED")throw Error("Failed to load project names");return Array.isArray(e.body)?e.body:[]}})},[ei,v]);let{deleteTimeSheet:eP}=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"project",i="organization"===a,{NEXT_PUBLIC_LEADMANAGER_ENDPOINT:l,NEXT_PUBLIC_PROCUREMENT_ENDPOINT:n}=(0,h.k)(),{post:r}=(0,p.m)(l+(i?"/organization-timesheets":"/project-timesheets")),{post:o}=(0,p.m)(n+"/worker-management"),{data:s}=(0,W.useSession)(),{leadData:d}=(0,H.qD)(),{t:c}=(0,Q.$G)(),u=(0,eU.NL)(),{updateShiftAttendance:m,isLoading:x}=(0,eW.Z)(),v=async e=>{try{let a=await o({eventType:"GET_WORKERS_BY_SHIFT_ID",generatedShiftId:e});if("WORKERS_FOUND"===a.code){var t;return(null===(t=a.body)||void 0===t?void 0:t.workers)||[]}return[]}catch(e){return console.error("Error fetching workers:",e),[]}},f=(0,q.D)({mutationFn:async e=>{var t,a,l,n,o,u;let{timesheet:p,reason:h}=e,x={eventType:"DELETE_TIMESHEET",organizationId:null==s?void 0:s["custom:organization_id"],...i?{}:{projectId:null==d?void 0:d.projectId,clientName:null==d?void 0:null===(t=d.lead)||void 0===t?void 0:t.leadName,projectName:null==d?void 0:d.projectName},timesheetId:p.timesheetId||p,reason:h},f=await r(x);if((null==f?void 0:f.code)!=="TIMESHEET_DELETED")throw Error("Error deleting timesheet");try{if(!i&&(null==p?void 0:p.generatedShiftId)&&(null==p?void 0:p.userId)){let e=await v(p.generatedShiftId),t=null==e?void 0:e.find(e=>e.organizationUserId===p.userId),i=null==t?void 0:null===(a=t.attendance)||void 0===a?void 0:a.shiftAttendanceId;i&&t&&await m({shiftId:p.shiftId,generatedShiftId:p.generatedShiftId,workerId:null==t?void 0:t.workerId,contractorWorkerId:null,type:"ORGANIZATION_USER",shiftAttendanceId:i,shiftWorkerStatus:"ABSENT",workerRate:(null==t?void 0:null===(l=t.workerRateDetails)||void 0===l?void 0:l.rate)||0,overTimeRate:(null==t?void 0:null===(n=t.workerRateDetails)||void 0===n?void 0:n.overTimeRate)||0,workerRateType:(null==t?void 0:null===(o=t.workerRateDetails)||void 0===o?void 0:o.rateType)||"HR",overTimeRateType:(null==t?void 0:null===(u=t.workerRateDetails)||void 0===u?void 0:u.overTimeDurationType)||"HR",totalWorkedDuration:0})}}catch(e){console.error("Error updating attendance:",e),Y.Am.warning(c("timeTracking.timesheetDeletedButAttendanceError",{defaultValue:"Timesheet deleted but failed to update attendance"}))}return!0},onSuccess:()=>
1{e(),i||t(),u.invalidateQueries({queryKey:["schedule","timesheets"]})},onError:e=>{console.error("Network error:",e)}}),g=async(e,t)=>{try{return await f.mutateAsync({timesheet:e,reason:t})}catch(e){return!1}};return{loading:f.isPending,data:f.data,error:f.error?f.error.message:"",deleteTimeSheet:g}}(_,J,t);(0,c.useEffect)(()=>{if(!L.isReady||a||"TimeTracking"!==(Array.isArray(L.query.tab)?L.query.tab[0]:L.query.tab)||"true"!==(Array.isArray(L.query.openCreate)?L.query.openCreate[0]:L.query.openCreate))return;u?Z(!0):A(!0);let{openCreate:e,...t}=L.query;L.replace({pathname:L.pathname,query:t},void 0,{shallow:!0})},[u,a,L,L.isReady,L.query.openCreate,L.query.tab]),(0,c.useEffect)(()=>{if(!a)return;let e=()=>{_()};return window.addEventListener(t8.qP,e),()=>window.removeEventListener(t8.qP,e)},[a,_]);let eA=(0,tq.X2)();return(0,i.jsx)(tF.Xg,{title:ek("common.timeTracking",{defaultValue:"Time Tracking"}),onBack:a?void 0:eA,maxHeight:tF.C5,bodySx:{overflowY:"hidden"},contentSx:{flex:1,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},actions:(0,i.jsxs)(n.Z,{direction:"row",spacing:1,children:[a?(0,i.jsx)(r.Z,{title:B?ek("timeTracking.clockAlreadyActive"):"",children:(0,i.jsx)(o.Z,{component:"span",sx:{display:"inline-flex"},children:(0,i.jsx)(s.Z,{variant:"outlined",startIcon:(0,i.jsx)(tJ.Z,{}),disabled:G||!!B,onClick:()=>E(!0),sx:{textTransform:"none"},children:ek(B?"timeTracking.currentlyClockedIn":"timeTracking.clockIn")})})}):null,(0,i.jsxs)(s.Z,{variant:"contained",onClick:()=>{if(u){Z(!0);return}A(!0)},sx:{textTransform:"none"},children:["+ ",ek("timeTracking.createTimeSheet")]})]}),secondaryActions:(0,i.jsx)(t$,{session:F,usersData:m,selectedUser:f,startDate:j,endDate:C,scope:t,selectedChargeability:I,onApply:(e,t,a,i)=>{g(e),y(t),b(a),S(i),M(1)},onClear:()=>{g(""),y(void 0),b(void 0),S(""),M(1)}}),children:(0,i.jsxs)(o.Z,{sx:{width:"100%",flex:1,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[!a&&(0,i.jsxs)(o.Z,{className:"d-flex",sx:{gap:1,maxWidth:"100%",mb:1},children:[(0,i.jsxs)(tQ.J,{isClickable:!1,sx:{flex:1,bgcolor:"background.paper"},children:[ek("timeTracking.totalTime"),":"," ",(0,i.jsxs)("span",{className:"fs-7 my-1 d-flex justify-content-between",children:[(0,i.jsx)(o.Z,{component:"span",className:"fs-6 ml-1",sx:{fontWeight:400},children:(0,i.jsxs)(o.Z,{className:"d-flex",children:[(0,T.Ii)(null==$?void 0:$.totalProductiveTime)," ","\xa0\xa0",(0,i.jsxs)(o.Z,{className:"d-flex justify-content-center align-item-center",sx:{color:"text.primary",width:"60px",paddingY:"3px",fontSize:"10px",borderRadius:"5px",border:1,borderColor:"divider"},children:[null==$?void 0:$.totalUsers," ",ek("common.user.other")]})]})}),(0,i.jsx)(d.Z,{className:"d-flex align-content-center",sx:{color:e=>e.palette.primary.main},children:(0,i.jsx)(eF.Z,{fill:"currentColor",width:"30px"})})]})]}),(0,i.jsxs)(tQ.J,{isClickable:!1,sx:{flex:1,bgcolor:"background.paper"},children:[ek("timeTracking.timeConvertedToExpenses"),":"," ",(0,i.jsxs)("span",{className:"fs-7 my-1 d-flex justify-content-between",children:[(0,i.jsxs)(o.Z,{component:"span",className:"fs-6 ml-1",sx:{fontWeight:400},children:[" ",(0,T.Ii)(null==$?void 0:$.totalConvertedHours)]}),(0,i.jsx)(d.Z,{className:"d-flex align-content-center",sx:{color:e=>e.palette.primary.main},children:(0,i.jsx)(eB,{fill:"currentColor",width:"30px"})})]})]}),(0,i.jsxs)(tQ.J,{isClickable:!1,sx:{flex:1,bgcolor:"background.paper"},children:[ek("workerManagement.totalWage",{defaultValue:"Total Wage"}),":"," ",(0,i.jsxs)("span",{className:"fs-7 my-1 d-flex justify-content-between",children:[(0,i.jsxs)(o.Z,{component:"span",className:"fs-6 ml-1",sx:{fontWeight:400},children:[" ",eN," ",(0,T.Is)(K,null==$?void 0:$.totalCost)]}),(0,i.jsx)(d.Z,{className:"d-flex align-content-center",sx:{color:e=>e.palette.primary.main},children:(0,i.jsx)(eq.Z,{fill:"currentColor",width:"30px"})})]})]}),(0,i.jsxs)(tQ.J,{isClickable:!1,sx:{flex:1,bgcolor:"background.paper"},children:[ek("timeTracking.wageConvertedToInvoice",{defaultValue:"Wage Converted to Invoice"}),":"," ",(0,i.jsxs)("span",{className:"fs-7 my-1 d-flex justify-content-between",children:[(0,i.jsxs)(o.Z,{component:"span",className:"fs-6 ml-1",sx:{color:"error.main",fontWeight:400},children:[" ",eN," ",(0,T.Is)(K,null==$?void 0:$.totalConvertedCost)]}),(0,i.jsx)(d.Z,{className:"d-flex align-content-center",sx:{color:e=>e.palette.primary.main},children:(0,i.jsx)(eG,{fill:"currentColor",width:"30px"})})]})]})]}),(0,i.jsx)(o.Z,{sx:{flex:1,minHeight:0,width:"100%",overflow:"hidden",display:"flex",flexDirection:"column"},children:(0,i.jsx)(eL,{loading:z,timeSheets:U,deleteTimeSheet:eP,editTimeSheet:ee,editProjectTimeSheet:et,scope:t,setCurrentPage:M,setRowsPerPage:R,onTimesheetChanged:async()=>{await _(),a||await J()}})}),w&&(0,i.jsx)(eO,{open:w,handleClose:()=>{Z(!1)},onSuccess:()=>{_(),a||J()},scope:t}),a?(0,i.jsx)(t9,{open:N,onClose:()=>E(!1)}):null,(0,i.jsx)(eJ,{isOpen:P,onClose:()=>A(!1),showUploadOption:!u,onProceedScratch:()=>{A(!1),Z(!0)}
1,onProceedUpload:async e=>{await el(e),A(!1)},isUploading:er,uploadProgress:eo}),(0,i.jsx)(tz,{open:eu,excelUserNames:eh,excelUserMapping:ex,usersData:m,isUploading:er,onClose:em,onMapChange:ev,excelProjectNames:ef,excelProjectMapping:eg,projectNames:eb,onProjectMapChange:ej,excelScheduleMappings:eT,scheduleMapping:ey,onScheduleMapChange:eC,organizationId:eI,projectId:eS,projectName:ew,isOrganizationScope:eZ,parsedExcelRows:ep,onConfirm:()=>en(m)}),(0,i.jsx)(tY,{open:ed,onClose:()=>ec(!1),data:es})]})})}},684026:function(e,t,a){var i=a(785893),l=a(727790),n=a(764202),r=a(76517),o=a(95442),s=a(202302),d=a(869320),c=a(298969),u=a(137491),m=a(928864),p=a(556143),h=a(604342),x=a(965457),v=a(353075),f=a(83205),g=a(725669),j=a(727484),T=a.n(j),y=a(366607),C=a.n(y),b=a(667294),I=a(567421),S=a(730737),w=a(772699);T().extend(C());let Z=(0,h.ZP)(v.H,{shouldForwardProp:e=>"inRange"!==e&&"isHovered"!==e})(e=>{let{theme:t,inRange:a,selected:i,day:l,start:n,end:r,beforeEnd:o}=e;return{borderRadius:0,...i&&{borderRadius:"50%"},...a&&{backgroundColor:(0,x.Fq)(t.palette.primary.main,.1),color:t.palette.common.black,"&:hover, &:focus":{backgroundColor:(0,x.Fq)(t.palette.primary.main,.1)}},...(0===l.day()||n||l.isSame(l.startOf("month"),"day"))&&{borderTopLeftRadius:"50%",borderBottomLeftRadius:"50%"},...(6===l.day()||r||l.isSame(l.endOf("month"),"day")||o)&&{borderTopRightRadius:"50%",borderBottomRightRadius:"50%"}}}),N=(e,t,a)=>!!t&&!!a&&(null==e?void 0:e.isBetween(t,a));function E(e,t){let a=e.year(),i=e.month(),l=e.date(),n=t.year(),r=t.month(),o=t.date();return a===n&&i===r&&l===o}function k(e){let{day:t,startDay:a,endDay:l,endComponent:n,minDay:r,...o}=e;return(0,i.jsx)(Z,{...o,day:t,disableMargin:!0,sx:{border:"none",outline:"none"},selected:!!a&&E(t,a)||!!l&&E(t,l),inRange:N(t,a,l),start:t.subtract(1,"day").isSame(a),end:t.add(1,"day").isSame(l),beforeEnd:t.isBetween(null==l?void 0:l.subtract(2,"day"),l),disabled:!!r&&t.isBefore(r,"day")})}t.Z=e=>{let{label:t,onApply:a,onClear:h,value:x,className:v,width:j,filterMenuField:T=!1}=e,[y,C]=(0,b.useState)(null),[Z,N]=(0,b.useState)(),{t:E}=(0,I.$G)(),[P,A]=(0,b.useState)(null),[D,M]=(0,b.useState)(),V=(0,n.Z)("(max-width:768px)"),{dateFormat:R,organizationTimezone:L,toLocalizedDayjs:z,getCurrentLocalizedDay:U}=(0,S.Z)(),O=()=>{C(null)},_=e=>{var t;if(!e)return;let a=null!==(t=z(e))&&void 0!==t?t:e;!Z||Z&&D?(N(a),M(void 0)):a.isBefore(Z,"day")?(N(a),M(void 0)):M(a.endOf("day"))},H=!!y;(0,b.useEffect)(()=>{if(x){var e,t;N(x.startDate&&null!==(e=z(x.startDate))&&void 0!==e?e:void 0),M(x.endDate&&null!==(t=z(x.endDate))&&void 0!==t?t:void 0)}},[L,x]);let W=e=>{if(!e)return"";let t=z(e);return t?t.format(R):""},Y=U().subtract(6,"month");return(0,i.jsx)(l.ZZ,{children:(0,i.jsxs)("div",{className:T?"":void 0!==v?v:"mt-1 mb-2",children:[(0,i.jsx)(p.Z,{label:t,variant:"standard",size:T?"small":"medium",onClick:e=>{C(null==e?void 0:e.currentTarget)},"aria-readonly":!0,fullWidth:!0,InputLabelProps:{shrink:!!T||void 0},sx:{cursor:"pointer",width:j||"100%",...T?w.uO:{}},InputProps:{endAdornment:(0,i.jsx)(r.Z,{position:"end",children:(0,i.jsx)(f.x,{})})},value:Z&&D?"".concat(W(Z)," - ").concat(W(D)):""}),(0,i.jsx)(m.ZP,{id:H?"date-range-popover":void 0,open:H,anchorEl:y,onClose:O,disableScrollLock:!0,anchorOrigin:{vertical:"bottom",horizontal:V?-200:-300},children:(0,i.jsxs)(o.Z,{sx:{p:0},children:[(0,i.jsxs)(u.ZP,{container:!0,direction:"row",p:0,children:[(0,i.jsx)(g.W,{autoFocus:!0,timezone:L,onChange:_,sx:{".MuiDayCalendar-weekDayLabel":{margin:0},".MuiPickersDay-today":{border:"none"},".Mui-selected":{bgcolor:"black"}},shouldDisableMonth:e=>e.isBefore(Y,"month"),slots:{day:k},defaultCalendarMonth:U(),slotProps:{day:e=>({startDay:Z,minDay:Y,onPointerEnter:()=>A(e.day),onPointerLeave:()=>A(null),endDay:D}),calendarHeader:()=>({sx:{marginX:2}})}}),(0,i.jsx)(s.Z,{orientation:"vertical",flexItem:!0}),(0,i.jsx)(g.W,{autoFocus:!0,timezone:L,sx:{".MuiDayCalendar-weekDayLabel":{margin:0},".Mui-selected":{bgcolor:"black"}},shouldDisableMonth:e=>e.isSame(Z,"month")||e.isBefore(Z,"month"),onChange:_,slots:{day:k},defaultCalendarMonth:U().add(1,"month"),slotProps:{day:e=>({startDay:Z,minDay:Y,hoveredDay:P,onPointerEnter:()=>A(e.day),onPointerLeave:()=>A(null),endDay:D,endComponent:!0}),calendarHeader:()=>({sx:{marginX:2}})}})]}),(0,i.jsx)(s.Z,{orientation:"horizontal",flexItem:!0}),(0,i.jsxs)(u.ZP,{container:!0,justifyContent:"space-between",marginLeft:"auto",direction:"row",mx:1,px:1,children:[(0,i.jsxs)(o.Z,{sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[(0,i.jsx)(d.Z,{className:"".concat(void 0==Z?"invisible":"visible"),children:Z?W(Z):R}),"\xa0-\xa0",(0,i.jsx)(d.Z,{children:D?W(D):""})]}),(0,i.jsxs)(o.Z,{sx:e=>({"& .MuiButtonBase-root":{textTransform:"Capitalize",padding:"0 6px",margin:"6px",color:"#ffff",":disabled":{opacity:"0.4"}}}),children:[(0,i.jsx)(c.Z,{variant:"contained",onClick:()=>{N(void 0),M(void 0),a(void 0,void 0),O(),null==h||h()},sx:{background:"#f7685b",":hover":{background:"#f7685b",color:"#ffffff"}},children:E("common.clear")}),(0,i.jsx)(c.Z,{variant:"contained",sx:{background:"primary.main"},onClick:()=>{a(Z,D),O()},children:E("common.apply")})]})]})]})})]})})}},491407:function(e,t,a){var i=a(92399),l=a(450905),n=a(254339),r=a(667294);t.Z=()=>{let[e,t]=(0,r.useState)(!1),[a,o]=(0,r.useState)(null),{leadData:s}=(0,i.qD)(),{NEXT_PUBLIC_PROCUREMENT_ENDPOINT:d}=(0,n.k)(),{post:c}=(0,l.m)(d+"/worker-management");return{createShiftAttendance:async e=>{try{var a,i;t(!0),o(null);let{generatedShiftId:l,shiftWorkerId:n}=e;if(!l||!n)return;let r={eventType:"CREATE_SHIFT_ATTENDANCE",projectId:(null==s?void 0:s.projectId)||"",projectName:null==s?void 0:s.projectName,...e,leadI
1d:(null==s?void 0:null===(a=s.lead)||void 0===a?void 0:a.leadId)||""},d=await c(r);if((null==d?void 0:d.code)==="SHIFT_ATTENDANCE_CREATED")return console.log(d),(null==d?void 0:null===(i=d.body)||void 0===i?void 0:i.shiftAttendance)||{};throw Error(d.code||"Something went wrong")}catch(e){if(e instanceof Error)throw Error(null==e?void 0:e.message);throw Error("Something went wrong")}finally{t(!1)}},updateShiftAttendance:async e=>{try{var a,i;if(t(!0),o(null),!(null==e?void 0:e.shiftAttendanceId))return;let l={eventType:"EDIT_SHIFT_ATTENDANCE",projectId:(null==s?void 0:s.projectId)||"",leadId:(null==s?void 0:null===(a=s.lead)||void 0===a?void 0:a.leadId)||"",projectName:null==s?void 0:s.projectName,...e},n=await c(l);if((null==n?void 0:n.code)==="SHIFT_ATTENDANCE_UPDATED")return(null==n?void 0:null===(i=n.body)||void 0===i?void 0:i.shiftAttendance)||{};throw Error(n.code||"Something went wrong")}catch(e){throw Error((null==e?void 0:e.message)||"Something went wrong")}finally{t(!1)}},isLoading:e,error:a}}},493829:function(e,t,a){a.d(t,{Z:function(){return i}});let i=(0,a(966157).Z)("map-pinned",[["path",{d:"M18 8c0 3.613-3.869 7.429-5.393 8.795a1 1 0 0 1-1.214 0C9.87 15.429 6 11.613 6 8a6 6 0 0 1 12 0",key:"11u0oz"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M8.714 14h-3.71a1 1 0 0 0-.948.683l-2.004 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .948-1.316l-2-6a1 1 0 0 0-.949-.684h-3.712",key:"q8zwxj"}]])}}]);

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.