-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcapa-tracker.html
More file actions
216 lines (194 loc) · 12.3 KB
/
Copy pathcapa-tracker.html
File metadata and controls
216 lines (194 loc) · 12.3 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CAPA Tracker | Aramco Appendix 11</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
<style>
:root { --aramco-green: #00843D; --aramco-dark: #1e1e1e; }
body { font-family: 'Roboto', sans-serif; background: #555; margin: 0; padding: 10px; padding-bottom: 80px; }
.document-page { background: #fff; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 10mm; border: 2px solid #000; box-shadow: 0 0 20px rgba(0,0,0,0.5); position: relative; box-sizing: border-box; }
/* 🏛️ Editable Header */
.header-table { width: 100%; border-collapse: collapse; border: 2px solid #000; }
.header-table td { border: 1px solid #000; padding: 10px; vertical-align: middle; }
.capa-title-box { text-align: center; background: #f2f2f2; }
.capa-title-box input { width: 100%; border: none; background: transparent; text-align: center; font-weight: bold; font-size: 16px; color: var(--aramco-green); outline: none; }
.capa-title-box small input { font-size: 11px; color: #333; font-weight: normal; }
.rev-box input { border: none; font-size: 10px; width: 100%; text-align: right; outline: none; font-weight: bold; }
/* 📋 Info Grid */
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 2px solid #000; border-top: none; }
.field { border-right: 1px solid #000; border-bottom: 1px solid #000; padding: 8px; }
.field:last-child { border-right: none; }
.field label { display: block; font-size: 10px; font-weight: bold; color: #555; text-transform: uppercase; }
.field input, .field select { width: 100%; border: none; font-size: 13px; outline: none; background: transparent; font-weight: bold; }
.section-bar { background: var(--aramco-green); color: white; padding: 8px; font-weight: bold; text-transform: uppercase; font-size: 13px; border: 2px solid #000; border-top: none; }
/* 📸 Finding Row */
.finding-row { border: 2px solid #000; border-top: none; display: grid; grid-template-columns: 1fr 1fr 200px; }
.col-box { padding: 10px; border-right: 1px solid #000; }
.col-box:last-child { border-right: none; }
.col-box label { font-size: 10px; font-weight: bold; display: block; margin-bottom: 5px; color: var(--aramco-green); }
textarea { width: 100%; min-height: 80px; border: none; font-family: inherit; font-size: 12px; resize: none; outline: none; }
.photo-area { padding: 10px; text-align: center; background: #fafafa; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.img-preview { width: 100%; max-width: 170px; height: 110px; border: 1px dashed #ccc; object-fit: cover; margin-bottom: 5px; background: #eee; }
/* 🕹️ NEW: Bottom Controls (Mobile Responsive) */
.controls { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(30,30,30,0.9); padding: 10px; display: flex; justify-content: center; gap: 8px; z-index: 2000; flex-wrap: wrap; }
.btn { padding: 8px 12px; border: none; border-radius: 4px; color: white; font-weight: bold; cursor: pointer; font-size: 12px; display: flex; align-items: center; gap: 5px; }
.btn-green { background: var(--aramco-green); }
.btn-blue { background: #1976d2; }
.btn-orange { background: #f57c00; }
.btn-red { background: #d32f2f; }
.btn-cam { font-size: 10px; padding: 5px; background: #444; border: none; color: white; cursor: pointer; }
@media print {
body { background: white; padding: 0; }
.document-page { border: 2px solid #000; box-shadow: none; width: 100%; margin: 0; padding: 10mm; }
.controls, .btn-cam { display: none !important; }
}
@media (max-width: 800px) {
body { padding: 5px; padding-bottom: 120px; }
.document-page { width: 100%; padding: 5mm; min-height: auto; }
.info-grid { grid-template-columns: 1fr; }
.finding-row { grid-template-columns: 1fr; }
.col-box { border-right: none; border-bottom: 1px solid #000; }
.photo-area { border-top: 1px solid #000; }
.controls { padding: 5px; gap: 5px; }
.btn { flex: 1 1 45%; font-size: 10px; justify-content: center; }
}
</style>
</head>
<body>
<div class="controls no-print">
<button class="btn btn-green" onclick="window.print()">📄 PRINT</button>
<button class="btn btn-blue" onclick="saveCAPA()">💾 SAVE</button>
<button class="btn btn-orange" onclick="loadCAPA()">🔄 LOAD</button>
<button class="btn btn-red" onclick="addCAPARow()">➕ ACTION</button>
<a href="index.html" class="btn btn-blue" style="text-decoration:none;">⬅️ DASHBOARD</a>
</div>
<div class="document-page">
<table class="header-table">
<tr>
<td width="20%" style="text-align:center;">
<img src="https://upload.wikimedia.org/wikipedia/en/thumb/4/44/Saudi_Aramco_Logo.svg/1200px-Saudi_Aramco_Logo.svg.png" style="width:60px;">
</td>
<td class="capa-title-box">
<input type="text" value="CORRECTIVE & PREVENTIVE ACTION (CAPA) LOG">
<br>
<small><input type="text" value="Saudi Aramco Suppliers Safety Management System (Appendix 11)"></small>
</td>
<td width="25%" class="rev-box">
<input type="text" value="APPENDIX 11" style="font-size: 12px;"><br>
<input type="text" value="Rev: April 2026"><br>
<input type="text" value="Page 1 of 1">
</td>
</tr>
</table>
<div class="info-grid">
<div class="field"><label>Company Name:</label><input type="text" id="comp_name"></div>
<div class="field"><label>Contract Number:</label><input type="text" id="cont_no"></div>
<div class="field"><label>Facility / Area:</label><input type="text" id="fac_area"></div>
<div class="field"><label>CAPA Log Ref #:</label><input type="text" id="capa_ref" placeholder="CP-2026-001"></div>
<div class="field"><label>Report Date:</label><input type="date" id="report_date"></div>
<div class="field"><label>Status:</label>
<select id="overall_status"><option>OPEN</option><option>CLOSED</option><option>IN-PROGRESS</option></select>
</div>
</div>
<div class="section-bar">Action Tracking & Evidence of Closure</div>
<div id="capa-container">
<div class="finding-row">
<div class="col-box">
<label>NON-CONFORMANCE & ROOT CAUSE:</label>
<textarea class="nc-desc" placeholder="Describe issue..."></textarea>
</div>
<div class="col-box">
<label>CORRECTIVE ACTIONS:</label>
<textarea class="pa-desc" placeholder="Actions taken..."></textarea>
<div style="display:grid; grid-template-columns: 1fr 1fr; gap:5px; margin-top:5px;">
<div><label>OWNER:</label><input type="text" class="owner-name" style="width:100%; border:1px solid #eee;"></div>
<div><label>TARGET:</label><input type="date" class="target-date" style="width:100%; border:1px solid #eee;"></div>
</div>
</div>
<div class="photo-area">
<label>EVIDENCE PHOTO</label>
<img id="prev_1" class="img-preview" src="" alt="Pending Evidence">
<input type="file" id="file_1" accept="image/*" style="display:none" onchange="previewImage(this, 'prev_1')">
<button class="btn-cam" onclick="document.getElementById('file_1').click()">📷 TAKE PHOTO</button>
</div>
</div>
</div>
<div class="section-bar">Authorizations</div>
<div style="display:flex; border:2px solid #000; border-top:none; min-height: 80px;">
<div style="flex:1; padding:10px; border-right:1px solid #000;">
<label style="font-size:10px; font-weight:bold;">ORIGINATOR (HSE):</label><br><br>____________________
</div>
<div style="flex:1; padding:10px;">
<label style="font-size:10px; font-weight:bold;">MANAGER:</label><br><br>____________________
</div>
</div>
</div>
<script>
let rowCount = 1;
function addCAPARow() {
rowCount++;
const html = `
<div class="finding-row">
<div class="col-box">
<label>NON-CONFORMANCE & ROOT CAUSE:</label>
<textarea class="nc-desc" placeholder="Describe finding..."></textarea>
</div>
<div class="col-box">
<label>CORRECTIVE ACTIONS:</label>
<textarea class="pa-desc" placeholder="Describe actions..."></textarea>
<div style="display:grid; grid-template-columns: 1fr 1fr; gap:5px; margin-top:5px;">
<div><label>OWNER:</label><input type="text" class="owner-name" style="width:100%; border:1px solid #eee;"></div>
<div><label>TARGET:</label><input type="date" class="target-date" style="width:100%; border:1px solid #eee;"></div>
</div>
</div>
<div class="photo-area">
<label>EVIDENCE PHOTO</label>
<img id="prev_${rowCount}" class="img-preview" src="" alt="Pending">
<input type="file" id="file_${rowCount}" accept="image/*" style="display:none" onchange="previewImage(this, 'prev_${rowCount}')">
<button class="btn-cam" onclick="document.getElementById('file_${rowCount}').click()">📷 PHOTO</button>
</div>
</div>`;
document.getElementById('capa-container').insertAdjacentHTML('beforeend', html);
}
function previewImage(input, previewId) {
if (input.files && input.files[0]) {
const reader = new FileReader();
reader.onload = (e) => document.getElementById(previewId).src = e.target.result;
reader.readAsDataURL(input.files[0]);
}
}
function saveCAPA() {
const data = {
header: { comp: document.getElementById('comp_name').value, ref: document.getElementById('capa_ref').value },
rows: []
};
document.querySelectorAll('.finding-row').forEach((row) => {
data.rows.push({ nc: row.querySelector('.nc-desc').value, pa: row.querySelector('.pa-desc').value, img: row.querySelector('.img-preview').src });
});
localStorage.setItem('aramco_capa_v4', JSON.stringify(data));
alert("✅ CAPA Saved!");
}
function loadCAPA() {
const data = JSON.parse(localStorage.getItem('aramco_capa_v4'));
if(!data) return alert("No Data!");
document.getElementById('comp_name').value = data.header.comp;
document.getElementById('capa_ref').value = data.header.ref;
alert("🔄 Header Loaded! Row data in memory.");
}
// 🔄 Settings se Data Auto-Fill karne ka Magic Code
window.addEventListener('load', () => {
const gComp = localStorage.getItem('g_comp');
const gCont = localStorage.getItem('g_cont');
const gName = localStorage.getItem('g_name');
const gSite = localStorage.getItem('g_site');
if(gComp && document.getElementById('comp_name')) document.getElementById('comp_name').value = gComp;
if(gCont && document.getElementById('cont_no')) document.getElementById('cont_no').value = gCont;
if(gName && document.getElementById('auditor')) document.getElementById('auditor').value = gName;
if(gSite && document.getElementById('facility')) document.getElementById('facility').value = gSite;
if(gSite && document.getElementById('fac_area')) document.getElementById('fac_area').value = gSite;
});
</script>
</body>
</html>