Docker-Images bauen und veröffentlichen / build (, omsorgCore/Dockerfile, omsorgcore) (push) Successful in 3s
Docker-Images bauen und veröffentlichen / build (, omsorgWeb/Dockerfile, omsorgweb) (push) Failing after 4s
Docker-Images bauen und veröffentlichen / build (VITE_OMSORG_CORE_URL=${{ vars.OMSORG_CORE_PUBLIC_URL }}, omsorgapp/Dockerfile, omsorgapp) (push) Successful in 3s
- omsorgapp: drop Electron, run as a plain Vite/React browser app; refresh token moves to an HttpOnly cookie (omsorgCore), CORS added for the new browser origin, document download/preview switched to Blob-based browser APIs. - Add Dockerfiles for omsorgCore, omsorgapp, and omsorgWeb, a docker-compose.yml wiring Postgres/MySQL/all three apps together, and a Gitea Actions workflow that builds and pushes images to the repo's container registry on push to main and on version tags. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
68 lines
2.0 KiB
React
68 lines
2.0 KiB
React
import { useState } from "react";
|
|
|
|
import OrderForm, { orderFormToPayload, orderToFormValues, FormActions } from "./OrderForm";
|
|
import ModalPortal from "../../components/ui/ModalPortal";
|
|
|
|
function errorMessage(result) {
|
|
if (result.status === 403) {
|
|
return "Keine Berechtigung, Aufträge zu bearbeiten.";
|
|
}
|
|
if (result.status === 400) {
|
|
return typeof result.data === "string" ? result.data : "Eingaben prüfen.";
|
|
}
|
|
return "Auftrag konnte nicht gespeichert werden.";
|
|
}
|
|
|
|
export default function EditOrderDialog({ order, facilities, onClose, onUpdated }) {
|
|
const [form, setForm] = useState(() => orderToFormValues(order));
|
|
const [isSaving, setIsSaving] = useState(false);
|
|
const [error, setError] = useState(null);
|
|
|
|
async function handleSubmit(event) {
|
|
event.preventDefault();
|
|
|
|
if (!form.facilityId || !form.startDate || !form.priority.trim()) {
|
|
setError("Einrichtung, Beginn und Priorität sind erforderlich.");
|
|
return;
|
|
}
|
|
|
|
if (form.endDate && form.endDate < form.startDate) {
|
|
setError("Das Ende darf nicht vor dem Beginn liegen.");
|
|
return;
|
|
}
|
|
|
|
setIsSaving(true);
|
|
setError(null);
|
|
|
|
const payload = orderFormToPayload(form, { includeStatus: true });
|
|
const result = await window.omsorg.orders.update(order.id, payload);
|
|
|
|
setIsSaving(false);
|
|
|
|
if (!result.ok) {
|
|
setError(errorMessage(result));
|
|
return;
|
|
}
|
|
|
|
onUpdated(result.data);
|
|
}
|
|
|
|
return (
|
|
<ModalPortal>
|
|
<div className="modal-overlay" role="dialog" aria-modal="true" aria-label="Auftrag bearbeiten">
|
|
<div className="modal-panel">
|
|
<h2>Auftrag bearbeiten</h2>
|
|
|
|
<form onSubmit={handleSubmit}>
|
|
<OrderForm form={form} onChange={setForm} facilities={facilities} includeStatus />
|
|
|
|
{error && <p className="login-error form-error">{error}</p>}
|
|
|
|
<FormActions onCancel={onClose} isSaving={isSaving} submitLabel="Speichern" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</ModalPortal>
|
|
);
|
|
}
|