feat(mui): migrate WarehouseReceiptForm onto MUI kit
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,20 +1,34 @@
|
|||||||
import { useState, useEffect, useRef, useCallback, useId } from "react";
|
import { useState, useEffect, useRef, useCallback, useId } from "react";
|
||||||
import { useParams, useNavigate, Link } from "react-router-dom";
|
import { useParams, useNavigate, Link as RouterLink } from "react-router-dom";
|
||||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useQuery, useQueryClient } 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 CircularProgress from "@mui/material/CircularProgress";
|
||||||
import { useAlert } from "../context/AlertContext";
|
import { useAlert } from "../context/AlertContext";
|
||||||
import { useAuth } from "../context/AuthContext";
|
import { useAuth } from "../context/AuthContext";
|
||||||
import Forbidden from "../components/Forbidden";
|
import Forbidden from "../components/Forbidden";
|
||||||
import { motion } from "framer-motion";
|
import ItemPicker from "../components/warehouse/ItemPicker";
|
||||||
import FormField from "../components/FormField";
|
|
||||||
import AdminDatePicker from "../components/AdminDatePicker";
|
|
||||||
import SupplierSelect from "../components/warehouse/SupplierSelect";
|
|
||||||
import WarehouseMovementTable, {
|
|
||||||
type MovementItem,
|
|
||||||
} from "../components/warehouse/WarehouseMovementTable";
|
|
||||||
|
|
||||||
import apiFetch from "../utils/api";
|
import apiFetch from "../utils/api";
|
||||||
import { warehouseReceiptDetailOptions } from "../lib/queries/warehouse";
|
import {
|
||||||
|
warehouseReceiptDetailOptions,
|
||||||
|
warehouseSupplierListOptions,
|
||||||
|
warehouseLocationListOptions,
|
||||||
|
type WarehouseSupplier,
|
||||||
|
type WarehouseLocation,
|
||||||
|
} from "../lib/queries/warehouse";
|
||||||
import { useApiMutation } from "../lib/queries/mutations";
|
import { useApiMutation } from "../lib/queries/mutations";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Card,
|
||||||
|
TextField,
|
||||||
|
Select,
|
||||||
|
DateField,
|
||||||
|
Field,
|
||||||
|
LoadingState,
|
||||||
|
} from "../ui";
|
||||||
|
|
||||||
interface ReceiptForm {
|
interface ReceiptForm {
|
||||||
supplier_id: number | null;
|
supplier_id: number | null;
|
||||||
@@ -23,6 +37,84 @@ interface ReceiptForm {
|
|||||||
notes: string;
|
notes: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface MovementItem {
|
||||||
|
key: string;
|
||||||
|
item_id: number | null;
|
||||||
|
item_name?: string;
|
||||||
|
quantity: number;
|
||||||
|
unit_price: number;
|
||||||
|
location_id: number | null;
|
||||||
|
batch_id: number | null;
|
||||||
|
reservation_id: number | null;
|
||||||
|
notes: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseDecimal(raw: string): number {
|
||||||
|
const cleaned = raw.replace(/[eE+\-]/g, "");
|
||||||
|
const n = Number(cleaned);
|
||||||
|
return Number.isFinite(n) ? n : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const BackIcon = (
|
||||||
|
<svg
|
||||||
|
width="20"
|
||||||
|
height="20"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="2"
|
||||||
|
>
|
||||||
|
<path d="M19 12H5M12 19l-7-7 7-7" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
|
||||||
|
const RemoveIcon = (
|
||||||
|
<svg
|
||||||
|
width="16"
|
||||||
|
height="16"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="2"
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
>
|
||||||
|
<line x1="18" y1="6" x2="6" y2="18" />
|
||||||
|
<line x1="6" y1="6" x2="18" y2="18" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
|
||||||
|
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 UploadIcon = (
|
||||||
|
<svg
|
||||||
|
width="32"
|
||||||
|
height="32"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="1.5"
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
>
|
||||||
|
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
|
||||||
|
<polyline points="17 8 12 3 7 8" />
|
||||||
|
<line x1="12" y1="3" x2="12" y2="15" />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
|
||||||
export default function WarehouseReceiptForm() {
|
export default function WarehouseReceiptForm() {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const alert = useAlert();
|
const alert = useAlert();
|
||||||
@@ -68,6 +160,13 @@ export default function WarehouseReceiptForm() {
|
|||||||
warehouseReceiptDetailOptions(isEdit ? id : undefined),
|
warehouseReceiptDetailOptions(isEdit ? id : undefined),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const { data: suppliersData } = useQuery(
|
||||||
|
warehouseSupplierListOptions({ perPage: 100 }),
|
||||||
|
);
|
||||||
|
const suppliers: WarehouseSupplier[] = suppliersData?.data ?? [];
|
||||||
|
|
||||||
|
const { data: locations } = useQuery(warehouseLocationListOptions());
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
formInitialized.current = false;
|
formInitialized.current = false;
|
||||||
}, [id]);
|
}, [id]);
|
||||||
@@ -119,6 +218,22 @@ export default function WarehouseReceiptForm() {
|
|||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const removeItem = (index: number) => {
|
||||||
|
setItems((prev) => prev.filter((_, i) => i !== index));
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateItem = (
|
||||||
|
index: number,
|
||||||
|
field: keyof MovementItem,
|
||||||
|
value: unknown,
|
||||||
|
) => {
|
||||||
|
setItems((prev) => {
|
||||||
|
const updated = [...prev];
|
||||||
|
updated[index] = { ...updated[index], [field]: value };
|
||||||
|
return updated;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const validate = (): boolean => {
|
const validate = (): boolean => {
|
||||||
const newErrors: Record<string, string> = {};
|
const newErrors: Record<string, string> = {};
|
||||||
const validItems = items.filter((l) => l.item_id !== null);
|
const validItems = items.filter((l) => l.item_id !== null);
|
||||||
@@ -275,167 +390,263 @@ export default function WarehouseReceiptForm() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
if (isEdit && isPending) {
|
if (isEdit && isPending) {
|
||||||
return (
|
return <LoadingState />;
|
||||||
<div className="admin-loading">
|
|
||||||
<div className="admin-spinner" />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const supplierOptions = [
|
||||||
|
{ value: "", label: "-- bez dodavatele --" },
|
||||||
|
...suppliers.map((s) => ({
|
||||||
|
value: String(s.id),
|
||||||
|
label: `${s.name}${s.ico ? ` (${s.ico})` : ""}`,
|
||||||
|
})),
|
||||||
|
];
|
||||||
|
|
||||||
|
const locationOptions = [
|
||||||
|
{ value: "", label: "-- bez lokace --" },
|
||||||
|
...(locations ?? []).map((loc: WarehouseLocation) => ({
|
||||||
|
value: String(loc.id),
|
||||||
|
label: `${loc.code} - ${loc.name}`,
|
||||||
|
})),
|
||||||
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<Box>
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<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 style={{ display: "flex", alignItems: "center", gap: "1rem" }}>
|
<Box
|
||||||
<Link
|
sx={{
|
||||||
to="/warehouse/receipts"
|
display: "flex",
|
||||||
className="admin-btn-icon"
|
alignItems: "flex-start",
|
||||||
title="Zpět na seznam"
|
justifyContent: "space-between",
|
||||||
aria-label="Zpět na seznam"
|
flexWrap: "wrap",
|
||||||
>
|
gap: 2,
|
||||||
<svg
|
mb: 3,
|
||||||
width="20"
|
}}
|
||||||
height="20"
|
>
|
||||||
viewBox="0 0 24 24"
|
<Box sx={{ display: "flex", alignItems: "center", gap: 1.5 }}>
|
||||||
fill="none"
|
<IconButton
|
||||||
stroke="currentColor"
|
component={RouterLink}
|
||||||
strokeWidth="2"
|
to="/warehouse/receipts"
|
||||||
|
title="Zpět na seznam"
|
||||||
|
aria-label="Zpět na seznam"
|
||||||
>
|
>
|
||||||
<path d="M19 12H5M12 19l-7-7 7-7" />
|
{BackIcon}
|
||||||
</svg>
|
</IconButton>
|
||||||
</Link>
|
<Typography variant="h4">
|
||||||
<div>
|
|
||||||
<h1 className="admin-page-title">
|
|
||||||
{isEdit ? "Upravit příjmový doklad" : "Nový příjmový doklad"}
|
{isEdit ? "Upravit příjmový doklad" : "Nový příjmový doklad"}
|
||||||
</h1>
|
</Typography>
|
||||||
</div>
|
</Box>
|
||||||
</div>
|
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
|
||||||
<div className="admin-page-actions">
|
<Button
|
||||||
<button
|
variant="outlined"
|
||||||
type="button"
|
color="inherit"
|
||||||
onClick={handleSaveDraft}
|
onClick={handleSaveDraft}
|
||||||
className="admin-btn admin-btn-secondary"
|
disabled={saving}
|
||||||
disabled={saving}
|
>
|
||||||
>
|
{saving ? "Ukládání..." : "Uložit jako návrh"}
|
||||||
{saving ? "Ukládání..." : "Uložit jako návrh"}
|
</Button>
|
||||||
</button>
|
<Button onClick={handleSaveAndConfirm} disabled={saving}>
|
||||||
<button
|
{saving ? "Ukládání..." : "Uložit a potvrdit"}
|
||||||
type="button"
|
</Button>
|
||||||
onClick={handleSaveAndConfirm}
|
</Box>
|
||||||
className="admin-btn admin-btn-primary"
|
</Box>
|
||||||
disabled={saving}
|
|
||||||
>
|
|
||||||
{saving ? "Ukládání..." : "Uložit a potvrdit"}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|
||||||
{/* Header fields */}
|
{/* Header fields */}
|
||||||
<motion.div
|
<motion.div
|
||||||
className="admin-card"
|
|
||||||
initial={{ opacity: 0, y: 12 }}
|
initial={{ opacity: 0, y: 12 }}
|
||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1, y: 0 }}
|
||||||
transition={{ duration: 0.25, delay: 0.06 }}
|
transition={{ duration: 0.25, delay: 0.06 }}
|
||||||
>
|
>
|
||||||
<div className="admin-card-body">
|
<Card sx={{ mb: 3 }}>
|
||||||
<h3 className="admin-card-title">Základní údaje</h3>
|
<Typography variant="subtitle2" sx={{ mb: 2, fontWeight: 600 }}>
|
||||||
<div className="admin-form">
|
Základní údaje
|
||||||
<FormField label="Dodavatel">
|
</Typography>
|
||||||
<SupplierSelect
|
<Field label="Dodavatel">
|
||||||
value={form.supplier_id}
|
<Select
|
||||||
onChange={(val) =>
|
value={form.supplier_id === null ? "" : String(form.supplier_id)}
|
||||||
setForm((prev) => ({ ...prev, supplier_id: val }))
|
onChange={(val) =>
|
||||||
}
|
setForm((prev) => ({
|
||||||
/>
|
...prev,
|
||||||
</FormField>
|
supplier_id: val ? Number(val) : null,
|
||||||
<div className="admin-form-row">
|
}))
|
||||||
<FormField label="Číslo dodacího listu">
|
}
|
||||||
<input
|
options={supplierOptions}
|
||||||
type="text"
|
/>
|
||||||
value={form.delivery_note_number}
|
</Field>
|
||||||
onChange={(e) =>
|
<Box
|
||||||
setForm((prev) => ({
|
sx={{
|
||||||
...prev,
|
display: "grid",
|
||||||
delivery_note_number: e.target.value,
|
gridTemplateColumns: { xs: "1fr", sm: "1fr 1fr" },
|
||||||
}))
|
gap: 2,
|
||||||
}
|
}}
|
||||||
className="admin-form-input"
|
>
|
||||||
placeholder="Např. DL-2024-001"
|
<Field label="Číslo dodacího listu">
|
||||||
/>
|
<TextField
|
||||||
</FormField>
|
value={form.delivery_note_number}
|
||||||
<FormField label="Datum dodacího listu">
|
|
||||||
<AdminDatePicker
|
|
||||||
mode="date"
|
|
||||||
value={form.delivery_note_date}
|
|
||||||
onChange={(val) =>
|
|
||||||
setForm((prev) => ({
|
|
||||||
...prev,
|
|
||||||
delivery_note_date: val,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</FormField>
|
|
||||||
</div>
|
|
||||||
<FormField label="Poznámky">
|
|
||||||
<textarea
|
|
||||||
value={form.notes}
|
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
setForm((prev) => ({ ...prev, notes: e.target.value }))
|
setForm((prev) => ({
|
||||||
|
...prev,
|
||||||
|
delivery_note_number: e.target.value,
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
className="admin-form-input"
|
placeholder="Např. DL-2024-001"
|
||||||
rows={3}
|
|
||||||
placeholder="Volitelné poznámky"
|
|
||||||
/>
|
/>
|
||||||
</FormField>
|
</Field>
|
||||||
</div>
|
<Field label="Datum dodacího listu">
|
||||||
</div>
|
<DateField
|
||||||
|
value={form.delivery_note_date}
|
||||||
|
onChange={(val) =>
|
||||||
|
setForm((prev) => ({
|
||||||
|
...prev,
|
||||||
|
delivery_note_date: val,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Field>
|
||||||
|
</Box>
|
||||||
|
<Field label="Poznámky">
|
||||||
|
<TextField
|
||||||
|
multiline
|
||||||
|
minRows={3}
|
||||||
|
value={form.notes}
|
||||||
|
onChange={(e) =>
|
||||||
|
setForm((prev) => ({ ...prev, notes: e.target.value }))
|
||||||
|
}
|
||||||
|
placeholder="Volitelné poznámky"
|
||||||
|
/>
|
||||||
|
</Field>
|
||||||
|
</Card>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|
||||||
{/* Lines */}
|
{/* Lines */}
|
||||||
<motion.div
|
<motion.div
|
||||||
className="admin-card"
|
|
||||||
initial={{ opacity: 0, y: 12 }}
|
initial={{ opacity: 0, y: 12 }}
|
||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1, y: 0 }}
|
||||||
transition={{ duration: 0.25, delay: 0.08 }}
|
transition={{ duration: 0.25, delay: 0.08 }}
|
||||||
>
|
>
|
||||||
<div className="admin-card-body">
|
<Card sx={{ mb: 3 }}>
|
||||||
<h3 className="admin-card-title">Položky</h3>
|
<Typography variant="subtitle2" sx={{ mb: 2, fontWeight: 600 }}>
|
||||||
|
Položky
|
||||||
|
</Typography>
|
||||||
{errors.items && (
|
{errors.items && (
|
||||||
<div
|
<Typography
|
||||||
className="admin-form-error"
|
variant="caption"
|
||||||
style={{ marginBottom: "0.75rem" }}
|
color="error"
|
||||||
|
sx={{ display: "block", mb: 1.5 }}
|
||||||
>
|
>
|
||||||
{errors.items}
|
{errors.items}
|
||||||
</div>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
<WarehouseMovementTable
|
<Box sx={{ display: "flex", flexDirection: "column", gap: 1.5 }}>
|
||||||
items={items}
|
{items.map((item, index) => (
|
||||||
onChange={setItems}
|
<Box
|
||||||
mode="receipt"
|
key={item.key}
|
||||||
/>
|
sx={{
|
||||||
</div>
|
display: "grid",
|
||||||
|
gridTemplateColumns: {
|
||||||
|
xs: "1fr",
|
||||||
|
md: "minmax(180px, 2fr) 110px 110px minmax(140px, 1.2fr) minmax(140px, 1.5fr) auto",
|
||||||
|
},
|
||||||
|
gap: 1,
|
||||||
|
alignItems: "start",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ItemPicker
|
||||||
|
value={item.item_id}
|
||||||
|
itemName={item.item_name}
|
||||||
|
onChange={(id) => updateItem(index, "item_id", id)}
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
type="number"
|
||||||
|
value={item.quantity || ""}
|
||||||
|
onChange={(e) =>
|
||||||
|
updateItem(index, "quantity", parseDecimal(e.target.value))
|
||||||
|
}
|
||||||
|
inputProps={{
|
||||||
|
min: 0,
|
||||||
|
step: 0.001,
|
||||||
|
inputMode: "decimal",
|
||||||
|
pattern: "[0-9]+([\\.,][0-9]+)?",
|
||||||
|
"aria-label": `Množství, řádek ${index + 1}`,
|
||||||
|
}}
|
||||||
|
placeholder="Množství"
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
type="number"
|
||||||
|
value={item.unit_price || ""}
|
||||||
|
onChange={(e) =>
|
||||||
|
updateItem(
|
||||||
|
index,
|
||||||
|
"unit_price",
|
||||||
|
parseDecimal(e.target.value),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
inputProps={{
|
||||||
|
min: 0,
|
||||||
|
step: 0.01,
|
||||||
|
inputMode: "decimal",
|
||||||
|
pattern: "[0-9]+([\\.,][0-9]+)?",
|
||||||
|
"aria-label": `Cena za kus, řádek ${index + 1}`,
|
||||||
|
}}
|
||||||
|
placeholder="Cena/ks"
|
||||||
|
/>
|
||||||
|
<Select
|
||||||
|
value={
|
||||||
|
item.location_id === null ? "" : String(item.location_id)
|
||||||
|
}
|
||||||
|
onChange={(val) =>
|
||||||
|
updateItem(index, "location_id", val ? Number(val) : null)
|
||||||
|
}
|
||||||
|
options={locationOptions}
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
value={item.notes ?? ""}
|
||||||
|
onChange={(e) => updateItem(index, "notes", e.target.value)}
|
||||||
|
placeholder="Poznámka"
|
||||||
|
/>
|
||||||
|
<IconButton
|
||||||
|
color="error"
|
||||||
|
onClick={() => removeItem(index)}
|
||||||
|
title="Odebrat řádek"
|
||||||
|
aria-label="Odebrat řádek"
|
||||||
|
sx={{ justifySelf: { xs: "start", md: "center" } }}
|
||||||
|
>
|
||||||
|
{RemoveIcon}
|
||||||
|
</IconButton>
|
||||||
|
</Box>
|
||||||
|
))}
|
||||||
|
</Box>
|
||||||
|
<Button
|
||||||
|
variant="outlined"
|
||||||
|
color="inherit"
|
||||||
|
startIcon={PlusIcon}
|
||||||
|
onClick={addItem}
|
||||||
|
sx={{ mt: 2 }}
|
||||||
|
>
|
||||||
|
Přidat položku
|
||||||
|
</Button>
|
||||||
|
</Card>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|
||||||
{/* File upload — only in edit mode for existing receipts */}
|
{/* File upload — only in edit mode for existing receipts */}
|
||||||
{isEdit && (
|
{isEdit && (
|
||||||
<motion.div
|
<motion.div
|
||||||
className="admin-card"
|
|
||||||
initial={{ opacity: 0, y: 12 }}
|
initial={{ opacity: 0, y: 12 }}
|
||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1, y: 0 }}
|
||||||
transition={{ duration: 0.25, delay: 0.1 }}
|
transition={{ duration: 0.25, delay: 0.1 }}
|
||||||
>
|
>
|
||||||
<div className="admin-card-body">
|
<Card sx={{ mb: 3 }}>
|
||||||
<h3 className="admin-card-title">Přílohy</h3>
|
<Typography variant="subtitle2" sx={{ mb: 2, fontWeight: 600 }}>
|
||||||
<div
|
Přílohy
|
||||||
className="admin-warehouse-upload"
|
</Typography>
|
||||||
|
<Box
|
||||||
onDrop={handleDrop}
|
onDrop={handleDrop}
|
||||||
onDragOver={handleDragOver}
|
onDragOver={handleDragOver}
|
||||||
style={{ opacity: uploadingFiles ? 0.6 : 1 }}
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const input = document.createElement("input");
|
const input = document.createElement("input");
|
||||||
input.type = "file";
|
input.type = "file";
|
||||||
@@ -447,41 +658,46 @@ export default function WarehouseReceiptForm() {
|
|||||||
};
|
};
|
||||||
input.click();
|
input.click();
|
||||||
}}
|
}}
|
||||||
|
sx={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
gap: 1,
|
||||||
|
p: 4,
|
||||||
|
border: "2px dashed",
|
||||||
|
borderColor: "divider",
|
||||||
|
borderRadius: 1,
|
||||||
|
color: "text.secondary",
|
||||||
|
cursor: "pointer",
|
||||||
|
opacity: uploadingFiles ? 0.6 : 1,
|
||||||
|
transition: "border-color .2s, background-color .2s",
|
||||||
|
"&:hover": {
|
||||||
|
borderColor: "primary.main",
|
||||||
|
bgcolor: "action.hover",
|
||||||
|
},
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{uploadingFiles ? (
|
{uploadingFiles ? (
|
||||||
<>
|
<>
|
||||||
<div className="admin-spinner admin-spinner-sm" />
|
<CircularProgress size={28} />
|
||||||
<p style={{ marginTop: "0.5rem" }}>Nahrávání...</p>
|
<Typography variant="body2">Nahrávání...</Typography>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<svg
|
{UploadIcon}
|
||||||
width="32"
|
<Typography variant="body2">
|
||||||
height="32"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
fill="none"
|
|
||||||
stroke="currentColor"
|
|
||||||
strokeWidth="1.5"
|
|
||||||
strokeLinecap="round"
|
|
||||||
strokeLinejoin="round"
|
|
||||||
className="admin-warehouse-upload-icon"
|
|
||||||
>
|
|
||||||
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
|
|
||||||
<polyline points="17 8 12 3 7 8" />
|
|
||||||
<line x1="12" y1="3" x2="12" y2="15" />
|
|
||||||
</svg>
|
|
||||||
<p className="admin-warehouse-upload-text">
|
|
||||||
Přetáhněte soubory sem nebo klikněte pro výběr
|
Přetáhněte soubory sem nebo klikněte pro výběr
|
||||||
</p>
|
</Typography>
|
||||||
<p className="admin-warehouse-upload-hint">
|
<Typography variant="caption" color="text.secondary">
|
||||||
Dodací listy, faktury a další dokumenty
|
Dodací listy, faktury a další dokumenty
|
||||||
</p>
|
</Typography>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</Box>
|
||||||
</div>
|
</Card>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user