|
@@ -3,9 +3,11 @@
|
|
|
import Tabs from '$lib/components/containers/cpr/Tabs.svelte';
|
|
import Tabs from '$lib/components/containers/cpr/Tabs.svelte';
|
|
|
import RegisterCpr from '$lib/components/containers/cpr/RegisterCpr.svelte';
|
|
import RegisterCpr from '$lib/components/containers/cpr/RegisterCpr.svelte';
|
|
|
import Tables from '$lib/components/containers/Tables.svelte';
|
|
import Tables from '$lib/components/containers/Tables.svelte';
|
|
|
|
|
+ import ContractCpr from '$lib/components/containers/cpr/ContractCpr.svelte';
|
|
|
|
|
+ import EmissionCpr from '$lib/components/containers/cpr/EmissionCpr.svelte';
|
|
|
|
|
|
|
|
const breadcrumb = [{ label: 'Início' }, { label: 'CPR', active: true }];
|
|
const breadcrumb = [{ label: 'Início' }, { label: 'CPR', active: true }];
|
|
|
- let activeTab = 0;
|
|
|
|
|
|
|
+ let activeTab = 4;
|
|
|
const tabs = ["Contrato", "Registro", "Emissão"];
|
|
const tabs = ["Contrato", "Registro", "Emissão"];
|
|
|
|
|
|
|
|
let columns = [
|
|
let columns = [
|
|
@@ -20,7 +22,7 @@
|
|
|
|
|
|
|
|
function handleAddTop() {
|
|
function handleAddTop() {
|
|
|
// Ao clicar em "+", mudar para a aba de Registro (index 1) e exibir Tabs + Form
|
|
// Ao clicar em "+", mudar para a aba de Registro (index 1) e exibir Tabs + Form
|
|
|
- activeTab = 1;
|
|
|
|
|
|
|
+ activeTab = 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function handleDeleteRow(e) {
|
|
function handleDeleteRow(e) {
|
|
@@ -36,6 +38,18 @@
|
|
|
r === row ? { ...r, status: r.status === 'Disponível' ? 'Indisponível' : 'Disponível' } : r
|
|
r === row ? { ...r, status: r.status === 'Disponível' ? 'Indisponível' : 'Disponível' } : r
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ function handleFinalize() {
|
|
|
|
|
+ // Aqui você pode adicionar validação dos campos obrigatórios
|
|
|
|
|
+ // Por enquanto, apenas volta para a tabela principal
|
|
|
|
|
+ alert('CPR finalizado com sucesso!');
|
|
|
|
|
+ activeTab = 4;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function handleCancel() {
|
|
|
|
|
+ // Volta para a tabela principal cancelando o processo
|
|
|
|
|
+ activeTab = 4;
|
|
|
|
|
+ }
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<div>
|
|
<div>
|
|
@@ -43,7 +57,7 @@
|
|
|
<div class="p-4">
|
|
<div class="p-4">
|
|
|
<div class="max-w-6xl mx-auto mt-4">
|
|
<div class="max-w-6xl mx-auto mt-4">
|
|
|
|
|
|
|
|
- {#if activeTab === 0}
|
|
|
|
|
|
|
+ {#if activeTab === 4}
|
|
|
<Tables
|
|
<Tables
|
|
|
title="Produtos"
|
|
title="Produtos"
|
|
|
columns={columns}
|
|
columns={columns}
|
|
@@ -52,11 +66,66 @@
|
|
|
on:editRow={handleEditRow}
|
|
on:editRow={handleEditRow}
|
|
|
on:deleteRow={handleDeleteRow}
|
|
on:deleteRow={handleDeleteRow}
|
|
|
/>
|
|
/>
|
|
|
|
|
+ {:else if activeTab === 0}
|
|
|
|
|
+ <Tabs {tabs} bind:active={activeTab} showCloseIcon={true} on:close={handleCancel} />
|
|
|
|
|
+ <div class="mt-4">
|
|
|
|
|
+ <ContractCpr />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <!-- Navigation Controls -->
|
|
|
|
|
+ <div class="flex justify-between mt-6">
|
|
|
|
|
+ <button
|
|
|
|
|
+ class="px-4 py-2 bg-gray-300 text-gray-700 rounded-lg cursor-not-allowed"
|
|
|
|
|
+ disabled
|
|
|
|
|
+ >
|
|
|
|
|
+ Anterior
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <button
|
|
|
|
|
+ class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700"
|
|
|
|
|
+ on:click={() => activeTab = 1}
|
|
|
|
|
+ >
|
|
|
|
|
+ Próximo
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
{:else if activeTab === 1}
|
|
{:else if activeTab === 1}
|
|
|
- <Tabs {tabs} bind:active={activeTab} />
|
|
|
|
|
|
|
+ <Tabs {tabs} bind:active={activeTab} showCloseIcon={true} on:close={handleCancel} />
|
|
|
<div class="mt-4">
|
|
<div class="mt-4">
|
|
|
<RegisterCpr />
|
|
<RegisterCpr />
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <!-- Navigation Controls -->
|
|
|
|
|
+ <div class="flex justify-between mt-6">
|
|
|
|
|
+ <button
|
|
|
|
|
+ class="px-4 py-2 bg-gray-500 text-white rounded-lg hover:bg-gray-600"
|
|
|
|
|
+ on:click={() => activeTab = 0}
|
|
|
|
|
+ >
|
|
|
|
|
+ Anterior
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <button
|
|
|
|
|
+ class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700"
|
|
|
|
|
+ on:click={() => activeTab = 2}
|
|
|
|
|
+ >
|
|
|
|
|
+ Próximo
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ {:else if activeTab === 2}
|
|
|
|
|
+ <Tabs {tabs} bind:active={activeTab} showCloseIcon={true} on:close={handleCancel} />
|
|
|
|
|
+ <div class="mt-4">
|
|
|
|
|
+ <EmissionCpr />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <!-- Navigation Controls -->
|
|
|
|
|
+ <div class="flex justify-between mt-6">
|
|
|
|
|
+ <button
|
|
|
|
|
+ class="px-4 py-2 bg-gray-500 text-white rounded-lg hover:bg-gray-600"
|
|
|
|
|
+ on:click={() => activeTab = 1}
|
|
|
|
|
+ >
|
|
|
|
|
+ Anterior
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <button
|
|
|
|
|
+ class="px-6 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 font-semibold"
|
|
|
|
|
+ on:click={handleFinalize}
|
|
|
|
|
+ >
|
|
|
|
|
+ Finalizar CPR
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
{/if}
|
|
{/if}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|