لیست مجاز ادویه

 

 

#آیدی نمبراسم جنریکشماره ATCدسته بندیشکلقوتحجم

➡ قبلیبعدی ⬅

let currentPage = 1; const limit = 5; let currentSearch = ""; async function loadMedicines(page = 1, search = "") { const loader = document.getElementById("medicine-loader"); const table = document.getElementById("medicine-table"); const tbody = table.querySelector("tbody"); const pagination = document.getElementById("pagination"); loader.style.display = "block"; table.style.display = "none"; pagination.style.display = "none"; tbody.innerHTML = ""; try { const res = await fetch( `http://180.94.64.131:9000/api/auth-medicines/for-web/?page=${page}&limit=${limit}&search=${encodeURIComponent( search )}` ); const json = await res.json(); if (json.success && json.data.length > 0) { loader.style.display = "none"; table.style.display = "table"; pagination.style.display = "flex"; json.data.forEach((item, index) => { const row = document.createElement("tr"); row.style.animationDelay = `${index * 0.04}s`; row.innerHTML = ` ${(page - 1) * limit + index + 1} ${item.code || "-"} ${item.generic_name || "-"} ${item.who_atc_code || "-"} ${item.category || "-"} ${item.dosage_form || "-"} ${item.strength || "-"} ${item.volume || "-"} `; tbody.appendChild(row); }); // Pagination state document.getElementById("prevBtn").disabled = page === 1; document.getElementById("nextBtn").disabled = page * limit >= json.count; } else { loader.innerHTML = "

ادویه ای با این مشخصه پیدا نشد

"; } } catch (err) { loader.innerHTML = "

⚠️ در جستجوی ادویه مشکل به وجود آمده است

"; console.error(err); } } // Pagination document.getElementById("prevBtn").addEventListener("click", () => { if (currentPage > 1) { currentPage--; loadMedicines(currentPage, currentSearch); } }); document.getElementById("nextBtn").addEventListener("click", () => { currentPage++; loadMedicines(currentPage, currentSearch); }); // Search button document.getElementById("search-btn").addEventListener("click", () => { currentSearch = document.getElementById("medicine-search").value; currentPage = 1; loadMedicines(currentPage, currentSearch); }); // Initial load loadMedicines();

#medicine-table-container { font-family: "Segoe UI", "Tahoma", sans-serif !important; background: #ffffff !important; border-radius: 14px !important; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1) !important; overflow: hidden; animation: fadeIn 0.5s ease !important; width: 100% !important; align-self: center; } @media (min-width: 922px) and (max-width: 1199px) { #medicine-table-container { width: 100% !important; } } @media (min-width: 1200px) and (max-width: 1440px) { #medicine-table-container { width: 1100px !important; position: relative; margin-bottom: 5rem; left: 25%; } } @media (min-width: 1441px) { #medicine-table-container { width: 1280px !important; position: relative; margin-bottom: 5rem; left: 35%; } } /* Top search bar */ #search-bar { background: #e0f2ff; padding: 12px 16px; display: flex; align-items: center; justify-content: center; gap: 8px; } #medicine-search { flex: 1; border: 1px solid #b3daff; border-radius: 8px; outline: none; font-size: 14px; padding: 10px 12px; color: #495057; transition: border 0.3s, box-shadow 0.3s; } #medicine-search:focus { border-color: #66b2ff; box-shadow: 0 0 6px rgba(0, 123, 255, 0.3); } #search-btn { background: #0096c7; border: none; padding: 10px 14px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.3s; } #search-btn svg { width: 18px; height: 18px; fill: white; } #search-btn:hover { background: #0077b6; } /* Table */ #medicine-table { width: 100%; border-collapse: collapse; overflow-x: auto !important; overflow-y: auto !important; } #medicine-table thead { background: #d0ebff; color: #023e8a; } #medicine-table th, #medicine-table td { text-align: right; text-wrap: nowrap; padding: 14px 16px; font-size: 14px; border-bottom: 1px solid #e9ecef; } #medicine-table th { font-weight: 600; } #medicine-table tbody tr { opacity: 0; transform: translateY(8px); animation: rowFade 0.4s ease forwards; } #medicine-table tbody tr:hover { background: #f1faff; transition: background 0.3s ease; } #medicine-table tbody tr:nth-child(even) { background: #f9f9f9; } /* Loader */ #medicine-loader { text-align: center; padding: 40px 20px; } .spinner { border: 4px solid #e0e6f0; border-top: 4px solid #0096c7; border-radius: 50%; width: 36px; height: 36px; margin: auto; animation: spin 1s linear infinite; } /* Pagination */ #pagination { display: flex; justify-content: center; padding: 12px; background: #f8f9fa; gap: 10px; } #pagination button { padding: 8px 14px; border: none; border-radius: 6px; background: #0096c7; color: white; font-size: 14px; cursor: pointer; transition: background 0.3s; } #pagination button:disabled { background: #ced4da; cursor: not-allowed; } #pagination button:hover:not(:disabled) { background: #0077b6; } /* Animations */ @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } @keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } @keyframes rowFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }