Spaces:
Running
Running
Update index.html
Browse files- index.html +113 -19
index.html
CHANGED
|
@@ -1,19 +1,113 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<title>Google Sheets CoreUI App</title>
|
| 6 |
+
<link href="https://cdn.jsdelivr.net/npm/@coreui/coreui@5.0.0/dist/css/coreui.min.css" rel="stylesheet">
|
| 7 |
+
<link rel="stylesheet" href="style.css">
|
| 8 |
+
</head>
|
| 9 |
+
<body class="bg-body-tertiary">
|
| 10 |
+
|
| 11 |
+
<!-- LOGIN VIEW -->
|
| 12 |
+
<div id="login-view" class="container d-flex align-items-center justify-content-center min-vh-100">
|
| 13 |
+
<div class="card p-4 shadow" style="width: 350px;">
|
| 14 |
+
<h3 class="text-center mb-4">System Login</h3>
|
| 15 |
+
<div class="mb-3">
|
| 16 |
+
<label class="form-label">Username</label>
|
| 17 |
+
<input type="text" id="username" class="form-control">
|
| 18 |
+
</div>
|
| 19 |
+
<div class="mb-4">
|
| 20 |
+
<label class="form-label">Password</label>
|
| 21 |
+
<input type="password" id="password" class="form-control">
|
| 22 |
+
</div>
|
| 23 |
+
<button class="btn btn-primary w-100" onclick="login()">Login</button>
|
| 24 |
+
<div id="login-error" class="text-danger mt-2 text-center d-none">Invalid credentials</div>
|
| 25 |
+
</div>
|
| 26 |
+
</div>
|
| 27 |
+
|
| 28 |
+
<!-- MAIN APP VIEW -->
|
| 29 |
+
<div id="app-view" class="d-none">
|
| 30 |
+
<header class="header header-sticky mb-4 p-3 shadow-sm bg-white d-flex justify-content-between align-items-center">
|
| 31 |
+
<h4 class="mb-0">Data Dashboard</h4>
|
| 32 |
+
<div>
|
| 33 |
+
<span class="badge text-bg-secondary me-3" id="user-role-badge"></span>
|
| 34 |
+
<button id="btn-admin" class="btn btn-warning btn-sm d-none me-2" onclick="openAdminModal()">Admin Config</button>
|
| 35 |
+
<button class="btn btn-outline-danger btn-sm" onclick="logout()">Logout</button>
|
| 36 |
+
</div>
|
| 37 |
+
</header>
|
| 38 |
+
|
| 39 |
+
<div class="container-fluid px-4">
|
| 40 |
+
<div class="d-flex justify-content-between mb-3">
|
| 41 |
+
<input type="text" id="searchInput" class="form-control w-25" placeholder="Search data..." onkeyup="renderTable()">
|
| 42 |
+
<button class="btn btn-success" onclick="openDataModal()">+ Add New Record</button>
|
| 43 |
+
</div>
|
| 44 |
+
<div class="card shadow-sm">
|
| 45 |
+
<div class="card-body overflow-auto">
|
| 46 |
+
<table class="table table-striped table-hover" id="dataTable">
|
| 47 |
+
<!-- Rendered via JS -->
|
| 48 |
+
</table>
|
| 49 |
+
</div>
|
| 50 |
+
</div>
|
| 51 |
+
</div>
|
| 52 |
+
</div>
|
| 53 |
+
|
| 54 |
+
<!-- DATA MODAL (Create/Update) -->
|
| 55 |
+
<div class="modal fade" id="dataModal" tabindex="-1">
|
| 56 |
+
<div class="modal-dialog">
|
| 57 |
+
<div class="modal-content">
|
| 58 |
+
<div class="modal-header">
|
| 59 |
+
<h5 class="modal-title">Record Form</h5>
|
| 60 |
+
<button type="button" class="btn-close" onclick="closeModal('dataModal')"></button>
|
| 61 |
+
</div>
|
| 62 |
+
<div class="modal-body" id="dataFormContainer">
|
| 63 |
+
<!-- Dynamic form fields injected here -->
|
| 64 |
+
</div>
|
| 65 |
+
<div class="modal-footer">
|
| 66 |
+
<button type="button" class="btn btn-secondary" onclick="closeModal('dataModal')">Close</button>
|
| 67 |
+
<button type="button" class="btn btn-primary" onclick="saveData()">Save changes</button>
|
| 68 |
+
</div>
|
| 69 |
+
</div>
|
| 70 |
+
</div>
|
| 71 |
+
</div>
|
| 72 |
+
|
| 73 |
+
<!-- ADMIN CONFIG MODAL -->
|
| 74 |
+
<div class="modal fade" id="adminModal" tabindex="-1" data-coreui-backdrop="static">
|
| 75 |
+
<div class="modal-dialog modal-lg">
|
| 76 |
+
<div class="modal-content">
|
| 77 |
+
<div class="modal-header">
|
| 78 |
+
<h5 class="modal-title">Admin Configuration</h5>
|
| 79 |
+
<button type="button" class="btn-close" onclick="closeModal('adminModal')"></button>
|
| 80 |
+
</div>
|
| 81 |
+
<div class="modal-body">
|
| 82 |
+
<div class="mb-3">
|
| 83 |
+
<label class="form-label">Target Google Sheet URL</label>
|
| 84 |
+
<div class="input-group">
|
| 85 |
+
<input type="text" id="adminSheetUrl" class="form-control" placeholder="https://docs.google.com/spreadsheets/d/...">
|
| 86 |
+
<button class="btn btn-outline-secondary" onclick="fetchSheets()">Load Sheets</button>
|
| 87 |
+
</div>
|
| 88 |
+
</div>
|
| 89 |
+
<div class="mb-3 d-none" id="adminSheetSelectGroup">
|
| 90 |
+
<label class="form-label">Select Sheet</label>
|
| 91 |
+
<div class="input-group">
|
| 92 |
+
<select id="adminSheetSelect" class="form-select"></select>
|
| 93 |
+
<button class="btn btn-outline-secondary" onclick="fetchColumns()">Load Columns</button>
|
| 94 |
+
</div>
|
| 95 |
+
</div>
|
| 96 |
+
<table class="table mt-3 d-none" id="adminColumnsTable">
|
| 97 |
+
<thead>
|
| 98 |
+
<tr><th>Column Header</th><th>Input Type</th><th>Options (Comma separated)</th></tr>
|
| 99 |
+
</thead>
|
| 100 |
+
<tbody id="adminColumnsBody"></tbody>
|
| 101 |
+
</table>
|
| 102 |
+
</div>
|
| 103 |
+
<div class="modal-footer">
|
| 104 |
+
<button type="button" class="btn btn-primary" onclick="saveAdminConfig()">Save Configuration</button>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
</div>
|
| 108 |
+
</div>
|
| 109 |
+
|
| 110 |
+
<script src="https://cdn.jsdelivr.net/npm/@coreui/coreui@5.0.0/dist/js/coreui.bundle.min.js"></script>
|
| 111 |
+
<script src="app.js"></script>
|
| 112 |
+
</body>
|
| 113 |
+
</html>
|