izradena poslovna logika
This commit is contained in:
28
002.FRONTEND/src/components/edit/EditNalogToggle.jsx
Normal file
28
002.FRONTEND/src/components/edit/EditNalogToggle.jsx
Normal file
@@ -0,0 +1,28 @@
|
||||
// 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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user