@airporting/tech-app 0.0.65 → 0.0.67
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/@mf-types/compiled-types/apps/sales/LeadsTable.d.ts +2 -1
- package/dist/mf/@mf-types/compiled-types/apps/scrapers/ScraperCard.d.ts +6 -1
- package/dist/mf/@mf-types/compiled-types/apps/scrapers/SobankDrawer.d.ts +8 -0
- package/dist/mf/@mf-types/compiled-types/apps/scrapers/types.d.ts +2 -2
- package/dist/mf/@mf-types/compiled-types/components/CompanyLogo.d.ts +8 -0
- package/dist/mf/@mf-types/compiled-types/gen/TechApi/index.d.ts +30 -0
- package/dist/mf/@mf-types.d.ts +2 -2
- package/dist/mf/@mf-types.zip +0 -0
- package/dist/mf/__federation_expose_etat_saisie.js +1 -1
- package/dist/mf/__federation_expose_sales.js +1 -1
- package/dist/mf/__federation_expose_scrapers.js +1 -1
- package/dist/mf/index.js +3 -3
- package/dist/mf/mf-manifest.json +1 -35
- package/dist/mf/mf-stats.json +13 -56
- package/dist/mf/tech_app.js +3 -3
- package/package.json +1 -1
- package/dist/mf/@mf-types/compiled-types/api/tech/sobank/exportsQuery.d.ts +0 -2
- package/dist/mf/@mf-types/compiled-types/apps/sobank.app.d.ts +0 -1
- package/dist/mf/@mf-types/compiled-types/tabs/sobank.d.ts +0 -2
- package/dist/mf/@mf-types/sobank.d.ts +0 -2
- package/dist/mf/__federation_expose_sobank.js +0 -1
|
@@ -2,7 +2,8 @@ import { LeadListItem, Temperature } from '@/src/apps/sales/types.ts';
|
|
|
2
2
|
type Props = {
|
|
3
3
|
leads: LeadListItem[];
|
|
4
4
|
temperatureFilter: Temperature | null;
|
|
5
|
+
search: string;
|
|
5
6
|
onRowClick: (id: number) => void;
|
|
6
7
|
};
|
|
7
|
-
export declare function LeadsTable({ leads, temperatureFilter, onRowClick }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function LeadsTable({ leads, temperatureFilter, search, onRowClick, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ScraperItem, ScraperPennylane } from './types.ts';
|
|
1
|
+
import type { ScraperItem, ScraperPennylane, SobankSummary } from './types.ts';
|
|
2
2
|
type ScraperCardProps = {
|
|
3
3
|
scraper: ScraperItem;
|
|
4
4
|
onClick: () => void;
|
|
@@ -8,4 +8,9 @@ type PennylaneCardProps = {
|
|
|
8
8
|
pennylane: ScraperPennylane;
|
|
9
9
|
};
|
|
10
10
|
export declare function PennylaneCard({ pennylane }: PennylaneCardProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
type SobankCardProps = {
|
|
12
|
+
sobank: SobankSummary;
|
|
13
|
+
onClick: () => void;
|
|
14
|
+
};
|
|
15
|
+
export declare function SobankCard({ sobank, onClick }: SobankCardProps): import("react/jsx-runtime").JSX.Element;
|
|
11
16
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SobankSummary } from './types.ts';
|
|
2
|
+
type Props = {
|
|
3
|
+
sobank: SobankSummary;
|
|
4
|
+
opened: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function SobankDrawer({ sobank, opened, onClose }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ScraperConnectorItem, ScraperItem, ScraperPennylane } from '@/src/gen/TechApi/index.ts';
|
|
2
|
-
export type { ScraperConnectorItem, ScraperItem, ScraperPennylane };
|
|
1
|
+
import type { ScraperConnectorItem, ScraperItem, ScraperPennylane, SobankAccountItem, SobankSummary } from '@/src/gen/TechApi/index.ts';
|
|
2
|
+
export type { ScraperConnectorItem, ScraperItem, ScraperPennylane, SobankAccountItem, SobankSummary, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ImageProps } from '@mantine/core';
|
|
2
|
+
type CompanyLogoProps = Partial<ImageProps> & {
|
|
3
|
+
slug?: string | null;
|
|
4
|
+
updatedAt?: string | null;
|
|
5
|
+
size?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function CompanyLogo({ slug, updatedAt, size, ...rest }: CompanyLogoProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -62,9 +62,12 @@ export interface EtatSaisieDossierLine {
|
|
|
62
62
|
fiscal_year_end: string | null;
|
|
63
63
|
gla_active: boolean;
|
|
64
64
|
last_entry_date: string | null;
|
|
65
|
+
last_reconciliation_date: string | null;
|
|
66
|
+
logo_updated_at: string | null;
|
|
65
67
|
managed: boolean;
|
|
66
68
|
reason: string | null;
|
|
67
69
|
responsable: ResponsableOption | null;
|
|
70
|
+
slug: string | null;
|
|
68
71
|
solde_attente_eur: number;
|
|
69
72
|
solde_virements_eur: number;
|
|
70
73
|
source: string;
|
|
@@ -72,6 +75,14 @@ export interface EtatSaisieDossierLine {
|
|
|
72
75
|
total_clients_eur: number;
|
|
73
76
|
total_fournisseurs_eur: number;
|
|
74
77
|
}
|
|
78
|
+
export interface EtatSaisieReconciliationRow {
|
|
79
|
+
source: string;
|
|
80
|
+
dossier: string;
|
|
81
|
+
managed: boolean;
|
|
82
|
+
bank_label: string | null;
|
|
83
|
+
establishment_id: number | null;
|
|
84
|
+
last_reconciled_period_end: string | null;
|
|
85
|
+
}
|
|
75
86
|
export interface EtatSaisieDossierMapItem {
|
|
76
87
|
airporting_id: number;
|
|
77
88
|
display_name: string;
|
|
@@ -246,6 +257,7 @@ export interface GetEtatSaisieLatestResponse {
|
|
|
246
257
|
customer_rows: EtatSaisieCustomerRow[];
|
|
247
258
|
dossier_lines: EtatSaisieDossierLine[];
|
|
248
259
|
internal_transfer_rows: EtatSaisieSuspenseRow[];
|
|
260
|
+
reconciliation_rows: EtatSaisieReconciliationRow[];
|
|
249
261
|
scan_duration_seconds: number | null;
|
|
250
262
|
status: string | null;
|
|
251
263
|
summary: EtatSaisieSummary | null;
|
|
@@ -364,6 +376,7 @@ export interface GetSalesLeadsResponse {
|
|
|
364
376
|
export interface GetScrapersResponse {
|
|
365
377
|
pennylane: ScraperPennylane;
|
|
366
378
|
scrapers: ScraperItem[];
|
|
379
|
+
sobank: SobankSummary;
|
|
367
380
|
}
|
|
368
381
|
export interface GetSynchroDashboardResponse {
|
|
369
382
|
askedToday: number;
|
|
@@ -540,6 +553,8 @@ export interface SalesLeadListItem {
|
|
|
540
553
|
}
|
|
541
554
|
export interface ScraperConnectorItem {
|
|
542
555
|
client: string | null;
|
|
556
|
+
companyLogoUpdatedAt: string | null;
|
|
557
|
+
companySlug: string | null;
|
|
543
558
|
connector: string;
|
|
544
559
|
isTooOld: boolean;
|
|
545
560
|
lastDataDate: string | null;
|
|
@@ -583,6 +598,21 @@ export interface SetResponsableBody {
|
|
|
583
598
|
export interface SetResponsableV1Params {
|
|
584
599
|
id: number;
|
|
585
600
|
}
|
|
601
|
+
export interface SobankAccountItem {
|
|
602
|
+
account: string;
|
|
603
|
+
balance: number;
|
|
604
|
+
balanceDate: string;
|
|
605
|
+
bank: string;
|
|
606
|
+
currency: string | null;
|
|
607
|
+
iban: string | null;
|
|
608
|
+
isTooOld: boolean;
|
|
609
|
+
}
|
|
610
|
+
export interface SobankSummary {
|
|
611
|
+
accounts: SobankAccountItem[];
|
|
612
|
+
count: number;
|
|
613
|
+
isTooOld: boolean;
|
|
614
|
+
lastDataDate: string | null;
|
|
615
|
+
}
|
|
586
616
|
export interface SobankExportItem {
|
|
587
617
|
account: string;
|
|
588
618
|
balance: number;
|
package/dist/mf/@mf-types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
export type RemoteKeys = 'REMOTE_ALIAS_IDENTIFIER/amex' | 'REMOTE_ALIAS_IDENTIFIER/bnpp' | 'REMOTE_ALIAS_IDENTIFIER/credmut' | 'REMOTE_ALIAS_IDENTIFIER/dashboard' | 'REMOTE_ALIAS_IDENTIFIER/etat-saisie' | 'REMOTE_ALIAS_IDENTIFIER/finance-jobs' | 'REMOTE_ALIAS_IDENTIFIER/github' | 'REMOTE_ALIAS_IDENTIFIER/payfit' | 'REMOTE_ALIAS_IDENTIFIER/sales' | 'REMOTE_ALIAS_IDENTIFIER/scrapers' | 'REMOTE_ALIAS_IDENTIFIER/
|
|
3
|
-
type PackageType<T> = T extends 'REMOTE_ALIAS_IDENTIFIER/wise' ? typeof import('REMOTE_ALIAS_IDENTIFIER/wise') :T extends 'REMOTE_ALIAS_IDENTIFIER/synchro' ? typeof import('REMOTE_ALIAS_IDENTIFIER/synchro') :T extends 'REMOTE_ALIAS_IDENTIFIER/spreadsheet' ? typeof import('REMOTE_ALIAS_IDENTIFIER/spreadsheet') :T extends 'REMOTE_ALIAS_IDENTIFIER/spendesk' ? typeof import('REMOTE_ALIAS_IDENTIFIER/spendesk') :T extends 'REMOTE_ALIAS_IDENTIFIER/
|
|
2
|
+
export type RemoteKeys = 'REMOTE_ALIAS_IDENTIFIER/amex' | 'REMOTE_ALIAS_IDENTIFIER/bnpp' | 'REMOTE_ALIAS_IDENTIFIER/credmut' | 'REMOTE_ALIAS_IDENTIFIER/dashboard' | 'REMOTE_ALIAS_IDENTIFIER/etat-saisie' | 'REMOTE_ALIAS_IDENTIFIER/finance-jobs' | 'REMOTE_ALIAS_IDENTIFIER/github' | 'REMOTE_ALIAS_IDENTIFIER/payfit' | 'REMOTE_ALIAS_IDENTIFIER/sales' | 'REMOTE_ALIAS_IDENTIFIER/scrapers' | 'REMOTE_ALIAS_IDENTIFIER/spendesk' | 'REMOTE_ALIAS_IDENTIFIER/spreadsheet' | 'REMOTE_ALIAS_IDENTIFIER/synchro' | 'REMOTE_ALIAS_IDENTIFIER/wise';
|
|
3
|
+
type PackageType<T> = T extends 'REMOTE_ALIAS_IDENTIFIER/wise' ? typeof import('REMOTE_ALIAS_IDENTIFIER/wise') :T extends 'REMOTE_ALIAS_IDENTIFIER/synchro' ? typeof import('REMOTE_ALIAS_IDENTIFIER/synchro') :T extends 'REMOTE_ALIAS_IDENTIFIER/spreadsheet' ? typeof import('REMOTE_ALIAS_IDENTIFIER/spreadsheet') :T extends 'REMOTE_ALIAS_IDENTIFIER/spendesk' ? typeof import('REMOTE_ALIAS_IDENTIFIER/spendesk') :T extends 'REMOTE_ALIAS_IDENTIFIER/scrapers' ? typeof import('REMOTE_ALIAS_IDENTIFIER/scrapers') :T extends 'REMOTE_ALIAS_IDENTIFIER/sales' ? typeof import('REMOTE_ALIAS_IDENTIFIER/sales') :T extends 'REMOTE_ALIAS_IDENTIFIER/payfit' ? typeof import('REMOTE_ALIAS_IDENTIFIER/payfit') :T extends 'REMOTE_ALIAS_IDENTIFIER/github' ? typeof import('REMOTE_ALIAS_IDENTIFIER/github') :T extends 'REMOTE_ALIAS_IDENTIFIER/finance-jobs' ? typeof import('REMOTE_ALIAS_IDENTIFIER/finance-jobs') :T extends 'REMOTE_ALIAS_IDENTIFIER/etat-saisie' ? typeof import('REMOTE_ALIAS_IDENTIFIER/etat-saisie') :T extends 'REMOTE_ALIAS_IDENTIFIER/dashboard' ? typeof import('REMOTE_ALIAS_IDENTIFIER/dashboard') :T extends 'REMOTE_ALIAS_IDENTIFIER/credmut' ? typeof import('REMOTE_ALIAS_IDENTIFIER/credmut') :T extends 'REMOTE_ALIAS_IDENTIFIER/bnpp' ? typeof import('REMOTE_ALIAS_IDENTIFIER/bnpp') :T extends 'REMOTE_ALIAS_IDENTIFIER/amex' ? typeof import('REMOTE_ALIAS_IDENTIFIER/amex') :any;
|
package/dist/mf/@mf-types.zip
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["7915"],{1354:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{m:()=>PageHeader});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var _tabler_icons_react__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(9632);var react__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(3106);function formatRelative(now,then){const seconds=Math.max(0,Math.floor((now-then)/1e3));if(seconds<5)return"\xe0 l’instant";if(seconds<60)return`il y a ${seconds}s`;const minutes=Math.floor(seconds/60);if(minutes<60)return`il y a ${minutes} min`;const hours=Math.floor(minutes/60);return`il y a ${hours} h`}function PageHeader({title,leading,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:[leading,/*#__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]})]})}},243:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{j:()=>logoDevUrl});const LOGO_DEV_TOKEN="pk_BVN4OQv0Qs-bnqjdIgTppg";function logoDevUrl(domain){return`https://img.logo.dev/${domain}?token=${LOGO_DEV_TOKEN}`}},8881:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>EtatSaisie});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useEtatSaisieLatest(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","etat-saisie","latest"],queryFn:async()=>(await api.etatSaisie.getLatestV1()).data,refetchOnWindowFocus:true})}function useEtatSaisieRecompute(){const api=(0,useApi.h)();const qc=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async()=>(await api.etatSaisie.recomputeV1()).data,onSuccess:()=>qc.invalidateQueries({queryKey:["tech","etat-saisie","latest"]})})}function DetailTable(props){const{columns,rows,onRowClick}=props;const[sortKey,setSortKey]=(0,index_js_.useState)(null);const[asc,setAsc]=(0,index_js_.useState)(false);const sorted=[...rows].sort((a,b)=>{if(!sortKey)return 0;const av=a[sortKey];const bv=b[sortKey];if("number"==typeof av&&"number"==typeof bv)return asc?av-bv:bv-av;return asc?String(av).localeCompare(String(bv)):String(bv).localeCompare(String(av))});const toggle=k=>{if(sortKey===k)setAsc(v=>!v);else{setSortKey(k);setAsc(false)}};const fmt=(v,numeric)=>{if(numeric&&"number"==typeof v)return v.toLocaleString("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2});if("boolean"==typeof v)return v?"✓":"";if(null==v)return"—";if("object"==typeof v)return"—";return String(v)};return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{striped:true,highlightOnHover:true,withTableBorder:true,stickyHeader:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:columns.map(c=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Th,{onClick:()=>toggle(c.key),style:{cursor:"pointer"},children:[c.label,sortKey===c.key?asc?" ▲":" ▼":""]},c.key))})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:0===sorted.length?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{colSpan:columns.length,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",ta:"center",children:"Aucune ligne"})})}):sorted.map((row,i)=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{onClick:onRowClick?()=>onRowClick(row):void 0,style:onRowClick?{cursor:"pointer"}:void 0,children:columns.map(c=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{style:c.numeric?{textAlign:"right",fontVariantNumeric:"tabular-nums"}:void 0,children:c.render?c.render(row):fmt(row[c.key],c.numeric)},c.key))},i))})]})}function useDossiers(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","etat-saisie","dossiers"],queryFn:async()=>(await api.etatSaisie.getDossiersV1()).data,refetchOnWindowFocus:true})}function useSetManaged(){const api=(0,useApi.h)();const qc=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async variables=>(await api.etatSaisie.setManagedV1({id:variables.id},{managed:variables.managed})).data,onSuccess:()=>{qc.invalidateQueries({queryKey:["tech","etat-saisie","dossiers"]});qc.invalidateQueries({queryKey:["tech","etat-saisie","latest"]})}})}function useSetResponsable(){const api=(0,useApi.h)();const qc=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async variables=>(await api.etatSaisie.setResponsableV1({id:variables.id},{notion_user_id:variables.notionUserId})).data,onSuccess:()=>{qc.invalidateQueries({queryKey:["tech","etat-saisie","dossiers"]})}})}var logoDev=__webpack_require__(243);const PROVIDER_DOMAIN={pennylane:"pennylane.com",zohobooks:"zoho.com",xero:"xero.com",odoo:"odoo.com"};function QuickBooksIcon(props){const{size}=props;return/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{width:size,height:size,viewBox:"0 0 24 24",role:"img","aria-label":"QuickBooks",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("title",{children:"QuickBooks"}),/*#__PURE__*/(0,jsx_runtime.jsx)("circle",{cx:"12",cy:"12",r:"12",fill:"#2CA01C"}),/*#__PURE__*/(0,jsx_runtime.jsx)("text",{x:"12",y:"16.5",textAnchor:"middle",fontSize:"12",fontWeight:"700",fill:"#ffffff",fontFamily:"Arial, Helvetica, sans-serif",children:"qb"})]})}function ProviderIcon(props){const{provider}=props;if(!provider)return null;if("quickbooks"===provider)return/*#__PURE__*/(0,jsx_runtime.jsx)(QuickBooksIcon,{size:20});const domain=PROVIDER_DOMAIN[provider];if(!domain)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"sm",variant:"light",color:"gray",title:provider,children:provider.slice(0,2).toUpperCase()});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Image,{src:(0,logoDev.j)(domain),alt:provider,title:provider,w:20,h:20,fit:"contain",radius:"sm",style:{aspectRatio:1}})}function DossiersTab(){const dossiers=useDossiers();const setManaged=useSetManaged();const setResponsable=useSetResponsable();const[filter,setFilter]=(0,index_js_.useState)("");const options=dossiers.data?.responsable_options??[];const optionData=options.map(u=>({value:String(u.id),label:u.name}));const rows=(0,index_js_.useMemo)(()=>{const all=dossiers.data?.dossiers??[];const needle=filter.trim().toLowerCase();const filtered=needle?all.filter(dossier=>dossier.display_name.toLowerCase().includes(needle)||dossier.slug.toLowerCase().includes(needle)):all;return[...filtered].sort((a,b)=>a.display_name.localeCompare(b.display_name))},[dossiers.data,filter]);if(dossiers.isError)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"red",mt:"md",children:"Erreur de chargement des dossiers."});return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{mb:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{placeholder:"Filtrer par nom ou slug",value:filter,onChange:event=>setFilter(event.currentTarget.value),w:320})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{striped:true,highlightOnHover:true,withTableBorder:true,stickyHeader:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Source"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Dossier"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"G\xe9r\xe9"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Responsable"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:0===rows.length?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{colSpan:4,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",ta:"center",children:"Aucun dossier"})})}):rows.map(dossier=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:dossier.provider})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:dossier.display_name}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Switch,{checked:dossier.managed,onChange:event=>setManaged.mutate({id:dossier.airporting_id,managed:event.currentTarget.checked})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{placeholder:"—",data:optionData,value:dossier.responsable?String(dossier.responsable.id):null,onChange:v=>setResponsable.mutate({id:dossier.airporting_id,notionUserId:v?Number(v):null}),searchable:true,clearable:true,w:220,leftSection:dossier.responsable?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Avatar,{src:dossier.responsable.avatar_url,size:20,radius:"xl"}):void 0})})]},`${dossier.airporting_id}:${dossier.provider}`))})]})]})}function ManagedBadge(props){const{managed}=props;if(!managed)return null;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Image,{src:(0,logoDev.j)("airporting.com"),alt:"G\xe9r\xe9 par Airporting",title:"G\xe9r\xe9 par Airporting",w:18,h:18,fit:"contain",radius:"sm",style:{aspectRatio:1}})}var PageHeader=__webpack_require__(1354);const STALE_THRESHOLD_DAYS=30;function staleBadge(isoDate){if(!isoDate)return null;const days=Math.floor((Date.now()-new Date(isoDate).getTime())/864e5);if(days<STALE_THRESHOLD_DAYS)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{ml:6,size:"xs",color:"red",variant:"light",children:["+",days,"j"]})}function withDossierFilter(rows,dossier){if(!dossier)return rows;return rows.filter(r=>r.dossier===dossier)}function withManagedFilter(rows,managedOnly){if(!managedOnly)return rows;return rows.filter(r=>true===r.managed)}function withCategoryFilter(rows,category){if("all"===category)return rows;return rows.filter(r=>r.category===category)}function etatBadge(row){if("error"===row.status)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"red",variant:"light",children:"Erreur"});if("too_large"===row.status)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"orange",variant:"light",children:"Trop volumineux"});if("anomalie"===row.category)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"orange",variant:"light",children:"Anomalie"});if("stale"===row.reason)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"yellow",variant:"light",children:"P\xe9rim\xe9"});if("empty"===row.reason)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"gray",variant:"light",children:"Vide"});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"green",variant:"light",children:"Propre"})}function EtatSaisieApp(){const latest=useEtatSaisieLatest();const recompute=useEtatSaisieRecompute();const[tab,setTab]=(0,index_js_.useState)("resume");const[selectedDossier,setSelectedDossier]=(0,index_js_.useState)(null);const[managedOnly,setManagedOnly]=(0,index_js_.useState)(true);const[statusFilter,setStatusFilter]=(0,index_js_.useState)("all");const[drillDossier,setDrillDossier]=(0,index_js_.useState)(null);const d=latest.data;const allDossiers=(0,index_js_.useMemo)(()=>{if(!d?.available)return[];const set=new Set;for(const r of d.suspense_rows??[])set.add(r.dossier);for(const r of d.supplier_rows??[])set.add(r.dossier);for(const r of d.customer_rows??[])set.add(r.dossier);for(const r of d.dossier_lines??[])set.add(r.dossier);for(const r of d.summary?.top_5_suspense??[])set.add(r.dossier);for(const r of d.summary?.top_5_supplier_debtors??[])set.add(r.dossier);for(const r of d.summary?.top_5_customer_creditors??[])set.add(r.dossier);return[...set].sort()},[d]);const openDrill=row=>setDrillDossier(row.dossier);const drillData=(0,index_js_.useMemo)(()=>{if(!drillDossier||!d?.available)return null;return{suspense:(d.suspense_rows??[]).filter(r=>r.dossier===drillDossier),supplier:(d.supplier_rows??[]).filter(r=>r.dossier===drillDossier),customer:(d.customer_rows??[]).filter(r=>r.dossier===drillDossier)}},[drillDossier,d]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{fluid:true,my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:"\xc9tat saisie",updatedAt:d?.computed_at?new Date(d.computed_at).getTime():latest.dataUpdatedAt,isFetching:latest.isFetching,isError:latest.isError,onRefresh:()=>latest.refetch(),actions:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{loading:recompute.isPending,onClick:()=>recompute.mutate(),variant:"light",children:"Recalculer"})}),d&&!d.available?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Aucun snapshot disponible — lancez \xab Recalculer \xbb ou attendez le run nocturne."}):/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{mb:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"Focus dossier",placeholder:"Tous les dossiers",data:allDossiers.map(dos=>({value:dos,label:dos})),value:selectedDossier,onChange:setSelectedDossier,searchable:true,clearable:true,w:320}),selectedDossier&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"subtle",onClick:()=>setSelectedDossier(null),mt:22,children:"R\xe9initialiser"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{mt:22,value:managedOnly?"managed":"all",onChange:v=>setManagedOnly("managed"===v),data:[{label:"G\xe9r\xe9s",value:"managed"},{label:"Tous",value:"all"}]})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs,{value:tab,onChange:setTab,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs.List,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"resume",children:"R\xe9sum\xe9"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"top5",children:"Top 5"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s471",children:"D\xe9tail 471"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s58",children:"Virements internes (58)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s401",children:"Fournisseurs d\xe9biteurs (401)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s411",children:"Clients cr\xe9diteurs (411)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"dossiers",children:"Dossiers"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs.Panel,{value:"resume",pt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:4,mb:"md",children:[{key:"all",label:"Scann\xe9s",value:d?.summary?.companies_scanned??0,color:void 0},{key:"propre",label:"Propres",value:d?.summary?.companies_clean??0,color:"green"},{key:"anomalie",label:"En anomalie",value:d?.summary?.companies_with_anomalies??0,color:"orange"},{key:"erreur",label:"En erreur",value:d?.summary?.companies_in_error??0,color:"red"}].map(tile=>{const active=statusFilter===tile.key;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:active,style:{cursor:"pointer",borderColor:active?"var(--mantine-color-blue-5)":void 0},onClick:()=>setStatusFilter(tile.key),children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:tile.label}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",c:tile.color,children:tile.value})]},tile.key)})}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:UNIFIED_COLS,rows:withCategoryFilter(withManagedFilter(withDossierFilter(d?.dossier_lines??[],selectedDossier),managedOnly),statusFilter),onRowClick:openDrill})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs.Panel,{value:"top5",pt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 comptes d'attente (471)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_SUSPENSE_COLS,rows:withDossierFilter(d?.summary?.top_5_suspense??[],selectedDossier),onRowClick:openDrill}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 fournisseurs d\xe9biteurs (401)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_SUPPLIER_COLS,rows:withDossierFilter(d?.summary?.top_5_supplier_debtors??[],selectedDossier),onRowClick:openDrill}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 clients cr\xe9diteurs (411)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_CUSTOMER_COLS,rows:withDossierFilter(d?.summary?.top_5_customer_creditors??[],selectedDossier),onRowClick:openDrill})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s471",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUSPENSE_COLS,rows:withManagedFilter(withDossierFilter(d?.suspense_rows??[],selectedDossier),managedOnly),onRowClick:openDrill})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s58",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUSPENSE_COLS,rows:withManagedFilter(withDossierFilter(d?.internal_transfer_rows??[],selectedDossier),managedOnly),onRowClick:openDrill})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s401",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUPPLIER_COLS,rows:withManagedFilter(withDossierFilter(d?.supplier_rows??[],selectedDossier),managedOnly),onRowClick:openDrill})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s411",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:CUSTOMER_COLS,rows:withManagedFilter(withDossierFilter(d?.customer_rows??[],selectedDossier),managedOnly),onRowClick:openDrill})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"dossiers",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DossiersTab,{})})]})]}),latest.isError?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"red",mt:"md",children:"Erreur de chargement."}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Drawer,{opened:!!drillDossier,onClose:()=>setDrillDossier(null),position:"right",size:"xl",title:drillDossier?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:["Dossier ",drillDossier]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:"light",onClick:()=>{setSelectedDossier(drillDossier);setDrillDossier(null)},children:"Focus sur ce dossier"})]}):null,children:drillData&&/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:5,mb:6,children:["Comptes d'attente 471 (",drillData.suspense.length,")"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DRILL_SUSPENSE_COLS,rows:drillData.suspense})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:5,mb:6,children:["Fournisseurs d\xe9biteurs 401 (",drillData.supplier.length,")"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DRILL_SUPPLIER_COLS,rows:drillData.supplier})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:5,mb:6,children:["Clients cr\xe9diteurs 411 (",drillData.customer.length,")"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DRILL_CUSTOMER_COLS,rows:drillData.customer})]})]})})]})}const TOP_SUSPENSE_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"G\xe9r\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"solde_eur",label:"Solde 471 (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr.",numeric:true},{key:"top_libelle",label:"Top \xe9criture"},{key:"top_montant",label:"Montant",numeric:true}];const TOP_SUPPLIER_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"total_eur",label:"Total d\xe9biteur (€)",numeric:true},{key:"nb_fournisseurs",label:"Nb fourn.",numeric:true},{key:"top_nom",label:"Top fournisseur"},{key:"top_montant",label:"Montant",numeric:true}];const TOP_CUSTOMER_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"total_eur",label:"Total cr\xe9diteur (€)",numeric:true},{key:"nb_clients",label:"Nb clients",numeric:true},{key:"top_nom",label:"Top client"},{key:"top_montant",label:"Montant",numeric:true}];const UNIFIED_COLS=[{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"status",label:"\xc9tat",render:r=>etatBadge(r)},{key:"dossier",label:"Dossier"},{key:"responsable",label:"Responsable",render:r=>r.responsable?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Avatar,{src:r.responsable.avatar_url,size:20,radius:"xl"}),/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:r.responsable.name})]}):/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:"—"})},{key:"fiscal_year_end",label:"Cl\xf4ture",render:r=>r.fiscal_year_end?/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:r.fiscal_year_end.split("-").reverse().join("/")}):/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:"—"})},{key:"solde_attente_eur",label:"Solde 471 (€)",numeric:true},{key:"solde_virements_eur",label:"Solde 58 (€)",numeric:true},{key:"total_fournisseurs_eur",label:"Fourn. d\xe9biteurs (€)",numeric:true},{key:"total_clients_eur",label:"Clients cr\xe9diteurs (€)",numeric:true},{key:"last_entry_date",label:"Derni\xe8re \xe9criture",render:row=>/*#__PURE__*/(0,jsx_runtime.jsxs)("span",{children:[row.last_entry_date??"—",staleBadge(row.last_entry_date)]})}];const SUSPENSE_COLS=[{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"date",label:"Date"},{key:"numero_compte",label:"N\xb0 Compte"},{key:"libelle_compte",label:"Libell\xe9 compte"},{key:"libelle_ecriture",label:"Libell\xe9 \xe9criture"},{key:"journal",label:"Journal"},{key:"numero_piece",label:"N\xb0 Pi\xe8ce"},{key:"debit",label:"D\xe9bit",numeric:true},{key:"credit",label:"Cr\xe9dit",numeric:true},{key:"solde_net",label:"Solde net",numeric:true},{key:"lettre",label:"Lettr\xe9"},{key:"devise",label:"Devise"}];const SUPPLIER_COLS=[{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"fournisseur",label:"Fournisseur"},{key:"solde_debiteur_eur",label:"Solde d\xe9biteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr. non lettr\xe9es",numeric:true},{key:"devise",label:"Devise"}];const CUSTOMER_COLS=[{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"client",label:"Client"},{key:"solde_crediteur_eur",label:"Solde cr\xe9diteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr. non lettr\xe9es",numeric:true},{key:"devise",label:"Devise"}];const DRILL_SUSPENSE_COLS=[{key:"date",label:"Date"},{key:"numero_compte",label:"N\xb0 Compte"},{key:"libelle_ecriture",label:"Libell\xe9"},{key:"debit",label:"D\xe9bit",numeric:true},{key:"credit",label:"Cr\xe9dit",numeric:true},{key:"solde_net",label:"Solde net",numeric:true},{key:"lettre",label:"Lettr\xe9"}];const DRILL_SUPPLIER_COLS=[{key:"fournisseur",label:"Fournisseur"},{key:"solde_debiteur_eur",label:"Solde d\xe9biteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr.",numeric:true},{key:"devise",label:"Devise"}];const DRILL_CUSTOMER_COLS=[{key:"client",label:"Client"},{key:"solde_crediteur_eur",label:"Solde cr\xe9diteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr.",numeric:true},{key:"devise",label:"Devise"}];function EtatSaisie(props){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_js_.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(providers.C,{...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)(EtatSaisieApp,{})})})}}}]);
|
|
1
|
+
"use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["7915"],{3437:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{D:()=>CompanyLogo});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);const BASE_URL="https://s3.dualstack.eu-west-3.amazonaws.com/media.airporting/companies";function CompanyLogo({slug,updatedAt,size=20,...rest}){const base=`${BASE_URL}/${slug}.png`;const url=updatedAt?`${base}?v=${new Date(updatedAt).getTime()}`:base;return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Image,{src:url,fallbackSrc:`${BASE_URL}/undefined.png`,alt:slug??"",w:size,h:size,fit:"contain",radius:"sm",style:{aspectRatio:1},...rest})}},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,leading,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:[leading,/*#__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]})]})}},243:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{j:()=>logoDevUrl});const LOGO_DEV_TOKEN="pk_BVN4OQv0Qs-bnqjdIgTppg";function logoDevUrl(domain){return`https://img.logo.dev/${domain}?token=${LOGO_DEV_TOKEN}`}},8881:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>EtatSaisie});var jsx_runtime=__webpack_require__(5893);var index_js_=__webpack_require__(3106);var providers=__webpack_require__(7034);var index_mjs_=__webpack_require__(207);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useEtatSaisieLatest(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","etat-saisie","latest"],queryFn:async()=>(await api.etatSaisie.getLatestV1()).data,refetchOnWindowFocus:true})}function useEtatSaisieRecompute(){const api=(0,useApi.h)();const qc=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async()=>(await api.etatSaisie.recomputeV1()).data,onSuccess:()=>qc.invalidateQueries({queryKey:["tech","etat-saisie","latest"]})})}function DetailTable(props){const{columns,rows,onRowClick}=props;const[sortKey,setSortKey]=(0,index_js_.useState)(null);const[asc,setAsc]=(0,index_js_.useState)(false);const sorted=[...rows].sort((a,b)=>{if(!sortKey)return 0;const av=a[sortKey];const bv=b[sortKey];if("number"==typeof av&&"number"==typeof bv)return asc?av-bv:bv-av;return asc?String(av).localeCompare(String(bv)):String(bv).localeCompare(String(av))});const toggle=k=>{if(sortKey===k)setAsc(v=>!v);else{setSortKey(k);setAsc(false)}};const fmt=(v,numeric)=>{if(numeric&&"number"==typeof v)return v.toLocaleString("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2});if("boolean"==typeof v)return v?"✓":"";if(null==v)return"—";if("object"==typeof v)return"—";return String(v)};return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{striped:true,highlightOnHover:true,withTableBorder:true,stickyHeader:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:columns.map(c=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Th,{onClick:()=>toggle(c.key),style:{cursor:"pointer"},children:[c.label,sortKey===c.key?asc?" ▲":" ▼":""]},c.key))})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:0===sorted.length?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{colSpan:columns.length,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",ta:"center",children:"Aucune ligne"})})}):sorted.map((row,i)=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{onClick:onRowClick?()=>onRowClick(row):void 0,style:onRowClick?{cursor:"pointer"}:void 0,children:columns.map(c=>/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{style:c.numeric?{textAlign:"right",fontVariantNumeric:"tabular-nums"}:void 0,children:c.render?c.render(row):fmt(row[c.key],c.numeric)},c.key))},i))})]})}function useDossiers(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","etat-saisie","dossiers"],queryFn:async()=>(await api.etatSaisie.getDossiersV1()).data,refetchOnWindowFocus:true})}function useSetManaged(){const api=(0,useApi.h)();const qc=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async variables=>(await api.etatSaisie.setManagedV1({id:variables.id},{managed:variables.managed})).data,onSuccess:()=>{qc.invalidateQueries({queryKey:["tech","etat-saisie","dossiers"]});qc.invalidateQueries({queryKey:["tech","etat-saisie","latest"]})}})}function useSetResponsable(){const api=(0,useApi.h)();const qc=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async variables=>(await api.etatSaisie.setResponsableV1({id:variables.id},{notion_user_id:variables.notionUserId})).data,onSuccess:()=>{qc.invalidateQueries({queryKey:["tech","etat-saisie","dossiers"]})}})}var logoDev=__webpack_require__(243);const PROVIDER_DOMAIN={pennylane:"pennylane.com",zohobooks:"zoho.com",xero:"xero.com",odoo:"odoo.com"};function QuickBooksIcon(props){const{size}=props;return/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{width:size,height:size,viewBox:"0 0 24 24",role:"img","aria-label":"QuickBooks",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("title",{children:"QuickBooks"}),/*#__PURE__*/(0,jsx_runtime.jsx)("circle",{cx:"12",cy:"12",r:"12",fill:"#2CA01C"}),/*#__PURE__*/(0,jsx_runtime.jsx)("text",{x:"12",y:"16.5",textAnchor:"middle",fontSize:"12",fontWeight:"700",fill:"#ffffff",fontFamily:"Arial, Helvetica, sans-serif",children:"qb"})]})}function ProviderIcon(props){const{provider}=props;if(!provider)return null;if("quickbooks"===provider)return/*#__PURE__*/(0,jsx_runtime.jsx)(QuickBooksIcon,{size:20});const domain=PROVIDER_DOMAIN[provider];if(!domain)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"sm",variant:"light",color:"gray",title:provider,children:provider.slice(0,2).toUpperCase()});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Image,{src:(0,logoDev.j)(domain),alt:provider,title:provider,w:20,h:20,fit:"contain",radius:"sm",style:{aspectRatio:1}})}function DossiersTab(){const dossiers=useDossiers();const setManaged=useSetManaged();const setResponsable=useSetResponsable();const[filter,setFilter]=(0,index_js_.useState)("");const options=dossiers.data?.responsable_options??[];const optionData=options.map(u=>({value:String(u.id),label:u.name}));const rows=(0,index_js_.useMemo)(()=>{const all=dossiers.data?.dossiers??[];const needle=filter.trim().toLowerCase();const filtered=needle?all.filter(dossier=>dossier.display_name.toLowerCase().includes(needle)||dossier.slug.toLowerCase().includes(needle)):all;return[...filtered].sort((a,b)=>a.display_name.localeCompare(b.display_name))},[dossiers.data,filter]);if(dossiers.isError)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"red",mt:"md",children:"Erreur de chargement des dossiers."});return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Group,{mb:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{placeholder:"Filtrer par nom ou slug",value:filter,onChange:event=>setFilter(event.currentTarget.value),w:320})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{striped:true,highlightOnHover:true,withTableBorder:true,stickyHeader:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Thead,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Source"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Dossier"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"G\xe9r\xe9"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Responsable"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:0===rows.length?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tr,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{colSpan:4,children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",ta:"center",children:"Aucun dossier"})})}):rows.map(dossier=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:dossier.provider})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:dossier.display_name}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Switch,{checked:dossier.managed,onChange:event=>setManaged.mutate({id:dossier.airporting_id,managed:event.currentTarget.checked})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{placeholder:"—",data:optionData,value:dossier.responsable?String(dossier.responsable.id):null,onChange:v=>setResponsable.mutate({id:dossier.airporting_id,notionUserId:v?Number(v):null}),searchable:true,clearable:true,w:220,leftSection:dossier.responsable?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Avatar,{src:dossier.responsable.avatar_url,size:20,radius:"xl"}):void 0})})]},`${dossier.airporting_id}:${dossier.provider}`))})]})]})}function ManagedBadge(props){const{managed}=props;if(!managed)return null;return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Image,{src:(0,logoDev.j)("airporting.com"),alt:"G\xe9r\xe9 par Airporting",title:"G\xe9r\xe9 par Airporting",w:18,h:18,fit:"contain",radius:"sm",style:{aspectRatio:1}})}var CompanyLogo=__webpack_require__(3437);var PageHeader=__webpack_require__(1354);const STALE_THRESHOLD_DAYS=30;function staleBadge(isoDate){if(!isoDate)return null;const days=Math.floor((Date.now()-new Date(isoDate).getTime())/864e5);if(days<STALE_THRESHOLD_DAYS)return null;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{ml:6,size:"xs",color:"red",variant:"light",children:["+",days,"j"]})}function withDossierFilter(rows,dossier){if(!dossier)return rows;return rows.filter(r=>r.dossier===dossier)}function withManagedFilter(rows,managedOnly){if(!managedOnly)return rows;return rows.filter(r=>true===r.managed)}function withCategoryFilter(rows,category){if("all"===category)return rows;return rows.filter(r=>r.category===category)}function etatBadge(row){if("error"===row.status)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"red",variant:"light",children:"Erreur"});if("too_large"===row.status)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"orange",variant:"light",children:"Trop volumineux"});if("anomalie"===row.category)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"orange",variant:"light",children:"Anomalie"});if("stale"===row.reason)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"yellow",variant:"light",children:"P\xe9rim\xe9"});if("empty"===row.reason)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"gray",variant:"light",children:"Vide"});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",color:"green",variant:"light",children:"Propre"})}function EtatSaisieApp(){const latest=useEtatSaisieLatest();const recompute=useEtatSaisieRecompute();const[tab,setTab]=(0,index_js_.useState)("resume");const[selectedDossier,setSelectedDossier]=(0,index_js_.useState)(null);const[managedOnly,setManagedOnly]=(0,index_js_.useState)(true);const[statusFilter,setStatusFilter]=(0,index_js_.useState)("all");const[drillDossier,setDrillDossier]=(0,index_js_.useState)(null);const d=latest.data;const allDossiers=(0,index_js_.useMemo)(()=>{if(!d?.available)return[];const set=new Set;for(const r of d.suspense_rows??[])set.add(r.dossier);for(const r of d.supplier_rows??[])set.add(r.dossier);for(const r of d.customer_rows??[])set.add(r.dossier);for(const r of d.dossier_lines??[])set.add(r.dossier);for(const r of d.reconciliation_rows??[])set.add(r.dossier);for(const r of d.summary?.top_5_suspense??[])set.add(r.dossier);for(const r of d.summary?.top_5_supplier_debtors??[])set.add(r.dossier);for(const r of d.summary?.top_5_customer_creditors??[])set.add(r.dossier);return[...set].sort()},[d]);const openDrill=row=>setDrillDossier(row.dossier);const drillData=(0,index_js_.useMemo)(()=>{if(!drillDossier||!d?.available)return null;return{suspense:(d.suspense_rows??[]).filter(r=>r.dossier===drillDossier),supplier:(d.supplier_rows??[]).filter(r=>r.dossier===drillDossier),customer:(d.customer_rows??[]).filter(r=>r.dossier===drillDossier)}},[drillDossier,d]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{fluid:true,my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(PageHeader.m,{title:"\xc9tat saisie",updatedAt:d?.computed_at?new Date(d.computed_at).getTime():latest.dataUpdatedAt,isFetching:latest.isFetching,isError:latest.isError,onRefresh:()=>latest.refetch(),actions:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{loading:recompute.isPending,onClick:()=>recompute.mutate(),variant:"light",children:"Recalculer"})}),d&&!d.available?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Aucun snapshot disponible — lancez \xab Recalculer \xbb ou attendez le run nocturne."}):/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{mb:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"Focus dossier",placeholder:"Tous les dossiers",data:allDossiers.map(dos=>({value:dos,label:dos})),value:selectedDossier,onChange:setSelectedDossier,searchable:true,clearable:true,w:320}),selectedDossier&&/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"subtle",onClick:()=>setSelectedDossier(null),mt:22,children:"R\xe9initialiser"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SegmentedControl,{mt:22,value:managedOnly?"managed":"all",onChange:v=>setManagedOnly("managed"===v),data:[{label:"G\xe9r\xe9s",value:"managed"},{label:"Tous",value:"all"}]})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs,{value:tab,onChange:setTab,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs.List,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"resume",children:"R\xe9sum\xe9"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"top5",children:"Top 5"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s471",children:"D\xe9tail 471"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s58",children:"Virements internes (58)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s401",children:"Fournisseurs d\xe9biteurs (401)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"s411",children:"Clients cr\xe9diteurs (411)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"rappros",children:"Rappros"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Tab,{value:"dossiers",children:"Dossiers"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs.Panel,{value:"resume",pt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:4,mb:"md",children:[{key:"all",label:"Scann\xe9s",value:d?.summary?.companies_scanned??0,color:void 0},{key:"propre",label:"Propres",value:d?.summary?.companies_clean??0,color:"green"},{key:"anomalie",label:"En anomalie",value:d?.summary?.companies_with_anomalies??0,color:"orange"},{key:"erreur",label:"En erreur",value:d?.summary?.companies_in_error??0,color:"red"}].map(tile=>{const active=statusFilter===tile.key;return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:active,style:{cursor:"pointer",borderColor:active?"var(--mantine-color-blue-5)":void 0},onClick:()=>setStatusFilter(tile.key),children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:tile.label}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,size:"xl",c:tile.color,children:tile.value})]},tile.key)})}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:UNIFIED_COLS,rows:withCategoryFilter(withManagedFilter(withDossierFilter(d?.dossier_lines??[],selectedDossier),managedOnly),statusFilter),onRowClick:openDrill})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Tabs.Panel,{value:"top5",pt:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 comptes d'attente (471)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_SUSPENSE_COLS,rows:withDossierFilter(d?.summary?.top_5_suspense??[],selectedDossier),onRowClick:openDrill}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 fournisseurs d\xe9biteurs (401)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_SUPPLIER_COLS,rows:withDossierFilter(d?.summary?.top_5_supplier_debtors??[],selectedDossier),onRowClick:openDrill}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,mt:"md",children:"Top 5 clients cr\xe9diteurs (411)"}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:TOP_CUSTOMER_COLS,rows:withDossierFilter(d?.summary?.top_5_customer_creditors??[],selectedDossier),onRowClick:openDrill})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s471",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUSPENSE_COLS,rows:withManagedFilter(withDossierFilter(d?.suspense_rows??[],selectedDossier),managedOnly),onRowClick:openDrill})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s58",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUSPENSE_COLS,rows:withManagedFilter(withDossierFilter(d?.internal_transfer_rows??[],selectedDossier),managedOnly),onRowClick:openDrill})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s401",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:SUPPLIER_COLS,rows:withManagedFilter(withDossierFilter(d?.supplier_rows??[],selectedDossier),managedOnly),onRowClick:openDrill})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"s411",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:CUSTOMER_COLS,rows:withManagedFilter(withDossierFilter(d?.customer_rows??[],selectedDossier),managedOnly),onRowClick:openDrill})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"rappros",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:RECONCILIATION_COLS,rows:withManagedFilter(withDossierFilter(d?.reconciliation_rows??[],selectedDossier),managedOnly)})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Tabs.Panel,{value:"dossiers",pt:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(DossiersTab,{})})]})]}),latest.isError?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"red",mt:"md",children:"Erreur de chargement."}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Drawer,{opened:!!drillDossier,onClose:()=>setDrillDossier(null),position:"right",size:"xl",title:drillDossier?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:4,children:["Dossier ",drillDossier]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{size:"xs",variant:"light",onClick:()=>{setSelectedDossier(drillDossier);setDrillDossier(null)},children:"Focus sur ce dossier"})]}):null,children:drillData&&/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:5,mb:6,children:["Comptes d'attente 471 (",drillData.suspense.length,")"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DRILL_SUSPENSE_COLS,rows:drillData.suspense})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:5,mb:6,children:["Fournisseurs d\xe9biteurs 401 (",drillData.supplier.length,")"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DRILL_SUPPLIER_COLS,rows:drillData.supplier})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)("div",{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Title,{order:5,mb:6,children:["Clients cr\xe9diteurs 411 (",drillData.customer.length,")"]}),/*#__PURE__*/(0,jsx_runtime.jsx)(DetailTable,{columns:DRILL_CUSTOMER_COLS,rows:drillData.customer})]})]})})]})}const TOP_SUSPENSE_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"G\xe9r\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"solde_eur",label:"Solde 471 (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr.",numeric:true},{key:"top_libelle",label:"Top \xe9criture"},{key:"top_montant",label:"Montant",numeric:true}];const TOP_SUPPLIER_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"total_eur",label:"Total d\xe9biteur (€)",numeric:true},{key:"nb_fournisseurs",label:"Nb fourn.",numeric:true},{key:"top_nom",label:"Top fournisseur"},{key:"top_montant",label:"Montant",numeric:true}];const TOP_CUSTOMER_COLS=[{key:"rank",label:"#",numeric:true},{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"total_eur",label:"Total cr\xe9diteur (€)",numeric:true},{key:"nb_clients",label:"Nb clients",numeric:true},{key:"top_nom",label:"Top client"},{key:"top_montant",label:"Montant",numeric:true}];const UNIFIED_COLS=[{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"status",label:"\xc9tat",render:r=>etatBadge(r)},{key:"dossier",label:"Dossier",render:r=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(CompanyLogo.D,{slug:r.slug,updatedAt:r.logo_updated_at,size:20}),/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:r.dossier})]})},{key:"responsable",label:"Responsable",render:r=>r.responsable?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",wrap:"nowrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Avatar,{src:r.responsable.avatar_url,size:20,radius:"xl"}),/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:r.responsable.name})]}):/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:"—"})},{key:"fiscal_year_end",label:"Cl\xf4ture",render:r=>r.fiscal_year_end?/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:r.fiscal_year_end.split("-").reverse().join("/")}):/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:"—"})},{key:"solde_attente_eur",label:"Solde 471 (€)",numeric:true},{key:"solde_virements_eur",label:"Solde 58 (€)",numeric:true},{key:"total_fournisseurs_eur",label:"Fourn. d\xe9biteurs (€)",numeric:true},{key:"total_clients_eur",label:"Clients cr\xe9diteurs (€)",numeric:true},{key:"last_entry_date",label:"Derni\xe8re \xe9criture",render:row=>/*#__PURE__*/(0,jsx_runtime.jsxs)("span",{children:[row.last_entry_date??"—",staleBadge(row.last_entry_date)]})},{key:"last_reconciliation_date",label:"Dernier rappro",render:r=>{if("pennylane"!==r.source)return/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:"—"});if(null==r.last_reconciliation_date)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"red",fw:700,children:"jamais"});return/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:r.last_reconciliation_date.split("-").reverse().join("/")})}}];const SUSPENSE_COLS=[{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"date",label:"Date"},{key:"numero_compte",label:"N\xb0 Compte"},{key:"libelle_compte",label:"Libell\xe9 compte"},{key:"libelle_ecriture",label:"Libell\xe9 \xe9criture"},{key:"journal",label:"Journal"},{key:"numero_piece",label:"N\xb0 Pi\xe8ce"},{key:"debit",label:"D\xe9bit",numeric:true},{key:"credit",label:"Cr\xe9dit",numeric:true},{key:"solde_net",label:"Solde net",numeric:true},{key:"lettre",label:"Lettr\xe9"},{key:"devise",label:"Devise"}];const SUPPLIER_COLS=[{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"fournisseur",label:"Fournisseur"},{key:"solde_debiteur_eur",label:"Solde d\xe9biteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr. non lettr\xe9es",numeric:true},{key:"devise",label:"Devise"}];const CUSTOMER_COLS=[{key:"source",label:"Source",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ProviderIcon,{provider:r.source})},{key:"managed",label:"Manag\xe9",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)(ManagedBadge,{managed:r.managed})},{key:"dossier",label:"Dossier"},{key:"client",label:"Client"},{key:"solde_crediteur_eur",label:"Solde cr\xe9diteur (€)",numeric:true},{key:"nb_ecritures",label:"Nb \xe9cr. non lettr\xe9es",numeric:true},{key:"devise",label:"Devise"}];const RECONCILIATION_COLS=[{key:"dossier",label:"Dossier"},{key:"bank_label",label:"Banque",render:r=>/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:r.bank_label??"—"})},{key:"last_reconciled_period_end",label:"Dernier rappro",render:r=>{if(null==r.last_reconciled_period_end)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{span:true,c:"red",fw:700,children:"jamais"});return/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:r.last_reconciled_period_end.split("-").reverse().join("/")})}}];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([["610"],{3897:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{O:()=>BrandLogo});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var _src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(243);function BrandLogo({domain,alt,size=24}){return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Image,{src:(0,_src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__.j)(domain),alt:alt,title:alt,w:size,h:size,fit:"contain",radius:"sm",style:{aspectRatio:1}})}},243:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{j:()=>logoDevUrl});const LOGO_DEV_TOKEN="pk_BVN4OQv0Qs-bnqjdIgTppg";function logoDevUrl(domain){return`https://img.logo.dev/${domain}?token=${LOGO_DEV_TOKEN}`}},2845:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Sales});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__(3863);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useSalesLeads(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","sales","leads"],queryFn:async()=>(await api.sales.listLeadsV1()).data,refetchOnWindowFocus:true})}var notifications_esm_index_mjs_=__webpack_require__(1455);function useSalesRescan(){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async()=>(await api.sales.rescanV1()).data,onSuccess:data=>{notifications_esm_index_mjs_.notifications.show({title:"Re-scan",message:data?.message??"Re-scan lanc\xe9",color:data?.ok?"green":"orange"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Re-scan",message:err?.error?.error??err?.message??"\xc9chec du re-scan",color:"red"})}})}const TEMPERATURE_META={burning:{emoji:"\uD83D\uDD25\uD83D\uDD25",label:"Br\xfblant",order:5},hot:{emoji:"\uD83D\uDD25",label:"Chaud",order:4},warm:{emoji:"\uD83C\uDF21️",label:"Ti\xe8de",order:3},cold:{emoji:"❄️",label:"Froid",order:2},frozen:{emoji:"\uD83E\uDDCA",label:"Gel\xe9",order:1}};const TEMPERATURE_ORDER=["burning","hot","warm","cold","frozen"];function dueLabel(value){if(!value)return"Pas de date fix\xe9e";return new Date(value).toLocaleDateString("fr-FR",{timeZone:"Europe/Paris"})}function compare(a,b,key,desc){let av;let bv;if("temperature"===key){av=TEMPERATURE_META[a.temperature].order;bv=TEMPERATURE_META[b.temperature].order}else{av=a[key]?new Date(a[key]).getTime():0;bv=b[key]?new Date(b[key]).getTime():0}if(desc)return bv-av;return av-bv}function LeadsTable({leads,temperatureFilter,onRowClick}){const[sortKey,setSortKey]=(0,index_js_.useState)("last_contact_at");const[desc,setDesc]=(0,index_js_.useState)(true);function toggleSort(key){if(key===sortKey)setDesc(d=>!d);else{setSortKey(key);setDesc(true)}}const rows=(0,index_js_.useMemo)(()=>{const filtered=temperatureFilter?leads.filter(l=>l.temperature===temperatureFilter):leads;return[...filtered].sort((a,b)=>compare(a,b,sortKey,desc))},[leads,temperatureFilter,sortKey,desc]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{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,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.UnstyledButton,{onClick:()=>toggleSort("temperature"),children:"Temp\xe9rature"})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Pr\xe9nom"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Nom"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Entreprise"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.UnstyledButton,{onClick:()=>toggleSort("last_contact_at"),children:"Dernier contact"})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Prochaine action"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.UnstyledButton,{onClick:()=>toggleSort("next_action_due_at"),children:"\xc9ch\xe9ance"})})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:rows.map(l=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{style:{cursor:"pointer"},onClick:()=>onRowClick(l.id),children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:TEMPERATURE_META[l.temperature].emoji}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.first_name??""}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.last_name??""}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.company??""}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.last_contact_at?new Date(l.last_contact_at).toLocaleDateString("fr-FR",{timeZone:"Europe/Paris"}):"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.next_action??"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:l.next_action_due_at?void 0:"dimmed",children:dueLabel(l.next_action_due_at)})})]},l.id))})]})}function useSalesLead(id){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","sales","lead",id],enabled:null!==id,queryFn:async()=>(await api.sales.getLeadV1({id})).data})}function useUpdateLead(id){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async payload=>(await api.sales.updateLeadV1({id},payload)).data,onSuccess:()=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:"Modifications enregistr\xe9es",color:"green"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:err?.error?.error??err?.message??"\xc9chec de la mise \xe0 jour",color:"red"})}})}function useDeleteLead(){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.sales.deleteLeadV1({id})).data,onSuccess:()=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:"Lead supprim\xe9",color:"green"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:err?.error?.error??err?.message??"\xc9chec de la suppression",color:"red"})}})}var BrandLogo=__webpack_require__(3897);const SOURCE_DOMAIN={pipedrive:"pipedrive.com",gmail:"google.com",claap:"claap.io",granola:"granola.ai",lemlist:"lemlist.com",linkedin:"linkedin.com",imessage:"apple.com",whatsapp:"whatsapp.com",slack:"slack.com",calendar:"google.com",pennylane:"pennylane.com",yousign:"yousign.com",notion:"notion.so"};function SourceLogo({source,size=18}){const domain=SOURCE_DOMAIN[source];if(!domain)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",variant:"light",color:"gray",title:source,children:source.slice(0,2).toUpperCase()});return/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:domain,alt:source,size:size})}function directionLabel(direction){if("inbound"===direction)return"↘ Entrant";return"↗ Sortant"}function LeadTimeline({items}){if(0===items.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Aucun \xe9change."});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Timeline,{active:items.length,bulletSize:14,lineWidth:2,children:items.map(it=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Timeline.Item,{title:it.summary??"(sans r\xe9sum\xe9)",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",mb:4,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SourceLogo,{source:it.source}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",fw:500,tt:"capitalize",children:it.source}),it.channel?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",variant:"outline",children:it.channel}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:directionLabel(it.direction)})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:new Date(it.occurred_at).toLocaleString("fr-FR",{timeZone:"Europe/Paris"})}),it.external_url?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Anchor,{href:it.external_url,target:"_blank",size:"xs",children:"Ouvrir la source"}):null]})]},it.id))})}function LeadDetailDrawer({leadId,onClose}){const detail=useSalesLead(leadId);const update=useUpdateLead(leadId??0);const remove=useDeleteLead();const[temperature,setTemperature]=(0,index_js_.useState)(null);const[nextAction,setNextAction]=(0,index_js_.useState)("");const[dueAt,setDueAt]=(0,index_js_.useState)("");(0,index_js_.useEffect)(()=>{if(detail.data){setTemperature(detail.data.temperature);setNextAction(detail.data.next_action??"");setDueAt(detail.data.next_action_due_at??"")}},[detail.data]);function save(){update.mutate({temperature:temperature??void 0,next_action:""===nextAction?null:nextAction,next_action_due_at:""===dueAt?null:dueAt})}function handleDelete(){if(null===leadId)return;remove.mutate(leadId,{onSuccess:onClose})}return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Drawer,{opened:null!==leadId,onClose:onClose,position:"right",size:"lg",title:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,children:"Lead"}),children:[detail.isLoading?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Loader,{}):null,detail.data?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Prochaine action",value:nextAction,onChange:e=>setNextAction(e.currentTarget.value),flex:1}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"\xc9ch\xe9ance (ISO)",placeholder:"Pas de date fix\xe9e",value:dueAt,onChange:e=>setDueAt(e.currentTarget.value)})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"Temp\xe9rature",data:TEMPERATURE_ORDER.map(t=>({value:t,label:`${TEMPERATURE_META[t].emoji} ${TEMPERATURE_META[t].label}`})),value:temperature,onChange:setTemperature}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{color:"red",variant:"light",onClick:handleDelete,children:"Supprimer"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{loading:update.isPending,onClick:save,children:"Enregistrer"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:5,mt:"md",children:"Historique"}),/*#__PURE__*/(0,jsx_runtime.jsx)(LeadTimeline,{items:detail.data.interactions})]}):null]})}var dates_esm_index_mjs_=__webpack_require__(9038);var form_esm_index_mjs_=__webpack_require__(5021);function useCreateLead(){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async payload=>(await api.sales.createLeadV1(payload)).data,onSuccess:data=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:data?.attached?"Coordonn\xe9e d\xe9j\xe0 connue — rattach\xe9 au lead existant":"Lead cr\xe9\xe9",color:"green"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:err?.error?.error??err?.message??"\xc9chec de la cr\xe9ation",color:"red"})}})}function NewLeadModal({opened,onClose}){const create=useCreateLead();const form=(0,form_esm_index_mjs_.useForm)({initialValues:{first_name:"",last_name:"",company:"",email:"",phone:"",note:"",next_action_due_at:null,request_reconstruction:true},validate:{email:(value,values)=>value||values.phone?null:"Email ou t\xe9l\xe9phone requis"}});function submit(values){create.mutate({first_name:values.first_name||null,last_name:values.last_name||null,company:values.company||null,emails:values.email?[values.email]:[],phones:values.phone?[values.phone]:[],note:values.note||null,next_action_due_at:values.next_action_due_at?values.next_action_due_at.toISOString():null,request_reconstruction:values.request_reconstruction},{onSuccess:()=>{form.reset();onClose()}})}return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:opened,onClose:onClose,title:"Nouveau lead",children:/*#__PURE__*/(0,jsx_runtime.jsx)("form",{onSubmit:form.onSubmit(submit),children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{grow:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Pr\xe9nom",...form.getInputProps("first_name")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Nom",...form.getInputProps("last_name")})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Entreprise",...form.getInputProps("company")}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{grow:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Email",...form.getInputProps("email")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"T\xe9l\xe9phone",...form.getInputProps("phone")})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Textarea,{label:"Note / prochaine action",...form.getInputProps("note")}),/*#__PURE__*/(0,jsx_runtime.jsx)(dates_esm_index_mjs_.DateInput,{label:"Relancer le",placeholder:"Pas de date fix\xe9e",clearable:true,valueFormat:"DD/MM/YYYY",...form.getInputProps("next_action_due_at")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Checkbox,{label:"Reconstruire l'historique (recherche multi-sources)",...form.getInputProps("request_reconstruction",{type:"checkbox"})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:onClose,children:"Annuler"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{type:"submit",loading:create.isPending,children:"Cr\xe9er"})]})]})})})}function SalesApp(){const leads=useSalesLeads();const rescan=useSalesRescan();const[selectedId,setSelectedId]=(0,index_js_.useState)(null);const[temperatureFilter,setTemperatureFilter]=(0,index_js_.useState)(null);const[newLeadOpened,newLead]=(0,esm_index_mjs_.useDisclosure)(false);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{fluid:true,my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",mb:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,children:"Sales"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{placeholder:"Toutes temp\xe9ratures",clearable:true,data:TEMPERATURE_ORDER.map(t=>({value:t,label:`${TEMPERATURE_META[t].emoji} ${TEMPERATURE_META[t].label}`})),value:temperatureFilter,onChange:v=>setTemperatureFilter(v)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{onClick:newLead.open,children:"+ Nouveau lead"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{loading:rescan.isPending,onClick:()=>rescan.mutate(),variant:"light",children:"Re-scanner"})]})]}),leads.isLoading?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Loader,{}):null,leads.data?/*#__PURE__*/(0,jsx_runtime.jsx)(LeadsTable,{leads:leads.data.leads,temperatureFilter:temperatureFilter,onRowClick:setSelectedId}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(NewLeadModal,{opened:newLeadOpened,onClose:newLead.close}),/*#__PURE__*/(0,jsx_runtime.jsx)(LeadDetailDrawer,{leadId:selectedId,onClose:()=>setSelectedId(null)})]})}function Sales(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)(SalesApp,{})})})}}}]);
|
|
1
|
+
"use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["610"],{3897:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{O:()=>BrandLogo});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var _src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(243);function BrandLogo({domain,alt,size=24}){return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Image,{src:(0,_src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__.j)(domain),alt:alt,title:alt,w:size,h:size,fit:"contain",radius:"sm",style:{aspectRatio:1}})}},243:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{j:()=>logoDevUrl});const LOGO_DEV_TOKEN="pk_BVN4OQv0Qs-bnqjdIgTppg";function logoDevUrl(domain){return`https://img.logo.dev/${domain}?token=${LOGO_DEV_TOKEN}`}},2845:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Sales});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__(3863);var modern_index_js_=__webpack_require__(6197);var useApi=__webpack_require__(4148);function useSalesLeads(){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","sales","leads"],queryFn:async()=>(await api.sales.listLeadsV1()).data,refetchOnWindowFocus:true})}var notifications_esm_index_mjs_=__webpack_require__(1455);function useSalesRescan(){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async()=>(await api.sales.rescanV1()).data,onSuccess:data=>{notifications_esm_index_mjs_.notifications.show({title:"Re-scan",message:data?.message??"Re-scan lanc\xe9",color:data?.ok?"green":"orange"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Re-scan",message:err?.error?.error??err?.message??"\xc9chec du re-scan",color:"red"})}})}const TEMPERATURE_META={burning:{emoji:"\uD83D\uDD25\uD83D\uDD25",label:"Br\xfblant",order:5},hot:{emoji:"\uD83D\uDD25",label:"Chaud",order:4},warm:{emoji:"\uD83C\uDF21️",label:"Ti\xe8de",order:3},cold:{emoji:"❄️",label:"Froid",order:2},frozen:{emoji:"\uD83E\uDDCA",label:"Gel\xe9",order:1}};const TEMPERATURE_ORDER=["burning","hot","warm","cold","frozen"];function dueLabel(value){if(!value)return"Pas de date fix\xe9e";return new Date(value).toLocaleDateString("fr-FR",{timeZone:"Europe/Paris"})}function compare(a,b,key,desc){let av;let bv;if("temperature"===key){av=TEMPERATURE_META[a.temperature].order;bv=TEMPERATURE_META[b.temperature].order}else{av=a[key]?new Date(a[key]).getTime():0;bv=b[key]?new Date(b[key]).getTime():0}if(desc)return bv-av;return av-bv}function matchesSearch(lead,query){const q=query.trim().toLowerCase();if(!q)return true;const haystack=[lead.first_name,lead.last_name,lead.company].filter(Boolean).join(" ").toLowerCase();return haystack.includes(q)}function LeadsTable({leads,temperatureFilter,search,onRowClick}){const[sortKey,setSortKey]=(0,index_js_.useState)("last_contact_at");const[desc,setDesc]=(0,index_js_.useState)(true);function toggleSort(key){if(key===sortKey)setDesc(d=>!d);else{setSortKey(key);setDesc(true)}}const rows=(0,index_js_.useMemo)(()=>{const filtered=leads.filter(l=>{if(temperatureFilter&&l.temperature!==temperatureFilter)return false;return matchesSearch(l,search)});return[...filtered].sort((a,b)=>compare(a,b,sortKey,desc))},[leads,temperatureFilter,search,sortKey,desc]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{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,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.UnstyledButton,{onClick:()=>toggleSort("temperature"),children:"Temp\xe9rature"})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Pr\xe9nom"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Nom"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Entreprise"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.UnstyledButton,{onClick:()=>toggleSort("last_contact_at"),children:"Dernier contact"})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Prochaine action"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.UnstyledButton,{onClick:()=>toggleSort("next_action_due_at"),children:"\xc9ch\xe9ance"})})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:rows.map(l=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{style:{cursor:"pointer"},onClick:()=>onRowClick(l.id),children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:TEMPERATURE_META[l.temperature].emoji}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.first_name??""}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.last_name??""}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.company??""}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.last_contact_at?new Date(l.last_contact_at).toLocaleDateString("fr-FR",{timeZone:"Europe/Paris"}):"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:l.next_action??"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"sm",c:l.next_action_due_at?void 0:"dimmed",children:dueLabel(l.next_action_due_at)})})]},l.id))})]})}function useSalesLead(id){const api=(0,useApi.h)();return(0,modern_index_js_.useQuery)({queryKey:["tech","sales","lead",id],enabled:null!==id,queryFn:async()=>(await api.sales.getLeadV1({id})).data})}function useUpdateLead(id){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async payload=>(await api.sales.updateLeadV1({id},payload)).data,onSuccess:()=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:"Modifications enregistr\xe9es",color:"green"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:err?.error?.error??err?.message??"\xc9chec de la mise \xe0 jour",color:"red"})}})}function useDeleteLead(){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async id=>(await api.sales.deleteLeadV1({id})).data,onSuccess:()=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:"Lead supprim\xe9",color:"green"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:err?.error?.error??err?.message??"\xc9chec de la suppression",color:"red"})}})}var BrandLogo=__webpack_require__(3897);const SOURCE_DOMAIN={pipedrive:"pipedrive.com",gmail:"google.com",claap:"claap.io",granola:"granola.ai",lemlist:"lemlist.com",linkedin:"linkedin.com",imessage:"apple.com",whatsapp:"whatsapp.com",slack:"slack.com",calendar:"google.com",pennylane:"pennylane.com",yousign:"yousign.com",notion:"notion.so"};function SourceLogo({source,size=18}){const domain=SOURCE_DOMAIN[source];if(!domain)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",variant:"light",color:"gray",title:source,children:source.slice(0,2).toUpperCase()});return/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:domain,alt:source,size:size})}function directionLabel(direction){if("inbound"===direction)return"↘ Entrant";return"↗ Sortant"}function LeadTimeline({items}){if(0===items.length)return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Aucun \xe9change."});return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Timeline,{active:items.length,bulletSize:14,lineWidth:2,children:items.map(it=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Timeline.Item,{title:it.summary??"(sans r\xe9sum\xe9)",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",mb:4,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SourceLogo,{source:it.source}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",fw:500,tt:"capitalize",children:it.source}),it.channel?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{size:"xs",variant:"outline",children:it.channel}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:directionLabel(it.direction)})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{size:"xs",c:"dimmed",children:new Date(it.occurred_at).toLocaleString("fr-FR",{timeZone:"Europe/Paris"})}),it.external_url?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Anchor,{href:it.external_url,target:"_blank",size:"xs",children:"Ouvrir la source"}):null]})]},it.id))})}function LeadDetailDrawer({leadId,onClose}){const detail=useSalesLead(leadId);const update=useUpdateLead(leadId??0);const remove=useDeleteLead();const[temperature,setTemperature]=(0,index_js_.useState)(null);const[nextAction,setNextAction]=(0,index_js_.useState)("");const[dueAt,setDueAt]=(0,index_js_.useState)("");(0,index_js_.useEffect)(()=>{if(detail.data){setTemperature(detail.data.temperature);setNextAction(detail.data.next_action??"");setDueAt(detail.data.next_action_due_at??"")}},[detail.data]);function save(){update.mutate({temperature:temperature??void 0,next_action:""===nextAction?null:nextAction,next_action_due_at:""===dueAt?null:dueAt})}function handleDelete(){if(null===leadId)return;remove.mutate(leadId,{onSuccess:onClose})}return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Drawer,{opened:null!==leadId,onClose:onClose,position:"right",size:"lg",title:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:4,children:"Lead"}),children:[detail.isLoading?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Loader,{}):null,detail.data?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Prochaine action",value:nextAction,onChange:e=>setNextAction(e.currentTarget.value),flex:1}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"\xc9ch\xe9ance (ISO)",placeholder:"Pas de date fix\xe9e",value:dueAt,onChange:e=>setDueAt(e.currentTarget.value)})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{label:"Temp\xe9rature",data:TEMPERATURE_ORDER.map(t=>({value:t,label:`${TEMPERATURE_META[t].emoji} ${TEMPERATURE_META[t].label}`})),value:temperature,onChange:setTemperature}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{color:"red",variant:"light",onClick:handleDelete,children:"Supprimer"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{loading:update.isPending,onClick:save,children:"Enregistrer"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:5,mt:"md",children:"Historique"}),/*#__PURE__*/(0,jsx_runtime.jsx)(LeadTimeline,{items:detail.data.interactions})]}):null]})}var dates_esm_index_mjs_=__webpack_require__(9038);var form_esm_index_mjs_=__webpack_require__(5021);function useCreateLead(){const api=(0,useApi.h)();const queryClient=(0,modern_index_js_.useQueryClient)();return(0,modern_index_js_.useMutation)({mutationFn:async payload=>(await api.sales.createLeadV1(payload)).data,onSuccess:data=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:data?.attached?"Coordonn\xe9e d\xe9j\xe0 connue — rattach\xe9 au lead existant":"Lead cr\xe9\xe9",color:"green"});queryClient.invalidateQueries({queryKey:["tech","sales"]})},onError:err=>{notifications_esm_index_mjs_.notifications.show({title:"Lead",message:err?.error?.error??err?.message??"\xc9chec de la cr\xe9ation",color:"red"})}})}function NewLeadModal({opened,onClose}){const create=useCreateLead();const form=(0,form_esm_index_mjs_.useForm)({initialValues:{first_name:"",last_name:"",company:"",email:"",phone:"",note:"",next_action_due_at:null,request_reconstruction:true}});function submit(values){const hasAny=Boolean(values.first_name)||Boolean(values.last_name)||Boolean(values.company)||Boolean(values.email)||Boolean(values.phone);if(!hasAny)return void notifications_esm_index_mjs_.notifications.show({title:"Lead",message:"Renseignez au moins un nom, une entreprise ou une coordonn\xe9e",color:"orange"});create.mutate({first_name:values.first_name||null,last_name:values.last_name||null,company:values.company||null,emails:values.email?[values.email]:[],phones:values.phone?[values.phone]:[],note:values.note||null,next_action_due_at:values.next_action_due_at?new Date(values.next_action_due_at).toISOString():null,request_reconstruction:values.request_reconstruction},{onSuccess:()=>{form.reset();onClose()}})}return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Modal,{opened:opened,onClose:onClose,title:"Nouveau lead",children:/*#__PURE__*/(0,jsx_runtime.jsx)("form",{onSubmit:form.onSubmit(submit),children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"sm",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{grow:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Pr\xe9nom",...form.getInputProps("first_name")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Nom",...form.getInputProps("last_name")})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Entreprise",...form.getInputProps("company")}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{grow:true,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"Email",...form.getInputProps("email")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{label:"T\xe9l\xe9phone",...form.getInputProps("phone")})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Textarea,{label:"Note / prochaine action",...form.getInputProps("note")}),/*#__PURE__*/(0,jsx_runtime.jsx)(dates_esm_index_mjs_.DateInput,{label:"Relancer le",placeholder:"Pas de date fix\xe9e",clearable:true,valueFormat:"DD/MM/YYYY",...form.getInputProps("next_action_due_at")}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Checkbox,{label:"Reconstruire l'historique (recherche multi-sources)",...form.getInputProps("request_reconstruction",{type:"checkbox"})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"flex-end",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{variant:"default",onClick:onClose,children:"Annuler"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{type:"submit",loading:create.isPending,children:"Cr\xe9er"})]})]})})})}function SalesApp(){const leads=useSalesLeads();const rescan=useSalesRescan();const[selectedId,setSelectedId]=(0,index_js_.useState)(null);const[temperatureFilter,setTemperatureFilter]=(0,index_js_.useState)(null);const[search,setSearch]=(0,index_js_.useState)("");const[newLeadOpened,newLead]=(0,esm_index_mjs_.useDisclosure)(false);return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Container,{fluid:true,my:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",mb:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:2,children:"Sales"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{placeholder:"Rechercher (nom, entreprise)",value:search,onChange:e=>setSearch(e.currentTarget.value),w:260}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Select,{placeholder:"Toutes temp\xe9ratures",clearable:true,data:TEMPERATURE_ORDER.map(t=>({value:t,label:`${TEMPERATURE_META[t].emoji} ${TEMPERATURE_META[t].label}`})),value:temperatureFilter,onChange:v=>setTemperatureFilter(v)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{onClick:newLead.open,children:"+ Nouveau lead"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Button,{loading:rescan.isPending,onClick:()=>rescan.mutate(),variant:"light",children:"Re-scanner"})]})]}),leads.isLoading?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Loader,{}):null,leads.data?/*#__PURE__*/(0,jsx_runtime.jsx)(LeadsTable,{leads:leads.data.leads,temperatureFilter:temperatureFilter,search:search,onRowClick:setSelectedId}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(NewLeadModal,{opened:newLeadOpened,onClose:newLead.close}),/*#__PURE__*/(0,jsx_runtime.jsx)(LeadDetailDrawer,{leadId:selectedId,onClose:()=>setSelectedId(null)})]})}function Sales(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)(SalesApp,{})})})}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["9047"],{3897:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{O:()=>BrandLogo});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var _src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(243);function BrandLogo({domain,alt,size=24}){return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Image,{src:(0,_src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__.j)(domain),alt:alt,title:alt,w:size,h:size,fit:"contain",radius:"sm",style:{aspectRatio:1}})}},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,leading,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:[leading,/*#__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]})]})}},243:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{j:()=>logoDevUrl});const LOGO_DEV_TOKEN="pk_BVN4OQv0Qs-bnqjdIgTppg";function logoDevUrl(domain){return`https://img.logo.dev/${domain}?token=${LOGO_DEV_TOKEN}`}},4126:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Scrapers});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 useScrapersQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","scrapers"],queryFn:async()=>await api.getScrapers().then(x=>x.data),refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var PageHeader=__webpack_require__(1354);var BrandLogo=__webpack_require__(3897);function IconBraintree({color="currentColor",size=20,...props}){return/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:size,height:size,viewBox:"0 0 24 24",fill:color,xmlns:"http://www.w3.org/2000/svg",...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M8.276 20.482h4.717c3.641 0 5.462-1.2 5.462-3.517 0-2.275-1.945-3.517-5.752-3.517H8.276Zm0-16.965v6.538h4.138c3.103 0 4.717-1.159 4.717-3.269 0-2.152-1.655-3.269-4.759-3.269zM1.696 24v-3.518H4.47V3.517H1.697V0h11.089c5.09 0 8.193 2.358 8.193 6.455 0 2.69-1.572 4.345-3.558 5.131 2.855.787 4.882 2.814 4.882 5.586 0 4.386-3.393 6.828-8.938 6.828H1.697"})})}function ScraperCard({scraper,onClick}){const color=scraper.isTooOld?"red":"green";return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:true,radius:"md",p:"md",style:{cursor:"pointer"},onClick:onClick,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",mb:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[null!==scraper.logoDomain?/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:scraper.logoDomain,alt:scraper.label}):/*#__PURE__*/(0,jsx_runtime.jsx)(IconBraintree,{size:24}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,children:scraper.label})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{color:color,variant:"light",children:[scraper.connectors.length," connecteur",1!==scraper.connectors.length?"s":""]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fz:"sm",c:color,children:null!==scraper.lastDataDate?`Derni\xe8re donn\xe9e : ${scraper.lastDataDate}`:"Aucune donn\xe9e"})]})}function PennylaneCard({pennylane}){const color=pennylane.isTooOld?"red":"green";return/*#__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",mb:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:"pennylane.com",alt:"Pennylane"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,children:"Pennylane"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:color,variant:"light",children:"Cookie"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",c:color,children:["\uD83C\uDF6A Dernier refresh \xe0 ",pennylane.lastTime]})]})}function ScraperDetailDrawer({scraper,onClose}){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Drawer,{opened:null!==scraper,onClose:onClose,title:null!==scraper?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:3,children:scraper.label}):null,position:"right",size:"md",children:null!==scraper?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[null!==scraper.logoDomain?/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:scraper.logoDomain,alt:scraper.label,size:40}):/*#__PURE__*/(0,jsx_runtime.jsx)(IconBraintree,{size:40}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",c:"dimmed",children:[scraper.connectors.length," connecteur",1!==scraper.connectors.length?"s":""]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{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:"Connecteur"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Client"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Derni\xe8re donn\xe9e"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Statut"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:scraper.connectors.map(connector=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:connector.connector}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:connector.client??"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:connector.lastDataDate??"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:connector.isTooOld?"red":"green",fw:600,fz:"sm",children:connector.isTooOld?"Retard":"OK"})})]},connector.connector))})]})]}):null})}function ScrapersApp(){const query=useScrapersQuery();const[selected,setSelected]=(0,index_js_.useState)(null);return/*#__PURE__*/(0,jsx_runtime.jsxs)(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:"Scrapers",updatedAt:query.dataUpdatedAt,isFetching:query.isFetching,isError:query.isError,onRefresh:()=>query.refetch()}),query.data?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"xl",children:[/*#__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:"Connecteurs"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:{base:1,sm:2,md:3},spacing:"md",children:query.data.scrapers.map(scraper=>/*#__PURE__*/(0,jsx_runtime.jsx)(ScraperCard,{scraper:scraper,onClick:()=>setSelected(scraper)},scraper.key))})]}),/*#__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:"Monitoring Cookie"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:{base:1,sm:2,md:3},spacing:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(PennylaneCard,{pennylane:query.data.pennylane})})]})]}):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Chargement…"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(ScraperDetailDrawer,{scraper:selected,onClose:()=>setSelected(null)})]})}function Scrapers(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)(ScrapersApp,{})})})}}}]);
|
|
1
|
+
"use strict";(globalThis["chunk_tech_app"]=globalThis["chunk_tech_app"]||[]).push([["9047"],{3897:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{O:()=>BrandLogo});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);var _src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(243);function BrandLogo({domain,alt,size=24}){return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Image,{src:(0,_src_components_logoDev_ts__WEBPACK_IMPORTED_MODULE_2__.j)(domain),alt:alt,title:alt,w:size,h:size,fit:"contain",radius:"sm",style:{aspectRatio:1}})}},3437:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{D:()=>CompanyLogo});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893);var _mantine_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(207);const BASE_URL="https://s3.dualstack.eu-west-3.amazonaws.com/media.airporting/companies";function CompanyLogo({slug,updatedAt,size=20,...rest}){const base=`${BASE_URL}/${slug}.png`;const url=updatedAt?`${base}?v=${new Date(updatedAt).getTime()}`:base;return/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_mantine_core__WEBPACK_IMPORTED_MODULE_1__.Image,{src:url,fallbackSrc:`${BASE_URL}/undefined.png`,alt:slug??"",w:size,h:size,fit:"contain",radius:"sm",style:{aspectRatio:1},...rest})}},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,leading,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:[leading,/*#__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]})]})}},243:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{j:()=>logoDevUrl});const LOGO_DEV_TOKEN="pk_BVN4OQv0Qs-bnqjdIgTppg";function logoDevUrl(domain){return`https://img.logo.dev/${domain}?token=${LOGO_DEV_TOKEN}`}},8401:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.r(__webpack_exports__);__webpack_require__.d(__webpack_exports__,{default:()=>Scrapers});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 useScrapersQuery(){const api=(0,useApi.h)();const query=(0,modern_index_js_.useQuery)({queryKey:["tech","scrapers"],queryFn:async()=>await api.getScrapers().then(x=>x.data),refetchInterval:3e4,refetchIntervalInBackground:false,refetchOnWindowFocus:true,refetchOnReconnect:true});return query}var PageHeader=__webpack_require__(1354);var BrandLogo=__webpack_require__(3897);function IconBraintree({color="currentColor",size=20,...props}){return/*#__PURE__*/(0,jsx_runtime.jsx)("svg",{width:size,height:size,viewBox:"0 0 24 24",fill:color,xmlns:"http://www.w3.org/2000/svg",...props,children:/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M8.276 20.482h4.717c3.641 0 5.462-1.2 5.462-3.517 0-2.275-1.945-3.517-5.752-3.517H8.276Zm0-16.965v6.538h4.138c3.103 0 4.717-1.159 4.717-3.269 0-2.152-1.655-3.269-4.759-3.269zM1.696 24v-3.518H4.47V3.517H1.697V0h11.089c5.09 0 8.193 2.358 8.193 6.455 0 2.69-1.572 4.345-3.558 5.131 2.855.787 4.882 2.814 4.882 5.586 0 4.386-3.393 6.828-8.938 6.828H1.697"})})}function ScraperCard({scraper,onClick}){const color=scraper.isTooOld?"red":"green";return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:true,radius:"md",p:"md",style:{cursor:"pointer"},onClick:onClick,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",mb:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[null!==scraper.logoDomain?/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:scraper.logoDomain,alt:scraper.label}):/*#__PURE__*/(0,jsx_runtime.jsx)(IconBraintree,{size:24}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,children:scraper.label})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{color:color,variant:"light",children:[scraper.connectors.length," connecteur",1!==scraper.connectors.length?"s":""]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fz:"sm",c:color,children:null!==scraper.lastDataDate?`Derni\xe8re donn\xe9e : ${scraper.lastDataDate}`:"Aucune donn\xe9e"})]})}function PennylaneCard({pennylane}){const color=pennylane.isTooOld?"red":"green";return/*#__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",mb:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:"pennylane.com",alt:"Pennylane"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,children:"Pennylane"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Badge,{color:color,variant:"light",children:"Cookie"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",c:color,children:["\uD83C\uDF6A Dernier refresh \xe0 ",pennylane.lastTime]})]})}function SobankCard({sobank,onClick}){const color=sobank.isTooOld?"red":"green";return/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Card,{withBorder:true,radius:"md",p:"md",style:{cursor:"pointer"},onClick:onClick,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{justify:"space-between",mb:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:"sogescot.com",alt:"Sobank"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fw:700,children:"Sobank"})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Badge,{color:color,variant:"light",children:[sobank.count," compte",1!==sobank.count?"s":""]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fz:"sm",c:color,children:null!==sobank.lastDataDate?`Dernier solde : ${sobank.lastDataDate}`:"Aucune donn\xe9e"})]})}var CompanyLogo=__webpack_require__(3437);function ScraperDetailDrawer({scraper,onClose}){return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Drawer,{opened:null!==scraper,onClose:onClose,title:null!==scraper?/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:3,children:scraper.label}):null,position:"right",size:"md",children:null!==scraper?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[null!==scraper.logoDomain?/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:scraper.logoDomain,alt:scraper.label,size:40}):/*#__PURE__*/(0,jsx_runtime.jsx)(IconBraintree,{size:40}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",c:"dimmed",children:[scraper.connectors.length," connecteur",1!==scraper.connectors.length?"s":""]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{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:"Connecteur"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Client"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Derni\xe8re donn\xe9e"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Statut"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:scraper.connectors.map(connector=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:connector.connector}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:null!==connector.client?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",wrap:"nowrap",children:[null!==connector.companySlug?/*#__PURE__*/(0,jsx_runtime.jsx)(CompanyLogo.D,{slug:connector.companySlug,updatedAt:connector.companyLogoUpdatedAt,size:20}):null,/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{fz:"sm",children:connector.client})]}):"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:connector.lastDataDate??"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:connector.isTooOld?"red":"green",fw:600,fz:"sm",children:connector.isTooOld?"Retard":"OK"})})]},connector.connector))})]})]}):null})}var tabler_icons_react_mjs_=__webpack_require__(9632);function formatBalance(account){const formatted=new Intl.NumberFormat("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2}).format(account.balance);return null!==account.currency?`${formatted} ${account.currency}`:formatted}function SobankDrawer({sobank,opened,onClose}){const[search,setSearch]=(0,index_js_.useState)("");const filtered=(0,index_js_.useMemo)(()=>{const needle=search.trim().toLowerCase();if(""===needle)return sobank.accounts;return sobank.accounts.filter(a=>{const haystack=`${a.account} ${a.bank} ${a.iban??""}`.toLowerCase();return haystack.includes(needle)})},[sobank.accounts,search]);return/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Drawer,{opened:opened,onClose:onClose,title:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Title,{order:3,children:"Sobank"}),position:"right",size:"lg",children:/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"md",children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Group,{gap:"xs",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(BrandLogo.O,{domain:"sogescot.com",alt:"Sobank",size:40}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Text,{fz:"sm",c:"dimmed",children:[sobank.count," compte",1!==sobank.count?"s":""]})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.TextInput,{leftSection:/*#__PURE__*/(0,jsx_runtime.jsx)(tabler_icons_react_mjs_.IconSearch,{size:16}),placeholder:"Rechercher (compte, banque, IBAN)…",value:search,onChange:e=>setSearch(e.currentTarget.value)}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table,{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:"Compte"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"Banque"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Th,{children:"IBAN"}),/*#__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:"Statut"})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Tbody,{children:filtered.map(account=>/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Table.Tr,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:account.account}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:account.bank}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:account.iban??"—"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:formatBalance(account)}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:account.balanceDate}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Table.Td,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:account.isTooOld?"red":"green",fw:600,fz:"sm",children:account.isTooOld?"Retard":"OK"})})]},account.iban??`${account.account}|${account.bank}`))})]})]})})}function ScrapersApp(){const query=useScrapersQuery();const[selected,setSelected]=(0,index_js_.useState)(null);const[sobankOpened,setSobankOpened]=(0,index_js_.useState)(false);return/*#__PURE__*/(0,jsx_runtime.jsxs)(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:"Scrapers",updatedAt:query.dataUpdatedAt,isFetching:query.isFetching,isError:query.isError,onRefresh:()=>query.refetch()}),query.data?/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.Stack,{gap:"xl",children:[/*#__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:"Connecteurs"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(index_mjs_.SimpleGrid,{cols:{base:1,sm:2,md:3},spacing:"md",children:[query.data.scrapers.map(scraper=>/*#__PURE__*/(0,jsx_runtime.jsx)(ScraperCard,{scraper:scraper,onClick:()=>setSelected(scraper)},scraper.key)),/*#__PURE__*/(0,jsx_runtime.jsx)(SobankCard,{sobank:query.data.sobank,onClick:()=>setSobankOpened(true)})]})]}),/*#__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:"Monitoring Cookie"}),/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.SimpleGrid,{cols:{base:1,sm:2,md:3},spacing:"md",children:/*#__PURE__*/(0,jsx_runtime.jsx)(PennylaneCard,{pennylane:query.data.pennylane})})]})]}):/*#__PURE__*/(0,jsx_runtime.jsx)(index_mjs_.Text,{c:"dimmed",children:"Chargement…"})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(ScraperDetailDrawer,{scraper:selected,onClose:()=>setSelected(null)}),query.data?/*#__PURE__*/(0,jsx_runtime.jsx)(SobankDrawer,{sobank:query.data.sobank,opened:sobankOpened,onClose:()=>setSobankOpened(false)}):null]})}function Scrapers(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)(ScrapersApp,{})})})}}}]);
|