add status spatial plannings
This commit is contained in:
@@ -535,16 +535,14 @@ class BigData {
|
||||
});
|
||||
}
|
||||
initChartNonBusinessDLH() {
|
||||
document
|
||||
.querySelectorAll("#non-business-dlh-count")
|
||||
.forEach((element) => {
|
||||
const count = this.safeGet(
|
||||
this.resumeBigData,
|
||||
"non_business_dlh_count",
|
||||
0
|
||||
);
|
||||
element.innerText = `${count}`;
|
||||
});
|
||||
document.querySelectorAll("#business-dlh-count").forEach((element) => {
|
||||
const count = this.safeGet(
|
||||
this.resumeBigData,
|
||||
"business_dlh_count",
|
||||
0
|
||||
);
|
||||
element.innerText = `${count}`;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import gridjs from "gridjs/dist/gridjs.umd.js";
|
||||
import "gridjs/dist/gridjs.umd.js";
|
||||
import GlobalConfig, { addThousandSeparators } from "../../global-config.js";
|
||||
import GeneralTable from "../../table-generator.js";
|
||||
import moment from "moment";
|
||||
|
||||
// Ambil hak akses dari data-attribute
|
||||
const tableElement = document.getElementById("spatial-planning-data-table");
|
||||
@@ -15,7 +16,11 @@ const dataSpatialPlanningColumns = [
|
||||
"Nama",
|
||||
"KBLI",
|
||||
"Kegiatan",
|
||||
"Luas",
|
||||
"Luas Lahan",
|
||||
"BCR",
|
||||
"Jenis Usaha",
|
||||
"Status Terbit",
|
||||
"Retribusi",
|
||||
"Lokasi",
|
||||
"Nomor",
|
||||
"Tanggal",
|
||||
@@ -23,7 +28,7 @@ const dataSpatialPlanningColumns = [
|
||||
name: "Actions",
|
||||
widht: "120px",
|
||||
formatter: function (cell, row) {
|
||||
const id = row.cells[8].data;
|
||||
const id = row.cells[12].data;
|
||||
const model = "data/web-spatial-plannings";
|
||||
|
||||
let actionButtons = '<div class="d-flex justify-items-end gap-10">';
|
||||
@@ -73,15 +78,27 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
table.processData = function (data) {
|
||||
return data.data.map((item) => {
|
||||
// Format retribution amount
|
||||
const retributionAmount = item.calculated_retribution
|
||||
? addThousandSeparators(item.calculated_retribution)
|
||||
: "0";
|
||||
|
||||
// Format business type
|
||||
const businessType = item.is_business_type ? "USAHA" : "NON USAHA";
|
||||
|
||||
return [
|
||||
item.no,
|
||||
item.name,
|
||||
item.kbli,
|
||||
item.activities,
|
||||
addThousandSeparators(item.area),
|
||||
addThousandSeparators(item.land_area || item.area),
|
||||
addThousandSeparators(item.site_bcr),
|
||||
`${businessType}`,
|
||||
item.is_terbit ? "Sudah Terbit" : "Belum Terbit",
|
||||
`${retributionAmount}`,
|
||||
item.location,
|
||||
item.number,
|
||||
item.date,
|
||||
moment(item.date).format("YYYY-MM-DD"),
|
||||
item.id,
|
||||
];
|
||||
});
|
||||
|
||||
@@ -9,6 +9,9 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
if (!saveButton || !form) return;
|
||||
|
||||
// Initialize is_terbit toggle
|
||||
initIsTerbitToggle();
|
||||
|
||||
saveButton.addEventListener("click", function () {
|
||||
// Disable tombol dan tampilkan spinner
|
||||
modalButton.disabled = true;
|
||||
@@ -29,6 +32,12 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
data[key] = value;
|
||||
});
|
||||
|
||||
// Handle checkbox properly - ensure boolean value is sent
|
||||
const isTerbitCheckbox = document.getElementById("is_terbit");
|
||||
if (isTerbitCheckbox) {
|
||||
data["is_terbit"] = isTerbitCheckbox.checked ? 1 : 0;
|
||||
}
|
||||
|
||||
const url = form.getAttribute("action");
|
||||
|
||||
const method = isEdit ? "PUT" : "POST";
|
||||
@@ -183,4 +192,29 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
document.querySelector(".btn-back").addEventListener("click", function () {
|
||||
window.history.back();
|
||||
});
|
||||
|
||||
// Function to handle is_terbit toggle
|
||||
function initIsTerbitToggle() {
|
||||
const checkbox = document.getElementById("is_terbit");
|
||||
const statusText = document.querySelector(".status-text");
|
||||
const statusDescription = statusText?.nextElementSibling;
|
||||
|
||||
if (checkbox && statusText) {
|
||||
checkbox.addEventListener("change", function () {
|
||||
if (this.checked) {
|
||||
statusText.textContent = "Sudah Terbit";
|
||||
if (statusDescription) {
|
||||
statusDescription.textContent =
|
||||
"Status PBG sudah diterbitkan";
|
||||
}
|
||||
} else {
|
||||
statusText.textContent = "Belum Terbit";
|
||||
if (statusDescription) {
|
||||
statusDescription.textContent =
|
||||
"Status PBG belum diterbitkan";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -91,16 +91,16 @@
|
||||
</div>
|
||||
|
||||
<div style="position: absolute; top: 50px; left: 900px; width: 200px; height: 200px; ">
|
||||
<x-custom-circle title="RAB dan Gambar" size="medium" style="background-color: #c248a7;float:left;margin-left:250px;"
|
||||
<x-custom-circle title="GAMBAR" size="medium" style="background-color: #c248a7;float:left;margin-left:250px;"
|
||||
visible_data="true" data_id="non-business-rab-count" data_count="0"
|
||||
document_url="{!! route('pbg-task.index') . '?' . http_build_query(['menu_id' => $menus->where('url','pbg-task.index')->first()->id, 'filter' => 'non-business', 'year' => date('Y')]) !!}"
|
||||
document_url="{!! route('pbg-task.index') . '?' . http_build_query(['menu_id' => $menus->where('url','pbg-task.index')->first()->id, 'filter' => 'non-business-rab', 'year' => date('Y')]) !!}"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div style="position: absolute; top: 160px; left: 900px; width: 200px; height: 200px; ">
|
||||
<x-custom-circle title="KRK" size="medium" style="background-color: #295040;float:left;margin-left:250px;"
|
||||
visible_data="true" data_id="non-business-krk-count" data_count="0"
|
||||
document_url="{!! route('pbg-task.index') . '?' . http_build_query(['menu_id' => $menus->where('url','pbg-task.index')->first()->id, 'filter' => 'non-business', 'year' => date('Y')]) !!}"
|
||||
document_url="{!! route('pbg-task.index') . '?' . http_build_query(['menu_id' => $menus->where('url','pbg-task.index')->first()->id, 'filter' => 'non-business-krk', 'year' => date('Y')]) !!}"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -114,23 +114,23 @@
|
||||
</div>
|
||||
|
||||
<div style="position: absolute; top: 350px; left: 900px; width: 200px; height: 200px; ">
|
||||
<x-custom-circle title="RAB dan Gambar" size="medium" style="background-color: #c248a7;float:left;margin-left:250px;"
|
||||
<x-custom-circle title="GAMBAR" size="medium" style="background-color: #c248a7;float:left;margin-left:250px;"
|
||||
visible_data="true" data_id="business-rab-count" data_count="0"
|
||||
document_url="{!! route('pbg-task.index') . '?' . http_build_query(['menu_id' => $menus->where('url','pbg-task.index')->first()->id, 'filter' => 'business', 'year' => date('Y')]) !!}"
|
||||
document_url="{!! route('pbg-task.index') . '?' . http_build_query(['menu_id' => $menus->where('url','pbg-task.index')->first()->id, 'filter' => 'business-rab', 'year' => date('Y')]) !!}"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div style="position: absolute; top: 460px; left: 900px; width: 200px; height: 200px; ">
|
||||
<x-custom-circle title="KRK" size="medium" style="background-color: #1d8b1d;float:left;margin-left:250px;"
|
||||
visible_data="true" data_id="business-krk-count" data_count="0"
|
||||
document_url="{!! route('pbg-task.index') . '?' . http_build_query(['menu_id' => $menus->where('url','pbg-task.index')->first()->id, 'filter' => 'business', 'year' => date('Y')]) !!}"
|
||||
document_url="{!! route('pbg-task.index') . '?' . http_build_query(['menu_id' => $menus->where('url','pbg-task.index')->first()->id, 'filter' => 'business-krk', 'year' => date('Y')]) !!}"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div style="position: absolute; top: 570px; left: 900px; width: 200px; height: 200px; ">
|
||||
<x-custom-circle title="DLH" size="medium" style="background-color: #351d02;float:left;margin-left:250px;"
|
||||
visible_data="true" data_id="business-dlh-count" data_count="0"
|
||||
document_url="{!! route('pbg-task.index') . '?' . http_build_query(['menu_id' => $menus->where('url','pbg-task.index')->first()->id, 'filter' => 'business', 'year' => date('Y')]) !!}"
|
||||
document_url="{!! route('pbg-task.index') . '?' . http_build_query(['menu_id' => $menus->where('url','pbg-task.index')->first()->id, 'filter' => 'business-dlh', 'year' => date('Y')]) !!}"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,5 +1,76 @@
|
||||
@extends('layouts.vertical', ['subtitle' => $subtitle]) <!-- Menggunakan subtitle dari controller -->
|
||||
|
||||
@section('css')
|
||||
<style>
|
||||
.form-check.form-switch {
|
||||
padding-left: 0;
|
||||
|
||||
.form-check-input {
|
||||
width: 3.25rem;
|
||||
height: 1.75rem;
|
||||
border-radius: 1rem;
|
||||
background-color: #dc3545; // Default to red (belum terbit)
|
||||
border: none;
|
||||
transition: all 0.3s ease;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
margin-left: 0;
|
||||
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
|
||||
&:checked {
|
||||
background-color: #28a745; // Green when checked (sudah terbit)
|
||||
box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
|
||||
}
|
||||
|
||||
&:focus {
|
||||
box-shadow: 0 0 0 0.2rem rgba(93, 135, 255, 0.25);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0.125rem;
|
||||
left: 0.125rem;
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
background-color: #fff;
|
||||
border-radius: 50%;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
&:checked::before {
|
||||
transform: translateX(1.5rem);
|
||||
}
|
||||
}
|
||||
|
||||
.form-check-label {
|
||||
margin-left: 1rem;
|
||||
cursor: pointer;
|
||||
padding-left: 0;
|
||||
|
||||
.status-text {
|
||||
font-weight: 600;
|
||||
font-size: 1rem;
|
||||
color: #2c3e50;
|
||||
transition: color 0.3s ease;
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: 0.85rem;
|
||||
margin-top: 0.25rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
@include('layouts.partials/page-title', ['title' => $title, 'subtitle' => $subtitle]) <!-- Menggunakan title dan subtitle dari controller -->
|
||||
@@ -38,38 +109,83 @@
|
||||
|
||||
<div class="row">
|
||||
@foreach($fields as $field => $label)
|
||||
<div class="col-md-6 form-group mb-3">
|
||||
<label for="{{ $field }}">{{ $label }}</label>
|
||||
@php
|
||||
$fieldType = $fieldTypes[$field] ?? 'text'; // Default text jika tidak ditemukan tipe
|
||||
@endphp
|
||||
@if($field == 'is_terbit')
|
||||
<!-- Special handling for is_terbit toggle -->
|
||||
<div class="col-md-6 form-group mb-3">
|
||||
<label class="form-label">{{ $label }}</label>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="is_terbit" name="is_terbit" value="1"
|
||||
{{ old('is_terbit', isset($modelInstance) && $modelInstance->is_terbit ? 'checked' : '') }}>
|
||||
<label class="form-check-label" for="is_terbit">
|
||||
<span class="status-text">{{ old('is_terbit', isset($modelInstance) && $modelInstance->is_terbit) ? 'Sudah Terbit' : 'Belum Terbit' }}</span>
|
||||
<small class="text-muted d-block">
|
||||
{{ old('is_terbit', isset($modelInstance) && $modelInstance->is_terbit) ? 'Status PBG sudah diterbitkan' : 'Status PBG belum diterbitkan' }}
|
||||
</small>
|
||||
</label>
|
||||
</div>
|
||||
<!-- Hidden input to ensure false value is sent when unchecked -->
|
||||
<input type="hidden" name="is_terbit" value="0">
|
||||
</div>
|
||||
@elseif($field == 'calculated_retribution' && isset($modelInstance))
|
||||
<!-- Special handling for calculated retribution (read-only) -->
|
||||
<div class="col-md-6 form-group mb-3">
|
||||
<label class="form-label">{{ $label }}</label>
|
||||
<div class="form-control bg-light" readonly>
|
||||
<strong class="text-success">{{ $modelInstance->formatted_retribution ?? '0' }}</strong>
|
||||
</div>
|
||||
<small class="text-muted">
|
||||
Rumus: LUAS LAHAN × BCR (decimal) × HARGA SATUAN<br>
|
||||
Detail: {{ $modelInstance->land_area ?? 0 }} m² × {{ ($modelInstance->site_bcr ?? 0) / 100 }} ×
|
||||
<strong class="{{ $modelInstance->is_business_type ? 'text-success' : 'text-primary' }}">
|
||||
{{ $modelInstance->is_business_type ? 'Rp 44.300 (USAHA)' : 'Rp 16.000 (NON USAHA)' }}
|
||||
</strong>
|
||||
</small>
|
||||
</div>
|
||||
@elseif($field == 'business_type_info' && isset($modelInstance))
|
||||
<!-- Business type information (read-only) -->
|
||||
<div class="col-md-6 form-group mb-3">
|
||||
<label class="form-label">Jenis Usaha</label>
|
||||
<div class="form-control bg-light" readonly>
|
||||
<span class="badge {{ $modelInstance->is_business_type ? 'bg-success' : 'bg-primary' }}">
|
||||
{{ $modelInstance->is_business_type ? 'USAHA' : 'NON USAHA' }}
|
||||
</span>
|
||||
</div>
|
||||
<small class="text-muted">Terdeteksi otomatis dari fungsi bangunan: "{{ $modelInstance->building_function ?? $modelInstance->activities ?? 'N/A' }}"</small>
|
||||
</div>
|
||||
@else
|
||||
<div class="col-md-6 form-group mb-3">
|
||||
<label for="{{ $field }}">{{ $label }}</label>
|
||||
@php
|
||||
$fieldType = $fieldTypes[$field] ?? 'text'; // Default text jika tidak ditemukan tipe
|
||||
@endphp
|
||||
|
||||
@if($fieldType == 'textarea')
|
||||
<textarea id="{{ $field }}" name="{{ $field }}" class="form-control">{{ old($field, isset($modelInstance) ? $modelInstance->{$field} : '') }}</textarea>
|
||||
@elseif($fieldType == 'select' && isset($dropdownOptions[$field]))
|
||||
<select id="{{ $field }}" name="{{ $field }}" class="form-control">
|
||||
@foreach($dropdownOptions[$field] as $code => $name)
|
||||
@php
|
||||
// $selectedValue = old($field, $modelInstance->{$field});
|
||||
$selectedValue = old($field, $modelInstance->$field ?? '');
|
||||
$isSelected = strval($selectedValue) === strval($code);
|
||||
@endphp
|
||||
<option value="{{ $code }}" class="{{ $isSelected ? 'selected' : '' }}" {{ $isSelected ? 'selected' : '' }}>
|
||||
{{ $name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@elseif($fieldType == 'combobox' && isset($dropdownOptions[$field]))
|
||||
<input class="form-control" list="{{ $field }}Options" id="{{ $field }}" name="{{ $field }}"
|
||||
value="{{ old($field, isset($modelInstance) ? $modelInstance->{$field} : '') }}" placeholder="Type to search..." oninput="fetchOptions('{{ $field }}')">
|
||||
<datalist id="{{ $field }}Options"></datalist>
|
||||
@elseif($fieldType == 'date')
|
||||
<input type="date" id="{{ $field }}" name="{{ $field }}" class="form-control"
|
||||
value="{{ old($field, isset($modelInstance) && $modelInstance->{$field} ? \Carbon\Carbon::parse($modelInstance->{$field})->format('Y-m-d') : '') }}">
|
||||
@else
|
||||
<input type="{{ $fieldType }}" id="{{ $field }}" name="{{ $field }}" class="form-control" value="{{ old($field, isset($modelInstance) ? $modelInstance->{$field} : '') }}">
|
||||
@endif
|
||||
</div>
|
||||
@if($fieldType == 'textarea')
|
||||
<textarea id="{{ $field }}" name="{{ $field }}" class="form-control">{{ old($field, isset($modelInstance) ? $modelInstance->{$field} : '') }}</textarea>
|
||||
@elseif($fieldType == 'select' && isset($dropdownOptions[$field]))
|
||||
<select id="{{ $field }}" name="{{ $field }}" class="form-control">
|
||||
@foreach($dropdownOptions[$field] as $code => $name)
|
||||
@php
|
||||
// $selectedValue = old($field, $modelInstance->{$field});
|
||||
$selectedValue = old($field, $modelInstance->$field ?? '');
|
||||
$isSelected = strval($selectedValue) === strval($code);
|
||||
@endphp
|
||||
<option value="{{ $code }}" class="{{ $isSelected ? 'selected' : '' }}" {{ $isSelected ? 'selected' : '' }}>
|
||||
{{ $name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@elseif($fieldType == 'combobox' && isset($dropdownOptions[$field]))
|
||||
<input class="form-control" list="{{ $field }}Options" id="{{ $field }}" name="{{ $field }}"
|
||||
value="{{ old($field, isset($modelInstance) ? $modelInstance->{$field} : '') }}" placeholder="Type to search..." oninput="fetchOptions('{{ $field }}')">
|
||||
<datalist id="{{ $field }}Options"></datalist>
|
||||
@elseif($fieldType == 'date')
|
||||
<input type="date" id="{{ $field }}" name="{{ $field }}" class="form-control"
|
||||
value="{{ old($field, isset($modelInstance) && $modelInstance->{$field} ? \Carbon\Carbon::parse($modelInstance->{$field})->format('Y-m-d') : '') }}">
|
||||
@else
|
||||
<input type="{{ $fieldType }}" id="{{ $field }}" name="{{ $field }}" class="form-control" value="{{ old($field, isset($modelInstance) ? $modelInstance->{$field} : '') }}">
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
|
||||
@@ -73,10 +73,7 @@
|
||||
<div class="col-lg-4 col-md-4 mb-2">
|
||||
<div class="d-flex gap-2">
|
||||
<button type="submit" class="btn btn-primary btn-sm py-2 fw-semibold shadow-sm">
|
||||
<i class="fas fa-filter me-1"></i>Terapkan
|
||||
</button>
|
||||
<button type="button" id="reset-filter" class="btn btn-outline-secondary btn-sm py-2 fw-semibold">
|
||||
<i class="fas fa-undo me-1"></i>Reset
|
||||
Terapkan
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user