add selector sheet feature
This commit is contained in:
parent
47c1201bc6
commit
ea871e5ea7
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>upload_otomation_fe</title>
|
||||
<title>Upload Automation</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export function useUploadController() {
|
|||
if (!file) return;
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await uploadFile(file, selectedPages);
|
||||
const res = await uploadFile(file, selectedPages, selectedSheet);
|
||||
dispatch(setResult(res));
|
||||
console.log('gtw',res);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,19 +16,68 @@ export default function ViewsAdminUploadRules() {
|
|||
<h2 className="text-xl font-semibold mb-3">🗂️ Format File yang Diizinkan</h2>
|
||||
<ul className="list-disc pl-5 space-y-2 text-gray-700">
|
||||
<li>
|
||||
Hanya mendukung <code className="bg-gray-100 px-1 rounded">.csv</code>,{" "}
|
||||
<code className="bg-gray-100 px-1 rounded">.xlsx</code>,{" "}
|
||||
<code className="bg-gray-100 px-1 rounded">.pdf</code>, dan{" "}
|
||||
<code className="bg-gray-100 px-1 rounded">.zip</code>.
|
||||
<strong>Format file yang didukung:</strong> <code className="bg-gray-200 text-teal-600 px-1 rounded">.csv</code>,{" "}
|
||||
<code className="bg-gray-200 text-green-600 px-1 rounded">.xlsx</code>,{" "}
|
||||
<code className="bg-gray-200 text-red-600 px-1 rounded">.pdf</code>, dan{" "}
|
||||
<code className="bg-gray-200 text-yellow-600 px-1 rounded">.zip</code>.
|
||||
</li>
|
||||
<li>
|
||||
{/* <li>
|
||||
Format <code>.zip</code> digunakan untuk data spasial seperti{" "}
|
||||
<code>.shp</code> atau <code>.gdb</code> (harus berisi struktur lengkap:
|
||||
.shp, .shx, .dbf, .prj).
|
||||
</li> */}
|
||||
<li><strong>Untuk file </strong><code className="bg-gray-200 text-green-600 px-1 rounded">.xlsx</code>:
|
||||
<ul>
|
||||
<li>Jika file memiliki lebih dari satu <em>sheet</em>, pengguna <strong>wajib memilih satu sheet</strong> saja untuk diunggah.</li>
|
||||
<li>Pastikan sheet yang dipilih berisi tabel data utama yang ingin diproses.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Setiap file yang diunggah hanya akan diproses sebagai <b>satu tabel</b>.
|
||||
Jika file berisi banyak sheet atau layer, sistem akan mengambil sheet/layer pertama.
|
||||
|
||||
<li><strong>Untuk file </strong><code className="bg-gray-200 text-red-600 px-1 rounded">.pdf</code>:
|
||||
<ul>
|
||||
<li>Jika dokumen memiliki lebih dari satu halaman, pengguna <strong>hanya dapat memilih maksimal 3 halaman</strong> untuk diproses.</li>
|
||||
<li>Jika dari halaman yang dipilih terdeteksi lebih dari satu tabel, pengguna <strong>wajib memilih satu tabel</strong> yang akan digunakan.</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li><strong>Untuk file </strong><code className="bg-gray-200 text-yellow-600 px-1 rounded">.zip</code>:
|
||||
<br />
|
||||
Digunakan untuk data spasial seperti{" "}
|
||||
<code>.shp</code> atau <code>.gdb</code>. <br />
|
||||
zip minimal harus berisi berikut:
|
||||
<ul className="list-['-'] pl-2 space-y-2 text-gray-700">
|
||||
<li className="pl-2">
|
||||
.shp :
|
||||
<ul className="list-disc pl-5 space-y-2 text-gray-700">
|
||||
<li>file.shp</li>
|
||||
<li>file.shx</li>
|
||||
<li>file.dbf</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li className="pl-2">
|
||||
.gdb :
|
||||
<ul className="list-disc pl-5 space-y-2 text-gray-700">
|
||||
<li>file.gdb</li>
|
||||
<li>file.gdbtable</li>
|
||||
<li>file.gdbindexes</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li><strong>Aturan umum untuk semua file:</strong>
|
||||
<ul>
|
||||
<li>Data <strong>wajib memiliki kolom koordinat</strong> seperti <code>latitude</code>, <code>longitude</code>, atau <code>geometry</code>.</li>
|
||||
<li>Jika tidak memiliki kolom koordinat, maka <strong>wajib memiliki kolom wilayah</strong> dengan nama salah satu atau kombinasi dari:
|
||||
<ul className="list-['-'] pl-2 space-y-1">
|
||||
<li className="pl-2"><code className="bg-gray-200 px-1 rounded">desa</code> / <code className="bg-gray-200 px-1 rounded">kelurahan</code></li>
|
||||
<li className="pl-2"><code className="bg-gray-200 px-1 rounded">kecamatan</code></li>
|
||||
<li className="pl-2"><code className="bg-gray-200 px-1 rounded">kota</code> / <code className="bg-gray-200 px-1 rounded">kabupaten</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Geometry akan diambil secara otomatis dari referensi <strong>data batas wilayah (Satu Peta)</strong>.</li>
|
||||
<li>Jika tidak ditemukan kolom koordinat maupun kolom wilayah yang valid, maka <strong>tabel dinyatakan tidak valid</strong> dan tidak dapat diproses.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
|
@ -37,16 +86,20 @@ export default function ViewsAdminUploadRules() {
|
|||
<section className="mb-8">
|
||||
<h2 className="text-xl font-semibold mb-3">⚙️ Batasan & Validasi Sistem</h2>
|
||||
<ul className="list-disc pl-5 space-y-2 text-gray-700">
|
||||
<li>Maksimal ukuran file: <b>50 MB</b>.</li>
|
||||
{/* <li>Maksimal ukuran file: <b>50 MB</b>.</li> */}
|
||||
<li>
|
||||
Setiap file yang diunggah hanya akan diproses sebagai <b>satu tabel</b>.
|
||||
{/* Jika file berisi banyak sheet atau layer, sistem akan mengambil sheet/layer pertama atau layer pilihan. */}
|
||||
</li>
|
||||
<li>
|
||||
Pastikan nama file <b>tidak mengandung spasi</b> atau karakter khusus seperti{" "}
|
||||
<code>/ \ : * ? " < > |</code>.
|
||||
</li>
|
||||
<li>
|
||||
{/* <li>
|
||||
Hindari penggunaan nama tabel yang terlalu panjang; sistem akan
|
||||
membuat nama tabel otomatis berdasarkan file Anda, misalnya:{" "}
|
||||
<code>data_kabbandung_myfile_20251009</code>.
|
||||
</li>
|
||||
</li> */}
|
||||
<li>
|
||||
Setelah file diunggah, sistem akan menampilkan <b>struktur tabel hasil deteksi</b>{" "}
|
||||
(kolom dan jumlah baris). Cek kembali sebelum menyimpan ke database.
|
||||
|
|
@ -107,7 +160,7 @@ export default function ViewsAdminUploadRules() {
|
|||
</Link>
|
||||
|
||||
<span className="text-sm text-gray-500">
|
||||
Diperbarui terakhir: <b>28 Oktober 2025</b>
|
||||
Diperbarui terakhir: <b>04 November 2025</b>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -26,10 +26,11 @@
|
|||
|
||||
import api from "../../../services/api";
|
||||
|
||||
export async function uploadFile(file, page = null) {
|
||||
export async function uploadFile(file, page = null, sheet = null) {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
formData.append("page", page);
|
||||
formData.append("sheet", sheet);
|
||||
|
||||
try {
|
||||
const response = await api.post("/upload", formData, {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user