whoami7 - Manager
:
/
home
/
qbizpnmr
/
arif.umairtax.com
/
public
/
Upload File:
files >> /home/qbizpnmr/arif.umairtax.com/public/Kanban-Bcat7y23.js
import{u as W,a as G,t as be,c7 as Ee,f as fe,d as Be,Y as ge,bt as je,Z as A,j as e,bx as ke,by as q,eM as Ce,eN as Le,a8 as Ve,aA as Pe,l as ve,eO as $e,eP as I,cQ as Me,e as X,cR as Oe,bT as Ae,H as K,$ as H,p as j,eT as ze,ad as ye,cx as L,ae as Y,cu as Fe,cV as _e,cW as He,eV as Re,eW as We,eX as Ke,bf as P,eY as Qe,r as we,L as Ue,ap as Ze,eZ as qe,e_ as Ye,a9 as Ge,e$ as Xe,f0 as Je,i as le,Q as es,bw as ss,dZ as ts,C as os,b7 as as,b8 as ie,b9 as de,cb as ce,f1 as rs,bq as ns,bc as ls,f2 as is,be as ue,bd as me,z as ds}from"./bundle.OlIVtvc7.js";import{u as J,c as ee,a as cs,i as us,b as ms}from"./hooks-XTagFAuk.js";import{T as R}from"./TaskClock-SGIUUrSZ.js";import{u as xs,a as hs,p as xe,L as C,b as he,d as ps,h as bs,T as fs,c as gs,M as js,e as ks}from"./TaskDetails-DEMDYSXK.js";import"./ClientActionButtons-DC8u7uNL.js";import"./react-responsive-DfXP7Il0.js";const Cs=K.div` background-color: ${({theme:o})=>o.backgroundColor}; &:hover { background-color: ${({theme:o})=>o.hoverBackgroundColor}; } `;function vs(){var d,v;const[o]=W(),t=G(),s=be();Ee();const{dateFormat:b}=fe(),D=Be(),k=ge(),_=J(),E=je(),[a]=A(ee),m=a&&_(a.time_log),T=()=>{H(["tasks"])};return e.jsxs(ke,{tabs:[o("overview"),o("documents")],width:"full",formatTabLabel:u=>{if(u===1)return e.jsx(Ae,{numberOfDocuments:a==null?void 0:a.documents.length,textCenter:!0})},withHorizontalPadding:!0,horizontalPaddingWidth:"1.5rem",children:[e.jsx("div",{children:a&&e.jsxs(e.Fragment,{children:[e.jsx(q,{leftSide:o("duration"),children:Ce(a.time_log.toString())}),e.jsx(q,{leftSide:o("rate"),children:D(a.rate||s.settings.default_task_rate,(d=a.client)==null?void 0:d.country_id,(v=a.client)==null?void 0:v.settings.currency_id)}),e.jsx(q,{leftSide:o("status"),children:e.jsx(Le,{entity:a,withoutDropdown:!0})}),a.description&&e.jsxs("div",{className:"flex flex-col justify-start px-6 py-3",children:[e.jsx(Ve,{className:"mb-1",children:o("description")}),e.jsx("span",{className:"text-sm mt-1",style:{color:t.$3},children:a.description})]}),!!(m!=null&&m.length)&&e.jsx(Pe,{className:"pt-1",withoutPadding:!0,borderColor:t.$20}),e.jsx("div",{className:"flex flex-col space-y-4 px-6 py-5 overflow-y-auto max-h-[30rem]",children:m==null?void 0:m.map(([u,B,g],w)=>e.jsxs(Cs,{className:"flex items-center justify-between p-4 w-full shadow-sm border rounded-md",style:{borderColor:t.$20},theme:{backgroundColor:t.$1,hoverBackgroundColor:t.$4},children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("p",{className:"text-sm font-medium",style:{color:t.$3},children:ve(u,b)}),e.jsxs("span",{className:"text-xs",style:{color:t.$17},children:[B," - ",g]})]}),e.jsx("div",{className:"text-sm font-medium",style:{color:t.$3},children:I(a)&&w===m.length-1?e.jsx(R,{task:a,calculateLastTimeLog:!0}):$e(a.time_log,w)})]},w))})]})}),e.jsxs("div",{className:"px-4",children:[e.jsx(Me,{endpoint:X("/api/v1/tasks/:id/upload",{id:a==null?void 0:a.id}),onSuccess:T,widgetOnly:!0,disableUpload:!k("edit_task")&&!E(a)}),e.jsx(Oe,{documents:(a==null?void 0:a.documents)||[],onDocumentDelete:T,disableEditableOptions:!E(a,!0)&&!k("edit_task")})]})]})}const $s=K.div` background-color: ${({theme:o})=>o.backgroundColor}; &:hover { background-color: ${({theme:o})=>o.hoverBackgroundColor}; } `;function ys(){const[o]=W(),[t,s]=A(ee),b=G(),{dateFormat:D}=fe(),k=be(),_=J(),E=xs(),a=hs(),[m,T]=j.useState(!1),[d,v]=j.useState(),[u,B]=j.useState([]),g=(r,$)=>{s(y=>y&&{...y,[r]:$})},w=We(),M=(r,$,y,N)=>{g("time_log",a(t.time_log,r,$,y,N))},z=(r,$,y,N)=>{g("time_log",E(t.time_log,r,$,N,y))},Q=(r,$,y)=>{g("time_log",bs(t.time_log,r,$,y))};return j.useEffect(()=>{t!=null&&t.time_log&&B(ze(t.time_log))},[d,t==null?void 0:t.time_log]),e.jsxs(e.Fragment,{children:[e.jsxs(ye,{title:o("time_log"),visible:m&&u.length>0,onClose:()=>{T(!1),v(void 0)},overflowVisible:!0,children:[u[Number(d)]&&e.jsxs(e.Fragment,{children:[e.jsx(L,{label:o("start_date"),type:"date",value:xe(u[d][C.Start]),onValueChange:r=>M(u[d][C.Start],r,d,C.Start)}),e.jsx(L,{label:o("start_time"),type:"time",step:"1",value:he(u[d][C.Start]),onValueChange:r=>z(u[d][C.Start],r,C.Start,d)}),(k==null?void 0:k.show_task_end_date)&&e.jsx(L,{label:o("end_date"),type:"date",value:xe(u[d][C.End]),onValueChange:r=>M(u[d][C.End],r,d,C.End)}),e.jsx(L,{type:"time",step:"1",label:o("end_time"),value:he(u[d][C.End]),onValueChange:r=>z(u[d][C.End],r,d,C.End)}),e.jsx(L,{label:o("duration"),debounceTimeout:1e3,value:ps(u[d][C.Start],u[d][C.End],k==null?void 0:k.show_task_end_date),onValueChange:r=>Q(r,u[d][C.Start],d)})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(Y,{onClick:()=>T(!1),children:o("done")})})]}),e.jsxs(ke,{tabs:[o("details"),o("times")],width:"full",withHorizontalPadding:!0,horizontalPaddingWidth:"1.5rem",children:[e.jsx("div",{children:e.jsxs("div",{className:"px-6 space-y-4",children:[e.jsx(Fe,{inputLabel:o("client"),value:t==null?void 0:t.client_id,onChange:r=>g("client_id",r.id)}),e.jsx(_e,{inputLabel:o("project"),value:t==null?void 0:t.project_id,onChange:r=>g("project_id",r.id)}),e.jsx(He,{inputLabel:o("assigned_user"),value:t==null?void 0:t.assigned_user_id,onChange:r=>g("assigned_user_id",r.id)}),e.jsx(L,{label:o("task_number"),value:t==null?void 0:t.number,onValueChange:r=>g("number",r)}),e.jsx(L,{label:o("rate"),value:t==null?void 0:t.rate,onValueChange:r=>g("rate",r)}),e.jsx(Re,{inputLabel:o("status"),value:t==null?void 0:t.status_id,onChange:r=>r&&g("status_id",r.id),onClearButtonClick:()=>g("status_id","")}),e.jsx(L,{label:o("description"),element:"textarea",value:t==null?void 0:t.description,onValueChange:r=>g("description",r)})]})}),e.jsxs("div",{className:"flex flex-col space-y-4 px-6 py-1 overflow-y-auto max-h-[42.5rem]",children:[t&&_(t.time_log).map(([r,$,y],N)=>e.jsxs($s,{className:"flex items-center justify-between p-4 w-full shadow-sm border rounded-md cursor-pointer focus:outline-none focus:ring-0",style:{borderColor:b.$20},theme:{backgroundColor:b.$1,hoverBackgroundColor:b.$4},onClick:()=>{T(!0),v(N)},children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("p",{className:"text-sm font-medium",style:{color:b.$3},children:ve(r,D)}),e.jsxs("span",{className:"text-xs",style:{color:b.$17},children:[$," - ",y]})]}),e.jsx("div",{className:"text-sm font-medium",style:{color:b.$3},children:I(t)&&N===t.time_log.length-1?e.jsx(R,{task:t,calculateLastTimeLog:!0}):$e(t.time_log,N)})]},N)),t&&_(t.time_log).length===0&&e.jsxs("div",{className:"text-sm font-medium",children:[o("no_records_found"),"."]})]})]}),t&&_(t.time_log).length>0&&e.jsx("div",{className:"flex justify-end px-6 py-4",children:e.jsx(Y,{onClick:()=>w(t),children:o("save")})})]})}function _s(o){const[t]=W(),{data:s}=Ke(),[b,D]=j.useState(),[k,_]=j.useState(),[E,a]=j.useState(!1),m=(d,v)=>{D(u=>u&&{...u,[d]:v})},T=d=>{if(d.preventDefault(),b&&!E){if(a(!0),P.processing(),Qe(b))return P.error("task_errors");we("POST",X("/api/v1/tasks"),b).then(()=>{P.success("created_task"),H(["tasks"]),D(s),o.setVisible(!1)}).catch(v=>{var u;((u=v.response)==null?void 0:u.status)===422&&(P.dismiss(),_(v.response.data))}).finally(()=>a(!1))}};return j.useEffect(()=>{s&&o.details&&D({...s,status_id:o.details.taskStatusId,project_id:o.details.projectId?o.details.projectId:""})},[s,o.details]),e.jsxs(ye,{title:t("new_task"),visible:o.visible,onClose:()=>o.setVisible(!1),size:"large",children:[b&&e.jsx(fs,{task:b,handleChange:m,errors:k,taskModal:!0}),b&&e.jsx(gs,{task:b,handleChange:m}),e.jsx(Y,{className:"self-end",onClick:T,disabled:!b||E,disableWithoutIcon:!0,children:t("save")})]})}const pe=K.div` min-width: ${o=>o.theme.minWidth}px; background-color: ${o=>o.theme.backgroundColor}; color: ${o=>o.theme.color}; color-scheme: ${o=>o.theme.colorScheme}; border-color: ${o=>o.theme.borderColor}; `,O=K.div` background-color: ${({theme:o})=>o.backgroundColor}; &:hover { background-color: ${({theme:o})=>o.hoverBackgroundColor}; } `;function Es(){const{documentTitle:o}=Ue("kanban"),[t]=W(),s=G(),{isAdmin:b,isOwner:D}=Ze(),k=qe(),_=Ye(),E=Ge(),a=ge(),m=je(),T=J(),d=[{name:t("tasks"),href:"/tasks"},{name:t("kanban"),href:"/tasks/kanban"}],[v,u]=j.useState("/api/v1/tasks?per_page=1000&status=active&without_deleted_clients=true"),[B,g]=j.useState(),[w,M]=j.useState(),[z,Q]=j.useState(),[r,$]=j.useState("view"),[y,N]=j.useState(!1),[Ne,se]=j.useState(!1),{data:U}=Xe({status:"active"}),{data:Z}=Je({endpoint:v}),[x]=A(ee),[te,oe]=A(cs),[ae,re]=A(us);ms(te),j.useEffect(()=>{if(U&&Z){const n=[];[...U.data].sort((i,f)=>i.status_order-f.status_order).map(i=>n.push({id:i.id,title:i.name,cards:[]})),Z.data.filter(({invoice_id:i})=>!i).map(i=>{const f=n.findIndex(p=>p.id===i.status_id);f>=0&&n[f].cards.push({id:i.id,title:i.description,description:Ce(i.time_log).toString(),sortOrder:i.status_order,task:i})}),n.map(i=>i.cards=i.cards.sort((f,p)=>f.sortOrder-p.sortOrder)),g(i=>({...i,columns:n}))}},[U,Z]);const ne=n=>{const l={},i=ds(n.columns).pluck("id").toArray();i.forEach(p=>l[p]=[]),n.columns.forEach(p=>{p.cards.map(h=>l[p.id].push(h.id))});const f={status_ids:i,task_ids:l};P.processing(),we("POST",X("/api/v1/tasks/sort"),f).then(()=>P.success()).finally(()=>{H(["tasks"]),H(["task_statuses"])})},Se=n=>{var V;const l=ue.cloneDeep(B),i=l.columns.find(c=>c.title===n.source.droppableId),f=l.columns.findIndex(c=>c.title===n.source.droppableId),p=l.columns.find(c=>{var S;return c.title===((S=n.destination)==null?void 0:S.droppableId)}),h=l.columns.findIndex(c=>{var S;return c.title===((S=n.destination)==null?void 0:S.droppableId)});if(i&&f>-1&&p&&h>-1){const c=i.cards.find(S=>S.id===n.draggableId);c&&(l.columns[f].cards=i.cards.filter(S=>S.id!==n.draggableId),l.columns[h].cards.push(c),l.columns[h].cards=me(l.columns[h].cards,l.columns[h].cards.length-1,(V=n.destination)==null?void 0:V.index),g(l),ne(l))}},Te=n=>{var f,p;const l=ue.cloneDeep(B),i=me(l.columns,n.source.index,(f=n.destination)==null?void 0:f.index);n.source.index!==((p=n.destination)==null?void 0:p.index)&&(l.columns=i,g(l),ne(l))},Ie=n=>{if(!n.destination)return;const l=n.source,i=n.destination;if(!(l.droppableId===i.droppableId&&l.index===i.index)){if(n.type==="COLUMN"){Te(n);return}Se(n)}},F=(n,l)=>{if(l==="edit"&&$("edit"),l==="view"&&$("view"),te===n)return re(!0);oe(n)},De=()=>{re(!1),oe(void 0)};return j.useEffect(()=>{u(w?le("/api/v1/tasks?project_tasks=:projectId&per_page=1000&status=active&without_deleted_clients=true",{projectId:w}):"/api/v1/tasks?per_page=1000&status=active&without_deleted_clients=true")},[w]),e.jsxs(es,{title:o,breadcrumbs:d,navigationTopRight:e.jsx(ns,{to:"/tasks",children:e.jsxs(ls,{children:[e.jsx(is,{size:20}),e.jsx("span",{children:t("tasks")})]})}),children:[e.jsxs(ss,{title:x?`${t("task")} ${x.number}`:t("task"),visible:ae,onClose:De,withoutHeaderBorder:!0,withoutDivider:x&&r==="edit"&&!T(x.time_log).length,actionChildren:e.jsxs("div",{className:"flex w-full divide-x-2",style:{color:s.$3,colorScheme:s.$0,backgroundColor:s.$1,borderColor:s.$4},children:[r==="view"&&(a("edit_task")||m(x))&&e.jsxs(O,{className:"flex justify-center items-center text-sm p-4 space-x-2 w-full cursor-pointer focus:outline-none focus:ring-0",onClick:()=>E(le("/tasks/:id/edit",{id:x==null?void 0:x.id})),style:{borderColor:s.$20},theme:{color:s.$3,backgroundColor:s.$1,hoverBackgroundColor:s.$4},children:[e.jsx("div",{children:e.jsx(ts,{color:s.$3,size:"1.2rem"})}),e.jsx("span",{children:t("edit_task")})]}),x&&!I(x)&&(a("edit_task")||m(x))&&e.jsxs(O,{className:"flex justify-center items-center text-sm p-4 space-x-2 w-full cursor-pointer focus:outline-none focus:ring-0",onClick:()=>_(x),style:{borderColor:s.$20},theme:{color:s.$3,backgroundColor:s.$1,hoverBackgroundColor:s.$4},children:[e.jsx("div",{children:e.jsx(js,{color:s.$3,filledColor:"transparent",size:"1.2rem"})}),e.jsx("span",{children:t("start")})]}),x&&I(x)&&(a("edit_task")||m(x))&&e.jsxs(O,{className:"flex justify-center items-center text-sm p-4 space-x-2 w-full cursor-pointer focus:outline-none focus:ring-0",onClick:()=>k(x),style:{borderColor:s.$20},theme:{color:s.$3,backgroundColor:s.$1,hoverBackgroundColor:s.$4},children:[e.jsx("div",{children:e.jsx(ks,{color:s.$3,filledColor:"transparent",size:"1.2rem"})}),e.jsx("span",{children:t("stop")})]})]}),size:"regular",withoutActionContainer:!0,children:[r==="view"&&e.jsx(vs,{}),r==="edit"&&e.jsx(ys,{})]}),e.jsx(os,{className:"w-full xl:w-2/5 rounded-sm shadow-sm",style:{borderColor:s.$21},children:e.jsxs("div",{className:"flex flex-col items-start md:flex-row md:items-center px-4 md:px-6 py-4 md:space-x-10 md:justify-between",children:[e.jsx("span",{className:"text-sm font-medium mb-1 md:mb-0",children:t("project")}),e.jsx(_e,{value:w,onChange:n=>M(n.id),onClearButtonClick:()=>M(void 0),clearButton:!0})]})}),B&&e.jsxs("div",{className:"flex border space-x-4 overflow-x-auto mt-4 p-6 shadow-sm rounded-sm",style:{color:s.$3,backgroundColor:s.$1,borderColor:s.$21,paddingRight:ae?512:0},children:[e.jsx(as,{onDragEnd:Ie,children:e.jsx(ie,{droppableId:"columns",type:"COLUMN",direction:"horizontal",children:n=>e.jsxs("div",{className:"flex space-x-4",ref:n.innerRef,...n.droppableProps,children:[B.columns.map((l,i)=>e.jsx(de,{draggableId:l.title,index:i,children:f=>e.jsxs(pe,{className:"rounded border shadow select-none h-max",ref:f.innerRef,...f.draggableProps,theme:{minWidth:360,color:s.$3,backgroundColor:s.$1,borderColor:s.$21},children:[e.jsxs("div",{...f.dragHandleProps,className:"flex items-center justify-between border-b rounded-tl rounded-tr px-4 py-5",style:{color:s.$3,backgroundColor:s.$1,borderColor:s.$20},children:[e.jsxs("h3",{className:"leading-6 font-medium",children:[l.title.slice(0,25),l.title.length>25&&"..."]}),a("create_task")&&e.jsx(O,{className:"cursor-pointer focus:outline-none focus:ring-0 p-1 border rounded-sm",onClick:()=>{Q({taskStatusId:l.id,projectId:w}),N(!0)},style:{borderColor:s.$21},theme:{backgroundColor:s.$1,hoverBackgroundColor:s.$4},children:e.jsx(ce,{size:"1.1rem",color:s.$3})})]}),e.jsx(ie,{droppableId:l.title,type:"CARD",renderClone:(p,h,V)=>{const c=l.cards.find(({id:S})=>S===V.draggableId);return c?e.jsxs("div",{className:"w-full text-leftblock rounded text-sm cursor-pointer",...p.draggableProps,...p.dragHandleProps,ref:p.innerRef,children:[e.jsxs("div",{className:"px-4 sm:px-6 py-4 border",style:{color:s.$3,backgroundColor:s.$4,borderColor:s.$21},children:[e.jsxs("p",{children:[c.title.slice(0,35),c.title.length>35&&"..."]}),e.jsx("div",{className:"font-mono font-medium text-xs",children:I(c.task)?e.jsx(R,{task:c.task,extraSmallText:!0}):c.description})]}),e.jsxs("div",{className:"flex border-b border-l border-r justify-center items-center divide-x-2",style:{color:s.$3,backgroundColor:s.$1,borderColor:s.$21},children:[(a("view_task")||a("edit_task")||m(x))&&e.jsx("button",{style:{color:s.$3,backgroundColor:s.$1},className:"w-full py-2 rounded-bl",onClick:()=>F(c.id,"view"),children:t("view")}),(a("edit_task")||m(x))&&e.jsx("button",{style:{color:s.$3,backgroundColor:s.$1},className:"w-full text-center py-2",onClick:()=>F(c.id,"edit"),children:t("edit")}),I(c.task)&&(a("edit_task")||m(x))&&e.jsx("button",{className:"w-full py-2 rounded-br",onClick:()=>k(c.task),style:{color:s.$3,backgroundColor:s.$1},children:t("stop")}),!I(c.task)&&(a("edit_task")||m(x))&&e.jsx("button",{style:{color:s.$3,backgroundColor:s.$1},className:"w-full py-2 rounded-br",onClick:()=>_(c.task),children:t("start")})]})]}):e.jsx(e.Fragment,{})},children:p=>e.jsx("div",{...p.droppableProps,children:e.jsxs("div",{ref:p.innerRef,className:"p-4 space-y-4 rounded-bl rounded-br",style:{color:s.$3,colorScheme:s.$0,backgroundColor:s.$1,borderColor:s.$3},children:[l.cards.map((h,V)=>e.jsx(de,{draggableId:h.id,index:V,children:c=>e.jsxs(pe,{className:"w-full text-leftblock text-sm group",ref:c.innerRef,...c.draggableProps,...c.dragHandleProps,theme:{backgroundColor:s.$7,color:s.$3},children:[e.jsxs("div",{className:"flex flex-col justify-center px-4 sm:px-6 py-4 border rounded-t-sm h-14",children:[e.jsxs("p",{children:[h.title.slice(0,35),h.title.length>35&&"..."]}),e.jsx("div",{className:"font-mono font-medium text-xs",children:I(h.task)?e.jsx(R,{task:h.task,extraSmallText:!0}):h.description})]}),e.jsxs("div",{className:"hidden group-hover:flex border-b border-l border-r justify-center rounded-br rounded-bl items-center divide-x-2",style:{color:s.$3,backgroundColor:s.$1,borderColor:s.$21},children:[(a("view_task")||a("edit_task")||m(x))&&e.jsx("button",{style:{color:s.$3,backgroundColor:s.$1},className:"w-full py-2 rounded-bl",onClick:()=>F(h.id,"view"),children:t("view")}),(a("edit_task")||m(x))&&e.jsx("button",{style:{color:s.$3,backgroundColor:s.$1},className:"w-full text-center py-2",onClick:()=>F(h.id,"edit"),children:t("edit")}),I(h.task)&&(a("edit_task")||m(x))&&e.jsx("button",{style:{color:s.$3,backgroundColor:s.$1},className:"w-full py-2 rounded-br",onClick:()=>k(h.task),children:t("stop")}),!I(h.task)&&(a("edit_task")||m(x))&&e.jsx("button",{style:{color:s.$3,backgroundColor:s.$1},className:"w-full py-2 rounded-br",onClick:()=>_(h.task),children:t("start")})]})]})},h.id)),p.placeholder]})})})]})},l.id)),n.placeholder]})})}),(b||D)&&e.jsx("div",{className:"pr-6",children:e.jsx(O,{className:"shadow-sm rounded border p-2 cursor-pointer",style:{color:s.$3,borderColor:s.$21},theme:{backgroundColor:s.$1,hoverBackgroundColor:s.$4},onClick:()=>se(!0),children:e.jsx(ce,{size:"1.3rem",color:s.$3})})})]}),e.jsx(rs,{visible:Ne,setVisible:se}),e.jsx(_s,{visible:y,setVisible:N,details:z,apiEndPoint:v})]})}export{Es as default};
Copyright ©2021 || Defacer Indonesia