Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Susulan : sinkronsisai bantuan dan sinkronisasi program #422

Merged
merged 2 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/Http/Controllers/Api/PembangunanController.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ public function store(PembangunanRequest $request)
->queue($extract . $filecsv = Str::replaceLast('zip', 'csv', $name));
} catch (\Exception $e) {
report($e);
return back()->with('error', 'Import data gagal.');
return response()->json([
"message" => "Proses Sinkronisasi Data gagal. Error : " . $e->getMessage(),
"status" => "danger"
]);
}

// Hapus folder temp ketika sudah selesai
Expand Down
5 changes: 0 additions & 5 deletions app/Http/Controllers/Data/DataPembangunanController.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ public function getPembangunan(Request $request)
}
}

public function show($id)
{
# code...
}

public function rincian($id, $kode_desa)
{
$page_title = 'Pembangunan';
Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/Data/ProgramBantuanController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function getaProgramBantuan(Request $request)
{
return DataTables::of(Program::when(!empty($request->input('desa')), fn ($q) => $q->where('desa_id', $request->desa))->with('desa'))
->addColumn('aksi', function ($row) {
$data['detail_url'] = route('data.program-bantuan.show', $row->id);
$data['detail_url'] = route('data.program-bantuan.show', [$row->id, $row->desa_id]);

return view('forms.aksi', $data);
})
Expand Down Expand Up @@ -97,13 +97,13 @@ public function store(Request $request)
return redirect()->route('data.program-bantuan.index')->with('success', 'Data berhasil disimpan!');
}

public function show($id)
public function show($id, $desa_id)
{
$program = Program::findOrFail($id);
$program = Program::with('desa')->findOrFail($id);
$page_title = 'Detail Program';
$page_description = 'Program Bantuan ' . $program->nama;
$sasaran = [1 => 'Penduduk/Perorangan', 2 => 'Keluarga-KK'];
$peserta = PesertaProgram::where('program_id', $id)->get();
$peserta = PesertaProgram::where('program_id', $id)->where('desa_id', $desa_id)->get();

return view('data.program_bantuan.show', compact('page_title', 'page_description', 'program', 'sasaran', 'peserta'));
}
Expand Down
28 changes: 4 additions & 24 deletions resources/views/data/program_bantuan/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
<th class="col-md-2">Nama</th>
<td>: {{ $program->nama }}</td>
</tr>
<tr>
<th>Desa</th>
<td>: {{ $program->desa->nama }}</td>
</tr>
<tr>
<th>Sasaran</th>
<td>: {{ $sasaran[$program->sasaran] }}</td>
Expand All @@ -42,30 +46,6 @@
</div>
<hr>
<legend>Daftar Peserta Program</legend>
<div class="table-responsive">
<table class="table table-bordered table-hover dataTable no-footer" id="program-table">
@if ($program->sasaran == 1)
<thead>
<tr>
<th class="col-md-2">Nama</th>
<td>: {{ $program->nama }}</td>
</tr>
<tr>
<th>Sasaran</th>
<td>: {{ $sasaran[$program->sasaran] }}</td>
</tr>
<tr>
<th>Periode Program</th>
<td>: {{ $program->start_date }} - {{ $program->end_date }}</td>
</tr>
<tr>
<th>Keterangan</th>
<td>: {{ $program->description }}</td>
</tr>
</table>
</div>
<hr>
<legend>Daftar Peserta Program</legend>
<div class="table-responsive">
<table class="table table-bordered table-hover dataTable no-footer" id="program-table">
@if ($program->sasaran == 1)
Expand Down
3 changes: 1 addition & 2 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@
Route::post('store', ['as' => 'data.program-bantuan.store', 'uses' => 'ProgramBantuanController@store']);
Route::post('add_peserta', ['as' => 'data.program-bantuan.add_peserta', 'uses' => 'ProgramBantuanController@add_peserta']);
Route::get('edit/{id}', ['as' => 'data.program-bantuan.edit', 'uses' => 'ProgramBantuanController@edit']);
Route::get('show/{id}', ['as' => 'data.program-bantuan.show', 'uses' => 'ProgramBantuanController@show']);
Route::get('show/{id}/{id_desa}', ['as' => 'data.program-bantuan.show', 'uses' => 'ProgramBantuanController@show']);
Route::get('create-peserta/{id}', ['as' => 'data.program-bantuan.create-peserta', 'uses' => 'ProgramBantuanController@createPeserta']);
Route::put('update/{id}', ['as' => 'data.program-bantuan.update', 'uses' => 'ProgramBantuanController@update']);
Route::delete('destroy/{id}', ['as' => 'data.program-bantuan.destroy', 'uses' => 'ProgramBantuanController@destroy']);
Expand Down Expand Up @@ -452,7 +452,6 @@
Route::group(['prefix' => 'pembangunan', 'middleware' => ['role:super-admin|administrator-website|admin-desa']], function () {
Route::get('/', ['as' => 'data.pembangunan.index', 'uses' => 'DataPembangunanController@index']);
Route::get('getdata', ['as' => 'data.pembangunan.getdata', 'uses' => 'DataPembangunanController@getPembangunan']);
Route::get('show/{id}', ['as' => 'data.pembangunan.show', 'uses' => 'DataPembangunanController@show']);
Route::get('rincian/{id}/{kode_desa}', ['as' => 'data.pembangunan.rincian', 'uses' => 'DataPembangunanController@rincian']);
Route::get('getrinciandata/{id}/{kode_desa}', ['as' => 'data.pembangunan.getrinciandata', 'uses' => 'DataPembangunanController@getrinciandata']);
});
Expand Down