gallabs commited on
Commit
cb15347
·
verified ·
1 Parent(s): e994202

Add 2 files

Browse files
Files changed (2) hide show
  1. index.html +247 -12
  2. prompts.txt +2 -1
index.html CHANGED
@@ -77,12 +77,55 @@
77
  padding: 1.5rem;
78
  }
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  @media (max-width: 768px) {
81
  .responsive-table {
82
  display: block;
83
  overflow-x: auto;
84
  white-space: nowrap;
85
  }
 
 
 
 
86
  }
87
  </style>
88
  </head>
@@ -322,6 +365,117 @@
322
  </div>
323
  </div>
324
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  <!-- Order Detail Modal -->
326
  <div id="order-detail-modal" class="modal-overlay hidden">
327
  <div class="modal-content">
@@ -627,6 +781,99 @@
627
  document.documentElement.classList.remove('dark');
628
  }
629
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
630
  // Order Detail Modal
631
  const viewButtons = document.querySelectorAll('.view-btn');
632
  const orderDetailModal = document.getElementById('order-detail-modal');
@@ -847,18 +1094,6 @@
847
  });
848
  });
849
 
850
- // New Order Button
851
- document.getElementById('new-order-btn').addEventListener('click', function() {
852
- Swal.fire({
853
- title: 'Novo Pedido de Compra',
854
- text: 'Redirecionando para a criação de novo pedido...',
855
- icon: 'info',
856
- timer: 1500,
857
- showConfirmButton: false
858
- });
859
- // In a real app, we would redirect to a new order form
860
- });
861
-
862
  // Money format input
863
  document.querySelectorAll('.money').forEach(input => {
864
  input.addEventListener('input', function() {
 
77
  padding: 1.5rem;
78
  }
79
 
80
+ .offcanvas {
81
+ position: fixed;
82
+ top: 0;
83
+ right: 0;
84
+ width: 50%;
85
+ height: 100vh;
86
+ background-color: white;
87
+ box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
88
+ transform: translateX(100%);
89
+ transition: transform 0.3s ease;
90
+ z-index: 1050;
91
+ overflow-y: auto;
92
+ }
93
+
94
+ .offcanvas.show {
95
+ transform: translateX(0);
96
+ }
97
+
98
+ .offcanvas-header {
99
+ padding: 1rem;
100
+ border-bottom: 1px solid #e5e7eb;
101
+ display: flex;
102
+ justify-content: space-between;
103
+ align-items: center;
104
+ }
105
+
106
+ .offcanvas-body {
107
+ padding: 1rem;
108
+ }
109
+
110
+ .dark .offcanvas {
111
+ background-color: #1f2937;
112
+ color: white;
113
+ }
114
+
115
+ .dark .offcanvas-header {
116
+ border-bottom-color: #374151;
117
+ }
118
+
119
  @media (max-width: 768px) {
120
  .responsive-table {
121
  display: block;
122
  overflow-x: auto;
123
  white-space: nowrap;
124
  }
125
+
126
+ .offcanvas {
127
+ width: 90%;
128
+ }
129
  }
130
  </style>
131
  </head>
 
365
  </div>
366
  </div>
367
 
368
+ <!-- New Order Offcanvas -->
369
+ <div id="new-order-offcanvas" class="offcanvas">
370
+ <div class="offcanvas-header">
371
+ <h2 class="text-xl font-bold">Novo Pedido de Compra</h2>
372
+ <button id="close-new-order" class="text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200">
373
+ <i class="fas fa-times text-xl"></i>
374
+ </button>
375
+ </div>
376
+ <div class="offcanvas-body">
377
+ <form id="new-order-form" class="space-y-4">
378
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
379
+ <div>
380
+ <label for="supplier-select" class="block text-sm font-medium mb-1">Fornecedor</label>
381
+ <select id="supplier-select" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600" required>
382
+ <option value="">Selecione um fornecedor</option>
383
+ <option value="1">Fornecedor A</option>
384
+ <option value="2">Fornecedor B</option>
385
+ <option value="3">Fornecedor C</option>
386
+ </select>
387
+ </div>
388
+
389
+ <div>
390
+ <label for="responsible-select" class="block text-sm font-medium mb-1">Responsável</label>
391
+ <select id="responsible-select" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600" required>
392
+ <option value="">Selecione o responsável</option>
393
+ <option value="1">João Silva</option>
394
+ <option value="2">Maria Souza</option>
395
+ <option value="3">Carlos Oliveira</option>
396
+ </select>
397
+ </div>
398
+
399
+ <div>
400
+ <label for="payment-terms" class="block text-sm font-medium mb-1">Condição de Pagamento</label>
401
+ <select id="payment-terms" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600" required>
402
+ <option value="">Selecione a condição</option>
403
+ <option value="30">30 dias</option>
404
+ <option value="60">60 dias</option>
405
+ <option value="90">90 dias</option>
406
+ <option value="30/60/90">30/60/90 dias</option>
407
+ </select>
408
+ </div>
409
+
410
+ <div>
411
+ <label for="delivery-date" class="block text-sm font-medium mb-1">Previsão de Entrega</label>
412
+ <input type="date" id="delivery-date" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600" required>
413
+ </div>
414
+ </div>
415
+
416
+ <div>
417
+ <label for="order-notes" class="block text-sm font-medium mb-1">Observações</label>
418
+ <textarea id="order-notes" rows="3" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600"></textarea>
419
+ </div>
420
+
421
+ <div class="mt-6">
422
+ <h3 class="text-lg font-semibold mb-4">Itens do Pedido</h3>
423
+
424
+ <div class="responsive-table mb-4">
425
+ <table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
426
+ <thead class="bg-gray-50 dark:bg-gray-700">
427
+ <tr>
428
+ <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Produto</th>
429
+ <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Quantidade</th>
430
+ <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Valor Unitário</th>
431
+ <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Ações</th>
432
+ </tr>
433
+ </thead>
434
+ <tbody id="order-items-list" class="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700">
435
+ <!-- Items will be added here dynamically -->
436
+ </tbody>
437
+ </table>
438
+ </div>
439
+
440
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-4">
441
+ <div>
442
+ <label for="product-select" class="block text-sm font-medium mb-1">Produto</label>
443
+ <select id="product-select" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600">
444
+ <option value="">Selecione um produto</option>
445
+ <option value="1">Produto X</option>
446
+ <option value="2">Produto Y</option>
447
+ <option value="3">Produto Z</option>
448
+ </select>
449
+ </div>
450
+
451
+ <div>
452
+ <label for="item-quantity" class="block text-sm font-medium mb-1">Quantidade</label>
453
+ <input type="number" id="item-quantity" min="1" value="1" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600">
454
+ </div>
455
+
456
+ <div>
457
+ <label for="item-unit-price" class="block text-sm font-medium mb-1">Valor Unitário</label>
458
+ <input type="text" id="item-unit-price" class="w-full p-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600 money">
459
+ </div>
460
+ </div>
461
+
462
+ <button type="button" id="add-item-to-order" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm flex items-center gap-1">
463
+ <i class="fas fa-plus"></i> Adicionar Item
464
+ </button>
465
+ </div>
466
+
467
+ <div class="flex justify-end gap-3 pt-6 border-t border-gray-200 dark:border-gray-700">
468
+ <button type="button" id="cancel-new-order" class="bg-gray-300 hover:bg-gray-400 dark:bg-gray-600 dark:hover:bg-gray-700 text-gray-800 dark:text-gray-200 px-4 py-2 rounded-lg">
469
+ Cancelar
470
+ </button>
471
+ <button type="submit" class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg flex items-center gap-2">
472
+ <i class="fas fa-save"></i> Salvar Pedido
473
+ </button>
474
+ </div>
475
+ </form>
476
+ </div>
477
+ </div>
478
+
479
  <!-- Order Detail Modal -->
480
  <div id="order-detail-modal" class="modal-overlay hidden">
481
  <div class="modal-content">
 
781
  document.documentElement.classList.remove('dark');
782
  }
783
 
784
+ // New Order Offcanvas
785
+ const newOrderBtn = document.getElementById('new-order-btn');
786
+ const newOrderOffcanvas = document.getElementById('new-order-offcanvas');
787
+ const closeNewOrder = document.getElementById('close-new-order');
788
+ const cancelNewOrder = document.getElementById('cancel-new-order');
789
+
790
+ newOrderBtn.addEventListener('click', function() {
791
+ newOrderOffcanvas.classList.add('show');
792
+ document.body.style.overflow = 'hidden';
793
+ });
794
+
795
+ closeNewOrder.addEventListener('click', function() {
796
+ newOrderOffcanvas.classList.remove('show');
797
+ document.body.style.overflow = 'auto';
798
+ });
799
+
800
+ cancelNewOrder.addEventListener('click', function() {
801
+ newOrderOffcanvas.classList.remove('show');
802
+ document.body.style.overflow = 'auto';
803
+ });
804
+
805
+ // Add items to new order
806
+ const addItemToOrderBtn = document.getElementById('add-item-to-order');
807
+ const orderItemsList = document.getElementById('order-items-list');
808
+
809
+ addItemToOrderBtn.addEventListener('click', function() {
810
+ const productSelect = document.getElementById('product-select');
811
+ const productName = productSelect.options[productSelect.selectedIndex].text;
812
+ const quantity = document.getElementById('item-quantity').value;
813
+ const unitPrice = document.getElementById('item-unit-price').value;
814
+
815
+ if (productSelect.value === '' || quantity === '' || unitPrice === '') {
816
+ Swal.fire({
817
+ title: 'Campos obrigatórios',
818
+ text: 'Por favor, preencha todos os campos do item.',
819
+ icon: 'warning'
820
+ });
821
+ return;
822
+ }
823
+
824
+ const totalValue = (parseFloat(quantity) * parseFloat(unitPrice.replace('R$ ', '').replace('.', '').replace(',', '.'))).toFixed(2);
825
+
826
+ const newRow = document.createElement('tr');
827
+ newRow.className = 'bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700';
828
+ newRow.innerHTML = `
829
+ <td class="px-4 py-2 whitespace-nowrap">${productName}</td>
830
+ <td class="px-4 py-2 whitespace-nowrap">${quantity}</td>
831
+ <td class="px-4 py-2 whitespace-nowrap">${unitPrice}</td>
832
+ <td class="px-4 py-2 whitespace-nowrap">
833
+ <button class="remove-item-row text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300">
834
+ <i class="fas fa-trash"></i>
835
+ </button>
836
+ </td>
837
+ `;
838
+
839
+ orderItemsList.appendChild(newRow);
840
+
841
+ // Clear form
842
+ productSelect.value = '';
843
+ document.getElementById('item-quantity').value = '1';
844
+ document.getElementById('item-unit-price').value = '';
845
+
846
+ // Add event listener to remove button
847
+ newRow.querySelector('.remove-item-row').addEventListener('click', function() {
848
+ newRow.remove();
849
+ });
850
+ });
851
+
852
+ // Submit new order form
853
+ document.getElementById('new-order-form').addEventListener('submit', function(e) {
854
+ e.preventDefault();
855
+
856
+ if (orderItemsList.children.length === 0) {
857
+ Swal.fire({
858
+ title: 'Itens obrigatórios',
859
+ text: 'Por favor, adicione pelo menos um item ao pedido.',
860
+ icon: 'warning'
861
+ });
862
+ return;
863
+ }
864
+
865
+ Swal.fire({
866
+ title: 'Pedido criado!',
867
+ text: 'O novo pedido de compra foi criado com sucesso.',
868
+ icon: 'success'
869
+ });
870
+
871
+ newOrderOffcanvas.classList.remove('show');
872
+ document.body.style.overflow = 'auto';
873
+ this.reset();
874
+ orderItemsList.innerHTML = '';
875
+ });
876
+
877
  // Order Detail Modal
878
  const viewButtons = document.querySelectorAll('.view-btn');
879
  const orderDetailModal = document.getElementById('order-detail-modal');
 
1094
  });
1095
  });
1096
 
 
 
 
 
 
 
 
 
 
 
 
 
1097
  // Money format input
1098
  document.querySelectorAll('.money').forEach(input => {
1099
  input.addEventListener('input', function() {
prompts.txt CHANGED
@@ -1 +1,2 @@
1
- Crie uma interface web responsiva para o gerenciamento de "Pedidos de Compra" utilizando HTML, CSS e JavaScript puro (ou Bootstrap 5, se preferir). A tela deve conter: - Título: "Pedidos de Compra" - Um botão para "Novo Pedido de Compra" - Uma tabela para listar os pedidos com as colunas: - Número do Pedido de Compra - Fornecedor - Responsável pela Compra - Data de Emissão - Data de Previsão de Entrega - Status do Pedido (Em Elaboração, Aguardando Aprovação, Aprovado, Enviado, Recebido Parcial, Recebido Total, Cancelado) - Valor Total - Ações (Visualizar, Editar, Cancelar, Imprimir) - Filtros por fornecedor, status, responsável e data. - Ao visualizar um pedido, abrir um modal ou tela de detalhe com: - Dados do Fornecedor, Responsável, Condições de Pagamento, Observações - Lista dos Itens do Pedido de Compra, colunas: - Produto (Nome) - Categoria do Produto - Quantidade Solicitada - Valor Unitário Negociado - Valor Total do Item - Quantidade Recebida - Status do Item (Pendente, Recebido, etc.) - Ações por item (Editar, Registrar Recebimento, Remover) - Botão para "Adicionar Item" - Botão para "Enviar para Aprovação" (habilitado apenas enquanto o status for "Em Elaboração") - Botão para "Registrar Recebimento" (parcial/total, conforme status) - Botão para "Cancelar Pedido" (com modal de confirmação) - Histórico de eventos/ações do pedido no final da tela - Confirmações e alertas devem usar modal estilo SweetAlert2. - Layout limpo, organizado, responsivo, com boas práticas de UX para facilitar o dia a dia de quem opera. - Utilize ícones modernos (FontAwesome ou Bootstrap Icons), cores suaves e espaçamento adequado. - Por favor, gere no modo dark (tema escuro), com um botão que alterne entre uma "meia lua, para dark" e "um sol, para modo light".
 
 
1
+ Crie uma interface web responsiva para o gerenciamento de "Pedidos de Compra" utilizando HTML, CSS e JavaScript puro (ou Bootstrap 5, se preferir). A tela deve conter: - Título: "Pedidos de Compra" - Um botão para "Novo Pedido de Compra" - Uma tabela para listar os pedidos com as colunas: - Número do Pedido de Compra - Fornecedor - Responsável pela Compra - Data de Emissão - Data de Previsão de Entrega - Status do Pedido (Em Elaboração, Aguardando Aprovação, Aprovado, Enviado, Recebido Parcial, Recebido Total, Cancelado) - Valor Total - Ações (Visualizar, Editar, Cancelar, Imprimir) - Filtros por fornecedor, status, responsável e data. - Ao visualizar um pedido, abrir um modal ou tela de detalhe com: - Dados do Fornecedor, Responsável, Condições de Pagamento, Observações - Lista dos Itens do Pedido de Compra, colunas: - Produto (Nome) - Categoria do Produto - Quantidade Solicitada - Valor Unitário Negociado - Valor Total do Item - Quantidade Recebida - Status do Item (Pendente, Recebido, etc.) - Ações por item (Editar, Registrar Recebimento, Remover) - Botão para "Adicionar Item" - Botão para "Enviar para Aprovação" (habilitado apenas enquanto o status for "Em Elaboração") - Botão para "Registrar Recebimento" (parcial/total, conforme status) - Botão para "Cancelar Pedido" (com modal de confirmação) - Histórico de eventos/ações do pedido no final da tela - Confirmações e alertas devem usar modal estilo SweetAlert2. - Layout limpo, organizado, responsivo, com boas práticas de UX para facilitar o dia a dia de quem opera. - Utilize ícones modernos (FontAwesome ou Bootstrap Icons), cores suaves e espaçamento adequado. - Por favor, gere no modo dark (tema escuro), com um botão que alterne entre uma "meia lua, para dark" e "um sol, para modo light".
2
+ Por favor, no botão "+ Novo Pedido de Compra". Chame um Modal ou um OffCanvas (com 50% da página) para adicionar um novo "Pedido de Compra" direto desta página, sem precisar buscar num Orçamento. E onde está a engrenagem, mude para uma "meia lua" para o modo dark, e ao alternar para o modo light, alterne o botão para um "sol".