Updated Customer view

This commit is contained in:
Anna-Sara Sélea 2025-10-15 19:45:15 +02:00
parent f68a18c6b3
commit e9c3350546

View file

@ -38,14 +38,18 @@ export default function Customer({customer}: CustomerProps) {
const submit: FormEventHandler = (e) => { const submit: FormEventHandler = (e) => {
e.preventDefault() e.preventDefault()
post(route('register_purchase'), { post(route('register_purchase'), {
onFinish: () => reset('amount'), onFinish: () => setData(
'amount', ''
),
}); });
} }
const submitDeposit: FormEventHandler = (e) => { const submitDeposit: FormEventHandler = (e) => {
e.preventDefault() e.preventDefault()
post(route('register_deposit'), { post(route('register_deposit'), {
onFinish: () => reset('deposit'), onFinish: () => setData(
'deposit', ''
),
}); });
} }
@ -104,32 +108,15 @@ export default function Customer({customer}: CustomerProps) {
</form> </form>
</div> </div>
<div className="box"> <details className="box">
<h2 className='title is-4'>Inbetalning Swish/kontant</h2> <summary className='title is-4 my-3'>
<form onSubmit={submitDeposit}> <span>Kommentar</span>
<div className="field"> <div className="summary-chevron-up">
<div className="control"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" className="feather feather-chevron-down">
<TextInput <polyline points="6 9 12 15 18 9"></polyline>
required </svg>
className="input"
type="number"
name="deposit"
value={data.deposit}
placeholder="Summa"
onChange={(e) => setData('deposit', e.target.value)}
/>
</div> </div>
</div> </summary>
<div className="field is-grouped">
<div className="control">
<button className="button">Spara</button>
</div>
</div>
</form>
</div>
<div className="box">
<h2 className='title is-4'>Kommentar</h2>
<form onSubmit={updateComment}> <form onSubmit={updateComment}>
<div className="field"> <div className="field">
<div className="control"> <div className="control">
@ -150,7 +137,52 @@ export default function Customer({customer}: CustomerProps) {
</div> </div>
</div> </div>
</form> </form>
<div className="summary-chevron-down">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" className="feather feather-chevron-up">
<polyline points="18 15 12 9 6 15"></polyline>
</svg>
</div> </div>
</details>
<details className="box">
<summary className='title is-4 my-3'>
<span>Inbetalning Swish/kontant</span>
<div className="summary-chevron-up">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" className="feather feather-chevron-down">
<polyline points="6 9 12 15 18 9"></polyline>
</svg>
</div>
</summary>
<form onSubmit={submitDeposit}>
<div className="field">
<div className="control">
<TextInput
required
className="input"
type="number"
name="deposit"
value={data.deposit}
placeholder="Summa"
onChange={(e) => setData('deposit', e.target.value)}
/>
</div>
</div>
<div className="field is-grouped">
<div className="control">
<button className="button">Spara</button>
</div>
</div>
</form>
<div className="summary-chevron-down">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" className="feather feather-chevron-up">
<polyline points="18 15 12 9 6 15"></polyline>
</svg>
</div>
</details>
<details className="box"> <details className="box">
<summary className='title is-4 my-3'> <summary className='title is-4 my-3'>