PageSourceSearch

https://opravdovezlociny.cz/assets/AdminServices-Ue6nSCWq.js

js opravdovezlociny.cz collected 2026-09-24 18:57:04 UTC 9,463 bytes, 6 lines download raw bytes

1import{e as K,f as q,r as u,m as B,s as m,j as e,B as y,ai as $,an as D,C as o,aB as w,b5 as E,P as z,p}from"./index-5ZAWLHa7.js";import{A as J}from"./AdminLayout-BUKoFlVJ.js";import{C as h,c as x,a as O,b as Z}from"./card-Oa34omM-.js";import{T as I,a as L,b as C,c as l,d as Q,e as c}from"./table-D0xIy6es.js";import{C as g}from"./circle-check-big-CQQOfw9A.js";import{T as F}from"./triangle-alert-CtZnnHqH.js";import{Z as M}from"./zap-BR9T_a4I.js";import{R as v}from"./refresh-cw-CZx3qSSi.js";import{C as R}from"./circle-x-BqLjgOQx.js";import"./layout-dashboard-C0M2opqQ.js";import"./list-DES9x6Jt.js";import"./plus-CNrvElMC.js";import"./users-DY6hoq56.js";import"./shopping-cart-IQImUVR3.js";import"./package-B3mUj7PH.js";import"./circle-dot-RefO1h_o.js";import"./truck-CiGAK9ox.js";import"./mic-BrJUUKir.js";import"./eye-EaCa6FW1.js";import"./upload-hDTYLIFH.js";import"./code-CfR0yrLo.js";import"./file-code-CIsw_UtE.js";import"./shield-BYg-Ymw1.js";import"./credit-card-DEGk0FvZ.js";import"./globe-enaP-c8h.js";import"./search-BrRMA8aZ.js";import"./ticket-Ba_SANqY.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const H=K("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]),j={"process-recurring-payments":{label:"Opakované platby",description:"process-recurring-payments · Zpracování pravidelných plateb za členství"},"aggregate-daily-stats":{label:"Denní statistiky",description:"aggregate-daily-stats · Agregace statistik návštěvnosti a prodejů"},"send-membership-emails":{label:"E-maily členství + Deaktivace",description:"send-membership-emails · Odesílání e-mailů a deaktivace účtů bez opakované platby"},"process-vouchers":{label:"Zpracování poukazů",description:"process-vouchers · Generování PDF a odesílání dárkových poukazů"},"cron-epizoda-daily":{label:"Publikace epizod",description:"cron-epizoda-daily · Automatická aktivace naplánovaných epizod"},"cron-eshop-mailstep":{label:"E-shop Mailstep",description:"cron-eshop-mailstep · Synchronizace objednávek s Mailstep skladem"},"cron-eshop-orders":{label:"E-shop objednávky",description:"cron-eshop-orders · Zpracování a aktualizace stavů objednávek"},"cron-fio-banka":{label:"Fio banka",description:"cron-fio-banka · Stahování transakcí z Fio banky"},"cron-people-every-minute":{label:"Osoby – scraping",description:"cron-people-every-minute · Obohacování dat o osobách z externích zdrojů"},"cron-stock-snapshot":{label:"Snapshot skladu",description:"cron-stock-snapshot · Denní snímek stavu skladových zásob"},"daily-database-backup":{label:"Záloha databáze",description:"daily-database-backup · Denní export tabulek do úložiště"},"fetch-support-emails":{label:"Podpora – e-maily",description:"fetch-support-emails · Stahování e-mailů z podpory"},"trivi-export-auto":{label:"Triví export",description:"trivi-export-auto · Automatický export dat do účetního systému Triví"},"cron-card-info":{label:"Info o kartě",description:"cron-card-info · Doplnění platební metody a čísla karty z Comgate API"},"cron-smsticket-import":{label:"SMSticket – vstupenky",description:"cron-smsticket-import · Import vstupenek a kupujících ze SMSticket, přidělení věrnostních bodů"}};function G(r){if(r==="* * * * *")return"Každou minutu";if(r==="*/5 * * * *")return"Každých 5 minut";if(r==="*/10 * * * *")return"Každých 10 minut";if(r==="*/30 * * * *")return"Každých 30 minut";if(r==="0 * * * *")return"Každou hodinu";const n=r.match(/^(\d+)\s+(\d+)\s+\*\s+\*\s+\*$/);return n?`Denně v ${n[2].padStart(2,"0")}:${n[1].padStart(2,"0")}`:r}function ke(){const r=q(),[n,b]=u.useState(null),[f,k]=u.useState(null),{data:t,isLoading:_}=B({queryKey:["admin-cron-jobs"],queryFn:async()=>{const{data:s,error:a}=await m.rpc("get_all_cron_jobs");if(a)throw a;return s||[]},refetchInterval:3e4});u.useEffect(()=>{let s=!1;return(async()=>{try{const{data:a,error:i}=await m.rpc("cleanup_cron_history",{p_days:30,p_limit:2e4});!s&&!i&&typeof a=="number"&&a>0&&console.log(`[cron cleanup] smazáno ${a} starých záznamů historie`)}catch{}})(),()=>{s=!0}},[]);const S=async(s,a)=>{var i;b(s);try{const{error:d}=await m.rpc("toggle_cron_job_by_name",{p_jobname:s,p_active:!a});if(d)throw d;p.success(`${a?"Pozastaveno":"Aktivováno"}: ${((i=j[s])==null?void 0:i.label)||s}`),r.invalidateQueries({queryKey:["admin-cron-jobs"]})}catch(d){p.error("Chyba: "+d.message)}finally{b(null)}},T=async s=>{var a;k(s);try{const{error:i}=await m.rpc("trigger_cron_job",{p_jobname:s});if(i)throw i;p.success(`Spuštěno: ${((a=j[s])==null?void 0:a.label)||s}`),setTimeout(()=>{r.invalidateQueries({queryKey:["admin-cron-jobs"]})},3e3)}catch(i){p.error("Chyba: "+i.message)}finally{k(null)}},A=(t==null?void 0:t.filter(s=>s.active).length)||0,P=(t==null?void 0:t.length)||0,N=(t==null?void 0:t.filter(s=>s.last_status==="failed").length)||0;return e.jsx(J,{title:"Služby",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsx(h,{children:e.jsx(x,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(H,{className:"w-8 h-8 text-blue-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:P}),e.jsx("p",{className:"text-sm text-gray-500",children:"Celkem služeb"})]})]})})}),e.jsx(h,{children:e.jsx(x,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(g,{className:"w-8 h-8 text-green-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:A}),e.jsx("p",{className:"text-sm text-gray-500",children:"Aktivních"})]})]})})}),e.jsx(h,{children:e.jsx(x,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(F,{className:`w-8 h-8 ${N>0?"text-red-500":"text-gray-300"}`}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:N}),e.jsx("p",{className:"text-sm text-gray-500",children:"Selhání"})]})]})})})]}),e.jsxs(h,{children:[e.jsxs(O,{className:"flex flex-row items-center justify-between",children:[e.jsxs(Z,{className:"flex items-center gap-2",children:[e.jsx(M,{className:"w-5 h-5"}),"Naplánované úlohy"]}),e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>
6r.invalidateQueries({queryKey:["admin-cron-jobs"]}),children:[e.jsx(v,{className:"w-4 h-4 mr-2"}),"Obnovit"]})]}),e.jsx(x,{children:_?e.jsx("div",{className:"space-y-3",children:[...Array(4)].map((s,a)=>e.jsx($,{className:"h-16 w-full"},a))}):e.jsxs(I,{children:[e.jsx(L,{children:e.jsxs(C,{children:[e.jsx(l,{children:"Služba"}),e.jsx(l,{children:"Plán"}),e.jsx(l,{children:"Stav"}),e.jsx(l,{children:"Poslední běh"}),e.jsx(l,{children:"Výsledek"}),e.jsx(l,{className:"text-right",children:"Akce"})]})}),e.jsx(Q,{children:t==null?void 0:t.map(s=>{const a=j[s.jobname];return e.jsxs(C,{children:[e.jsx(c,{children:e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900",children:(a==null?void 0:a.label)||s.jobname}),e.jsx("p",{className:"text-xs text-gray-500",children:(a==null?void 0:a.description)||s.jobname})]})}),e.jsx(c,{children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(D,{className:"w-3.5 h-3.5 text-gray-400"}),e.jsx("span",{className:"text-sm",children:G(s.schedule)})]})}),e.jsx(c,{children:s.active?e.jsxs(o,{className:"bg-green-100 text-green-700 hover:bg-green-100",children:[e.jsx(g,{className:"w-3 h-3 mr-1"}),"Aktivní"]}):e.jsxs(o,{variant:"secondary",className:"bg-gray-100 text-gray-500",children:[e.jsx(w,{className:"w-3 h-3 mr-1"}),"Pozastaveno"]})}),e.jsx(c,{children:s.last_run?e.jsx("span",{className:"text-sm text-gray-600",children:E(s.last_run)}):e.jsx("span",{className:"text-sm text-gray-400",children:"—"})}),e.jsxs(c,{children:[s.last_status==="succeeded"&&e.jsxs(o,{className:"bg-green-50 text-green-600 hover:bg-green-50",children:[e.jsx(g,{className:"w-3 h-3 mr-1"}),"OK"]}),s.last_status==="failed"&&e.jsxs(o,{variant:"destructive",className:"text-xs",children:[e.jsx(R,{className:"w-3 h-3 mr-1"}),"Selhání"]}),s.last_status&&!["succeeded","failed"].includes(s.last_status)&&e.jsx(o,{variant:"secondary",children:s.last_status}),!s.last_status&&e.jsx("span",{className:"text-sm text-gray-400",children:"—"})]}),e.jsx(c,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsxs(y,{variant:"outline",size:"sm",onClick:()=>T(s.jobname),disabled:f===s.jobname,children:[f===s.jobname?e.jsx(v,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(z,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"ml-1 hidden sm:inline",children:"Spustit"})]}),e.jsxs(y,{variant:s.active?"destructive":"default",size:"sm",onClick:()=>S(s.jobname,s.active),disabled:n===s.jobname,children:[n===s.jobname?e.jsx(v,{className:"w-3.5 h-3.5 animate-spin"}):s.active?e.jsx(w,{className:"w-3.5 h-3.5"}):e.jsx(z,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"ml-1 hidden sm:inline",children:s.active?"Pozastavit":"Aktivovat"})]})]})})]},s.jobid)})})]})})]})]})})}export{ke as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.