126 lines
2.9 KiB
PHP
126 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Data;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\SpatialPlanning;
|
|
use Illuminate\Http\Request;
|
|
|
|
class SpatialPlanningController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*/
|
|
public function index()
|
|
{
|
|
return view('data.spatialPlannings.index');
|
|
}
|
|
|
|
/**
|
|
* show the form for creating a new resource.
|
|
*/
|
|
public function bulkCreate()
|
|
{
|
|
return view('data.spatialPlannings.form-upload');
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*/
|
|
public function create()
|
|
{
|
|
$title = 'Rencana Tata Ruang';
|
|
$subtitle = "Create Data";
|
|
|
|
// Mengambil data untuk dropdown
|
|
$dropdownOptions = [];
|
|
|
|
$fields = $this->getFields();
|
|
$fieldTypes = $this->getFieldTypes();
|
|
|
|
$apiUrl = url('/api/spatial-plannings');
|
|
return view('data.spatialPlannings.form', compact('title', 'subtitle', 'fields', 'fieldTypes', 'apiUrl', 'dropdownOptions'));
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*/
|
|
public function store(Request $request)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*/
|
|
public function show(string $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*/
|
|
public function edit(string $id)
|
|
{
|
|
$title = 'Rencana Tata Ruang';
|
|
$subtitle = 'Update Data';
|
|
|
|
$modelInstance = SpatialPlanning::find($id);
|
|
// Pastikan model ditemukan
|
|
if (!$modelInstance) {
|
|
return redirect()->route('spatialPlanning.index') ->with('error', 'Rencana tata ruang tidak ditemukan');
|
|
}
|
|
|
|
$dropdownOptions = [];
|
|
|
|
$fields = $this->getFields();
|
|
$fieldTypes = $this->getFieldTypes();
|
|
|
|
$apiUrl = url('/api/spatial-plannings');
|
|
return view('data.spatialPlannings.form', compact('title', 'subtitle', 'modelInstance', 'fields', 'fieldTypes', 'apiUrl', 'dropdownOptions'));
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*/
|
|
public function update(Request $request, string $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*/
|
|
public function destroy(string $id)
|
|
{
|
|
//
|
|
}
|
|
|
|
private function getFields()
|
|
{
|
|
return [
|
|
"name"=> "Nama",
|
|
"kbli"=> "KBLI",
|
|
"activities"=> "Kegiatan",
|
|
"area"=> "Luas (m2)",
|
|
"location"=> "Lokasi",
|
|
"number"=> "Nomor",
|
|
"date"=> "Tanggal",
|
|
];
|
|
}
|
|
|
|
private function getFieldTypes()
|
|
{
|
|
return [
|
|
"name"=> "text",
|
|
"kbli"=> "text",
|
|
"activities"=> "text",
|
|
"area"=> "text",
|
|
"location"=> "text",
|
|
"number"=> "text",
|
|
"date"=> "date",
|
|
];
|
|
}
|
|
}
|