@airporting/tech-app 0.0.48 → 0.0.50

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.
package/dist/mf/9660.js CHANGED
@@ -1 +1 @@
1
- "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["9660"],{2663:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{r:()=>QueueDashboard});var jsx_runtime=__webpack_require__(5893);var index_mjs_=__webpack_require__(207);var index_js_=__webpack_require__(3106);var PageHeader=__webpack_require__(1354);var esm_index_mjs_=__webpack_require__(1455);function BulkActionBar({selectedIds,onClear,actions}){const count=selectedIds.length;const[confirm,setConfirm]=(0,index_js_.useState)(null);const[prompt,setPrompt]=(0,index_js_.useState)(null);const[promptValue,setPromptValue]=(0,index_js_.useState)("");const[pending,setPending]=(0,index_js_.useState)(false);if(0===count)return null;const run=async(action,value)=>{setConfirm(null);setPrompt(null);setPending(true);const res=await action.run(selectedIds,value);setPending(false);onClear();esm_index_mjs_.notifications.show({title:action.label,message:`${res.ok} succeeded${res.failed?`, ${res.failed} failed`:""}`,color:res.failed?"red":"green"})};const trigger=action=>{if(action.prompt){setPromptValue("");setPrompt(action.key)}else if(action.confirm)setConfirm(action.key);else run(action)};return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{p:"sm",radius:"md",withBorder:true,style:{position:"sticky",bottom:16,zIndex:5,backgroundColor:"var(--mantine-color-dark-7)"},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",fw:600,children:[count," selected"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:"subtle",onClick:onClear,children:"Clear"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{gap:"xs",children:actions.map(a=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:a.variant??"default",color:a.color,loading:pending,onClick:()=>trigger(a),children:a.label},a.key))})]})}),actions.filter(a=>a.confirm).map(a=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:confirm===a.key,onClose:()=>setConfirm(null),title:a.confirm.title.replace("{count}",String(count)),children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:a.confirm.body}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setConfirm(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Button,{color:a.color,onClick:()=>run(a),children:[a.label," ",count]})]})]})},a.key)),actions.filter(a=>a.prompt).map(a=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:prompt===a.key,onClose:()=>setPrompt(null),title:`${a.label} \u{2014} ${count} task(s)`,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:a.prompt.label,placeholder:a.prompt.placeholder,value:promptValue,onChange:e=>setPromptValue(e.currentTarget.value)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setPrompt(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Button,{color:a.color,disabled:!promptValue.trim(),onClick:()=>run(a,promptValue.trim()),children:["Apply to ",count]})]})]})},a.key))]})}function FiltersBar({fields,values,onChange,stock}){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{align:"flex-end",children:fields.map(field=>{if("search"===field.kind)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:field.label,placeholder:field.placeholder??"Rechercher…",value:values[field.key]??"",onChange:e=>onChange({...values,[field.key]:e.currentTarget.value}),w:field.width??220},field.key);const raw=field.options(stock);const options=raw.map(o=>"string"==typeof o?{value:o,label:o}:o);return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:field.label,placeholder:field.placeholder??"All",data:options,value:values[field.key]??null,onChange:v=>onChange({...values,[field.key]:v}),searchable:true,clearable:field.clearable??true,w:field.width??220},field.key)})})}var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useJobLogs(githubJob){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","github","job-logs",githubJob],queryFn:async()=>(await api.github.getJobLogsV1({githubJob:githubJob})).data,enabled:!!githubJob,refetchOnWindowFocus:false,retry:false})}function fallbackUrl(githubJob){const parts=githubJob.split("/");if(parts.length<3)return null;const runId=parts[parts.length-1];const repo=parts[parts.length-2];const owner=parts.slice(0,-2).join("/");return`https://github.com/${owner}/${repo}/actions/runs/${runId}`}function JobLogsDrawer({githubJob,opened,onClose}){const query=useJobLogs(opened?githubJob:null);const ghLink=githubJob?fallbackUrl(githubJob):null;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Drawer,{opened:opened,onClose:onClose,position:"right",size:"60%",title:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,children:"Workflow logs"}),query.data?.conclusion&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"success"===query.data.conclusion?"green":"red",children:query.data.conclusion})]}),children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[ghLink&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{component:"a",href:ghLink,target:"_blank",variant:"default",size:"xs",children:"Open in GitHub"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:"default",onClick:()=>query.refetch(),children:"Refresh logs"})]}),query.isLoading&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:400}),query.isError&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Alert,{color:"red",title:"Failed to load logs",children:query.error?.message??"Unknown error"}),query.data?.jobs.map((j,i)=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:5,children:j.name}),j.conclusion&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"success"===j.conclusion?"green":"red",children:j.conclusion})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Code,{block:true,style:{maxHeight:400,overflow:"auto",whiteSpace:"pre"},children:j.logs||"(empty)"})]},i)),query.data&&0===query.data.jobs.length&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"No jobs found."})]})})}var jobLogsContext=__webpack_require__(6845);function toneToBg(tone){switch(tone){case"bad":return"rgba(255, 99, 99, 0.12)";case"warn":return"rgba(255, 170, 80, 0.12)";case"good":return"rgba(80, 200, 120, 0.10)";default:return}}function isFilterActive(tileFilter,active){if(!tileFilter||!active)return false;return Object.entries(tileFilter).every(([k,v])=>active[k]===v)}function KpiStrip({stock,isLoading,isError,tiles,activeFilter,onTileClick}){if(isLoading)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:Math.min(tiles.length,6),children:tiles.map(t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:60},t.key))});if(isError)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"red",children:"Failed to load stock"});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:Math.min(tiles.length,6),children:tiles.map(t=>{const tone=t.tone?.(stock);const clickable=Boolean(t.filter&&onTileClick);const active=isFilterActive(t.filter,activeFilter);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{padding:"sm",radius:"md",withBorder:true,onClick:clickable?()=>onTileClick(t):void 0,style:{backgroundColor:toneToBg(tone),minHeight:60,cursor:clickable?"pointer":"default",outline:active?"2px solid var(--mantine-color-teal-5)":void 0,outlineOffset:active?-2:void 0,transition:"outline 120ms ease"},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:t.label}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"lg",children:t.value(stock)})]},t.key)})})}function TasksTable({items,total,isLoading,columns,rowActions,selectedIds,getRowId,onToggleId,onToggleAll}){if(isLoading)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:300});if(!items||0===items.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"No tasks for current filters."});const visibleIds=items.map(getRowId);const allSelected=visibleIds.every(id=>selectedIds.has(id));const someSelected=!allSelected&&visibleIds.some(id=>selectedIds.has(id));return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.ScrollArea,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"xs",c:"dimmed",mb:"xs",children:[total," task(s)"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{miw:1100,verticalSpacing:"xs",highlightOnHover: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,{w:40,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Checkbox,{checked:allSelected,indeterminate:someSelected,onChange:e=>onToggleAll(visibleIds,e.currentTarget.checked),"aria-label":"Select all"})}),columns.map(col=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{style:{minWidth:col.minWidth},children:col.label},col.key)),rowActions.length>0&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Actions"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:items.map(item=>{const id=getRowId(item);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{bg:selectedIds.has(id)?"var(--mantine-color-dark-6)":void 0,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Checkbox,{checked:selectedIds.has(id),onChange:()=>onToggleId(id),"aria-label":`Select task ${id}`})}),columns.map(col=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:col.render(item)},col.key)),rowActions.length>0&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:rowActions.map(a=>/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:a.render(item)},a.key))})]},id)})})]})]})}function normalizeSignature(message){return message.replace(/[\d]+/g,"#").replace(/['"]/g,"").replace(/\s+/g," ").trim().slice(0,140)}function TopErrorsCard({items,extract,onPick,limit=5}){const groups=(0,index_js_.useMemo)(()=>{const map=new Map;for(const item of items??[]){const raw=extract(item);if(!raw)continue;const sig=normalizeSignature(raw);map.set(sig,(map.get(sig)??0)+1)}return[...map.entries()].sort((a,b)=>b[1]-a[1]).slice(0,limit).map(([sig,count])=>({sig,count}))},[items,extract,limit]);if(0===groups.length)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{padding:"md",radius:"md",withBorder:true,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",mb:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:5,children:"Top erreurs"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"regroup\xe9es par signature"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Stack,{gap:6,children:groups.map(({sig,count})=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"sm",wrap:"nowrap",style:{cursor:onPick?"pointer":"default"},onClick:()=>onPick?.(sig),children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{color:"red",variant:"light",children:["\xd7",count]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",style:{flex:1},truncate:true,children:sig})]},sig))})]})}function QueueDashboard({config}){const stock=config.source.useStock();const[filters,setFilters]=(0,index_js_.useState)(config.initialFilters);const tasksQuery=config.source.useTasks(filters);const items=tasksQuery.data?.items;const[selectedIds,setSelectedIds]=(0,index_js_.useState)(new Set);const toggleId=(0,index_js_.useCallback)(id=>{setSelectedIds(prev=>{const next=new Set(prev);if(next.has(id))next.delete(id);else next.add(id);return next})},[]);const toggleAll=(0,index_js_.useCallback)((ids,select)=>{setSelectedIds(prev=>{const next=new Set(prev);for(const id of ids)if(select)next.add(id);else next.delete(id);return next})},[]);const clearSelection=(0,index_js_.useCallback)(()=>setSelectedIds(new Set),[]);const searchKey=config.filters.find(f=>"search"===f.kind)?.key;const searchValue=searchKey?(filters[searchKey]??"").trim().toLowerCase():"";const filtered=(0,index_js_.useMemo)(()=>{if(!items)return;if(!searchValue||!config.searchMatches)return items;return items.filter(it=>config.searchMatches(it,searchValue))},[items,searchValue,config]);const onErrorPick=signature=>{if(!searchKey)return;setFilters({...filters,[searchKey]:signature})};return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Container,{fluid:true,my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(jobLogsContext.z,{children:(currentJob,closeJob)=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:config.title,badge:config.headerBadge,updatedAt:stock.dataUpdatedAt,isFetching:stock.isFetching||tasksQuery.isFetching,isError:stock.isError,onRefresh:()=>{stock.refetch();tasksQuery.refetch()},actions:config.headerActions}),/*#__PURE__*/(0,jsx_runtime.jsx)(KpiStrip,{stock:stock.data,isLoading:stock.isLoading,isError:stock.isError,tiles:config.kpis,activeFilter:filters,onTileClick:tile=>{if(tile.filter)setFilters({...filters,...tile.filter})}}),config.topErrors&&/*#__PURE__*/(0,jsx_runtime.jsx)(TopErrorsCard,{items:items,extract:config.topErrors.extract,onPick:onErrorPick}),/*#__PURE__*/(0,jsx_runtime.jsx)(FiltersBar,{fields:config.filters,values:filters,onChange:setFilters,stock:stock.data}),/*#__PURE__*/(0,jsx_runtime.jsx)(TasksTable,{items:filtered,total:tasksQuery.data?.total??filtered?.length??0,isLoading:tasksQuery.isLoading,columns:config.columns,rowActions:config.rowActions,selectedIds:selectedIds,getRowId:config.getRowId,onToggleId:toggleId,onToggleAll:toggleAll}),/*#__PURE__*/(0,jsx_runtime.jsx)(BulkActionBar,{selectedIds:[...selectedIds],onClear:clearSelection,actions:config.bulkActions}),/*#__PURE__*/(0,jsx_runtime.jsx)(JobLogsDrawer,{githubJob:currentJob,opened:!!currentJob,onClose:closeJob})]})})})}},6845:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{j:()=>useOpenJobLogs,z:()=>JobLogsProvider});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var react__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(3106);const JobLogsContext=/*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.createContext)(null);function useOpenJobLogs(){const ctx=(0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(JobLogsContext);if(!ctx)throw new Error("useOpenJobLogs must be used within JobLogsProvider");return ctx.open}function JobLogsProvider({children}){const[current,setCurrent]=(0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(null);return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(JobLogsContext.Provider,{value:{open:setCurrent},children:children(current,()=>setCurrent(null))})}},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 react__WEBPACK_IMPORTED_MODULE_2__=__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_2__.useState)(()=>Date.now());(0,react__WEBPACK_IMPORTED_MODULE_2__.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__.ActionIcon,{variant:"subtle",color:"gray",onClick:onRefresh,disabled:!onRefresh,"aria-label":"Refresh",style:{width:"auto",paddingInline:8},children:/*#__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})}),actions]})]})}}}]);
1
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["9660"],{2663:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{r:()=>QueueDashboard});var jsx_runtime=__webpack_require__(5893);var index_mjs_=__webpack_require__(207);var index_js_=__webpack_require__(3106);var PageHeader=__webpack_require__(1354);var esm_index_mjs_=__webpack_require__(1455);function BulkActionBar({selectedIds,onClear,actions}){const count=selectedIds.length;const[confirm,setConfirm]=(0,index_js_.useState)(null);const[prompt,setPrompt]=(0,index_js_.useState)(null);const[promptValue,setPromptValue]=(0,index_js_.useState)("");const[pending,setPending]=(0,index_js_.useState)(false);if(0===count)return null;const run=async(action,value)=>{setConfirm(null);setPrompt(null);setPending(true);const res=await action.run(selectedIds,value);setPending(false);onClear();esm_index_mjs_.notifications.show({title:action.label,message:`${res.ok} succeeded${res.failed?`, ${res.failed} failed`:""}`,color:res.failed?"red":"green"})};const trigger=action=>{if(action.prompt){setPromptValue("");setPrompt(action.key)}else if(action.confirm)setConfirm(action.key);else run(action)};return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Paper,{p:"sm",radius:"md",withBorder:true,style:{position:"sticky",bottom:16,zIndex:5,backgroundColor:"var(--mantine-color-dark-7)"},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"sm",fw:600,children:[count," selected"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:"subtle",onClick:onClear,children:"Clear"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{gap:"xs",children:actions.map(a=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:a.variant??"default",color:a.color,loading:pending,onClick:()=>trigger(a),children:a.label},a.key))})]})}),actions.filter(a=>a.confirm).map(a=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:confirm===a.key,onClose:()=>setConfirm(null),title:a.confirm.title.replace("{count}",String(count)),children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",children:a.confirm.body}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setConfirm(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Button,{color:a.color,onClick:()=>run(a),children:[a.label," ",count]})]})]})},a.key)),actions.filter(a=>a.prompt).map(a=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:prompt===a.key,onClose:()=>setPrompt(null),title:`${a.label} \u{2014} ${count} task(s)`,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:a.prompt.label,placeholder:a.prompt.placeholder,value:promptValue,onChange:e=>setPromptValue(e.currentTarget.value)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:()=>setPrompt(null),children:"Cancel"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Button,{color:a.color,disabled:!promptValue.trim(),onClick:()=>run(a,promptValue.trim()),children:["Apply to ",count]})]})]})},a.key))]})}function FiltersBar({fields,values,onChange,stock}){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{align:"flex-end",children:fields.map(field=>{if("search"===field.kind)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:field.label,placeholder:field.placeholder??"Rechercher…",value:values[field.key]??"",onChange:e=>onChange({...values,[field.key]:e.currentTarget.value}),w:field.width??220},field.key);const raw=field.options(stock);const options=raw.map(o=>"string"==typeof o?{value:o,label:o}:o);return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:field.label,placeholder:field.placeholder??"All",data:options,value:values[field.key]??null,onChange:v=>onChange({...values,[field.key]:v}),searchable:true,clearable:field.clearable??true,w:field.width??220},field.key)})})}var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useJobLogs(githubJob){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","github","job-logs",githubJob],queryFn:async()=>(await api.github.getJobLogsV1({githubJob:githubJob})).data,enabled:!!githubJob,refetchOnWindowFocus:false,retry:false})}function fallbackUrl(githubJob){const parts=githubJob.split("/");if(parts.length<3)return null;const runId=parts[parts.length-1];const repo=parts[parts.length-2];const owner=parts.slice(0,-2).join("/");return`https://github.com/${owner}/${repo}/actions/runs/${runId}`}function JobLogsDrawer({githubJob,opened,onClose}){const query=useJobLogs(opened?githubJob:null);const ghLink=githubJob?fallbackUrl(githubJob):null;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Drawer,{opened:opened,onClose:onClose,position:"right",size:"60%",title:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,children:"Workflow logs"}),query.data?.conclusion&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"success"===query.data.conclusion?"green":"red",children:query.data.conclusion})]}),children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[ghLink&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{component:"a",href:ghLink,target:"_blank",variant:"default",size:"xs",children:"Open in GitHub"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:"default",onClick:()=>query.refetch(),children:"Refresh logs"})]}),query.isLoading&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:400}),query.isError&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Alert,{color:"red",title:"Failed to load logs",children:query.error?.message??"Unknown error"}),query.data?.jobs.map((j,i)=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:5,children:j.name}),j.conclusion&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"success"===j.conclusion?"green":"red",children:j.conclusion})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Code,{block:true,style:{maxHeight:400,overflow:"auto",whiteSpace:"pre"},children:j.logs||"(empty)"})]},i)),query.data&&0===query.data.jobs.length&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"No jobs found."})]})})}var jobLogsContext=__webpack_require__(6845);function toneToBg(tone){switch(tone){case"bad":return"rgba(255, 99, 99, 0.12)";case"warn":return"rgba(255, 170, 80, 0.12)";case"good":return"rgba(80, 200, 120, 0.10)";default:return}}function isFilterActive(tileFilter,active){if(!tileFilter||!active)return false;return Object.entries(tileFilter).every(([k,v])=>active[k]===v)}function KpiStrip({stock,isLoading,isError,tiles,activeFilter,onTileClick}){if(isLoading)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:Math.min(tiles.length,6),children:tiles.map(t=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:60},t.key))});if(isError)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"red",children:"Failed to load stock"});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:Math.min(tiles.length,6),children:tiles.map(t=>{const tone=t.tone?.(stock);const clickable=Boolean(t.filter&&onTileClick);const active=isFilterActive(t.filter,activeFilter);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{padding:"sm",radius:"md",withBorder:true,onClick:clickable?()=>onTileClick(t):void 0,style:{backgroundColor:toneToBg(tone),minHeight:60,cursor:clickable?"pointer":"default",outline:active?"2px solid var(--mantine-color-teal-5)":void 0,outlineOffset:active?-2:void 0,transition:"outline 120ms ease"},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:t.label}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"lg",children:t.value(stock)})]},t.key)})})}function TasksTable({items,total,isLoading,columns,rowActions,selectedIds,getRowId,onToggleId,onToggleAll}){if(isLoading)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Skeleton,{height:300});if(!items||0===items.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"No tasks for current filters."});const visibleIds=items.map(getRowId);const allSelected=visibleIds.every(id=>selectedIds.has(id));const someSelected=!allSelected&&visibleIds.some(id=>selectedIds.has(id));return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.ScrollArea,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{size:"xs",c:"dimmed",mb:"xs",children:[total," task(s)"]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{miw:1100,verticalSpacing:"xs",highlightOnHover: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,{w:40,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Checkbox,{checked:allSelected,indeterminate:someSelected,onChange:e=>onToggleAll(visibleIds,e.currentTarget.checked),"aria-label":"Select all"})}),columns.map(col=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{style:{minWidth:col.minWidth},children:col.label},col.key)),rowActions.length>0&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Actions"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:items.map(item=>{const id=getRowId(item);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{bg:selectedIds.has(id)?"var(--mantine-color-dark-6)":void 0,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Checkbox,{checked:selectedIds.has(id),onChange:()=>onToggleId(id),"aria-label":`Select task ${id}`})}),columns.map(col=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:col.render(item)},col.key)),rowActions.length>0&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:rowActions.map(a=>/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:a.render(item)},a.key))})]},id)})})]})]})}function normalizeSignature(message){return message.replace(/[\d]+/g,"#").replace(/['"]/g,"").replace(/\s+/g," ").trim().slice(0,140)}function TopErrorsCard({items,extract,onPick,limit=5}){const groups=(0,index_js_.useMemo)(()=>{const map=new Map;for(const item of items??[]){const raw=extract(item);if(!raw)continue;const sig=normalizeSignature(raw);map.set(sig,(map.get(sig)??0)+1)}return[...map.entries()].sort((a,b)=>b[1]-a[1]).slice(0,limit).map(([sig,count])=>({sig,count}))},[items,extract,limit]);if(0===groups.length)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{padding:"md",radius:"md",withBorder:true,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",mb:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:5,children:"Top erreurs"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"regroup\xe9es par signature"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Stack,{gap:6,children:groups.map(({sig,count})=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"sm",wrap:"nowrap",style:{cursor:onPick?"pointer":"default"},onClick:()=>onPick?.(sig),children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{color:"red",variant:"light",children:["\xd7",count]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",style:{flex:1},truncate:true,children:sig})]},sig))})]})}function QueueDashboard({config}){const stock=config.source.useStock();const[filters,setFilters]=(0,index_js_.useState)(config.initialFilters);const tasksQuery=config.source.useTasks(filters);const items=tasksQuery.data?.items;const[selectedIds,setSelectedIds]=(0,index_js_.useState)(new Set);const toggleId=(0,index_js_.useCallback)(id=>{setSelectedIds(prev=>{const next=new Set(prev);if(next.has(id))next.delete(id);else next.add(id);return next})},[]);const toggleAll=(0,index_js_.useCallback)((ids,select)=>{setSelectedIds(prev=>{const next=new Set(prev);for(const id of ids)if(select)next.add(id);else next.delete(id);return next})},[]);const clearSelection=(0,index_js_.useCallback)(()=>setSelectedIds(new Set),[]);const searchKey=config.filters.find(f=>"search"===f.kind)?.key;const searchValue=searchKey?(filters[searchKey]??"").trim().toLowerCase():"";const filtered=(0,index_js_.useMemo)(()=>{if(!items)return;if(!searchValue||!config.searchMatches)return items;return items.filter(it=>config.searchMatches(it,searchValue))},[items,searchValue,config]);const onErrorPick=signature=>{if(!searchKey)return;setFilters({...filters,[searchKey]:signature})};return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Container,{fluid:true,my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(jobLogsContext.z,{children:(currentJob,closeJob)=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:config.title,badge:config.headerBadge,updatedAt:stock.dataUpdatedAt,isFetching:stock.isFetching||tasksQuery.isFetching,isError:stock.isError,onRefresh:()=>{stock.refetch();tasksQuery.refetch()},actions:config.headerActions}),/*#__PURE__*/(0,jsx_runtime.jsx)(KpiStrip,{stock:stock.data,isLoading:stock.isLoading,isError:stock.isError,tiles:config.kpis,activeFilter:filters,onTileClick:tile=>{if(tile.filter)setFilters({...filters,...tile.filter})}}),config.topErrors&&/*#__PURE__*/(0,jsx_runtime.jsx)(TopErrorsCard,{items:items,extract:config.topErrors.extract,onPick:onErrorPick}),/*#__PURE__*/(0,jsx_runtime.jsx)(FiltersBar,{fields:config.filters,values:filters,onChange:setFilters,stock:stock.data}),/*#__PURE__*/(0,jsx_runtime.jsx)(TasksTable,{items:filtered,total:tasksQuery.data?.total??filtered?.length??0,isLoading:tasksQuery.isLoading,columns:config.columns,rowActions:config.rowActions,selectedIds:selectedIds,getRowId:config.getRowId,onToggleId:toggleId,onToggleAll:toggleAll}),/*#__PURE__*/(0,jsx_runtime.jsx)(BulkActionBar,{selectedIds:[...selectedIds],onClear:clearSelection,actions:config.bulkActions}),/*#__PURE__*/(0,jsx_runtime.jsx)(JobLogsDrawer,{githubJob:currentJob,opened:!!currentJob,onClose:closeJob})]})})})}},6845:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{j:()=>useOpenJobLogs,z:()=>JobLogsProvider});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var react__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(3106);const JobLogsContext=/*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_1__.createContext)(null);function useOpenJobLogs(){const ctx=(0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(JobLogsContext);if(!ctx)throw new Error("useOpenJobLogs must be used within JobLogsProvider");return ctx.open}function JobLogsProvider({children}){const[current,setCurrent]=(0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(null);return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(JobLogsContext.Provider,{value:{open:setCurrent},children:children(current,()=>setCurrent(null))})}},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]})]})}}}]);
@@ -1,9 +1,12 @@
1
+ import { ReactNode } from 'react';
1
2
  export type Column<T> = {
2
3
  key: keyof T & string;
3
4
  label: string;
4
5
  numeric?: boolean;
6
+ render?: (row: T) => ReactNode;
5
7
  };
6
8
  export declare function DetailTable<T>(props: {
7
9
  columns: Column<T>[];
8
10
  rows: T[];
11
+ onRowClick?: (row: T) => void;
9
12
  }): import("react/jsx-runtime").JSX.Element;
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 react__WEBPACK_IMPORTED_MODULE_2__=__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_2__.useState)(()=>Date.now());(0,react__WEBPACK_IMPORTED_MODULE_2__.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__.ActionIcon,{variant:"subtle",color:"gray",onClick:onRefresh,disabled:!onRefresh,"aria-label":"Refresh",style:{width:"auto",paddingInline:8},children:/*#__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})}),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"})})}},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 +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 react__WEBPACK_IMPORTED_MODULE_2__=__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_2__.useState)(()=>Date.now());(0,react__WEBPACK_IMPORTED_MODULE_2__.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__.ActionIcon,{variant:"subtle",color:"gray",onClick:onRefresh,disabled:!onRefresh,"aria-label":"Refresh",style:{width:"auto",paddingInline:8},children:/*#__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})}),actions]})]})}},7497: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}=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?"✓":"";return null==v?"—":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,{children:columns.map(c=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{style:c.numeric?{textAlign:"right",fontVariantNumeric:"tabular-nums"}:void 0,children:fmt(row[c.key],c.numeric)},c.key))},i))})]})}var PageHeader=__webpack_require__(1354);function EtatSaisieApp(){const latest=useEtatSaisieLatest();const recompute=useEtatSaisieRecompute();const[tab,setTab]=(0,index_js_.useState)("resume");const d=latest.data;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)(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:"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.jsxs)(index_mjs_.Tabs.Panel,{value:"resume",pt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.SimpleGrid,{cols:4,mb:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"Scann\xe9s"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",children:d?.summary?.companies_scanned??0})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"Propres"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",c:"green",children:d?.summary?.companies_clean??0})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"En anomalie"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",c:"orange",children:d?.summary?.companies_with_anomalies??0})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"En erreur"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",c:"red",children:d?.summary?.companies_in_error??0})]})]}),/*#__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:d?.summary?.top_5_suspense??[]}),/*#__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:d?.summary?.top_5_supplier_debtors??[]}),/*#__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:d?.summary?.top_5_customer_creditors??[]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Dossiers \xe0 relancer (no_data)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DOSSIER_COLS,rows:d?.no_data??[]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Dossiers non manag\xe9s (hors agr\xe9gats)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DOSSIER_COLS,rows:d?.not_managed??[]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s471",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUSPENSE_COLS,rows:d?.suspense_rows??[]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s401",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUPPLIER_COLS,rows:d?.supplier_rows??[]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s411",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:CUSTOMER_COLS,rows:d?.customer_rows??[]})})]}),latest.isError?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"red",mt:"md",children:"Erreur de chargement."}):null]})}const TOP_SUSPENSE_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source"},{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"},{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"},{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 DOSSIER_COLS=[{key:"source",label:"Source"},{key:"dossier",label:"Dossier"},{key:"status",label:"Statut"},{key:"solde_attente_eur",label:"Solde attente (€)",numeric:true},{key:"total_fournisseurs_eur",label:"Total fourn. (€)",numeric:true},{key:"total_clients_eur",label:"Total clients (€)",numeric:true},{key:"last_entry_date",label:"Derni\xe8re \xe9criture"}];const SUSPENSE_COLS=[{key:"source",label:"Source"},{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"},{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"},{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"}];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]})]})}},7497: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?"✓":"";return null==v?"—":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))})]})}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 EtatSaisieApp(){const latest=useEtatSaisieLatest();const recompute=useEtatSaisieRecompute();const[tab,setTab]=(0,index_js_.useState)("resume");const[selectedDossier,setSelectedDossier]=(0,index_js_.useState)(null);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.no_data??[])set.add(r.dossier);for(const r of d.not_managed??[])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.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:"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.jsxs)(index_mjs_.Tabs.Panel,{value:"resume",pt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.SimpleGrid,{cols:4,mb:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"Scann\xe9s"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",children:d?.summary?.companies_scanned??0})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"Propres"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",c:"green",children:d?.summary?.companies_clean??0})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"En anomalie"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",c:"orange",children:d?.summary?.companies_with_anomalies??0})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:"En erreur"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",c:"red",children:d?.summary?.companies_in_error??0})]})]}),/*#__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_.Title,{order:4,mt:"md",children:"Dossiers \xe0 relancer (no_data)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DOSSIER_COLS,rows:withDossierFilter(d?.no_data??[],selectedDossier),onRowClick:openDrill}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Dossiers non manag\xe9s (hors agr\xe9gats)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DOSSIER_COLS,rows:withDossierFilter(d?.not_managed??[],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:withDossierFilter(d?.suspense_rows??[],selectedDossier),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:withDossierFilter(d?.supplier_rows??[],selectedDossier),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:withDossierFilter(d?.customer_rows??[],selectedDossier),onRowClick:openDrill})})]})]}),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"},{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"},{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"},{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 DOSSIER_COLS=[{key:"source",label:"Source"},{key:"dossier",label:"Dossier"},{key:"status",label:"Statut"},{key:"solde_attente_eur",label:"Solde attente (€)",numeric:true},{key:"total_fournisseurs_eur",label:"Total fourn. (€)",numeric:true},{key:"total_clients_eur",label:"Total clients (€)",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"},{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"},{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"},{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 +1 @@
1
- "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["8692"],{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}},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 react__WEBPACK_IMPORTED_MODULE_2__=__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_2__.useState)(()=>Date.now());(0,react__WEBPACK_IMPORTED_MODULE_2__.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__.ActionIcon,{variant:"subtle",color:"gray",onClick:onRefresh,disabled:!onRefresh,"aria-label":"Refresh",style:{width:"auto",paddingInline:8},children:/*#__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})}),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"})})}},1996:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Github});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var index_mjs_=__webpack_require__(207);var githubQuery=__webpack_require__(3139);var IconGithub=__webpack_require__(5068);var dist_index_js_=__webpack_require__(1380);var PageHeader=__webpack_require__(1354);function GithubApp(){const dashboardResult=(0,githubQuery.V)();const dashboard=dashboardResult.data;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:"Runners GitHub",updatedAt:dashboardResult.dataUpdatedAt,isFetching:dashboardResult.isFetching,isError:dashboardResult.isError,onRefresh:()=>dashboardResult.refetch()}),dashboard?/*#__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:"Repository"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Tag"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Self-hosted"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Runners"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:dashboard.list.map((line,i)=>{const{repo,selfhost,runner_tag,runners}=line;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)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:`https://github.com/airporting/${repo}`,children:[repo,"\xa0",/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:runner_tag}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:selfhost?/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconCheck,{size:30,color:"green"}):/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconCross,{size:30,color:"red"})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:runners.map((runnerItem,j)=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"blue",m:5,children:runnerItem},j))})]},i)})})]})}):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"Chargement…"})]})}var providers=__webpack_require__(7034);function Github(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)(GithubApp,{})})})}}}]);
1
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["8692"],{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}},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"})})}},1996:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Github});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var index_mjs_=__webpack_require__(207);var githubQuery=__webpack_require__(3139);var IconGithub=__webpack_require__(5068);var dist_index_js_=__webpack_require__(1380);var PageHeader=__webpack_require__(1354);function GithubApp(){const dashboardResult=(0,githubQuery.V)();const dashboard=dashboardResult.data;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:"Runners GitHub",updatedAt:dashboardResult.dataUpdatedAt,isFetching:dashboardResult.isFetching,isError:dashboardResult.isError,onRefresh:()=>dashboardResult.refetch()}),dashboard?/*#__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:"Repository"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Tag"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Self-hosted"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Runners"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:dashboard.list.map((line,i)=>{const{repo,selfhost,runner_tag,runners}=line;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)(dist_index_js_.AirButton,{variant:"subtle",color:"gray",href:`https://github.com/airporting/${repo}`,children:[repo,"\xa0",/*#__PURE__*/(0,jsx_runtime.jsx)(IconGithub.U,{size:20})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:runner_tag}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:selfhost?/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconCheck,{size:30,color:"green"}):/*#__PURE__*/(0,jsx_runtime.jsx)(dist_index_js_.IconCross,{size:30,color:"red"})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:runners.map((runnerItem,j)=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:"blue",m:5,children:runnerItem},j))})]},i)})})]})}):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{children:"Chargement…"})]})}var providers=__webpack_require__(7034);function Github(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)(GithubApp,{})})})}}}]);
@@ -1 +1 @@
1
- "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["1744"],{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 react__WEBPACK_IMPORTED_MODULE_2__=__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_2__.useState)(()=>Date.now());(0,react__WEBPACK_IMPORTED_MODULE_2__.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__.ActionIcon,{variant:"subtle",color:"gray",onClick:onRefresh,disabled:!onRefresh,"aria-label":"Refresh",style:{width:"auto",paddingInline:8},children:/*#__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})}),actions]})]})}},316:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Sobank});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var esm_index_mjs_=__webpack_require__(9038);var tabler_icons_react_mjs_=__webpack_require__(9632);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useSobankExports(params){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","sobank","exports",params],queryFn:async()=>await api.sobank.getExportsV1(params).then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true})}var date_fns_index_js_=__webpack_require__(4365);var PageHeader=__webpack_require__(1354);function SobankApp(){const[dateRange,setDateRange]=(0,index_js_.useState)([null,null]);const[bank,setBank]=(0,index_js_.useState)("");const[currency,setCurrency]=(0,index_js_.useState)("");const[iban,setIban]=(0,index_js_.useState)("");const exportsResult=useSobankExports({...dateRange[0]&&{balanceDateAfter:new Date(dateRange[0]).toISOString()},...dateRange[1]&&{balanceDateBefore:new Date(dateRange[1]).toISOString()},...bank&&{bank},...currency&&{currency},...iban&&{iban}});const rows=exportsResult.data?.exports??[];return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:"Exports Sobank",updatedAt:exportsResult.dataUpdatedAt,isFetching:exportsResult.isFetching,isError:exportsResult.isError,onRefresh:()=>exportsResult.refetch()}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Stack,{gap:"sm",my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{align:"flex-end",wrap:"wrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.DatePickerInput,{leftSection:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconCalendar,{size:18}),type:"range",label:"P\xe9riode de solde",placeholder:"S\xe9lectionner une plage",value:dateRange,onChange:setDateRange,clearable:true,allowSingleDateInRange:true,w:260}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Banque",placeholder:"Filtrer par banque",value:bank,onChange:e=>setBank(e.currentTarget.value),w:160}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Devise",placeholder:"EUR, USD...",value:currency,onChange:e=>setCurrency(e.currentTarget.value),w:120}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"IBAN",placeholder:"Filtrer par IBAN",value:iban,onChange:e=>setIban(e.currentTarget.value),w:240})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{stickyHeader:true,striped:true,highlightOnHover:true,withTableBorder:true,withColumnBorders: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:"ID"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"IBAN"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Banque"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Compte"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Devise"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Solde"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Date solde"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Solde pr\xe9c\xe9dent"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Date pr\xe9c\xe9dente"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Cr\xe9\xe9 le"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:rows.map(row=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:row.id}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:row.iban??"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:row.bank}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:row.account}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:row.currency}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:String(row.balance)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:(0,date_fns_index_js_.format)(row.balance_date,"dd/MM/yyyy HH:mm")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:String(row.previous_balance)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:(0,date_fns_index_js_.format)(row.previous_date,"dd/MM/yyyy HH:mm")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:(0,date_fns_index_js_.format)(row.created,"dd/MM/yyyy HH:mm")})]},row.id))})]})]})}function Sobank(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)(SobankApp,{})})})}}}]);
1
+ "use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["1744"],{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]})]})}},316:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Sobank});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var esm_index_mjs_=__webpack_require__(9038);var tabler_icons_react_mjs_=__webpack_require__(9632);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useSobankExports(params){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","sobank","exports",params],queryFn:async()=>await api.sobank.getExportsV1(params).then(x=>x.data),refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true})}var date_fns_index_js_=__webpack_require__(4365);var PageHeader=__webpack_require__(1354);function SobankApp(){const[dateRange,setDateRange]=(0,index_js_.useState)([null,null]);const[bank,setBank]=(0,index_js_.useState)("");const[currency,setCurrency]=(0,index_js_.useState)("");const[iban,setIban]=(0,index_js_.useState)("");const exportsResult=useSobankExports({...dateRange[0]&&{balanceDateAfter:new Date(dateRange[0]).toISOString()},...dateRange[1]&&{balanceDateBefore:new Date(dateRange[1]).toISOString()},...bank&&{bank},...currency&&{currency},...iban&&{iban}});const rows=exportsResult.data?.exports??[];return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:"Exports Sobank",updatedAt:exportsResult.dataUpdatedAt,isFetching:exportsResult.isFetching,isError:exportsResult.isError,onRefresh:()=>exportsResult.refetch()}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Stack,{gap:"sm",my:"md",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{align:"flex-end",wrap:"wrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(esm_index_mjs_.DatePickerInput,{leftSection:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconCalendar,{size:18}),type:"range",label:"P\xe9riode de solde",placeholder:"S\xe9lectionner une plage",value:dateRange,onChange:setDateRange,clearable:true,allowSingleDateInRange:true,w:260}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Banque",placeholder:"Filtrer par banque",value:bank,onChange:e=>setBank(e.currentTarget.value),w:160}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Devise",placeholder:"EUR, USD...",value:currency,onChange:e=>setCurrency(e.currentTarget.value),w:120}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"IBAN",placeholder:"Filtrer par IBAN",value:iban,onChange:e=>setIban(e.currentTarget.value),w:240})]})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{stickyHeader:true,striped:true,highlightOnHover:true,withTableBorder:true,withColumnBorders: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:"ID"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"IBAN"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Banque"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Compte"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Devise"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Solde"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Date solde"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Solde pr\xe9c\xe9dent"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Date pr\xe9c\xe9dente"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Cr\xe9\xe9 le"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:rows.map(row=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:row.id}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:row.iban??"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:row.bank}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:row.account}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:row.currency}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:String(row.balance)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:(0,date_fns_index_js_.format)(row.balance_date,"dd/MM/yyyy HH:mm")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:String(row.previous_balance)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:(0,date_fns_index_js_.format)(row.previous_date,"dd/MM/yyyy HH:mm")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:(0,date_fns_index_js_.format)(row.created,"dd/MM/yyyy HH:mm")})]},row.id))})]})]})}function Sobank(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)(SobankApp,{})})})}}}]);