Merge pull request #3 from alealien666/santri

.
This commit is contained in:
AleAlien 2025-02-10 17:40:06 +07:00 committed by GitHub
commit 156b448443
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 40 additions and 34 deletions

View File

@ -4,6 +4,7 @@
use App\Models\PaymentType;
use Illuminate\Http\Request;
use Inertia\Inertia;
class PaymentTypeController extends Controller
{
@ -12,52 +13,25 @@ class PaymentTypeController extends Controller
*/
public function index()
{
//
$paymentType = PaymentType::all();
return Inertia::render('list-admin/payment/PaymentType', [
'paymentType' => $paymentType,
'fields' => [
'payment_type' => 'text'
]
]);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(PaymentType $paymentType)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(PaymentType $paymentType)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, PaymentType $paymentType)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(PaymentType $paymentType)
{
//

View File

@ -0,0 +1,28 @@
import React, { useState } from 'react'
import { Head } from '@inertiajs/react'
import ModalInput from '@/Components/ModalInput'
import DeleteButton from '@/Components/DeleteButton'
export default function PaymentType({ tableName, paymentType, fields }) {
const [selectedPaymentType, setSelectedPaymentType] = useState(null)
return (
<div>
<Head title="Daftar Payment Type" />
<h1>Data Payment Type</h1>
<ModalInput fields={fields} tableName="payment_types" initialData={selectedPaymentType} onClose={() => setSelectedPaymentType(null)} />
<label htmlFor="modal_input" className='btn btn-secondary' onClick={() => setSelectedPaymentType(null)}>Tambah Payment Type</label>
{paymentType ? paymentType.map((item, i) => {
return (
<div key={i}>
<p>Payment type: {item.payment_type}</p>
</div>
)
}) : ""}
</div>
)
}

View File

@ -4,6 +4,7 @@
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\SantriController;
use App\Http\Controllers\PaymentTypeController;
use Inertia\Inertia;
/*
@ -31,6 +32,9 @@
Route::post('/updatesantris/{id}', [SantriController::class, 'update'])->name('updateSantri');
Route::post('/deletesantris/{id}', [SantriController::class, 'destroy'])->name('deleteSantri');
// payment type
Route::get('/data-payment-type', [PaymentTypeController::class, 'index'])->name('indexPaymentType');
Route::get('/dashboard', function () {
return Inertia::render('Dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');