Spaces:
Running
Running
barcode scanner in modem serial # automatic add if scan again - Follow Up Deployment
5063c1f verified Download index.html from royramirez20/materials-request: direct link, hf CLI and curl.
- Browser
- Download file 28.9 kB
-
https://huggingface.co/spaces/royramirez20/materials-request/resolve/main/index.html
- Command line
-
hf download hf://spaces/royramirez20/materials-request/index.html
-
curl -L -o index.html https://huggingface.co/spaces/royramirez20/materials-request/resolve/main/index.html
28.9 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Technician Materials Form</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| /* Custom styles for barcode scanner */ | |
| .barcode-scanner { | |
| position: relative; | |
| display: inline-block; | |
| } | |
| .barcode-scanner-btn { | |
| background-color: #4F46E5; | |
| color: white; | |
| border: none; | |
| padding: 0.25rem 0.5rem; | |
| border-radius: 0.25rem; | |
| cursor: pointer; | |
| margin-left: 0.5rem; | |
| } | |
| .barcode-scanner-btn:hover { | |
| background-color: #4338CA; | |
| } | |
| .scanner-modal { | |
| display: none; | |
| position: fixed; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| background-color: rgba(0,0,0,0.8); | |
| z-index: 1000; | |
| flex-direction: column; | |
| align-items: center; | |
| justify-content: center; | |
| } | |
| .scanner-video { | |
| width: 80%; | |
| max-width: 500px; | |
| border: 2px solid white; | |
| border-radius: 8px; | |
| } | |
| .scanner-close { | |
| margin-top: 1rem; | |
| background-color: #EF4444; | |
| color: white; | |
| padding: 0.5rem 1rem; | |
| border-radius: 0.25rem; | |
| cursor: pointer; | |
| } | |
| /* Custom file upload button */ | |
| .file-input-label { | |
| display: inline-block; | |
| padding: 0.5rem 1rem; | |
| background-color: #4F46E5; | |
| color: white; | |
| border-radius: 0.25rem; | |
| cursor: pointer; | |
| transition: background-color 0.2s; | |
| } | |
| .file-input-label:hover { | |
| background-color: #4338CA; | |
| } | |
| .file-input { | |
| display: none; | |
| } | |
| /* Animation for form submission */ | |
| @keyframes fadeIn { | |
| from { opacity: 0; transform: translateY(20px); } | |
| to { opacity: 1; transform: translateY(0); } | |
| } | |
| .fade-in { | |
| animation: fadeIn 0.5s ease-out forwards; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-100"> | |
| <div class="container mx-auto px-4 py-8 max-w-4xl"> | |
| <div class="bg-white rounded-lg shadow-lg overflow-hidden fade-in"> | |
| <!-- Header --> | |
| <div class="bg-indigo-600 px-6 py-4"> | |
| <h1 class="text-2xl font-bold text-white">Technician Materials Form</h1> | |
| <p class="text-indigo-200">Please fill out all required fields</p> | |
| </div> | |
| <!-- Form --> | |
| <form id="materialsForm" class="p-6 space-y-6"> | |
| <!-- Basic Information Section --> | |
| <div class="space-y-4"> | |
| <h2 class="text-xl font-semibold text-gray-800 border-b pb-2">Basic Information</h2> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4"> | |
| <!-- Date --> | |
| <div> | |
| <label for="date" class="block text-sm font-medium text-gray-700 mb-1"> | |
| Date <span class="text-red-500">*</span> | |
| </label> | |
| <input type="date" id="date" name="date" required | |
| class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500"> | |
| </div> | |
| <!-- Technician Name --> | |
| <div> | |
| <label for="technicianName" class="block text-sm font-medium text-gray-700 mb-1"> | |
| Technician Name <span class="text-red-500">*</span> | |
| </label> | |
| <input type="text" id="technicianName" name="technicianName" required | |
| class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" | |
| placeholder="Enter technician name"> | |
| </div> | |
| </div> | |
| <!-- Plate Number --> | |
| <div> | |
| <label for="plateNumber" class="block text-sm font-medium text-gray-700 mb-1"> | |
| Plate # <span class="text-red-500">*</span> | |
| </label> | |
| <input type="text" id="plateNumber" name="plateNumber" required | |
| class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" | |
| placeholder="Enter plate number"> | |
| </div> | |
| </div> | |
| <!-- Materials Section --> | |
| <div class="space-y-4"> | |
| <h2 class="text-xl font-semibold text-gray-800 border-b pb-2">Materials Used</h2> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4"> | |
| <!-- Mechanical Connector --> | |
| <div> | |
| <label for="mechanicalConnector" class="block text-sm font-medium text-gray-700 mb-1"> | |
| Mechanical Connector (per pc.) <span class="text-red-500">*</span> | |
| </label> | |
| <input type="number" id="mechanicalConnector" name="mechanicalConnector" min="0" required | |
| class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" | |
| placeholder="Enter quantity"> | |
| </div> | |
| <!-- NIU --> | |
| <div> | |
| <label for="niu" class="block text-sm font-medium text-gray-700 mb-1"> | |
| NIU (per pc.) <span class="text-red-500">*</span> | |
| </label> | |
| <input type="number" id="niu" name="niu" min="0" required | |
| class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" | |
| placeholder="Enter quantity"> | |
| </div> | |
| <!-- Patchcord --> | |
| <div> | |
| <label for="patchcord" class="block text-sm font-medium text-gray-700 mb-1"> | |
| Patchcord (per pc.) <span class="text-red-500">*</span> | |
| </label> | |
| <input type="number" id="patchcord" name="patchcord" min="0" required | |
| class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" | |
| placeholder="Enter quantity"> | |
| </div> | |
| <!-- F17, S-Shape Anchor Clamp --> | |
| <div> | |
| <label for="anchorClamp" class="block text-sm font-medium text-gray-700 mb-1"> | |
| F17, S-Shape Anchor Clamp (per pc.) <span class="text-red-500">*</span> | |
| </label> | |
| <input type="number" id="anchorClamp" name="anchorClamp" min="0" required | |
| class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" | |
| placeholder="Enter quantity"> | |
| </div> | |
| <!-- House Bracket --> | |
| <div> | |
| <label for="houseBracket" class="block text-sm font-medium text-gray-700 mb-1"> | |
| House Bracket (per pc.) <span class="text-red-500">*</span> | |
| </label> | |
| <input type="number" id="houseBracket" name="houseBracket" min="0" required | |
| class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" | |
| placeholder="Enter quantity"> | |
| </div> | |
| <!-- Mid Span --> | |
| <div> | |
| <label for="midSpan" class="block text-sm font-medium text-gray-700 mb-1"> | |
| Mid Span (per pc.) <span class="text-red-500">*</span> | |
| </label> | |
| <input type="number" id="midSpan" name="midSpan" min="0" required | |
| class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" | |
| placeholder="Enter quantity"> | |
| </div> | |
| <!-- Cable Clip --> | |
| <div> | |
| <label for="cableClip" class="block text-sm font-medium text-gray-700 mb-1"> | |
| Cable Clip (per pc.) <span class="text-red-500">*</span> | |
| </label> | |
| <input type="number" id="cableClip" name="cableClip" min="0" required | |
| class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" | |
| placeholder="Enter quantity"> | |
| </div> | |
| <!-- Cable Tie --> | |
| <div> | |
| <label for="cableTie" class="block text-sm font-medium text-gray-700 mb-1"> | |
| Cable Tie (per pc.) <span class="text-red-500">*</span> | |
| </label> | |
| <input type="number" id="cableTie" name="cableTie" min="0" required | |
| class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" | |
| placeholder="Enter quantity"> | |
| </div> | |
| <!-- Adhesive Tape --> | |
| <div> | |
| <label for="adhesiveTape" class="block text-sm font-medium text-gray-700 mb-1"> | |
| Adhesive Tape (per pc.) <span class="text-red-500">*</span> | |
| </label> | |
| <input type="number" id="adhesiveTape" name="adhesiveTape" min="0" required | |
| class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" | |
| placeholder="Enter quantity"> | |
| </div> | |
| <!-- Electrical Tape --> | |
| <div> | |
| <label for="electricalTape" class="block text-sm font-medium text-gray-700 mb-1"> | |
| Electrical Tape (per pc.) <span class="text-red-500">*</span> | |
| </label> | |
| <input type="number" id="electricalTape" name="electricalTape" min="0" required | |
| class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" | |
| placeholder="Enter quantity"> | |
| </div> | |
| <!-- Labeler Tape --> | |
| <div> | |
| <label for="labelerTape" class="block text-sm font-medium text-gray-700 mb-1"> | |
| Labeler Tape <span class="text-red-500">*</span> | |
| </label> | |
| <input type="number" id="labelerTape" name="labelerTape" min="0" required | |
| class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" | |
| placeholder="Enter quantity"> | |
| </div> | |
| <!-- Others --> | |
| <div class="md:col-span-2"> | |
| <label for="others" class="block text-sm font-medium text-gray-700 mb-1"> | |
| Others (Please Specify) <span class="text-red-500">*</span> | |
| </label> | |
| <textarea id="others" name="others" rows="2" | |
| class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" | |
| placeholder="Specify other materials used"></textarea> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Serialized Materials Section --> | |
| <div class="space-y-4"> | |
| <h2 class="text-xl font-semibold text-gray-800 border-b pb-2">Serialized Materials</h2> | |
| <!-- DROP FOC, 2 Core Serial Number --> | |
| <div> | |
| <label for="dropFocSerial" class="block text-sm font-medium text-gray-700 mb-1"> | |
| DROP FOC, 2 Core Serial Number (per reel) <span class="text-red-500">*</span> | |
| </label> | |
| <input type="text" id="dropFocSerial" name="dropFocSerial" required | |
| class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" | |
| placeholder="Enter serial number"> | |
| </div> | |
| <!-- Modem Type --> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1"> | |
| Modem Type <span class="text-red-500">*</span> | |
| </label> | |
| <div class="grid grid-cols-2 md:grid-cols-3 gap-2"> | |
| <label class="inline-flex items-center"> | |
| <input type="radio" name="modemType" value="ZTE" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500" required> | |
| <span class="ml-2 text-gray-700">ZTE</span> | |
| </label> | |
| <label class="inline-flex items-center"> | |
| <input type="radio" name="modemType" value="HUAWEI" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500"> | |
| <span class="ml-2 text-gray-700">HUAWEI</span> | |
| </label> | |
| <label class="inline-flex items-center"> | |
| <input type="radio" name="modemType" value="SKYWORTH" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500"> | |
| <span class="ml-2 text-gray-700">SKYWORTH</span> | |
| </label> | |
| <label class="inline-flex items-center"> | |
| <input type="radio" name="modemType" value="V2F" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500"> | |
| <span class="ml-2 text-gray-700">V2F</span> | |
| </label> | |
| <label class="inline-flex items-center"> | |
| <input type="radio" name="modemType" value="V2" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500"> | |
| <span class="ml-2 text-gray-700">V2</span> | |
| </label> | |
| <label class="inline-flex items-center"> | |
| <input type="radio" name="modemType" value="GAMECHANGER" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500"> | |
| <span class="ml-2 text-gray-700">GAMECHANGER</span> | |
| </label> | |
| <label class="inline-flex items-center md:col-span-3"> | |
| <input type="radio" name="modemType" value="Other" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500"> | |
| <span class="ml-2 text-gray-700">Other:</span> | |
| <input type="text" name="modemTypeOther" class="ml-2 px-2 py-1 border border-gray-300 rounded-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 flex-1" placeholder="Specify modem type"> | |
| </label> | |
| </div> | |
| </div> | |
| <!-- Modem Serial Number --> | |
| <div> | |
| <label for="modemSerial" class="block text-sm font-medium text-gray-700 mb-1"> | |
| Modem Serial Number | |
| </label> | |
| <div class="flex"> | |
| <input type="text" id="modemSerial" name="modemSerial" | |
| class="w-full px-3 py-2 border border-gray-300 rounded-l-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500" | |
| placeholder="Enter modem serial number"> | |
| <button type="button" onclick="openScanner('modemSerial')" | |
| class="barcode-scanner-btn rounded-r-md"> | |
| <i class="fas fa-barcode"></i> | |
| </button> | |
| </div> | |
| <div id="modemSerialsContainer" class="mt-2 space-y-1"></div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Upload Picture Section --> | |
| <div class="space-y-4"> | |
| <h2 class="text-xl font-semibold text-gray-800 border-b pb-2">Upload Picture</h2> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1"> | |
| Upload Picture (if any) | |
| </label> | |
| <label for="pictureUpload" class="file-input-label"> | |
| <i class="fas fa-upload mr-2"></i>Choose File | |
| </label> | |
| <input type="file" id="pictureUpload" name="pictureUpload" accept="image/*" class="file-input"> | |
| <span id="fileName" class="ml-2 text-sm text-gray-500">No file chosen</span> | |
| </div> | |
| </div> | |
| <!-- Form Submission --> | |
| <div class="pt-4 border-t border-gray-200"> | |
| <div class="flex justify-between"> | |
| <button type="button" onclick="resetForm()" class="px-4 py-2 bg-gray-300 text-gray-700 rounded-md hover:bg-gray-400 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500"> | |
| <i class="fas fa-redo mr-2"></i>Reset | |
| </button> | |
| <button type="submit" class="px-4 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"> | |
| <i class="fas fa-paper-plane mr-2"></i>Submit | |
| </button> | |
| </div> | |
| </div> | |
| </form> | |
| </div> | |
| <!-- Success Modal --> | |
| <div id="successModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50"> | |
| <div class="bg-white p-6 rounded-lg shadow-xl max-w-md w-full mx-4"> | |
| <div class="text-center"> | |
| <div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-green-100"> | |
| <svg class="h-6 w-6 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path> | |
| </svg> | |
| </div> | |
| <h3 class="mt-3 text-lg font-medium text-gray-900">Form Submitted Successfully!</h3> | |
| <div class="mt-2 text-sm text-gray-500"> | |
| <p>Your entry has been recorded in the sheet.</p> | |
| <p class="mt-2"> | |
| <a href="https://docs.google.com/spreadsheets/d/1aArzBlDDI-ycUjn4kHRZl4GxorM-KZIpI244MwPaTLQ/edit?gid=0#gid=0" | |
| target="_blank" | |
| class="text-indigo-600 hover:text-indigo-500"> | |
| View Sheet <i class="fas fa-external-link-alt ml-1"></i> | |
| </a> | |
| </p> | |
| </div> | |
| <div class="mt-4"> | |
| <button type="button" onclick="closeSuccessModal()" class="px-4 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"> | |
| Close | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Barcode Scanner Modal --> | |
| <div id="scannerModal" class="scanner-modal hidden"> | |
| <video id="scannerVideo" class="scanner-video" autoplay playsinline></video> | |
| <button id="scannerClose" class="scanner-close">Close Scanner</button> | |
| </div> | |
| </div> | |
| <script> | |
| // File upload display | |
| document.getElementById('pictureUpload').addEventListener('change', function(e) { | |
| const fileName = document.getElementById('fileName'); | |
| if (this.files.length > 0) { | |
| fileName.textContent = this.files[0].name; | |
| } else { | |
| fileName.textContent = 'No file chosen'; | |
| } | |
| }); | |
| // Form submission | |
| document.getElementById('materialsForm').addEventListener('submit', function(e) { | |
| e.preventDefault(); | |
| // Collect form data including modem serial | |
| const formData = { | |
| date: document.getElementById('date').value, | |
| technicianName: document.getElementById('technicianName').value, | |
| plateNumber: document.getElementById('plateNumber').value, | |
| modemType: document.querySelector('input[name="modemType"]:checked').value, | |
| modemSerials: getModemSerials(), | |
| // ... other form fields ... | |
| }; | |
| console.log('Form data:', formData); | |
| // Here you would normally send the form data to your server | |
| // For this demo, we'll just show the success modal | |
| document.getElementById('successModal').classList.remove('hidden'); | |
| }); | |
| // Reset form | |
| function resetForm() { | |
| document.getElementById('materialsForm').reset(); | |
| document.getElementById('fileName').textContent = 'No file chosen'; | |
| } | |
| // Close success modal | |
| function closeSuccessModal() { | |
| document.getElementById('successModal').classList.add('hidden'); | |
| resetForm(); | |
| } | |
| // Barcode scanner functionality | |
| function openScanner(fieldId) { | |
| const modal = document.getElementById('scannerModal'); | |
| const video = document.getElementById('scannerVideo'); | |
| modal.classList.remove('hidden'); | |
| // For demo purposes, we'll simulate scanning after 2 seconds | |
| setTimeout(() => { | |
| // In a real implementation, you would use a barcode scanning library | |
| // Here we just simulate a scanned value | |
| const serialNumber = 'SN' + Math.floor(Math.random() * 1000000000).toString().padStart(9, '0'); | |
| if (fieldId === 'modemSerial') { | |
| addModemSerial(serialNumber); | |
| } else { | |
| document.getElementById(fieldId).value = serialNumber; | |
| } | |
| closeScanner(); | |
| }, 2000); | |
| // In a real implementation, you would access the device camera here | |
| // navigator.mediaDevices.getUserMedia({ video: { facingMode: "environment" } }) | |
| // .then(function(stream) { | |
| // video.srcObject = stream; | |
| // }) | |
| // .catch(function(err) { | |
| // console.error("Error accessing camera: ", err); | |
| // }); | |
| } | |
| function closeScanner() { | |
| const modal = document.getElementById('scannerModal'); | |
| const video = document.getElementById('scannerVideo'); | |
| modal.classList.add('hidden'); | |
| // In a real implementation, you would stop the camera stream here | |
| // if (video.srcObject) { | |
| // video.srcObject.getTracks().forEach(track => track.stop()); | |
| // } | |
| } | |
| document.getElementById('scannerClose').addEventListener('click', closeScanner); | |
| // Handle multiple modem serial numbers | |
| function addModemSerial(serialNumber) { | |
| const container = document.getElementById('modemSerialsContainer'); | |
| const input = document.getElementById('modemSerial'); | |
| // Check if this serial already exists | |
| const existingItems = container.querySelectorAll('.serial-item'); | |
| for (const item of existingItems) { | |
| if (item.textContent.includes(serialNumber)) { | |
| return; // Skip duplicates | |
| } | |
| } | |
| // Create new serial item | |
| const serialItem = document.createElement('div'); | |
| serialItem.className = 'serial-item flex items-center justify-between bg-gray-100 px-3 py-2 rounded'; | |
| const serialText = document.createElement('span'); | |
| serialText.textContent = serialNumber; | |
| const deleteBtn = document.createElement('button'); | |
| deleteBtn.innerHTML = '<i class="fas fa-times text-red-500"></i>'; | |
| deleteBtn.className = 'ml-2'; | |
| deleteBtn.onclick = function() { | |
| container.removeChild(serialItem); | |
| }; | |
| serialItem.appendChild(serialText); | |
| serialItem.appendChild(deleteBtn); | |
| container.appendChild(serialItem); | |
| // Clear the input field for next scan | |
| input.value = ''; | |
| } | |
| // Get all modem serials as array | |
| function getModemSerials() { | |
| const items = document.getElementById('modemSerialsContainer').querySelectorAll('.serial-item span'); | |
| return Array.from(items).map(item => item.textContent); | |
| } | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=royramirez20/materials-request" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |