-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: saas change & uncomment refund fee details (#901)
- Loading branch information
Showing
14 changed files
with
112 additions
and
524 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
173 changes: 81 additions & 92 deletions
173
apps/web/src/app/[lang]/app/[type]/settings/templates/refund-fees/[id]/table.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,86 @@ | ||
"use client"; | ||
// import { UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderDto } from "@ayasofyazilim/saas/ContractService"; | ||
// import type { | ||
// UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailCreateDto, | ||
// UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderDto, | ||
// } from "@ayasofyazilim/saas/ContractService"; | ||
import { $UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailCreateByListDto } from "@ayasofyazilim/saas/ContractService"; | ||
import type { | ||
UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailCreateDto, | ||
UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderDto, | ||
} from "@ayasofyazilim/saas/ContractService"; | ||
import { tanstackTableEditableColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; | ||
import { SchemaForm } from "@repo/ayasofyazilim-ui/organisms/schema-form"; | ||
import { TableField } from "@repo/ayasofyazilim-ui/organisms/schema-form/fields"; | ||
import { PlusCircle, Trash2 } from "lucide-react"; | ||
import { useRouter } from "next/navigation"; | ||
import { handlePostResponse } from "src/app/[lang]/app/actions/api-utils-client"; | ||
import { postRefundFeeHeadersRefundFeeDetailsApi } from "src/app/[lang]/app/actions/ContractService/post-actions"; | ||
import type { ContractServiceResource } from "src/language-data/ContractService"; | ||
|
||
// import { $UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailCreateByListDto } from "@ayasofyazilim/saas/ContractService"; | ||
// import { tanstackTableEditableColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; | ||
// import { SchemaForm } from "@repo/ayasofyazilim-ui/organisms/schema-form"; | ||
// import { TableField } from "@repo/ayasofyazilim-ui/organisms/schema-form/fields"; | ||
// import { PlusCircle, Trash2 } from "lucide-react"; | ||
// import { useRouter } from "next/navigation"; | ||
// import { handlePostResponse } from "src/app/[lang]/app/actions/api-utils-client"; | ||
// import { postRefundFeeHeadersRefundFeeDetailsApi } from "src/app/[lang]/app/actions/ContractService/post-actions"; | ||
// import type { ContractServiceResource } from "src/language-data/ContractService"; | ||
type TypeWithId<Type, IdType = string> = Type & { | ||
id: IdType; | ||
}; | ||
|
||
// type TypeWithId<Type, IdType = string> = Type & { | ||
// id: IdType; | ||
// }; | ||
export default function RefundFeeDetailsForm({ | ||
response, | ||
languageData, | ||
}: { | ||
response: UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderDto; | ||
languageData: ContractServiceResource; | ||
}) { | ||
const router = useRouter(); | ||
const RebateFeeColumns = tanstackTableEditableColumnsByRowData< | ||
TypeWithId<UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailCreateDto> | ||
>({ | ||
rows: $UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailCreateByListDto | ||
.properties.refundFeeDetails.items.properties, | ||
excludeColumns: ["extraProperties"], | ||
}); | ||
return ( | ||
<SchemaForm | ||
fields={{ | ||
RebateTable: TableField< | ||
TypeWithId<UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailCreateDto> | ||
>({ | ||
editable: true, | ||
columns: RebateFeeColumns, | ||
data: response.refundFeeDetails || [], | ||
fillerColumn: "id", | ||
tableActions: [ | ||
{ | ||
type: "create-row", | ||
actionLocation: "table", | ||
cta: languageData["Rebate.Create"], | ||
icon: PlusCircle, | ||
}, | ||
], | ||
rowActions: [ | ||
{ | ||
actionLocation: "row", | ||
cta: languageData.Delete, | ||
icon: Trash2, | ||
type: "delete-row", | ||
}, | ||
], | ||
}), | ||
}} | ||
formData={response.refundFeeDetails || []} | ||
onSubmit={(data) => { | ||
const formData = data.formData; | ||
|
||
export default function RefundFeeDetailsForm() { | ||
// { | ||
// // response, | ||
// // languageData, | ||
// }: { | ||
// // response: UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderDto; | ||
// // languageData: ContractServiceResource; | ||
// }, | ||
return null; | ||
// const router = useRouter(); | ||
// const RebateFeeColumns = tanstackTableEditableColumnsByRowData< | ||
// TypeWithId<UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailCreateDto> | ||
// >({ | ||
// rows: $UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailCreateByListDto | ||
// .properties.refundFeeDetails.items.properties, | ||
// excludeColumns: ["extraProperties"], | ||
// }); | ||
// return ( | ||
// <SchemaForm | ||
// fields={{ | ||
// RebateTable: TableField< | ||
// TypeWithId<UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailCreateDto> | ||
// >({ | ||
// editable: true, | ||
// showPagination: false, | ||
// columns: RebateFeeColumns, | ||
// data: response.refundFeeDetails || [], | ||
// fillerColumn: "id", | ||
// tableActions: [ | ||
// { | ||
// type: "create-row", | ||
// actionLocation: "table", | ||
// cta: languageData[ | ||
// "RebateTables.Templates.Form.rebateTableDetails.add" | ||
// ], | ||
// icon: PlusCircle, | ||
// }, | ||
// ], | ||
// rowActions: [ | ||
// { | ||
// actionLocation: "row", | ||
// cta: languageData[ | ||
// "RebateTables.Templates.Form.rebateTableDetails.delete" | ||
// ], | ||
// icon: Trash2, | ||
// type: "delete-row", | ||
// }, | ||
// ], | ||
// }), | ||
// }} | ||
// formData={response.refundFeeDetails || []} | ||
// onSubmit={(data) => { | ||
// const formData = (data.formData || | ||
// []) as UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailCreateDto[]; | ||
|
||
// void postRefundFeeHeadersRefundFeeDetailsApi({ | ||
// id: response.id, | ||
// requestBody: { | ||
// // @ts-expect-error UNI-582 | ||
// refundFeeDetails: formData, | ||
// }, | ||
// }).then((res) => { | ||
// handlePostResponse(res, router); | ||
// }); | ||
// }} | ||
// schema={ | ||
// $UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailCreateByListDto | ||
// .properties.refundFeeDetails | ||
// } | ||
// submitText={languageData["RefundTables.Create.Submit"]} | ||
// uiSchema={{ | ||
// "ui:field": "RebateTable", | ||
// }} | ||
// /> | ||
// ); | ||
void postRefundFeeHeadersRefundFeeDetailsApi({ | ||
id: response.id, | ||
requestBody: { | ||
refundFeeDetails: formData, | ||
}, | ||
}).then((res) => { | ||
handlePostResponse(res, router); | ||
}); | ||
}} | ||
schema={ | ||
$UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailCreateByListDto | ||
.properties.refundFeeDetails | ||
} | ||
submitText={languageData["RefundTables.Create.Submit"]} | ||
uiSchema={{ | ||
"ui:field": "RebateTable", | ||
}} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/web/src/app/[lang]/app/[type]/settings/templates/refund-tables/[id]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.