Skip to content

Commit

Permalink
Merge branch 'dev' into 6-potensi
Browse files Browse the repository at this point in the history
  • Loading branch information
arifpriadi authored Jun 11, 2024
2 parents ad5acbd + 8c0cc02 commit 2c23263
Show file tree
Hide file tree
Showing 76 changed files with 1,076 additions and 60 deletions.
48 changes: 24 additions & 24 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,30 +75,30 @@ class Handler extends ExceptionHandler
*/
public function register()
{
$this->reportable(function (Throwable $e) {
\Sentry\configureScope(function (\Sentry\State\Scope $scope): void {
$profil = Profil::first();
$scope->setUser(
[
'nama_provinsi' => $profil->nama_provinsi,
'nama_kabupaten' => $profil->nama_kabupaten,
'nama_kecamatan' => $profil->nama_kecamatan,
]
);
if (Auth::check()) {
$scope->setUser([
'email' => auth()->user()->email,
'name' => auth()->user()->name,
'role' => Auth::user()->getRoleNames(),
]);
}
$scope->setTags([
'kecamatan' => $profil->nama_kecamatan,
'versi' => config('app.version'),
]);
});
// $this->reportable(function (Throwable $e) {
// \Sentry\configureScope(function (\Sentry\State\Scope $scope): void {
// $profil = Profil::first();
// $scope->setUser(
// [
// 'nama_provinsi' => $profil->nama_provinsi,
// 'nama_kabupaten' => $profil->nama_kabupaten,
// 'nama_kecamatan' => $profil->nama_kecamatan,
// ]
// );
// if (Auth::check()) {
// $scope->setUser([
// 'email' => auth()->user()->email,
// 'name' => auth()->user()->name,
// 'role' => Auth::user()->getRoleNames(),
// ]);
// }
// $scope->setTags([
// 'kecamatan' => $profil->nama_kecamatan,
// 'versi' => config('app.version'),
// ]);
// });

Integration::captureUnhandledException($e);
});
// Integration::captureUnhandledException($e);
// });
}
}
98 changes: 98 additions & 0 deletions app/Http/Controllers/BackEnd/ThemesController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?php

namespace App\Http\Controllers\BackEnd;

use App\Http\Controllers\BackEndController;
use App\Models\Themes;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Log;

class ThemesController extends BackEndController
{
public function index()
{
$page_title = 'Tema';
$page_description = 'Daftar Tema';
$themes = Themes::orderBy('active', 'desc')->get();

return view('backend.themes.index', compact('page_title', 'page_description', 'themes'));
}

public function activate(Themes $themes)
{
Themes::where('active', 1)->update(['active' => 0]);
$themes->update(['active' => 1]);

return redirect()->route('setting.themes.index')->with('success', 'Tema berhasil diaktifkan');
}

public function reScan()
{
scan_themes();

return redirect()->route('setting.themes.index')->with('success', 'Tema berhasil pindai ulang');
}

public function upload()
{
try {
$file = request()->file('file');

if ($file->getClientOriginalExtension() !== 'zip') {
return response()->json([
'status' => 'error',
'message' => 'File harus berformat .zip',
]);
}

$fileName = $file->getClientOriginalName();
$filePath = storage_path('framework/themes');
$file->move($filePath, $fileName);

$zip = new \ZipArchive;
if ($zip->open("$filePath/$fileName") === true) {
$extractedPath = base_path('themes/extracted');
$zip->extractTo($extractedPath);
$zip->close();

$folderTheme = explode('.', $fileName)[0];
$composerPath = "$extractedPath/$folderTheme/composer.json";

if (file_exists($composerPath)) {
$composerData = json_decode(file_get_contents($composerPath), true);
$newFolder = base_path('themes/'.$composerData['name']);

if (File::move("$extractedPath/$folderTheme", $newFolder)) {
File::deleteDirectory($extractedPath);
File::deleteDirectory($filePath);

scan_themes();

return response()->json([
'status' => 'success',
'message' => 'Tema berhasil diunggah',
]);
} else {
File::deleteDirectory($extractedPath);
File::deleteDirectory($filePath);
}
}
}
} catch (\Exception $e) {
Log::error('File upload failed: '.$e->getMessage());
}

return response()->json([
'status' => 'error',
'message' => 'Tema gagal diunggah',
]);
}

// destroy
public function destroy(Themes $themes)
{
$themes->delete();

return redirect()->route('setting.themes.index')->with('success', 'Theme berhasil dihapus');
}
}
40 changes: 40 additions & 0 deletions app/Http/Controllers/BackEndController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

/*
* File ini bagian dari:
*
* OpenDK
*
* Aplikasi dan source code ini dirilis berdasarkan lisensi GPL V3
*
* Hak Cipta 2017 - 2024 Perkumpulan Desa Digital Terbuka (https://opendesa.id)
*
* Dengan ini diberikan izin, secara gratis, kepada siapa pun yang mendapatkan salinan
* dari perangkat lunak ini dan file dokumentasi terkait ("Aplikasi Ini"), untuk diperlakukan
* tanpa batasan, termasuk hak untuk menggunakan, menyalin, mengubah dan/atau mendistribusikan,
* asal tunduk pada syarat berikut:
*
* Pemberitahuan hak cipta di atas dan pemberitahuan izin ini harus disertakan dalam
* setiap salinan atau bagian penting Aplikasi Ini. Barang siapa yang menghapus atau menghilangkan
* pemberitahuan ini melanggar ketentuan lisensi Aplikasi Ini.
*
* PERANGKAT LUNAK INI DISEDIAKAN "SEBAGAIMANA ADANYA", TANPA JAMINAN APA PUN, BAIK TERSURAT MAUPUN
* TERSIRAT. PENULIS ATAU PEMEGANG HAK CIPTA SAMA SEKALI TIDAK BERTANGGUNG JAWAB ATAS KLAIM, KERUSAKAN ATAU
* KEWAJIBAN APAPUN ATAS PENGGUNAAN ATAU LAINNYA TERKAIT APLIKASI INI.
*
* @package OpenDK
* @author Tim Pengembang OpenDesa
* @copyright Hak Cipta 2017 - 2024 Perkumpulan Desa Digital Terbuka (https://opendesa.id)
* @license http://www.gnu.org/licenses/gpl.html GPL V3
* @link https://github.com/OpenSID/opendk
*/

namespace App\Http\Controllers;

class BackEndController extends Controller
{
public function __construct()
{
parent::__construct();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
* @link https://github.com/OpenSID/opendk
*/

namespace App\Http\Controllers\Page;
namespace App\Http\Controllers\FrontEnd;

use App\Http\Controllers\Controller;
use App\Http\Controllers\FrontEndController;
use App\Models\CoaType;
use App\Models\DataDesa;
use Illuminate\Support\Facades\DB;

class AnggaranDesaController extends Controller
class AnggaranDesaController extends FrontEndController
{
/**
* Menampilkan Data Anggaran Dan realisasi Kecamatan
Expand Down
Loading

0 comments on commit 2c23263

Please sign in to comment.