feat(mui): migrate Offers Templates (Šablony) onto MUI kit

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-07 00:15:43 +02:00
parent 4b94efbb43
commit 5d919c3c90

View File

@@ -1,11 +1,11 @@
import { useState, useRef, type ReactNode } from "react"; import { useState, useRef } from "react";
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import { motion } from "framer-motion";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import IconButton from "@mui/material/IconButton";
import { useAlert } from "../context/AlertContext"; import { useAlert } from "../context/AlertContext";
import { useAuth } from "../context/AuthContext"; import { useAuth } from "../context/AuthContext";
import { motion } from "framer-motion";
import ConfirmModal from "../components/ConfirmModal";
import FormModal from "../components/FormModal";
import FormField from "../components/FormField";
import Forbidden from "../components/Forbidden"; import Forbidden from "../components/Forbidden";
import RichEditor from "../components/RichEditor"; import RichEditor from "../components/RichEditor";
import { import {
@@ -16,8 +16,24 @@ import {
type ScopeSection, type ScopeSection,
} from "../lib/queries/offers"; } from "../lib/queries/offers";
import { useApiMutation } from "../lib/queries/mutations"; import { useApiMutation } from "../lib/queries/mutations";
import apiFetch from "../utils/api"; import apiFetch from "../utils/api";
import {
Button,
Card,
DataTable,
Modal,
ConfirmDialog,
Field,
TextField,
StatusChip,
PageHeader,
EmptyState,
LoadingState,
Tabs,
TabPanel,
type DataColumn,
type TabDef,
} from "../ui";
const API_BASE = "/api/admin"; const API_BASE = "/api/admin";
@@ -33,45 +49,130 @@ interface ScopeForm {
sections: ScopeSection[]; sections: ScopeSection[];
} }
const PlusIcon = (
<svg
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
>
<line x1="12" y1="5" x2="12" y2="19" />
<line x1="5" y1="12" x2="19" y2="12" />
</svg>
);
const EditIcon = (
<svg
width="18"
height="18"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" />
</svg>
);
const DeleteIcon = (
<svg
width="18"
height="18"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<polyline points="3 6 5 6 21 6" />
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
</svg>
);
const UpIcon = (
<svg
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
>
<path d="M18 15l-6-6-6 6" />
</svg>
);
const DownIcon = (
<svg
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
>
<path d="M6 9l6 6 6-6" />
</svg>
);
const RemoveIcon = (
<svg
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
>
<line x1="18" y1="6" x2="6" y2="18" />
<line x1="6" y1="6" x2="18" y2="18" />
</svg>
);
export default function OffersTemplates() { export default function OffersTemplates() {
const { hasPermission } = useAuth(); const { hasPermission } = useAuth();
const [activeTab, setActiveTab] = useState<"items" | "scopes">("items"); const [activeTab, setActiveTab] = useState<"items" | "scopes">("items");
if (!hasPermission("settings.templates")) return <Forbidden />; if (!hasPermission("settings.templates")) return <Forbidden />;
const tabs: TabDef[] = [
{ value: "items", label: "Šablony položek" },
{ value: "scopes", label: "Šablony rozsahu" },
];
return ( return (
<div> <Box>
<motion.div <motion.div
className="admin-page-header"
initial={{ opacity: 0, y: 12 }} initial={{ opacity: 0, y: 12 }}
animate={{ opacity: 1, y: 0 }} animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.25 }} transition={{ duration: 0.25 }}
> >
<div> <PageHeader
<h1 className="admin-page-title">Šablony</h1> title="Šablony"
<p className="admin-page-subtitle"> subtitle="Šablony položek a rozsahu projektu"
Šablony položek a rozsahu projektu />
</p>
</div>
</motion.div> </motion.div>
<div className="admin-tabs mb-4"> <motion.div
<button initial={{ opacity: 0, y: 12 }}
className={`admin-tab ${activeTab === "items" ? "active" : ""}`} animate={{ opacity: 1, y: 0 }}
onClick={() => setActiveTab("items")} transition={{ duration: 0.25, delay: 0.06 }}
> >
Šablony položek <Tabs
</button> value={activeTab}
<button onChange={(v) => setActiveTab(v as "items" | "scopes")}
className={`admin-tab ${activeTab === "scopes" ? "active" : ""}`} tabs={tabs}
onClick={() => setActiveTab("scopes")} />
> </motion.div>
Šablony rozsahu
</button>
</div>
{activeTab === "items" ? <ItemTemplatesTab /> : <ScopeTemplatesTab />} <TabPanel value="items" current={activeTab}>
</div> <ItemTemplatesTab />
</TabPanel>
<TabPanel value="scopes" current={activeTab}>
<ScopeTemplatesTab />
</TabPanel>
</Box>
); );
} }
@@ -169,155 +270,135 @@ function ItemTemplatesTab() {
}; };
if (isPending) { if (isPending) {
return ( return <LoadingState />;
<div className="admin-loading">
<div className="admin-spinner" />
</div>
);
} }
return (
<> const columns: DataColumn<ItemTemplate>[] = [
<motion.div {
className="admin-card" key: "name",
initial={{ opacity: 0, y: 12 }} header: "Název",
animate={{ opacity: 1, y: 0 }} width: "26%",
transition={{ duration: 0.25, delay: 0.06 }} bold: true,
> render: (t) => t.name,
<div className="admin-card-header flex-between"> },
<h3 className="admin-card-title"> {
Šablony položek ({templates.length}) key: "description",
</h3> header: "Popis",
<button width: "30%",
onClick={openCreate} render: (t) => (
className="admin-btn admin-btn-primary admin-btn-sm" <Box component="span" sx={{ color: "text.secondary" }}>
>
<svg
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
>
<line x1="12" y1="5" x2="12" y2="19" />
<line x1="5" y1="12" x2="19" y2="12" />
</svg>
Přidat
</button>
</div>
<div className="admin-card-body">
{templates.length === 0 ? (
<div className="admin-empty-state">
<p>Zatím žádné šablony položek.</p>
</div>
) : (
<div className="admin-table-responsive">
<table className="admin-table">
<thead>
<tr>
<th>Název</th>
<th>Popis</th>
<th>Cena</th>
<th>Kategorie</th>
<th>Akce</th>
</tr>
</thead>
<tbody>
{templates.map((t) => (
<tr key={t.id}>
<td className="fw-500">{t.name}</td>
<td style={{ color: "var(--text-secondary)" }}>
{t.description || "—"} {t.description || "—"}
</td> </Box>
<td>{Number(t.default_price).toFixed(2)}</td> ),
<td style={{ color: "var(--text-secondary)" }}> },
{
key: "default_price",
header: "Cena",
width: "14%",
mono: true,
render: (t) => Number(t.default_price).toFixed(2),
},
{
key: "category",
header: "Kategorie",
width: "18%",
render: (t) => (
<Box component="span" sx={{ color: "text.secondary" }}>
{t.category || "—"} {t.category || "—"}
</td> </Box>
<td> ),
<div className="admin-table-actions"> },
<button {
key: "actions",
header: "Akce",
width: "12%",
align: "right",
render: (t) => (
<Box sx={{ display: "flex", gap: 0.5, justifyContent: "flex-end" }}>
<IconButton
size="small"
onClick={() => openEdit(t)} onClick={() => openEdit(t)}
className="admin-btn-icon"
title="Upravit"
aria-label="Upravit" aria-label="Upravit"
title="Upravit"
> >
<svg {EditIcon}
width="18" </IconButton>
height="18" <IconButton
viewBox="0 0 24 24" size="small"
fill="none" color="error"
stroke="currentColor" onClick={() => setDeleteConfirm({ show: true, template: t })}
strokeWidth="2"
>
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" />
</svg>
</button>
<button
onClick={() =>
setDeleteConfirm({ show: true, template: t })
}
className="admin-btn-icon danger"
title="Smazat"
aria-label="Smazat" aria-label="Smazat"
title="Smazat"
> >
<svg {DeleteIcon}
width="18" </IconButton>
height="18" </Box>
viewBox="0 0 24 24" ),
fill="none" },
stroke="currentColor" ];
strokeWidth="2"
return (
<Box>
<Box
sx={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
mb: 2,
}}
> >
<polyline points="3 6 5 6 21 6" /> <Typography variant="subtitle1" sx={{ fontWeight: 600 }}>
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" /> Šablony položek ({templates.length})
</svg> </Typography>
</button> <Button size="small" startIcon={PlusIcon} onClick={openCreate}>
</div> Přidat
</td> </Button>
</tr> </Box>
))}
</tbody> <Card>
</table> <DataTable<ItemTemplate>
</div> columns={columns}
)} rows={templates}
</div> rowKey={(t) => t.id}
</motion.div> empty={<EmptyState title="Zatím žádné šablony položek." />}
/>
</Card>
{/* Item Template Modal */} {/* Item Template Modal */}
<FormModal <Modal
isOpen={showModal} isOpen={showModal}
onClose={() => setShowModal(false)} onClose={() => setShowModal(false)}
onSubmit={handleSubmit} onSubmit={handleSubmit}
title={editingTemplate ? "Upravit šablonu" : "Nová šablona položky"} title={editingTemplate ? "Upravit šablonu" : "Nová šablona položky"}
submitLabel={editingTemplate ? "Uložit" : "Vytvořit"} submitText={editingTemplate ? "Uložit" : "Vytvořit"}
loading={saving} loading={saving}
maxWidth="md"
> >
<div className="admin-form"> <Field label="Název" required>
<FormField label="Název" required> <TextField
<input
type="text"
value={form.name} value={form.name}
onChange={(e) => setForm((p) => ({ ...p, name: e.target.value }))} onChange={(e) => setForm((p) => ({ ...p, name: e.target.value }))}
className="admin-form-input"
/> />
</FormField> </Field>
<FormField label="Popis"> <Field label="Popis">
<textarea <TextField
value={form.description} value={form.description}
onChange={(e) => onChange={(e) =>
setForm((p) => ({ setForm((p) => ({ ...p, description: e.target.value }))
...p,
description: e.target.value,
}))
} }
className="admin-form-input" multiline
rows={2} rows={2}
/> />
</FormField> </Field>
<div className="admin-form-row"> <Box
<FormField label="Výchozí cena"> sx={{
<input display: "grid",
gridTemplateColumns: { xs: "1fr", sm: "1fr 1fr" },
gap: 2,
}}
>
<Field label="Výchozí cena">
<TextField
type="number" type="number"
value={form.default_price} value={form.default_price}
onChange={(e) => onChange={(e) =>
@@ -326,26 +407,21 @@ function ItemTemplatesTab() {
default_price: parseFloat(e.target.value), default_price: parseFloat(e.target.value),
})) }))
} }
className="admin-form-input" slotProps={{ htmlInput: { step: "0.01", inputMode: "decimal" } }}
step="0.01"
inputMode="decimal"
/> />
</FormField> </Field>
<FormField label="Kategorie"> <Field label="Kategorie">
<input <TextField
type="text"
value={form.category} value={form.category}
onChange={(e) => onChange={(e) =>
setForm((p) => ({ ...p, category: e.target.value })) setForm((p) => ({ ...p, category: e.target.value }))
} }
className="admin-form-input"
/> />
</FormField> </Field>
</div> </Box>
</div> </Modal>
</FormModal>
<ConfirmModal <ConfirmDialog
isOpen={deleteConfirm.show} isOpen={deleteConfirm.show}
onClose={() => setDeleteConfirm({ show: false, template: null })} onClose={() => setDeleteConfirm({ show: false, template: null })}
onConfirm={handleDelete} onConfirm={handleDelete}
@@ -353,10 +429,10 @@ function ItemTemplatesTab() {
message={`Opravdu chcete smazat šablonu "${deleteConfirm.template?.name}"?`} message={`Opravdu chcete smazat šablonu "${deleteConfirm.template?.name}"?`}
confirmText="Smazat" confirmText="Smazat"
cancelText="Zrušit" cancelText="Zrušit"
type="danger" confirmVariant="danger"
loading={deleting} loading={deleting}
/> />
</> </Box>
); );
} }
@@ -533,268 +609,256 @@ function ScopeTemplatesTab() {
} }
}; };
return ( if (isPending) {
<> return <LoadingState />;
<motion.div
className="admin-card"
initial={{ opacity: 0, y: 12 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.25, delay: 0.06 }}
>
<div className="admin-card-header flex-between">
<h3 className="admin-card-title">
Šablony rozsahu ({templates.length})
</h3>
<button
onClick={openCreate}
className="admin-btn admin-btn-primary admin-btn-sm"
>
<svg
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
>
<line x1="12" y1="5" x2="12" y2="19" />
<line x1="5" y1="12" x2="19" y2="12" />
</svg>
Přidat
</button>
</div>
<div className="admin-card-body">
{templates.length === 0 ? (
<div className="admin-empty-state">
<p>Zatím žádné šablony rozsahu.</p>
</div>
) : (
<div className="admin-table-responsive">
<table className="admin-table">
<thead>
<tr>
<th>Název</th>
<th>Akce</th>
</tr>
</thead>
<tbody>
{templates.map((t) => (
<tr key={t.id}>
<td className="fw-500">{t.name}</td>
<td>
<div className="admin-table-actions">
<button
onClick={() => openEdit(t)}
className="admin-btn-icon"
title="Upravit"
aria-label="Upravit"
>
<svg
width="18"
height="18"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
>
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" />
</svg>
</button>
<button
onClick={() =>
setDeleteConfirm({ show: true, template: t })
} }
className="admin-btn-icon danger"
title="Smazat" const columns: DataColumn<ScopeTemplate>[] = [
{
key: "name",
header: "Název",
width: "80%",
bold: true,
render: (t) => t.name,
},
{
key: "actions",
header: "Akce",
width: "20%",
align: "right",
render: (t) => (
<Box sx={{ display: "flex", gap: 0.5, justifyContent: "flex-end" }}>
<IconButton
size="small"
onClick={() => openEdit(t)}
aria-label="Upravit"
title="Upravit"
>
{EditIcon}
</IconButton>
<IconButton
size="small"
color="error"
onClick={() => setDeleteConfirm({ show: true, template: t })}
aria-label="Smazat" aria-label="Smazat"
title="Smazat"
> >
<svg {DeleteIcon}
width="18" </IconButton>
height="18" </Box>
viewBox="0 0 24 24" ),
fill="none" },
stroke="currentColor" ];
strokeWidth="2"
return (
<Box>
<Box
sx={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
mb: 2,
}}
> >
<polyline points="3 6 5 6 21 6" /> <Typography variant="subtitle1" sx={{ fontWeight: 600 }}>
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" /> Šablony rozsahu ({templates.length})
</svg> </Typography>
</button> <Button size="small" startIcon={PlusIcon} onClick={openCreate}>
</div> Přidat
</td> </Button>
</tr> </Box>
))}
</tbody> <Card>
</table> <DataTable<ScopeTemplate>
</div> columns={columns}
)} rows={templates}
</div> rowKey={(t) => t.id}
</motion.div> empty={<EmptyState title="Zatím žádné šablony rozsahu." />}
/>
</Card>
{/* Scope Template Modal (large) */} {/* Scope Template Modal (large) */}
<FormModal <Modal
isOpen={showModal} isOpen={showModal}
onClose={() => setShowModal(false)} onClose={() => setShowModal(false)}
onSubmit={handleSubmit} onSubmit={handleSubmit}
title={ title={
editingTemplate ? "Upravit šablonu rozsahu" : "Nová šablona rozsahu" editingTemplate ? "Upravit šablonu rozsahu" : "Nová šablona rozsahu"
} }
submitLabel={editingTemplate ? "Uložit" : "Vytvořit"} submitText={editingTemplate ? "Uložit" : "Vytvořit"}
size="lg" maxWidth="lg"
loading={saving} loading={saving}
> >
<div className="admin-form"> <Field label="Název šablony" required>
<FormField label="Název šablony" required> <TextField
<input
type="text"
value={form.name} value={form.name}
onChange={(e) => setForm((p) => ({ ...p, name: e.target.value }))} onChange={(e) => setForm((p) => ({ ...p, name: e.target.value }))}
className="admin-form-input"
/> />
</FormField> </Field>
<div className="admin-form-group"> <Box>
<label className="admin-form-label mb-2">Sekce</label> <Typography
<div className="admin-scope-list"> component="label"
variant="body2"
sx={{
display: "block",
mb: 1,
fontWeight: 600,
color: "text.secondary",
}}
>
Sekce
</Typography>
<Box sx={{ display: "flex", flexDirection: "column", gap: 2 }}>
{form.sections.map((section, index) => ( {form.sections.map((section, index) => (
<div key={section._key} className="admin-scope-section"> <Box
<div className="admin-scope-section-header"> key={section._key}
<span className="admin-scope-number">{index + 1}.</span> sx={{
<span className="admin-scope-title"> border: 1,
{section.title || borderColor: "divider",
section.title_cz || borderRadius: 2,
`Sekce ${index + 1}`} p: 2,
</span> }}
<div className="admin-scope-actions"> >
<button <Box
type="button" sx={{
display: "flex",
alignItems: "center",
gap: 1,
mb: 1.5,
}}
>
<Typography
variant="body2"
sx={{ fontWeight: 700, color: "text.secondary" }}
>
{index + 1}.
</Typography>
<Typography
variant="body2"
sx={{ fontWeight: 600, flex: 1 }}
noWrap
>
{section.title || section.title_cz || `Sekce ${index + 1}`}
</Typography>
<IconButton
size="small"
onClick={() => moveSection(index, -1)} onClick={() => moveSection(index, -1)}
disabled={index === 0} disabled={index === 0}
className="admin-btn-icon"
title="Posunout nahoru" title="Posunout nahoru"
aria-label="Posunout nahoru" aria-label="Posunout nahoru"
> >
<svg {UpIcon}
width="14" </IconButton>
height="14" <IconButton
viewBox="0 0 24 24" size="small"
fill="none"
stroke="currentColor"
strokeWidth="2"
>
<path d="M18 15l-6-6-6 6" />
</svg>
</button>
<button
type="button"
onClick={() => moveSection(index, 1)} onClick={() => moveSection(index, 1)}
disabled={index === form.sections.length - 1} disabled={index === form.sections.length - 1}
className="admin-btn-icon"
title="Posunout dolů" title="Posunout dolů"
aria-label="Posunout dolů" aria-label="Posunout dolů"
> >
<svg {DownIcon}
width="14" </IconButton>
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
>
<path d="M6 9l6 6 6-6" />
</svg>
</button>
{form.sections.length > 1 && ( {form.sections.length > 1 && (
<button <IconButton
type="button" size="small"
color="error"
onClick={() => removeSection(index)} onClick={() => removeSection(index)}
className="admin-btn-icon danger"
title="Odebrat" title="Odebrat"
aria-label="Odebrat" aria-label="Odebrat"
> >
<svg {RemoveIcon}
width="14" </IconButton>
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
>
<line x1="18" y1="6" x2="6" y2="18" />
<line x1="6" y1="6" x2="18" y2="18" />
</svg>
</button>
)} )}
</div> </Box>
</div>
<div className="admin-form"> <Box
<div className="admin-form-row"> sx={{
<FormField display: "grid",
label={ gridTemplateColumns: { xs: "1fr", sm: "1fr 1fr" },
<> gap: 2,
<span className="offers-lang-badge">EN</span> Název }}
sekce
</>
}
> >
<input <Box sx={{ mb: 2 }}>
type="text" <Box
sx={{
display: "flex",
alignItems: "center",
gap: 0.75,
mb: 0.5,
}}
>
<StatusChip label="EN" color="info" />
<Typography
component="label"
variant="body2"
sx={{ fontWeight: 600, color: "text.secondary" }}
>
Název sekce
</Typography>
</Box>
<TextField
value={section.title} value={section.title}
onChange={(e) => onChange={(e) =>
updateSection(index, "title", e.target.value) updateSection(index, "title", e.target.value)
} }
className="admin-form-input"
placeholder="Název sekce (anglicky)" placeholder="Název sekce (anglicky)"
/> />
</FormField> </Box>
<FormField <Box sx={{ mb: 2 }}>
label={ <Box
<> sx={{
<span className="offers-lang-badge offers-lang-badge-cz"> display: "flex",
CZ alignItems: "center",
</span>{" "} gap: 0.75,
Název sekce mb: 0.5,
</> }}
}
> >
<input <StatusChip label="CZ" color="success" />
type="text" <Typography
component="label"
variant="body2"
sx={{ fontWeight: 600, color: "text.secondary" }}
>
Název sekce
</Typography>
</Box>
<TextField
value={section.title_cz} value={section.title_cz}
onChange={(e) => onChange={(e) =>
updateSection(index, "title_cz", e.target.value) updateSection(index, "title_cz", e.target.value)
} }
className="admin-form-input"
placeholder="Název sekce (česky)" placeholder="Název sekce (česky)"
/> />
</FormField> </Box>
</div> </Box>
<FormField label="Obsah">
<Field label="Obsah">
<RichEditor <RichEditor
value={section.content} value={section.content}
onChange={(val) => updateSection(index, "content", val)} onChange={(val) => updateSection(index, "content", val)}
placeholder="Obsah sekce..." placeholder="Obsah sekce..."
minHeight="150px" minHeight="150px"
/> />
</FormField> </Field>
</div> </Box>
</div>
))} ))}
</div> </Box>
<div style={{ marginTop: "0.75rem" }}> <Box sx={{ mt: 1.5 }}>
<button <Button
type="button" variant="outlined"
color="inherit"
size="small"
startIcon={PlusIcon}
onClick={addSection} onClick={addSection}
className="admin-btn admin-btn-secondary admin-btn-sm"
> >
+ Přidat sekci Přidat sekci
</button> </Button>
</div> </Box>
</div> </Box>
</div> </Modal>
</FormModal>
<ConfirmModal <ConfirmDialog
isOpen={deleteConfirm.show} isOpen={deleteConfirm.show}
onClose={() => setDeleteConfirm({ show: false, template: null })} onClose={() => setDeleteConfirm({ show: false, template: null })}
onConfirm={handleDelete} onConfirm={handleDelete}
@@ -802,9 +866,9 @@ function ScopeTemplatesTab() {
message={`Opravdu chcete smazat šablonu "${deleteConfirm.template?.name}"?`} message={`Opravdu chcete smazat šablonu "${deleteConfirm.template?.name}"?`}
confirmText="Smazat" confirmText="Smazat"
cancelText="Zrušit" cancelText="Zrušit"
type="danger" confirmVariant="danger"
loading={deleting} loading={deleting}
/> />
</> </Box>
); );
} }