From 37d4d86c6463bf10c0050968e2b65d6bf5f81a06 Mon Sep 17 00:00:00 2001 From: Aji Kamaludin Date: Sat, 8 Jun 2019 23:54:32 +0700 Subject: [PATCH] delete tagihan done --- app/Http/Controllers/HomeController.php | 3 +++ app/Http/Controllers/TagihanController.php | 16 ++++++++++++++-- resources/views/dashboard/index.blade.php | 21 ++++++++++++++++++--- resources/views/pengaturan/index.blade.php | 4 ++++ resources/views/siswa/show.blade.php | 8 +++++--- routes/web.php | 2 ++ 6 files changed, 46 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index f0052b4..ee04593 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -57,4 +57,7 @@ class HomeController extends Controller 'msg' => 'Pengaturan diubah' ]); } + + //TODO: dump sql all data + //TODO: reset all data } diff --git a/app/Http/Controllers/TagihanController.php b/app/Http/Controllers/TagihanController.php index 7f8b244..e0a7f1d 100644 --- a/app/Http/Controllers/TagihanController.php +++ b/app/Http/Controllers/TagihanController.php @@ -157,8 +157,20 @@ class TagihanController extends Controller * @param int $id * @return \Illuminate\Http\Response */ - public function destroy($id) + public function destroy(Tagihan $tagihan) { - //TODO: work on this if transaksi and keuangan done + if($tagihan->transaksi->count() != 0){ + return redirect()->route('tagihan.index')->with([ + 'type' => 'danger', + 'msg' => 'tidak dapat menghapus tagihan yang masih memiliki transaksi' + ]); + } + $tagihan->siswa()->detach(); + if($tagihan->delete()){ + return redirect()->route('tagihan.index')->with([ + 'type' => 'success', + 'msg' => 'tagihan telah dihapus' + ]); + } } } diff --git a/resources/views/dashboard/index.blade.php b/resources/views/dashboard/index.blade.php index 18f4579..69f5f62 100644 --- a/resources/views/dashboard/index.blade.php +++ b/resources/views/dashboard/index.blade.php @@ -1,7 +1,6 @@ @extends('layouts.app') -@section('site-name','Sistem Informasi SPP') -@section('page-name','PAUD') +@section('page-name','Dashboard') @section('content') diff --git a/resources/views/siswa/show.blade.php b/resources/views/siswa/show.blade.php index d1157c3..bcf8719 100644 --- a/resources/views/siswa/show.blade.php +++ b/resources/views/siswa/show.blade.php @@ -30,7 +30,8 @@

Tabungan

@@ -73,8 +74,9 @@

Tagihan SPP

@if(!$siswa->is_yatim)
- format('m-d-Y') }}"> - + format('m-d-Y') }}"> + + Export
@endif
diff --git a/routes/web.php b/routes/web.php index 3a120e6..0a159f1 100644 --- a/routes/web.php +++ b/routes/web.php @@ -67,6 +67,7 @@ Route::middleware(['auth:web'])->group(function(){ Route::post('menabung', 'TabunganController@menabung')->name('tabungan.store'); Route::get('export-mutasi', 'TabunganController@export')->name('tabungan.export'); Route::get('cetak-tabungan/{siswa}', 'TabunganController@cetak')->name('tabungan.cetak'); + Route::get('export-tabungan/{siswa}', 'TabunganController@cetak')->name('tabungan.siswa.export'); //TODO: export tabungan siswa //Keuangan Route::get('keuangan', 'KeuanganController@index')->name('keuangan.index'); @@ -76,6 +77,7 @@ Route::middleware(['auth:web'])->group(function(){ //Pembayaran SPP Route::get('transaksi-spp','TransaksiController@index')->name('spp.index'); Route::post('print-spp/{siswa?}','TransaksiController@print')->name('spp.print'); + Route::post('export-spp/{siswa?}','TransaksiController@print')->name('spp.export');// TODO: export spp });