import{o as e}from"./chunk-jRWAZmH_.js";import{n as t,t as n}from"./jsx-runtime-CEixWuwE.js";import{n as r}from"./axios-DIFBeL1S.js";import{t as i}from"./index.esm-BU-BBO8k.js";import{t as a}from"./input-D-p75RoQ.js";import{i as o}from"./ctiAxios-CFpkMDWI.js";import{t as s}from"./button-Z8LWcDu0.js";import{t as c}from"./popconfirm-DYqs1oej.js";import{r as l}from"./notification-BoSXwLUg.js";import{t as u}from"./UndoOutlined-BlN5VpW4.js";import{t as d}from"./Loader-DAvrHvso.js";import{F as f,ht as p,ot as m,s as h}from"./index-CF_KvxDb.js";import{a as g,t as _}from"./synchronize.queries-DSsRB4le.js";var v=e(t()),y=e(r()),b=n(),x=({swfData:e})=>{let[t]=m.useForm(),n=(0,v.useMemo)(()=>{let t=e.split(`|`);return{exe:t[0],title:t[1],options:t.splice(2,t.length-1).filter(e=>e)}},[e]),r=_(n.exe),y=()=>{r.refetch()},x=async()=>{let e=t.getFieldsValue(),r={exe:n.exe},i=``;for(let t in e)e[t]&&(i=`${i}${t} ${e[t]} `);r.args=i,l({type:`success`,message:`Synchronisation`,description:`Synchronisation lancée sur le serveur`}),await o(`modules/outils/php/httpService_synchronizeManager_exec.php`,r),y()};function S(e){return(0,b.jsx)(`div`,{className:`content-table`,children:(0,b.jsx)(h,{columns:g,data:e.map((e,t)=>({...e,key:t})),loading:r.isFetching})})}return!r.data?.jobs||r.isPending?(0,b.jsx)(`div`,{className:`loading-wrapper`,children:(0,b.jsx)(d,{})}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(i,{children:(0,b.jsx)(`title`,{children:`iCTI | Synchronisation`})}),(0,b.jsxs)(`div`,{className:`component-header`,children:[(0,b.jsx)(`div`,{className:`header-title`,children:n.title}),(0,b.jsx)(`div`,{className:`header-actions`,children:(0,b.jsx)(f,{title:`Actualiser`,children:(0,b.jsx)(s,{type:`link`,onClick:y,children:(0,b.jsx)(u,{})})})})]}),(0,b.jsx)(`div`,{className:`component-content`,children:(0,b.jsx)(p,{defaultActiveKey:`1`,items:[{label:`Synchronisation des données`,key:`1`,children:(0,b.jsxs)(b.Fragment,{children:[!n.options||!n.options.length?null:(0,b.jsx)(`div`,{className:`sync-options`,children:(0,b.jsx)(m,{form:t,children:n.options.map(e=>{let t=e.split(`#`)[0],n=e.split(`#`)[1],r=e.split(`#`)[3];return(0,b.jsxs)(`div`,{className:`form-item`,children:[(0,b.jsx)(`div`,{className:`first-label`,children:t}),(0,b.jsx)(m.Item,{name:n,extra:r,children:(0,b.jsx)(a,{})},n)]},n)})})}),(0,b.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,justifyContent:`center`},children:(0,b.jsxs)(c,{title:`Êtes-vous sur de vouloir lancer la synchronisation ?`,onConfirm:x,children:[(0,b.jsx)(s,{type:`primary`,style:{width:500},children:`Lancer`}),(0,b.jsx)(`p`,{children:r.data.lastJobs[0].last_all_endded})]})})]})},{label:`Historique des travaux`,key:`2`,children:(0,b.jsx)(b.Fragment,{children:S(r.data.jobs)})}]})})]})};x.propTypes={data:y.default.string};var S=v.memo(x);export{S as default};
|