File size: 57,994 Bytes
f060756 7f38256 f060756 7f38256 f060756 7f38256 f060756 3a6ce34 f060756 3a6ce34 f060756 3a6ce34 f060756 3a6ce34 f060756 7f38256 f060756 3a6ce34 f060756 3a6ce34 7f38256 f060756 7f38256 f060756 7f38256 f060756 7f38256 3a6ce34 7f38256 f060756 7f38256 f060756 7f38256 f060756 3a6ce34 f060756 3a6ce34 f060756 |
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 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 |
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pedidos de Compra</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style>
.offcanvas {
transition: transform 0.3s ease-in-out;
}
.offcanvas-right {
transform: translateX(100%);
}
.offcanvas-right.show {
transform: translateX(0);
}
.backdrop {
transition: opacity 0.3s ease-in-out;
}
.backdrop.show {
opacity: 1;
pointer-events: auto;
}
.status-em-elaboracao {
background-color: #4b5563;
color: #d1d5db;
}
.status-aguardando-aprovacao {
background-color: #f59e0b;
color: #1e293b;
}
.status-aprovado {
background-color: #10b981;
color: #1e293b;
}
.status-enviado {
background-color: #3b82f6;
color: #ffffff;
}
.status-recebido-parcial {
background-color: #8b5cf6;
color: #ffffff;
}
.status-recebido-total {
background-color: #22c55e;
color: #1e293b;
}
.status-cancelado {
background-color: #ef4444;
color: #ffffff;
}
@media (max-width: 768px) {
.offcanvas {
width: 100% !important;
}
}
#itemForm {
display: none;
}
#itemForm.show {
display: block;
}
</style>
</head>
<body class="bg-gray-900 text-gray-200 min-h-screen">
<div class="container mx-auto px-4 py-6">
<!-- Header -->
<div class="flex flex-col md:flex-row justify-between items-start md:items-center mb-8 gap-4">
<h1 class="text-3xl font-bold text-blue-400">Pedidos de Compra</h1>
<div class="flex flex-col sm:flex-row gap-3 w-full md:w-auto">
<button id="newOrderBtn" class="px-4 py-2 bg-blue-600 hover:bg-blue-500 rounded-lg flex items-center gap-2">
<i class="fas fa-plus"></i> Novo Pedido de Compra
</button>
</div>
</div>
<!-- Filters (always visible) -->
<div id="filters" class="bg-gray-800 p-4 rounded-lg mb-6">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
<div>
<label class="block text-sm font-medium mb-1">Fornecedor</label>
<select class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
<option>Todos</option>
<option>Fornecedor A</option>
<option>Fornecedor B</option>
<option>Fornecedor C</option>
</select>
</div>
<div>
<label class="block text-sm font-medium mb-1">Status</label>
<select class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
<option>Todos</option>
<option>Em Elaboração</option>
<option>Aguardando Aprovação</option>
<option>Aprovado</option>
<option>Enviado</option>
<option>Recebido Parcial</option>
<option>Recebido Total</option>
<option>Cancelado</option>
</select>
</div>
<div>
<label class="block text-sm font-medium mb-1">Responsável</label>
<select class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
<option>Todos</option>
<option>João Silva</option>
<option>Maria Souza</option>
<option>Carlos Oliveira</option>
</select>
</div>
<div>
<label class="block text-sm font-medium mb-1">Período</label>
<input type="date" class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
</div>
</div>
<div class="flex justify-end mt-4 gap-2">
<button class="px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg">Limpar</button>
<button class="px-4 py-2 bg-blue-600 hover:bg-blue-500 rounded-lg">Aplicar</button>
</div>
</div>
<!-- Orders Table -->
<div class="bg-gray-800 rounded-lg overflow-hidden shadow-lg">
<div class="overflow-x-auto">
<table class="w-full">
<thead class="bg-gray-700">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">Nº Pedido</th>
<th class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">Fornecedor</th>
<th class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">Responsável</th>
<th class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">Emissão</th>
<th class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">Previsão Entrega</th>
<th class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">Status</th>
<th class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider">Valor Total</th>
<th class="px-6 py-3 text-right text-xs font-medium uppercase tracking-wider">Ações</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-700">
<tr class="hover:bg-gray-700/50">
<td class="px-6 py-4 whitespace-nowrap">PC-2023-001</td>
<td class="px-6 py-4 whitespace-nowrap">Fornecedor A</td>
<td class="px-6 py-4 whitespace-nowrap">João Silva</td>
<td class="px-6 py-4 whitespace-nowrap">10/05/2023</td>
<td class="px-6 py-4 whitespace-nowrap">25/05/2023</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 py-1 rounded-full text-xs status-recebido-total">Recebido Total</span>
</td>
<td class="px-6 py-4 whitespace-nowrap">R$ 5.245,00</td>
<td class="px-6 py-4 whitespace-nowrap text-right">
<div class="flex justify-end gap-2">
<button onclick="viewOrder('PC-2023-001')" class="p-1 text-blue-400 hover:text-blue-300">
<i class="fas fa-eye"></i>
</button>
<button class="p-1 text-yellow-400 hover:text-yellow-300">
<i class="fas fa-print"></i>
</button>
</div>
</td>
</tr>
<tr class="hover:bg-gray-700/50">
<td class="px-6 py-4 whitespace-nowrap">PC-2023-002</td>
<td class="px-6 py-4 whitespace-nowrap">Fornecedor B</td>
<td class="px-6 py-4 whitespace-nowrap">Maria Souza</td>
<td class="px-6 py-4 whitespace-nowrap">15/05/2023</td>
<td class="px-6 py-4 whitespace-nowrap">30/05/2023</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 py-1 rounded-full text-xs status-enviado">Enviado</span>
</td>
<td class="px-6 py-4 whitespace-nowrap">R$ 3.780,50</td>
<td class="px-6 py-4 whitespace-nowrap text-right">
<div class="flex justify-end gap-2">
<button onclick="viewOrder('PC-2023-002')" class="p-1 text-blue-400 hover:text-blue-300">
<i class="fas fa-eye"></i>
</button>
<button class="p-1 text-yellow-400 hover:text-yellow-300">
<i class="fas fa-print"></i>
</button>
</div>
</td>
</tr>
<tr class="hover:bg-gray-700/50">
<td class="px-6 py-4 whitespace-nowrap">PC-2023-003</td>
<td class="px-6 py-4 whitespace-nowrap">Fornecedor C</td>
<td class="px-6 py-4 whitespace-nowrap">Carlos Oliveira</td>
<td class="px-6 py-4 whitespace-nowrap">18/05/2023</td>
<td class="px-6 py-4 whitespace-nowrap">05/06/2023</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 py-1 rounded-full text-xs status-aguardando-aprovacao">Aguardando Aprovação</span>
</td>
<td class="px-6 py-4 whitespace-nowrap">R$ 12.450,00</td>
<td class="px-6 py-4 whitespace-nowrap text-right">
<div class="flex justify-end gap-2">
<button onclick="viewOrder('PC-2023-003')" class="p-1 text-blue-400 hover:text-blue-300">
<i class="fas fa-eye"></i>
</button>
<button class="p-1 text-yellow-400 hover:text-yellow-300">
<i class="fas fa-print"></i>
</button>
</div>
</td>
</tr>
<tr class="hover:bg-gray-700/50">
<td class="px-6 py-4 whitespace-nowrap">PC-2023-004</td>
<td class="px-6 py-4 whitespace-nowrap">Fornecedor A</td>
<td class="px-6 py-4 whitespace-nowrap">João Silva</td>
<td class="px-6 py-4 whitespace-nowrap">20/05/2023</td>
<td class="px-6 py-4 whitespace-nowrap">10/06/2023</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 py-1 rounded-full text-xs status-em-elaboracao">Em Elaboração</span>
</td>
<td class="px-6 py-4 whitespace-nowrap">R$ 7.890,25</td>
<td class="px-6 py-4 whitespace-nowrap text-right">
<div class="flex justify-end gap-2">
<button onclick="viewOrder('PC-2023-004')" class="p-1 text-blue-400 hover:text-blue-300">
<i class="fas fa-eye"></i>
</button>
<button class="p-1 text-green-400 hover:text-green-300">
<i class="fas fa-edit"></i>
</button>
<button onclick="cancelOrder('PC-2023-004')" class="p-1 text-red-400 hover:text-red-300">
<i class="fas fa-times"></i>
</button>
<button class="p-1 text-yellow-400 hover:text-yellow-300">
<i class="fas fa-print"></i>
</button>
</div>
</td>
</tr>
<tr class="hover:bg-gray-700/50">
<td class="px-6 py-4 whitespace-nowrap">PC-2023-005</td>
<td class="px-6 py-4 whitespace-nowrap">Fornecedor B</td>
<td class="px-6 py-4 whitespace-nowrap">Maria Souza</td>
<td class="px-6 py-4 whitespace-nowrap">22/05/2023</td>
<td class="px-6 py-4 whitespace-nowrap">15/06/2023</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 py-1 rounded-full text-xs status-recebido-parcial">Recebido Parcial</span>
</td>
<td class="px-6 py-4 whitespace-nowrap">R$ 9.120,75</td>
<td class="px-6 py-4 whitespace-nowrap text-right">
<div class="flex justify-end gap-2">
<button onclick="viewOrder('PC-2023-005')" class="p-1 text-blue-400 hover:text-blue-300">
<i class="fas fa-eye"></i>
</button>
<button onclick="registerReceipt('PC-2023-005')" class="p-1 text-purple-400 hover:text-purple-300">
<i class="fas fa-truck-loading"></i>
</button>
<button class="p-1 text-yellow-400 hover:text-yellow-300">
<i class="fas fa-print"></i>
</button>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="px-6 py-4 bg-gray-700 flex items-center justify-between">
<div class="text-sm text-gray-400">
Mostrando <span class="font-medium">1</span> a <span class="font-medium">5</span> de <span class="font-medium">15</span> resultados
</div>
<div class="flex gap-1">
<button class="px-3 py-1 bg-gray-600 rounded-md hover:bg-gray-500">
<i class="fas fa-chevron-left"></i>
</button>
<button class="px-3 py-1 bg-blue-600 rounded-md">1</button>
<button class="px-3 py-1 bg-gray-600 rounded-md hover:bg-gray-500">2</button>
<button class="px-3 py-1 bg-gray-600 rounded-md hover:bg-gray-500">3</button>
<button class="px-3 py-1 bg-gray-600 rounded-md hover:bg-gray-500">
<i class="fas fa-chevron-right"></i>
</button>
</div>
</div>
</div>
</div>
<!-- Order Detail Modal -->
<div id="orderModal" class="fixed inset-0 z-50 hidden overflow-y-auto">
<div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
<div class="absolute inset-0 bg-gray-900 opacity-75"></div>
</div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span>
<div class="inline-block align-bottom bg-gray-800 rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-6xl sm:w-full">
<div class="bg-gray-800 px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div class="flex justify-between items-start">
<h3 class="text-2xl font-bold text-blue-400" id="modalOrderNumber">Pedido PC-2023-001</h3>
<button onclick="closeModal()" class="text-gray-400 hover:text-gray-300">
<i class="fas fa-times"></i>
</button>
</div>
<!-- Order Info -->
<div class="mt-6 grid grid-cols-1 md:grid-cols-3 gap-4">
<div class="bg-gray-700 p-4 rounded-lg">
<h4 class="font-medium text-blue-300 mb-2">Fornecedor</h4>
<p id="modalSupplier">Fornecedor A</p>
<p id="modalSupplierContact">[email protected]</p>
<p id="modalSupplierPhone">(11) 9999-9999</p>
</div>
<div class="bg-gray-700 p-4 rounded-lg">
<h4 class="font-medium text-blue-300 mb-2">Responsável</h4>
<p id="modalResponsible">João Silva</p>
<p id="modalDepartment">Compras</p>
</div>
<div class="bg-gray-700 p-4 rounded-lg">
<h4 class="font-medium text-blue-300 mb-2">Datas</h4>
<div class="grid grid-cols-2 gap-2">
<div>
<p class="text-sm text-gray-400">Emissão:</p>
<p id="modalEmissionDate">10/05/2023</p>
</div>
<div>
<p class="text-sm text-gray-400">Previsão Entrega:</p>
<p id="modalDeliveryDate">25/05/2023</p>
</div>
<div>
<p class="text-sm text-gray-400">Pagamento:</p>
<p id="modalPayment">30 dias</p>
</div>
<div>
<p class="text-sm text-gray-400">Status:</p>
<p id="modalStatus"><span class="px-2 py-1 rounded-full text-xs status-recebido-total">Recebido Total</span></p>
</div>
</div>
</div>
</div>
<!-- Order Items -->
<div class="mt-6">
<div class="flex justify-between items-center mb-4">
<h4 class="font-medium text-lg">Itens do Pedido</h4>
<button id="addItemBtn" class="px-3 py-1 bg-blue-600 hover:bg-blue-500 rounded-md text-sm">
<i class="fas fa-plus mr-1"></i> Adicionar Item
</button>
</div>
<!-- Item Form (hidden by default) -->
<div id="itemForm" class="bg-gray-700 p-4 rounded-lg mb-4">
<div class="grid grid-cols-2 gap-4 mb-4">
<div>
<label class="block text-sm font-medium mb-1">Produto *</label>
<select class="w-full bg-gray-600 border border-gray-500 rounded-md px-3 py-2 text-sm">
<option>Selecione um produto</option>
<option>Notebook Dell XPS 15</option>
<option>Monitor 27" 4K</option>
<option>Teclado Mecânico</option>
</select>
</div>
<div>
<label class="block text-sm font-medium mb-1">Quantidade *</label>
<input type="number" min="1" value="1" class="w-full bg-gray-600 border border-gray-500 rounded-md px-3 py-2 text-sm">
</div>
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium mb-1">Valor Unitário *</label>
<input type="text" placeholder="R$ 0,00" class="w-full bg-gray-600 border border-gray-500 rounded-md px-3 py-2 text-sm">
</div>
<div>
<label class="block text-sm font-medium mb-1">Valor Total</label>
<input type="text" placeholder="R$ 0,00" readonly class="w-full bg-gray-600 border border-gray-500 rounded-md px-3 py-2 text-sm">
</div>
</div>
<div class="flex justify-end mt-4 gap-2">
<button type="button" onclick="hideItemForm()" class="px-3 py-1 bg-gray-600 hover:bg-gray-500 rounded-md text-sm">
Cancelar
</button>
<button type="button" class="px-3 py-1 bg-green-600 hover:bg-green-500 rounded-md text-sm">
<i class="fas fa-save mr-1"></i> Salvar
</button>
</div>
</div>
<div class="overflow-x-auto">
<table class="w-full">
<thead class="bg-gray-700">
<tr>
<th class="px-4 py-2 text-left">Produto</th>
<th class="px-4 py-2 text-left">Categoria</th>
<th class="px-4 py-2 text-left">Quantidade</th>
<th class="px-4 py-2 text-left">Unitário</th>
<th class="px-4 py-2 text-left">Total</th>
<th class="px-4 py-2 text-left">Recebido</th>
<th class="px-4 py-2 text-left">Status</th>
<th class="px-4 py-2 text-right">Ações</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-700">
<tr>
<td class="px-4 py-3">Notebook Dell XPS 15</td>
<td class="px-4 py-3">Informática</td>
<td class="px-4 py-3">2</td>
<td class="px-4 py-3">R$ 4.500,00</td>
<td class="px-4 py-3">R$ 9.000,00</td>
<td class="px-4 py-3">2</td>
<td class="px-4 py-3">
<span class="px-2 py-1 rounded-full text-xs bg-green-600 text-white">Recebido</span>
</td>
<td class="px-4 py-3 text-right">
<div class="flex justify-end gap-1">
<button onclick="editItem('Notebook Dell XPS 15', 2, 4500)" class="p-1 text-blue-400 hover:text-blue-300">
<i class="fas fa-edit"></i>
</button>
<button onclick="deleteItem('Notebook Dell XPS 15')" class="p-1 text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</td>
</tr>
<tr>
<td class="px-4 py-3">Monitor 27" 4K</td>
<td class="px-4 py-3">Informática</td>
<td class="px-4 py-3">5</td>
<td class="px-4 py-3">R$ 1.250,00</td>
<td class="px-4 py-3">R$ 6.250,00</td>
<td class="px-4 py-3">5</td>
<td class="px-4 py-3">
<span class="px-2 py-1 rounded-full text-xs bg-green-600 text-white">Recebido</span>
</td>
<td class="px-4 py-3 text-right">
<div class="flex justify-end gap-1">
<button onclick="editItem('Monitor 27\" 4K', 5, 1250)" class="p-1 text-blue-400 hover:text-blue-300">
<i class="fas fa-edit"></i>
</button>
<button onclick="deleteItem('Monitor 27\" 4K')" class="p-1 text-red-400 hover:text-red-300">
<i class="fas fa-trash"></i>
</button>
</div>
</td>
</tr>
</tbody>
<tfoot class="bg-gray-700 font-medium">
<tr>
<td colspan="3" class="px-4 py-3 text-right">Total:</td>
<td colspan="5" class="px-4 py-3">R$ 15.250,00</td>
</tr>
</tfoot>
</table>
</div>
</div>
<!-- Order Notes -->
<div class="mt-6">
<h4 class="font-medium text-lg mb-2">Observações</h4>
<div class="bg-gray-700 p-4 rounded-lg">
<p id="modalNotes">Entregar na recepção do prédio A, das 8h às 17h. Favor embalar com cuidado os equipamentos eletrônicos.</p>
</div>
</div>
<!-- Order History -->
<div class="mt-6">
<div class="flex justify-between items-center mb-2">
<h4 class="font-medium text-lg">Histórico</h4>
<button onclick="showAllHistory()" class="text-sm text-blue-400 hover:text-blue-300">
Ver todos <i class="fas fa-chevron-down ml-1"></i>
</button>
</div>
<div class="space-y-4" id="historyItems">
<div class="flex items-start">
<div class="flex-shrink-0 bg-blue-500 rounded-full p-2">
<i class="fas fa-check text-white"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium">Pedido recebido totalmente</p>
<p class="text-sm text-gray-400">25/05/2023 14:30 - Por João Silva</p>
</div>
</div>
<div class="flex items-start">
<div class="flex-shrink-0 bg-purple-500 rounded-full p-2">
<i class="fas fa-truck text-white"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium">Pedido enviado pelo fornecedor</p>
<p class="text-sm text-gray-400">20/05/2023 09:15 - Por Fornecedor A</p>
</div>
</div>
<div class="flex items-start">
<div class="flex-shrink-0 bg-green-500 rounded-full p-2">
<i class="fas fa-thumbs-up text-white"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium">Pedido aprovado</p>
<p class="text-sm text-gray-400">12/05/2023 16:45 - Por Maria Souza (Gerente)</p>
</div>
</div>
<div class="flex items-start">
<div class="flex-shrink-0 bg-yellow-500 rounded-full p-2">
<i class="fas fa-paper-plane text-white"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium">Pedido enviado para aprovação</p>
<p class="text-sm text-gray-400">10/05/2023 17:30 - Por João Silva</p>
</div>
</div>
<div class="flex items-start">
<div class="flex-shrink-0 bg-gray-500 rounded-full p-2">
<i class="fas fa-file-alt text-white"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium">Pedido criado</p>
<p class="text-sm text-gray-400">10/05/2023 14:00 - Por João Silva</p>
</div>
</div>
</div>
</div>
</div>
<div class="bg-gray-700 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
<button id="sendApprovalBtn" type="button" onclick="confirmSendForApproval()" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-yellow-600 text-base font-medium text-white hover:bg-yellow-500 sm:ml-3 sm:w-auto sm:text-sm">
<i class="fas fa-paper-plane mr-2"></i> Enviar para Aprovação
</button>
<button id="registerReceiptBtn" type="button" class="mt-3 w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-purple-600 text-base font-medium text-white hover:bg-purple-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
<i class="fas fa-truck-loading mr-2"></i> Registrar Recebimento
</button>
<button onclick="cancelOrder('PC-2023-001')" type="button" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-600 shadow-sm px-4 py-2 bg-gray-800 text-base font-medium text-white hover:bg-gray-700 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
<i class="fas fa-times mr-2"></i> Cancelar Pedido
</button>
<button onclick="closeModal()" type="button" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-600 shadow-sm px-4 py-2 bg-gray-800 text-base font-medium text-white hover:bg-gray-700 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
Fechar
</button>
</div>
</div>
</div>
</div>
<!-- Edit Item Modal -->
<div id="editItemModal" class="fixed inset-0 z-50 hidden overflow-y-auto">
<div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
<div class="absolute inset-0 bg-gray-900 opacity-75"></div>
</div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span>
<div class="inline-block align-bottom bg-gray-800 rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">
<div class="bg-gray-800 px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div class="flex justify-between items-start">
<h3 class="text-xl font-bold text-blue-400">Editar Item</h3>
<button onclick="closeEditItemModal()" class="text-gray-400 hover:text-gray-300">
<i class="fas fa-times"></i>
</button>
</div>
<div class="mt-6">
<div class="grid grid-cols-1 gap-4">
<div>
<label class="block text-sm font-medium mb-1">Produto</label>
<input type="text" id="editProductName" readonly class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium mb-1">Quantidade *</label>
<input type="number" id="editQuantity" min="1" class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
</div>
<div>
<label class="block text-sm font-medium mb-1">Valor Unitário *</label>
<input type="text" id="editUnitPrice" placeholder="R$ 0,00" class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
</div>
</div>
<div>
<label class="block text-sm font-medium mb-1">Valor Total</label>
<input type="text" id="editTotalPrice" placeholder="R$ 0,00" readonly class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
</div>
</div>
</div>
</div>
<div class="bg-gray-700 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
<button type="button" onclick="saveItemChanges()" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-green-600 text-base font-medium text-white hover:bg-green-500 sm:ml-3 sm:w-auto sm:text-sm">
<i class="fas fa-save mr-2"></i> Salvar Alterações
</button>
<button type="button" onclick="closeEditItemModal()" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-600 shadow-sm px-4 py-2 bg-gray-800 text-base font-medium text-white hover:bg-gray-700 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
Cancelar
</button>
</div>
</div>
</div>
</div>
<!-- New Order Offcanvas -->
<div id="backdrop" class="fixed inset-0 bg-black bg-opacity-50 z-40 backdrop opacity-0 pointer-events-none transition-opacity duration-300"></div>
<div id="newOrderOffcanvas" class="fixed top-0 right-0 h-full w-1/3 bg-gray-800 shadow-xl z-50 offcanvas offcanvas-right overflow-y-auto">
<div class="p-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-2xl font-bold text-blue-400">Novo Pedido de Compra</h2>
<button onclick="closeOffcanvas()" class="text-gray-400 hover:text-gray-300">
<i class="fas fa-times"></i>
</button>
</div>
<form>
<div class="space-y-4">
<div>
<label class="block text-sm font-medium mb-1">Fornecedor *</label>
<select class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
<option>Selecione um fornecedor</option>
<option>Fornecedor A</option>
<option>Fornecedor B</option>
<option>Fornecedor C</option>
</select>
</div>
<div>
<label class="block text-sm font-medium mb-1">Responsável *</label>
<select class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
<option>Selecione um responsável</option>
<option>João Silva</option>
<option>Maria Souza</option>
<option>Carlos Oliveira</option>
</select>
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium mb-1">Data de Emissão *</label>
<input type="date" class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
</div>
<div>
<label class="block text-sm font-medium mb-1">Previsão de Entrega *</label>
<input type="date" class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
</div>
</div>
<div>
<label class="block text-sm font-medium mb-1">Condição de Pagamento *</label>
<select class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
<option>À vista</option>
<option>7 dias</option>
<option>15 dias</option>
<option>30 dias</option>
<option>60 dias</option>
</select>
</div>
<div>
<label class="block text-sm font-medium mb-1">Observações</label>
<textarea rows="3" class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2"></textarea>
</div>
<div class="pt-4 border-t border-gray-700">
<h3 class="text-lg font-medium mb-4">Itens do Pedido</h3>
<div class="space-y-4">
<div class="bg-gray-700 p-4 rounded-lg">
<div class="grid grid-cols-2 gap-4 mb-4">
<div>
<label class="block text-sm font-medium mb-1">Produto *</label>
<select class="w-full bg-gray-600 border border-gray-500 rounded-md px-3 py-2 text-sm">
<option>Selecione um produto</option>
<option>Notebook Dell XPS 15</option>
<option>Monitor 27" 4K</option>
<option>Teclado Mecânico</option>
<option>Mouse Sem Fio</option>
</select>
</div>
<div>
<label class="block text-sm font-medium mb-1">Quantidade *</label>
<input type="number" min="1" value="1" class="w-full bg-gray-600 border border-gray-500 rounded-md px-3 py-2 text-sm">
</div>
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium mb-1">Valor Unitário *</label>
<input type="text" placeholder="R$ 0,00" class="w-full bg-gray-600 border border-gray-500 rounded-md px-3 py-2 text-sm">
</div>
<div>
<label class="block text-sm font-medium mb-1">Valor Total</label>
<input type="text" placeholder="R$ 0,00" readonly class="w-full bg-gray-600 border border-gray-500 rounded-md px-3 py-2 text-sm">
</div>
</div>
<div class="flex justify-end mt-4">
<button type="button" class="px-3 py-1 bg-red-600 hover:bg-red-500 rounded-md text-sm">
<i class="fas fa-trash mr-1"></i> Remover
</button>
</div>
</div>
<button type="button" class="w-full px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg flex items-center justify-center gap-2">
<i class="fas fa-plus"></i> Adicionar Item
</button>
</div>
</div>
<div class="flex justify-end gap-3 pt-6">
<button type="button" onclick="closeOffcanvas()" class="px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg">
Cancelar
</button>
<button type="button" class="px-4 py-2 bg-blue-600 hover:bg-blue-500 rounded-lg">
<i class="fas fa-save mr-2"></i> Salvar Pedido
</button>
</div>
</div>
</form>
</div>
</div>
<script>
// Toggle item form
document.getElementById('addItemBtn').addEventListener('click', function() {
document.getElementById('itemForm').classList.add('show');
});
function hideItemForm() {
document.getElementById('itemForm').classList.remove('show');
}
// Open new order offcanvas
document.getElementById('newOrderBtn').addEventListener('click', function() {
document.getElementById('backdrop').classList.add('show');
document.getElementById('newOrderOffcanvas').classList.add('show');
});
// Close offcanvas
function closeOffcanvas() {
document.getElementById('backdrop').classList.remove('show');
document.getElementById('newOrderOffcanvas').classList.remove('show');
}
// Close modal
function closeModal() {
document.getElementById('orderModal').classList.add('hidden');
}
// View order modal
function viewOrder(orderNumber) {
// In a real app, we would fetch order details based on orderNumber
document.getElementById('modalOrderNumber').textContent = `Pedido ${orderNumber}`;
document.getElementById('orderModal').classList.remove('hidden');
// Update buttons based on status
const status = document.getElementById('modalStatus').textContent.trim();
const sendApprovalBtn = document.getElementById('sendApprovalBtn');
const registerReceiptBtn = document.getElementById('registerReceiptBtn');
sendApprovalBtn.classList.toggle('hidden', status !== 'Em Elaboração');
registerReceiptBtn.classList.toggle('hidden', status === 'Em Elaboração' || status === 'Cancelado');
}
// Show all history items
function showAllHistory() {
const historyItems = document.getElementById('historyItems');
// In a real app, we would fetch all history items here
Swal.fire({
title: 'Histórico Completo',
html: `
<div class="text-left space-y-4 max-h-96 overflow-y-auto">
<div class="flex items-start">
<div class="flex-shrink-0 bg-blue-500 rounded-full p-2">
<i class="fas fa-check text-white"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium">Pedido recebido totalmente</p>
<p class="text-sm text-gray-400">25/05/2023 14:30 - Por João Silva</p>
</div>
</div>
<div class="flex items-start">
<div class="flex-shrink-0 bg-purple-500 rounded-full p-2">
<i class="fas fa-truck text-white"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium">Pedido enviado pelo fornecedor</p>
<p class="text-sm text-gray-400">20/05/2023 09:15 - Por Fornecedor A</p>
</div>
</div>
<div class="flex items-start">
<div class="flex-shrink-0 bg-green-500 rounded-full p-2">
<i class="fas fa-thumbs-up text-white"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium">Pedido aprovado</p>
<p class="text-sm text-gray-400">12/05/2023 16:45 - Por Maria Souza (Gerente)</p>
</div>
</div>
<div class="flex items-start">
<div class="flex-shrink-0 bg-yellow-500 rounded-full p-2">
<i class="fas fa-p paper-plane text-white"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium">Pedido enviado para aprovação</p>
<p class="text-sm text-gray-400">10/05/2023 17:30 - Por João Silva</p>
</div>
</div>
<div class="flex items-start">
<div class="flex-shrink-0 bg-gray-500 rounded-full p-2">
<i class="fas fa-file-alt text-white"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium">Pedido criado</p>
<p class="text-sm text-gray-400">10/05/2023 14:00 - Por João Silva</p>
</div>
</div>
<div class="flex items-start">
<div class="flex-shrink-0 bg-blue-400 rounded-full p-2">
<i class="fas fa-comment text-white"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium">Observação adicionada</p>
<p class="text-sm text-gray-400">10/05/2023 14:05 - Por João Silva</p>
<p class="text-sm italic">"Entregar na recepção do prédio A"</p>
</div>
</div>
</div>
`,
background: '#1f2937',
color: '#f3f4f6',
confirmButtonColor: '#3b82f6',
width: '600px'
});
}
// Confirm send for approval
function confirmSendForApproval() {
Swal.fire({
title: 'Enviar para Aprovação',
text: 'Tem certeza que deseja enviar este pedido para aprovação? Esta ação não pode ser desfeita.',
icon: 'question',
showCancelButton: true,
confirmButtonColor: '#3b82f6',
cancelButtonColor: '#6b7280',
confirmButtonText: 'Sim, enviar!',
cancelButtonText: 'Cancelar',
background: '#1f2937',
color: '#f3f4f6'
}).then((result) => {
if (result.isConfirmed) {
Swal.fire({
title: 'Enviado!',
text: 'O pedido foi enviado para aprovação com sucesso.',
icon: 'success',
background: '#1f2937',
color: '#f3f4f6'
});
}
});
}
// Cancel order confirmation
function cancelOrder(orderNumber) {
Swal.fire({
title: 'Cancelar Pedido',
text: `Tem certeza que deseja cancelar o pedido ${orderNumber}? Esta ação não pode ser desfeita.`,
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#ef4444',
cancelButtonColor: '#6b7280',
confirmButtonText: 'Sim, cancelar!',
cancelButtonText: 'Não, manter',
background: '#1f2937',
color: '#f3f4f6'
}).then((result) => {
if (result.isConfirmed) {
Swal.fire({
title: 'Cancelado!',
text: `O pedido ${orderNumber} foi cancelado.`,
icon: 'success',
background: '#1f2937',
color: '#f3f4f6'
});
}
});
}
// Register receipt
function registerReceipt(orderNumber) {
Swal.fire({
title: 'Registrar Recebimento',
html: `
<div class="text-left">
<div class="mb-4">
<label class="block text-sm font-medium mb-1">Tipo de Recebimento</label>
<select id="receiptType" class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
<option value="partial">Parcial</option>
<option value="total">Total</option>
</select>
</div>
<div id="partialFields">
<div class="mb-4">
<label class="block text-sm font-medium mb-1">Quantidade Recebida</label>
<input type="number" id="receivedQty" class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
</div>
<div class="mb-4">
<label class="block text-sm font-medium mb-1">Nota Fiscal</label>
<input type="text" id="invoiceNumber" class="w-full bg-gray-700 border border-gray-600 rounded-md px-3 py-2">
</div>
</div>
</div>
`,
showCancelButton: true,
confirmButtonText: 'Registrar',
cancelButtonText: 'Cancelar',
background: '#1f2937',
color: '#f3f4f6',
preConfirm: () => {
const type = document.getElementById('receiptType').value;
const qty = document.getElementById('receivedQty').value;
const invoice = document.getElementById('invoiceNumber').value;
if (type === 'partial' && (!qty || qty <= 0)) {
Swal.showValidationMessage('Informe a quantidade recebida');
}
return { type, qty, invoice };
}
}).then((result) => {
if (result.isConfirmed) {
Swal.fire({
title: 'Sucesso!',
text: 'Recebimento registrado com sucesso.',
icon: 'success',
background: '#1f2937',
color: '#f3f4f6'
});
}
});
}
// Edit item modal functions
function editItem(productName, quantity, unitPrice) {
document.getElementById('editProductName').value = productName;
document.getElementById('editQuantity').value = quantity;
document.getElementById('editUnitPrice').value = `R$ ${unitPrice.toFixed(2).replace('.', ',')}`;
document.getElementById('editTotalPrice').value = `R$ ${(quantity * unitPrice).toFixed(2).replace('.', ',')}`;
document.getElementById('editItemModal').classList.remove('hidden');
}
function closeEditItemModal() {
document.getElementById('editItemModal').classList.add('hidden');
}
function saveItemChanges() {
const productName = document.getElementById('editProductName').value;
const quantity = document.getElementById('editQuantity').value;
const unitPrice = document.getElementById('editUnitPrice').value;
// Here you would save the changes to your data/API
Swal.fire({
title: 'Item Atualizado!',
text: `O item ${productName} foi atualizado com sucesso.`,
icon: 'success',
background: '#1f2937',
color: '#f3f4f6'
});
closeEditItemModal();
}
function deleteItem(productName) {
Swal.fire({
title: 'Excluir Item',
text: `Tem certeza que deseja excluir o item ${productName}?`,
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#ef4444',
cancelButtonColor: '#6b7280',
confirmButtonText: 'Sim, excluir!',
cancelButtonText: 'Cancelar',
background: '#1f2937',
color: '#f3f4f6'
}).then((result) => {
if (result.isConfirmed) {
Swal.fire({
title: 'Excluído!',
text: `O item ${productName} foi removido do pedido.`,
icon: 'success',
background: '#1f2937',
color: '#f3f4f6'
});
}
});
}
// Close offcanvas when clicking on backdrop
document.getElementById('backdrop').addEventListener('click', closeOffcanvas);
// Calculate total price when editing
document.getElementById('editQuantity').addEventListener('input', calculateTotal);
document.getElementById('editUnitPrice').addEventListener('input', calculateTotal);
function calculateTotal() {
const quantity = parseFloat(document.getElementById('editQuantity').value) || 0;
const unitPriceStr = document.getElementById('editUnitPrice').value.replace('R$ ', '').replace(',', '.');
const unitPrice = parseFloat(unitPriceStr) || 0;
const total = quantity * unitPrice;
document.getElementById('editTotalPrice').value = `R$ ${total.toFixed(2).replace('.', ',')}`;
}
</script>
<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-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=gallabs/tom-system-pedido-de-compra-ii" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |