commit
156b448443
|
@ -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)
|
||||
{
|
||||
//
|
||||
|
|
|
@ -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>
|
||||
)
|
||||
}
|
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue