Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 305d48e
Author: afa28 <[email protected]>
Date:   Thu Jul 29 19:37:31 2021 +0800

    Catatan Rilis

commit 4f271d2
Author: afa28 <[email protected]>
Date:   Thu Jul 29 19:05:52 2021 +0800

    Template Catatan Rilis

commit f1a51b7
Author: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Date:   Thu Jul 29 09:47:05 2021 +0800

    docs: add nurisakbar as a contributor for code

commit b94724f
Merge: 892489d 8e07be0
Author: Andi Fahruddin Akas <[email protected]>
Date:   Wed Jul 28 23:31:09 2021 +0800

    Merge pull request #204 : Penambahan opsi luas wilayah kecamatan

commit 892489d
Merge: f894741 262e623
Author: Andi Fahruddin Akas <[email protected]>
Date:   Wed Jul 28 23:06:45 2021 +0800

    Merge pull request #196 : Laporan APBDes dari OpenSID

commit 262e623
Author: afa28 <[email protected]>
Date:   Wed Jul 28 22:36:37 2021 +0800

    Rules cek desa_id

commit 8e07be0
Author: afa28 <[email protected]>
Date:   Wed Jul 28 19:37:55 2021 +0800

    Riview

    - Sesuaikan migrasi
    - Sesuaikan view

commit c4fd4e5
Author: Nuris Akbar <[email protected]>
Date:   Thu Jul 15 16:18:04 2021 +0100

    Luas wilayah kecamatan

commit f894741
Author: afa28 <[email protected]>
Date:   Wed Jul 28 19:19:51 2021 +0800

    das_setting

commit ae7aa62
Author: afa28 <[email protected]>
Date:   Wed Jul 28 19:17:39 2021 +0800

    https://demo.opendk.or.id

commit 7a7e92a
Author: afa28 <[email protected]>
Date:   Wed Jul 28 18:22:22 2021 +0800

    Perbaikan

commit d6efa10
Author: Eddie Ridwan <[email protected]>
Date:   Sun Jul 25 16:17:13 2021 +1000

    Filter berita desa menggunakan ajax

commit acaa9f7
Author: Eddie Ridwan <[email protected]>
Date:   Wed Jul 21 22:55:09 2021 +1000

    #109 Filter desa di berita

commit 3f9e942
Author: afa28 <[email protected]>
Date:   Sun Jul 11 04:24:41 2021 +0800

    Laporan APBDes
  • Loading branch information
andifahruddinakas committed Aug 1, 2021
1 parent 249d040 commit 9a4c0b2
Show file tree
Hide file tree
Showing 36 changed files with 1,222 additions and 168 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@
"contributions": [
"code"
]
},
{
"login": "nurisakbar",
"name": "Nuris Akbar",
"avatar_url": "https://avatars.githubusercontent.com/u/5483330?v=4",
"profile": "http://belajarphp.net",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ OpenDK (https://github.com/OpenSID/OpenDK) adalah aplikasi yang bisa digunakan o
Pedoman pemasangan dan penggunaan OpenDK dapat dilihat di wiki OpenDK di https://github.com/opensid/opendk/wiki.

### 💻 DEMO
Demo aplikasi OpenDK dapat dilihat di https://demo.opendk.my.id. Versi yang terlihat di demo itu adalah rilis terkini.
Demo aplikasi OpenDK dapat dilihat di https://demo.opendk.or.id. Versi yang terlihat di demo itu adalah rilis terkini.

Modul administrasi OpenDK demo dapat diaskses pada https://demo.opendk.my.id/index.php/login. Masukkan Username = [email protected] dan Password = password.
Modul administrasi OpenDK demo dapat diaskses pada https://demo.opendk.or.id/index.php/login. Masukkan Username = [email protected] dan Password = password.

### 💬 FORUM

Expand Down Expand Up @@ -44,6 +44,7 @@ Berikut adalah teman-teman luar biasa yang telah berkontribusi langsung mengemba
<td align="center"><a href="https://facebook.com/faizulamaly"><img src="https://avatars.githubusercontent.com/u/31075119?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Faizul Amali</b></sub></a><br /><a href="https://github.com/OpenSID/OpenDK/commits?author=ilamazuliaf" title="Code">💻</a></td>
<td align="center"><a href="https://ibnuis.dev"><img src="https://avatars.githubusercontent.com/u/14322078?v=4?s=100" width="100px;" alt=""/><br /><sub><b>IBNU HALIM MUSTOFA</b></sub></a><br /><a href="https://github.com/OpenSID/OpenDK/commits?author=ibnuhalimm" title="Code">💻</a></td>
<td align="center"><a href="https://ahmadrosid.com"><img src="https://avatars.githubusercontent.com/u/29406408?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ahmadrosid</b></sub></a><br /><a href="https://github.com/OpenSID/OpenDK/commits?author=ahmadrosid" title="Code">💻</a></td>
<td align="center"><a href="http://belajarphp.net"><img src="https://avatars.githubusercontent.com/u/5483330?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nuris Akbar</b></sub></a><br /><a href="https://github.com/OpenSID/OpenDK/commits?author=nurisakbar" title="Code">💻</a></td>
</tr>
</table>

Expand All @@ -55,5 +56,5 @@ Berikut adalah teman-teman luar biasa yang telah berkontribusi langsung mengemba
Daftar kontributor sesuai spesifikasi [all-contributors](https://github.com/all-contributors/all-contributors), menggunakan @all-contributors Bot.

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-11-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
39 changes: 39 additions & 0 deletions app/Http/Controllers/Api/LaporanApbdesController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Http\Requests\LaporanApbdesRequest;
use App\Jobs\LaporanApbdesQueueJob;

use function response;

class LaporanApbdesController extends Controller
{
/**
* Create a new AuthController instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth:api');
}

/**
* Tambah / Ubah Data Apbdes Sesuai OpenSID
*
* @param ApbdesRequest $request
* @return \Illuminate\Http\JsonResponse
*/
public function store(LaporanApbdesRequest $request)
{
// dispatch queue job apbdes
LaporanApbdesQueueJob::dispatch($request->only(['desa_id', 'laporan_apbdes']));

return response()->json([
'status' => 'success',
'message' => 'Proses sync data APBDes OpenSID sedang berjalan',
]);
}
}
3 changes: 2 additions & 1 deletion app/Http/Controllers/Api/PendudukController.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public function store(PendudukRequest $request)
PendudukQueueJob::dispatch($request->all());

return response()->json([
'message' => 'Proses sync data penduduk OpenSID sedang berjalan',
'status' => 'success',
'message' => 'Proses sync Data Penduduk OpenSID sedang berjalan',
]);
}

Expand Down
18 changes: 15 additions & 3 deletions app/Http/Controllers/Data/DataUmumController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ class DataUmumController extends Controller
public function index()
{
$data_umum = DataUmum::where('kecamatan_id', config('app.default_profile'))->first();
$luas_wilayah = \DB::table('das_data_desa')->sum('luas_wilayah');
$luas_wilayah = $data_umum['luas_wilayah_value'];
$page_title = 'Ubah Data Umum';
$page_description = ucwords(strtolower($this->sebutan_wilayah).' : ' . $data_umum->kecamatan->nama);

return view('data.data_umum.edit', compact('page_title', 'page_description', 'data_umum','luas_wilayah'));
}

Expand Down Expand Up @@ -81,6 +80,7 @@ public function store(Request $request)
request()->validate([
'kecamatan_id' => 'required',
'tipologi' => 'required',
'sumber_luas_wilayah' => 'required',
'luas_wilayah' => 'required',
'bts_wil_utara' => 'required',
'bts_wil_timur' => 'required',
Expand All @@ -100,6 +100,7 @@ public function store(Request $request)
'jml_balai_pertemuan' => 'required',
]);
$profil->save();

return redirect()->route('data.data-umum.index')->with('success', 'Data Umum berhasil disimpan!');
} catch (Exception $e) {
return back()->withInput()->with('error', 'Data Umum gagal disimpan!');
Expand Down Expand Up @@ -144,6 +145,7 @@ public function update(Request $request, $id)
request()->validate([
'kecamatan_id' => 'required',
'tipologi' => 'required',
'sumber_luas_wilayah' => 'required',
'luas_wilayah' => 'required',
'bts_wil_utara' => 'required',
'bts_wil_timur' => 'required',
Expand All @@ -164,7 +166,9 @@ public function update(Request $request, $id)
'jml_balai_pertemuan' => 'required',
]);

DataUmum::find($id)->update($request->all());
$data = $request->sumber_luas_wilayah==1?$request->all():$request->except('luas_wilayah');

DataUmum::find($id)->update($data);

return redirect()->route('data.data-umum.index')->with('success', 'Update Data Umum sukses!');
} catch (Exception $e) {
Expand All @@ -189,4 +193,12 @@ public function destroy($id)
return redirect()->route('data.data-umum.index')->with('error', 'Data Umum gagal dihapus!');
}
}

public function getDataUmumAjax(Request $request)
{
if($request->ajax()){
return response()->json(['data'=>DataUmum::first()]);
}
}

}
151 changes: 151 additions & 0 deletions app/Http/Controllers/Data/LaporanApbdesController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?php

namespace App\Http\Controllers\Data;

use App\Http\Controllers\Controller;
use App\Imports\ImporLaporanApbdes;
use App\Models\DataDesa;
use App\Models\LaporanApbdes;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Yajra\DataTables\DataTables;

use Exception;
use ZipArchive;

use function back;
use function compact;
use function redirect;
use function route;
use function view;

class LaporanApbdesController extends Controller
{
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(LaporanApbdes $apbdes)
{
$page_title = 'Laporan APBDes';
$page_description = 'Data APBDes';
$list_desa = DataDesa::get();

return view('data.laporan-apbdes.index', compact('page_title', 'page_description', 'list_desa'));
}

/**
* Return datatable Data Apbdes.
*
* @param Request $request
* @return DataTables
*/
public function getApbdes(Request $request)
{
$desa = $request->input('desa');

$query = DB::table('das_apbdes')
->leftJoin('das_data_desa', 'das_apbdes.desa_id', '=', 'das_data_desa.desa_id')
->select([
'das_apbdes.id',
'das_data_desa.nama as nama_desa',
'das_apbdes.judul',
'das_apbdes.tahun',
'das_apbdes.semester',
'das_apbdes.nama_file',
'das_apbdes.imported_at',
])
->when($desa, function ($query) use ($desa) {
return $desa === 'ALL'
? $query
: $query->where('das_data_desa.desa_id', $desa);
});

return DataTables::of($query)
->addColumn('action', function ($row) {
$delete_url = route('data.laporan-apbdes.destroy', $row->id);
$download_url = asset('storage/apbdes/' . $row->nama_file);

$data['delete_url'] = $delete_url;
$data['download_url'] = $download_url;

return view('forms.action', $data);
})->make();
}

/**
* Remove the specified resource from storage.
*
* @return Response
*/
public function destroy($id)
{
try {
$apbdes = LaporanApbdes::findOrFail($id);

// Hapus file apbdes
Storage::disk('public')->delete('apbdes/' . $apbdes->nama_file);

$apbdes->delete();

return redirect()->route('data.laporan-apbdes.index')->with('success', 'Data sukses dihapus!');
} catch (\Illuminate\Database\QueryException $e) {
return redirect()->route('data.laporan-apbdes.index')->with('error', 'Data gagal dihapus!');
}
}

/**
* Display a listing of the resource.
*
* @return Response
*/
public function import()
{
$page_title = 'Laporan APBDes';
$page_description = 'Import Data';

return view('data.laporan-apbdes.import', compact('page_title', 'page_description'));
}

/**
* Impor data apbdes dari file Excel.
* Kalau apbdes sudah ada (berdasarkan NIK), update dengan data yg diimpor
*
* @return Response
*/
public function do_import(Request $request)
{
$this->validate($request, [
'file' => 'file|mimes:zip|max:51200',
]);

try {
// Upload file zip temporary.
$file = $request->file('file');
$file->storeAs('temp', $name = $file->getClientOriginalName());

// Temporary path file
$path = storage_path("app/temp/{$name}");
$extract = storage_path('app/temp/apbdes/');

// Ekstrak file
$zip = new ZipArchive;
$zip->open($path);
$zip->extractTo($extract);
$zip->close();

// Proses impor excell
(new ImporLaporanApbdes())
->queue($extract . Str::replaceLast('zip', 'xlsx', $name));
} catch (Exception $e) {
return back()->with('error', 'Import data gagal. ' . $e->getMessage());
}

return back()->with('success', 'Import data sukses.');
}

}
Loading

0 comments on commit 9a4c0b2

Please sign in to comment.