Merge pull request #14 from alealien666/manualPay

progress be ++
This commit is contained in:
AleAlien 2025-02-21 21:37:02 +07:00 committed by GitHub
commit f0890af9e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 66 additions and 63 deletions

View File

@ -56,8 +56,7 @@ public function indexManualPayment(cekDenda $cekDenda, GenerateMonthlyBill $gene
public function manualPayment(Request $request, $id)
{
$request->validate([
'amount' => 'required',
'penalty' => 'nullable'
''
], [
'amount.required' => 'wajib mengisi nominal pembayaran',
]);

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

View File

@ -1,7 +1,7 @@
import { Inertia } from "@inertiajs/inertia";
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 [errors, setErrors] = useState({});
const [selectedPayments, setSelectedPayments] = useState([]);
@ -53,7 +53,7 @@ const ModalInput = ({ fields, tableName, options, initialData, onClose }) => {
[paymentType]: {
...currentDetails,
range: validRange,
amount: newAmount, // Pastikan amount diperbarui
amount: newAmount,
},
};
});
@ -140,6 +140,8 @@ const ModalInput = ({ fields, tableName, options, initialData, onClose }) => {
</div>
))}
{showPayments && (
<div>
<div className="mb-2">
<label className="input input-bordered input-secondary flex items-center gap-2">
Payment Type
@ -205,6 +207,8 @@ const ModalInput = ({ fields, tableName, options, initialData, onClose }) => {
</label>
</div>
</div>
)}
<button type="submit" className="btn btn-secondary w-full mt-3">
{initialData ? "Simpan Perubahan" : "Tambah Data"}

View File

@ -7,7 +7,7 @@ export default function ManualPayment({ santri, penalty, bill, fields, options }
return (
<div className='text-red-500'>
<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) => (
<div key={i} className="p-4 border-b">
<p>Nis: {item.user.nis}</p>