@airporting/tech-app 0.0.58 → 0.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ import { IconProps } from '@airporting/app-front/dist/components/icons/Icon';
2
+ export declare function IconBraintree({ color, size, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
@@ -43,6 +43,7 @@ export interface EtatSaisieDossierLine {
43
43
  reason: string | null;
44
44
  responsable: ResponsableOption | null;
45
45
  solde_attente_eur: number;
46
+ solde_virements_eur: number;
46
47
  source: string;
47
48
  status: string;
48
49
  total_clients_eur: number;
@@ -204,8 +205,17 @@ export interface GetDashboardPennylaneResponse {
204
205
  isTooOld: boolean;
205
206
  lastTime: string;
206
207
  }
208
+ export interface BraintreeConnectorItem {
209
+ merchant: string;
210
+ lastTime: string;
211
+ isTooOld: boolean;
212
+ }
213
+ export interface GetDashboardBraintreeResponse {
214
+ connectors: BraintreeConnectorItem[];
215
+ }
207
216
  export interface GetDashboardResponse {
208
217
  amex: GetDashboardAmexResponse;
218
+ braintree: GetDashboardBraintreeResponse;
209
219
  bnpp: GetDashboardBnppResponse;
210
220
  gsheet: GetGsheetDashboardResponse;
211
221
  notion: GetNotionDashboardResponse;
@@ -223,6 +233,7 @@ export interface GetEtatSaisieLatestResponse {
223
233
  computed_at: string | null;
224
234
  customer_rows: EtatSaisieCustomerRow[];
225
235
  dossier_lines: EtatSaisieDossierLine[];
236
+ internal_transfer_rows: EtatSaisieSuspenseRow[];
226
237
  scan_duration_seconds: number | null;
227
238
  status: string | null;
228
239
  summary: EtatSaisieSummary | null;
Binary file
@@ -1 +1 @@
1
- "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["9777"],{2268:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{g:()=>useFinanceJobsStock});var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6197);var _useApi__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4148);function useFinanceJobsStock(){const api=(0,_useApi__WEBPACK_IMPORTED_MODULE_1__.h)();return(0,_tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__.useQuery)({queryKey:["tech","finance-jobs","stock"],queryFn:async()=>(await api.financeJobs.getStockV1()).data,refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true})}},3139:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{V:()=>useGithubQuery});var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6197);var _useApi__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4148);function useGithubQuery(){const api=(0,_useApi__WEBPACK_IMPORTED_MODULE_1__.h)();const query=(0,_tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__.useQuery)({queryKey:["tech","github"],queryFn:async()=>await api.github.getJobsRunnersV1().then(x=>x.data),refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}},466:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{U:()=>useGsheetStock});var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6197);var _useApi__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4148);function useGsheetStock(){const api=(0,_useApi__WEBPACK_IMPORTED_MODULE_1__.h)();return(0,_tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__.useQuery)({queryKey:["tech","gsheet","stock"],queryFn:async()=>(await api.gsheet.getStockV1()).data,refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true})}},1354:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{m:()=>PageHeader});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var _tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(9632);var react__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(3106);function formatRelative(now,then){const seconds=Math.max(0,Math.floor((now-then)/1e3));if(seconds<5)return"\xe0 l’instant";if(seconds<60)return`il y a ${seconds}s`;const minutes=Math.floor(seconds/60);if(minutes<60)return`il y a ${minutes} min`;const hours=Math.floor(minutes/60);return`il y a ${hours} h`}function PageHeader({title,badge,updatedAt,isFetching,isError,onRefresh,actions}){const[now,setNow]=(0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(()=>Date.now());(0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)(()=>{if(!updatedAt)return;const id=window.setInterval(()=>setNow(Date.now()),1e3);return()=>window.clearInterval(id)},[updatedAt]);const relative=updatedAt?formatRelative(now,updatedAt):null;const color=isError?"orange":isFetching?"teal":"dimmed";return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{justify:"space-between",align:"center",mih:48,mb:"md",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"sm",align:"center",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Title,{order:2,children:title}),badge]}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"sm",align:"center",children:[relative&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Text,{size:"xs",c:color,fw:isFetching?600:400,"data-testid":"page-header-freshness",children:isError?"\xe9chec maj":isFetching?"maj…":relative}),onRefresh&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Tooltip,{label:"Rafra\xeechir",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{variant:"default",size:"md",onClick:onRefresh,loading:isFetching,"aria-label":"Refresh",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconRefresh,{size:16})})}),actions]})]})}},5068:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{U:()=>IconGithub});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);function IconGithub({color="currentColor",size=20,marker,...props}){return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("svg",{width:size,height:size,viewBox:"0 0 24 24",fill:color,xmlns:"http://www.w3.org/2000/svg",...props,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path",{d:"M12 0.297C5.373 0.297 0 5.67 0 12.297c0 5.292 3.438 9.787 8.205 11.387.6.111.82-.261.82-.58 0-.287-.011-1.244-.016-2.255-3.338.726-4.042-1.609-4.042-1.609-.546-1.389-1.333-1.759-1.333-1.759-1.089-.745.083-.73.083-.73 1.205.085 1.84 1.236 1.84 1.236 1.07 1.834 2.807 1.304 3.492.997.107-.775.419-1.305.762-1.605-2.665-.304-5.466-1.332-5.466-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.536-1.524.116-3.176 0 0 1.008-.322 3.301 1.23a11.51 11.51 0 0 1 3.004-.404 c1.019.005 2.047.138 3.004.404 2.291-1.552 3.297-1.23 3.297-1.23.655 1.652.243 2.873.119 3.176.77.84 1.235 1.91 1.235 3.221 0 4.61-2.805 5.624-5.476 5.921.43.372.823 1.104.823 2.223 0 1.606-.015 2.896-.015 3.293 0 .321.216.697.825.578C20.565 22.08 24 17.585 24 12.297 24 5.67 18.627.297 12 .297z"})})}},3815:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Dashboard});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var index_mjs_=__webpack_require__(207);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useDashboardQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","dashboard"],queryFn:async()=>await api.getDashboard().then(x=>x.data),refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var IconGithub=__webpack_require__(5068);var dist_index_js_=__webpack_require__(1380);var PageHeader=__webpack_require__(1354);var financeJobsStockQuery=__webpack_require__(2268);var gsheetStockQuery=__webpack_require__(466);var githubQuery=__webpack_require__(3139);function toneColor(tone){if("bad"===tone)return"red";if("warn"===tone)return"orange";return"green"}function toneLabel(tone){if("bad"===tone)return"ALERT";if("warn"===tone)return"WARN";return"OK"}function SystemHealthStrip(){const finance=(0,financeJobsStockQuery.g)();const gsheet=(0,gsheetStockQuery.U)();const github=(0,githubQuery.V)();const loading=finance.isLoading||gsheet.isLoading||github.isLoading;if(loading)return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.SimpleGrid,{cols:3,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:80}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:80}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:80})]});const tiles=[];if(finance.data){const d=finance.data;const errored=d.errored??0;const stuck=d.stuck??0;tiles.push({key:"finance",title:"Finance jobs",detail:`${d.pending??0} pending \xb7 ${errored} errored`,tone:errored>0?"bad":stuck>0?"warn":"ok"})}if(gsheet.data){const d=gsheet.data;const errored=d.errored??0;const stuck=d.stuck??0;tiles.push({key:"gsheet",title:"Gsheet",detail:`${d.pending??0} pending \xb7 ${errored} errored`,tone:errored>0?"bad":stuck>0?"warn":"ok"})}if(github.data){const list=github.data.list??[];const repos=list.length;tiles.push({key:"runners",title:"Runners GitHub",detail:`${repos} repos surveill\xe9s`,tone:0===repos?"bad":"ok"})}if(0===tiles.length)return null;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:Math.min(tiles.length,3),children:tiles.map(t=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",align:"flex-start",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,children:t.title}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:toneColor(t.tone),variant:"light",children:toneLabel(t.tone)})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:"dimmed",mt:4,children:t.detail})]},t.key))})}function App(){const dashboardResult=useDashboardQuery();const dashboard=dashboardResult.data;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Container,{fluid:true,my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"lg",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:"Sant\xe9",updatedAt:dashboardResult.dataUpdatedAt,isFetching:dashboardResult.isFetching,isError:dashboardResult.isError,onRefresh:()=>dashboardResult.refetch()}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",tt:"uppercase",fw:600,mb:"sm",children:"Sant\xe9 Syst\xe8me"}),/*#__PURE__*/(0,jsx_runtime.jsx)(SystemHealthStrip,{})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Divider,{}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",tt:"uppercase",fw:600,mb:"sm",children:"Int\xe9grations Produit"}),dashboard?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:3,ml:dashboard.amex.globalProblem?-30:0,children:[dashboard.amex.globalProblem?/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconCross,{size:24,color:"red"}):/*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{}),"Amex"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Purchase"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,c:dashboard.amex.purchaseProblem?"red":"green",children:[dashboard.amex.purchaseTodayBalances," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"cash balances"}),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}),dashboard.amex.purchasePendingTransactions,"/",dashboard.amex.purchaseTodayTransactions," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"transactions en attente"})]})]})})},"amex_purchase")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Merchant"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,c:dashboard.amex.merchantProblem?"red":"green",children:[dashboard.amex.merchantPendingTransactions,"/",dashboard.amex.merchantTodayTransactions," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"transactions en attente"}),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}),dashboard.amex.merchantPendingChargebacks,"/",dashboard.amex.merchantTodayChargesbacks," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"remboursements en attente"}),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}),dashboard.amex.merchantPendingAdjustments,"/",dashboard.amex.merchantTodayAdjustments," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"ajustements en attente"}),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{})]})]})})},"amex_merchant")})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:3,ml:dashboard.gsheet.globalProblem?-30:0,children:[dashboard.gsheet.globalProblem?/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconCross,{size:24,color:"red"}):/*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{}),"Gsheet"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"T\xe2ches non termin\xe9es"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,c:dashboard.gsheet.pending>50?"red":dashboard.gsheet.pending>30?"orange":"green",children:[dashboard.gsheet.pending," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,children:"onglets"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fw:700,fz:"sm",mt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{span:true,c:"dimmed",children:["Le plus ancien date du :"," "]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,fw:"bold",c:dashboard.gsheet.isPendingTooOld?"red":"green",children:dashboard.gsheet.oldest})]})]},"gsheet_pending")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"apart",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"T\xe2ches en cours"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:[dashboard.gsheet.running," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,children:"onglets"})]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:"https://github.com/airporting/gsheet_runner/actions",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})})]})},"gsheet_running")})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:3,children:["Notion",/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:"https://www.notion.so/airporting/Bug-report-5686f21b8154456f8b82629fb36e0859",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:12},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ScrollArea,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{miw:800,verticalSpacing:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Membre"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Not started"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"In progress"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"To be reviewed"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:dashboard.notion.bugs?.map((bug,i)=>{const[assignee,avatar,notStarted,inProgress,toBeReviewed]=bug;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Avatar,{size:26,src:avatar,radius:26}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",fw:500,children:assignee})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:+notStarted?"red":void 0,children:notStarted}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:+inProgress?"orange":void 0,children:inProgress}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:+toBeReviewed?"green":void 0,children:toBeReviewed})]},i)})})]})})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:3,children:"Payfit"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Exports du jour"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:[dashboard.payfit.today.sum," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,children:"exports"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fw:700,fz:"sm",mt:"md",children:[dashboard.payfit.today.siretsCount," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"dimmed",children:"SIRETs concern\xe9s"})]})]},"payfit_today")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"apart",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Exports en attente"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:[dashboard.payfit.pending.sum," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,children:"exports"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fw:700,fz:"sm",mt:"md",children:[dashboard.payfit.pending.siretsCount," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"dimmed",children:"SIRETs concern\xe9s"})]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:"https://github.com/airporting/payfit-scraper/actions/workflows/scrap.yml",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})})]})},"payfit_pending")})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:3,children:"Pennylane"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Cookie"})})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",mt:"md",children:["Dernier refresh \xe0"," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,span:true,c:dashboard.pennylane.isTooOld?"red":"green",children:dashboard.pennylane.lastTime})]})]},"pennylane_cookie")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:3,children:"Synchro"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"T\xe2ches"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,c:"green",children:[dashboard.synchro.askedToday," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"initial",children:"aujourd'hui"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{c:"dimmed",fz:"sm",mt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,fw:700,c:"red",children:dashboard.synchro.errorsToday})," ","en erreur (~",((dashboard.synchro.errorsToday??0)*100/(dashboard.synchro.askedToday??1)).toFixed(2),"%)"]})]},"synchro_today")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Actuellement"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:[dashboard.synchro.running," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"initial",children:"en cours"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"apart",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{c:"dimmed",fz:"sm",mt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,fw:700,children:dashboard.synchro.waiting})," ","en attente"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:"https://github.com/airporting/jobs_recipes_runner/actions/workflows/run-recipe.yml",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})})]})]},"synchro_running")})]})]}):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Chargement…"})]})]})})}var providers=__webpack_require__(7034);function Dashboard(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(App,{})})})}}}]);
1
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["9777"],{2268:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{g:()=>useFinanceJobsStock});var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6197);var _useApi__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4148);function useFinanceJobsStock(){const api=(0,_useApi__WEBPACK_IMPORTED_MODULE_1__.h)();return(0,_tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__.useQuery)({queryKey:["tech","finance-jobs","stock"],queryFn:async()=>(await api.financeJobs.getStockV1()).data,refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true})}},3139:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{V:()=>useGithubQuery});var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6197);var _useApi__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4148);function useGithubQuery(){const api=(0,_useApi__WEBPACK_IMPORTED_MODULE_1__.h)();const query=(0,_tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__.useQuery)({queryKey:["tech","github"],queryFn:async()=>await api.github.getJobsRunnersV1().then(x=>x.data),refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}},466:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{U:()=>useGsheetStock});var _tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(6197);var _useApi__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(4148);function useGsheetStock(){const api=(0,_useApi__WEBPACK_IMPORTED_MODULE_1__.h)();return(0,_tanstack_react_query__WEBPACK_IMPORTED_MODULE_0__.useQuery)({queryKey:["tech","gsheet","stock"],queryFn:async()=>(await api.gsheet.getStockV1()).data,refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true})}},1354:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{m:()=>PageHeader});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var _tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(9632);var react__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(3106);function formatRelative(now,then){const seconds=Math.max(0,Math.floor((now-then)/1e3));if(seconds<5)return"\xe0 l’instant";if(seconds<60)return`il y a ${seconds}s`;const minutes=Math.floor(seconds/60);if(minutes<60)return`il y a ${minutes} min`;const hours=Math.floor(minutes/60);return`il y a ${hours} h`}function PageHeader({title,badge,updatedAt,isFetching,isError,onRefresh,actions}){const[now,setNow]=(0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(()=>Date.now());(0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)(()=>{if(!updatedAt)return;const id=window.setInterval(()=>setNow(Date.now()),1e3);return()=>window.clearInterval(id)},[updatedAt]);const relative=updatedAt?formatRelative(now,updatedAt):null;const color=isError?"orange":isFetching?"teal":"dimmed";return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{justify:"space-between",align:"center",mih:48,mb:"md",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"sm",align:"center",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Title,{order:2,children:title}),badge]}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"sm",align:"center",children:[relative&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Text,{size:"xs",c:color,fw:isFetching?600:400,"data-testid":"page-header-freshness",children:isError?"\xe9chec maj":isFetching?"maj…":relative}),onRefresh&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Tooltip,{label:"Rafra\xeechir",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{variant:"default",size:"md",onClick:onRefresh,loading:isFetching,"aria-label":"Refresh",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconRefresh,{size:16})})}),actions]})]})}},5068:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{U:()=>IconGithub});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);function IconGithub({color="currentColor",size=20,marker,...props}){return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("svg",{width:size,height:size,viewBox:"0 0 24 24",fill:color,xmlns:"http://www.w3.org/2000/svg",...props,children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path",{d:"M12 0.297C5.373 0.297 0 5.67 0 12.297c0 5.292 3.438 9.787 8.205 11.387.6.111.82-.261.82-.58 0-.287-.011-1.244-.016-2.255-3.338.726-4.042-1.609-4.042-1.609-.546-1.389-1.333-1.759-1.333-1.759-1.089-.745.083-.73.083-.73 1.205.085 1.84 1.236 1.84 1.236 1.07 1.834 2.807 1.304 3.492.997.107-.775.419-1.305.762-1.605-2.665-.304-5.466-1.332-5.466-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.536-1.524.116-3.176 0 0 1.008-.322 3.301 1.23a11.51 11.51 0 0 1 3.004-.404 c1.019.005 2.047.138 3.004.404 2.291-1.552 3.297-1.23 3.297-1.23.655 1.652.243 2.873.119 3.176.77.84 1.235 1.91 1.235 3.221 0 4.61-2.805 5.624-5.476 5.921.43.372.823 1.104.823 2.223 0 1.606-.015 2.896-.015 3.293 0 .321.216.697.825.578C20.565 22.08 24 17.585 24 12.297 24 5.67 18.627.297 12 .297z"})})}},4224:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Dashboard});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var index_mjs_=__webpack_require__(207);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useDashboardQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","dashboard"],queryFn:async()=>await api.getDashboard().then(x=>x.data),refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var IconGithub=__webpack_require__(5068);function IconBraintree({color="currentColor",size=20,...props}){return/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:size,height:size,viewBox:"0 0 24 24",fill:color,xmlns:"http://www.w3.org/2000/svg",...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M8.276 20.482h4.717c3.641 0 5.462-1.2 5.462-3.517 0-2.275-1.945-3.517-5.752-3.517H8.276Zm0-16.965v6.538h4.138c3.103 0 4.717-1.159 4.717-3.269 0-2.152-1.655-3.269-4.759-3.269zM1.696 24v-3.518H4.47V3.517H1.697V0h11.089c5.09 0 8.193 2.358 8.193 6.455 0 2.69-1.572 4.345-3.558 5.131 2.855.787 4.882 2.814 4.882 5.586 0 4.386-3.393 6.828-8.938 6.828H1.697"})})}var dist_index_js_=__webpack_require__(1380);var PageHeader=__webpack_require__(1354);var financeJobsStockQuery=__webpack_require__(2268);var gsheetStockQuery=__webpack_require__(466);var githubQuery=__webpack_require__(3139);function toneColor(tone){if("bad"===tone)return"red";if("warn"===tone)return"orange";return"green"}function toneLabel(tone){if("bad"===tone)return"ALERT";if("warn"===tone)return"WARN";return"OK"}function SystemHealthStrip(){const finance=(0,financeJobsStockQuery.g)();const gsheet=(0,gsheetStockQuery.U)();const github=(0,githubQuery.V)();const loading=finance.isLoading||gsheet.isLoading||github.isLoading;if(loading)return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.SimpleGrid,{cols:3,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:80}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:80}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:80})]});const tiles=[];if(finance.data){const d=finance.data;const errored=d.errored??0;const stuck=d.stuck??0;tiles.push({key:"finance",title:"Finance jobs",detail:`${d.pending??0} pending \xb7 ${errored} errored`,tone:errored>0?"bad":stuck>0?"warn":"ok"})}if(gsheet.data){const d=gsheet.data;const errored=d.errored??0;const stuck=d.stuck??0;tiles.push({key:"gsheet",title:"Gsheet",detail:`${d.pending??0} pending \xb7 ${errored} errored`,tone:errored>0?"bad":stuck>0?"warn":"ok"})}if(github.data){const list=github.data.list??[];const repos=list.length;tiles.push({key:"runners",title:"Runners GitHub",detail:`${repos} repos surveill\xe9s`,tone:0===repos?"bad":"ok"})}if(0===tiles.length)return null;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:Math.min(tiles.length,3),children:tiles.map(t=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:true,radius:"md",p:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",align:"flex-start",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:600,children:t.title}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:toneColor(t.tone),variant:"light",children:toneLabel(t.tone)})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:"dimmed",mt:4,children:t.detail})]},t.key))})}function App(){const dashboardResult=useDashboardQuery();const dashboard=dashboardResult.data;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Container,{fluid:true,my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"lg",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:"Sant\xe9",updatedAt:dashboardResult.dataUpdatedAt,isFetching:dashboardResult.isFetching,isError:dashboardResult.isError,onRefresh:()=>dashboardResult.refetch()}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",tt:"uppercase",fw:600,mb:"sm",children:"Sant\xe9 Syst\xe8me"}),/*#__PURE__*/(0,jsx_runtime.jsx)(SystemHealthStrip,{})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Divider,{}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",tt:"uppercase",fw:600,mb:"sm",children:"Int\xe9grations Produit"}),dashboard?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:3,ml:dashboard.amex.globalProblem?-30:0,children:[dashboard.amex.globalProblem?/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconCross,{size:24,color:"red"}):/*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{}),"Amex"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Purchase"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,c:dashboard.amex.purchaseProblem?"red":"green",children:[dashboard.amex.purchaseTodayBalances," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"cash balances"}),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}),dashboard.amex.purchasePendingTransactions,"/",dashboard.amex.purchaseTodayTransactions," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"transactions en attente"})]})]})})},"amex_purchase")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Merchant"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,c:dashboard.amex.merchantProblem?"red":"green",children:[dashboard.amex.merchantPendingTransactions,"/",dashboard.amex.merchantTodayTransactions," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"transactions en attente"}),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}),dashboard.amex.merchantPendingChargebacks,"/",dashboard.amex.merchantTodayChargesbacks," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"remboursements en attente"}),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}),dashboard.amex.merchantPendingAdjustments,"/",dashboard.amex.merchantTodayAdjustments," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"ajustements en attente"}),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{})]})]})})},"amex_merchant")})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:3,ml:dashboard.gsheet.globalProblem?-30:0,children:[dashboard.gsheet.globalProblem?/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconCross,{size:24,color:"red"}):/*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment,{}),"Gsheet"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"T\xe2ches non termin\xe9es"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,c:dashboard.gsheet.pending>50?"red":dashboard.gsheet.pending>30?"orange":"green",children:[dashboard.gsheet.pending," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,children:"onglets"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fw:700,fz:"sm",mt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{span:true,c:"dimmed",children:["Le plus ancien date du :"," "]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,fw:"bold",c:dashboard.gsheet.isPendingTooOld?"red":"green",children:dashboard.gsheet.oldest})]})]},"gsheet_pending")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"apart",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"T\xe2ches en cours"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:[dashboard.gsheet.running," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,children:"onglets"})]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:"https://github.com/airporting/gsheet_runner/actions",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})})]})},"gsheet_running")})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:3,children:["Notion",/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:"https://www.notion.so/airporting/Bug-report-5686f21b8154456f8b82629fb36e0859",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:12},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.ScrollArea,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{miw:800,verticalSpacing:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Membre"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Not started"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"In progress"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"To be reviewed"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:dashboard.notion.bugs?.map((bug,i)=>{const[assignee,avatar,notStarted,inProgress,toBeReviewed]=bug;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Avatar,{size:26,src:avatar,radius:26}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",fw:500,children:assignee})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:+notStarted?"red":void 0,children:notStarted}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:+inProgress?"orange":void 0,children:inProgress}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{c:+toBeReviewed?"green":void 0,children:toBeReviewed})]},i)})})]})})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:3,children:"Payfit"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Exports du jour"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:[dashboard.payfit.today.sum," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,children:"exports"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fw:700,fz:"sm",mt:"md",children:[dashboard.payfit.today.siretsCount," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"dimmed",children:"SIRETs concern\xe9s"})]})]},"payfit_today")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"apart",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Exports en attente"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:[dashboard.payfit.pending.sum," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,children:"exports"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fw:700,fz:"sm",mt:"md",children:[dashboard.payfit.pending.siretsCount," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"dimmed",children:"SIRETs concern\xe9s"})]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:"https://github.com/airporting/payfit-scraper/actions/workflows/scrap.yml",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})})]})},"payfit_pending")})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:3,children:"Pennylane"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsx)("div",{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Cookie"})})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",mt:"md",children:["Dernier refresh \xe0"," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,span:true,c:dashboard.pennylane.isTooOld?"red":"green",children:dashboard.pennylane.lastTime})]})]},"pennylane_cookie")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:3,children:"Synchro"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Grid,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"T\xe2ches"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,c:"green",children:[dashboard.synchro.askedToday," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"initial",children:"aujourd'hui"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{c:"dimmed",fz:"sm",mt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,fw:700,c:"red",children:dashboard.synchro.errorsToday})," ","en erreur (~",((dashboard.synchro.errorsToday??0)*100/(dashboard.synchro.askedToday??1)).toFixed(2),"%)"]})]},"synchro_today")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{justify:"apart",children:/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:"Actuellement"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:[dashboard.synchro.running," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"initial",children:"en cours"})]})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"apart",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{c:"dimmed",fz:"sm",mt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,fw:700,children:dashboard.synchro.waiting})," ","en attente"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:"https://github.com/airporting/jobs_recipes_runner/actions/workflows/run-recipe.yml",children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})})]})]},"synchro_running")})]}),dashboard.braintree&&/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",align:"center",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(IconBraintree,{size:20}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:3,children:"Braintree"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid,{children:0===dashboard.braintree.connectors.length?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:12},children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",fz:"sm",children:"Aucune donn\xe9e Braintree"})}):dashboard.braintree.connectors.map(connector=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Grid.Col,{span:{base:6},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Paper,{withBorder:true,p:"md",radius:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",tt:"uppercase",fw:700,fz:"xs",children:connector.merchant}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",mt:"md",children:["Derni\xe8re transaction le"," ",/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,span:true,c:connector.isTooOld?"red":"green",children:connector.lastTime})]})]})},connector.merchant))})]})]}):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Chargement…"})]})]})})}var providers=__webpack_require__(7034);function Dashboard(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(App,{})})})}}}]);
@@ -1 +1 @@
1
- "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["7915"],{1354:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{m:()=>PageHeader});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var _tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(9632);var react__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(3106);function formatRelative(now,then){const seconds=Math.max(0,Math.floor((now-then)/1e3));if(seconds<5)return"\xe0 l’instant";if(seconds<60)return`il y a ${seconds}s`;const minutes=Math.floor(seconds/60);if(minutes<60)return`il y a ${minutes} min`;const hours=Math.floor(minutes/60);return`il y a ${hours} h`}function PageHeader({title,badge,updatedAt,isFetching,isError,onRefresh,actions}){const[now,setNow]=(0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(()=>Date.now());(0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)(()=>{if(!updatedAt)return;const id=window.setInterval(()=>setNow(Date.now()),1e3);return()=>window.clearInterval(id)},[updatedAt]);const relative=updatedAt?formatRelative(now,updatedAt):null;const color=isError?"orange":isFetching?"teal":"dimmed";return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{justify:"space-between",align:"center",mih:48,mb:"md",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"sm",align:"center",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Title,{order:2,children:title}),badge]}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"sm",align:"center",children:[relative&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Text,{size:"xs",c:color,fw:isFetching?600:400,"data-testid":"page-header-freshness",children:isError?"\xe9chec maj":isFetching?"maj…":relative}),onRefresh&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Tooltip,{label:"Rafra\xeechir",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{variant:"default",size:"md",onClick:onRefresh,loading:isFetching,"aria-label":"Refresh",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconRefresh,{size:16})})}),actions]})]})}},1657:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>EtatSaisie});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useEtatSaisieLatest(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","etat-saisie","latest"],queryFn:async()=>(await api.etatSaisie.getLatestV1()).data,refetchOnWindowFocus:true})}function useEtatSaisieRecompute(){const api=(0,useApi.h)();const qc=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async()=>(await api.etatSaisie.recomputeV1()).data,onSuccess:()=>qc.invalidateQueries({queryKey:["tech","etat-saisie","latest"]})})}function DetailTable(props){const{columns,rows,onRowClick}=props;const[sortKey,setSortKey]=(0,index_js_.useState)(null);const[asc,setAsc]=(0,index_js_.useState)(false);const sorted=[...rows].sort((a,b)=>{if(!sortKey)return 0;const av=a[sortKey];const bv=b[sortKey];if("number"==typeof av&&"number"==typeof bv)return asc?av-bv:bv-av;return asc?String(av).localeCompare(String(bv)):String(bv).localeCompare(String(av))});const toggle=k=>{if(sortKey===k)setAsc(v=>!v);else{setSortKey(k);setAsc(false)}};const fmt=(v,numeric)=>{if(numeric&&"number"==typeof v)return v.toLocaleString("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2});if("boolean"==typeof v)return v?"✓":"";if(null==v)return"—";if("object"==typeof v)return"—";return String(v)};return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{striped:true,highlightOnHover:true,withTableBorder:true,stickyHeader:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:columns.map(c=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Th,{onClick:()=>toggle(c.key),style:{cursor:"pointer"},children:[c.label,sortKey===c.key?asc?" ▲":" ▼":""]},c.key))})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:0===sorted.length?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{colSpan:columns.length,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",ta:"center",children:"Aucune ligne"})})}):sorted.map((row,i)=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{onClick:onRowClick?()=>onRowClick(row):void 0,style:onRowClick?{cursor:"pointer"}:void 0,children:columns.map(c=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{style:c.numeric?{textAlign:"right",fontVariantNumeric:"tabular-nums"}:void 0,children:c.render?c.render(row):fmt(row[c.key],c.numeric)},c.key))},i))})]})}function useDossiers(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","etat-saisie","dossiers"],queryFn:async()=>(await api.etatSaisie.getDossiersV1()).data,refetchOnWindowFocus:true})}function useSetManaged(){const api=(0,useApi.h)();const qc=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async variables=>(await api.etatSaisie.setManagedV1({id:variables.id},{managed:variables.managed})).data,onSuccess:()=>{qc.invalidateQueries({queryKey:["tech","etat-saisie","dossiers"]});qc.invalidateQueries({queryKey:["tech","etat-saisie","latest"]})}})}function useSetResponsable(){const api=(0,useApi.h)();const qc=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async variables=>(await api.etatSaisie.setResponsableV1({id:variables.id},{notion_user_id:variables.notionUserId})).data,onSuccess:()=>{qc.invalidateQueries({queryKey:["tech","etat-saisie","dossiers"]})}})}const LOGO_DEV_TOKEN="pk_BVN4OQv0Qs-bnqjdIgTppg";function logoDevUrl(domain){return`https://img.logo.dev/${domain}?token=${LOGO_DEV_TOKEN}`}const PROVIDER_DOMAIN={pennylane:"pennylane.com",zohobooks:"zoho.com",xero:"xero.com",odoo:"odoo.com"};function QuickBooksIcon(props){const{size}=props;return/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{width:size,height:size,viewBox:"0 0 24 24",role:"img","aria-label":"QuickBooks",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("title",{children:"QuickBooks"}),/*#__PURE__*/(0,jsx_runtime.jsx)("circle",{cx:"12",cy:"12",r:"12",fill:"#2CA01C"}),/*#__PURE__*/(0,jsx_runtime.jsx)("text",{x:"12",y:"16.5",textAnchor:"middle",fontSize:"12",fontWeight:"700",fill:"#ffffff",fontFamily:"Arial, Helvetica, sans-serif",children:"qb"})]})}function ProviderIcon(props){const{provider}=props;if(!provider)return null;if("quickbooks"===provider)return/*#__PURE__*/(0,jsx_runtime.jsx)(QuickBooksIcon,{size:20});const domain=PROVIDER_DOMAIN[provider];if(!domain)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"sm",variant:"light",color:"gray",title:provider,children:provider.slice(0,2).toUpperCase()});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Image,{src:logoDevUrl(domain),alt:provider,title:provider,w:20,h:20,fit:"contain",radius:"sm",style:{aspectRatio:1}})}function DossiersTab(){const dossiers=useDossiers();const setManaged=useSetManaged();const setResponsable=useSetResponsable();const[filter,setFilter]=(0,index_js_.useState)("");const options=dossiers.data?.responsable_options??[];const optionData=options.map(u=>({value:String(u.id),label:u.name}));const rows=(0,index_js_.useMemo)(()=>{const all=dossiers.data?.dossiers??[];const needle=filter.trim().toLowerCase();const filtered=needle?all.filter(dossier=>dossier.display_name.toLowerCase().includes(needle)||dossier.slug.toLowerCase().includes(needle)):all;return[...filtered].sort((a,b)=>a.display_name.localeCompare(b.display_name))},[dossiers.data,filter]);if(dossiers.isError)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"red",mt:"md",children:"Erreur de chargement des dossiers."});return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{mb:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{placeholder:"Filtrer par nom ou slug",value:filter,onChange:event=>setFilter(event.currentTarget.value),w:320})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{striped:true,highlightOnHover:true,withTableBorder:true,stickyHeader:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Source"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Dossier"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"G\xe9r\xe9"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Responsable"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:0===rows.length?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{colSpan:4,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",ta:"center",children:"Aucun dossier"})})}):rows.map(dossier=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:dossier.provider})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:dossier.display_name}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Switch,{checked:dossier.managed,onChange:event=>setManaged.mutate({id:dossier.airporting_id,managed:event.currentTarget.checked})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{placeholder:"—",data:optionData,value:dossier.responsable?String(dossier.responsable.id):null,onChange:v=>setResponsable.mutate({id:dossier.airporting_id,notionUserId:v?Number(v):null}),searchable:true,clearable:true,w:220,leftSection:dossier.responsable?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Avatar,{src:dossier.responsable.avatar_url,size:20,radius:"xl"}):void 0})})]},`${dossier.airporting_id}:${dossier.provider}`))})]})]})}function ManagedBadge(props){const{managed}=props;if(!managed)return null;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Image,{src:logoDevUrl("airporting.com"),alt:"G\xe9r\xe9 par Airporting",title:"G\xe9r\xe9 par Airporting",w:18,h:18,fit:"contain",radius:"sm",style:{aspectRatio:1}})}var PageHeader=__webpack_require__(1354);const STALE_THRESHOLD_DAYS=30;function staleBadge(isoDate){if(!isoDate)return null;const days=Math.floor((Date.now()-new Date(isoDate).getTime())/864e5);if(days<STALE_THRESHOLD_DAYS)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{ml:6,size:"xs",color:"red",variant:"light",children:["+",days,"j"]})}function withDossierFilter(rows,dossier){if(!dossier)return rows;return rows.filter(r=>r.dossier===dossier)}function withManagedFilter(rows,managedOnly){if(!managedOnly)return rows;return rows.filter(r=>true===r.managed)}function withCategoryFilter(rows,category){if("all"===category)return rows;return rows.filter(r=>r.category===category)}function etatBadge(row){if("error"===row.status)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"red",variant:"light",children:"Erreur"});if("too_large"===row.status)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"orange",variant:"light",children:"Trop volumineux"});if("anomalie"===row.category)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"orange",variant:"light",children:"Anomalie"});if("stale"===row.reason)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"yellow",variant:"light",children:"P\xe9rim\xe9"});if("empty"===row.reason)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"gray",variant:"light",children:"Vide"});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"green",variant:"light",children:"Propre"})}function EtatSaisieApp(){const latest=useEtatSaisieLatest();const recompute=useEtatSaisieRecompute();const[tab,setTab]=(0,index_js_.useState)("resume");const[selectedDossier,setSelectedDossier]=(0,index_js_.useState)(null);const[managedOnly,setManagedOnly]=(0,index_js_.useState)(true);const[statusFilter,setStatusFilter]=(0,index_js_.useState)("all");const[drillDossier,setDrillDossier]=(0,index_js_.useState)(null);const d=latest.data;const allDossiers=(0,index_js_.useMemo)(()=>{if(!d?.available)return[];const set=new Set;for(const r of d.suspense_rows??[])set.add(r.dossier);for(const r of d.supplier_rows??[])set.add(r.dossier);for(const r of d.customer_rows??[])set.add(r.dossier);for(const r of d.dossier_lines??[])set.add(r.dossier);for(const r of d.summary?.top_5_suspense??[])set.add(r.dossier);for(const r of d.summary?.top_5_supplier_debtors??[])set.add(r.dossier);for(const r of d.summary?.top_5_customer_creditors??[])set.add(r.dossier);return[...set].sort()},[d]);const openDrill=row=>setDrillDossier(row.dossier);const drillData=(0,index_js_.useMemo)(()=>{if(!drillDossier||!d?.available)return null;return{suspense:(d.suspense_rows??[]).filter(r=>r.dossier===drillDossier),supplier:(d.supplier_rows??[]).filter(r=>r.dossier===drillDossier),customer:(d.customer_rows??[]).filter(r=>r.dossier===drillDossier)}},[drillDossier,d]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{fluid:true,my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:"\xc9tat saisie",updatedAt:d?.computed_at?new Date(d.computed_at).getTime():latest.dataUpdatedAt,isFetching:latest.isFetching,isError:latest.isError,onRefresh:()=>latest.refetch(),actions:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{loading:recompute.isPending,onClick:()=>recompute.mutate(),variant:"light",children:"Recalculer"})}),d&&!d.available?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Aucun snapshot disponible — lancez \xab Recalculer \xbb ou attendez le run nocturne."}):/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{mb:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"Focus dossier",placeholder:"Tous les dossiers",data:allDossiers.map(dos=>({value:dos,label:dos})),value:selectedDossier,onChange:setSelectedDossier,searchable:true,clearable:true,w:320}),selectedDossier&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"subtle",onClick:()=>setSelectedDossier(null),mt:22,children:"R\xe9initialiser"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{mt:22,value:managedOnly?"managed":"all",onChange:v=>setManagedOnly("managed"===v),data:[{label:"G\xe9r\xe9s",value:"managed"},{label:"Tous",value:"all"}]})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs,{value:tab,onChange:setTab,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs.List,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"resume",children:"R\xe9sum\xe9"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"top5",children:"Top 5"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s471",children:"D\xe9tail 471"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s401",children:"Fournisseurs d\xe9biteurs (401)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s411",children:"Clients cr\xe9diteurs (411)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"dossiers",children:"Dossiers"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs.Panel,{value:"resume",pt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:4,mb:"md",children:[{key:"all",label:"Scann\xe9s",value:d?.summary?.companies_scanned??0,color:void 0},{key:"propre",label:"Propres",value:d?.summary?.companies_clean??0,color:"green"},{key:"anomalie",label:"En anomalie",value:d?.summary?.companies_with_anomalies??0,color:"orange"},{key:"erreur",label:"En erreur",value:d?.summary?.companies_in_error??0,color:"red"}].map(tile=>{const active=statusFilter===tile.key;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:active,style:{cursor:"pointer",borderColor:active?"var(--mantine-color-blue-5)":void 0},onClick:()=>setStatusFilter(tile.key),children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:tile.label}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",c:tile.color,children:tile.value})]},tile.key)})}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:UNIFIED_COLS,rows:withCategoryFilter(withManagedFilter(withDossierFilter(d?.dossier_lines??[],selectedDossier),managedOnly),statusFilter),onRowClick:openDrill})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs.Panel,{value:"top5",pt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 comptes d'attente (471)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_SUSPENSE_COLS,rows:withDossierFilter(d?.summary?.top_5_suspense??[],selectedDossier),onRowClick:openDrill}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 fournisseurs d\xe9biteurs (401)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_SUPPLIER_COLS,rows:withDossierFilter(d?.summary?.top_5_supplier_debtors??[],selectedDossier),onRowClick:openDrill}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 clients cr\xe9diteurs (411)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_CUSTOMER_COLS,rows:withDossierFilter(d?.summary?.top_5_customer_creditors??[],selectedDossier),onRowClick:openDrill})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s471",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUSPENSE_COLS,rows:withManagedFilter(withDossierFilter(d?.suspense_rows??[],selectedDossier),managedOnly),onRowClick:openDrill})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s401",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUPPLIER_COLS,rows:withManagedFilter(withDossierFilter(d?.supplier_rows??[],selectedDossier),managedOnly),onRowClick:openDrill})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s411",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:CUSTOMER_COLS,rows:withManagedFilter(withDossierFilter(d?.customer_rows??[],selectedDossier),managedOnly),onRowClick:openDrill})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"dossiers",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DossiersTab,{})})]})]}),latest.isError?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"red",mt:"md",children:"Erreur de chargement."}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Drawer,{opened:!!drillDossier,onClose:()=>setDrillDossier(null),position:"right",size:"xl",title:drillDossier?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:["Dossier ",drillDossier]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:"light",onClick:()=>{setSelectedDossier(drillDossier);setDrillDossier(null)},children:"Focus sur ce dossier"})]}):null,children:drillData&&/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:5,mb:6,children:["Comptes d'attente 471 (",drillData.suspense.length,")"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DRILL_SUSPENSE_COLS,rows:drillData.suspense})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:5,mb:6,children:["Fournisseurs d\xe9biteurs 401 (",drillData.supplier.length,")"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DRILL_SUPPLIER_COLS,rows:drillData.supplier})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:5,mb:6,children:["Clients cr\xe9diteurs 411 (",drillData.customer.length,")"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DRILL_CUSTOMER_COLS,rows:drillData.customer})]})]})})]})}const TOP_SUSPENSE_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"G\xe9r\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"solde_eur",label:"Solde 471 (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr.",numeric:true},{key:"top_libelle",label:"Top \xe9criture"},{key:"top_montant",label:"Montant",numeric:true}];const TOP_SUPPLIER_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"total_eur",label:"Total d\xe9biteur (€)",numeric:true},{key:"nb_fournisseurs",label:"Nb fourn.",numeric:true},{key:"top_nom",label:"Top fournisseur"},{key:"top_montant",label:"Montant",numeric:true}];const TOP_CUSTOMER_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"total_eur",label:"Total cr\xe9diteur (€)",numeric:true},{key:"nb_clients",label:"Nb clients",numeric:true},{key:"top_nom",label:"Top client"},{key:"top_montant",label:"Montant",numeric:true}];const UNIFIED_COLS=[{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"status",label:"\xc9tat",render:r=>etatBadge(r)},{key:"dossier",label:"Dossier"},{key:"responsable",label:"Responsable",render:r=>r.responsable?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Avatar,{src:r.responsable.avatar_url,size:20,radius:"xl"}),/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:r.responsable.name})]}):/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:"—"})},{key:"fiscal_year_end",label:"Cl\xf4ture",render:r=>r.fiscal_year_end?/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:r.fiscal_year_end.split("-").reverse().join("/")}):/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:"—"})},{key:"solde_attente_eur",label:"Solde 471 (€)",numeric:true},{key:"total_fournisseurs_eur",label:"Fourn. d\xe9biteurs (€)",numeric:true},{key:"total_clients_eur",label:"Clients cr\xe9diteurs (€)",numeric:true},{key:"last_entry_date",label:"Derni\xe8re \xe9criture",render:row=>/*#__PURE__*/(0,jsx_runtime.jsxs)("span",{children:[row.last_entry_date??"—",staleBadge(row.last_entry_date)]})}];const SUSPENSE_COLS=[{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"date",label:"Date"},{key:"numero_compte",label:"N\xb0 Compte"},{key:"libelle_compte",label:"Libell\xe9 compte"},{key:"libelle_ecriture",label:"Libell\xe9 \xe9criture"},{key:"journal",label:"Journal"},{key:"numero_piece",label:"N\xb0 Pi\xe8ce"},{key:"debit",label:"D\xe9bit",numeric:true},{key:"credit",label:"Cr\xe9dit",numeric:true},{key:"solde_net",label:"Solde net",numeric:true},{key:"lettre",label:"Lettr\xe9"},{key:"devise",label:"Devise"}];const SUPPLIER_COLS=[{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"fournisseur",label:"Fournisseur"},{key:"solde_debiteur_eur",label:"Solde d\xe9biteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr. non lettr\xe9es",numeric:true},{key:"devise",label:"Devise"}];const CUSTOMER_COLS=[{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"client",label:"Client"},{key:"solde_crediteur_eur",label:"Solde cr\xe9diteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr. non lettr\xe9es",numeric:true},{key:"devise",label:"Devise"}];const DRILL_SUSPENSE_COLS=[{key:"date",label:"Date"},{key:"numero_compte",label:"N\xb0 Compte"},{key:"libelle_ecriture",label:"Libell\xe9"},{key:"debit",label:"D\xe9bit",numeric:true},{key:"credit",label:"Cr\xe9dit",numeric:true},{key:"solde_net",label:"Solde net",numeric:true},{key:"lettre",label:"Lettr\xe9"}];const DRILL_SUPPLIER_COLS=[{key:"fournisseur",label:"Fournisseur"},{key:"solde_debiteur_eur",label:"Solde d\xe9biteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr.",numeric:true},{key:"devise",label:"Devise"}];const DRILL_CUSTOMER_COLS=[{key:"client",label:"Client"},{key:"solde_crediteur_eur",label:"Solde cr\xe9diteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr.",numeric:true},{key:"devise",label:"Devise"}];function EtatSaisie(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(EtatSaisieApp,{})})})}}}]);
1
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["7915"],{1354:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{m:()=>PageHeader});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var _tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(9632);var react__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(3106);function formatRelative(now,then){const seconds=Math.max(0,Math.floor((now-then)/1e3));if(seconds<5)return"\xe0 l’instant";if(seconds<60)return`il y a ${seconds}s`;const minutes=Math.floor(seconds/60);if(minutes<60)return`il y a ${minutes} min`;const hours=Math.floor(minutes/60);return`il y a ${hours} h`}function PageHeader({title,badge,updatedAt,isFetching,isError,onRefresh,actions}){const[now,setNow]=(0,react__WEBPACK_IMPORTED_MODULE_3__.useState)(()=>Date.now());(0,react__WEBPACK_IMPORTED_MODULE_3__.useEffect)(()=>{if(!updatedAt)return;const id=window.setInterval(()=>setNow(Date.now()),1e3);return()=>window.clearInterval(id)},[updatedAt]);const relative=updatedAt?formatRelative(now,updatedAt):null;const color=isError?"orange":isFetching?"teal":"dimmed";return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{justify:"space-between",align:"center",mih:48,mb:"md",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"sm",align:"center",children:[/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Title,{order:2,children:title}),badge]}),/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Group,{gap:"sm",align:"center",children:[relative&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Text,{size:"xs",c:color,fw:isFetching?600:400,"data-testid":"page-header-freshness",children:isError?"\xe9chec maj":isFetching?"maj…":relative}),onRefresh&&/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Tooltip,{label:"Rafra\xeechir",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.ActionIcon,{variant:"default",size:"md",onClick:onRefresh,loading:isFetching,"aria-label":"Refresh",children:/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__.IconRefresh,{size:16})})}),actions]})]})}},1657:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>EtatSaisie});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useEtatSaisieLatest(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","etat-saisie","latest"],queryFn:async()=>(await api.etatSaisie.getLatestV1()).data,refetchOnWindowFocus:true})}function useEtatSaisieRecompute(){const api=(0,useApi.h)();const qc=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async()=>(await api.etatSaisie.recomputeV1()).data,onSuccess:()=>qc.invalidateQueries({queryKey:["tech","etat-saisie","latest"]})})}function DetailTable(props){const{columns,rows,onRowClick}=props;const[sortKey,setSortKey]=(0,index_js_.useState)(null);const[asc,setAsc]=(0,index_js_.useState)(false);const sorted=[...rows].sort((a,b)=>{if(!sortKey)return 0;const av=a[sortKey];const bv=b[sortKey];if("number"==typeof av&&"number"==typeof bv)return asc?av-bv:bv-av;return asc?String(av).localeCompare(String(bv)):String(bv).localeCompare(String(av))});const toggle=k=>{if(sortKey===k)setAsc(v=>!v);else{setSortKey(k);setAsc(false)}};const fmt=(v,numeric)=>{if(numeric&&"number"==typeof v)return v.toLocaleString("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2});if("boolean"==typeof v)return v?"✓":"";if(null==v)return"—";if("object"==typeof v)return"—";return String(v)};return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{striped:true,highlightOnHover:true,withTableBorder:true,stickyHeader:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:columns.map(c=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Th,{onClick:()=>toggle(c.key),style:{cursor:"pointer"},children:[c.label,sortKey===c.key?asc?" ▲":" ▼":""]},c.key))})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:0===sorted.length?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{colSpan:columns.length,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",ta:"center",children:"Aucune ligne"})})}):sorted.map((row,i)=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{onClick:onRowClick?()=>onRowClick(row):void 0,style:onRowClick?{cursor:"pointer"}:void 0,children:columns.map(c=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{style:c.numeric?{textAlign:"right",fontVariantNumeric:"tabular-nums"}:void 0,children:c.render?c.render(row):fmt(row[c.key],c.numeric)},c.key))},i))})]})}function useDossiers(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","etat-saisie","dossiers"],queryFn:async()=>(await api.etatSaisie.getDossiersV1()).data,refetchOnWindowFocus:true})}function useSetManaged(){const api=(0,useApi.h)();const qc=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async variables=>(await api.etatSaisie.setManagedV1({id:variables.id},{managed:variables.managed})).data,onSuccess:()=>{qc.invalidateQueries({queryKey:["tech","etat-saisie","dossiers"]});qc.invalidateQueries({queryKey:["tech","etat-saisie","latest"]})}})}function useSetResponsable(){const api=(0,useApi.h)();const qc=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async variables=>(await api.etatSaisie.setResponsableV1({id:variables.id},{notion_user_id:variables.notionUserId})).data,onSuccess:()=>{qc.invalidateQueries({queryKey:["tech","etat-saisie","dossiers"]})}})}const LOGO_DEV_TOKEN="pk_BVN4OQv0Qs-bnqjdIgTppg";function logoDevUrl(domain){return`https://img.logo.dev/${domain}?token=${LOGO_DEV_TOKEN}`}const PROVIDER_DOMAIN={pennylane:"pennylane.com",zohobooks:"zoho.com",xero:"xero.com",odoo:"odoo.com"};function QuickBooksIcon(props){const{size}=props;return/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{width:size,height:size,viewBox:"0 0 24 24",role:"img","aria-label":"QuickBooks",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("title",{children:"QuickBooks"}),/*#__PURE__*/(0,jsx_runtime.jsx)("circle",{cx:"12",cy:"12",r:"12",fill:"#2CA01C"}),/*#__PURE__*/(0,jsx_runtime.jsx)("text",{x:"12",y:"16.5",textAnchor:"middle",fontSize:"12",fontWeight:"700",fill:"#ffffff",fontFamily:"Arial, Helvetica, sans-serif",children:"qb"})]})}function ProviderIcon(props){const{provider}=props;if(!provider)return null;if("quickbooks"===provider)return/*#__PURE__*/(0,jsx_runtime.jsx)(QuickBooksIcon,{size:20});const domain=PROVIDER_DOMAIN[provider];if(!domain)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"sm",variant:"light",color:"gray",title:provider,children:provider.slice(0,2).toUpperCase()});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Image,{src:logoDevUrl(domain),alt:provider,title:provider,w:20,h:20,fit:"contain",radius:"sm",style:{aspectRatio:1}})}function DossiersTab(){const dossiers=useDossiers();const setManaged=useSetManaged();const setResponsable=useSetResponsable();const[filter,setFilter]=(0,index_js_.useState)("");const options=dossiers.data?.responsable_options??[];const optionData=options.map(u=>({value:String(u.id),label:u.name}));const rows=(0,index_js_.useMemo)(()=>{const all=dossiers.data?.dossiers??[];const needle=filter.trim().toLowerCase();const filtered=needle?all.filter(dossier=>dossier.display_name.toLowerCase().includes(needle)||dossier.slug.toLowerCase().includes(needle)):all;return[...filtered].sort((a,b)=>a.display_name.localeCompare(b.display_name))},[dossiers.data,filter]);if(dossiers.isError)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"red",mt:"md",children:"Erreur de chargement des dossiers."});return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{mb:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{placeholder:"Filtrer par nom ou slug",value:filter,onChange:event=>setFilter(event.currentTarget.value),w:320})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{striped:true,highlightOnHover:true,withTableBorder:true,stickyHeader:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Source"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Dossier"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"G\xe9r\xe9"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Responsable"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:0===rows.length?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{colSpan:4,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",ta:"center",children:"Aucun dossier"})})}):rows.map(dossier=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:dossier.provider})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:dossier.display_name}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Switch,{checked:dossier.managed,onChange:event=>setManaged.mutate({id:dossier.airporting_id,managed:event.currentTarget.checked})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{placeholder:"—",data:optionData,value:dossier.responsable?String(dossier.responsable.id):null,onChange:v=>setResponsable.mutate({id:dossier.airporting_id,notionUserId:v?Number(v):null}),searchable:true,clearable:true,w:220,leftSection:dossier.responsable?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Avatar,{src:dossier.responsable.avatar_url,size:20,radius:"xl"}):void 0})})]},`${dossier.airporting_id}:${dossier.provider}`))})]})]})}function ManagedBadge(props){const{managed}=props;if(!managed)return null;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Image,{src:logoDevUrl("airporting.com"),alt:"G\xe9r\xe9 par Airporting",title:"G\xe9r\xe9 par Airporting",w:18,h:18,fit:"contain",radius:"sm",style:{aspectRatio:1}})}var PageHeader=__webpack_require__(1354);const STALE_THRESHOLD_DAYS=30;function staleBadge(isoDate){if(!isoDate)return null;const days=Math.floor((Date.now()-new Date(isoDate).getTime())/864e5);if(days<STALE_THRESHOLD_DAYS)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{ml:6,size:"xs",color:"red",variant:"light",children:["+",days,"j"]})}function withDossierFilter(rows,dossier){if(!dossier)return rows;return rows.filter(r=>r.dossier===dossier)}function withManagedFilter(rows,managedOnly){if(!managedOnly)return rows;return rows.filter(r=>true===r.managed)}function withCategoryFilter(rows,category){if("all"===category)return rows;return rows.filter(r=>r.category===category)}function etatBadge(row){if("error"===row.status)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"red",variant:"light",children:"Erreur"});if("too_large"===row.status)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"orange",variant:"light",children:"Trop volumineux"});if("anomalie"===row.category)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"orange",variant:"light",children:"Anomalie"});if("stale"===row.reason)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"yellow",variant:"light",children:"P\xe9rim\xe9"});if("empty"===row.reason)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"gray",variant:"light",children:"Vide"});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"green",variant:"light",children:"Propre"})}function EtatSaisieApp(){const latest=useEtatSaisieLatest();const recompute=useEtatSaisieRecompute();const[tab,setTab]=(0,index_js_.useState)("resume");const[selectedDossier,setSelectedDossier]=(0,index_js_.useState)(null);const[managedOnly,setManagedOnly]=(0,index_js_.useState)(true);const[statusFilter,setStatusFilter]=(0,index_js_.useState)("all");const[drillDossier,setDrillDossier]=(0,index_js_.useState)(null);const d=latest.data;const allDossiers=(0,index_js_.useMemo)(()=>{if(!d?.available)return[];const set=new Set;for(const r of d.suspense_rows??[])set.add(r.dossier);for(const r of d.supplier_rows??[])set.add(r.dossier);for(const r of d.customer_rows??[])set.add(r.dossier);for(const r of d.dossier_lines??[])set.add(r.dossier);for(const r of d.summary?.top_5_suspense??[])set.add(r.dossier);for(const r of d.summary?.top_5_supplier_debtors??[])set.add(r.dossier);for(const r of d.summary?.top_5_customer_creditors??[])set.add(r.dossier);return[...set].sort()},[d]);const openDrill=row=>setDrillDossier(row.dossier);const drillData=(0,index_js_.useMemo)(()=>{if(!drillDossier||!d?.available)return null;return{suspense:(d.suspense_rows??[]).filter(r=>r.dossier===drillDossier),supplier:(d.supplier_rows??[]).filter(r=>r.dossier===drillDossier),customer:(d.customer_rows??[]).filter(r=>r.dossier===drillDossier)}},[drillDossier,d]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{fluid:true,my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:"\xc9tat saisie",updatedAt:d?.computed_at?new Date(d.computed_at).getTime():latest.dataUpdatedAt,isFetching:latest.isFetching,isError:latest.isError,onRefresh:()=>latest.refetch(),actions:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{loading:recompute.isPending,onClick:()=>recompute.mutate(),variant:"light",children:"Recalculer"})}),d&&!d.available?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Aucun snapshot disponible — lancez \xab Recalculer \xbb ou attendez le run nocturne."}):/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{mb:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"Focus dossier",placeholder:"Tous les dossiers",data:allDossiers.map(dos=>({value:dos,label:dos})),value:selectedDossier,onChange:setSelectedDossier,searchable:true,clearable:true,w:320}),selectedDossier&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"subtle",onClick:()=>setSelectedDossier(null),mt:22,children:"R\xe9initialiser"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{mt:22,value:managedOnly?"managed":"all",onChange:v=>setManagedOnly("managed"===v),data:[{label:"G\xe9r\xe9s",value:"managed"},{label:"Tous",value:"all"}]})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs,{value:tab,onChange:setTab,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs.List,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"resume",children:"R\xe9sum\xe9"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"top5",children:"Top 5"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s471",children:"D\xe9tail 471"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s58",children:"Virements internes (58)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s401",children:"Fournisseurs d\xe9biteurs (401)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s411",children:"Clients cr\xe9diteurs (411)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"dossiers",children:"Dossiers"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs.Panel,{value:"resume",pt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:4,mb:"md",children:[{key:"all",label:"Scann\xe9s",value:d?.summary?.companies_scanned??0,color:void 0},{key:"propre",label:"Propres",value:d?.summary?.companies_clean??0,color:"green"},{key:"anomalie",label:"En anomalie",value:d?.summary?.companies_with_anomalies??0,color:"orange"},{key:"erreur",label:"En erreur",value:d?.summary?.companies_in_error??0,color:"red"}].map(tile=>{const active=statusFilter===tile.key;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:active,style:{cursor:"pointer",borderColor:active?"var(--mantine-color-blue-5)":void 0},onClick:()=>setStatusFilter(tile.key),children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:tile.label}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",c:tile.color,children:tile.value})]},tile.key)})}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:UNIFIED_COLS,rows:withCategoryFilter(withManagedFilter(withDossierFilter(d?.dossier_lines??[],selectedDossier),managedOnly),statusFilter),onRowClick:openDrill})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs.Panel,{value:"top5",pt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 comptes d'attente (471)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_SUSPENSE_COLS,rows:withDossierFilter(d?.summary?.top_5_suspense??[],selectedDossier),onRowClick:openDrill}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 fournisseurs d\xe9biteurs (401)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_SUPPLIER_COLS,rows:withDossierFilter(d?.summary?.top_5_supplier_debtors??[],selectedDossier),onRowClick:openDrill}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 clients cr\xe9diteurs (411)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_CUSTOMER_COLS,rows:withDossierFilter(d?.summary?.top_5_customer_creditors??[],selectedDossier),onRowClick:openDrill})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s471",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUSPENSE_COLS,rows:withManagedFilter(withDossierFilter(d?.suspense_rows??[],selectedDossier),managedOnly),onRowClick:openDrill})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s58",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUSPENSE_COLS,rows:withManagedFilter(withDossierFilter(d?.internal_transfer_rows??[],selectedDossier),managedOnly),onRowClick:openDrill})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s401",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUPPLIER_COLS,rows:withManagedFilter(withDossierFilter(d?.supplier_rows??[],selectedDossier),managedOnly),onRowClick:openDrill})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s411",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:CUSTOMER_COLS,rows:withManagedFilter(withDossierFilter(d?.customer_rows??[],selectedDossier),managedOnly),onRowClick:openDrill})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"dossiers",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DossiersTab,{})})]})]}),latest.isError?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"red",mt:"md",children:"Erreur de chargement."}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Drawer,{opened:!!drillDossier,onClose:()=>setDrillDossier(null),position:"right",size:"xl",title:drillDossier?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:["Dossier ",drillDossier]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:"light",onClick:()=>{setSelectedDossier(drillDossier);setDrillDossier(null)},children:"Focus sur ce dossier"})]}):null,children:drillData&&/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:5,mb:6,children:["Comptes d'attente 471 (",drillData.suspense.length,")"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DRILL_SUSPENSE_COLS,rows:drillData.suspense})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:5,mb:6,children:["Fournisseurs d\xe9biteurs 401 (",drillData.supplier.length,")"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DRILL_SUPPLIER_COLS,rows:drillData.supplier})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:5,mb:6,children:["Clients cr\xe9diteurs 411 (",drillData.customer.length,")"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DRILL_CUSTOMER_COLS,rows:drillData.customer})]})]})})]})}const TOP_SUSPENSE_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"G\xe9r\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"solde_eur",label:"Solde 471 (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr.",numeric:true},{key:"top_libelle",label:"Top \xe9criture"},{key:"top_montant",label:"Montant",numeric:true}];const TOP_SUPPLIER_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"total_eur",label:"Total d\xe9biteur (€)",numeric:true},{key:"nb_fournisseurs",label:"Nb fourn.",numeric:true},{key:"top_nom",label:"Top fournisseur"},{key:"top_montant",label:"Montant",numeric:true}];const TOP_CUSTOMER_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"total_eur",label:"Total cr\xe9diteur (€)",numeric:true},{key:"nb_clients",label:"Nb clients",numeric:true},{key:"top_nom",label:"Top client"},{key:"top_montant",label:"Montant",numeric:true}];const UNIFIED_COLS=[{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"status",label:"\xc9tat",render:r=>etatBadge(r)},{key:"dossier",label:"Dossier"},{key:"responsable",label:"Responsable",render:r=>r.responsable?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Avatar,{src:r.responsable.avatar_url,size:20,radius:"xl"}),/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:r.responsable.name})]}):/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:"—"})},{key:"fiscal_year_end",label:"Cl\xf4ture",render:r=>r.fiscal_year_end?/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:r.fiscal_year_end.split("-").reverse().join("/")}):/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:"—"})},{key:"solde_attente_eur",label:"Solde 471 (€)",numeric:true},{key:"solde_virements_eur",label:"Solde 58 (€)",numeric:true},{key:"total_fournisseurs_eur",label:"Fourn. d\xe9biteurs (€)",numeric:true},{key:"total_clients_eur",label:"Clients cr\xe9diteurs (€)",numeric:true},{key:"last_entry_date",label:"Derni\xe8re \xe9criture",render:row=>/*#__PURE__*/(0,jsx_runtime.jsxs)("span",{children:[row.last_entry_date??"—",staleBadge(row.last_entry_date)]})}];const SUSPENSE_COLS=[{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"date",label:"Date"},{key:"numero_compte",label:"N\xb0 Compte"},{key:"libelle_compte",label:"Libell\xe9 compte"},{key:"libelle_ecriture",label:"Libell\xe9 \xe9criture"},{key:"journal",label:"Journal"},{key:"numero_piece",label:"N\xb0 Pi\xe8ce"},{key:"debit",label:"D\xe9bit",numeric:true},{key:"credit",label:"Cr\xe9dit",numeric:true},{key:"solde_net",label:"Solde net",numeric:true},{key:"lettre",label:"Lettr\xe9"},{key:"devise",label:"Devise"}];const SUPPLIER_COLS=[{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"fournisseur",label:"Fournisseur"},{key:"solde_debiteur_eur",label:"Solde d\xe9biteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr. non lettr\xe9es",numeric:true},{key:"devise",label:"Devise"}];const CUSTOMER_COLS=[{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"client",label:"Client"},{key:"solde_crediteur_eur",label:"Solde cr\xe9diteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr. non lettr\xe9es",numeric:true},{key:"devise",label:"Devise"}];const DRILL_SUSPENSE_COLS=[{key:"date",label:"Date"},{key:"numero_compte",label:"N\xb0 Compte"},{key:"libelle_ecriture",label:"Libell\xe9"},{key:"debit",label:"D\xe9bit",numeric:true},{key:"credit",label:"Cr\xe9dit",numeric:true},{key:"solde_net",label:"Solde net",numeric:true},{key:"lettre",label:"Lettr\xe9"}];const DRILL_SUPPLIER_COLS=[{key:"fournisseur",label:"Fournisseur"},{key:"solde_debiteur_eur",label:"Solde d\xe9biteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr.",numeric:true},{key:"devise",label:"Devise"}];const DRILL_CUSTOMER_COLS=[{key:"client",label:"Client"},{key:"solde_crediteur_eur",label:"Solde cr\xe9diteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr.",numeric:true},{key:"devise",label:"Devise"}];function EtatSaisie(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(EtatSaisieApp,{})})})}}}]);