mirror of
https://github.com/sassanix/Warracker.git
synced 2026-01-05 13:09:32 -06:00
This release introduces several key features and improvements
Added:
- Account email change support from Settings with full validation and UI update.
- Progressive Web App (PWA) capability with manifest and service worker integration.
- "Manage Tags" button on the main page to streamline tag management UX.
Changed:
- Improved responsiveness of key pages (index, status) across mobile and tablet views.
- Replaced hardcoded DB credentials with environment variable references (contribution by @humrochagf, commit 20997e9):
• Credentials are now pulled from Docker Compose env vars.
• Redundant superuser credential checks removed.
• Updated migration and permission scripts for dynamic configuration.
This version enhances user flexibility, security, and cross-device compatibility.
747 lines
44 KiB
HTML
747 lines
44 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<!-- Authentication redirect script -->
|
||
<script src="auth-redirect.js" data-protected="true"></script>
|
||
|
||
<!-- Include authentication script first to handle login state immediately -->
|
||
<script src="include-auth-new.js"></script>
|
||
|
||
<!-- File utilities script for secure file handling -->
|
||
<script src="file-utils.js"></script>
|
||
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Warracker - Warranty Tracker</title>
|
||
<!-- Add standard favicon.ico link -->
|
||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
|
||
<!-- Replace the old favicon link -->
|
||
<!-- <link rel="icon" type="image/png" href="img/favicon.png"> -->
|
||
<!-- Add new favicon links -->
|
||
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon-16x16.png?v=2">
|
||
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png?v=2">
|
||
<link rel="apple-touch-icon" sizes="180x180" href="img/favicon-512x512.png">
|
||
<link rel="manifest" href="manifest.json">
|
||
<link rel="stylesheet" href="style.css">
|
||
<script src="theme-loader.js"></script> <!-- Apply theme early -->
|
||
|
||
<!-- Font Awesome for icons -->
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||
<!-- Load header fix styles to ensure consistent header styling -->
|
||
<link rel="stylesheet" href="header-fix.css">
|
||
<!-- Load fix for auth buttons -->
|
||
<script src="fix-auth-buttons-loader.js"></script>
|
||
<!-- Mobile Header specific styles -->
|
||
<link rel="stylesheet" href="mobile-header.css">
|
||
|
||
<!-- Immediate authentication check script -->
|
||
<script>
|
||
// Check if user is logged in immediately to hide buttons
|
||
(function() {
|
||
if (localStorage.getItem('auth_token')) {
|
||
// Hide login and register buttons immediately
|
||
document.addEventListener('DOMContentLoaded', function() {
|
||
console.log('Inline script: User is logged in, hiding login/register buttons');
|
||
|
||
// Hide auth container
|
||
var authContainer = document.getElementById('authContainer');
|
||
if (authContainer) {
|
||
authContainer.style.display = 'none';
|
||
authContainer.style.visibility = 'hidden';
|
||
}
|
||
|
||
// Show user menu
|
||
var userMenu = document.getElementById('userMenu');
|
||
if (userMenu) {
|
||
userMenu.style.display = 'block';
|
||
userMenu.style.visibility = 'visible';
|
||
}
|
||
|
||
// Update user info if possible
|
||
try {
|
||
var userInfo = JSON.parse(localStorage.getItem('user_info'));
|
||
if (userInfo) {
|
||
var displayName = userInfo.first_name || userInfo.username || 'User';
|
||
var userDisplayName = document.getElementById('userDisplayName');
|
||
if (userDisplayName) {
|
||
userDisplayName.textContent = displayName;
|
||
}
|
||
|
||
var userName = document.getElementById('userName');
|
||
if (userName) {
|
||
userName.textContent = (userInfo.first_name || '') + ' ' + (userInfo.last_name || '');
|
||
if (!userName.textContent.trim()) userName.textContent = userInfo.username || 'User';
|
||
}
|
||
|
||
var userEmail = document.getElementById('userEmail');
|
||
if (userEmail && userInfo.email) {
|
||
userEmail.textContent = userInfo.email;
|
||
}
|
||
}
|
||
} catch (e) {
|
||
console.error('Error updating user info:', e);
|
||
}
|
||
}, { once: true });
|
||
}
|
||
})();
|
||
</script>
|
||
|
||
<!-- Registration status check script -->
|
||
<script src="registration-status.js"></script>
|
||
</head>
|
||
<body>
|
||
<!-- Header -->
|
||
<header>
|
||
<div class="container">
|
||
<div class="app-title">
|
||
<i class="fas fa-shield-alt"></i>
|
||
<h1>Warracker</h1>
|
||
</div>
|
||
<div class="nav-links">
|
||
<a href="index.html" class="nav-link active">
|
||
<i class="fas fa-home"></i> Home
|
||
</a>
|
||
<a href="status.html" class="nav-link">
|
||
<i class="fas fa-chart-pie"></i> Status
|
||
</a>
|
||
</div>
|
||
<!-- Group for right-aligned elements -->
|
||
<div class="header-right-group">
|
||
<div id="authContainer" class="auth-buttons">
|
||
<a href="login.html" class="auth-btn login-btn">
|
||
<i class="fas fa-sign-in-alt"></i> Login
|
||
</a>
|
||
<a href="register.html" class="auth-btn register-btn">
|
||
<i class="fas fa-user-plus"></i> Register
|
||
</a>
|
||
</div>
|
||
<div id="userMenu" class="user-menu" style="display: none;">
|
||
<button id="userBtn" class="user-btn">
|
||
<i class="fas fa-user-circle"></i>
|
||
<span id="userDisplayName">User</span>
|
||
</button>
|
||
<div id="userMenuDropdown" class="user-menu-dropdown">
|
||
<div class="user-info">
|
||
<div id="userName" class="user-name">User Name</div>
|
||
<div id="userEmail" class="user-email">user@example.com</div>
|
||
</div>
|
||
<div class="user-menu-item">
|
||
<a href="settings-new.html" style="color: inherit; text-decoration: none; display: block;">
|
||
<i class="fas fa-cog"></i> Settings
|
||
</a>
|
||
</div>
|
||
<div class="user-menu-item">
|
||
<i class="fas fa-info-circle"></i>
|
||
<a href="about.html" style="text-decoration: none; color: inherit;">About</a>
|
||
</div>
|
||
<div class="user-menu-item" id="logoutMenuItem">
|
||
<i class="fas fa-sign-out-alt"></i> Logout
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div> <!-- End header-right-group -->
|
||
</div>
|
||
</header>
|
||
|
||
<!-- Main Content -->
|
||
<div class="container">
|
||
<div class="main-content">
|
||
|
||
<!-- Warranties List Panel -->
|
||
<div class="warranties-panel">
|
||
<!-- Panel Header -->
|
||
<div class="panel-header">
|
||
<h2>Your Warranties</h2>
|
||
<!-- ADD BUTTON CONTAINER AND REFRESH BUTTON WRAPPER HERE -->
|
||
<div class="panel-header-actions">
|
||
<div class="add-warranty-button-container">
|
||
<button id="showAddWarrantyBtn" class="btn btn-primary btn-sm">
|
||
<i class="fas fa-plus"></i> Add New Warranty
|
||
</button>
|
||
</div>
|
||
<button id="refreshBtn" class="btn btn-secondary btn-sm" title="Refresh List">
|
||
<i class="fas fa-sync-alt"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
<!-- Filters and Search -->
|
||
<div class="filter-controls">
|
||
<div class="search-container" style="display: flex; width: 100%; gap: 8px; align-items: center; flex-wrap: nowrap;">
|
||
<!-- Make search box much longer, buttons only as wide as needed -->
|
||
<div class="search-box" style="flex: 2 1 400px; min-width: 200px; max-width: 1000px;">
|
||
<button id="searchBtn" class="search-btn" title="Search">
|
||
<i class="fas fa-search"></i>
|
||
</button>
|
||
<input type="text" id="searchWarranties" placeholder="Find by name, vendors, notes, tag, or serial number..." style="width: 100%; min-width: 200px;">
|
||
<button id="clearSearch" class="clear-search-btn" title="Clear search" style="display: none;">
|
||
<i class="fas fa-times"></i>
|
||
</button>
|
||
</div>
|
||
<div style="display: flex; gap: 8px; flex-wrap: nowrap; flex-shrink: 0; min-width: 0;">
|
||
<button id="exportBtn" class="export-btn" title="Export warranties" style="white-space: nowrap;">
|
||
<i class="fas fa-file-export"></i> Export
|
||
</button>
|
||
<button id="importBtn" class="import-btn" title="Import warranties from CSV" style="white-space: nowrap;">
|
||
<i class="fas fa-file-import"></i> Import
|
||
</button>
|
||
<button id="globalManageTagsBtn" class="export-btn" title="Manage all tags" style="white-space: nowrap;">
|
||
<i class="fas fa-tags"></i> Manage Tags
|
||
</button>
|
||
</div>
|
||
<input type="file" id="csvFileInput" accept=".csv" style="display: none;">
|
||
</div>
|
||
|
||
<div class="filter-options">
|
||
<div class="filter-group">
|
||
<label class="filter-label">Status</label>
|
||
<select id="statusFilter" class="filter-select">
|
||
<option value="all">All Status</option>
|
||
<option value="active">Active</option>
|
||
<option value="expiring">Expiring Soon</option>
|
||
<option value="expired">Expired</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div class="filter-group">
|
||
<label class="filter-label">Tag</label>
|
||
<select id="tagFilter" class="filter-select">
|
||
<option value="all">All Tags</option>
|
||
<!-- Tag options will be populated by JavaScript -->
|
||
</select>
|
||
</div>
|
||
|
||
<div class="filter-group">
|
||
<label class="filter-label">Vendor</label>
|
||
<select id="vendorFilter" class="filter-select">
|
||
<option value="all">All Vendors</option>
|
||
<!-- Vendor options will be populated by JavaScript -->
|
||
</select>
|
||
</div>
|
||
|
||
<div class="filter-group">
|
||
<label class="filter-label">Sort By</label>
|
||
<select id="sortBy" class="filter-select">
|
||
<option value="expiration">Expiration Date</option>
|
||
<option value="purchase">Purchase Date</option>
|
||
<option value="name">Product Name</option>
|
||
<option value="vendor">Vendor</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div class="view-switcher">
|
||
<label class="filter-label">View</label>
|
||
<div class="view-buttons">
|
||
<button id="gridViewBtn" class="view-btn active" title="Grid View">
|
||
<i class="fas fa-th-large"></i>
|
||
</button>
|
||
<button id="listViewBtn" class="view-btn" title="List View">
|
||
<i class="fas fa-list"></i>
|
||
</button>
|
||
<button id="tableViewBtn" class="view-btn" title="Table View">
|
||
<i class="fas fa-table"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="warrantiesList" class="warranties-list grid-view">
|
||
<!-- Table headers for table view -->
|
||
<div class="table-view-header">
|
||
<tr>
|
||
<th>Product</th>
|
||
<th>Purchase Date</th>
|
||
<th>Expiration</th>
|
||
<th>Status</th>
|
||
<th>Actions</th>
|
||
</tr>
|
||
</div>
|
||
<!-- Warranties will be loaded here -->
|
||
<div class="empty-state" style="display: none;">
|
||
<i class="fas fa-box-open"></i>
|
||
<h3>No warranties yet</h3>
|
||
<p>Add your first warranty to get started</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- MOVE the Form Panel content below -->
|
||
<!-- Original <div class="form-panel"> should be removed from here -->
|
||
<div id="addWarrantyModal" class="modal-backdrop">
|
||
<div class="modal" style="max-width: 700px;"> <!-- Adjusted max-width for the wizard -->
|
||
<div class="modal-header">
|
||
<h3 class="modal-title">Add New Warranty</h3>
|
||
<button class="close-btn" data-dismiss="modal">×</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<!-- MOVE the entire original .form-panel content HERE -->
|
||
<div class="form-panel" style="box-shadow: none; padding: 0; background: none;">
|
||
<!-- Form Tabs -->
|
||
<div class="form-tabs" data-step="0">
|
||
<div class="form-tab active" data-tab="product-info" id="productInfoTabBtn">
|
||
<i class="fas fa-box"></i> Product
|
||
</div>
|
||
<div class="form-tab" data-tab="warranty-details" id="warrantyDetailsTabBtn">
|
||
<i class="fas fa-shield-alt"></i> Warranty
|
||
</div>
|
||
<div class="form-tab" data-tab="documents" id="documentsTabBtn">
|
||
<i class="fas fa-file-alt"></i> Documents
|
||
</div>
|
||
<div class="form-tab" data-tab="tags" id="tagsTabBtn">
|
||
<i class="fas fa-tags"></i> Tags
|
||
</div>
|
||
<div class="form-tab" data-tab="summary" id="summaryTabBtn">
|
||
<i class="fas fa-check-circle"></i> Summary
|
||
</div>
|
||
</div>
|
||
<!-- Warranty Form -->
|
||
<form id="warrantyForm">
|
||
<!-- Product Information Tab -->
|
||
<div class="tab-content active" id="product-info">
|
||
<div class="form-group">
|
||
<label for="productName">Product Name</label>
|
||
<input type="text" id="productName" name="product_name" class="form-control" required>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label for="productUrl">Product URL (Optional)</label>
|
||
<input type="text" id="productUrl" name="product_url" class="form-control" placeholder="https://example.com/product">
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label>Serial Numbers</label>
|
||
<div id="serialNumbersContainer">
|
||
<!-- Serial number inputs will be added dynamically -->
|
||
<input type="text" name="serial_numbers[]" class="form-control" style="margin-bottom: 8px;" placeholder="Enter serial number">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label for="vendor">Vendor (Optional)</label>
|
||
<input type="text" id="vendor" name="vendor" class="form-control" placeholder="e.g. Amazon, Best Buy, etc.">
|
||
</div>
|
||
</div>
|
||
<!-- Warranty Details Tab -->
|
||
<div class="tab-content" id="warranty-details">
|
||
<div class="form-group">
|
||
<label for="purchaseDate">Purchase Date</label>
|
||
<input type="date" id="purchaseDate" name="purchase_date" class="form-control" required>
|
||
</div>
|
||
|
||
<!-- Add Lifetime Checkbox -->
|
||
<div class="form-group">
|
||
<label class="lifetime-label">
|
||
<input type="checkbox" id="isLifetime" name="is_lifetime" value="true">
|
||
Lifetime Warranty
|
||
</label>
|
||
</div>
|
||
<!-- End Lifetime Checkbox -->
|
||
|
||
<div id="warrantyDurationFields">
|
||
<div class="form-group">
|
||
<label for="warrantyDurationYears">Warranty Period</label>
|
||
<div class="duration-inputs">
|
||
<div>
|
||
<input type="number" id="warrantyDurationYears" name="warranty_duration_years" class="form-control" min="0" max="100" placeholder="Years">
|
||
<small>Years</small>
|
||
</div>
|
||
<div>
|
||
<input type="number" id="warrantyDurationMonths" name="warranty_duration_months" class="form-control" min="0" max="11" placeholder="Months">
|
||
<small>Months</small>
|
||
</div>
|
||
<div>
|
||
<input type="number" id="warrantyDurationDays" name="warranty_duration_days" class="form-control" min="0" max="365" placeholder="Days">
|
||
<small>Days</small>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label for="purchasePrice">Purchase Price (Optional)</label>
|
||
<div class="price-input-wrapper">
|
||
<span class="currency-symbol">$</span>
|
||
<input type="number" id="purchasePrice" name="purchase_price" class="form-control" min="0" step="0.01" placeholder="0.00">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label for="notes">Notes (Optional)</label>
|
||
<textarea id="notes" name="notes" class="form-control" rows="3" placeholder="Add any notes about this warranty..."></textarea>
|
||
</div>
|
||
</div>
|
||
<!-- Documents Tab -->
|
||
<div class="tab-content" id="documents">
|
||
<div class="form-group">
|
||
<label>Invoice/Receipt</label>
|
||
<div class="file-input-wrapper">
|
||
<label for="invoice" class="file-input-label">
|
||
<i class="fas fa-upload"></i> Choose File
|
||
</label>
|
||
<input type="file" id="invoice" name="invoice" class="file-input" accept=".pdf,.png,.jpg,.jpeg">
|
||
</div>
|
||
<div id="fileName" class="file-name"></div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label>Product Manual (Optional)</label>
|
||
<div class="file-input-wrapper">
|
||
<label for="manual" class="file-input-label">
|
||
<i class="fas fa-upload"></i> Choose File
|
||
</label>
|
||
<input type="file" id="manual" name="manual" class="file-input" accept=".pdf,.png,.jpg,.jpeg">
|
||
</div>
|
||
<div id="manualFileName" class="file-name"></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>Files (ZIP/RAR, Optional)</label>
|
||
<div class="file-input-wrapper">
|
||
<label for="otherDocument" class="file-input-label">
|
||
<i class="fas fa-upload"></i> Choose File
|
||
</label>
|
||
<input type="file" id="otherDocument" name="other_document" class="file-input" accept=".zip,.rar">
|
||
</div>
|
||
<div id="otherDocumentFileName" class="file-name"></div>
|
||
</div>
|
||
</div>
|
||
<!-- Tags Tab -->
|
||
<div class="tab-content" id="tags">
|
||
<div class="form-group">
|
||
<label>Add Tags</label>
|
||
<p class="text-muted">Tags help you organize and filter your warranties</p>
|
||
|
||
<div class="tags-container">
|
||
<div class="selected-tags" id="selectedTags">
|
||
<!-- Selected tags will be displayed here -->
|
||
</div>
|
||
|
||
<div class="tags-dropdown">
|
||
<input type="text" id="tagSearch" class="form-control" placeholder="Search or add new tag...">
|
||
<div class="tags-list" id="tagsList">
|
||
<!-- Tag options will be populated by JavaScript -->
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mt-10">
|
||
<button type="button" id="manageTagsBtn" class="btn btn-secondary btn-sm">
|
||
<i class="fas fa-cog"></i> Manage Tags
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- Summary Tab -->
|
||
<div class="tab-content" id="summary">
|
||
<div class="summary-container">
|
||
<div class="summary-section">
|
||
<h4><i class="fas fa-box"></i> Product Information</h4>
|
||
<div class="summary-item">
|
||
<span class="summary-label">Product Name:</span>
|
||
<span id="summary-product-name" class="summary-value">-</span>
|
||
</div>
|
||
<div class="summary-item">
|
||
<span class="summary-label">Product URL:</span>
|
||
<span id="summary-product-url" class="summary-value">-</span>
|
||
</div>
|
||
<div class="summary-item">
|
||
<span class="summary-label">Serial Numbers:</span>
|
||
<span id="summary-serial-numbers" class="summary-value">-</span>
|
||
</div>
|
||
<div class="summary-item">
|
||
<span class="summary-label">Vendor:</span>
|
||
<span id="summary-vendor" class="summary-value">-</span>
|
||
</div>
|
||
</div>
|
||
<div class="summary-section">
|
||
<h4><i class="fas fa-shield-alt"></i> Warranty Details</h4>
|
||
<div class="summary-item">
|
||
<span class="summary-label">Purchase Date:</span>
|
||
<span id="summary-purchase-date" class="summary-value">-</span>
|
||
</div>
|
||
<div class="summary-item">
|
||
<span class="summary-label">Warranty Period:</span>
|
||
<span id="summary-warranty-duration" class="summary-value">-</span>
|
||
</div>
|
||
<div class="summary-item">
|
||
<span class="summary-label">Purchase Price:</span>
|
||
<span id="summary-purchase-price" class="summary-value">-</span>
|
||
</div>
|
||
</div>
|
||
<div class="summary-section">
|
||
<h4><i class="fas fa-file-alt"></i> Documents</h4>
|
||
<div class="summary-item">
|
||
<span class="summary-label">Invoice/Receipt:</span>
|
||
<span id="summary-invoice" class="summary-value">-</span>
|
||
</div>
|
||
<div class="summary-item">
|
||
<span class="summary-label">Product Manual:</span>
|
||
<span id="summary-manual" class="summary-value">-</span>
|
||
</div>
|
||
<div class="summary-item">
|
||
<span class="summary-label">Files:</span>
|
||
<span id="summary-other-document" class="summary-value">-</span>
|
||
</div>
|
||
</div>
|
||
<div class="summary-section">
|
||
<h4><i class="fas fa-tags"></i> Tags</h4>
|
||
<div class="summary-item">
|
||
<span class="summary-label">Selected Tags:</span>
|
||
<div id="summary-tags" class="summary-value">-</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button type="submit" class="btn btn-primary" id="submitWarrantyBtn">Add Warranty</button>
|
||
</div>
|
||
</div>
|
||
<!-- Tab Navigation -->
|
||
<div class="tab-navigation">
|
||
<button type="button" class="btn btn-secondary prev-tab" id="prevTabBtn">
|
||
<i class="fas fa-arrow-left"></i> Previous
|
||
</button>
|
||
<button type="button" class="btn btn-primary next-tab" id="nextTabBtn">
|
||
Next <i class="fas fa-arrow-right"></i>
|
||
</button>
|
||
</div>
|
||
</form>
|
||
</div> <!-- End form-panel -->
|
||
</div> <!-- End modal-body -->
|
||
<!-- Optional: Add a modal footer if you want separate Cancel/Submit buttons -->
|
||
<!-- <div class="modal-footer">
|
||
<button class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||
</div> -->
|
||
</div> <!-- End modal -->
|
||
</div> <!-- End addWarrantyModal -->
|
||
</div> <!-- End main-content -->
|
||
</div> <!-- End container -->
|
||
|
||
<!-- Edit Warranty Modal -->
|
||
<div id="editModal" class="modal-backdrop">
|
||
<div class="modal">
|
||
<div class="modal-header">
|
||
<h3 class="modal-title">Edit Warranty</h3>
|
||
<button class="close-btn" data-dismiss="modal">×</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<!-- Tab Navigation -->
|
||
<div class="edit-tabs-nav">
|
||
<button type="button" class="edit-tab-btn active" data-tab="edit-product-info">
|
||
<i class="fas fa-box"></i> Product
|
||
</button>
|
||
<button type="button" class="edit-tab-btn" data-tab="edit-warranty-details">
|
||
<i class="fas fa-shield-alt"></i> Warranty
|
||
</button>
|
||
<button type="button" class="edit-tab-btn" data-tab="edit-documents">
|
||
<i class="fas fa-file-alt"></i> Documents
|
||
</button>
|
||
<button type="button" class="edit-tab-btn" data-tab="edit-tags">
|
||
<i class="fas fa-tags"></i> Tags
|
||
</button>
|
||
</div>
|
||
|
||
<form id="editWarrantyForm">
|
||
<input type="hidden" id="editWarrantyId">
|
||
|
||
<!-- Product Info Tab -->
|
||
<div class="edit-tab-content active" id="edit-product-info">
|
||
<div class="form-group">
|
||
<label for="editProductName">Product Name</label>
|
||
<input type="text" id="editProductName" name="product_name" class="form-control" required>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label for="editProductUrl">Product URL (Optional)</label>
|
||
<input type="text" id="editProductUrl" name="product_url" class="form-control" placeholder="https://example.com/product">
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label>Serial Numbers</label>
|
||
<div id="editSerialNumbersContainer">
|
||
<!-- Serial number inputs will be added dynamically -->
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label for="editVendor">Vendor (Optional)</label>
|
||
<input type="text" id="editVendor" name="vendor" class="form-control" placeholder="e.g. Amazon, Best Buy, etc.">
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Warranty Details Tab -->
|
||
<div class="edit-tab-content" id="edit-warranty-details">
|
||
<div class="form-group">
|
||
<label for="editPurchaseDate">Purchase Date</label>
|
||
<input type="date" id="editPurchaseDate" name="purchase_date" class="form-control" required>
|
||
</div>
|
||
|
||
<!-- Add Lifetime Checkbox -->
|
||
<div class="form-group">
|
||
<label class="lifetime-label">
|
||
<input type="checkbox" id="editIsLifetime" name="is_lifetime" value="true">
|
||
Lifetime Warranty
|
||
</label>
|
||
</div>
|
||
<!-- End Lifetime Checkbox -->
|
||
|
||
<div id="editWarrantyDurationFields">
|
||
<div class="form-group">
|
||
<label for="editWarrantyDurationYears">Warranty Period</label>
|
||
<div class="duration-inputs">
|
||
<div>
|
||
<input type="number" id="editWarrantyDurationYears" name="warranty_duration_years" class="form-control" min="0" max="100" placeholder="Years">
|
||
<small>Years</small>
|
||
</div>
|
||
<div>
|
||
<input type="number" id="editWarrantyDurationMonths" name="warranty_duration_months" class="form-control" min="0" max="11" placeholder="Months">
|
||
<small>Months</small>
|
||
</div>
|
||
<div>
|
||
<input type="number" id="editWarrantyDurationDays" name="warranty_duration_days" class="form-control" min="0" max="365" placeholder="Days">
|
||
<small>Days</small>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label for="editPurchasePrice">Purchase Price (Optional)</label>
|
||
<div class="price-input-wrapper">
|
||
<span class="currency-symbol">$</span>
|
||
<input type="number" id="editPurchasePrice" name="purchase_price" class="form-control" min="0" step="0.01" placeholder="0.00">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label for="editNotes">Notes (Optional)</label>
|
||
<textarea id="editNotes" name="notes" class="form-control" rows="3" placeholder="Add any notes about this warranty..."></textarea>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Documents Tab -->
|
||
<div class="edit-tab-content" id="edit-documents">
|
||
<div class="form-group">
|
||
<label>Invoice/Receipt</label>
|
||
<div class="file-input-wrapper">
|
||
<label for="editInvoice" class="file-input-label">
|
||
<i class="fas fa-upload"></i> Choose File
|
||
</label>
|
||
<input type="file" id="editInvoice" name="invoice" class="file-input" accept=".pdf,.png,.jpg,.jpeg">
|
||
</div>
|
||
<div id="editFileName" class="file-name"></div>
|
||
<div id="currentInvoice" class="mt-10"></div>
|
||
<button type="button" id="deleteInvoiceBtn" class="btn btn-danger btn-sm mt-2" style="display:none;"><i class="fas fa-trash"></i> Delete Invoice</button>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>Product Manual (Optional)</label>
|
||
<div class="file-input-wrapper">
|
||
<label for="editManual" class="file-input-label">
|
||
<i class="fas fa-upload"></i> Choose File
|
||
</label>
|
||
<input type="file" id="editManual" name="manual" class="file-input" accept=".pdf,.png,.jpg,.jpeg">
|
||
</div>
|
||
<div id="editManualFileName" class="file-name"></div>
|
||
<div id="currentManual" class="mt-10"></div>
|
||
<button type="button" id="deleteManualBtn" class="btn btn-danger btn-sm mt-2" style="display:none;"><i class="fas fa-trash"></i> Delete Manual</button>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>Files (ZIP/RAR, Optional)</label>
|
||
<div class="file-input-wrapper">
|
||
<label for="editOtherDocument" class="file-input-label">
|
||
<i class="fas fa-upload"></i> Choose File
|
||
</label>
|
||
<input type="file" id="editOtherDocument" name="other_document" class="file-input" accept=".zip,.rar">
|
||
</div>
|
||
<div id="editOtherDocumentFileName" class="file-name"></div>
|
||
<div id="currentOtherDocument" class="mt-10"></div>
|
||
<button type="button" id="deleteOtherDocumentBtn" class="btn btn-danger btn-sm mt-2" style="display:none;"><i class="fas fa-trash"></i> Delete Files</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Tags Tab -->
|
||
<div class="edit-tab-content" id="edit-tags">
|
||
<div class="form-group">
|
||
<label>Add Tags</label>
|
||
<p class="text-muted">Tags help you organize and filter your warranties</p>
|
||
|
||
<div class="tags-container">
|
||
<div class="selected-tags" id="editSelectedTags">
|
||
<!-- Selected tags will be displayed here -->
|
||
</div>
|
||
|
||
<div class="tags-dropdown">
|
||
<input type="text" id="editTagSearch" class="form-control" placeholder="Search or add new tag...">
|
||
<div class="tags-list" id="editTagsList">
|
||
<!-- Tag options will be populated by JavaScript -->
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mt-10">
|
||
<button type="button" id="editManageTagsBtn" class="btn btn-secondary btn-sm">
|
||
<i class="fas fa-cog"></i> Manage Tags
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-danger" data-dismiss="modal">Cancel</button>
|
||
<button id="saveWarrantyBtn" class="btn btn-primary">Save Changes</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Confirm Delete Modal -->
|
||
<div id="deleteModal" class="modal-backdrop">
|
||
<div class="modal">
|
||
<div class="modal-header">
|
||
<h3 class="modal-title">Confirm Delete</h3>
|
||
<button class="close-btn" data-dismiss="modal">×</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<p>Are you sure you want to delete this warranty? This action cannot be undone.</p>
|
||
<p><strong>Product:</strong> <span id="deleteProductName"></span></p>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||
<button id="confirmDeleteBtn" class="btn btn-danger">Delete</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Tag Management Modal -->
|
||
<div id="tagManagementModal" class="modal-backdrop">
|
||
<div class="modal">
|
||
<div class="modal-header">
|
||
<h3 class="modal-title">Manage Tags</h3>
|
||
<button class="close-btn" data-dismiss="modal">×</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form id="newTagForm" class="tag-form">
|
||
<input type="text" id="newTagName" class="form-control" placeholder="New tag name" required>
|
||
<input type="color" id="newTagColor" value="#808080">
|
||
<button type="submit" class="btn btn-primary">Add Tag</button>
|
||
</form>
|
||
|
||
<h4 class="mt-20">Existing Tags</h4>
|
||
<div id="existingTags" class="existing-tags">
|
||
<!-- Tags will be populated here by JavaScript -->
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Toast Container -->
|
||
<div id="toastContainer" class="toast-container"></div>
|
||
|
||
<!-- Loading Spinner -->
|
||
<div class="loading-container" id="loadingContainer">
|
||
<div class="loading-spinner"></div>
|
||
</div>
|
||
|
||
<script src="auth.js"></script>
|
||
<script src="script.js"></script>
|
||
|
||
</body>
|
||
</html>
|