.
This commit is contained in:
parent
debbb3f3dd
commit
5781fbdb24
@ -31,7 +31,7 @@ export const CatalogDataTable = () => {
|
|||||||
accessorKey: "id",
|
accessorKey: "id",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "article_id" as const,
|
id: "id_article" as const,
|
||||||
accessorKey: "id_article",
|
accessorKey: "id_article",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -71,7 +71,7 @@ export const CatalogDataTable = () => {
|
|||||||
initialState: {
|
initialState: {
|
||||||
columnVisibility: {
|
columnVisibility: {
|
||||||
id: false,
|
id: false,
|
||||||
article_id: false,
|
id_article: false,
|
||||||
catalog_name: false,
|
catalog_name: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -54,6 +54,21 @@ export const QuoteDetailsCardEditor = ({
|
|||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
enableResizing: false,
|
enableResizing: false,
|
||||||
},*/
|
},*/
|
||||||
|
/*{
|
||||||
|
id: "id_article" as const,
|
||||||
|
accessorKey: "id_article",
|
||||||
|
header: "artículo",
|
||||||
|
cell: ({ row: { index, original } }) => {
|
||||||
|
return (
|
||||||
|
<FormTextAreaField
|
||||||
|
readOnly={original?.id_article}
|
||||||
|
autoSize
|
||||||
|
{...register(`items.${index}.id_article`)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
size: 500,
|
||||||
|
},*/
|
||||||
{
|
{
|
||||||
id: "description" as const,
|
id: "description" as const,
|
||||||
accessorKey: "description",
|
accessorKey: "description",
|
||||||
@ -200,6 +215,7 @@ export const QuoteDetailsCardEditor = ({
|
|||||||
|
|
||||||
const handleAppendCatalogArticle = useCallback(
|
const handleAppendCatalogArticle = useCallback(
|
||||||
(article: any) => {
|
(article: any) => {
|
||||||
|
console.log(article);
|
||||||
fieldActions.append({
|
fieldActions.append({
|
||||||
...article,
|
...article,
|
||||||
quantity: {
|
quantity: {
|
||||||
|
|||||||
@ -91,6 +91,7 @@ export const QuoteEdit = () => {
|
|||||||
},
|
},
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
|
id_article: "",
|
||||||
description: "",
|
description: "",
|
||||||
quantity: {
|
quantity: {
|
||||||
amount: null,
|
amount: null,
|
||||||
@ -139,6 +140,7 @@ export const QuoteEdit = () => {
|
|||||||
|
|
||||||
const onSubmit = async (data: QuoteDataForm, shouldRedirect: boolean) => {
|
const onSubmit = async (data: QuoteDataForm, shouldRedirect: boolean) => {
|
||||||
// Transformación del form -> typo de request
|
// Transformación del form -> typo de request
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
mutate(data, {
|
mutate(data, {
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
|
|||||||
@ -34,7 +34,7 @@ export const QuotesList = () => {
|
|||||||
{ value: "draft", label: t("quotes.list.tabs.draft") },
|
{ value: "draft", label: t("quotes.list.tabs.draft") },
|
||||||
{ value: "ready", label: t("quotes.list.tabs.ready") },
|
{ value: "ready", label: t("quotes.list.tabs.ready") },
|
||||||
{ value: "delivered", label: t("quotes.list.tabs.delivered") },
|
{ value: "delivered", label: t("quotes.list.tabs.delivered") },
|
||||||
{ value: "accepted", label: t("quotes.list.tabs.delivered") },
|
{ value: "accepted", label: t("quotes.list.tabs.accepted") },
|
||||||
{ value: "rejected", label: t("quotes.list.tabs.rejected") },
|
{ value: "rejected", label: t("quotes.list.tabs.rejected") },
|
||||||
{ value: "archived", label: t("quotes.list.tabs.archived") },
|
{ value: "archived", label: t("quotes.list.tabs.archived") },
|
||||||
];
|
];
|
||||||
|
|||||||
@ -14,7 +14,7 @@ i18n
|
|||||||
// init i18next
|
// init i18next
|
||||||
// for all options read: https://www.i18next.com/overview/configuration-options
|
// for all options read: https://www.i18next.com/overview/configuration-options
|
||||||
.init({
|
.init({
|
||||||
debug: true,
|
debug: false,
|
||||||
fallbackLng: "es",
|
fallbackLng: "es",
|
||||||
interpolation: {
|
interpolation: {
|
||||||
escapeValue: false,
|
escapeValue: false,
|
||||||
|
|||||||
@ -210,9 +210,9 @@ export class CreateQuoteUseCase
|
|||||||
try {
|
try {
|
||||||
items = new Collection<QuoteItem>(
|
items = new Collection<QuoteItem>(
|
||||||
quoteDTO.items?.map((item) => {
|
quoteDTO.items?.map((item) => {
|
||||||
const articleIdOrError = ArticleIdentifier.create(item.article_id);
|
const idArticleOrError = ArticleIdentifier.create(item.id_article);
|
||||||
if (articleIdOrError.isFailure) {
|
if (idArticleOrError.isFailure) {
|
||||||
throw articleIdOrError.error;
|
throw idArticleOrError.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const descriptionOrError = Description.create(item.description);
|
const descriptionOrError = Description.create(item.description);
|
||||||
@ -246,7 +246,7 @@ export class CreateQuoteUseCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
const quoteItemOrError = QuoteItem.create({
|
const quoteItemOrError = QuoteItem.create({
|
||||||
articleId: articleIdOrError.object,
|
idArticle: idArticleOrError.object,
|
||||||
description: descriptionOrError.object,
|
description: descriptionOrError.object,
|
||||||
quantity: quantityOrError.object,
|
quantity: quantityOrError.object,
|
||||||
unitPrice: unitPriceOrError.object,
|
unitPrice: unitPriceOrError.object,
|
||||||
|
|||||||
@ -199,9 +199,9 @@ export class UpdateQuoteUseCase
|
|||||||
try {
|
try {
|
||||||
items = new Collection<QuoteItem>(
|
items = new Collection<QuoteItem>(
|
||||||
quoteDTO.items?.map((item) => {
|
quoteDTO.items?.map((item) => {
|
||||||
const articleIdOrError = ArticleIdentifier.create(item.article_id);
|
const idArticleOrError = ArticleIdentifier.create(item.id_article);
|
||||||
if (articleIdOrError.isFailure) {
|
if (idArticleOrError.isFailure) {
|
||||||
throw articleIdOrError.error;
|
throw idArticleOrError.error;
|
||||||
}
|
}
|
||||||
|
|
||||||
const descriptionOrError = Description.create(item.description);
|
const descriptionOrError = Description.create(item.description);
|
||||||
@ -235,7 +235,7 @@ export class UpdateQuoteUseCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
const quoteItemOrError = QuoteItem.create({
|
const quoteItemOrError = QuoteItem.create({
|
||||||
articleId: articleIdOrError.object,
|
idArticle: idArticleOrError.object,
|
||||||
description: descriptionOrError.object,
|
description: descriptionOrError.object,
|
||||||
quantity: quantityOrError.object,
|
quantity: quantityOrError.object,
|
||||||
unitPrice: unitPriceOrError.object,
|
unitPrice: unitPriceOrError.object,
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
} from "@shared/contexts";
|
} from "@shared/contexts";
|
||||||
|
|
||||||
export interface IQuoteItemProps extends IEntityProps {
|
export interface IQuoteItemProps extends IEntityProps {
|
||||||
articleId: ArticleIdentifier;
|
idArticle: ArticleIdentifier;
|
||||||
description: Description; // Descripción del artículo o servicio
|
description: Description; // Descripción del artículo o servicio
|
||||||
quantity: Quantity; // Cantidad de unidades
|
quantity: Quantity; // Cantidad de unidades
|
||||||
unitPrice: MoneyValue; // Precio unitario en la moneda de la factura
|
unitPrice: MoneyValue; // Precio unitario en la moneda de la factura
|
||||||
@ -22,7 +22,7 @@ export interface IQuoteItemProps extends IEntityProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IQuoteItem {
|
export interface IQuoteItem {
|
||||||
articleId: ArticleIdentifier;
|
idArticle: ArticleIdentifier;
|
||||||
description: Description;
|
description: Description;
|
||||||
quantity: Quantity;
|
quantity: Quantity;
|
||||||
unitPrice: MoneyValue;
|
unitPrice: MoneyValue;
|
||||||
@ -36,8 +36,8 @@ export class QuoteItem extends Entity<IQuoteItemProps> implements IQuoteItem {
|
|||||||
return Result.ok(new QuoteItem(props, id));
|
return Result.ok(new QuoteItem(props, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
get articleId(): ArticleIdentifier {
|
get idArticle(): ArticleIdentifier {
|
||||||
return this.props.articleId;
|
return this.props.idArticle;
|
||||||
}
|
}
|
||||||
|
|
||||||
get description(): Description {
|
get description(): Description {
|
||||||
|
|||||||
@ -52,7 +52,7 @@ const quoteItemPresenter = (
|
|||||||
): ICreateQuote_QuoteItem_Response_DTO[] =>
|
): ICreateQuote_QuoteItem_Response_DTO[] =>
|
||||||
items.totalCount > 0
|
items.totalCount > 0
|
||||||
? items.items.map((item: QuoteItem) => ({
|
? items.items.map((item: QuoteItem) => ({
|
||||||
article_id: item.articleId.toString(),
|
id_article: item.idArticle.toString(),
|
||||||
description: item.description.toString(),
|
description: item.description.toString(),
|
||||||
quantity: item.quantity.convertScale(2).toObject(),
|
quantity: item.quantity.convertScale(2).toObject(),
|
||||||
unit_price: item.unitPrice.convertScale(4).toObject(),
|
unit_price: item.unitPrice.convertScale(4).toObject(),
|
||||||
|
|||||||
@ -52,7 +52,7 @@ const quoteItemPresenter = (
|
|||||||
): IGetQuote_QuoteItem_Response_DTO[] =>
|
): IGetQuote_QuoteItem_Response_DTO[] =>
|
||||||
items.totalCount > 0
|
items.totalCount > 0
|
||||||
? items.items.map((item: QuoteItem) => ({
|
? items.items.map((item: QuoteItem) => ({
|
||||||
article_id: item.articleId.toString(),
|
id_article: item.idArticle.toString(),
|
||||||
description: item.description.toString(),
|
description: item.description.toString(),
|
||||||
quantity: item.quantity.convertScale(2).toObject(),
|
quantity: item.quantity.convertScale(2).toObject(),
|
||||||
unit_price: item.unitPrice.convertScale(4).toObject(),
|
unit_price: item.unitPrice.convertScale(4).toObject(),
|
||||||
|
|||||||
@ -111,7 +111,7 @@ const map = async (quote: Quote, context: ISalesContext) => {
|
|||||||
const quoteItemPresenter = (items: ICollection<QuoteItem>, context: ISalesContext): any[] =>
|
const quoteItemPresenter = (items: ICollection<QuoteItem>, context: ISalesContext): any[] =>
|
||||||
items.totalCount > 0
|
items.totalCount > 0
|
||||||
? items.items.map((item: QuoteItem) => ({
|
? items.items.map((item: QuoteItem) => ({
|
||||||
article_id: item.articleId.toString(),
|
id_article: item.idArticle.toString(),
|
||||||
description: item.description.toString(),
|
description: item.description.toString(),
|
||||||
quantity: item.quantity.toFormat(),
|
quantity: item.quantity.toFormat(),
|
||||||
unit_price: item.unitPrice.toFormat(),
|
unit_price: item.unitPrice.toFormat(),
|
||||||
|
|||||||
@ -52,7 +52,7 @@ const quoteItemPresenter = (
|
|||||||
): IUpdateQuote_QuoteItem_Response_DTO[] =>
|
): IUpdateQuote_QuoteItem_Response_DTO[] =>
|
||||||
items.totalCount > 0
|
items.totalCount > 0
|
||||||
? items.items.map((item: QuoteItem) => ({
|
? items.items.map((item: QuoteItem) => ({
|
||||||
article_id: item.articleId.toString(),
|
id_article: item.idArticle.toString(),
|
||||||
description: item.description.toString(),
|
description: item.description.toString(),
|
||||||
quantity: item.quantity.convertScale(2).toObject(),
|
quantity: item.quantity.convertScale(2).toObject(),
|
||||||
unit_price: item.unitPrice.convertScale(4).toObject(),
|
unit_price: item.unitPrice.convertScale(4).toObject(),
|
||||||
|
|||||||
@ -23,10 +23,10 @@ class QuoteItemMapper
|
|||||||
const { sourceParent } = params;
|
const { sourceParent } = params;
|
||||||
const id = this.mapsValue(source, "item_id", UniqueID.create);
|
const id = this.mapsValue(source, "item_id", UniqueID.create);
|
||||||
|
|
||||||
const articleId = this.mapsValue(source, "id_article", ArticleIdentifier.create);
|
const idArticle = this.mapsValue(source, "id_article", ArticleIdentifier.create);
|
||||||
|
|
||||||
const props: IQuoteItemProps = {
|
const props: IQuoteItemProps = {
|
||||||
articleId,
|
idArticle,
|
||||||
description: this.mapsValue(source, "description", Description.create),
|
description: this.mapsValue(source, "description", Description.create),
|
||||||
quantity: this.mapsValue(source, "quantity", (quantity) =>
|
quantity: this.mapsValue(source, "quantity", (quantity) =>
|
||||||
Quantity.create({
|
Quantity.create({
|
||||||
@ -86,7 +86,7 @@ class QuoteItemMapper
|
|||||||
item_id: source.id.toString(),
|
item_id: source.id.toString(),
|
||||||
quote_id: sourceParent.id.toPrimitive(),
|
quote_id: sourceParent.id.toPrimitive(),
|
||||||
position: index,
|
position: index,
|
||||||
id_article: source.articleId.toPrimitive(),
|
id_article: source.idArticle.toPrimitive(),
|
||||||
description: source.description.toPrimitive(),
|
description: source.description.toPrimitive(),
|
||||||
quantity: source.quantity.convertScale(2).toPrimitive(),
|
quantity: source.quantity.convertScale(2).toPrimitive(),
|
||||||
unit_price: source.unitPrice.convertScale(4).toPrimitive(),
|
unit_price: source.unitPrice.convertScale(4).toPrimitive(),
|
||||||
|
|||||||
@ -30,7 +30,7 @@ export interface ICreateQuote_Request_DTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ICreateQuoteItem_Request_DTO {
|
export interface ICreateQuoteItem_Request_DTO {
|
||||||
article_id: string;
|
id_article: string;
|
||||||
quantity: IQuantity_Response_DTO;
|
quantity: IQuantity_Response_DTO;
|
||||||
description: string;
|
description: string;
|
||||||
unit_price: IMoney_Response_DTO;
|
unit_price: IMoney_Response_DTO;
|
||||||
|
|||||||
@ -28,7 +28,7 @@ export interface ICreateQuote_Response_DTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ICreateQuote_QuoteItem_Response_DTO {
|
export interface ICreateQuote_QuoteItem_Response_DTO {
|
||||||
article_id: string;
|
id_article: string;
|
||||||
quantity: IQuantity_DTO;
|
quantity: IQuantity_DTO;
|
||||||
description: string;
|
description: string;
|
||||||
unit_price: IMoney_DTO;
|
unit_price: IMoney_DTO;
|
||||||
|
|||||||
@ -28,7 +28,7 @@ export interface IGetQuote_Response_DTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IGetQuote_QuoteItem_Response_DTO {
|
export interface IGetQuote_QuoteItem_Response_DTO {
|
||||||
article_id: string;
|
id_article: string;
|
||||||
quantity: IQuantity_DTO;
|
quantity: IQuantity_DTO;
|
||||||
description: string;
|
description: string;
|
||||||
unit_price: IMoney_DTO;
|
unit_price: IMoney_DTO;
|
||||||
|
|||||||
@ -30,7 +30,7 @@ export interface IUpdateQuote_Request_DTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IUpdateQuoteItem_Request_DTO {
|
export interface IUpdateQuoteItem_Request_DTO {
|
||||||
article_id: string;
|
id_article: string;
|
||||||
quantity: IQuantity_Response_DTO;
|
quantity: IQuantity_Response_DTO;
|
||||||
description: string;
|
description: string;
|
||||||
unit_price: IMoney_Response_DTO;
|
unit_price: IMoney_Response_DTO;
|
||||||
|
|||||||
@ -28,7 +28,7 @@ export interface IUpdateQuote_Response_DTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IUpdateQuote_QuoteItem_Response_DTO {
|
export interface IUpdateQuote_QuoteItem_Response_DTO {
|
||||||
article_id: string;
|
id_article: string;
|
||||||
quantity: IQuantity_DTO;
|
quantity: IQuantity_DTO;
|
||||||
description: string;
|
description: string;
|
||||||
unit_price: IMoney_DTO;
|
unit_price: IMoney_DTO;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user