diff --git a/.gitignore b/.gitignore
index 6ec4adf2..b3c8ae49 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,6 +38,7 @@ graphify-out
docs
specs/
.opencode/
+.gemini/
.specify/
storage/sso
.claude/
diff --git a/app/Exports/ImporDataSpasialTemplateExport.php b/app/Exports/ImporDataSpasialTemplateExport.php
new file mode 100644
index 00000000..e08d121e
--- /dev/null
+++ b/app/Exports/ImporDataSpasialTemplateExport.php
@@ -0,0 +1,166 @@
+SHOULD_PRESERVE_EMPTY_ROWS = true;
+
+ $writer = new Writer($options);
+ $writer->openToFile($filePath);
+
+ $infoLabelStyle = (new Style)->setFontBold();
+
+ $writer->getCurrentSheet()->setName(self::SHEET_PETUNJUK);
+ $writer->addRow(Row::fromValues(['PETUNJUK PENGISIAN TEMPLATE IMPOR DATASPASIAL'], $infoLabelStyle));
+ $writer->addRow(Row::fromValues(['']));
+ $writer->addRow(Row::fromValues(['1. Isi kolom sesuai dengan data yang dimiliki.']));
+ $writer->addRow(Row::fromValues(['2. Pilih desa pada kolom pertama dari daftar dropdown (jika tersedia).']));
+ $writer->addRow(Row::fromValues(['3. Isi kode_fasilitas dan nama_fasilitas sesuai data.']));
+ $writer->addRow(Row::fromValues(['4. Kolom lainnya diisi sesuai skema terbit untuk sektor yang dipilih.']));
+ $writer->addRow(Row::fromValues(['5. Jangan mengubah nama sheet atau header kolom.']));
+ if ($this->sektor) {
+ $writer->addRow(Row::fromValues(['']));
+ $writer->addRow(Row::fromValues(['Sektor: '.$this->sektor]));
+ }
+
+ $writer->addNewSheetAndMakeItCurrent();
+ $writer->getCurrentSheet()->setName(self::SHEET_DATA);
+ $writer->addRow(Row::fromValues(['TEMPLATE IMPOR DATASPASIAL'], $infoLabelStyle));
+ $writer->addRow(Row::fromValues(['Sektor', $this->sektor]));
+ if ($this->periode) {
+ $writer->addRow(Row::fromValues(['Periode', $this->periode]));
+ }
+ $writer->addRow(Row::fromValues(['']));
+ $writer->addRow(Row::fromValues(['Catatan: Pilih desa dari dropdown pada kolom pertama.']));
+ $writer->addRow(Row::fromValues(['']));
+ $writer->addRow(Row::fromValues(['']));
+
+ $header = ['kode_desa', 'kode_fasilitas', 'nama_fasilitas'];
+ foreach ($this->items as $item) {
+ if (is_array($item)) {
+ $key = $item['kode'] ?? $item['key'] ?? $item['id'] ?? $item['nama'] ?? $item['label'] ?? 'field';
+ } else {
+ $key = (string) $item;
+ }
+ $key = preg_replace('/[^A-Za-z0-9_]/', '_', strtolower((string) $key));
+ $header[] = $key;
+ }
+ $headerStyle = (new Style)->setFontBold()->setBackgroundColor(Color::YELLOW);
+ $writer->addRow(Row::fromValues($header), $headerStyle);
+
+ $writer->addNewSheetAndMakeItCurrent();
+ $writer->getCurrentSheet()->setName(self::SHEET_DESA);
+ $writer->addRow(Row::fromValues(['Kode Desa', 'Nama Desa', 'Kode - Nama'], (new Style)->setFontBold()));
+
+ $desaList = $this->desaList;
+ if (is_object($desaList) && method_exists($desaList, 'toArray')) {
+ $desaList = $desaList->toArray();
+ }
+ if (! is_array($desaList)) {
+ $desaList = [];
+ }
+
+ foreach ($desaList as $desa) {
+ if (is_object($desa)) {
+ if (method_exists($desa, 'toArray')) {
+ $desa = $desa->toArray();
+ } else {
+ $desa = (array) $desa;
+ }
+ }
+ if (is_array($desa)) {
+ $attrs = $desa['attributes'] ?? [];
+ if (is_array($attrs)) {
+ $kode = $desa['kode_desa'] ?? $desa['kode'] ?? ($attrs['kode_desa'] ?? ($attrs['kode'] ?? ''));
+ $nama = $desa['nama_desa'] ?? $desa['nama'] ?? ($attrs['nama_desa'] ?? ($attrs['nama'] ?? ''));
+ } else {
+ $kode = $desa['kode_desa'] ?? $desa['kode'] ?? '';
+ $nama = $desa['nama_desa'] ?? $desa['nama'] ?? '';
+ }
+ } else {
+ continue;
+ }
+ $writer->addRow(Row::fromValues([(string) $kode, (string) $nama, (string) $kode.' - '.(string) $nama]));
+ }
+
+ $writer->close();
+ $this->injectDesaDropdown($filePath);
+ }
+
+ protected function injectDesaDropdown(string $filePath): void
+ {
+ $desaList = $this->desaList;
+ if (is_object($desaList) && method_exists($desaList, 'toArray')) {
+ $desaList = $desaList->toArray();
+ }
+ if (! is_array($desaList) || $desaList === []) {
+ return;
+ }
+ $this->desaList = $desaList; // normalize for count below
+
+ $zip = new ZipArchive;
+ if ($zip->open($filePath) !== true) {
+ return;
+ }
+
+ $sheetPath = 'xl/worksheets/sheet2.xml';
+ $xml = $zip->getFromName($sheetPath);
+ if ($xml === false) {
+ $sheetPath = 'xl/worksheets/sheet1.xml';
+ $xml = $zip->getFromName($sheetPath);
+ }
+ if ($xml === false) {
+ $zip->close();
+ return;
+ }
+
+ $dataStartRow = self::CONTEXT_ROWS + 2;
+ $lastRow = $dataStartRow + 999;
+ $lastDesaRow = count($this->desaList) + 1;
+ $formula = sprintf("'%s'!\$C\$2:\$C\$%d", self::SHEET_DESA, $lastDesaRow);
+
+ $validation = ''
+ .htmlspecialchars($formula, ENT_XML1 | ENT_QUOTES, 'UTF-8')
+ .'';
+
+ $pos = strpos($xml, '');
+ if ($pos !== false) {
+ $formulaBlock = '';
+ for ($r = $dataStartRow; $r <= $dataStartRow + 49; $r++) {
+ $formulaBlock .= 'IFERROR(MID(A'.$r.',FIND(" - ",A'.$r.')+3,255),"")
';
+ }
+ $xml = substr_replace($xml, ''.$formulaBlock.$validation, $pos, strlen(''));
+ $zip->addFromString($sheetPath, $xml);
+ } else {
+ $zip->close();
+ return;
+ }
+
+ $zip->close();
+ }
+}
diff --git a/app/Http/Controllers/DataSpasial/ImporDataController.php b/app/Http/Controllers/DataSpasial/ImporDataController.php
index 0b566665..cbe05d52 100644
--- a/app/Http/Controllers/DataSpasial/ImporDataController.php
+++ b/app/Http/Controllers/DataSpasial/ImporDataController.php
@@ -4,17 +4,29 @@
namespace App\Http\Controllers\DataSpasial;
+use App\Exports\ImporDataSpasialTemplateExport;
+use App\Http\Requests\DataSpasial\PreviewImporRequest;
+use App\Http\Requests\DataSpasial\UploadImporRequest;
+use App\Services\ConfigApiService;
+use App\Services\DataSpasialApiService;
use App\Services\DataSpasialResult;
+use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
+use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Session;
+use Illuminate\View\View;
+use OpenSpout\Reader\XLSX\Reader;
+use Symfony\Component\HttpFoundation\BinaryFileResponse;
-/**
- * Menu Impor Data (Operator Impor).
- *
- * Kerangka menu pada fase fondasi ini. Alur impor lengkap (template, validasi
- * per baris, ringkasan ditolak/konflik) menjadi lingkup KAB-04.
- */
class ImporDataController extends DataSpasialController
{
+ public function __construct(
+ DataSpasialApiService $dataspasial,
+ protected ConfigApiService $configApiService
+ ) {
+ parent::__construct($dataspasial);
+ }
+
protected function pageTitle(): string
{
return 'Impor Data';
@@ -27,10 +39,388 @@ protected function viewName(): string
protected function fetch(Request $request): DataSpasialResult
{
- return $this->dataspasial->listFasilitas($request->only([
- 'sektor_id',
- 'skema_versi_id',
- 'kode_desa',
- ]));
+ return DataSpasialResult::empty([], null, 200);
+ }
+
+ public function index(Request $request): View
+ {
+ $sektors = $this->dataspasial->listSektor();
+ $kecamatans = $this->configApiService->kecamatan();
+
+ return view($this->viewName(), [
+ 'title' => $this->pageTitle(),
+ 'sektors' => $sektors,
+ 'kecamatans' => $kecamatans,
+ ]);
+ }
+
+ public function downloadTemplate(Request $request)
+ {
+ $request->validate([
+ 'sektor' => 'required|string',
+ ]);
+
+ $sektor = $request->input('sektor');
+
+ $desaList = $this->getDesaListForTemplate($request);
+
+ $skema = $this->dataspasial->listSkema(['sektor' => $sektor]);
+ $items = $this->extractSkemaItems($skema);
+
+ $filename = 'template_impor_'.str_replace([' ', '/'], '_', strtolower($sektor)).'_'.date('YmdHis').'.xlsx';
+
+ $periode = $request->input('periode', date('Y-m'));
+ $export = new ImporDataSpasialTemplateExport($desaList, $items, $sektor, $periode);
+ $tempFile = tempnam(sys_get_temp_dir(), 'tmpl_');
+ $export->write($tempFile);
+
+ return response()->download($tempFile, $filename)->deleteFileAfterSend();
+ }
+
+ public function upload(UploadImporRequest $request): JsonResponse
+ {
+ $file = $request->file('file');
+ $rows = $this->parseFile($file);
+
+ // Normalisasi kode_desa dengan memisahkan "Kode - Nama" dan validasi format
+ $desaList = $this->configApiService->desaConfig();
+ if ($desaList instanceof Collection) {
+ $desaList = $desaList->toArray();
+ }
+ $validKodeDesa = [];
+ foreach ((array) $desaList as $d) {
+ if (is_object($d)) {
+ $validKodeDesa[] = (string) ($d->kode_desa ?? $d->kode ?? '');
+ } elseif (is_array($d)) {
+ $attrs = $d['attributes'] ?? [];
+ $validKodeDesa[] = (string) ($d['kode_desa'] ?? $d['kode'] ?? ($attrs['kode_desa'] ?? ($attrs['kode'] ?? '')));
+ }
+ }
+ $validKodeDesa = array_filter($validKodeDesa);
+
+ foreach ($rows as $i => &$row) {
+ $kd = (string) ($row['kode_desa'] ?? ($row['desa'] ?? ''));
+ $kd = trim($kd);
+ if (strpos($kd, ' - ') !== false) {
+ $parts = explode(' - ', $kd, 2);
+ $kd = trim($parts[0]);
+ }
+ $row['kode_desa'] = $kd;
+ $row['nomor_baris'] = $i + 2;
+ $row['_kode_valid'] = $kd !== '' && (empty($validKodeDesa) || in_array($kd, $validKodeDesa, true));
+ }
+ unset($row);
+
+ Session::put('impor_parsed', [
+ 'sektor' => $request->input('sektor'),
+ 'filename' => $file->getClientOriginalName(),
+ 'rows' => $rows,
+ ]);
+
+ return response()->json([
+ 'success' => true,
+ 'rows_count' => count($rows),
+ 'invalid_count' => count(array_filter($rows, fn ($r) => ($r['_kode_valid'] ?? true) === false)),
+ 'rows' => array_slice($rows, 0, 200),
+ ]);
+ }
+
+ public function preview(PreviewImporRequest $request): JsonResponse
+ {
+ $parsed = Session::get('impor_parsed');
+ if (! $parsed) {
+ return response()->json(['success' => false, 'message' => 'Tidak ada data hasil unggah.'], 422);
+ }
+
+ $baris = [];
+ foreach (($parsed['rows'] ?? []) as $idx => $row) {
+ $nilai = $row['nilai'] ?? $this->extractNilai($row);
+ // Buang key internal yang bukan bagian skema (prefix underscore)
+ foreach (array_keys($nilai) as $k) {
+ if (strpos((string) $k, '_') === 0) {
+ unset($nilai[$k]);
+ }
+ }
+ $baris[] = [
+ 'nomor_baris' => $row['nomor_baris'] ?? ($idx + 2),
+ 'kode_desa' => $row['kode_desa'] ?? ($row['desa'] ?? ''),
+ 'kode_fasilitas' => $row['kode_fasilitas'] ?? '',
+ 'nama_fasilitas' => $row['nama_fasilitas'] ?? '',
+ 'periode' => $row['periode'] ?? date('Y-m'),
+ 'nilai' => $nilai,
+ ];
+ }
+
+ $payload = [
+ 'sektor' => $parsed['sektor'],
+ 'filename' => $parsed['filename'],
+ 'force_overwrite' => (bool) $request->input('force_overwrite', false),
+ 'mode' => $request->input('mode', 'sebagian'),
+ 'baris' => $baris,
+ ];
+ $result = $this->dataspasial->imporPratinjau($payload);
+ if ($result->isUnavailable()) {
+ return response()->json(['success' => false, 'message' => $result->message ?? 'Gagal melakukan pratinjau.'], 422);
+ }
+
+ $data = $result->data;
+ logger()->error('data', $data);
+ $previewData = $this->normalizePreview($data, $result->meta);
+
+ Session::put('impor_preview', $previewData);
+
+ return response()->json(['success' => true, 'preview' => $previewData]);
+ }
+
+ public function save(Request $request, string $imporId): JsonResponse
+ {
+ $result = $this->dataspasial->imporSimpan($imporId, $request->all());
+
+ if ($result->isUnavailable()) {
+ return response()->json(['success' => false, 'message' => $result->message ?? 'Gagal menyimpan impor.'], 422);
+ }
+
+ Session::forget('impor_parsed');
+ Session::forget('impor_preview');
+
+ return response()->json(['success' => true, 'result' => $result->data]);
+ }
+
+ /**
+ * Normalisasi respons pratinjau API-06 (JSON:API) menjadi struktur flat
+ * yang mudah dikonsumsi frontend.
+ */
+ private function normalizePreview(array $data, array $meta = []): array
+ {
+ $first = $data[0] ?? $data;
+ $attrs = [];
+ if (is_array($first) && isset($first['attributes']) && is_array($first['attributes'])) {
+ $attrs = $first['attributes'];
+ } elseif (is_array($first)) {
+ $attrs = $first;
+ }
+
+ if (empty($attrs)) {
+ $attrs = $meta;
+ }
+
+ $ringkasan = $attrs['ringkasan'] ?? [];
+ $laporan = $attrs['laporan'] ?? ($attrs['baris'] ?? []);
+
+ $baris = [];
+ foreach ((array) $laporan as $item) {
+ if (is_object($item)) {
+ $item = (array) $item;
+ }
+ $pesan = $item['pesan'] ?? ($item['alasan'] ?? null);
+ if (is_array($pesan)) {
+ $pesan = implode('; ', $pesan);
+ }
+ $baris[] = [
+ 'nomor_baris' => $item['nomor_baris'] ?? null,
+ 'kode_desa' => $item['kode_desa'] ?? '',
+ 'nama_desa' => $item['nama_desa'] ?? '',
+ 'kode_fasilitas' => $item['kode_fasilitas'] ?? '',
+ 'nama_fasilitas' => $item['nama_fasilitas'] ?? '',
+ 'periode' => $item['periode'] ?? '',
+ 'status' => $item['status'] ?? ($item['keterangan'] ?? ''),
+ 'pesan' => (string) ($pesan ?? ''),
+ 'nilai' => $item['nilai'] ?? [],
+ ];
+ }
+
+ return [
+ 'impor_id' => $attrs['impor_id'] ?? ($first['impor_id'] ?? ($first['id'] ?? ($attrs['id'] ?? ''))),
+ 'sektor' => $attrs['sektor'] ?? null,
+ 'skema_versi' => $attrs['skema_versi'] ?? null,
+ 'filename' => $attrs['filename'] ?? '',
+ 'kadaluwarsa_pada' => $attrs['kadaluwarsa_pada'] ?? null,
+ 'force_overwrite' => $attrs['force_overwrite'] ?? false,
+ 'mode' => $attrs['mode'] ?? 'sebagian',
+ 'ringkasan' => [
+ 'total_baris' => $ringkasan['total_baris'] ?? count($baris),
+ 'baris_siap' => $ringkasan['baris_siap'] ?? 0,
+ 'baris_menimpa' => $ringkasan['baris_menimpa'] ?? 0,
+ 'baris_konflik' => $ringkasan['baris_konflik'] ?? 0,
+ 'baris_galat' => $ringkasan['baris_galat'] ?? 0,
+ 'bisa_disimpan' => $ringkasan['bisa_disimpan'] ?? false,
+ ],
+ 'baris' => $baris,
+ ];
+ }
+
+ private function getDesaListForTemplate(Request $request): array
+ {
+ $kecamatanId = $request->input('kecamatan');
+ if ($kecamatanId) {
+ $result = $this->configApiService->desaConfig(['filter[kode_kecamatan]' => $kecamatanId]);
+ } else {
+ $result = $this->configApiService->desaConfig();
+ }
+
+ if ($result instanceof Collection) {
+ $result = $result->toArray();
+ }
+
+ if (! is_array($result)) {
+ return [];
+ }
+
+ return array_values(array_filter(array_map(function ($desa) {
+ if (is_object($desa)) {
+ $kode = (string) ($desa->kode_desa ?? $desa->kode ?? '');
+ $nama = (string) ($desa->nama_desa ?? $desa->nama ?? '');
+
+ return $kode === '' ? null : ['kode_desa' => $kode, 'nama_desa' => $nama];
+ }
+ if (is_array($desa)) {
+ $attrs = $desa['attributes'] ?? [];
+ $kode = (string) ($desa['kode_desa'] ?? $desa['kode'] ?? ($attrs['kode_desa'] ?? ($attrs['kode'] ?? '')));
+ $nama = (string) ($desa['nama_desa'] ?? $desa['nama'] ?? ($attrs['nama_desa'] ?? ($attrs['nama'] ?? '')));
+
+ return $kode === '' ? null : ['kode_desa' => $kode, 'nama_desa' => $nama];
+ }
+
+ return null;
+ }, $result)));
+ }
+
+ private function extractSkemaItems(DataSpasialResult $skema): array
+ {
+ $data = $skema->data;
+ if (empty($data)) {
+ return [];
+ }
+ $first = is_array($data[0]) ? $data[0] : $data;
+ $attrs = $first['attributes'] ?? $first;
+ if (isset($attrs['isian']) && is_array($attrs['isian'])) {
+ return $attrs['isian'];
+ }
+ if (isset($attrs['fields']) && is_array($attrs['fields'])) {
+ return $attrs['fields'];
+ }
+
+ return [];
+ }
+
+ private function parseFile($file): array
+ {
+ $rows = [];
+ $path = $file->getRealPath();
+
+ try {
+ $reader = new Reader;
+ $reader->open($path);
+ foreach ($reader->getSheetIterator() as $sheet) {
+ $sheetName = strtolower($sheet->getName());
+ if (in_array($sheetName, ['petunjuk', 'daftar desa'], true)) {
+ continue;
+ }
+ $allRows = [];
+ foreach ($sheet->getRowIterator() as $row) {
+ $cells = $row->getCells();
+ $values = [];
+ foreach ($cells as $cell) {
+ $values[] = trim((string) $cell->getValue());
+ }
+ $allRows[] = $values;
+ }
+ if (empty($allRows)) {
+ continue;
+ }
+ $headerIndex = -1;
+ foreach ($allRows as $i => $r) {
+ $joined = strtolower(implode(' ', $r));
+ if (strpos($joined, 'kode_desa') !== false && strpos($joined, 'kode_fasilitas') !== false) {
+ $headerIndex = $i;
+ break;
+ }
+ }
+ if ($headerIndex === -1) {
+ foreach ($allRows as $i => $r) {
+ $joined = strtolower(implode(' ', $r));
+ if (strpos($joined, 'kode_desa') !== false) {
+ // look ahead a few rows
+ $headerIndex = $i;
+ break;
+ }
+ }
+ }
+ if ($headerIndex === -1) {
+ continue;
+ }
+ $header = array_map(function ($h) {
+ $h = strtolower(trim((string) $h));
+ $h = str_replace([' ', '-'], '_', $h);
+ $h = preg_replace('/[^a-z0-9_]/', '', $h);
+
+ return $h;
+ }, $allRows[$headerIndex]);
+
+ for ($i = $headerIndex + 1; $i < count($allRows); $i++) {
+ $data = $allRows[$i];
+ $hasContent = false;
+ foreach ($data as $k => $v) {
+ $val = trim((string) $v);
+ if ($val !== '' && strpos($val, '=') !== 0) {
+ $hasContent = true;
+ break;
+ }
+ }
+ if (! $hasContent) {
+ continue;
+ }
+ $row = [];
+ foreach ($header as $idx => $col) {
+ if ($col === '') {
+ continue;
+ }
+ if (isset($data[$idx])) {
+ $val = trim((string) $data[$idx]);
+ if (strpos($val, '=') === 0) {
+ continue;
+ }
+ $row[$col] = $val;
+ }
+ }
+ if (! empty($row)) {
+ if (isset($row['kode_desa']) && strpos($row['kode_desa'], ' - ') !== false) {
+ $parts = explode(' - ', $row['kode_desa'], 2);
+ $row['kode_desa'] = trim($parts[0]);
+ }
+ if (isset($row['kode_desa']) && strpos($row['kode_desa'], '=') === 0) {
+ continue;
+ }
+ if (empty($row['kode_desa']) && isset($row['desa'])) {
+ unset($row['desa']);
+ }
+ $rows[] = $row;
+ }
+ }
+ break;
+ }
+ $reader->close();
+ } catch (\Throwable $e) {
+ // Fallback to previous method if parsing fails
+ }
+
+ return $rows;
+ }
+
+ private function extractNilai(array $row): array
+ {
+ $nilai = [];
+ $exclude = ['nomor_baris', 'kode_desa', 'desa', 'kode_fasilitas', 'nama_fasilitas', 'periode', 'petunjuk'];
+ foreach ($row as $k => $v) {
+ if (in_array($k, $exclude, true)) {
+ continue;
+ }
+ if ($v === null || $v === '') {
+ continue;
+ }
+ $nilai[$k] = $v;
+ }
+
+ return $nilai;
}
}
diff --git a/app/Http/Requests/DataSpasial/DownloadTemplateRequest.php b/app/Http/Requests/DataSpasial/DownloadTemplateRequest.php
new file mode 100644
index 00000000..03bf9e85
--- /dev/null
+++ b/app/Http/Requests/DataSpasial/DownloadTemplateRequest.php
@@ -0,0 +1,23 @@
+ 'required|string',
+ 'kecamatan' => 'nullable|string',
+ ];
+ }
+
+ public function authorize(): bool
+ {
+ return $this->user() !== null;
+ }
+}
diff --git a/app/Http/Requests/DataSpasial/PreviewImporRequest.php b/app/Http/Requests/DataSpasial/PreviewImporRequest.php
new file mode 100644
index 00000000..f19c39e2
--- /dev/null
+++ b/app/Http/Requests/DataSpasial/PreviewImporRequest.php
@@ -0,0 +1,23 @@
+ 'nullable|boolean',
+ 'mode' => 'nullable|string',
+ ];
+ }
+
+ public function authorize(): bool
+ {
+ return $this->user() !== null;
+ }
+}
diff --git a/app/Http/Requests/DataSpasial/UploadImporRequest.php b/app/Http/Requests/DataSpasial/UploadImporRequest.php
new file mode 100644
index 00000000..847ba620
--- /dev/null
+++ b/app/Http/Requests/DataSpasial/UploadImporRequest.php
@@ -0,0 +1,23 @@
+ 'required|file|mimes:xlsx|max:10240',
+ 'sektor' => 'required|string',
+ ];
+ }
+
+ public function authorize(): bool
+ {
+ return $this->user() !== null;
+ }
+}
diff --git a/app/Services/DataSpasialApiService.php b/app/Services/DataSpasialApiService.php
index b8b218fe..a4e81802 100644
--- a/app/Services/DataSpasialApiService.php
+++ b/app/Services/DataSpasialApiService.php
@@ -609,4 +609,26 @@ public function imporNilai(array $body, ?int $schemaVersion = null): DataSpasial
{
return $this->request('POST', 'impor', [], $body, $schemaVersion);
}
+
+ /**
+ * Pratinjau impor data spasial (API-06).
+ *
+ * @param array $body
+ */
+ public function imporPratinjau(array $body, ?int $schemaVersion = null): DataSpasialResult
+ {
+ return $this->request('POST', 'impor/pratinjau', [], $body, $schemaVersion);
+ }
+
+ /**
+ * Simpan hasil pratinjau impor data spasial (API-06).
+ *
+ * @param array $body
+ */
+ public function imporSimpan(string $imporId, array $body = [], ?int $schemaVersion = null): DataSpasialResult
+ {
+ $path = 'impor/'.rawurlencode($imporId).'/simpan';
+
+ return $this->request('POST', $path, [], $body, $schemaVersion);
+ }
}
diff --git a/catatan_rilis.md b/catatan_rilis.md
index ef19adff..1b2234a5 100644
--- a/catatan_rilis.md
+++ b/catatan_rilis.md
@@ -11,6 +11,7 @@ Di rilis ini, versi 2611.0.0 berisi penambahan dan perbaikan yang diminta penggu
6. [#1298](https://github.com/OpenSID/OpenKab/issues/1298) [KAB-03] Penerbitan, riwayat versi & status adopsi desa.
7. [#1299](https://github.com/OpenSID/OpenKab/issues/1299) Feat: Peta Gabungan Geospasial & DataSpasial.
8. [#1300](https://github.com/OpenSID/OpenKab/issues/1300) [KAB-05] Dasbor indikator, grafik & ekspor.
+9. [#1301](https://github.com/OpenSID/OpenKab/issues/1301) [KAB-06] Impor data desa dari file: templat, unggah & pratinjau.
#### Perbaikan BUG
diff --git a/resources/views/dataspasial/impor/index.blade.php b/resources/views/dataspasial/impor/index.blade.php
index 5142d521..378908b4 100644
--- a/resources/views/dataspasial/impor/index.blade.php
+++ b/resources/views/dataspasial/impor/index.blade.php
@@ -10,45 +10,391 @@
@include('partials.breadcrumbs')
@include('partials.flash_message')
-
-