feat(api): add CRUD operations for various general catalogs including concepts, customs broker concepts, DODA, electronic notices, equivalencies, error catalogs, exchange rates, identifiers, INPC, legends, multi-currency types, packages, ports, prevalidators, seals, signatures, unit conversions, and units of measure.
This commit is contained in:
@@ -2,18 +2,18 @@
|
||||
* Exportaciones de APIs para módulo A76
|
||||
*/
|
||||
export * from './classes';
|
||||
export * from './packages';
|
||||
export * from './exchange-rate';
|
||||
export * from './concepts';
|
||||
export * from './customs-broker-concepts';
|
||||
export * from './classification-concepts';
|
||||
export * from './unit-conversions';
|
||||
export * from './equivalencies';
|
||||
export * from './multi-currency-types';
|
||||
export * from './inpc';
|
||||
export * from './legends';
|
||||
export * from './signatures';
|
||||
export * from './error-catalogs';
|
||||
export * from './doda';
|
||||
export * from './prevalidators';
|
||||
export * from './electronic-notices';
|
||||
export * from './general_catalogs/packages';
|
||||
export * from './general_catalogs/exchange-rate';
|
||||
export * from './general_catalogs/concepts';
|
||||
export * from './general_catalogs/customs-broker-concepts';
|
||||
export * from './general_catalogs/classification-concepts';
|
||||
export * from './general_catalogs/unit-conversions';
|
||||
export * from './general_catalogs/equivalencies';
|
||||
export * from './general_catalogs/multi-currency-types';
|
||||
export * from './general_catalogs/inpc';
|
||||
export * from './general_catalogs/legends';
|
||||
export * from './general_catalogs/signatures';
|
||||
export * from './general_catalogs/error-catalogs';
|
||||
export * from './general_catalogs/doda';
|
||||
export * from './general_catalogs/prevalidators';
|
||||
export * from './general_catalogs/electronic-notices';
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
/**
|
||||
* API client for Countries operations
|
||||
*/
|
||||
import { api } from '$lib/api';
|
||||
|
||||
export interface Country {
|
||||
m3_key: string;
|
||||
mex_key: string;
|
||||
ame_key: string;
|
||||
description_es: string;
|
||||
description_en: string;
|
||||
}
|
||||
|
||||
export interface CountryListResponse {
|
||||
items: Country[];
|
||||
total: number;
|
||||
page: number;
|
||||
page_size: number;
|
||||
}
|
||||
|
||||
export interface CountryCreateRequest {
|
||||
m3_key: string;
|
||||
mex_key: string;
|
||||
ame_key: string;
|
||||
description_es: string;
|
||||
description_en: string;
|
||||
}
|
||||
|
||||
export interface CountryUpdateRequest {
|
||||
m3_key: string;
|
||||
mex_key: string;
|
||||
ame_key: string;
|
||||
description_es: string;
|
||||
description_en: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all countries with pagination
|
||||
*/
|
||||
export async function getCountries(
|
||||
filters?: {
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
}
|
||||
): Promise<{ data: CountryListResponse; status: number }> {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
if (filters?.page) params.append('page', filters.page.toString());
|
||||
if (filters?.page_size) params.append('page_size', filters.page_size.toString());
|
||||
|
||||
const response = await api.get(`/v1/public/refrence_data/countries?${params.toString()}`);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a single country by m3_key
|
||||
*/
|
||||
export async function getCountry(
|
||||
m3_key: string
|
||||
): Promise<{ data: Country; status: number }> {
|
||||
const response = await api.get(`/v1/public/refrence_data/countries/${m3_key}`);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new country
|
||||
*/
|
||||
export async function createCountry(
|
||||
data: CountryCreateRequest
|
||||
): Promise<{ data: Country; status: number }> {
|
||||
const response = await api.post(`/v1/public/refrence_data/countries`, data);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing country
|
||||
*/
|
||||
export async function updateCountry(
|
||||
m3_key: string,
|
||||
data: CountryUpdateRequest
|
||||
): Promise<{ data: Country; status: number }> {
|
||||
const response = await api.put(`/v1/public/refrence_data/countries/${m3_key}`, data);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a country
|
||||
*/
|
||||
export async function deleteCountry(
|
||||
m3_key: string
|
||||
): Promise<{ data: any; status: number }> {
|
||||
const response = await api.delete(`/v1/public/refrence_data/countries/${m3_key}`);
|
||||
return response;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Company } from '$lib/api/dashboard/a76/company';
|
||||
import type { Company } from '$lib/api/dashboard/a76/general_catalogs/company';
|
||||
import type { ColumnDef } from '@tanstack/table-core';
|
||||
import { renderComponent } from '$lib/components/ui/data-table';
|
||||
import DataTableActions from './data-table-actions.svelte';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import * as Dialog from "$lib/components/ui/dialog";
|
||||
import { Input } from "$lib/components/ui/input";
|
||||
import { Label } from "$lib/components/ui/label";
|
||||
import { createCompany, updateCompany, type Company } from "$lib/api/dashboard/a76/company";
|
||||
import { createCompany, updateCompany, type Company } from "$lib/api/dashboard/a76/general_catalogs/company";
|
||||
|
||||
let {
|
||||
open = $bindable(false),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Button } from "$lib/components/ui/button";
|
||||
import * as DropdownMenu from "$lib/components/ui/dropdown-menu";
|
||||
import { deleteCompany, type Company } from "$lib/api/dashboard/a76/company";
|
||||
import { deleteCompany, type Company } from "$lib/api/dashboard/a76/general_catalogs/company";
|
||||
import { EllipsisVertical, Pencil, LoaderCircle, Trash2 } from 'lucide-svelte';
|
||||
import CreateEditDialog from "./create-edit-dialog.svelte";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ColumnDef } from '@tanstack/table-core';
|
||||
import type { ExchangeRate } from '$lib/api/dashboard/a76/exchange-rate';
|
||||
import type { ExchangeRate } from '$lib/api/dashboard/a76/general_catalogs/exchange-rate';
|
||||
import { renderComponent } from '$lib/components/ui/data-table';
|
||||
import DataTableActions from './data-table-actions.svelte';
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
ExchangeRate,
|
||||
ExchangeRateCreate,
|
||||
ExchangeRateUpdate
|
||||
} from '$lib/api/dashboard/a76/exchange-rate';
|
||||
import { createExchangeRate, updateExchangeRate } from '$lib/api/dashboard/a76/exchange-rate';
|
||||
} from '$lib/api/dashboard/a76/general_catalogs/exchange-rate';
|
||||
import { createExchangeRate, updateExchangeRate } from '$lib/api/dashboard/a76/general_catalogs/exchange-rate';
|
||||
import { companyStore } from '$lib/stores/company.svelte';
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
|
||||
import { EllipsisVertical, Pencil, Trash2, LoaderCircle } from 'lucide-svelte';
|
||||
import type { ExchangeRate } from '$lib/api/dashboard/a76/exchange-rate';
|
||||
import { deleteExchangeRate } from '$lib/api/dashboard/a76/exchange-rate';
|
||||
import type { ExchangeRate } from '$lib/api/dashboard/a76/general_catalogs/exchange-rate';
|
||||
import { deleteExchangeRate } from '$lib/api/dashboard/a76/general_catalogs/exchange-rate';
|
||||
import { companyStore } from '$lib/stores/company.svelte';
|
||||
import CreateEditDialog from './create-edit-dialog.svelte';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Identifier } from '$lib/api/dashboard/a76/identifiers';
|
||||
import type { Identifier } from '$lib/api/dashboard/a76/general_catalogs/identifiers';
|
||||
import type { ColumnDef } from '@tanstack/table-core';
|
||||
import { renderComponent } from '$lib/components/ui/data-table';
|
||||
import DataTableActions from './data-table-actions.svelte';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { Input } from "$lib/components/ui/input";
|
||||
import { Label } from "$lib/components/ui/label";
|
||||
import { Textarea } from "$lib/components/ui/textarea";
|
||||
import { createIdentifier, updateIdentifier, type Identifier } from "$lib/api/dashboard/a76/identifiers";
|
||||
import { createIdentifier, updateIdentifier, type Identifier } from "$lib/api/dashboard/a76/general_catalogs/identifiers";
|
||||
import { companyStore } from "$lib/stores/company.svelte";
|
||||
|
||||
let {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Button } from "$lib/components/ui/button";
|
||||
import * as DropdownMenu from "$lib/components/ui/dropdown-menu";
|
||||
import { deleteIdentifier, type Identifier } from "$lib/api/dashboard/a76/identifiers";
|
||||
import { deleteIdentifier, type Identifier } from "$lib/api/dashboard/a76/general_catalogs/identifiers";
|
||||
import { EllipsisVertical, Pencil, LoaderCircle, Trash2 } from 'lucide-svelte';
|
||||
import CreateEditDialog from "./create-edit-dialog.svelte";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Definición de columnas para la tabla de Packages
|
||||
*/
|
||||
import type { Package } from '$lib/api/dashboard/a76/packages';
|
||||
import type { Package } from '$lib/api/dashboard/a76/general_catalogs/packages';
|
||||
import type { ColumnDef } from '@tanstack/table-core';
|
||||
import { renderComponent } from '$lib/components/ui/data-table';
|
||||
import DataTableActions from './data-table-actions.svelte';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import * as Dialog from "$lib/components/ui/dialog";
|
||||
import { Input } from "$lib/components/ui/input";
|
||||
import { Label } from "$lib/components/ui/label";
|
||||
import { createPackage, updatePackage, type Package, type PackageCreate, type PackageUpdate } from "$lib/api/dashboard/a76/packages";
|
||||
import { createPackage, updatePackage, type Package, type PackageCreate, type PackageUpdate } from "$lib/api/dashboard/a76/general_catalogs/packages";
|
||||
import { companyStore } from "$lib/stores/company.svelte";
|
||||
|
||||
let {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Button } from "$lib/components/ui/button";
|
||||
import * as DropdownMenu from "$lib/components/ui/dropdown-menu";
|
||||
import { deletePackage, type Package } from "$lib/api/dashboard/a76/packages";
|
||||
import { deletePackage, type Package } from "$lib/api/dashboard/a76/general_catalogs/packages";
|
||||
import { companyStore } from "$lib/stores/company.svelte";
|
||||
import { EllipsisVertical, Pencil, LoaderCircle, Trash2 } from 'lucide-svelte';
|
||||
import CreateEditDialog from "./create-edit-dialog.svelte";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Port } from '$lib/api/dashboard/a76/ports';
|
||||
import type { Port } from '$lib/api/dashboard/a76/general_catalogs/ports';
|
||||
import type { ColumnDef } from '@tanstack/table-core';
|
||||
import { renderComponent } from '$lib/components/ui/data-table';
|
||||
import DataTableActions from './data-table-actions.svelte';
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { Input } from "$lib/components/ui/input";
|
||||
import { Label } from "$lib/components/ui/label";
|
||||
import * as Select from "$lib/components/ui/select";
|
||||
import { createPort, updatePort, type Port, PortType } from "$lib/api/dashboard/a76/ports";
|
||||
import { createPort, updatePort, type Port, PortType } from "$lib/api/dashboard/a76/general_catalogs/ports";
|
||||
|
||||
let {
|
||||
open = $bindable(false),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Button } from "$lib/components/ui/button";
|
||||
import * as DropdownMenu from "$lib/components/ui/dropdown-menu";
|
||||
import { deletePort, type Port } from "$lib/api/dashboard/a76/ports";
|
||||
import { deletePort, type Port } from "$lib/api/dashboard/a76/general_catalogs/ports";
|
||||
import { EllipsisVertical, Pencil, LoaderCircle, Trash2 } from 'lucide-svelte';
|
||||
import CreateEditDialog from "./create-edit-dialog.svelte";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Column definitions for Seal table
|
||||
*/
|
||||
import type { ColumnDef } from '@tanstack/table-core';
|
||||
import type { Seal } from '$lib/api/dashboard/a76/seal';
|
||||
import type { Seal } from '$lib/api/dashboard/a76/general_catalogs/seal';
|
||||
import { renderComponent } from '$lib/components/ui/data-table';
|
||||
import DataTableActions from './data-table-actions.svelte';
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
import { Input } from '$lib/components/ui/input';
|
||||
import { Label } from '$lib/components/ui/label';
|
||||
import { LoaderCircle } from 'lucide-svelte';
|
||||
import type { Seal } from '$lib/api/dashboard/a76/seal';
|
||||
import { createSeal, updateSeal } from '$lib/api/dashboard/a76/seal';
|
||||
import type { Seal } from '$lib/api/dashboard/a76/general_catalogs/seal';
|
||||
import { createSeal, updateSeal } from '$lib/api/dashboard/a76/general_catalogs/seal';
|
||||
import { companyStore } from '$lib/stores/company.svelte';
|
||||
|
||||
let {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
|
||||
import { EllipsisVertical, Pencil, Trash2, LoaderCircle } from 'lucide-svelte';
|
||||
import type { Seal } from '$lib/api/dashboard/a76/seal';
|
||||
import { deleteSeal } from '$lib/api/dashboard/a76/seal';
|
||||
import type { Seal } from '$lib/api/dashboard/a76/general_catalogs/seal';
|
||||
import { deleteSeal } from '$lib/api/dashboard/a76/general_catalogs/seal';
|
||||
import { companyStore } from '$lib/stores/company.svelte';
|
||||
import CreateEditDialog from './create-edit-dialog.svelte';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { UnitOfMeasureACE } from '$lib/api/dashboard/a76/units-of-measure';
|
||||
import type { UnitOfMeasureACE } from '$lib/api/dashboard/a76/general_catalogs/units-of-measure';
|
||||
import type { ColumnDef } from '@tanstack/table-core';
|
||||
import { renderComponent } from '$lib/components/ui/data-table';
|
||||
import DataTableActions from './data-table-actions.svelte';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import * as Dialog from "$lib/components/ui/dialog";
|
||||
import { Input } from "$lib/components/ui/input";
|
||||
import { Label } from "$lib/components/ui/label";
|
||||
import { createUnitOfMeasureACE, updateUnitOfMeasureACE, type UnitOfMeasureACE } from "$lib/api/dashboard/a76/units-of-measure";
|
||||
import { createUnitOfMeasureACE, updateUnitOfMeasureACE, type UnitOfMeasureACE } from "$lib/api/dashboard/a76/general_catalogs/units-of-measure";
|
||||
|
||||
let {
|
||||
open = $bindable(false),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Button } from "$lib/components/ui/button";
|
||||
import * as DropdownMenu from "$lib/components/ui/dropdown-menu";
|
||||
import { deleteUnitOfMeasureACE, type UnitOfMeasureACE } from "$lib/api/dashboard/a76/units-of-measure";
|
||||
import { deleteUnitOfMeasureACE, type UnitOfMeasureACE } from "$lib/api/dashboard/a76/general_catalogs/units-of-measure";
|
||||
import { EllipsisVertical, Pencil, LoaderCircle, Trash2 } from 'lucide-svelte';
|
||||
import CreateEditDialog from "./create-edit-dialog.svelte";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { UnitOfMeasureAmerican } from '$lib/api/dashboard/a76/units-of-measure';
|
||||
import type { UnitOfMeasureAmerican } from '$lib/api/dashboard/a76/general_catalogs/units-of-measure';
|
||||
import type { ColumnDef } from '@tanstack/table-core';
|
||||
import { renderComponent } from '$lib/components/ui/data-table';
|
||||
import DataTableActions from './data-table-actions.svelte';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import * as Dialog from "$lib/components/ui/dialog";
|
||||
import { Input } from "$lib/components/ui/input";
|
||||
import { Label } from "$lib/components/ui/label";
|
||||
import { createUnitOfMeasureAmerican, updateUnitOfMeasureAmerican, type UnitOfMeasureAmerican } from "$lib/api/dashboard/a76/units-of-measure";
|
||||
import { createUnitOfMeasureAmerican, updateUnitOfMeasureAmerican, type UnitOfMeasureAmerican } from "$lib/api/dashboard/a76/general_catalogs/units-of-measure";
|
||||
|
||||
let {
|
||||
open = $bindable(false),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Button } from "$lib/components/ui/button";
|
||||
import * as DropdownMenu from "$lib/components/ui/dropdown-menu";
|
||||
import { deleteUnitOfMeasureAmerican, type UnitOfMeasureAmerican } from "$lib/api/dashboard/a76/units-of-measure";
|
||||
import { deleteUnitOfMeasureAmerican, type UnitOfMeasureAmerican } from "$lib/api/dashboard/a76/general_catalogs/units-of-measure";
|
||||
import { EllipsisVertical, Pencil, LoaderCircle, Trash2 } from 'lucide-svelte';
|
||||
import CreateEditDialog from "./create-edit-dialog.svelte";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { UnitOfMeasureOMA } from '$lib/api/dashboard/a76/units-of-measure';
|
||||
import type { UnitOfMeasureOMA } from '$lib/api/dashboard/a76/general_catalogs/units-of-measure';
|
||||
import type { ColumnDef } from '@tanstack/table-core';
|
||||
import { renderComponent } from '$lib/components/ui/data-table';
|
||||
import DataTableActions from './data-table-actions.svelte';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import * as Dialog from "$lib/components/ui/dialog";
|
||||
import { Input } from "$lib/components/ui/input";
|
||||
import { Label } from "$lib/components/ui/label";
|
||||
import { createUnitOfMeasureOMA, updateUnitOfMeasureOMA, type UnitOfMeasureOMA } from "$lib/api/dashboard/a76/units-of-measure";
|
||||
import { createUnitOfMeasureOMA, updateUnitOfMeasureOMA, type UnitOfMeasureOMA } from "$lib/api/dashboard/a76/general_catalogs/units-of-measure";
|
||||
|
||||
let {
|
||||
open = $bindable(false),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Button } from "$lib/components/ui/button";
|
||||
import * as DropdownMenu from "$lib/components/ui/dropdown-menu";
|
||||
import { deleteUnitOfMeasureOMA, type UnitOfMeasureOMA } from "$lib/api/dashboard/a76/units-of-measure";
|
||||
import { deleteUnitOfMeasureOMA, type UnitOfMeasureOMA } from "$lib/api/dashboard/a76/general_catalogs/units-of-measure";
|
||||
import { EllipsisVertical, Pencil, LoaderCircle, Trash2 } from 'lucide-svelte';
|
||||
import CreateEditDialog from "./create-edit-dialog.svelte";
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
import DataTable from '$lib/components/dashboard/exchange-rate/data-table.svelte';
|
||||
import CreateEditDialog from '$lib/components/dashboard/exchange-rate/create-edit-dialog.svelte';
|
||||
import { createColumns } from '$lib/components/dashboard/exchange-rate/columns';
|
||||
import type { ExchangeRate } from '$lib/api/dashboard/a76/exchange-rate';
|
||||
import { getExchangeRates } from '$lib/api/dashboard/a76/exchange-rate';
|
||||
import type { ExchangeRate } from '$lib/api/dashboard/a76/general_catalogs/exchange-rate';
|
||||
import { getExchangeRates } from '$lib/api/dashboard/a76/general_catalogs/exchange-rate';
|
||||
import { companyStore } from '$lib/stores/company.svelte';
|
||||
|
||||
let allItems = $state<ExchangeRate[]>([]);
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
import DataTable from '$lib/components/dashboard/seal/data-table.svelte';
|
||||
import CreateEditDialog from '$lib/components/dashboard/seal/create-edit-dialog.svelte';
|
||||
import { createColumns } from '$lib/components/dashboard/seal/columns';
|
||||
import type { Seal } from '$lib/api/dashboard/a76/seal';
|
||||
import { getSeals } from '$lib/api/dashboard/a76/seal';
|
||||
import type { Seal } from '$lib/api/dashboard/a76/general_catalogs/seal';
|
||||
import { getSeals } from '$lib/api/dashboard/a76/general_catalogs/seal';
|
||||
import { companyStore } from '$lib/stores/company.svelte';
|
||||
|
||||
let allItems = $state<Seal[]>([]);
|
||||
|
||||
Reference in New Issue
Block a user