PageSourceSearch

https://app.vitalityeld.com/assets/Cnv66Qie.js

js vitalityeld.com collected 2026-10-02 01:49:18 UTC 5,511 bytes, 1 lines download raw bytes

1import{W as e,bg as a,F as s,ar as t,fD as i,dn as n,fE as o,fF as r,eG as c,ct as l,ay as m,b7 as d}from"./CmVwsSB4.js";import{aL as p,aM as u,n as _,aN as h,o as j,a4 as x,c as g,a1 as v,W as y,B as f,cW as b,a2 as N}from"./Bku_ZNU5.js";import{d as k}from"./DpWTr_uu.js";import{T as w}from"./HKxU0Z16.js";import{c as C}from"./Csxtr5IC.js";import{M as S}from"./Bi9iYurM.js";import{a as P,R as A}from"./Q6V8zohY.js";import{C as B}from"./g2Jc0PnI.js";import{c as E,d as L}from"./CKDz8ZGm.js";import{D as M}from"./D1GbUBdx.js";import"./CSc5fXZY.js";import"./CTY7bpk3.js";import"./CmKv_H9j.js";import"./BK7_xeUk.js";import"./D8h6dFF-.js";import"./RtxMXR5n.js";import"./gnUkNAR_.js";import"./CYXEBxuh.js";import"./BS7xc076.js";import"./CjOj0ulW.js";import"./VCg4fHUe.js";import"./KH3gTha8.js";import"./DZmZcIhl.js";import"./DOsZ2wzb.js";import"./CGT12gMF.js";import"./Dm-rMh9l.js";const O=e=>{var a;return{metadata:{company_id:e.company_id,company_name:e.company_name,tenant_id:""},next_cycle:"",recurring_cycle:"month",status:(null==(a=e.subscription_items)?void 0:a.length)?"active":"inactive",subscription_items:e.subscription_items,is_blocked:Boolean(e.is_blocked),allow_without_subscription:!1,recurring_amount:0,active_assets:e.active_assets,active_camera:e.active_camera,active_driver:0,active_vehicle:e.active_vehicle,total_assets:e.active_assets,total_camera:e.active_camera,total_driver:0,total_vehicle:e.active_vehicle,company_id:e.company_id,last_payment:{amount:0,created:"",finalized_at:"",invoice_id:"",paid_at:"",status:""}}},T=({item:l})=>{const m=a(),d=j.getState().hasPermission,p=d("BILLING_PLAN_UPDATE"),u=d("VIEW_SYSTEM_BILLING_MANAGEMENT"),_=d("UPDATE_COMPANY"),h=d("BLOCK_COMPANY"),[v,y]=s.useState(null),f=Boolean(l.is_blocked),{mutate:b,isPending:N}=E(),{mutate:k,isPending:P}=L(),A=N||P;return e.jsxs(e.Fragment,{children:[e.jsxs(w,{className:"items-end",children:[p&&e.jsxs(C,{onSelect:()=>y("manage"),children:[e.jsx(t,{icon:i}),"Manage Subscriptions"]}),u&&e.jsxs(C,{onSelect:()=>m({to:"/system/revenue/invoices",search:{page:1,limit:20,status:"",search:"",company_id:l.company_id,tenant_group:"all",company_group:"all"}}),children:[e.jsx(t,{icon:n}),"Invoices"]}),h&&e.jsxs(C,{onSelect:()=>y("block"),children:[e.jsx(t,{icon:f?o:r}),f?"Unblock":"Block"]}),_&&e.jsxs(C,{onSelect:()=>y("edit"),children:[e.jsx(t,{icon:c}),"Edit"]})]}),p&&e.jsx(S,{item:O(l),open:"manage"===v,onOpenChange:e=>!e&&y(null)}),h&&e.jsx(x,{isOpen:"block"===v,isLoading:A,setOpenChange:e=>!e&&y(null),title:f?"Unblock company?":"Block company?",description:f?"Are you sure you want to unblock this company?":"Are you sure you want to block this company?",confirmButtonText:f?"Unblock":"Block",confirmButtonVariant:f?"default":"destructive",onConfirm:()=>{(f?k:b)({company_id:l.company_id},{onSuccess:()=>y(null)})},dialogHeader:e.jsx("div",{className:g("mb-3 flex size-10 items-center justify-center rounded-full",f?"bg-green-100 text-green-500 dark:bg-green-900/50 dark:text-green-400":"bg-red-100 text-red-500 dark:bg-red-900/50 dark:text-red-400"),children:e.jsx(t,{icon:f?o:r,size:20,strokeWidth:2})})}),_&&e.jsx(B,{company_id:l.company_id,open:"edit"===v,onOpenChange:e=>!e&&y(null)})]})};function I(){const s=a(),i=l({from:"/_protected/system/revenue/billing-exceptions"});return e.jsxs("div",{className:"w-table flex flex-wrap items-end gap-2",children:[e.jsx(v,{label:"Company",placeholder:"Search company",value:i.search,onChange:e=>s({to:".",search:a=>({...a,search:e,page:1})}),className:"w-full sm:max-w-sm",withClear:!0}),e.jsx(y,{queryKeys:"billing-exceptions-list"}),i.search&&e.jsxs(f,{variant:"ghost",className:"px-2 lg:px-3",onClick:()=>{s({to:".",search:e=>({...e,search:"",page:1})})},children:["Reset",e.jsx(t,{icon:m})]})]})}function D(){var a,t;const i=d(),{limit:n,search:o}=b.useSearch(),[r,c]=s.useState(1),[l,m]=s.useState(void 0),[j,x]=s.useState([]);s.useEffect(()=>{c(1),m(void 0),x([])},[n,o]);const{data:g,isPending:v}=k({limit:n,search:o,page_token:l}),y=j.length>0&&r>1,f=null==(a=null==g?void 0:g.data)?void 0:a.next_page_token,w=Boolean(f);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(I,{}),e.jsx(N,{isNestedTable:!0,isLoading:v,columns:[{header:"Company name",cell:({row:a})=>e.jsx("div",{className:"font-medium",children:a.original.company_name})},{header:"Last Plan",cell:({row:a})=>{const s=a.original.subscription_items??[];return 0===s.length?"N/A":e.jsx("div",{className:"space-y-1 text-sm text-muted-foreground",children:s.map(a=>e.jsx("div",{children:P(a.product_name??a.name,a.product_type)},a.price_id))})}},{header:"Active vehicles count",cell:({row:e})=>e.original.active_vehicle},{header:"Active camera count",cell:({row:e})=>e.original.active_camera},{header:"Reason",cell:({row:a})=>{const s=a.original.reason,t=s?A[s]:void 0;return t?e.jsxs(p,{children:[e.jsx(u,{asChild:!0,children:e.jsx(_,{variant:"warning",children:t.label})}),e.jsx(h,{className:"max-w-64",children:t.description})]}):e.jsx("span",{className:"text-muted-foreground",children:s??"—"})}}
1,{header:"Actions",size:10,cell:({row:a})=>e.jsx(T,{item:a.original})}],data:(null==(t=null==g?void 0:g.data)?void 0:t.items)??[],hidePagination:!0}),e.jsx(M,{page:r,isPending:v,canPrev:y,canNext:w,onFirst:()=>{y&&(c(1),x([]),m(void 0),i.invalidateQueries({predicate:e=>"billing-exceptions-list"===e.queryKey[0]}))},onPrev:()=>{y&&(c(e=>Math.max(1,e-1)),m(()=>{const e=[...j],a=e.pop();return x(e),a}))},onNext:()=>{w&&(x(e=>[...e,l??""]),m(f),c(e=>e+1))}})]})}export{D as component};

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.