File size: 17,065 Bytes
5cb3a81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AssetNinja Tracker - Details</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#3B82F6',
                        secondary: '#10B981',
                        warning: '#F59E0B'
                    }
                }
            }
        }

        document.addEventListener('DOMContentLoaded', function() {
            feather.replace();
            
            // Get solution type from URL
            const urlParams = new URLSearchParams(window.location.search);
            const solutionType = urlParams.get('type');
            const itemId = urlParams.get('id');

            // Highlight solution type indicator
            document.getElementById('solutionTypeIndicator').classList.add(
                solutionType === 'asset' ? 'bg-primary' : 
                solutionType === 'inventory' ? 'bg-secondary' : 'bg-warning'
            );

            // Set appropriate action buttons based on solution type
            const actionForm = document.getElementById('actionForm');
            if (solutionType === 'asset') {
                actionForm.innerHTML = `
                    <div class="mb-4">
                        <label class="block text-sm font-medium text-gray-700 mb-1">Action</label>
                        <select id="actionSelect" class="w-full border-gray-300 rounded-md shadow-sm focus:border-primary focus:ring-primary">
                            <option value="moved">Moved to</option>
                            <option value="missing">Mark as Missing</option>
                        </select>
                    </div>
                    <div id="locationField" class="mb-4">
                        <label class="block text-sm font-medium text-gray-700 mb-1">Select Location</label>
                        <select class="w-full border-gray-300 rounded-md shadow-sm focus:border-primary focus:ring-primary">
                            <option>Office Floor 1</option>
                            <option>Office Floor 2</option>
                            <option>Conference Room A</option>
                            <option>Storage Room</option>
                        </select>
                    </div>
                    <button type="submit" class="w-full bg-primary text-white py-2 px-4 rounded-md hover:bg-primary-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
                        Submit Action
                    </button>
                `;
            } else if (solutionType === 'inventory') {
                actionForm.innerHTML = `
                    <div class="mb-4">
                        <label class="block text-sm font-medium text-gray-700 mb-1">Action</label>
                        <select id="actionSelect" class="w-full border-gray-300 rounded-md shadow-sm focus:border-primary focus:ring-primary">
                            <option value="scanned">Scanned at</option>
                            <option value="consumed">Mark as Consumed</option>
                        </select>
                    </div>
                    <div id="locationField" class="mb-4">
                        <label class="block text-sm font-medium text-gray-700 mb-1">Select Location</label>
                        <select class="w-full border-gray-300 rounded-md shadow-sm focus:border-primary focus:ring-primary">
                            <option>Office Floor 1</option>
                            <option>Office Floor 2</option>
                            <option>Conference Room A</option>
                            <option>Storage Room</option>
                        </select>
                    </div>
                    <button type="submit" class="w-full bg-secondary text-white py-2 px-4 rounded-md hover:bg-secondary-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-secondary">
                        Submit Action
                    </button>
                `;
            } else {
                actionForm.innerHTML = `
                    <div class="mb-4">
                        <label class="block text-sm font-medium text-gray-700 mb-1">Action</label>
                        <select id="actionSelect" class="w-full border-gray-300 rounded-md shadow-sm focus:border-primary focus:ring-primary">
                            <option value="received">Received at</option>
                            <option value="complete">Mark as Complete</option>
                        </select>
                    </div>
                    <div id="locationField" class="mb-4">
                        <label class="block text-sm font-medium text-gray-700 mb-1">Select Location</label>
                        <select class="w-full border-gray-300 rounded-md shadow-sm focus:border-primary focus:ring-primary">
                            <option>Office Floor 1</option>
                            <option>Office Floor 2</option>
                            <option>Conference Room A</option>
                            <option>Storage Room</option>
                        </select>
                    </div>
                    <button type="submit" class="w-full bg-warning text-white py-2 px-4 rounded-md hover:bg-warning-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-warning">
                        Submit Action
                    </button>
                `;
            }

            // Toggle location field based on action
            document.getElementById('actionSelect')?.addEventListener('change', function(e) {
                const locationField = document.getElementById('locationField');
                if (['moved', 'scanned', 'received'].includes(e.target.value)) {
                    locationField.style.display = 'block';
                } else {
                    locationField.style.display = 'none';
                }
            });

            // Highlight rows in tables
            function setupTableHighlight(tableClass, highlightClass) {
                const rows = document.querySelectorAll(`.${tableClass} tbody tr`);
                rows.forEach(row => {
                    row.addEventListener('click', function() {
                        const key = this.getAttribute('data-key');
                        rows.forEach(r => r.classList.remove(highlightClass));
                        document.querySelectorAll(`.${tableClass} tbody tr[data-key="${key}"]`)
                            .forEach(r => r.classList.add(highlightClass));
                    });
                });
            }

            setupTableHighlight('location-history', 'highlight-location');
            setupTableHighlight('action-history', 'highlight-user');
        });
    </script>
    <style>
        .highlight-location {
            background-color: rgba(16, 185, 129, 0.1);
        }
        .highlight-user {
            background-color: rgba(249, 168, 37, 0.1);
        }
    </style>
</head>
<body class="bg-gray-50">
    <div class="min-h-screen flex flex-col">
        <!-- Header -->
        <header class="bg-white shadow-sm">
            <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4 flex justify-between items-center">
                <div class="flex items-center space-x-2">
                    <i data-feather="package" class="text-primary"></i>
                    <h1 class="text-xl font-bold text-gray-800">AssetNinja Tracker</h1>
                </div>
                <div class="flex items-center space-x-4">
                    <div class="relative">
                        <button id="userDropdownBtn" class="flex items-center space-x-2 focus:outline-none">
                            <span class="text-sm font-medium text-gray-700">John Doe</span>
                            <i data-feather="chevron-down" class="w-4 h-4 text-gray-500"></i>
                        </button>
                        <div id="userDropdown" class="hidden absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 z-10">
                            <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Jane Smith</a>
                            <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Mike Johnson</a>
                            <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Sarah Williams</a>
                            <a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">David Brown</a>
                        </div>
                    </div>
                    <button class="p-2 rounded-full bg-gray-100 text-gray-500 hover:bg-gray-200">
                        <i data-feather="bell"></i>
                    </button>
                </div>
            </div>
        </header>

        <!-- Main Content -->
        <main class="flex-grow">
            <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
                <!-- Back button -->
                <a href="index.html" class="inline-flex items-center text-primary hover:text-primary-600 mb-6">
                    <i data-feather="arrow-left" class="w-4 h-4 mr-2"></i>
                    Back to Dashboard
                </a>

                <!-- Detail Summary and Action -->
                <div class="grid grid-cols-1 lg:grid-cols-3 gap-8 mb-8">
                    <!-- Item Details -->
                    <div class="lg:col-span-2 bg-white rounded-lg shadow p-6">
                        <div class="flex items-start justify-between mb-4">
                            <div>
                                <div class="flex items-center space-x-3 mb-2">
                                    <span id="solutionTypeIndicator" class="w-3 h-3 rounded-full"></span>
                                    <span id="solutionTypeText" class="text-sm font-medium text-gray-500">Asset</span>
                                </div>
                                <h2 id="itemName" class="text-2xl font-bold text-gray-800">Laptop Dell XPS</h2>
                                <p id="currentLocation" class="text-gray-600 mt-2">Current Location: Office Floor 3</p>
                            </div>
                            <div class="flex space-x-2">
                                <button class="p-2 rounded-full bg-gray-100 text-gray-500 hover:bg-gray-200">
                                    <i data-feather="edit"></i>
                                </button>
                            </div>
                        </div>
                    </div>

                    <!-- Action Form -->
                    <div class="bg-white rounded-lg shadow p-6">
                        <h3 class="text-lg font-medium text-gray-900 mb-4">Item Actions</h3>
                        <form id="actionForm"></form>
                    </div>
                </div>

                <!-- Location History -->
                <div class="bg-white rounded-lg shadow overflow-hidden mb-8">
                    <div class="px-6 py-4 border-b border-gray-200">
                        <h3 class="text-lg font-medium text-gray-900">Location History</h3>
                    </div>
                    <div class="overflow-x-auto">
                        <table class="location-history min-w-full divide-y divide-gray-200">
                            <thead class="bg-gray-50">
                                <tr>
                                    <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Location</th>
                                    <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Time</th>
                                </tr>
                            </thead>
                            <tbody class="bg-white divide-y divide-gray-200">
                                <tr data-key="floor3" class="cursor-pointer hover:bg-gray-50">
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">Office Floor 3</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Today, 10:30 AM</td>
                                </tr>
                                <tr data-key="confA" class="cursor-pointer hover:bg-gray-50">
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">Conference Room A</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Yesterday, 2:15 PM</td>
                                </tr>
                                <tr data-key="floor2" class="cursor-pointer hover:bg-gray-50">
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">Office Floor 2</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Monday, 9:00 AM</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>

                <!-- Action History -->
                <div class="bg-white rounded-lg shadow overflow-hidden">
                    <div class="px-6 py-4 border-b border-gray-200">
                        <h3 class="text-lg font-medium text-gray-900">Action History</h3>
                    </div>
                    <div class="overflow-x-auto">
                        <table class="action-history min-w-full divide-y divide-gray-200">
                            <thead class="bg-gray-50">
                                <tr>
                                    <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">User</th>
                                    <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Action</th>
                                    <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Time</th>
                                </tr>
                            </thead>
                            <tbody class="bg-white divide-y divide-gray-200">
                                <tr data-key="john" class="cursor-pointer hover:bg-gray-50">
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">John Doe</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Moved to Office Floor 3</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Today, 10:30 AM</td>
                                </tr>
                                <tr data-key="sarah" class="cursor-pointer hover:bg-gray-50">
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">Sarah Williams</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Moved to Conference Room A</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Yesterday, 2:15 PM</td>
                                </tr>
                                <tr data-key="mike" class="cursor-pointer hover:bg-gray-50">
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">Mike Johnson</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Moved to Office Floor 2</td>
                                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Monday, 9:00 AM</td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </main>
    </div>

    <script>
        // Toggle user dropdown
        document.getElementById('userDropdownBtn')?.addEventListener('click', function() {
            const dropdown = document.getElementById('userDropdown');
            dropdown.classList.toggle('hidden');
        });

        // Close dropdown when clicking outside
        document.addEventListener('click', function(event) {
            const dropdownBtn = document.getElementById('userDropdownBtn');
            const dropdown = document.getElementById('userDropdown');
            
            if (!dropdownBtn.contains(event.target) && !dropdown.contains(event.target)) {
                dropdown.classList.add('hidden');
            }
        });
    </script>
</body>
</html>