Spaces:
Running
Running
Add 3 files
Browse files- README.md +7 -5
- index.html +806 -19
- prompts.txt +1 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: rig-ops-procedure-v2
|
| 3 |
+
emoji: ⚛️
|
| 4 |
+
colorFrom: pink
|
| 5 |
+
colorTo: green
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- QwenSite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,806 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
| 6 |
+
<title>Rig Operation Procedure Builder - LEGO Style</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js"></script>
|
| 9 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
|
| 10 |
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
|
| 11 |
+
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
| 12 |
+
<style>
|
| 13 |
+
body {
|
| 14 |
+
font-family: 'Poppins', sans-serif;
|
| 15 |
+
}
|
| 16 |
+
.procedure-block {
|
| 17 |
+
@apply bg-white border-2 border-dashed border-gray-300 rounded-lg shadow-sm p-4 mb-4 cursor-move transition-all hover:shadow-md;
|
| 18 |
+
}
|
| 19 |
+
.procedure-block.dragging {
|
| 20 |
+
@apply opacity-50 border-blue-400;
|
| 21 |
+
}
|
| 22 |
+
.upload-area {
|
| 23 |
+
@apply border-2 border-dashed border-gray-300 rounded-lg p-6 text-center cursor-pointer hover:bg-gray-50 transition-all relative overflow-hidden;
|
| 24 |
+
}
|
| 25 |
+
.upload-area input[type="file"] {
|
| 26 |
+
@apply absolute inset-0 w-full h-full opacity-0 cursor-pointer;
|
| 27 |
+
}
|
| 28 |
+
.drag-over {
|
| 29 |
+
@apply bg-blue-50 border-blue-400;
|
| 30 |
+
}
|
| 31 |
+
.step-number {
|
| 32 |
+
@apply bg-blue-600 text-white w-8 h-8 rounded-full flex items-center justify-center text-sm font-semibold;
|
| 33 |
+
}
|
| 34 |
+
.flex-between-center {
|
| 35 |
+
@apply flex items-center justify-between;
|
| 36 |
+
}
|
| 37 |
+
</style>
|
| 38 |
+
</head>
|
| 39 |
+
<body class="bg-gradient-to-br from-slate-50 to-slate-100 min-h-screen">
|
| 40 |
+
|
| 41 |
+
<div class="container mx-auto px-4 py-8 max-w-6xl">
|
| 42 |
+
|
| 43 |
+
<!-- Header -->
|
| 44 |
+
<header class="text-center mb-8">
|
| 45 |
+
<h1 class="text-4xl font-bold text-gray-800 mb-2">🧱 Rig Operation Procedure Builder</h1>
|
| 46 |
+
<p class="text-lg text-gray-600">Build your procedures like LEGO blocks. Drag, edit, and publish!</p>
|
| 47 |
+
</header>
|
| 48 |
+
|
| 49 |
+
<!-- Main Toolbar -->
|
| 50 |
+
<div class="bg-white rounded-lg shadow-lg p-6 mb-6">
|
| 51 |
+
<div class="flex-between-center mb-4">
|
| 52 |
+
<h2 class="text-xl font-semibold text-gray-700">🛠️ Procedure Toolbox</h2>
|
| 53 |
+
<div class="flex space-x-3">
|
| 54 |
+
<button id="saveBtn" class="bg-green-600 hover:bg-green-700 text-white px-5 py-2 rounded-lg text-sm font-medium flex items-center gap-1 transition">
|
| 55 |
+
<i class="fas fa-save"></i> Save
|
| 56 |
+
</button>
|
| 57 |
+
<button id="printBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-5 py-2 rounded-lg text-sm font-medium flex items-center gap-1 transition">
|
| 58 |
+
<i class="fas fa-print"></i> Print
|
| 59 |
+
</button>
|
| 60 |
+
<button id="downloadWordBtn" class="bg-purple-600 hover:bg-purple-700 text-white px-5 py-2 rounded-lg text-sm font-medium flex items-center gap-1 transition">
|
| 61 |
+
<i class="fas fa-file-word"></i> Download Word
|
| 62 |
+
</button>
|
| 63 |
+
<button id="approvalBtn" class="bg-orange-500 hover:bg-orange-600 text-white px-5 py-2 rounded-lg text-sm font-medium flex items-center gap-1 transition">
|
| 64 |
+
<i class="fas fa-check-circle"></i> Submit for Approval
|
| 65 |
+
</button>
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
|
| 69 |
+
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4">
|
| 70 |
+
<div class="toolbox-item p-4 bg-blue-50 border border-blue-200 rounded-lg cursor-pointer hover:bg-blue-100 transition text-center" data-type="image">
|
| 71 |
+
<i class="fas fa-image text-blue-600 text-2xl mb-2"></i>
|
| 72 |
+
<p class="text-sm font-medium text-blue-800">Upload Image</p>
|
| 73 |
+
</div>
|
| 74 |
+
<div class="toolbox-item p-4 bg-green-50 border border-green-200 rounded-lg cursor-pointer hover:bg-green-100 transition text-center" data-type="time">
|
| 75 |
+
<i class="fas fa-clock text-green-600 text-2xl mb-2"></i>
|
| 76 |
+
<p class="text-sm font-medium text-green-800">Time Estimate</p>
|
| 77 |
+
</div>
|
| 78 |
+
<div class="toolbox-item p-4 bg-red-50 border border-red-200 rounded-lg cursor-pointer hover:bg-red-100 transition text-center" data-type="material">
|
| 79 |
+
<i class="fas fa-tools text-red-600 text-2xl mb-2"></i>
|
| 80 |
+
<p class="text-sm font-medium text-red-800">Materials</p>
|
| 81 |
+
</div>
|
| 82 |
+
<div class="toolbox-item p-4 bg-yellow-50 border border-yellow-200 rounded-lg cursor-pointer hover:bg-yellow-100 transition text-center" data-type="safety">
|
| 83 |
+
<i class="fas fa-shield-alt text-yellow-600 text-2xl mb-2"></i>
|
| 84 |
+
<p class="text-sm font-medium text-yellow-800">Safety Concerns</p>
|
| 85 |
+
</div>
|
| 86 |
+
<div class="toolbox-item p-4 bg-indigo-50 border border-indigo-200 rounded-lg cursor-pointer hover:bg-indigo-100 transition text-center" data-type="personnel">
|
| 87 |
+
<i class="fas fa-users text-indigo-600 text-2xl mb-2"></i>
|
| 88 |
+
<p class="text-sm font-medium text-indigo-800">Personnel</p>
|
| 89 |
+
</div>
|
| 90 |
+
<div class="toolbox-item p-4 bg-gray-50 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-100 transition text-center" data-type="note">
|
| 91 |
+
<i class="fas fa-sticky-note text-gray-600 text-2xl mb-2"></i>
|
| 92 |
+
<p class="text-sm font-medium text-gray-800">Notes</p>
|
| 93 |
+
</div>
|
| 94 |
+
<div class="toolbox-item p-4 bg-pink-50 border border-pink-200 rounded-lg cursor-pointer hover:bg-pink-100 transition text-center" data-type="warning">
|
| 95 |
+
<i class="fas fa-exclamation-triangle text-pink-600 text-2xl mb-2"></i>
|
| 96 |
+
<p class="text-sm font-medium text-pink-800">Warning</p>
|
| 97 |
+
</div>
|
| 98 |
+
<div class="toolbox-item p-4 bg-teal-50 border border-teal-200 rounded-lg cursor-pointer hover:bg-teal-100 transition text-center" data-type="checklist">
|
| 99 |
+
<i class="fas fa-check-square text-teal-600 text-2xl mb-2"></i>
|
| 100 |
+
<p class="text-sm font-medium text-teal-800">Checklist</p>
|
| 101 |
+
</div>
|
| 102 |
+
<div class="toolbox-item p-4 bg-purple-50 border border-purple-200 rounded-lg cursor-pointer hover:bg-purple-100 transition text-center" data-type="reference">
|
| 103 |
+
<i class="fas fa-book text-purple-600 text-2xl mb-2"></i>
|
| 104 |
+
<p class="text-sm font-medium text-purple-800">Reference Doc</p>
|
| 105 |
+
</div>
|
| 106 |
+
<div class="toolbox-item p-4 bg-gray-50 border border-gray-300 rounded-lg cursor-pointer hover:bg-gray-100 transition text-center" data-type="step">
|
| 107 |
+
<i class="fas fa-list-ol text-gray-600 text-2xl mb-2"></i>
|
| 108 |
+
<p class="text-sm font-medium text-gray-800">Text Step</p>
|
| 109 |
+
</div>
|
| 110 |
+
</div>
|
| 111 |
+
</div>
|
| 112 |
+
|
| 113 |
+
<!-- Procedure Builder Area -->
|
| 114 |
+
<div id="procedureBuilder" class="bg-white rounded-lg shadow-lg p-6 min-h-96 mb-6">
|
| 115 |
+
<div class="text-center text-gray-500 mb-4" id="placeholder">
|
| 116 |
+
<i class="fas fa-plus-circle text-3xl mb-2 text-gray-400"></i>
|
| 117 |
+
<p>Drag item dari toolbox atau klik untuk menambahkan blok prosedur</p>
|
| 118 |
+
</div>
|
| 119 |
+
</div>
|
| 120 |
+
|
| 121 |
+
<!-- Database & Approval Panel -->
|
| 122 |
+
<div class="bg-white rounded-lg shadow-lg p-6">
|
| 123 |
+
<h2 class="text-xl font-semibold text-gray-700 mb-4">📁 Database & Approval Status</h2>
|
| 124 |
+
<div class="overflow-x-auto">
|
| 125 |
+
<table class="min-w-full text-sm">
|
| 126 |
+
<thead>
|
| 127 |
+
<tr class="border-b">
|
| 128 |
+
<th class="text-left py-2">Procedure ID</th>
|
| 129 |
+
<th class="text-left py-2">Title</th>
|
| 130 |
+
<th class="text-left py-2">Last Edited</th>
|
| 131 |
+
<th class="text-left py-2">Status</th>
|
| 132 |
+
<th class="text-left py-2">Actions</th>
|
| 133 |
+
</tr>
|
| 134 |
+
</thead>
|
| 135 |
+
<tbody id="procedureTableBody">
|
| 136 |
+
<!-- Placeholder row -->
|
| 137 |
+
<tr class="border-b">
|
| 138 |
+
<td class="py-2">PRC-001</td>
|
| 139 |
+
<td>Main Drilling Sequence</td>
|
| 140 |
+
<td>2023-10-15 14:30</td>
|
| 141 |
+
<td><span class="bg-yellow-100 text-yellow-800 px-2 py-1 rounded text-xs">Pending</span></td>
|
| 142 |
+
<td>
|
| 143 |
+
<button class="text-blue-600 text-sm hover:underline">Edit</button> |
|
| 144 |
+
<button class="text-gray-600 text-sm hover:underline">View</button>
|
| 145 |
+
</td>
|
| 146 |
+
</tr>
|
| 147 |
+
</tbody>
|
| 148 |
+
</table>
|
| 149 |
+
</div>
|
| 150 |
+
</div>
|
| 151 |
+
|
| 152 |
+
</div>
|
| 153 |
+
|
| 154 |
+
<!-- Template Blocks (Hidden) -->
|
| 155 |
+
<div class="hidden">
|
| 156 |
+
<!-- Image Block -->
|
| 157 |
+
<div id="template-image" class="procedure-block">
|
| 158 |
+
<div class="flex-between-center mb-3">
|
| 159 |
+
<div class="step-number">?</div>
|
| 160 |
+
<div class="text-sm text-gray-500">Image Upload</div>
|
| 161 |
+
<div class="flex gap-1">
|
| 162 |
+
<button class="edit-block text-blue-600 hover:text-blue-800 text-xs"><i class="fas fa-edit"></i></button>
|
| 163 |
+
<button class="remove-block text-red-600 hover:text-red-800 text-xs"><i class="fas fa-trash"></i></button>
|
| 164 |
+
</div>
|
| 165 |
+
</div>
|
| 166 |
+
<div class="upload-area" data-type="image">
|
| 167 |
+
<i class="fas fa-cloud-upload-alt text-gray-400 text-3xl mb-2"></i>
|
| 168 |
+
<p class="text-gray-500 text-sm">Klik atau seret gambar ke sini</p>
|
| 169 |
+
<input type="file" accept="image/*" class="upload-input">
|
| 170 |
+
<img class="hidden mt-2 max-h-48 rounded border" />
|
| 171 |
+
</div>
|
| 172 |
+
</div>
|
| 173 |
+
|
| 174 |
+
<!-- Time Block -->
|
| 175 |
+
<div id="template-time" class="procedure-block">
|
| 176 |
+
<div class="flex-between-center mb-3">
|
| 177 |
+
<div class="step-number">?</div>
|
| 178 |
+
<div class="text-sm text-gray-500">Time Estimate</div>
|
| 179 |
+
<div class="flex gap-1">
|
| 180 |
+
<button class="edit-block text-blue-600 hover:text-blue-800 text-xs"><i class="fas fa-edit"></i></button>
|
| 181 |
+
<button class="remove-block text-red-600 hover:text-red-800 text-xs"><i class="fas fa-trash"></i></button>
|
| 182 |
+
</div>
|
| 183 |
+
</div>
|
| 184 |
+
<div class="grid grid-cols-2 gap-4">
|
| 185 |
+
<div>
|
| 186 |
+
<label class="block text-xs font-semibold text-gray-700 mb-1">Start Time:</label>
|
| 187 |
+
<input type="time" class="w-full border border-gray-300 rounded px-2 py-1 text-sm" value="08:00">
|
| 188 |
+
</div>
|
| 189 |
+
<div>
|
| 190 |
+
<label class="block text-xs font-semibold text-gray-700 mb-1">End Time:</label>
|
| 191 |
+
<input type="time" class="w-full border border-gray-300 rounded px-2 py-1 text-sm" value="10:30">
|
| 192 |
+
</div>
|
| 193 |
+
</div>
|
| 194 |
+
<div class="mt-2">
|
| 195 |
+
<label class="block text-xs font-semibold text-gray-700 mb-1">Total Duration:</label>
|
| 196 |
+
<input type="text" class="w-full border border-gray-300 rounded px-2 py-1 text-sm bg-gray-100" value="2h 30m" readonly>
|
| 197 |
+
</div>
|
| 198 |
+
</div>
|
| 199 |
+
|
| 200 |
+
<!-- Material Block -->
|
| 201 |
+
<div id="template-material" class="procedure-block">
|
| 202 |
+
<div class="flex-between-center mb-3">
|
| 203 |
+
<div class="step-number">?</div>
|
| 204 |
+
<div class="text-sm text-gray-500">Required Materials</div>
|
| 205 |
+
<div class="flex gap-1">
|
| 206 |
+
<button class="edit-block text-blue-600 hover:text-blue-800 text-xs"><i class="fas fa-edit"></i></button>
|
| 207 |
+
<button class="remove-block text-red-600 hover:text-red-800 text-xs"><i class="fas fa-trash"></i></button>
|
| 208 |
+
</div>
|
| 209 |
+
</div>
|
| 210 |
+
<div class="material-list space-y-2 mb-2"></div>
|
| 211 |
+
<button class="add-material bg-gray-200 hover:bg-gray-300 text-gray-700 px-3 py-1 rounded text-xs flex items-center gap-1">
|
| 212 |
+
<i class="fas fa-plus text-xs"></i> Add Material
|
| 213 |
+
</button>
|
| 214 |
+
</div>
|
| 215 |
+
|
| 216 |
+
<!-- Safety Block -->
|
| 217 |
+
<div id="template-safety" class="procedure-block">
|
| 218 |
+
<div class="flex-between-center mb-3">
|
| 219 |
+
<div class="step-number">?</div>
|
| 220 |
+
<div class="text-sm text-gray-500">Safety Concerns</div>
|
| 221 |
+
<div class="flex gap-1">
|
| 222 |
+
<button class="edit-block text-blue-600 hover:text-blue-800 text-xs"><i class="fas fa-edit"></i></button>
|
| 223 |
+
<button class="remove-block text-red-600 hover:text-red-800 text-xs"><i class="fas fa-trash"></i></button>
|
| 224 |
+
</div>
|
| 225 |
+
</div>
|
| 226 |
+
<textarea class="w-full border border-red-200 rounded px-3 py-2 text-sm bg-red-50 resize-none focus:ring-2 focus:ring-red-300"
|
| 227 |
+
placeholder="Describe safety concerns, PPE requirements, emergency procedures..."></textarea>
|
| 228 |
+
</div>
|
| 229 |
+
|
| 230 |
+
<!-- Personnel Block -->
|
| 231 |
+
<div id="template-personnel" class="procedure-block">
|
| 232 |
+
<div class="flex-between-center mb-3">
|
| 233 |
+
<div class="step-number">?</div>
|
| 234 |
+
<div class="text-sm text-gray-500">Required Personnel</div>
|
| 235 |
+
<div class="flex gap-1">
|
| 236 |
+
<button class="edit-block text-blue-600 hover:text-blue-800 text-xs"><i class="fas fa-edit"></i></button>
|
| 237 |
+
<button class="remove-block text-red-600 hover:text-red-800 text-xs"><i class="fas fa-trash"></i></button>
|
| 238 |
+
</div>
|
| 239 |
+
</div>
|
| 240 |
+
<div class="personnel-list space-y-2 mb-2"></div>
|
| 241 |
+
<button class="add-personnel bg-gray-200 hover:bg-gray-300 text-gray-700 px-3 py-1 rounded text-xs flex items-center gap-1">
|
| 242 |
+
<i class="fas fa-plus text-xs"></i> Add Personnel
|
| 243 |
+
</button>
|
| 244 |
+
</div>
|
| 245 |
+
|
| 246 |
+
<!-- Note Block -->
|
| 247 |
+
<div id="template-note" class="procedure-block">
|
| 248 |
+
<div class="flex-between-center mb-3">
|
| 249 |
+
<div class="step-number">?</div>
|
| 250 |
+
<div class="text-sm text-gray-500">Additional Notes</div>
|
| 251 |
+
<div class="flex gap-1">
|
| 252 |
+
<button class="edit-block text-blue-600 hover:text-blue-800 text-xs"><i class="fas fa-edit"></i></button>
|
| 253 |
+
<button class="remove-block text-red-600 hover:text-red-800 text-xs"><i class="fas fa-trash"></i></button>
|
| 254 |
+
</div>
|
| 255 |
+
</div>
|
| 256 |
+
<textarea class="w-full border border-gray-200 rounded px-3 py-2 text-sm resize-none focus:ring-2 focus:ring-gray-300"
|
| 257 |
+
placeholder="Enter additional information or instructions..."></textarea>
|
| 258 |
+
</div>
|
| 259 |
+
|
| 260 |
+
<!-- Warning Block -->
|
| 261 |
+
<div id="template-warning" class="procedure-block border-l-4 border-l-orange-500">
|
| 262 |
+
<div class="flex-between-center mb-3">
|
| 263 |
+
<div class="step-number">?</div>
|
| 264 |
+
<div class="text-sm text-gray-500">⚠️ Critical Warning</div>
|
| 265 |
+
<div class="flex gap-1">
|
| 266 |
+
<button class="edit-block text-blue-600 hover:text-blue-800 text-xs"><i class="fas fa-edit"></i></button>
|
| 267 |
+
<button class="remove-block text-red-600 hover:text-red-800 text-xs"><i class="fas fa-trash"></i></button>
|
| 268 |
+
</div>
|
| 269 |
+
</div>
|
| 270 |
+
<textarea class="w-full border border-orange-200 rounded px-3 py-2 text-sm bg-orange-50 resize-none focus:ring-2 focus:ring-orange-300 font-medium"
|
| 271 |
+
placeholder="Enter critical warning message..."></textarea>
|
| 272 |
+
</div>
|
| 273 |
+
|
| 274 |
+
<!-- Checklist Block -->
|
| 275 |
+
<div id="template-checklist" class="procedure-block">
|
| 276 |
+
<div class="flex-between-center mb-3">
|
| 277 |
+
<div class="step-number">?</div>
|
| 278 |
+
<div class="text-sm text-gray-500">Checklist</div>
|
| 279 |
+
<div class="flex gap-1">
|
| 280 |
+
<button class="edit-block text-blue-600 hover:text-blue-800 text-xs"><i class="fas fa-edit"></i></button>
|
| 281 |
+
<button class="remove-block text-red-600 hover:text-red-800 text-xs"><i class="fas fa-trash"></i></button>
|
| 282 |
+
</div>
|
| 283 |
+
</div>
|
| 284 |
+
<div class="checklist-items space-y-2 mb-2"></div>
|
| 285 |
+
<button class="add-checklist bg-gray-200 hover:bg-gray-300 text-gray-700 px-3 py-1 rounded text-xs flex items-center gap-1">
|
| 286 |
+
<i class="fas fa-plus text-xs"></i> Add Item
|
| 287 |
+
</button>
|
| 288 |
+
</div>
|
| 289 |
+
|
| 290 |
+
<!-- Reference Block -->
|
| 291 |
+
<div id="template-reference" class="procedure-block">
|
| 292 |
+
<div class="flex-between-center mb-3">
|
| 293 |
+
<div class="step-number">?</div>
|
| 294 |
+
<div class="text-sm text-gray-500">Reference Document</div>
|
| 295 |
+
<div class="flex gap-1">
|
| 296 |
+
<button class="edit-block text-blue-600 hover:text-blue-800 text-xs"><i class="fas fa-edit"></i></button>
|
| 297 |
+
<button class="remove-block text-red-600 hover:text-red-800 text-xs"><i class="fas fa-trash"></i></button>
|
| 298 |
+
</div>
|
| 299 |
+
</div>
|
| 300 |
+
<div class="upload-area" data-type="reference">
|
| 301 |
+
<i class="fas fa-file-pdf text-gray-400 text-3xl mb-2"></i>
|
| 302 |
+
<p class="text-gray-500 text-sm">Klik atau seret dokumen referensi</p>
|
| 303 |
+
<input type="file" class="upload-input">
|
| 304 |
+
</div>
|
| 305 |
+
</div>
|
| 306 |
+
|
| 307 |
+
<!-- Text Step Block -->
|
| 308 |
+
<div id="template-step" class="procedure-block">
|
| 309 |
+
<div class="flex-between-center mb-3">
|
| 310 |
+
<div class="step-number">?</div>
|
| 311 |
+
<div class="text-sm text-gray-500">Procedure Step</div>
|
| 312 |
+
<div class="flex gap-1">
|
| 313 |
+
<button class="edit-block text-blue-600 hover:text-blue-800 text-xs"><i class="fas fa-edit"></i></button>
|
| 314 |
+
<button class="remove-block text-red-600 hover:text-red-800 text-xs"><i class="fas fa-trash"></i></button>
|
| 315 |
+
</div>
|
| 316 |
+
</div>
|
| 317 |
+
<textarea class="w-full border border-gray-200 rounded px-3 py-2 text-sm focus:ring-2 focus:ring-blue-300"
|
| 318 |
+
placeholder="Describe the operation procedure step by step..."></textarea>
|
| 319 |
+
</div>
|
| 320 |
+
</div>
|
| 321 |
+
|
| 322 |
+
<script>
|
| 323 |
+
// Global state
|
| 324 |
+
let procedureCounter = 1;
|
| 325 |
+
let blocks = [];
|
| 326 |
+
let selectedProcedure = null;
|
| 327 |
+
|
| 328 |
+
// Elements
|
| 329 |
+
const builder = document.getElementById('procedureBuilder');
|
| 330 |
+
const placeholder = document.getElementById('placeholder');
|
| 331 |
+
const toolboxItems = document.querySelectorAll('.toolbox-item');
|
| 332 |
+
const saveBtn = document.getElementById('saveBtn');
|
| 333 |
+
const printBtn = document.getElementById('printBtn');
|
| 334 |
+
const downloadWordBtn = document.getElementById('downloadWordBtn');
|
| 335 |
+
const approvalBtn = document.getElementById('approvalBtn');
|
| 336 |
+
|
| 337 |
+
// Initialize
|
| 338 |
+
function init() {
|
| 339 |
+
setupToolbox();
|
| 340 |
+
setupBuilder();
|
| 341 |
+
setupEvents();
|
| 342 |
+
loadProcedures();
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
// Setup toolbox drag and click
|
| 346 |
+
function setupToolbox() {
|
| 347 |
+
toolboxItems.forEach(item => {
|
| 348 |
+
const type = item.dataset.type;
|
| 349 |
+
|
| 350 |
+
// Click to add
|
| 351 |
+
item.addEventListener('click', () => {
|
| 352 |
+
addBlock(type);
|
| 353 |
+
});
|
| 354 |
+
|
| 355 |
+
// Drag start
|
| 356 |
+
item.addEventListener('dragstart', (e) => {
|
| 357 |
+
e.dataTransfer.setData('text/plain', type);
|
| 358 |
+
item.style.opacity = '0.5';
|
| 359 |
+
});
|
| 360 |
+
|
| 361 |
+
item.addEventListener('dragend', () => {
|
| 362 |
+
item.style.opacity = '1';
|
| 363 |
+
});
|
| 364 |
+
});
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
// Setup builder area
|
| 368 |
+
function setupBuilder() {
|
| 369 |
+
// Allow drop
|
| 370 |
+
builder.addEventListener('dragover', (e) => {
|
| 371 |
+
e.preventDefault();
|
| 372 |
+
const uploadAreas = builder.querySelectorAll('.upload-area');
|
| 373 |
+
uploadAreas.forEach(area => {
|
| 374 |
+
if (area.contains(e.target) || area === e.target) {
|
| 375 |
+
area.classList.add('drag-over');
|
| 376 |
+
}
|
| 377 |
+
});
|
| 378 |
+
});
|
| 379 |
+
|
| 380 |
+
builder.addEventListener('dragleave', (e) => {
|
| 381 |
+
const uploadAreas = builder.querySelectorAll('.upload-area');
|
| 382 |
+
uploadAreas.forEach(area => {
|
| 383 |
+
if (area.contains(e.target) || area === e.target) {
|
| 384 |
+
area.classList.remove('drag-over');
|
| 385 |
+
}
|
| 386 |
+
});
|
| 387 |
+
});
|
| 388 |
+
|
| 389 |
+
builder.addEventListener('drop', (e) => {
|
| 390 |
+
e.preventDefault();
|
| 391 |
+
const uploadAreas = builder.querySelectorAll('.upload-area');
|
| 392 |
+
uploadAreas.forEach(area => {
|
| 393 |
+
area.classList.remove('drag-over');
|
| 394 |
+
});
|
| 395 |
+
|
| 396 |
+
const type = e.dataTransfer.getData('text/plain');
|
| 397 |
+
if (type) {
|
| 398 |
+
addBlock(type);
|
| 399 |
+
}
|
| 400 |
+
});
|
| 401 |
+
|
| 402 |
+
// Click on builder to add
|
| 403 |
+
builder.addEventListener('click', (e) => {
|
| 404 |
+
if (e.target === builder || e.target === placeholder) {
|
| 405 |
+
// Show quick add menu
|
| 406 |
+
if (blocks.length === 0) {
|
| 407 |
+
addBlock('step'); // Default
|
| 408 |
+
}
|
| 409 |
+
}
|
| 410 |
+
});
|
| 411 |
+
}
|
| 412 |
+
|
| 413 |
+
// Add block to builder
|
| 414 |
+
function addBlock(type) {
|
| 415 |
+
const template = document.getElementById(`template-${type}`).cloneNode(true);
|
| 416 |
+
const id = `block-${Date.now()}`;
|
| 417 |
+
template.id = id;
|
| 418 |
+
template.style.display = 'block';
|
| 419 |
+
|
| 420 |
+
// Set step number
|
| 421 |
+
const stepNumber = template.querySelector('.step-number');
|
| 422 |
+
stepNumber.textContent = procedureCounter++;
|
| 423 |
+
|
| 424 |
+
// Handle dynamic content
|
| 425 |
+
if (type === 'material') {
|
| 426 |
+
setupMaterialBlock(template);
|
| 427 |
+
} else if (type === 'personnel') {
|
| 428 |
+
setupPersonnelBlock(template);
|
| 429 |
+
} else if (type === 'checklist') {
|
| 430 |
+
setupChecklistBlock(template);
|
| 431 |
+
} else if (type === 'image' || type === 'reference') {
|
| 432 |
+
setupUploadArea(template);
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
// Add event listeners to controls
|
| 436 |
+
template.querySelector('.remove-block').addEventListener('click', () => {
|
| 437 |
+
if (confirm('Are you sure you want to remove this block?')) {
|
| 438 |
+
template.remove();
|
| 439 |
+
updateStepNumbers();
|
| 440 |
+
}
|
| 441 |
+
});
|
| 442 |
+
|
| 443 |
+
template.querySelector('.edit-block').addEventListener('click', () => {
|
| 444 |
+
alert('Edit mode activated for this block. You can now modify the content.');
|
| 445 |
+
// Just focus the first input/textarea
|
| 446 |
+
const firstInput = template.querySelector('input, textarea');
|
| 447 |
+
if (firstInput) firstInput.focus();
|
| 448 |
+
});
|
| 449 |
+
|
| 450 |
+
// Make block draggable
|
| 451 |
+
template.setAttribute('draggable', true);
|
| 452 |
+
template.addEventListener('dragstart', (e) => {
|
| 453 |
+
e.dataTransfer.setData('text/plain', 'move');
|
| 454 |
+
e.dataTransfer.setDragImage(template, 0, 0);
|
| 455 |
+
template.classList.add('dragging');
|
| 456 |
+
});
|
| 457 |
+
|
| 458 |
+
template.addEventListener('dragend', () => {
|
| 459 |
+
template.classList.remove('dragging');
|
| 460 |
+
});
|
| 461 |
+
|
| 462 |
+
// Append to builder
|
| 463 |
+
builder.appendChild(template);
|
| 464 |
+
placeholder.style.display = 'none';
|
| 465 |
+
|
| 466 |
+
// Save state
|
| 467 |
+
blocks.push({ id, type, element: template });
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
function setupMaterialBlock(block) {
|
| 471 |
+
const list = block.querySelector('.material-list');
|
| 472 |
+
const addButton = block.querySelector('.add-material');
|
| 473 |
+
|
| 474 |
+
function addMaterialItem() {
|
| 475 |
+
const item = document.createElement('div');
|
| 476 |
+
item.className = 'flex gap-2 items-center';
|
| 477 |
+
item.innerHTML = `
|
| 478 |
+
<input type="text" class="flex-1 border border-gray-300 rounded px-2 py-1 text-sm" placeholder="Material name">
|
| 479 |
+
<input type="number" class="w-20 border border-gray-300 rounded px-2 py-1 text-sm" placeholder="Qty" value="1">
|
| 480 |
+
<select class="border border-gray-300 rounded px-2 py-1 text-sm">
|
| 481 |
+
<option>pcs</option>
|
| 482 |
+
<option>kg</option>
|
| 483 |
+
<option>liter</option>
|
| 484 |
+
<option>unit</option>
|
| 485 |
+
</select>
|
| 486 |
+
<button class="remove-material text-red-600 hover:text-red-800 text-xs"><i class="fas fa-times"></i></button>
|
| 487 |
+
`;
|
| 488 |
+
list.appendChild(item);
|
| 489 |
+
item.querySelector('.remove-material').addEventListener('click', () => {
|
| 490 |
+
item.remove();
|
| 491 |
+
});
|
| 492 |
+
}
|
| 493 |
+
|
| 494 |
+
addButton.addEventListener('click', addMaterialItem);
|
| 495 |
+
addMaterialItem(); // Add first item by default
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
function setupPersonnelBlock(block) {
|
| 499 |
+
const list = block.querySelector('.personnel-list');
|
| 500 |
+
const addButton = block.querySelector('.add-personnel');
|
| 501 |
+
|
| 502 |
+
function addPersonnelItem() {
|
| 503 |
+
const item = document.createElement('div');
|
| 504 |
+
item.className = 'flex gap-2 items-center';
|
| 505 |
+
item.innerHTML = `
|
| 506 |
+
<input type="text" class="flex-1 border border-gray-300 rounded px-2 py-1 text-sm" placeholder="Name">
|
| 507 |
+
<select class="w-32 border border-gray-300 rounded px-2 py-1 text-sm">
|
| 508 |
+
<option>Driller</option>
|
| 509 |
+
<option>Engineer</option>
|
| 510 |
+
<option>Supervisor</option>
|
| 511 |
+
<option>Assistant</option>
|
| 512 |
+
<option>Inspector</option>
|
| 513 |
+
</select>
|
| 514 |
+
<button class="remove-personnel text-red-600 hover:text-red-800 text-xs"><i class="fas fa-times"></i></button>
|
| 515 |
+
`;
|
| 516 |
+
list.appendChild(item);
|
| 517 |
+
item.querySelector('.remove-personnel').addEventListener('click', () => {
|
| 518 |
+
item.remove();
|
| 519 |
+
});
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
addButton.addEventListener('click', addPersonnelItem);
|
| 523 |
+
addPersonnelItem(); // Add first item by default
|
| 524 |
+
}
|
| 525 |
+
|
| 526 |
+
function setupChecklistBlock(block) {
|
| 527 |
+
const list = block.querySelector('.checklist-items');
|
| 528 |
+
const addButton = block.querySelector('.add-checklist');
|
| 529 |
+
|
| 530 |
+
function addChecklistItem() {
|
| 531 |
+
const item = document.createElement('div');
|
| 532 |
+
item.className = 'flex items-center gap-2';
|
| 533 |
+
item.innerHTML = `
|
| 534 |
+
<input type="checkbox" class="w-4 h-4">
|
| 535 |
+
<input type="text" class="flex-1 border border-gray-300 rounded px-2 py-1 text-sm" placeholder="Task to check">
|
| 536 |
+
<button class="remove-checklist text-red-600 hover:text-red-800 text-xs"><i class="fas fa-times"></i></button>
|
| 537 |
+
`;
|
| 538 |
+
list.appendChild(item);
|
| 539 |
+
item.querySelector('.remove-checklist').addEventListener('click', () => {
|
| 540 |
+
item.remove();
|
| 541 |
+
});
|
| 542 |
+
}
|
| 543 |
+
|
| 544 |
+
addButton.addEventListener('click', addChecklistItem);
|
| 545 |
+
addChecklistItem(); // Add first item by default
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
function setupUploadArea(block) {
|
| 549 |
+
const area = block.querySelector('.upload-area');
|
| 550 |
+
const input = area.querySelector('input[type="file"]');
|
| 551 |
+
const img = area.querySelector('img');
|
| 552 |
+
|
| 553 |
+
area.addEventListener('click', () => {
|
| 554 |
+
input.click();
|
| 555 |
+
});
|
| 556 |
+
|
| 557 |
+
input.addEventListener('change', (e) => {
|
| 558 |
+
const file = e.target.files[0];
|
| 559 |
+
if (file && img) {
|
| 560 |
+
const reader = new FileReader();
|
| 561 |
+
reader.onload = (e) => {
|
| 562 |
+
img.src = e.target.result;
|
| 563 |
+
img.classList.remove('hidden');
|
| 564 |
+
};
|
| 565 |
+
reader.readAsDataURL(file);
|
| 566 |
+
}
|
| 567 |
+
});
|
| 568 |
+
|
| 569 |
+
// Drag and drop for file
|
| 570 |
+
area.addEventListener('drop', (e) => {
|
| 571 |
+
e.preventDefault();
|
| 572 |
+
const file = e.dataTransfer.files[0];
|
| 573 |
+
if (file) {
|
| 574 |
+
input.files = e.dataTransfer.files;
|
| 575 |
+
const reader = new FileReader();
|
| 576 |
+
reader.onload = (e) => {
|
| 577 |
+
if (img) {
|
| 578 |
+
img.src = e.target.result;
|
| 579 |
+
img.classList.remove('hidden');
|
| 580 |
+
}
|
| 581 |
+
};
|
| 582 |
+
reader.readAsDataURL(file);
|
| 583 |
+
}
|
| 584 |
+
});
|
| 585 |
+
}
|
| 586 |
+
|
| 587 |
+
// Update step numbers sequentially
|
| 588 |
+
function updateStepNumbers() {
|
| 589 |
+
procedureCounter = 1;
|
| 590 |
+
document.querySelectorAll('.procedure-block').forEach(block => {
|
| 591 |
+
const num = block.querySelector('.step-number');
|
| 592 |
+
if (num) {
|
| 593 |
+
num.textContent = procedureCounter++;
|
| 594 |
+
}
|
| 595 |
+
});
|
| 596 |
+
}
|
| 597 |
+
|
| 598 |
+
// Setup global events
|
| 599 |
+
function setupEvents() {
|
| 600 |
+
// Reorder blocks via drag and drop
|
| 601 |
+
builder.addEventListener('dragover', (e) => {
|
| 602 |
+
e.preventDefault();
|
| 603 |
+
const afterElement = getDragAfterElement(builder, e.clientY);
|
| 604 |
+
const draggable = document.querySelector('.dragging');
|
| 605 |
+
if (afterElement == null) {
|
| 606 |
+
builder.appendChild(draggable);
|
| 607 |
+
} else {
|
| 608 |
+
builder.insertBefore(draggable, afterElement);
|
| 609 |
+
}
|
| 610 |
+
});
|
| 611 |
+
|
| 612 |
+
// Save procedure
|
| 613 |
+
saveBtn.addEventListener('click', () => {
|
| 614 |
+
const title = prompt('Enter procedure title:', 'New Procedure') || 'Untitled';
|
| 615 |
+
const id = 'PRC-' + Date.now().toString().substr(-6).toUpperCase();
|
| 616 |
+
const now = new Date().toISOString().replace('T', ' ').substr(0, 16);
|
| 617 |
+
|
| 618 |
+
const procedure = {
|
| 619 |
+
id,
|
| 620 |
+
title,
|
| 621 |
+
lastEdited: now,
|
| 622 |
+
status: 'Draft',
|
| 623 |
+
blocks: Array.from(document.querySelectorAll('.procedure-block')).map(block => {
|
| 624 |
+
return {
|
| 625 |
+
id: block.id,
|
| 626 |
+
type: block.querySelector('.toolbox-item')?.dataset.type || 'unknown',
|
| 627 |
+
html: block.outerHTML
|
| 628 |
+
};
|
| 629 |
+
})
|
| 630 |
+
};
|
| 631 |
+
|
| 632 |
+
// Save to "database" (localStorage)
|
| 633 |
+
let procedures = JSON.parse(localStorage.getItem('rigProcedures') || '[]');
|
| 634 |
+
procedures.push(procedure);
|
| 635 |
+
localStorage.setItem('rigProcedures', JSON.stringify(procedures));
|
| 636 |
+
|
| 637 |
+
alert(`Procedure "${title}" saved successfully!`);
|
| 638 |
+
loadProcedures();
|
| 639 |
+
});
|
| 640 |
+
|
| 641 |
+
// Print
|
| 642 |
+
printBtn.addEventListener('click', () => {
|
| 643 |
+
window.print();
|
| 644 |
+
});
|
| 645 |
+
|
| 646 |
+
// Download as Word (using HTML to DOCX approach via PDF for simplicity)
|
| 647 |
+
downloadWordBtn.addEventListener('click', () => {
|
| 648 |
+
const { jsPDF } = window.jspdf;
|
| 649 |
+
|
| 650 |
+
html2canvas(document.getElementById('procedureBuilder')).then(canvas => {
|
| 651 |
+
const imgData = canvas.toDataURL('image/png');
|
| 652 |
+
const pdf = new jsPDF();
|
| 653 |
+
const imgProps = pdf.getImageProperties(imgData);
|
| 654 |
+
const pdfWidth = pdf.internal.pageSize.getWidth();
|
| 655 |
+
const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width;
|
| 656 |
+
pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight);
|
| 657 |
+
pdf.save("rig-procedure.pdf");
|
| 658 |
+
});
|
| 659 |
+
});
|
| 660 |
+
|
| 661 |
+
// Submit for approval
|
| 662 |
+
approvalBtn.addEventListener('click', () => {
|
| 663 |
+
if (blocks.length === 0) {
|
| 664 |
+
alert('Please add at least one block before submitting.');
|
| 665 |
+
return;
|
| 666 |
+
}
|
| 667 |
+
if (confirm('Submit this procedure for approval? It will be reviewed by the safety team.')) {
|
| 668 |
+
const procedures = JSON.parse(localStorage.getItem('rigProcedures') || '[]');
|
| 669 |
+
// Update the last saved one
|
| 670 |
+
if (procedures.length > 0) {
|
| 671 |
+
procedures[procedures.length - 1].status = 'Pending';
|
| 672 |
+
localStorage.setItem('rigProcedures', JSON.stringify(procedures));
|
| 673 |
+
alert('Procedure submitted for approval!');
|
| 674 |
+
loadProcedures();
|
| 675 |
+
}
|
| 676 |
+
}
|
| 677 |
+
});
|
| 678 |
+
}
|
| 679 |
+
|
| 680 |
+
function getDragAfterElement(container, y) {
|
| 681 |
+
const draggableElements = [...container.querySelectorAll('.procedure-block:not(.dragging)')];
|
| 682 |
+
return draggableElements.reduce((closest, child) => {
|
| 683 |
+
const box = child.getBoundingClientRect();
|
| 684 |
+
const offset = y - box.top - box.height / 2;
|
| 685 |
+
if (offset < 0 && offset > closest.offset) {
|
| 686 |
+
return { offset: offset, element: child };
|
| 687 |
+
} else {
|
| 688 |
+
return closest;
|
| 689 |
+
}
|
| 690 |
+
}, { offset: Number.NEGATIVE_INFINITY }).element;
|
| 691 |
+
}
|
| 692 |
+
|
| 693 |
+
// Load procedures from localStorage
|
| 694 |
+
function loadProcedures() {
|
| 695 |
+
const tableBody = document.getElementById('procedureTableBody');
|
| 696 |
+
tableBody.innerHTML = '';
|
| 697 |
+
|
| 698 |
+
const procedures = JSON.parse(localStorage.getItem('rigProcedures') || '[]');
|
| 699 |
+
procedures.forEach(proc => {
|
| 700 |
+
const tr = document.createElement('tr');
|
| 701 |
+
tr.className = 'border-b';
|
| 702 |
+
tr.innerHTML = `
|
| 703 |
+
<td class="py-2">${proc.id}</td>
|
| 704 |
+
<td>${proc.title}</td>
|
| 705 |
+
<td>${proc.lastEdited}</td>
|
| 706 |
+
<td><span class="px-2 py-1 rounded text-xs ${
|
| 707 |
+
proc.status === 'Approved' ? 'bg-green-100 text-green-800' :
|
| 708 |
+
proc.status === 'Rejected' ? 'bg-red-100 text-red-800' :
|
| 709 |
+
'bg-yellow-100 text-yellow-800'
|
| 710 |
+
}">${proc.status}</span></td>
|
| 711 |
+
<td>
|
| 712 |
+
<button class="text-blue-600 text-sm hover:underline edit-proc" data-id="${proc.id}">Edit</button> |
|
| 713 |
+
<button class="text-gray-600 text-sm hover:underline view-proc" data-id="${proc.id}">View</button>
|
| 714 |
+
</td>
|
| 715 |
+
`;
|
| 716 |
+
tableBody.appendChild(tr);
|
| 717 |
+
});
|
| 718 |
+
|
| 719 |
+
// Add event listeners
|
| 720 |
+
document.querySelectorAll('.edit-proc').forEach(btn => {
|
| 721 |
+
btn.addEventListener('click', (e) => {
|
| 722 |
+
const id = e.target.dataset.id;
|
| 723 |
+
loadProcedure(id);
|
| 724 |
+
});
|
| 725 |
+
});
|
| 726 |
+
|
| 727 |
+
document.querySelectorAll('.view-proc').forEach(btn => {
|
| 728 |
+
btn.addEventListener('click', (e) => {
|
| 729 |
+
const id = e.target.dataset.id;
|
| 730 |
+
loadProcedure(id, true);
|
| 731 |
+
});
|
| 732 |
+
});
|
| 733 |
+
}
|
| 734 |
+
|
| 735 |
+
function loadProcedure(id, readOnly = false) {
|
| 736 |
+
const procedures = JSON.parse(localStorage.getItem('rigProcedures') || '[]');
|
| 737 |
+
const procedure = procedures.find(p => p.id === id);
|
| 738 |
+
if (!procedure) return;
|
| 739 |
+
|
| 740 |
+
// Clear current builder
|
| 741 |
+
builder.innerHTML = '';
|
| 742 |
+
blocks = [];
|
| 743 |
+
procedureCounter = 1;
|
| 744 |
+
|
| 745 |
+
// Add blocks
|
| 746 |
+
procedure.blocks.forEach(blockObj => {
|
| 747 |
+
const div = document.createElement('div');
|
| 748 |
+
div.innerHTML = blockObj.html;
|
| 749 |
+
const block = div.firstElementChild;
|
| 750 |
+
block.style.display = 'block';
|
| 751 |
+
|
| 752 |
+
// Remove events and make readonly if needed
|
| 753 |
+
if (readOnly) {
|
| 754 |
+
block.querySelectorAll('input, textarea, button').forEach(el => {
|
| 755 |
+
if (el.type !== 'checkbox') {
|
| 756 |
+
el.disabled = true;
|
| 757 |
+
}
|
| 758 |
+
if (el.classList.contains('remove-block') || el.classList.contains('edit-block')) {
|
| 759 |
+
el.style.display = 'none';
|
| 760 |
+
}
|
| 761 |
+
});
|
| 762 |
+
block.removeAttribute('draggable');
|
| 763 |
+
} else {
|
| 764 |
+
// Reattach events
|
| 765 |
+
block.querySelector('.remove-block').addEventListener('click', () => {
|
| 766 |
+
if (confirm('Remove this block?')) {
|
| 767 |
+
block.remove();
|
| 768 |
+
updateStepNumbers();
|
| 769 |
+
}
|
| 770 |
+
});
|
| 771 |
+
block.querySelector('.edit-block').addEventListener('click', () => {
|
| 772 |
+
alert('Edit mode. Modify content directly.');
|
| 773 |
+
});
|
| 774 |
+
}
|
| 775 |
+
|
| 776 |
+
builder.appendChild(block);
|
| 777 |
+
blocks.push({ id: block.id, type: blockObj.type, element: block });
|
| 778 |
+
});
|
| 779 |
+
|
| 780 |
+
placeholder.style.display = blocks.length === 0 ? 'block' : 'none';
|
| 781 |
+
updateStepNumbers();
|
| 782 |
+
}
|
| 783 |
+
|
| 784 |
+
// Start app
|
| 785 |
+
window.addEventListener('DOMContentLoaded', init);
|
| 786 |
+
</script>
|
| 787 |
+
|
| 788 |
+
<!-- Print Styling -->
|
| 789 |
+
<style media="print">
|
| 790 |
+
.toolbox, .toolbox-item, #placeholder, .edit-block, .remove-block {
|
| 791 |
+
display: none !important;
|
| 792 |
+
}
|
| 793 |
+
.procedure-block {
|
| 794 |
+
page-break-inside: avoid;
|
| 795 |
+
border: 1px dashed #ccc;
|
| 796 |
+
}
|
| 797 |
+
body {
|
| 798 |
+
background: white;
|
| 799 |
+
font-size: 11pt;
|
| 800 |
+
}
|
| 801 |
+
.upload-area img {
|
| 802 |
+
max-height: 200px;
|
| 803 |
+
}
|
| 804 |
+
</style>
|
| 805 |
+
<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-qwensite.hf.space/logo.svg" alt="qwensite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-qwensite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >QwenSite</a> - 🧬 <a href="https://enzostvs-qwensite.hf.space?remix=alterzick/rig-ops-procedure-v2" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 806 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
buatkan rig operation procedure seperti lego dimana di dalamnya terdapat inputing procedure dimana didalamnya terdapat upload gambar , waktu procedure, material yang di butuhkan , safety concern , personel dan informasi tambahan lainnya. penyusunan procedure ada juga tambahan editing untuk memastikan beberapa variable dapat di edit untuk nilai nilai tertentu , database procedure , approval review, document download ke word atau print
|