whoami7 - Manager
:
/
home
/
qbizpnmr
/
arif.umairtax.com
/
public
/
Upload File:
files >> //home/qbizpnmr/arif.umairtax.com/public/useCustomBulkActions-CpMgieVX.js
import{u as y,p as P,a as v,j as s,ax as r,ay as d,ac as S,ad as B,ae as E,a9 as I,_ as T,bk as N,Y as O,au as $,a3 as Q,aE as q,aG as h,aJ as z,dt as F,bf as x,aQ as G,z as H,bl as J}from"./bundle.OlIVtvc7.js";import{u as R}from"./useDownloadPdfs-Dg_h5aER.js";import{b as C}from"./hooks-DfuZBC_R.js";import{C as k}from"./CreditStatus-Bi9XtGcq.js";import{u as V}from"./payments-BhlrdSKU.js";import{p as Y}from"./atoms-BIyl7r8z.js";const K=n=>{const[o]=y(),[m,l]=P.useState(!1),{selectedIds:i,setSelected:c}=n,p=C(),u=v();return s.jsxs(s.Fragment,{children:[s.jsx(r,{onClick:()=>l(!0),icon:s.jsx(d,{element:S}),children:o("send_email")}),s.jsxs(B,{title:o("bulk_email_credits"),visible:m,onClose:()=>l(!1),children:[s.jsx("span",{className:"text-lg",style:{backgroundColor:u.$2,color:u.$3,colorScheme:u.$0},children:o("are_you_sure")}),s.jsx("div",{className:"flex justify-end space-x-4 mt-5",children:s.jsx(E,{behavior:"button",onClick:()=>{p(i,"email"),c([]),l(!1)},children:o("yes")})})]})]})};/** * Invoice Ninja (https://invoiceninja.com). * * @link https://github.com/invoiceninja/invoiceninja source repository * * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com) * * @license https://www.elastic.co/licensing/elastic-license */const L=()=>{const n=I(),o=T(Y),{data:m}=V();return l=>{m&&(o({...m.data.data,invoices:[],credits:[],client_id:l[0].client_id}),l.forEach(i=>{o(c=>c&&{...c,credits:[...c.credits,{_id:N(),credit_id:i.id,amount:i.balance>0?i.balance:i.amount}]})}),n("/payments/create?action=apply&type=1"))}},ne=()=>{const[n]=y(),o=C(),m=O(),l=J(),i=L(),c=$({entity:"credit"}),p=R({entity:"credit"}),u=e=>!e.some(({status_id:t,is_deleted:a})=>t!==k.Draft||a),f=e=>e.some(({documents:t})=>t.length),j=e=>e.flatMap(({documents:t})=>t.map(({id:a})=>a)),_=(e,t)=>{const a=j(e);l(a,"download"),t([])},b=e=>{if(e.length){if(H(e).pluck("client_id").unique().toArray().length>1)return x.error("multiple_client_error");i(e)}},g=e=>e.every(({client_id:t,amount:a,status_id:D})=>t&&a>0&&D!==k.Applied),{setChangeTemplateVisible:A,setChangeTemplateResources:M,setChangeTemplateEntityContext:w}=Q();return[({selectedIds:e,setSelected:t})=>s.jsx(K,{selectedIds:e,setSelected:t}),({selectedIds:e,setSelected:t})=>s.jsx(r,{onClick:()=>{c(e),t([])},icon:s.jsx(d,{element:q}),children:n("print_pdf")}),({selectedIds:e,setSelected:t})=>s.jsx(r,{onClick:()=>{p(e),t([])},icon:s.jsx(d,{element:h}),children:n("download_pdf")}),({selectedIds:e,selectedResources:t,setSelected:a})=>u(t)&&s.jsx(r,{onClick:()=>{o(e,"mark_sent"),a([])},icon:s.jsx(d,{element:z}),children:n("mark_sent")}),({selectedResources:e,setSelected:t})=>g(e)&&m("create_payment")&&s.jsx(r,{onClick:()=>{b(e),t([])},icon:s.jsx(d,{element:F}),children:n("apply_credit")}),({selectedResources:e,setSelected:t})=>s.jsx(r,{onClick:()=>f(e)?_(e,t):x.error("no_documents_to_download"),icon:s.jsx(d,{element:h}),children:n("documents")}),({selectedResources:e})=>s.jsx(r,{onClick:()=>{A(!0),M(e),w({endpoint:"/api/v1/credits/bulk",entity:"credit"})},icon:s.jsx(d,{element:G}),children:n("run_template")})]};export{ne as u};
Copyright ©2021 || Defacer Indonesia