File size: 47,791 Bytes
7054af0 |
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 |
<!DOCTYPE html>
<html lang="pt-BR" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Orçamentos</title>
<!-- Bootstrap 5.3.2 CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<!-- DataTables CSS -->
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap5.min.css">
<!-- SweetAlert2 CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css">
<style>
.offcanvas-end {
width: 33.333333%;
transition: transform 0.4s ease-in-out;
}
@media (max-width: 992px) {
.offcanvas-end {
width: 75%;
}
}
@media (max-width: 576px) {
.offcanvas-end {
width: 100%;
}
}
.status-badge {
padding: 5px 10px;
border-radius: 20px;
font-size: 0.8rem;
font-weight: 500;
}
.status-em-elaboracao {
background-color: rgba(13, 110, 253, 0.2);
color: #0d6efd;
}
.status-aguardando-analise {
background-color: rgba(255, 193, 7, 0.2);
color: #ffc107;
}
.status-analise-concluida {
background-color: rgba(25, 135, 84, 0.2);
color: #198754;
}
.status-convertido {
background-color: rgba(111, 66, 193, 0.2);
color: #6f42c1;
}
.status-cancelado {
background-color: rgba(220, 53, 69, 0.2);
color: #dc3545;
}
.action-btn {
width: 30px;
height: 30px;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 50%;
margin: 0 2px;
transition: all 0.2s;
}
.action-btn:hover {
transform: scale(1.1);
}
.budget-detail-modal .modal-dialog {
max-width: 90%;
}
.history-item {
border-left: 3px solid #6c757d;
padding-left: 1rem;
margin-bottom: 1rem;
position: relative;
}
.history-item:last-child {
margin-bottom: 0;
}
.history-item::before {
content: '';
position: absolute;
left: -8px;
top: 5px;
width: 13px;
height: 13px;
border-radius: 50%;
background-color: #6c757d;
}
.history-item-success::before {
background-color: #198754;
}
.history-item-warning::before {
background-color: #ffc107;
}
.history-item-danger::before {
background-color: #dc3545;
}
.history-item-info::before {
background-color: #0dcaf0;
}
</style>
</head>
<body class="bg-dark text-light">
<div class="container-fluid py-4">
<!-- Header -->
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="display-6 fw-bold">
<i class="bi bi-file-earmark-text me-2"></i> Orçamentos
</h1>
<button class="btn btn-primary" id="newBudgetBtn">
<i class="bi bi-plus-lg me-1"></i> Novo Orçamento
</button>
</div>
<!-- Search and Filter -->
<div class="card bg-dark border-secondary mb-4">
<div class="card-body">
<div class="row g-3">
<div class="col-md-3">
<label for="searchClient" class="form-label">Cliente</label>
<input type="text" class="form-control" id="searchClient" placeholder="Buscar por cliente...">
</div>
<div class="col-md-2">
<label for="searchSeller" class="form-label">Vendedor</label>
<select class="form-select" id="searchSeller">
<option value="">Todos</option>
<option>João Silva</option>
<option>Maria Souza</option>
<option>Carlos Oliveira</option>
</select>
</div>
<div class="col-md-2">
<label for="searchStatus" class="form-label">Status</label>
<select class="form-select" id="searchStatus">
<option value="">Todos</option>
<option>Em Elaboração</option>
<option>Aguardando Análise</option>
<option>Análise Concluída</option>
<option>Convertido em Pedido</option>
<option>Cancelado</option>
</select>
</div>
<div class="col-md-3">
<label for="searchDate" class="form-label">Período</label>
<input type="date" class="form-control" id="searchDate">
</div>
<div class="col-md-2 d-flex align-items-end">
<button class="btn btn-outline-secondary w-100" id="searchBtn">
<i class="bi bi-search me-1"></i> Filtrar
</button>
</div>
</div>
</div>
</div>
<!-- Budgets Table -->
<div class="card bg-dark border-secondary">
<div class="card-body">
<div class="table-responsive">
<table id="budgetsTable" class="table table-dark table-hover table-striped" style="width:100%">
<thead>
<tr>
<th>Número</th>
<th>Cliente</th>
<th>Vendedor</th>
<th>Criação</th>
<th>Validade</th>
<th>Status</th>
<th>Ações</th>
</tr>
</thead>
<tbody>
<tr>
<td>ORC-2023-001</td>
<td>Empresa ABC Ltda</td>
<td>João Silva</td>
<td>15/10/2023</td>
<td>30/10/2023</td>
<td><span class="status-badge status-convertido">Convertido em Pedido</span></td>
<td>
<button class="btn btn-sm btn-outline-info action-btn view-btn" title="Visualizar">
<i class="bi bi-eye"></i>
</button>
<button class="btn btn-sm btn-outline-warning action-btn edit-btn" title="Editar">
<i class="bi bi-pencil"></i>
</button>
<button class="btn btn-sm btn-outline-primary action-btn duplicate-btn" title="Duplicar">
<i class="bi bi-files"></i>
</button>
</td>
</tr>
<tr>
<td>ORC-2023-002</td>
<td>Comércio XYZ S/A</td>
<td>Maria Souza</td>
<td>18/10/2023</td>
<td>02/11/2023</td>
<td><span class="status-badge status-aguardando-analise">Aguardando Análise</span></td>
<td>
<button class="btn btn-sm btn-outline-info action-btn view-btn" title="Visualizar">
<i class="bi bi-eye"></i>
</button>
<button class="btn btn-sm btn-outline-warning action-btn edit-btn" title="Editar">
<i class="bi bi-pencil"></i>
</button>
<button class="btn btn-sm btn-outline-primary action-btn duplicate-btn" title="Duplicar">
<i class="bi bi-files"></i>
</button>
<button class="btn btn-sm btn-outline-success action-btn convert-btn" title="Converter em Pedido">
<i class="bi bi-cart-check"></i>
</button>
<button class="btn btn-sm btn-outline-danger action-btn cancel-btn" title="Cancelar">
<i class="bi bi-x-circle"></i>
</button>
</td>
</tr>
<tr>
<td>ORC-2023-003</td>
<td>Indústria 123 ME</td>
<td>Carlos Oliveira</td>
<td>20/10/2023</td>
<td>05/11/2023</td>
<td><span class="status-badge status-em-elaboracao">Em Elaboração</span></td>
<td>
<button class="btn btn-sm btn-outline-info action-btn view-btn" title="Visualizar">
<i class="bi bi-eye"></i>
</button>
<button class="btn btn-sm btn-outline-warning action-btn edit-btn" title="Editar">
<i class="bi bi-pencil"></i>
</button>
<button class="btn btn-sm btn-outline-primary action-btn duplicate-btn" title="Duplicar">
<i class="bi bi-files"></i>
</button>
<button class="btn btn-sm btn-outline-success action-btn convert-btn" title="Converter em Pedido">
<i class="bi bi-cart-check"></i>
</button>
<button class="btn btn-sm btn-outline-danger action-btn cancel-btn" title="Cancelar">
<i class="bi bi-x-circle"></i>
</button>
</td>
</tr>
<tr>
<td>ORC-2023-004</td>
<td>Serviços QWE EIRELI</td>
<td>João Silva</td>
<td>22/10/2023</td>
<td>07/11/2023</td>
<td><span class="status-badge status-analise-concluida">Análise Concluída</span></td>
<td>
<button class="btn btn-sm btn-outline-info action-btn view-btn" title="Visualizar">
<i class="bi bi-eye"></i>
</button>
<button class="btn btn-sm btn-outline-warning action-btn edit-btn" title="Editar">
<i class="bi bi-pencil"></i>
</button>
<button class="btn btn-sm btn-outline-primary action-btn duplicate-btn" title="Duplicar">
<i class="bi bi-files"></i>
</button>
<button class="btn btn-sm btn-outline-success action-btn convert-btn" title="Converter em Pedido">
<i class="bi bi-cart-check"></i>
</button>
<button class="btn btn-sm btn-outline-danger action-btn cancel-btn" title="Cancelar">
<i class="bi bi-x-circle"></i>
</button>
</td>
</tr>
<tr>
<td>ORC-2023-005</td>
<td>Comércio Popular</td>
<td>Maria Souza</td>
<td>25/10/2023</td>
<td>10/11/2023</td>
<td><span class="status-badge status-cancelado">Cancelado</span></td>
<td>
<button class="btn btn-sm btn-outline-info action-btn view-btn" title="Visualizar">
<i class="bi bi-eye"></i>
</button>
<button class="btn btn-sm btn-outline-primary action-btn duplicate-btn" title="Duplicar">
<i class="bi bi-files"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- New Budget Offcanvas -->
<div class="offcanvas offcanvas-end" tabindex="-1" id="newBudgetOffcanvas" aria-labelledby="newBudgetOffcanvasLabel">
<div class="offcanvas-header bg-dark border-bottom border-secondary">
<h5 class="offcanvas-title" id="newBudgetOffcanvasLabel">Novo Orçamento</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body bg-dark">
<form id="newBudgetForm">
<div class="mb-3">
<label for="clientName" class="form-label">Cliente</label>
<select class="form-select" id="clientName" required>
<option value="" selected disabled>Selecione um cliente</option>
<option>Empresa ABC Ltda</option>
<option>Comércio XYZ S/A</option>
<option>Indústria 123 ME</option>
<option>Serviços QWE EIRELI</option>
<option>Comércio Popular</option>
</select>
</div>
<div class="mb-3">
<label for="sellerName" class="form-label">Vendedor</label>
<select class="form-select" id="sellerName" required>
<option value="" selected disabled>Selecione um vendedor</option>
<option>João Silva</option>
<option>Maria Souza</option>
<option>Carlos Oliveira</option>
</select>
</div>
<div class="mb-3">
<label for="validUntil" class="form-label">Validade (dias)</label>
<select class="form-select" id="validUntil" required>
<option value="7">7 dias</option>
<option value="10" selected>10 dias</option>
<option value="15">15 dias</option>
<option value="30">30 dias</option>
</select>
</div>
<div class="mb-3">
<label for="budgetNotes" class="form-label">Observações</label>
<textarea class="form-control" id="budgetNotes" rows="3"></textarea>
</div>
<div class="d-grid gap-2">
<button type="submit" class="btn btn-primary">
<i class="bi bi-save me-1"></i> Salvar Orçamento
</button>
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="offcanvas">
<i class="bi bi-x-lg me-1"></i> Cancelar
</button>
</div>
</form>
</div>
</div>
<!-- Budget Detail Modal -->
<div class="modal fade budget-detail-modal" id="budgetDetailModal" tabindex="-1" aria-labelledby="budgetDetailModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content bg-dark">
<div class="modal-header border-secondary">
<h5 class="modal-title" id="budgetDetailModalLabel">Detalhes do Orçamento ORC-2023-002</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="row mb-4">
<div class="col-md-6">
<div class="card bg-dark border-secondary mb-3">
<div class="card-header bg-dark border-secondary">
<h6 class="mb-0"><i class="bi bi-building me-2"></i>Dados do Cliente</h6>
</div>
<div class="card-body">
<p class="mb-1"><strong>Nome:</strong> Comércio XYZ S/A</p>
<p class="mb-1"><strong>CNPJ:</strong> 12.345.678/0001-99</p>
<p class="mb-1"><strong>Endereço:</strong> Rua Exemplo, 123 - Centro - São Paulo/SP</p>
<p class="mb-1"><strong>Contato:</strong> (11) 99999-9999</p>
<p class="mb-0"><strong>Email:</strong> [email protected]</p>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card bg-dark border-secondary mb-3">
<div class="card-header bg-dark border-secondary">
<h6 class="mb-0"><i class="bi bi-person-badge me-2"></i>Dados do Orçamento</h6>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<p class="mb-1"><strong>Vendedor:</strong> Maria Souza</p>
<p class="mb-1"><strong>Data Criação:</strong> 18/10/2023</p>
<p class="mb-1"><strong>Data Validade:</strong> 02/11/2023</p>
</div>
<div class="col-md-6">
<p class="mb-1"><strong>Status:</strong> <span class="status-badge status-aguardando-analise">Aguardando Análise</span></p>
<p class="mb-1"><strong>Total:</strong> R$ 12.450,00</p>
<p class="mb-0"><strong>Desconto:</strong> 5%</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card bg-dark border-secondary mb-4">
<div class="card-header bg-dark border-secondary d-flex justify-content-between align-items-center">
<h6 class="mb-0"><i class="bi bi-cart me-2"></i>Itens do Orçamento</h6>
<button class="btn btn-sm btn-primary" id="addItemBtn">
<i class="bi bi-plus-lg me-1"></i> Adicionar Item
</button>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-dark table-hover" id="itemsTable">
<thead>
<tr>
<th>Produto</th>
<th>Categoria</th>
<th>Fornecedor</th>
<th>Quantidade</th>
<th>Valor Unitário</th>
<th>Total</th>
<th>Status</th>
<th>Ações</th>
</tr>
</thead>
<tbody>
<tr>
<td>Notebook Dell Inspiron 15</td>
<td>Informática</td>
<td>Dell Brasil</td>
<td>2</td>
<td>R$ 3.500,00</td>
<td>R$ 7.000,00</td>
<td><span class="badge bg-secondary">Pendente</span></td>
<td>
<button class="btn btn-sm btn-outline-warning action-btn edit-item-btn" title="Editar">
<i class="bi bi-pencil"></i>
</button>
<button class="btn btn-sm btn-outline-danger action-btn remove-item-btn" title="Remover">
<i class="bi bi-trash"></i>
</button>
</td>
</tr>
<tr>
<td>Monitor LG 24" Full HD</td>
<td>Informática</td>
<td>LG Eletronics</td>
<td>3</td>
<td>R$ 850,00</td>
<td>R$ 2.550,00</td>
<td><span class="badge bg-secondary">Pendente</span></td>
<td>
<button class="btn btn-sm btn-outline-warning action-btn edit-item-btn" title="Editar">
<i class="bi bi-pencil"></i>
</button>
<button class="btn btn-sm btn-outline-danger action-btn remove-item-btn" title="Remover">
<i class="bi bi-trash"></i>
</button>
</td>
</tr>
<tr>
<td>Impressora HP LaserJet</td>
<td>Informática</td>
<td>HP Brasil</td>
<td>1</td>
<td>R$ 1.200,00</td>
<td>R$ 1.200,00</td>
<td><span class="badge bg-secondary">Pendente</span></td>
<td>
<button class="btn btn-sm btn-outline-warning action-btn edit-item-btn" title="Editar">
<i class="bi bi-pencil"></i>
</button>
<button class="btn btn-sm btn-outline-danger action-btn remove-item-btn" title="Remover">
<i class="bi bi-trash"></i>
</button>
</td>
</tr>
<tr>
<td>Teclado e Mouse sem fio Logitech</td>
<td>Informática</td>
<td>Logitech</td>
<td>2</td>
<td>R$ 350,00</td>
<td>R$ 700,00</td>
<td><span class="badge bg-secondary">Pendente</span></td>
<td>
<button class="btn btn-sm btn-outline-warning action-btn edit-item-btn" title="Editar">
<i class="bi bi-pencil"></i>
</button>
<button class="btn btn-sm btn-outline-danger action-btn remove-item-btn" title="Remover">
<i class="bi bi-trash"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="row mb-4">
<div class="col-md-6">
<div class="card bg-dark border-secondary">
<div class="card-header bg-dark border-secondary">
<h6 class="mb-0"><i class="bi bi-chat-left-text me-2"></i>Observações</h6>
</div>
<div class="card-body">
<p>Cliente solicitou entrega até o dia 30/10/2023. Possível desconto adicional se fechar o pedido esta semana.</p>
<textarea class="form-control mt-2" rows="3" placeholder="Adicionar observações..."></textarea>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card bg-dark border-secondary">
<div class="card-header bg-dark border-secondary">
<h6 class="mb-0"><i class="bi bi-calculator me-2"></i>Resumo Financeiro</h6>
</div>
<div class="card-body">
<div class="d-flex justify-content-between mb-2">
<span>Subtotal:</span>
<span>R$ 11.450,00</span>
</div>
<div class="d-flex justify-content-between mb-2">
<span>Desconto (5%):</span>
<span>- R$ 572,50</span>
</div>
<div class="d-flex justify-content-between mb-2">
<span>Frete:</span>
<span>R$ 250,00</span>
</div>
<div class="d-flex justify-content-between fw-bold fs-5 border-top border-secondary pt-2">
<span>Total:</span>
<span>R$ 11.127,50</span>
</div>
</div>
</div>
</div>
</div>
<div class="card bg-dark border-secondary">
<div class="card-header bg-dark border-secondary">
<h6 class="mb-0"><i class="bi bi-clock-history me-2"></i>Histórico</h6>
</div>
<div class="card-body">
<div class="history-item history-item-success">
<div class="d-flex justify-content-between">
<strong>Orçamento criado</strong>
<small class="text-muted">18/10/2023 09:15</small>
</div>
<p class="mb-0">Por: Maria Souza</p>
</div>
<div class="history-item history-item-info">
<div class="d-flex justify-content-between">
<strong>Primeiro item adicionado</strong>
<small class="text-muted">18/10/2023 09:30</small>
</div>
<p class="mb-0">Notebook Dell Inspiron 15 - 2 unidades</p>
</div>
<div class="history-item history-item-info">
<div class="d-flex justify-content-between">
<strong>Itens adicionados</strong>
<small class="text-muted">18/10/2023 10:45</small>
</div>
<p class="mb-0">Monitor LG 24" Full HD - 3 unidades, Impressora HP LaserJet - 1 unidade</p>
</div>
<div class="history-item history-item-warning">
<div class="d-flex justify-content-between">
<strong>Enviado para análise</strong>
<small class="text-muted">18/10/2023 14:20</small>
</div>
<p class="mb-0">Status alterado para "Aguardando Análise"</p>
</div>
</div>
</div>
</div>
<div class="modal-footer border-secondary">
<button type="button" class="btn btn-success" id="sendToAnalysisBtn">
<i class="bi bi-send me-1"></i> Enviar para Análise de Compra
</button>
<button type="button" class="btn btn-danger" id="cancelBudgetBtn">
<i class="bi bi-x-circle me-1"></i> Cancelar Orçamento
</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
<i class="bi bi-x-lg me-1"></i> Fechar
</button>
</div>
</div>
</div>
</div>
<!-- Add/Edit Item Modal -->
<div class="modal fade" id="itemModal" tabindex="-1" aria-labelledby="itemModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content bg-dark">
<div class="modal-header border-secondary">
<h5 class="modal-title" id="itemModalLabel">Adicionar Item</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form id="itemForm">
<div class="mb-3">
<label for="productName" class="form-label">Produto</label>
<select class="form-select" id="productName" required>
<option value="" selected disabled>Selecione um produto</option>
<option>Notebook Dell Inspiron 15</option>
<option>Monitor LG 24" Full HD</option>
<option>Impressora HP LaserJet</option>
<option>Teclado e Mouse sem fio Logitech</option>
<option>HD Externo Seagate 1TB</option>
</select>
</div>
<div class="mb-3">
<label for="productCategory" class="form-label">Categoria</label>
<input type="text" class="form-control" id="productCategory" readonly>
</div>
<div class="mb-3">
<label for="supplier" class="form-label">Fornecedor</label>
<select class="form-select" id="supplier" required>
<option value="" selected disabled>Selecione um fornecedor</option>
<option>Dell Brasil</option>
<option>LG Eletronics</option>
<option>HP Brasil</option>
<option>Logitech</option>
<option>Seagate</option>
</select>
</div>
<div class="mb-3">
<label for="quantity" class="form-label">Quantidade</label>
<input type="number" class="form-control" id="quantity" min="1" value="1" required>
</div>
<div class="mb-3">
<label for="unitPrice" class="form-label">Valor Unitário</label>
<input type="text" class="form-control" id="unitPrice" required>
</div>
</form>
</div>
<div class="modal-footer border-secondary">
<button type="button" class="btn btn-primary" id="saveItemBtn">
<i class="bi bi-save me-1"></i> Salvar
</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
<i class="bi bi-x-lg me-1"></i> Cancelar
</button>
</div>
</div>
</div>
</div>
<!-- Bootstrap 5.3.2 JS Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<!-- DataTables JS -->
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap5.min.js"></script>
<!-- SweetAlert2 JS -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
$(document).ready(function() {
// Initialize DataTable
$('#budgetsTable').DataTable({
language: {
url: 'https://cdn.datatables.net/plug-ins/1.13.6/i18n/pt-BR.json'
},
responsive: true
});
// Initialize items table
$('#itemsTable').DataTable({
language: {
url: 'https://cdn.datatables.net/plug-ins/1.13.6/i18n/pt-BR.json'
},
responsive: true,
searching: false,
paging: false,
info: false
});
// New Budget Offcanvas
$('#newBudgetBtn').click(function() {
var newBudgetOffcanvas = new bootstrap.Offcanvas(document.getElementById('newBudgetOffcanvas'));
newBudgetOffcanvas.show();
});
// Form submission for new budget
$('#newBudgetForm').submit(function(e) {
e.preventDefault();
Swal.fire({
title: 'Sucesso!',
text: 'Orçamento criado com sucesso.',
icon: 'success',
confirmButtonText: 'OK'
}).then(() => {
var offcanvas = bootstrap.Offcanvas.getInstance(document.getElementById('newBudgetOffcanvas'));
offcanvas.hide();
$('#newBudgetForm')[0].reset();
// In a real app, you would refresh the table or add the new budget
});
});
// View Budget buttons
$('.view-btn').click(function() {
var budgetDetailModal = new bootstrap.Modal(document.getElementById('budgetDetailModal'));
budgetDetailModal.show();
});
// Edit Budget buttons
$('.edit-btn').click(function() {
// In a real app, this would open the edit mode
Swal.fire({
title: 'Editar Orçamento',
text: 'Você será redirecionado para a edição do orçamento.',
icon: 'info',
confirmButtonText: 'OK'
});
});
// Duplicate Budget buttons
$('.duplicate-btn').click(function() {
Swal.fire({
title: 'Duplicar Orçamento',
text: 'Tem certeza que deseja duplicar este orçamento?',
icon: 'question',
showCancelButton: true,
confirmButtonText: 'Sim, duplicar',
cancelButtonText: 'Cancelar'
}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
'Sucesso!',
'Orçamento duplicado com sucesso.',
'success'
);
}
});
});
// Convert to Order buttons
$('.convert-btn').click(function() {
Swal.fire({
title: 'Converter em Pedido',
text: 'Tem certeza que deseja converter este orçamento em pedido de venda?',
icon: 'question',
showCancelButton: true,
confirmButtonText: 'Sim, converter',
cancelButtonText: 'Cancelar'
}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
'Sucesso!',
'Orçamento convertido em pedido de venda.',
'success'
);
}
});
});
// Cancel Budget buttons
$('.cancel-btn').click(function() {
Swal.fire({
title: 'Cancelar Orçamento',
text: 'Tem certeza que deseja cancelar este orçamento? Esta ação não pode ser desfeita.',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Sim, cancelar',
cancelButtonText: 'Manter orçamento',
confirmButtonColor: '#dc3545'
}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
'Cancelado!',
'O orçamento foi cancelado.',
'success'
);
}
});
});
// Add Item button in Budget Detail
$('#addItemBtn').click(function() {
$('#itemModalLabel').text('Adicionar Item');
$('#itemForm')[0].reset();
$('#productCategory').val('');
var itemModal = new bootstrap.Modal(document.getElementById('itemModal'));
itemModal.show();
});
// Edit Item buttons
$('.edit-item-btn').click(function() {
$('#itemModalLabel').text('Editar Item');
// In a real app, you would populate the form with the item data
$('#productName').val('Notebook Dell Inspiron 15');
$('#productCategory').val('Informática');
$('#supplier').val('Dell Brasil');
$('#quantity').val('2');
$('#unitPrice').val('3.500,00');
var itemModal = new bootstrap.Modal(document.getElementById('itemModal'));
itemModal.show();
});
// Remove Item buttons
$('.remove-item-btn').click(function() {
Swal.fire({
title: 'Remover Item',
text: 'Tem certeza que deseja remover este item do orçamento?',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Sim, remover',
cancelButtonText: 'Manter item',
confirmButtonColor: '#dc3545'
}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
'Removido!',
'O item foi removido do orçamento.',
'success'
);
}
});
});
// Save Item button
$('#saveItemBtn').click(function() {
// Validate form
if ($('#itemForm')[0].checkValidity()) {
Swal.fire({
title: 'Sucesso!',
text: 'Item salvo com sucesso.',
icon: 'success',
confirmButtonText: 'OK'
}).then(() => {
var itemModal = bootstrap.Modal.getInstance(document.getElementById('itemModal'));
itemModal.hide();
// In a real app, you would add/update the item in the table
});
} else {
$('#itemForm')[0].reportValidity();
}
});
// Send to Analysis button
$('#sendToAnalysisBtn').click(function() {
Swal.fire({
title: 'Enviar para Análise',
text: 'Tem certeza que deseja enviar este orçamento para análise de compra?',
icon: 'question',
showCancelButton: true,
confirmButtonText: 'Sim, enviar',
cancelButtonText: 'Cancelar'
}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
'Enviado!',
'O orçamento foi enviado para análise de compra.',
'success'
);
}
});
});
// Cancel Budget button in detail modal
$('#cancelBudgetBtn').click(function() {
Swal.fire({
title: 'Cancelar Orçamento',
text: 'Tem certeza que deseja cancelar este orçamento? Esta ação não pode ser desfeita.',
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Sim, cancelar',
cancelButtonText: 'Manter orçamento',
confirmButtonColor: '#dc3545'
}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
'Cancelado!',
'O orçamento foi cancelado.',
'success'
).then(() => {
var budgetDetailModal = bootstrap.Modal.getInstance(document.getElementById('budgetDetailModal'));
budgetDetailModal.hide();
});
}
});
});
// Product selection change
$('#productName').change(function() {
// In a real app, you would fetch the category from your database
var product = $(this).val();
var category = '';
if (product === 'Notebook Dell Inspiron 15' ||
product === 'Monitor LG 24" Full HD' ||
product === 'Impressora HP LaserJet' ||
product === 'Teclado e Mouse sem fio Logitech') {
category = 'Informática';
} else if (product === 'HD Externo Seagate 1TB') {
category = 'Armazenamento';
}
$('#productCategory').val(category);
});
});
</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-orcamento-bootstrap532" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |