import{o as e}from"./chunk-jRWAZmH_.js";import{n as t,t as n}from"./jsx-runtime-CEixWuwE.js";import{t as r}from"./index.esm-DB3Pt-Y3.js";import{i}from"./ctiAxios-z6-f5GoX.js";import{a}from"./notification-iew2j46e.js";import{t as o}from"./button-BwrlrBF7.js";import{t as s}from"./prop-types-CEsF4M7J.js";import{t as c}from"./input-vY_ggPFq.js";import{t as l}from"./popconfirm-skTHAEtZ.js";import{t as u}from"./UndoOutlined-Dm9VLtd3.js";import{t as d}from"./Loader-DwTdyGS9.js";import{I as f,at as p,c as m,dt as h}from"./index-vzToGWaQ.js";import{a as g,t as _}from"./synchronize.queries-CRzIztql.js";var v=e(t()),y=e(s()),b=n(),x=({swfData:e})=>{let[t]=p.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]),s=_(n.exe),y=()=>{s.refetch()},x=async()=>{let e=t.getFieldsValue(),r={exe:n.exe},o=``;for(let t in e)e[t]&&(o=`${o}${t} ${e[t]} `);r.args=o,a({type:`success`,message:`Synchronisation`,description:`Synchronisation lancée sur le serveur`}),await i(`modules/outils/php/httpService_synchronizeManager_exec.php`,r),y()};function S(e){return(0,b.jsx)(`div`,{className:`content-table`,children:(0,b.jsx)(m,{columns:g,data:e.map((e,t)=>({...e,key:t})),loading:s.isFetching})})}return!s.data?.jobs||s.isPending?(0,b.jsx)(`div`,{className:`loading-wrapper`,children:(0,b.jsx)(d,{})}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(r,{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)(o,{type:`link`,onClick:y,children:(0,b.jsx)(u,{})})})})]}),(0,b.jsx)(`div`,{className:`component-content`,children:(0,b.jsx)(h,{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)(p,{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)(p.Item,{name:n,extra:r,children:(0,b.jsx)(c,{})},n)]},n)})})}),(0,b.jsx)(`div`,{style:{display:`flex`,flexDirection:`row`,justifyContent:`center`},children:(0,b.jsxs)(l,{title:`Êtes-vous sur de vouloir lancer la synchronisation ?`,onConfirm:x,children:[(0,b.jsx)(o,{type:`primary`,style:{width:500},children:`Lancer`}),(0,b.jsx)(`p`,{children:s.data.lastJobs[0].last_all_endded})]})})]})},{label:`Historique des travaux`,key:`2`,children:(0,b.jsx)(b.Fragment,{children:S(s.data.jobs)})}]})})]})};x.propTypes={data:y.default.string};var S=v.memo(x);export{S as default};
|