File size: 9,670 Bytes
0c6ac49
 
 
 
 
271b6dd
0c6ac49
 
 
 
 
 
 
 
 
271b6dd
0c6ac49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271b6dd
0c6ac49
 
 
 
 
 
2e73730
0c6ac49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271b6dd
0c6ac49
 
 
 
 
 
 
 
271b6dd
0c6ac49
 
 
 
 
 
 
 
271b6dd
0c6ac49
 
 
 
 
 
 
 
 
 
 
 
2e73730
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0c6ac49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271b6dd
0c6ac49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Admin — Cafe Hidden Garden</title>
  <link href="https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;0,6..72,700;1,6..72,400;1,6..72,500&family=Figtree:wght@400;500;600;700&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="/css/admin.css">
</head>
<body>

  <!-- Login Screen -->
  <div id="loginScreen" class="login-screen">
    <div class="login-card">
      <p class="login-overline">Admin</p>
      <h1>Cafe Hidden Garden</h1>
      <p>Enter your password to manage the menu.</p>
      <form id="loginForm">
        <input type="password" id="password" placeholder="Password" required autofocus>
        <p class="login-error" id="loginError"></p>
        <button type="submit" class="btn">Sign in</button>
      </form>
    </div>
  </div>

  <!-- Dashboard -->
  <div id="dashboard" class="dashboard" style="display: none;">

    <!-- Top bar -->
    <header class="topbar">
      <div class="topbar-inner">
        <div class="topbar-brand">
          <a href="/" class="topbar-logo" target="_blank">Cafe Hidden Garden</a>
          <span class="topbar-badge">Admin</span>
        </div>
        <nav class="topbar-nav" id="topbarNav">
          <button class="tb-nav-item active" data-section="menu">Menu</button>
          <button class="tb-nav-item" data-section="categories">Categories</button>
          <button class="tb-nav-item" data-section="info">Cafe Info</button>
          <button class="tb-nav-item" data-section="tables">Tables & Orders</button>
          <button class="tb-nav-item" data-section="settings">Settings</button>
        </nav>
        <div class="topbar-actions">
          <a href="/" class="topbar-link" target="_blank">View site ↗</a>
          <button id="logoutBtn" class="topbar-link" style="color: var(--cherry);">Logout</button>
        </div>
      </div>
    </header>

    <!-- Main content area -->
    <main class="main">

      <!-- Menu Section -->
      <section id="menuSection" class="panel">
        <div class="panel-head">
          <h2>Menu items</h2>
          <button id="addItemBtn" class="btn">+ Add item</button>
        </div>
        <div class="table-wrap">
          <table class="table">
            <thead>
              <tr>
                <th>Item</th>
                <th>Category</th>
                <th>Price</th>
                <th>Status</th>
                <th>Actions</th>
              </tr>
            </thead>
            <tbody id="menuTableBody"></tbody>
          </table>
          <div class="empty" id="menuEmpty" style="display:none;">No menu items yet. Add your first one.</div>
        </div>
      </section>

      <!-- Categories Section -->
      <section id="categoriesSection" class="panel" style="display: none;">
        <div class="panel-head">
          <h2>Categories</h2>
        </div>
        <div class="form-block">
          <p class="form-hint">Categories organize your menu. The first category is treated as "All" and won't appear as a filter.</p>
          <div class="cat-editor" id="categoriesEditor"></div>
          <button id="addCategoryBtn" class="btn btn-ghost">+ Add category</button>
          <div style="margin-top: 20px;">
            <button id="saveCategoriesBtn" class="btn">Save categories</button>
          </div>
        </div>
      </section>

      <!-- Cafe Info Section -->
      <section id="infoSection" class="panel" style="display: none;">
        <div class="panel-head">
          <h2>Cafe information</h2>
        </div>
        <form id="infoForm" class="form-block">
          <div class="field">
            <label for="infoName">Cafe name</label>
            <input type="text" id="infoName" placeholder="Cafe Hidden Garden">
          </div>
          <div class="field">
            <label for="infoTagline">Tagline</label>
            <input type="text" id="infoTagline" placeholder="Crafted with care, served with warmth">
          </div>
          <div class="field-row">
            <div class="field">
              <label for="infoAddress">Address</label>
              <input type="text" id="infoAddress" placeholder="New Balaji Colony, Tirupati, OR">
            </div>
            <div class="field">
              <label for="infoPhone">Phone</label>
              <input type="text" id="infoPhone" placeholder="(503) 555-0192">
            </div>
          </div>
          <div class="field">
            <label for="infoEmail">Email</label>
            <input type="email" id="infoEmail" placeholder="hello@cafehiddengarden.com">
          </div>

          <h3 class="form-subhead">Hours</h3>
          <div id="hoursEditor"></div>
          <button type="button" id="addHoursBtn" class="btn btn-ghost">+ Add day range</button>

          <div style="margin-top: 28px;">
            <button type="submit" class="btn">Save changes</button>
          </div>
        </form>
      </section>

      <!-- Tables & Orders Section -->
      <section id="tablesSection" class="panel" style="display: none;">
        <!-- Table count -->
        <div class="panel-head">
          <h2>Tables & QR Codes</h2>
        </div>
        <div class="form-block" style="margin-bottom: 28px;">
          <div class="field" style="max-width: 200px;">
            <label for="tableCount">Number of tables</label>
            <input type="number" id="tableCount" min="0" max="100" placeholder="8">
          </div>
          <button type="button" id="saveTablesBtn" class="btn">Save</button>
          <button type="button" id="loadQrBtn" class="btn btn-ghost" style="margin-left:8px;">Generate QR codes</button>
        </div>

        <!-- QR Code Grid -->
        <div class="qr-grid" id="qrGrid">
          <p style="color:var(--parchment);font-size:0.82rem;padding:32px;">Set the number of tables above, then click "Generate QR codes" to generate printable QR codes for each table.</p>
        </div>

        <!-- Orders -->
        <div class="panel-head" style="margin-top: 44px;">
          <h2>Active orders</h2>
          <button id="refreshOrdersBtn" class="btn btn-ghost" style="font-size:0.75rem;">Refresh</button>
        </div>
        <div id="ordersContainer">
          <p style="color:var(--parchment);font-size:0.82rem;">No orders yet.</p>
        </div>
      </section>

      <!-- Settings Section -->
      <section id="settingsSection" class="panel" style="display: none;">
        <div class="panel-head">
          <h2>Change password</h2>
        </div>
        <form id="passwordForm" class="form-block" style="max-width: 380px;">
          <div class="field">
            <label for="currentPassword">Current password</label>
            <input type="password" id="currentPassword" required>
          </div>
          <div class="field">
            <label for="newPassword">New password</label>
            <input type="password" id="newPassword" required minlength="6">
          </div>
          <div class="field">
            <label for="confirmPassword">Confirm new password</label>
            <input type="password" id="confirmPassword" required minlength="6">
          </div>
          <p class="form-error" id="passwordError"></p>
          <p class="form-success" id="passwordSuccess"></p>
          <button type="submit" class="btn">Update password</button>
        </form>
      </section>

    </main>
  </div>

  <!-- Item Modal -->
  <div id="itemModal" class="modal">
    <div class="modal-card">
      <div class="modal-head">
        <h2 id="modalTitle">Add item</h2>
        <button class="modal-close" id="modalClose">&times;</button>
      </div>
      <form id="itemForm">
        <input type="hidden" id="itemId">
        <div class="field">
          <label for="itemName">Name</label>
          <input type="text" id="itemName" required placeholder="Cappuccino">
        </div>
        <div class="field-row">
          <div class="field">
            <label for="itemPrice">Price (₹)</label>
            <input type="number" id="itemPrice" required min="0" step="0.01" placeholder="4.50">
          </div>
          <div class="field">
            <label for="itemCategory">Category</label>
            <select id="itemCategory" required></select>
          </div>
        </div>
        <div class="field">
          <label for="itemDescription">Description</label>
          <textarea id="itemDescription" rows="3" placeholder="Rich espresso with velvety micro-foam"></textarea>
        </div>
        <div class="field">
          <label for="itemImage">Photo URL</label>
          <input type="text" id="itemImage" placeholder="https://images.unsplash.com/photo-...">
          <span style="font-size:0.72rem;color:var(--parchment);display:block;margin-top:4px;">Unsplash or any square image URL. Leave empty for category icon.</span>
        </div>
        <div class="field-checks">
          <label class="check">
            <input type="checkbox" id="itemAvailable" checked>
            <span>Available</span>
          </label>
          <label class="check">
            <input type="checkbox" id="itemFeatured">
            <span>Featured</span>
          </label>
        </div>
        <div class="modal-actions">
          <button type="button" class="btn btn-ghost" id="modalCancel">Cancel</button>
          <button type="submit" class="btn" id="modalSave">Save</button>
        </div>
      </form>
    </div>
  </div>

  <!-- Toast -->
  <div id="toastContainer"></div>

  <script src="/js/admin.js"></script>
</body>
</html>