commit
f0890af9e5
|
@ -56,8 +56,7 @@ public function indexManualPayment(cekDenda $cekDenda, GenerateMonthlyBill $gene
|
||||||
public function manualPayment(Request $request, $id)
|
public function manualPayment(Request $request, $id)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'amount' => 'required',
|
''
|
||||||
'penalty' => 'nullable'
|
|
||||||
], [
|
], [
|
||||||
'amount.required' => 'wajib mengisi nominal pembayaran',
|
'amount.required' => 'wajib mengisi nominal pembayaran',
|
||||||
]);
|
]);
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 302 KiB |
|
@ -1,7 +1,7 @@
|
||||||
import { Inertia } from "@inertiajs/inertia";
|
import { Inertia } from "@inertiajs/inertia";
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
|
|
||||||
const ModalInput = ({ fields, tableName, options, initialData, onClose }) => {
|
const ModalInput = ({ fields, tableName, options, initialData, onClose, showPayments = false }) => {
|
||||||
const [formData, setFormData] = useState({});
|
const [formData, setFormData] = useState({});
|
||||||
const [errors, setErrors] = useState({});
|
const [errors, setErrors] = useState({});
|
||||||
const [selectedPayments, setSelectedPayments] = useState([]);
|
const [selectedPayments, setSelectedPayments] = useState([]);
|
||||||
|
@ -53,7 +53,7 @@ const ModalInput = ({ fields, tableName, options, initialData, onClose }) => {
|
||||||
[paymentType]: {
|
[paymentType]: {
|
||||||
...currentDetails,
|
...currentDetails,
|
||||||
range: validRange,
|
range: validRange,
|
||||||
amount: newAmount, // Pastikan amount diperbarui
|
amount: newAmount,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -140,6 +140,8 @@ const ModalInput = ({ fields, tableName, options, initialData, onClose }) => {
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
|
{showPayments && (
|
||||||
|
<div>
|
||||||
<div className="mb-2">
|
<div className="mb-2">
|
||||||
<label className="input input-bordered input-secondary flex items-center gap-2">
|
<label className="input input-bordered input-secondary flex items-center gap-2">
|
||||||
Payment Type
|
Payment Type
|
||||||
|
@ -205,6 +207,8 @@ const ModalInput = ({ fields, tableName, options, initialData, onClose }) => {
|
||||||
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<button type="submit" className="btn btn-secondary w-full mt-3">
|
<button type="submit" className="btn btn-secondary w-full mt-3">
|
||||||
{initialData ? "Simpan Perubahan" : "Tambah Data"}
|
{initialData ? "Simpan Perubahan" : "Tambah Data"}
|
||||||
|
|
|
@ -7,7 +7,7 @@ export default function ManualPayment({ santri, penalty, bill, fields, options }
|
||||||
return (
|
return (
|
||||||
<div className='text-red-500'>
|
<div className='text-red-500'>
|
||||||
<Head title="Manual Payment" />
|
<Head title="Manual Payment" />
|
||||||
<ModalInput fields={fields} options={options} tableName={['payments', 'detail_payments']} initialData={selectedSantri} onClose={() => setSelectedSantri(null)} />
|
<ModalInput showPayments={true} fields={fields} options={options} tableName={['payments', 'detail_payments']} initialData={selectedSantri} onClose={() => setSelectedSantri(null)} />
|
||||||
{santri && santri.length > 0 ? santri.map((item, i) => (
|
{santri && santri.length > 0 ? santri.map((item, i) => (
|
||||||
<div key={i} className="p-4 border-b">
|
<div key={i} className="p-4 border-b">
|
||||||
<p>Nis: {item.user.nis}</p>
|
<p>Nis: {item.user.nis}</p>
|
||||||
|
|
Loading…
Reference in New Issue