diff --git a/app/Http/Controllers/Api/SpatialPlanningsController.php b/app/Http/Controllers/Api/SpatialPlanningsController.php index 3c75aee..9513398 100644 --- a/app/Http/Controllers/Api/SpatialPlanningsController.php +++ b/app/Http/Controllers/Api/SpatialPlanningsController.php @@ -3,8 +3,13 @@ namespace App\Http\Controllers\Api; use App\Http\Controllers\Controller; +use App\Http\Requests\ExcelUploadRequest; +use App\Http\Requests\SpatialPlanningsRequest; +use App\Http\Resources\SpatialPlanningsResource; +use App\Imports\SpatialPlanningImport; use App\Models\SpatialPlanning; use Illuminate\Http\Request; +use Maatwebsite\Excel\Facades\Excel; class SpatialPlanningsController extends Controller { @@ -18,13 +23,20 @@ class SpatialPlanningsController extends Controller $query = $query->where("name", "LIKE", "%{$request->get("search")}%") ->orWhere("nomor", "LIKE", "%{$request->get("search")}%"); } - $query = $query->paginate(); - return response()->json($query); + return SpatialPlanningsResource::collection($query->paginate()); } - public function store(Request $request) + public function store(SpatialPlanningsRequest $request) { - // + try{ + $validated = $request->validated(); + $data = SpatialPlanning::create($validated); + return response()->json(['message' => 'Successfully created', new SpatialPlanningsResource($data)]); + }catch(\Exception $e){ + return response()->json([ + 'message' => $e->getMessage() + ], 500); + } } /** @@ -38,9 +50,18 @@ class SpatialPlanningsController extends Controller /** * Update the specified resource in storage. */ - public function update(Request $request, string $id) + public function update(SpatialPlanningsRequest $request, string $id) { - // + try{ + $validated = $request->validated(); + $data = SpatialPlanning::find($id); + $data->update($validated); + return response()->json(['message' => 'Successfully updated', new SpatialPlanningsResource($data)]); + }catch(\Exception $e){ + return response()->json([ + 'message' => $e->getMessage() + ], 500); + } } /** @@ -51,7 +72,27 @@ class SpatialPlanningsController extends Controller try{ SpatialPlanning::destroy($id); return response()->json([ - 'message' => 'Data berhasil dihapus' + 'message' => 'Successfully deleted' + ], 200); + }catch(\Exception $e){ + return response()->json([ + 'message' => $e->getMessage() + ], 500); + } + } + + public function upload(ExcelUploadRequest $request){ + try{ + if(!$request->hasFile('file')){ + return response()->json([ + 'error' => 'No file provided' + ], 400); + } + + $file = $request->file('file'); + Excel::import(new SpatialPlanningImport, $file); + return response()->json([ + 'message' => 'Successfully imported' ], 200); }catch(\Exception $e){ return response()->json([ diff --git a/app/Http/Controllers/SpatialPlanningsController.php b/app/Http/Controllers/SpatialPlanningsController.php index 6d6f137..acdfc0b 100644 --- a/app/Http/Controllers/SpatialPlanningsController.php +++ b/app/Http/Controllers/SpatialPlanningsController.php @@ -2,63 +2,27 @@ namespace App\Http\Controllers; +use App\Models\SpatialPlanning; use Illuminate\Http\Request; class SpatialPlanningsController extends Controller { - /** - * Display a listing of the resource. - */ public function index() { return view('spatial-plannings.index'); } - - /** - * Show the form for creating a new resource. - */ public function create() { return view('spatial-plannings.create'); } - /** - * 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) { - return view('spatial-plannings.update'); + $data = SpatialPlanning::findOrFail($id); + return view('spatial-plannings.update', compact('data')); } - /** - * Update the specified resource in storage. - */ - public function update(Request $request, string $id) - { - // - } - - /** - * Remove the specified resource from storage. - */ - public function destroy(string $id) - { - // + public function upload (){ + return view('spatial-plannings.upload'); } } diff --git a/app/Http/Requests/ExcelUploadRequest.php b/app/Http/Requests/ExcelUploadRequest.php new file mode 100644 index 0000000..ad492ca --- /dev/null +++ b/app/Http/Requests/ExcelUploadRequest.php @@ -0,0 +1,28 @@ +|string> + */ + public function rules(): array + { + return [ + "file" => "required|file|mimes:xlsx,xls|max:102400" + ]; + } +} diff --git a/app/Http/Requests/SpatialPlanningsRequest.php b/app/Http/Requests/SpatialPlanningsRequest.php index b1af782..73971b4 100644 --- a/app/Http/Requests/SpatialPlanningsRequest.php +++ b/app/Http/Requests/SpatialPlanningsRequest.php @@ -29,7 +29,7 @@ class SpatialPlanningsRequest extends FormRequest 'luas' => ['required','numeric','regex:/^\d{1,16}(\.\d{1,2})?$/'], 'lokasi' => ['required','string'], 'nomor' => ['required','string','max:255',Rule::unique('spatial_plannings')->ignore($this->id)], - 'tanggal' => ['required','date'], + 'sp_date' => ['required','date'], ]; } } diff --git a/app/Http/Resources/SpatialPlanningsResource.php b/app/Http/Resources/SpatialPlanningsResource.php new file mode 100644 index 0000000..40a29d9 --- /dev/null +++ b/app/Http/Resources/SpatialPlanningsResource.php @@ -0,0 +1,19 @@ + + */ + public function toArray(Request $request): array + { + return parent::toArray($request); + } +} diff --git a/app/Imports/SpatialPlanningImport.php b/app/Imports/SpatialPlanningImport.php new file mode 100644 index 0000000..1f5c548 --- /dev/null +++ b/app/Imports/SpatialPlanningImport.php @@ -0,0 +1,77 @@ + "January", "Februari" => "February", "Maret" => "March", + "April" => "April", "Mei" => "May", "Juni" => "June", + "Juli" => "July", "Agustus" => "August", "September" => "September", + "Oktober" => "October", "November" => "November", "Desember" => "December" + ]; + + $collection->skip(2)->each(function ($row) use ($months) { + if (empty(array_filter($row->toArray()))) { + return; + } + + if (!isset($row[6]) || empty($row[6])) { + return; + } + + if(!SpatialPlanning::where("nomor", $row[6])->exists()){ + $clean_nomor = str_replace('\\','',$row[6]); + $date_string = isset($row[7]) ? trim($row[7]) : null; + $clean_sp_date = null; + if ($date_string) { + if(is_numeric($date_string)) { + $clean_sp_date = Carbon::createFromFormat('Y-m-d', '1900-01-01')->addDays($date_string - 2)->format('Y-m-d'); + }else{ + foreach ($months as $id => $en) { + $date_string = str_replace($id, $en, $date_string); + } + + $formats = ['j F Y', 'd F Y', 'j-M-Y', 'd-M-Y']; + + foreach ($formats as $format) { + $date = DateTime::createFromFormat($format, $date_string); + if ($date) { + $clean_sp_date = $date->format('Y-m-d'); + break; + } + } + } + } + SpatialPlanning::create([ + 'name' => $row[1], + 'kbli' => $row[2], + 'kegiatan' => $row[3], + 'luas' => $row[4], + 'lokasi' => $row[5], + 'nomor' => $clean_nomor, + 'sp_date' => $clean_sp_date, + ]); + } + }); + } + + public function sheets(): array { + return [ + 0 => $this + ]; + } +} diff --git a/database/seeders/UsersRoleMenuSeeder.php b/database/seeders/UsersRoleMenuSeeder.php index 84b7625..d8a4c9f 100644 --- a/database/seeders/UsersRoleMenuSeeder.php +++ b/database/seeders/UsersRoleMenuSeeder.php @@ -186,6 +186,13 @@ class UsersRoleMenuSeeder extends Seeder "parent_id" => $data->id, "sort_order" => 5, ], + [ + "name" => "Tata Ruang", + "url" => "spatial-plannings", + "icon" => null, + "parent_id" => $data->id, + "sort_order" => 6, + ], [ "name" => "Lap Pariwisata", "url" => "tourisms.index", @@ -213,6 +220,7 @@ class UsersRoleMenuSeeder extends Seeder $laporan_pariwisata = Menu::where('name', 'Lap Pariwisata')->first(); $umkm = Menu::where('name', 'UMKM')->first(); $lack_of_potentials = Menu::where('name', 'Dashboard Potensi')->first(); + $spatial_plannings = Menu::where('name', 'Tata Ruang')->first(); // Superadmin gets all menus $superadmin->menus()->sync([ @@ -238,6 +246,7 @@ class UsersRoleMenuSeeder extends Seeder $laporan_pariwisata->id => ["allow_show" => true, "allow_create" => true, "allow_update" => true, "allow_destroy" => true], $umkm->id => ["allow_show" => true, "allow_create" => true, "allow_update" => true, "allow_destroy" => true], $lack_of_potentials->id => ["allow_show" => true, "allow_create" => true, "allow_update" => true, "allow_destroy" => true], + $spatial_plannings->id => ["allow_show" => true, "allow_create" => true, "allow_update" => true, "allow_destroy" => true], ]); // Admin gets limited menus diff --git a/resources/js/spatial-plannings/create.js b/resources/js/spatial-plannings/create.js new file mode 100644 index 0000000..e8ed4f5 --- /dev/null +++ b/resources/js/spatial-plannings/create.js @@ -0,0 +1,69 @@ +import flatpickr from "flatpickr"; + +class CreateSpatialPlannings { + constructor() { + this.initCreateSpatial(); + } + + initCreateSpatial() { + const toastNotification = document.getElementById("toastNotification"); + const toast = new bootstrap.Toast(toastNotification); + document + .getElementById("btnCreateSpatialPlannings") + .addEventListener("click", async function () { + let submitButton = this; + let spinner = document.getElementById("spinner"); + let form = document.getElementById( + "formCreateSpatialPlannings" + ); + + if (!form) { + console.error("Form element not found!"); + return; + } + // Get form data + let formData = new FormData(form); + + // Disable button and show spinner + submitButton.disabled = true; + spinner.classList.remove("d-none"); + + try { + let response = await fetch(form.action, { + method: "POST", + headers: { + Authorization: `Bearer ${document + .querySelector('meta[name="api-token"]') + .getAttribute("content")}`, + }, + body: formData, + }); + + if (response.ok) { + let result = await response.json(); + document.getElementById("toast-message").innerText = + result.message; + toast.show(); + setTimeout(() => { + window.location.href = "/data/spatial-plannings"; + }, 2000); + } else { + let error = await response.json(); + document.getElementById("toast-message").innerText = + error.message; + toast.show(); + console.error("Error:", error); + } + } catch (error) { + console.error("Request failed:", error); + document.getElementById("toast-message").innerText = + error.message; + toast.show(); + } + }); + } +} + +document.addEventListener("DOMContentLoaded", function (e) { + new CreateSpatialPlannings(); +}); diff --git a/resources/js/spatial-plannings/index.js b/resources/js/spatial-plannings/index.js new file mode 100644 index 0000000..51da198 --- /dev/null +++ b/resources/js/spatial-plannings/index.js @@ -0,0 +1,156 @@ +import { Grid } from "gridjs/dist/gridjs.umd.js"; +import gridjs from "gridjs/dist/gridjs.umd.js"; +import "gridjs/dist/gridjs.umd.js"; +import GlobalConfig from "../global-config"; +import Swal from "sweetalert2"; + +class SpatialPlannings { + constructor() { + this.toastMessage = document.getElementById("toast-message"); + this.toastElement = document.getElementById("toastNotification"); + this.toast = new bootstrap.Toast(this.toastElement); + this.table = null; + + // Initialize functions + this.initTableSpatialPlannings(); + this.initEvents(); + } + initEvents() { + document.body.addEventListener("click", async (event) => { + const deleteButton = event.target.closest( + ".btn-delete-spatial-plannings" + ); + if (deleteButton) { + event.preventDefault(); + await this.handleDelete(deleteButton); + } + }); + } + + initTableSpatialPlannings() { + let tableContainer = document.getElementById("table-spatial-plannings"); + // Create a new Grid.js instance only if it doesn't exist + this.table = new Grid({ + columns: [ + "ID", + "Name", + "KBLI", + "Kegiatan", + "Luas", + "Lokasi", + "Nomor", + "Date", + { + name: "Action", + formatter: (cell) => + gridjs.html(` +
+ + + + +
+ `), + }, + ], + pagination: { + limit: 15, + server: { + url: (prev, page) => + `${prev}${prev.includes("?") ? "&" : "?"}page=${ + page + 1 + }`, + }, + }, + sort: true, + search: { + server: { + url: (prev, keyword) => `${prev}?search=${keyword}`, + }, + }, + server: { + url: `${GlobalConfig.apiHost}/api/spatial-plannings`, + credentials: "include", + headers: { + Authorization: `Bearer ${document + .querySelector('meta[name="api-token"]') + .getAttribute("content")}`, + "Content-Type": "application/json", + }, + then: (data) => + data.data.map((item) => [ + item.id, + item.name, + item.kbli, + item.kegiatan, + item.luas, + item.lokasi, + item.nomor, + item.sp_date, + item.id, + ]), + total: (data) => data.meta.total, + }, + }).render(tableContainer); + } + + async handleDelete(deleteButton) { + const id = deleteButton.getAttribute("data-id"); + + const result = await Swal.fire({ + title: "Are you sure?", + text: "You won't be able to revert this!", + icon: "warning", + showCancelButton: true, + confirmButtonColor: "#3085d6", + cancelButtonColor: "#d33", + confirmButtonText: "Yes, delete it!", + }); + + if (result.isConfirmed) { + try { + let response = await fetch( + `${GlobalConfig.apiHost}/api/spatial-plannings/${id}`, + { + method: "DELETE", + credentials: "include", + headers: { + Authorization: `Bearer ${document + .querySelector('meta[name="api-token"]') + .getAttribute("content")}`, + "Content-Type": "application/json", + }, + } + ); + + if (response.ok) { + let result = await response.json(); + this.toastMessage.innerText = + result.message || "Deleted successfully!"; + this.toast.show(); + + // Refresh Grid.js table + if (typeof this.table !== "undefined") { + this.table.updateConfig({}).forceRender(); + } + } else { + let error = await response.json(); + console.error("Delete failed:", error); + this.toastMessage.innerText = + error.message || "Delete failed!"; + this.toast.show(); + } + } catch (error) { + console.error("Error deleting item:", error); + this.toastMessage.innerText = "An error occurred!"; + this.toast.show(); + } + } + } +} + +document.addEventListener("DOMContentLoaded", function (e) { + new SpatialPlannings(); +}); diff --git a/resources/js/spatial-plannings/update.js b/resources/js/spatial-plannings/update.js new file mode 100644 index 0000000..14d56d5 --- /dev/null +++ b/resources/js/spatial-plannings/update.js @@ -0,0 +1,67 @@ +class UpdateSpatialPlannings { + constructor() { + this.initUpdateSpatial(); + } + + initUpdateSpatial() { + const toastNotification = document.getElementById("toastNotification"); + const toast = new bootstrap.Toast(toastNotification); + document + .getElementById("btnUpdateSpatialPlannings") + .addEventListener("click", async function () { + let submitButton = this; + let spinner = document.getElementById("spinner"); + let form = document.getElementById( + "formUpdateSpatialPlannings" + ); + + if (!form) { + console.error("Form element not found!"); + return; + } + // Get form data + let formData = new FormData(form); + + // Disable button and show spinner + submitButton.disabled = true; + spinner.classList.remove("d-none"); + + try { + let response = await fetch(form.action, { + method: "POST", + headers: { + Authorization: `Bearer ${document + .querySelector('meta[name="api-token"]') + .getAttribute("content")}`, + }, + body: formData, + }); + + if (response.ok) { + let result = await response.json(); + document.getElementById("toast-message").innerText = + result.message; + toast.show(); + setTimeout(() => { + window.location.href = "/data/spatial-plannings"; + }, 2000); + } else { + let error = await response.json(); + document.getElementById("toast-message").innerText = + error.message; + toast.show(); + console.error("Error:", error); + } + } catch (error) { + console.error("Request failed:", error); + document.getElementById("toast-message").innerText = + error.message; + toast.show(); + } + }); + } +} + +document.addEventListener("DOMContentLoaded", function (e) { + new UpdateSpatialPlannings(); +}); diff --git a/resources/js/spatial-plannings/upload.js b/resources/js/spatial-plannings/upload.js new file mode 100644 index 0000000..b8bbc26 --- /dev/null +++ b/resources/js/spatial-plannings/upload.js @@ -0,0 +1,83 @@ +import { Dropzone } from "dropzone"; +Dropzone.autoDiscover = false; + +class UploadSpatialPlannings { + constructor() { + this.spatialDropzone = null; + this.formElement = document.getElementById( + "formUploadSpatialPlannings" + ); + this.uploadButton = document.getElementById("submit-upload"); + this.spinner = document.getElementById("spinner"); + if (!this.formElement) { + console.error( + "Element formUploadSpatialPlannings tidak ditemukan!" + ); + } + } + + init() { + this.initDropzone(); + this.setupUploadButton(); + } + + initDropzone() { + const toastNotification = document.getElementById("toastNotification"); + const toast = new bootstrap.Toast(toastNotification); + var previewTemplate, + dropzonePreviewNode = document.querySelector( + "#dropzone-preview-list" + ); + (dropzonePreviewNode.id = ""), + dropzonePreviewNode && + ((previewTemplate = dropzonePreviewNode.parentNode.innerHTML), + dropzonePreviewNode.parentNode.removeChild(dropzonePreviewNode), + (this.spatialDropzone = new Dropzone(".dropzone", { + url: this.formElement.action, + method: "post", + acceptedFiles: ".xls,.xlsx", + previewTemplate: previewTemplate, + previewsContainer: "#dropzone-preview", + autoProcessQueue: false, + headers: { + Authorization: `Bearer ${document + .querySelector('meta[name="api-token"]') + .getAttribute("content")}`, + }, + init: function () { + this.on("success", function (file, response) { + document.getElementById("toast-message").innerText = + response.message; + toast.show(); + setTimeout(() => { + window.location.href = + "/data/spatial-plannings"; + }, 2000); + }); + this.on("error", function (file, errorMessage) { + document.getElementById("toast-message").innerText = + errorMessage.message; + toast.show(); + this.uploadButton.disabled = false; + this.spinner.classList.add("d-none"); + }); + }, + }))); + } + + setupUploadButton() { + this.uploadButton.addEventListener("click", (e) => { + if (this.spatialDropzone.files.length > 0) { + this.spatialDropzone.processQueue(); + this.uploadButton.disabled = true; + this.spinner.classList.remove("d-none"); + } else { + return; + } + }); + } +} + +document.addEventListener("DOMContentLoaded", function (e) { + new UploadSpatialPlannings().init(); +}); diff --git a/resources/views/spatial-plannings/create.blade.php b/resources/views/spatial-plannings/create.blade.php new file mode 100644 index 0000000..c94d7d1 --- /dev/null +++ b/resources/views/spatial-plannings/create.blade.php @@ -0,0 +1,32 @@ +@extends('layouts.vertical', ['subtitle' => 'Data']) + +@section('content') + +@include('layouts.partials/page-title', ['title' => 'Data', 'subtitle' => 'Tata Ruang']) + + +
+
+
+
+ Back +
+
+
+ @csrf + @include('spatial-plannings.form') + +
+
+
+
+
+ +@endsection + +@section('scripts') +@vite(['resources/js/spatial-plannings/create.js']) +@endsection diff --git a/resources/views/spatial-plannings/form.blade.php b/resources/views/spatial-plannings/form.blade.php new file mode 100644 index 0000000..18c78ea --- /dev/null +++ b/resources/views/spatial-plannings/form.blade.php @@ -0,0 +1,28 @@ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
\ No newline at end of file diff --git a/resources/views/spatial-plannings/index.blade.php b/resources/views/spatial-plannings/index.blade.php index 5187f80..44414db 100644 --- a/resources/views/spatial-plannings/index.blade.php +++ b/resources/views/spatial-plannings/index.blade.php @@ -1,3 +1,32 @@ -
- +@extends('layouts.vertical', ['subtitle' => 'Data']) + +@section('css') +@vite(['node_modules/gridjs/dist/theme/mermaid.min.css']) +@endsection + +@section('content') + +@include('layouts.partials/page-title', ['title' => 'Data', 'subtitle' => 'Tata Ruang']) + + + + +
+
+
+
+
+ Create + Upload +
+
+
+
+
+ +@endsection + +@section('scripts') +@vite(['resources/js/spatial-plannings/index.js']) +@endsection \ No newline at end of file diff --git a/resources/views/spatial-plannings/update.blade.php b/resources/views/spatial-plannings/update.blade.php new file mode 100644 index 0000000..8b198f4 --- /dev/null +++ b/resources/views/spatial-plannings/update.blade.php @@ -0,0 +1,33 @@ +@extends('layouts.vertical', ['subtitle' => 'Data']) + +@section('content') + +@include('layouts.partials/page-title', ['title' => 'Data', 'subtitle' => 'Tata Ruang']) + + +
+
+
+
+ Back +
+
+
+ @csrf + @method('put') + @include('spatial-plannings.form') + +
+
+
+
+
+ +@endsection + +@section('scripts') +@vite(['resources/js/spatial-plannings/update.js']) +@endsection diff --git a/resources/views/spatial-plannings/upload.blade.php b/resources/views/spatial-plannings/upload.blade.php new file mode 100644 index 0000000..a70e86d --- /dev/null +++ b/resources/views/spatial-plannings/upload.blade.php @@ -0,0 +1,80 @@ +@extends('layouts.vertical', ['subtitle' => 'Data']) + +@section('content') + +@include('layouts.partials/page-title', ['title' => 'Data', 'subtitle' => 'Tata Ruang']) + + +
+
+
+
+
Upload Data
+

+ Please upload a file with the extension .xls or .xlsx with a maximum size of 10 MB. +
+ For .xls and .xlsx files, ensure that the data is contained within a single sheet with the following columns: + No, Nama, KBLI, Kegiatan, Luas, Lokasi, Nomor, Tanggal. +

+
+ +
+ +
+ +
+
+
+ +
+
+
+ +

Drop files here or click to upload.

+
+
+ +
    +
  • + +
    +
    +
    +
    + +
    +
    +
    +
    +
      +
    +

    + +
    +
    +
    + +
    +
    +
    +
  • +
+ +
+
+ +
+
+
+
+
+ +@endsection + +@section('scripts') +@vite(['resources/js/spatial-plannings/upload.js']) +@endsection \ No newline at end of file diff --git a/routes/api.php b/routes/api.php index 54bff93..886f4d0 100644 --- a/routes/api.php +++ b/routes/api.php @@ -11,6 +11,7 @@ use App\Http\Controllers\Api\PbgTaskController; use App\Http\Controllers\Api\RequestAssignmentController; use App\Http\Controllers\Api\RolesController; use App\Http\Controllers\Api\ScrapingController; +use App\Http\Controllers\Api\SpatialPlanningsController; use App\Http\Controllers\Api\UsersController; use App\Http\Controllers\Settings\SyncronizeController; use App\Http\Controllers\Api\AdvertisementController; @@ -93,6 +94,14 @@ Route::group(['middleware' => 'auth:sanctum'], function (){ //business industries api Route::apiResource('api-business-industries', BusinessOrIndustriesController::class); Route::post('api-business-industries/upload', [BusinessOrIndustriesController::class, 'upload'])->name('business-industries.upload'); + + Route::controller(SpatialPlanningsController::class)->group( function (){ + Route::get('/spatial-plannings', 'index')->name('api.spatial-plannings'); + Route::post('/spatial-plannings', 'store')->name('api.spatial-plannings.store'); + Route::put('/spatial-plannings/{id}', 'update')->name('api.spatial-plannings.update'); + Route::delete('/spatial-plannings/{id}', 'destroy')->name('api.spatial-plannings.destroy'); + Route::post('/spatial-plannings/upload', 'upload')->name('api.spatial-plannings.upload'); + }); }); diff --git a/routes/web.php b/routes/web.php index 2ae134c..adee5ea 100755 --- a/routes/web.php +++ b/routes/web.php @@ -15,6 +15,7 @@ use App\Http\Controllers\Data\AdvertisementController; use App\Http\Controllers\Data\UmkmController; use App\Http\Controllers\Data\TourismController; use App\Http\Controllers\Report\ReportTourismController; +use App\Http\Controllers\SpatialPlanningsController; use Illuminate\Support\Facades\Route; require __DIR__ . '/auth.php'; @@ -82,6 +83,13 @@ Route::group(['middleware' => 'auth'], function(){ Route::get('/tourisms/create', [TourismController::class, 'create'])->name('tourisms.create'); Route::get('/tourisms/bulk-create', [TourismController::class, 'bulkCreate'])->name('tourisms.bulk-create'); Route::resource('/business-industries',BusinessOrIndustriesController::class); + + Route::controller(SpatialPlanningsController::class)->group( function (){ + Route::get('/spatial-plannings', 'index')->name('spatial-plannings'); + Route::get('/spatial-plannings/create', 'create')->name('spatial-plannings.create'); + Route::get('/spatial-plannings/{spatial_planning_id}/edit', 'edit')->name('spatial-plannings.edit'); + Route::get('/spatial-plannings/upload', 'upload')->name('spatial-plannings.upload'); + }); }); // Report diff --git a/vite.config.js b/vite.config.js index 2abc22d..a822470 100755 --- a/vite.config.js +++ b/vite.config.js @@ -89,6 +89,11 @@ export default defineConfig({ "resources/js/data/tourisms/form-create-update.js", "resources/js/data/tourisms/form-upload.js", "resources/js/report/tourisms/index.js", + // spatial-plannings + "resources/js/spatial-plannings/index.js", + "resources/js/spatial-plannings/create.js", + "resources/js/spatial-plannings/update.js", + "resources/js/spatial-plannings/upload.js", ], refresh: true, }),