|
|
|
|
@@ -4,6 +4,13 @@ import { createRawSnippet } from "svelte";
|
|
|
|
|
import DataTableActions from "./data-table-actions.svelte";
|
|
|
|
|
import type { Pedimento } from "$lib/api/dashboard/a76/pedimentos";
|
|
|
|
|
|
|
|
|
|
// Extender el tipo ColumnMeta para incluir className
|
|
|
|
|
declare module "@tanstack/table-core" {
|
|
|
|
|
interface ColumnMeta<TData extends unknown, TValue> {
|
|
|
|
|
className?: string;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Formatea un número como moneda
|
|
|
|
|
*/
|
|
|
|
|
@@ -120,6 +127,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef<Pedimento>[] {
|
|
|
|
|
{
|
|
|
|
|
accessorKey: "pedimento_type",
|
|
|
|
|
header: "Tipo",
|
|
|
|
|
meta: { className: "hidden md:table-cell" },
|
|
|
|
|
cell: ({ row }) => {
|
|
|
|
|
const typeSnippet = createRawSnippet<[{ type?: string | null }]>((getType) => {
|
|
|
|
|
const { type } = getType();
|
|
|
|
|
@@ -134,6 +142,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef<Pedimento>[] {
|
|
|
|
|
{
|
|
|
|
|
accessorKey: "pedimento_code",
|
|
|
|
|
header: "Clave",
|
|
|
|
|
meta: { className: "hidden lg:table-cell" },
|
|
|
|
|
cell: ({ row }) => {
|
|
|
|
|
const codeSnippet = createRawSnippet<[{ code?: string | null }]>((getCode) => {
|
|
|
|
|
const { code } = getCode();
|
|
|
|
|
@@ -148,6 +157,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef<Pedimento>[] {
|
|
|
|
|
{
|
|
|
|
|
accessorKey: "regime",
|
|
|
|
|
header: "Régimen",
|
|
|
|
|
meta: { className: "hidden lg:table-cell" },
|
|
|
|
|
cell: ({ row }) => {
|
|
|
|
|
const regimeSnippet = createRawSnippet<[{ regime?: string | null }]>((getRegime) => {
|
|
|
|
|
const { regime } = getRegime();
|
|
|
|
|
@@ -162,6 +172,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef<Pedimento>[] {
|
|
|
|
|
{
|
|
|
|
|
accessorKey: "pedimento_dates.start_date",
|
|
|
|
|
header: "Fecha Inicio",
|
|
|
|
|
meta: { className: "hidden xl:table-cell" },
|
|
|
|
|
cell: ({ row }) => {
|
|
|
|
|
const dateSnippet = createRawSnippet<[{ date: string }]>((getDate) => {
|
|
|
|
|
const { date } = getDate();
|
|
|
|
|
@@ -176,6 +187,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef<Pedimento>[] {
|
|
|
|
|
{
|
|
|
|
|
accessorKey: "pedimento_dates.end_date",
|
|
|
|
|
header: "Fecha Final",
|
|
|
|
|
meta: { className: "hidden xl:table-cell" },
|
|
|
|
|
cell: ({ row }) => {
|
|
|
|
|
const dateSnippet = createRawSnippet<[{ date: string }]>((getDate) => {
|
|
|
|
|
const { date } = getDate();
|
|
|
|
|
@@ -190,6 +202,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef<Pedimento>[] {
|
|
|
|
|
{
|
|
|
|
|
accessorKey: "pedimento_dates.payment_date",
|
|
|
|
|
header: "Fecha de Pago",
|
|
|
|
|
meta: { className: "hidden xl:table-cell" },
|
|
|
|
|
cell: ({ row }) => {
|
|
|
|
|
const dateSnippet = createRawSnippet<[{ date: string }]>((getDate) => {
|
|
|
|
|
const { date } = getDate();
|
|
|
|
|
@@ -204,6 +217,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef<Pedimento>[] {
|
|
|
|
|
{
|
|
|
|
|
accessorKey: "pedimento_config_update_rectification.pediment_rectifed_18",
|
|
|
|
|
header: "Pedimento 18",
|
|
|
|
|
meta: { className: "hidden lg:table-cell" },
|
|
|
|
|
cell: ({ row }) => {
|
|
|
|
|
const ped18Snippet = createRawSnippet<[{ value?: string | null }]>((getValue) => {
|
|
|
|
|
const { value } = getValue();
|
|
|
|
|
@@ -218,6 +232,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef<Pedimento>[] {
|
|
|
|
|
{
|
|
|
|
|
accessorKey: "pedimento_config_update_rectification.r1",
|
|
|
|
|
header: "Pedimento R1",
|
|
|
|
|
meta: { className: "hidden lg:table-cell" },
|
|
|
|
|
cell: ({ row }) => {
|
|
|
|
|
const r1Snippet = createRawSnippet<[{ value?: string | null }]>((getValue) => {
|
|
|
|
|
const { value } = getValue();
|
|
|
|
|
@@ -232,6 +247,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef<Pedimento>[] {
|
|
|
|
|
{
|
|
|
|
|
accessorKey: "pedimento_validation.electronic_signature",
|
|
|
|
|
header: "Acuse Electrónico",
|
|
|
|
|
meta: { className: "hidden xl:table-cell" },
|
|
|
|
|
cell: ({ row }) => {
|
|
|
|
|
const ackSnippet = createRawSnippet<[{ value?: string | null }]>((getValue) => {
|
|
|
|
|
const { value } = getValue();
|
|
|
|
|
@@ -249,6 +265,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef<Pedimento>[] {
|
|
|
|
|
{
|
|
|
|
|
accessorKey: "pedimento_payments.total_contributions",
|
|
|
|
|
header: "¿Se pagó el impuesto?",
|
|
|
|
|
meta: { className: "hidden xl:table-cell" },
|
|
|
|
|
cell: ({ row }) => {
|
|
|
|
|
const paidSnippet = createRawSnippet<[{ value?: string | null }]>((getValue) => {
|
|
|
|
|
const { value } = getValue();
|
|
|
|
|
@@ -266,6 +283,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef<Pedimento>[] {
|
|
|
|
|
{
|
|
|
|
|
accessorKey: "client_id",
|
|
|
|
|
header: "Cliente",
|
|
|
|
|
meta: { className: "hidden md:table-cell" },
|
|
|
|
|
cell: ({ row }) => {
|
|
|
|
|
const clientSnippet = createRawSnippet<[{ clientId?: number | null }]>((getClient) => {
|
|
|
|
|
const { clientId } = getClient();
|
|
|
|
|
@@ -309,6 +327,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef<Pedimento>[] {
|
|
|
|
|
});
|
|
|
|
|
return renderSnippet(headerSnippet, {});
|
|
|
|
|
},
|
|
|
|
|
meta: { className: "hidden lg:table-cell" },
|
|
|
|
|
cell: ({ row }) => {
|
|
|
|
|
const valueSnippet = createRawSnippet<[{ value: string }]>((getValue) => {
|
|
|
|
|
const { value } = getValue();
|
|
|
|
|
@@ -330,6 +349,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef<Pedimento>[] {
|
|
|
|
|
});
|
|
|
|
|
return renderSnippet(headerSnippet, {});
|
|
|
|
|
},
|
|
|
|
|
meta: { className: "hidden xl:table-cell" },
|
|
|
|
|
cell: ({ row }) => {
|
|
|
|
|
const priceSnippet = createRawSnippet<[{ price: string }]>((getPrice) => {
|
|
|
|
|
const { price } = getPrice();
|
|
|
|
|
@@ -351,6 +371,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef<Pedimento>[] {
|
|
|
|
|
});
|
|
|
|
|
return renderSnippet(headerSnippet, {});
|
|
|
|
|
},
|
|
|
|
|
meta: { className: "hidden lg:table-cell" },
|
|
|
|
|
cell: ({ row }) => {
|
|
|
|
|
const weightSnippet = createRawSnippet<[{ weight: string }]>((getWeight) => {
|
|
|
|
|
const { weight } = getWeight();
|
|
|
|
|
@@ -365,6 +386,7 @@ export function createColumns(onSuccess?: () => void): ColumnDef<Pedimento>[] {
|
|
|
|
|
{
|
|
|
|
|
accessorKey: "created_at",
|
|
|
|
|
header: "Fecha de Creación",
|
|
|
|
|
meta: { className: "hidden 2xl:table-cell" },
|
|
|
|
|
cell: ({ row }) => {
|
|
|
|
|
const dateSnippet = createRawSnippet<[{ date: string }]>((getDate) => {
|
|
|
|
|
const { date } = getDate();
|
|
|
|
|
|