28 lines
763 B
JavaScript
28 lines
763 B
JavaScript
// src/components/edit/EditNalogToggle.jsx
|
|
// Ovo postaje višak
|
|
import { h } from 'preact';
|
|
import { useState } from 'preact/hooks';
|
|
import RadniNalogEditForm from './RadniNalogEditForm';
|
|
import Button from '../Button';
|
|
|
|
export default function EditNalogToggle({ nalog }) {
|
|
const [isEditing, setIsEditing] = useState(false);
|
|
|
|
return (
|
|
<div style={{ display: 'inline-block' }}>
|
|
<Button
|
|
label="Uredi radni nalog"
|
|
onClick={() => setIsEditing(true)}
|
|
variant="secondary"
|
|
/>
|
|
|
|
{isEditing && (
|
|
<RadniNalogEditForm
|
|
nalog={nalog}
|
|
onSave={() => { setIsEditing(false); window.location.reload(); }}
|
|
onCancel={() => setIsEditing(false)}
|
|
/>
|
|
)}
|
|
</div>
|
|
);
|
|
} |