GreenMoood commited on
Commit
fa29a94
·
verified ·
1 Parent(s): 893529b

Add the following information for both add end edit forms ICE/ IF / TP/ RC/CNSS/RIB/ remove the botton to add attachement file from the table and add it to the forms, where you have to upload the RIB and a print button to print the supplier creationg form

Browse files
Files changed (1) hide show
  1. suppliers.html +158 -45
suppliers.html CHANGED
@@ -176,44 +176,59 @@
176
  <tr class="text-left border-b border-gray-700">
177
  <th class="px-4 py-3">Supplier ID</th>
178
  <th class="px-4 py-3">Name</th>
 
 
 
 
 
 
179
  <th class="px-4 py-3">Contact</th>
180
  <th class="px-4 py-3">Email</th>
181
  <th class="px-4 py-3">Phone</th>
182
  <th class="px-4 py-3">Country</th>
183
  <th class="px-4 py-3">Status</th>
184
- <th class="px-4 py-3 text-right">Actions</th>
185
  </tr>
186
  </thead>
187
  <tbody>
188
  <tr>
189
  <td class="px-4 py-3">SUP-001</td>
190
  <td class="px-4 py-3">ABC Supplies</td>
 
 
 
 
 
 
191
  <td class="px-4 py-3">John Smith</td>
192
  <td class="px-4 py-3">john@abcsupplies.com</td>
193
  <td class="px-4 py-3">+212 123 456 789</td>
194
  <td class="px-4 py-3">Morocco</td>
195
  <td class="px-4 py-3"><span class="px-2 py-1 rounded-full text-xs bg-green-900 text-green-300">Active</span></td>
196
- <td class="px-4 py-3 text-right">
197
  <button class="p-1 text-blue-400 hover:text-blue-300 edit-btn">
198
  <i data-feather="edit" class="w-4 h-4"></i>
199
  </button>
200
  <button class="p-1 text-red-400 hover:text-red-300 delete-btn">
201
  <i data-feather="trash" class="w-4 h-4"></i>
202
  </button>
203
- <button class="p-1 text-green-400 hover:text-green-300 import-btn">
204
- <i data-feather="file-text" class="w-4 h-4"></i>
205
- </button>
206
  </td>
207
  </tr>
208
  <tr>
209
  <td class="px-4 py-3">SUP-002</td>
210
  <td class="px-4 py-3">XYZ Imports</td>
 
 
 
 
 
 
211
  <td class="px-4 py-3">Sarah Johnson</td>
212
  <td class="px-4 py-3">sarah@xyzimports.com</td>
213
  <td class="px-4 py-3">+212 234 567 890</td>
214
  <td class="px-4 py-3">Morocco</td>
215
  <td class="px-4 py-3"><span class="px-2 py-1 rounded-full text-xs bg-green-900 text-green-300">Active</span></td>
216
- <td class="px-4 py-3 text-right">
217
  <button class="p-1 text-blue-400 hover:text-blue-300 edit-btn">
218
  <i data-feather="edit" class="w-4 h-4"></i>
219
  </button>
@@ -228,12 +243,18 @@
228
  <tr>
229
  <td class="px-4 py-3">SUP-003</td>
230
  <td class="px-4 py-3">Global Parts</td>
 
 
 
 
 
 
231
  <td class="px-4 py-3">Michael Brown</td>
232
  <td class="px-4 py-3">michael@globalparts.com</td>
233
  <td class="px-4 py-3">+212 345 678 901</td>
234
  <td class="px-4 py-3">France</td>
235
  <td class="px-4 py-3"><span class="px-2 py-1 rounded-full text-xs bg-green-900 text-green-300">Active</span></td>
236
- <td class="px-4 py-3 text-right">
237
  <button class="p-1 text-blue-400 hover:text-blue-300 edit-btn">
238
  <i data-feather="edit" class="w-4 h-4"></i>
239
  </button>
@@ -248,12 +269,18 @@
248
  <tr>
249
  <td class="px-4 py-3">SUP-004</td>
250
  <td class="px-4 py-3">EuroTech</td>
 
 
 
 
 
 
251
  <td class="px-4 py-3">David Wilson</td>
252
  <td class="px-4 py-3">david@eurotech.com</td>
253
  <td class="px-4 py-3">+212 456 789 012</td>
254
  <td class="px-4 py-3">Germany</td>
255
  <td class="px-4 py-3"><span class="px-2 py-1 rounded-full text-xs bg-yellow-900 text-yellow-300">Pending</span></td>
256
- <td class="px-4 py-3 text-right">
257
  <button class="p-1 text-blue-400 hover:text-blue-300 edit-btn">
258
  <i data-feather="edit" class="w-4 h-4"></i>
259
  </button>
@@ -268,12 +295,18 @@
268
  <tr>
269
  <td class="px-4 py-3">SUP-005</td>
270
  <td class="px-4 py-3">Maroc Logistics</td>
 
 
 
 
 
 
271
  <td class="px-4 py-3">Ahmed Alami</td>
272
  <td class="px-4 py-3">ahmed@maroclogistics.com</td>
273
  <td class="px-4 py-3">+212 567 890 123</td>
274
  <td class="px-4 py-3">Morocco</td>
275
  <td class="px-4 py-3"><span class="px-2 py-1 rounded-full text-xs bg-red-900 text-red-300">Inactive</span></td>
276
- <td class="px-4 py-3 text-right">
277
  <button class="p-1 text-blue-400 hover:text-blue-300 edit-btn">
278
  <i data-feather="edit" class="w-4 h-4"></i>
279
  </button>
@@ -311,6 +344,30 @@
311
  <label for="supplierId" class="block text-sm font-medium mb-1">Supplier ID</label>
312
  <input type="text" id="supplierId" class="w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-500" value="SUP-006" disabled>
313
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
314
  <div>
315
  <label for="contactPerson" class="block text-sm font-medium mb-1">Contact Person</label>
316
  <input type="text" id="contactPerson" class="w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-500">
@@ -345,16 +402,26 @@
345
  <option value="Inactive">Inactive</option>
346
  </select>
347
  </div>
 
 
 
 
348
  </div>
349
- <div class="flex justify-end space-x-3 mt-6">
350
- <button type="button" id="cancelBtn" class="px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg">
351
- Cancel
352
- </button>
353
- <button type="submit" class="px-4 py-2 bg-blue-600 hover:bg-blue-500 rounded-lg">
354
- Save Supplier
355
  </button>
 
 
 
 
 
 
 
 
356
  </div>
357
- </form>
358
  </div>
359
  </div>
360
  </div>
@@ -436,31 +503,72 @@ responsive: true,
436
  alert('Supplier saved successfully!');
437
  supplierModal.classList.add('hidden');
438
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439
 
440
- // Import PDF functionality
441
- document.querySelectorAll('.import-btn').forEach(btn => {
442
- btn.addEventListener('click', (e) => {
443
- const row = e.target.closest('tr');
444
- const supplierId = row.querySelector('td:first-child').textContent;
445
- const supplierName = row.querySelector('td:nth-child(2)').textContent;
446
-
447
- // Create file input for PDF import
448
- const fileInput = document.createElement('input');
449
- fileInput.type = 'file';
450
- fileInput.accept = '.pdf';
451
- fileInput.click();
452
-
453
- fileInput.addEventListener('change', (e) => {
454
- const file = e.target.files[0];
455
- if (file) {
456
- alert(`PDF imported successfully for ${supplierName} (${supplierId})`);
457
- // In a real app, upload the file to server and associate with supplier
458
- }
459
- });
460
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  });
462
-
463
- // Edit functionality to populate form with row data
464
  document.querySelectorAll('.edit-btn').forEach(btn => {
465
  btn.addEventListener('click', (e) => {
466
  const row = e.target.closest('tr');
@@ -468,12 +576,17 @@ responsive: true,
468
 
469
  document.getElementById('supplierId').value = cells[0].textContent;
470
  document.getElementById('supplierName').value = cells[1].textContent;
471
- document.getElementById('contactPerson').value = cells[2].textContent;
472
- document.getElementById('email').value = cells[3].textContent;
473
- document.getElementById('phone').value = cells[4].textContent;
474
- document.getElementById('country').value = cells[5].textContent;
475
-
476
- const statusText = cells[6].textContent.trim();
 
 
 
 
 
477
  document.getElementById('status').value =
478
  statusText.includes('Active') ? 'Active' :
479
  statusText.includes('Pending') ? 'Pending' : 'Inactive';
 
176
  <tr class="text-left border-b border-gray-700">
177
  <th class="px-4 py-3">Supplier ID</th>
178
  <th class="px-4 py-3">Name</th>
179
+ <th class="px-4 py-3">ICE</th>
180
+ <th class="px-4 py-3">IF</th>
181
+ <th class="px-4 py-3">TP</th>
182
+ <th class="px-4 py-3">RC</th>
183
+ <th class="px-4 py-3">CNSS</th>
184
+ <th class="px-4 py-3">RIB</th>
185
  <th class="px-4 py-3">Contact</th>
186
  <th class="px-4 py-3">Email</th>
187
  <th class="px-4 py-3">Phone</th>
188
  <th class="px-4 py-3">Country</th>
189
  <th class="px-4 py-3">Status</th>
190
+ <th class="px-4 py-3 text-right">Actions</th>
191
  </tr>
192
  </thead>
193
  <tbody>
194
  <tr>
195
  <td class="px-4 py-3">SUP-001</td>
196
  <td class="px-4 py-3">ABC Supplies</td>
197
+ <td class="px-4 py-3">123456789</td>
198
+ <td class="px-4 py-3">987654321</td>
199
+ <td class="px-4 py-3">0612345678</td>
200
+ <td class="px-4 py-3">RC12345</td>
201
+ <td class="px-4 py-3">CNSS123</td>
202
+ <td class="px-4 py-3">RIB123456789</td>
203
  <td class="px-4 py-3">John Smith</td>
204
  <td class="px-4 py-3">john@abcsupplies.com</td>
205
  <td class="px-4 py-3">+212 123 456 789</td>
206
  <td class="px-4 py-3">Morocco</td>
207
  <td class="px-4 py-3"><span class="px-2 py-1 rounded-full text-xs bg-green-900 text-green-300">Active</span></td>
208
+ <td class="px-4 py-3 text-right">
209
  <button class="p-1 text-blue-400 hover:text-blue-300 edit-btn">
210
  <i data-feather="edit" class="w-4 h-4"></i>
211
  </button>
212
  <button class="p-1 text-red-400 hover:text-red-300 delete-btn">
213
  <i data-feather="trash" class="w-4 h-4"></i>
214
  </button>
 
 
 
215
  </td>
216
  </tr>
217
  <tr>
218
  <td class="px-4 py-3">SUP-002</td>
219
  <td class="px-4 py-3">XYZ Imports</td>
220
+ <td class="px-4 py-3">987654321</td>
221
+ <td class="px-4 py-3">123456789</td>
222
+ <td class="px-4 py-3">0623456789</td>
223
+ <td class="px-4 py-3">RC54321</td>
224
+ <td class="px-4 py-3">CNSS456</td>
225
+ <td class="px-4 py-3">RIB987654321</td>
226
  <td class="px-4 py-3">Sarah Johnson</td>
227
  <td class="px-4 py-3">sarah@xyzimports.com</td>
228
  <td class="px-4 py-3">+212 234 567 890</td>
229
  <td class="px-4 py-3">Morocco</td>
230
  <td class="px-4 py-3"><span class="px-2 py-1 rounded-full text-xs bg-green-900 text-green-300">Active</span></td>
231
+ <td class="px-4 py-3 text-right">
232
  <button class="p-1 text-blue-400 hover:text-blue-300 edit-btn">
233
  <i data-feather="edit" class="w-4 h-4"></i>
234
  </button>
 
243
  <tr>
244
  <td class="px-4 py-3">SUP-003</td>
245
  <td class="px-4 py-3">Global Parts</td>
246
+ <td class="px-4 py-3">456789123</td>
247
+ <td class="px-4 py-3">789123456</td>
248
+ <td class="px-4 py-3">0634567890</td>
249
+ <td class="px-4 py-3">RC67890</td>
250
+ <td class="px-4 py-3">CNSS789</td>
251
+ <td class="px-4 py-3">RIB456789123</td>
252
  <td class="px-4 py-3">Michael Brown</td>
253
  <td class="px-4 py-3">michael@globalparts.com</td>
254
  <td class="px-4 py-3">+212 345 678 901</td>
255
  <td class="px-4 py-3">France</td>
256
  <td class="px-4 py-3"><span class="px-2 py-1 rounded-full text-xs bg-green-900 text-green-300">Active</span></td>
257
+ <td class="px-4 py-3 text-right">
258
  <button class="p-1 text-blue-400 hover:text-blue-300 edit-btn">
259
  <i data-feather="edit" class="w-4 h-4"></i>
260
  </button>
 
269
  <tr>
270
  <td class="px-4 py-3">SUP-004</td>
271
  <td class="px-4 py-3">EuroTech</td>
272
+ <td class="px-4 py-3">789123456</td>
273
+ <td class="px-4 py-3">456789123</td>
274
+ <td class="px-4 py-3">0645678901</td>
275
+ <td class="px-4 py-3">RC09876</td>
276
+ <td class="px-4 py-3">CNSS012</td>
277
+ <td class="px-4 py-3">RIB789123456</td>
278
  <td class="px-4 py-3">David Wilson</td>
279
  <td class="px-4 py-3">david@eurotech.com</td>
280
  <td class="px-4 py-3">+212 456 789 012</td>
281
  <td class="px-4 py-3">Germany</td>
282
  <td class="px-4 py-3"><span class="px-2 py-1 rounded-full text-xs bg-yellow-900 text-yellow-300">Pending</span></td>
283
+ <td class="px-4 py-3 text-right">
284
  <button class="p-1 text-blue-400 hover:text-blue-300 edit-btn">
285
  <i data-feather="edit" class="w-4 h-4"></i>
286
  </button>
 
295
  <tr>
296
  <td class="px-4 py-3">SUP-005</td>
297
  <td class="px-4 py-3">Maroc Logistics</td>
298
+ <td class="px-4 py-3">321654987</td>
299
+ <td class="px-4 py-3">654987321</td>
300
+ <td class="px-4 py-3">0656789012</td>
301
+ <td class="px-4 py-3">RC54321</td>
302
+ <td class="px-4 py-3">CNSS345</td>
303
+ <td class="px-4 py-3">RIB321654987</td>
304
  <td class="px-4 py-3">Ahmed Alami</td>
305
  <td class="px-4 py-3">ahmed@maroclogistics.com</td>
306
  <td class="px-4 py-3">+212 567 890 123</td>
307
  <td class="px-4 py-3">Morocco</td>
308
  <td class="px-4 py-3"><span class="px-2 py-1 rounded-full text-xs bg-red-900 text-red-300">Inactive</span></td>
309
+ <td class="px-4 py-3 text-right">
310
  <button class="p-1 text-blue-400 hover:text-blue-300 edit-btn">
311
  <i data-feather="edit" class="w-4 h-4"></i>
312
  </button>
 
344
  <label for="supplierId" class="block text-sm font-medium mb-1">Supplier ID</label>
345
  <input type="text" id="supplierId" class="w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-500" value="SUP-006" disabled>
346
  </div>
347
+ <div>
348
+ <label for="ice" class="block text-sm font-medium mb-1">ICE</label>
349
+ <input type="text" id="ice" class="w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-500">
350
+ </div>
351
+ <div>
352
+ <label for="if" class="block text-sm font-medium mb-1">IF</label>
353
+ <input type="text" id="if" class="w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-500">
354
+ </div>
355
+ <div>
356
+ <label for="tp" class="block text-sm font-medium mb-1">TP</label>
357
+ <input type="text" id="tp" class="w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-500">
358
+ </div>
359
+ <div>
360
+ <label for="rc" class="block text-sm font-medium mb-1">RC</label>
361
+ <input type="text" id="rc" class="w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-500">
362
+ </div>
363
+ <div>
364
+ <label for="cnss" class="block text-sm font-medium mb-1">CNSS</label>
365
+ <input type="text" id="cnss" class="w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-500">
366
+ </div>
367
+ <div>
368
+ <label for="rib" class="block text-sm font-medium mb-1">RIB</label>
369
+ <input type="text" id="rib" class="w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-500">
370
+ </div>
371
  <div>
372
  <label for="contactPerson" class="block text-sm font-medium mb-1">Contact Person</label>
373
  <input type="text" id="contactPerson" class="w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-500">
 
402
  <option value="Inactive">Inactive</option>
403
  </select>
404
  </div>
405
+ <div class="md:col-span-2">
406
+ <label for="ribFile" class="block text-sm font-medium mb-1">RIB File (PDF)</label>
407
+ <input type="file" id="ribFile" accept=".pdf" class="w-full px-3 py-2 bg-gray-700 border border-gray-600 rounded-lg focus:outline-none focus:ring-1 focus:ring-blue-500">
408
+ </div>
409
  </div>
410
+ <div class="flex justify-between mt-6">
411
+ <button type="button" id="printBtn" class="px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg flex items-center">
412
+ <i data-feather="printer" class="w-4 h-4 mr-2"></i>
413
+ Print Form
 
 
414
  </button>
415
+ <div class="space-x-3">
416
+ <button type="button" id="cancelBtn" class="px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg">
417
+ Cancel
418
+ </button>
419
+ <button type="submit" class="px-4 py-2 bg-blue-600 hover:bg-blue-500 rounded-lg">
420
+ Save Supplier
421
+ </button>
422
+ </div>
423
  </div>
424
+ </form>
425
  </div>
426
  </div>
427
  </div>
 
503
  alert('Supplier saved successfully!');
504
  supplierModal.classList.add('hidden');
505
  });
506
+ // Print functionality
507
+ document.getElementById('printBtn').addEventListener('click', () => {
508
+ const printContent = `
509
+ <div style="font-family: Arial, sans-serif; padding: 20px;">
510
+ <h1 style="text-align: center; margin-bottom: 30px;">Supplier Registration Form</h1>
511
+ <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px;">
512
+ <div><strong>Supplier ID:</strong> <span id="printSupplierId"></span></div>
513
+ <div><strong>Supplier Name:</strong> <span id="printSupplierName"></span></div>
514
+ <div><strong>ICE:</strong> <span id="printIce"></span></div>
515
+ <div><strong>IF:</strong> <span id="printIf"></span></div>
516
+ <div><strong>TP:</strong> <span id="printTp"></span></div>
517
+ <div><strong>RC:</strong> <span id="printRc"></span></div>
518
+ <div><strong>CNSS:</strong> <span id="printCnss"></span></div>
519
+ <div><strong>RIB:</strong> <span id="printRib"></span></div>
520
+ <div><strong>Contact Person:</strong> <span id="printContactPerson"></span></div>
521
+ <div><strong>Email:</strong> <span id="printEmail"></span></div>
522
+ <div><strong>Phone:</strong> <span id="printPhone"></span></div>
523
+ <div><strong>Country:</strong> <span id="printCountry"></span></div>
524
+ <div><strong>Address:</strong> <span id="printAddress"></span></div>
525
+ <div><strong>Status:</strong> <span id="printStatus"></span></div>
526
+ </div>
527
+ <div style="margin-top: 30px; text-align: right;">
528
+ <p>_________________________</p>
529
+ <p>Signature</p>
530
+ </div>
531
+ </div>
532
+ `;
533
 
534
+ const printWindow = window.open('', '', 'width=800,height=600');
535
+ printWindow.document.open();
536
+ printWindow.document.write(`
537
+ <html>
538
+ <head>
539
+ <title>Supplier Registration Form</title>
540
+ <style>
541
+ body { font-family: Arial, sans-serif; }
542
+ @media print {
543
+ @page { margin: 0; }
544
+ body { margin: 1.6cm; }
545
+ }
546
+ </style>
547
+ </head>
548
+ <body onload="window.print();window.close();">
549
+ ${printContent}
550
+ <script>
551
+ document.getElementById('printSupplierId').textContent = document.getElementById('supplierId').value;
552
+ document.getElementById('printSupplierName').textContent = document.getElementById('supplierName').value;
553
+ document.getElementById('printIce').textContent = document.getElementById('ice').value;
554
+ document.getElementById('printIf').textContent = document.getElementById('if').value;
555
+ document.getElementById('printTp').textContent = document.getElementById('tp').value;
556
+ document.getElementById('printRc').textContent = document.getElementById('rc').value;
557
+ document.getElementById('printCnss').textContent = document.getElementById('cnss').value;
558
+ document.getElementById('printRib').textContent = document.getElementById('rib').value;
559
+ document.getElementById('printContactPerson').textContent = document.getElementById('contactPerson').value;
560
+ document.getElementById('printEmail').textContent = document.getElementById('email').value;
561
+ document.getElementById('printPhone').textContent = document.getElementById('phone').value;
562
+ document.getElementById('printCountry').textContent = document.getElementById('country').value;
563
+ document.getElementById('printAddress').textContent = document.getElementById('address').value;
564
+ document.getElementById('printStatus').textContent = document.getElementById('status').value;
565
+ </script>
566
+ </body>
567
+ </html>
568
+ `);
569
+ printWindow.document.close();
570
  });
571
+ // Edit functionality to populate form with row data
 
572
  document.querySelectorAll('.edit-btn').forEach(btn => {
573
  btn.addEventListener('click', (e) => {
574
  const row = e.target.closest('tr');
 
576
 
577
  document.getElementById('supplierId').value = cells[0].textContent;
578
  document.getElementById('supplierName').value = cells[1].textContent;
579
+ document.getElementById('ice').value = cells[2].textContent;
580
+ document.getElementById('if').value = cells[3].textContent;
581
+ document.getElementById('tp').value = cells[4].textContent;
582
+ document.getElementById('rc').value = cells[5].textContent;
583
+ document.getElementById('cnss').value = cells[6].textContent;
584
+ document.getElementById('rib').value = cells[7].textContent;
585
+ document.getElementById('contactPerson').value = cells[8].textContent;
586
+ document.getElementById('email').value = cells[9].textContent;
587
+ document.getElementById('phone').value = cells[10].textContent;
588
+ document.getElementById('country').value = cells[11].textContent;
589
+ const statusText = cells[6].textContent.trim();
590
  document.getElementById('status').value =
591
  statusText.includes('Active') ? 'Active' :
592
  statusText.includes('Pending') ? 'Pending' : 'Inactive';