anuragshas commited on
Commit
a4c293a
·
1 Parent(s): 4c1d2cd

fix: remove storage info button

Browse files
Files changed (2) hide show
  1. data-manager.js +0 -82
  2. index.html +7 -105
data-manager.js CHANGED
@@ -188,7 +188,6 @@ class QuotationDataManager {
188
  field.addEventListener("blur", () => {
189
  const formData = this.getFormData();
190
  this.saveCompanyDetails(formData);
191
- this.updateStorageStatus();
192
  });
193
  }
194
  });
@@ -206,7 +205,6 @@ class QuotationDataManager {
206
  field.addEventListener("blur", () => {
207
  const formData = this.getFormData();
208
  this.saveBankDetails(formData);
209
- this.updateStorageStatus();
210
  });
211
  }
212
  });
@@ -225,7 +223,6 @@ class QuotationDataManager {
225
  field.addEventListener("blur", () => {
226
  const formData = this.getFormData();
227
  this.saveCustomerDetails(formData);
228
- this.updateStorageStatus();
229
  });
230
  }
231
  });
@@ -271,7 +268,6 @@ class QuotationDataManager {
271
  this.saveCompanyDetails(formData);
272
  this.saveBankDetails(formData);
273
  this.saveCustomerDetails(formData);
274
- this.updateStorageStatus();
275
  this.showModal("✅ Data saved successfully!", "success");
276
  } catch (error) {
277
  console.error("Error saving data:", error);
@@ -296,7 +292,6 @@ class QuotationDataManager {
296
  this.clearAllData();
297
  // Clear form fields
298
  document.getElementById("quotation-form").reset();
299
- this.updateStorageStatus();
300
  this.showModal(
301
  "🗑️ All saved data cleared successfully!",
302
  "success",
@@ -329,82 +324,6 @@ class QuotationDataManager {
329
  }
330
  });
331
  }
332
-
333
- // Storage info panel handlers
334
- const showStorageInfoButton =
335
- document.getElementById("show-storage-info");
336
- const hideStorageInfoButton =
337
- document.getElementById("hide-storage-info");
338
- const storageInfoPanel = document.getElementById("storage-info-panel");
339
-
340
- if (showStorageInfoButton && storageInfoPanel) {
341
- showStorageInfoButton.addEventListener("click", (e) => {
342
- e.stopPropagation();
343
- this.updateStorageStatus();
344
- storageInfoPanel.classList.toggle("hidden");
345
- });
346
- }
347
-
348
- if (hideStorageInfoButton && storageInfoPanel) {
349
- hideStorageInfoButton.addEventListener("click", () => {
350
- storageInfoPanel.classList.add("hidden");
351
- });
352
- }
353
-
354
- // Hide popover when clicking outside
355
- document.addEventListener("click", (e) => {
356
- if (
357
- !storageInfoPanel.contains(e.target) &&
358
- e.target !== showStorageInfoButton
359
- ) {
360
- storageInfoPanel.classList.add("hidden");
361
- }
362
- });
363
- }
364
-
365
- // Update storage status display
366
- updateStorageStatus() {
367
- const companyData = this.loadCompanyDetails();
368
- const bankData = this.loadBankDetails();
369
- const customerData = this.loadCustomerDetails();
370
-
371
- // Update company status
372
- const companyStatus = document.getElementById("company-storage-status");
373
- if (companyStatus) {
374
- if (companyData && companyData.name) {
375
- companyStatus.textContent = `✅ Saved (${companyData.name})`;
376
- companyStatus.className = "text-blue-600";
377
- } else {
378
- companyStatus.textContent = "❌ Not saved";
379
- companyStatus.className = "text-gray-600";
380
- }
381
- }
382
-
383
- // Update bank status
384
- const bankStatus = document.getElementById("bank-storage-status");
385
- if (bankStatus) {
386
- if (bankData && bankData.name) {
387
- bankStatus.textContent = `✅ Saved (${bankData.name})`;
388
- bankStatus.className = "text-green-600";
389
- } else {
390
- bankStatus.textContent = "❌ Not saved";
391
- bankStatus.className = "text-gray-600";
392
- }
393
- }
394
-
395
- // Update customer status
396
- const customerStatus = document.getElementById(
397
- "customer-storage-status",
398
- );
399
- if (customerStatus) {
400
- if (customerData && customerData.name) {
401
- customerStatus.textContent = `✅ Saved in session (${customerData.name})`;
402
- customerStatus.className = "text-yellow-600";
403
- } else {
404
- customerStatus.textContent = "❌ Not saved (Session only)";
405
- customerStatus.className = "text-gray-600";
406
- }
407
- }
408
  }
409
 
410
  // Initialize data manager
@@ -421,7 +340,6 @@ class QuotationDataManager {
421
  this.loadFormData();
422
  this.setupAutoSave();
423
  this.setupDataManagementHandlers();
424
- this.updateStorageStatus();
425
  });
426
 
427
  // Clear customer data when page unloads (optional)
 
188
  field.addEventListener("blur", () => {
189
  const formData = this.getFormData();
190
  this.saveCompanyDetails(formData);
 
191
  });
192
  }
193
  });
 
205
  field.addEventListener("blur", () => {
206
  const formData = this.getFormData();
207
  this.saveBankDetails(formData);
 
208
  });
209
  }
210
  });
 
223
  field.addEventListener("blur", () => {
224
  const formData = this.getFormData();
225
  this.saveCustomerDetails(formData);
 
226
  });
227
  }
228
  });
 
268
  this.saveCompanyDetails(formData);
269
  this.saveBankDetails(formData);
270
  this.saveCustomerDetails(formData);
 
271
  this.showModal("✅ Data saved successfully!", "success");
272
  } catch (error) {
273
  console.error("Error saving data:", error);
 
292
  this.clearAllData();
293
  // Clear form fields
294
  document.getElementById("quotation-form").reset();
 
295
  this.showModal(
296
  "🗑️ All saved data cleared successfully!",
297
  "success",
 
324
  }
325
  });
326
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
327
  }
328
 
329
  // Initialize data manager
 
340
  this.loadFormData();
341
  this.setupAutoSave();
342
  this.setupDataManagementHandlers();
 
343
  });
344
 
345
  // Clear customer data when page unloads (optional)
index.html CHANGED
@@ -271,22 +271,13 @@
271
  >
272
  Generate Quotation
273
  </button>
274
- <div class="space-x-2">
275
- <button
276
- type="button"
277
- id="clear-data"
278
- class="bg-red-500 hover:bg-red-600 text-white font-bold py-2 px-4 rounded-lg shadow-md transition-all duration-200 ease-in-out transform hover:scale-105"
279
- >
280
- Clear Saved Data
281
- </button>
282
- <button
283
- type="button"
284
- id="show-storage-info"
285
- class="bg-gray-500 hover:bg-gray-600 text-white font-bold py-2 px-4 rounded-lg shadow-md transition-all duration-200 ease-in-out transform hover:scale-105"
286
- >
287
- Storage Info
288
- </button>
289
- </div>
290
  </div>
291
  </form>
292
  </div>
@@ -300,95 +291,6 @@
300
  </h2>
301
  <div id="preview-content"></div>
302
  </div>
303
-
304
- <!-- Storage Information Panel -->
305
- <div
306
- id="storage-info-panel"
307
- class="absolute z-10 bg-white shadow-lg rounded-lg px-6 pt-4 pb-6 mb-4 hidden w-full max-w-md"
308
- style="top: 50px; right: 0"
309
- >
310
- <h3 class="text-lg font-bold mb-3 flex items-center gap-2">
311
- <svg
312
- xmlns="http://www.w3.org/2000/svg"
313
- class="h-6 w-6 text-gray-600"
314
- fill="none"
315
- viewBox="0 0 24 24"
316
- stroke="currentColor"
317
- >
318
- <path
319
- stroke-linecap="round"
320
- stroke-linejoin="round"
321
- stroke-width="2"
322
- d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.57-.588-3.756z"
323
- />
324
- </svg>
325
- Storage Information
326
- </h3>
327
- <div class="text-sm space-y-2">
328
- <div class="bg-blue-50 p-3 rounded-lg">
329
- <h4 class="font-semibold text-blue-800">
330
- Company Details
331
- </h4>
332
- <p
333
- id="company-storage-status"
334
- class="text-blue-600"
335
- >
336
- Not saved
337
- </p>
338
- </div>
339
- <div class="bg-green-50 p-3 rounded-lg">
340
- <h4 class="font-semibold text-green-800">
341
- Bank Details
342
- </h4>
343
- <p id="bank-storage-status" class="text-green-600">
344
- Not saved
345
- </p>
346
- </div>
347
- <div class="bg-yellow-50 p-3 rounded-lg">
348
- <h4 class="font-semibold text-yellow-800">
349
- Customer Details
350
- </h4>
351
- <p
352
- id="customer-storage-status"
353
- class="text-yellow-600"
354
- >
355
- Not saved (Session only)
356
- </p>
357
- </div>
358
- <div class="bg-gray-100 p-3 rounded-lg mt-3">
359
- <h4
360
- class="font-semibold text-gray-800 flex items-center gap-1"
361
- >
362
- <svg
363
- xmlns="http://www.w3.org/2000/svg"
364
- class="h-4 w-4"
365
- viewBox="0 0 20 20"
366
- fill="currentColor"
367
- >
368
- <path
369
- fill-rule="evenodd"
370
- d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 3.001-1.742 3.001H4.42c-1.53 0-2.493-1.667-1.743-3.001l5.58-9.92zM10 13a1 1 0 110-2 1 1 0 010 2zm-1-8a1 1 0 00-1 1v3a1 1 0 102 0V6a1 1 0 00-1-1z"
371
- clip-rule="evenodd"
372
- />
373
- </svg>
374
- Security Notice
375
- </h4>
376
- <p class="text-gray-600 text-xs mt-1">
377
- Data is stored in your browser's localStorage.
378
- For maximum security:
379
- <br />• Use private/incognito browsing <br />•
380
- Clear data when done <br />• Don't use on shared
381
- computers
382
- </p>
383
- </div>
384
- </div>
385
- <button
386
- id="hide-storage-info"
387
- class="mt-4 bg-gray-500 hover:bg-gray-600 text-white font-bold py-2 px-4 rounded-lg shadow-md transition-all duration-200 ease-in-out transform hover:scale-105"
388
- >
389
- Hide
390
- </button>
391
- </div>
392
  </div>
393
  </div>
394
  <div
 
271
  >
272
  Generate Quotation
273
  </button>
274
+ <button
275
+ type="button"
276
+ id="clear-data"
277
+ class="bg-red-500 hover:bg-red-600 text-white font-bold py-2 px-4 rounded-lg shadow-md transition-all duration-200 ease-in-out transform hover:scale-105"
278
+ >
279
+ Clear Saved Data
280
+ </button>
 
 
 
 
 
 
 
 
 
281
  </div>
282
  </form>
283
  </div>
 
291
  </h2>
292
  <div id="preview-content"></div>
293
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  </div>
295
  </div>
296
  <div