diff --git a/Modules/Murid/Http/Controllers/PembayaranController.php b/Modules/Murid/Http/Controllers/PembayaranController.php index 43d0067..b53a097 100644 --- a/Modules/Murid/Http/Controllers/PembayaranController.php +++ b/Modules/Murid/Http/Controllers/PembayaranController.php @@ -2,6 +2,8 @@ namespace Modules\Murid\Http\Controllers; +use App\Models\Bank; +use App\Models\User; use Carbon\Carbon; use ErrorException; use Illuminate\Contracts\Support\Renderable; @@ -10,6 +12,7 @@ use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Session; +use Modules\Murid\Http\Requests\ConfirmPaymentRequest; use Modules\SPP\Entities\DetailPaymentSpp; class PembayaranController extends Controller @@ -61,11 +64,14 @@ public function show($id) public function edit($id) { $payment = DetailPaymentSpp::with('user.muridDetail')->where('user_id', Auth::id())->findOrFail($id); + $accountbanks = User::with('banks')->first(); + $bank = Bank::all(); + if ($payment->status == 'paid') { Session::flash('error','Pembayaran Sudah Diterima.'); return redirect('murid/pembayaran'); } - return view('murid::pembayaran.edit', compact('payment')); + return view('murid::pembayaran.edit', compact('payment','accountbanks','bank')); } /** @@ -74,20 +80,25 @@ public function edit($id) * @param int $id * @return Renderable */ - public function update(Request $request, $id) + public function update(ConfirmPaymentRequest $request, $id) { try { DB::beginTransaction(); - $file = $request->file('file'); - $file_payment = 'payment-'.time().Auth::id().".".$file->getClientOriginalExtension(); - // isi dengan nama folder tempat kemana file diupload - $tujuan_upload = 'public/images/bukti_payment'; - $file->storeAs($tujuan_upload,$file_payment); + if ($request->file) { + $file = $request->file('file'); + $file_payment = 'payment-'.time().Auth::id().".".$file->getClientOriginalExtension(); + // isi dengan nama folder tempat kemana file diupload + $tujuan_upload = 'public/images/bukti_payment'; + $file->storeAs($tujuan_upload,$file_payment); + } $payment = DetailPaymentSpp::where('user_id', Auth::id())->findOrFail($id); - $payment->file = $file_payment; - $payment->date_file = Carbon::now(); + $payment->file = $file_payment ?? $payment->file; + $payment->date_file = $request->date_file; + $payment->sender = $request->sender; + $payment->bank_sender = $request->bank_sender; + $payment->destination_bank = $request->destination_bank; $payment->update(); DB::commit(); diff --git a/Modules/Murid/Http/Requests/ConfirmPaymentRequest.php b/Modules/Murid/Http/Requests/ConfirmPaymentRequest.php new file mode 100644 index 0000000..384683a --- /dev/null +++ b/Modules/Murid/Http/Requests/ConfirmPaymentRequest.php @@ -0,0 +1,46 @@ + 'required_if:file,null|mimes:jpg,jpeg,png', + 'sender' => 'required', + 'bank_sender' => 'required', + 'destination_bank' => 'required', + 'date_file' => 'required' + ]; + } + + public function messages() + { + return [ + 'file.required' => 'File Bukti Pembayaran tidak boleh kosong.', + 'file.mimes' => 'File Bukti Pembayaran tidak valid.', + 'sender.required' => 'Nama Pengirim tidak boleh kosong.', + 'bank_sender.required' => 'Bank Pengirim tidak boleh kosong.', + 'destination_bank' => 'Bank Tujuan tidak boleh kosong.', + 'date_file.required' => 'Tanggal Transfer tidak boleh kosong.' + ]; + } + + /** + * Determine if the user is authorized to make this request. + * + * @return bool + */ + public function authorize() + { + return true; + } +} diff --git a/Modules/Murid/Resources/views/pembayaran/edit.blade.php b/Modules/Murid/Resources/views/pembayaran/edit.blade.php index 5ba647c..35d793f 100644 --- a/Modules/Murid/Resources/views/pembayaran/edit.blade.php +++ b/Modules/Murid/Resources/views/pembayaran/edit.blade.php @@ -34,53 +34,126 @@
-
-
-
-
-

Silahkan Upload Bukti Pembayaran

-
-
-
- @csrf - @method('PUT') -
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- * - - @error('file') -
- {{ $message }} -
- @enderror -
+
+
+
+

Lakukan Konfirmasi Pembayaran

+
Silahkan lakukan konfirmasi ketika Anda sudah melakukan transfer.
+
+ + @csrf + @method('PUT') +
+ + + @error('sender') +
+ {{ $message }} +
+ @enderror +
+ +
+ + + @error('bank_sender') +
+ {{ $message }}
-
- - Batal - + @enderror +
+ +
+ + + @error('destination_bank') +
+ {{ $message }} +
+ @enderror +
+ +
+ + + @error('date_file') +
+ {{ $message }}
+ @enderror +
+ +
+ +
-
+ +
+ + + @error('file') +
+ {{ $message }} +
+ @enderror +
+ +
+ + Batal +
+ +
+
+
+ +
+
+
+
Mohon untuk mentransfer sesuai dengan jumlah yang ditentukan.
+
+
+
+
+
+ + Jumlah : + Rp {{number_format($payment->amount)}} + + + + +
+
+
+ + @foreach ($accountbanks->banks as $bank) +
    +
  • {{$bank->bank_name}}
  • +
  • {{$bank->account_name}}
  • +
  • {{$bank->account_number}}
  • +
+ @endforeach +
+
+
+
+ + Pembayaran SPP bulan {{$payment->month}} + +
+
+
diff --git a/Modules/SPP/Database/Migrations/2022_07_29_081354_add_column_in_detail_payment_spps_table.php b/Modules/SPP/Database/Migrations/2022_07_29_081354_add_column_in_detail_payment_spps_table.php new file mode 100644 index 0000000..5b86380 --- /dev/null +++ b/Modules/SPP/Database/Migrations/2022_07_29_081354_add_column_in_detail_payment_spps_table.php @@ -0,0 +1,34 @@ +string('sender')->after('user_id')->nullable(); + $table->string('bank_sender')->after('sender')->nullable(); + $table->string('destination_bank')->after('bank_sender')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('detail_payment_spps', function (Blueprint $table) { + + }); + } +} diff --git a/Modules/SPP/Resources/views/murid/show.blade.php b/Modules/SPP/Resources/views/murid/show.blade.php index 2309a22..2a6790e 100644 --- a/Modules/SPP/Resources/views/murid/show.blade.php +++ b/Modules/SPP/Resources/views/murid/show.blade.php @@ -73,6 +73,10 @@ data-nisn="{{$detail->user->muridDetail->nisn}}" data-month="{{$detail->month}}" data-amount="Rp {{number_format($detail->amount)}}" + data-sender="{{$detail->sender}}" + data-banksender="{{$detail->bank_sender}}" + data-datefile="{{$detail->date_file}}" + data-destinationbank="{{$detail->destination_bank}}" >Proses Bukti Bayar @elseif($detail->status == 'paid') @@ -104,11 +108,19 @@ var name = $(this).attr('data-name'); var month = $(this).attr('data-month'); var amount = $(this).attr('data-amount'); + var sender = $(this).attr('data-sender'); + var banksender = $(this).attr('data-banksender'); + var datefile = $(this).attr('data-datefile'); + var destinationbank = $(this).attr('data-destinationbank'); $("#id_payment").val(id) $("#nisn").val(nisn) $("#name").val(name) $("#month").val(month) $("#amount").val(amount) + $("#sender").val(sender) + $("#banksender").val(banksender) + $("#datefile").val(datefile) + $("#destinationbank").val(destinationbank) }); // Proses Update Data Peminjam @@ -120,4 +132,4 @@ }); }); -@endsection \ No newline at end of file +@endsection diff --git a/Modules/SPP/Resources/views/murid/update.blade.php b/Modules/SPP/Resources/views/murid/update.blade.php index 790904f..0d2dc00 100644 --- a/Modules/SPP/Resources/views/murid/update.blade.php +++ b/Modules/SPP/Resources/views/murid/update.blade.php @@ -36,6 +36,34 @@ + +
+
Detail Pembayaran
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
- \ No newline at end of file +