ISO Documentation

ISO Documentation
ISO QMS Documentation System

ISO QMS Documentation System

MetaTechX Engineers LLP

Quality Management Dashboard

0
Total Documents
0
Approved
0
Pending Review
0
Maintenance Due

Documents by Type

Status Overview

Recent Documents

`;printWindow.document.write(printContent);printWindow.document.close();setTimeout(() => {printWindow.print();}, 250);showToast('PDF print dialog opened', 'success');}function exportToPDF() {const config = window.elementSdk ? window.elementSdk.config : defaultConfig;const printWindow = window.open('', '_blank');const printContent = `Dashboard Report

${config.company_name || defaultConfig.company_name}

${config.dashboard_title || defaultConfig.dashboard_title}

Generated: ${new Date().toLocaleDateString()} ${new Date().toLocaleTimeString()}

${allRecords.length}
Total Documents
${allRecords.filter(r => r.status === 'Approved').length}
Approved
${allRecords.filter(r => r.status === 'Under Review').length}
Pending Review
${allRecords.filter(r => r.next_maintenance && new Date(r.next_maintenance) <= new Date()).length}
Maintenance Due

All Documents

${allRecords.map(r => ``).join('')}
Doc NumberTitleTypeDepartmentStatusDate
${r.document_number}${r.title}${r.document_type}${r.department}${r.status}${new Date(r.date).toLocaleDateString()}
`;printWindow.document.write(printContent);printWindow.document.close();setTimeout(() => {printWindow.print();}, 250);showToast('Dashboard PDF print dialog opened', 'success');}function exportToExcel() {if (allRecords.length === 0) {showToast('No data to export', 'error');return;}const exportData = allRecords.map(record => ({'Document Type': record.document_type,'Document Number': record.document_number,'Title': record.title,'Department': record.department,'Team': record.team,'Prepared By': record.prepared_by,'Designation': record.prepared_by_designation,'Reviewed By': record.reviewed_by,'Reviewer Designation': record.reviewed_by_designation,'Approved By': record.approved_by,'Approver Designation': record.approved_by_designation,'Date': record.date,'Revision': record.revision,'Status': record.status,'Priority': record.priority,'Scope': record.scope,'Objective': record.objective,'Responsibilities': record.responsibilities,'Equipment ID': record.equipment_id,'Maintenance Type': record.maintenance_type,'Next Maintenance': record.next_maintenance,'Frequency': record.frequency,'Safety Requirements': record.safety_requirements,'Quality Criteria': record.quality_criteria,'Records Retention': record.records_retention}));const ws = XLSX.utils.json_to_sheet(exportData);const wb = XLSX.utils.book_new();XLSX.utils.book_append_sheet(wb, ws, 'ISO QMS Records');XLSX.writeFile(wb, `ISO_QMS_Records_${new Date().toISOString().split('T')[0]}.xlsx`);showToast('Excel file downloaded successfully!', 'success');}function generateDailyReport() {const today = new Date().toISOString().split('T')[0];const todayRecords = allRecords.filter(r => r.date === today);const config = window.elementSdk ? window.elementSdk.config : defaultConfig;const printWindow = window.open('', '_blank');const printContent = `Daily Report - ${today}

${config.company_name || defaultConfig.company_name}

Daily Report - ${new Date(today).toLocaleDateString()}

Generated: ${new Date().toLocaleTimeString()}

${todayRecords.length}
Today's Documents
${allRecords.length}
Total Documents
${allRecords.filter(r => r.status === 'Approved').length}
Approved
${allRecords.filter(r => r.status === 'Under Review').length}
Pending Review

Today's Documents

${todayRecords.length === 0 ? '

No documents created today

' : `${todayRecords.map(r => ``).join('')}
Doc NumberTitleTypeDepartmentTeamStatusPriority
${r.document_number}${r.title}${r.document_type}${r.department}${r.team}${r.status}${r.priority}
`}

Maintenance Due

${allRecords.filter(r => r.next_maintenance && new Date(r.next_maintenance) <= new Date()).length === 0 ? '

No maintenance due

' : `${allRecords.filter(r => r.next_maintenance && new Date(r.next_maintenance) <= new Date()).map(r => ``).join('')}
Equipment IDTitleDue DatePriority
${r.equipment_id}${r.title}${new Date(r.next_maintenance).toLocaleDateString()}${r.priority}
`} `;printWindow.document.write(printContent);printWindow.document.close();setTimeout(() => {printWindow.print();}, 250);showToast('Daily report print dialog opened', 'success');}function loadFromLocalStorage() {try {const stored = localStorage.getItem('iso_qms_backup');if (stored) {allRecords = JSON.parse(stored);updateDashboard();renderRecords();}} catch (e) {console.error('Failed to load from localStorage:', e);}}function syncToLocalStorage() {try {localStorage.setItem('iso_qms_backup', JSON.stringify(allRecords));} catch (e) {console.error('Failed to backup to localStorage:', e);}}function backupToLocal() {try {const dataStr = JSON.stringify(allRecords, null, 2);const dataBlob = new Blob([dataStr], { type: 'application/json' });const url = URL.createObjectURL(dataBlob);const link = document.createElement('a');link.href = url;link.download = `ISO_QMS_Backup_${new Date().toISOString().split('T')[0]}.json`;link.click();URL.revokeObjectURL(url);showToast('Backup downloaded to your device!', 'success');} catch (e) {showToast('Failed to create backup', 'error');}}function getStatusColor(status) {const colors = {'Draft': 'text-gray-600','Under Review': 'text-yellow-600','Approved': 'text-green-600','Obsolete': 'text-red-600','Completed': 'text-green-600','In Progress': 'text-blue-600','Scheduled': 'text-yellow-600','Overdue': 'text-red-600'};return colors[status] || 'text-gray-600';}function getStatusBadgeColor(status) {const colors = {'Draft': 'bg-gray-200 text-gray-800','Under Review': 'bg-yellow-200 text-yellow-800','Approved': 'bg-green-200 text-green-800','Obsolete': 'bg-red-200 text-red-800','Completed': 'bg-green-200 text-green-800','In Progress': 'bg-blue-200 text-blue-800','Scheduled': 'bg-yellow-200 text-yellow-800','Overdue': 'bg-red-200 text-red-800'};return colors[status] || 'bg-gray-200 text-gray-800';}function getPriorityColor(priority) {const colors = {'Low': 'text-blue-600','Medium': 'text-yellow-600','High': 'text-orange-600','Critical': 'text-red-600'};return colors[priority] || 'text-gray-600';}function showToast(message, type) {const toast = document.createElement('div');const bgColor = type === 'success' ? 'bg-green-500' : type === 'info' ? 'bg-blue-500' : 'bg-red-500';toast.className = `fixed top-4 right-4 px-6 py-3 rounded-lg shadow-lg text-white ${bgColor} z-50`;toast.textContent = message;document.body.appendChild(toast);setTimeout(() => toast.remove(), 3000);}async function showConfirmDialog(message) {return new Promise((resolve) => {const overlay = document.createElement('div');overlay.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';overlay.innerHTML = `

${message}

`;document.body.appendChild(overlay);overlay.querySelector('#confirmBtn').onclick = () => {overlay.remove();resolve(true);};overlay.querySelector('#cancelBtn').onclick = () => {overlay.remove();resolve(false);};});}init();

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *