Skip to content

Commit

Permalink
feat(templates/refund-fee): add details (#896)
Browse files Browse the repository at this point in the history
  • Loading branch information
yusualhashash authored Nov 28, 2024
2 parents a6e74cc + e81f7b2 commit 7780031
Show file tree
Hide file tree
Showing 9 changed files with 193 additions and 345 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"use client";
import type {
UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderDto,
UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderUpdateDto,
} from "@ayasofyazilim/saas/ContractService";
import { $UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderUpdateDto } from "@ayasofyazilim/saas/ContractService";
import { SchemaForm } from "@repo/ayasofyazilim-ui/organisms/schema-form";
import { createUiSchemaWithResource } from "@repo/ayasofyazilim-ui/organisms/schema-form/utils";
import { useRouter } from "next/navigation";
import { handlePutResponse } from "src/app/[lang]/app/actions/api-utils-client";
import { putRefundFeeHeadersApi } from "src/app/[lang]/app/actions/ContractService/put-actions";
import type { ContractServiceResource } from "src/language-data/ContractService";

function Form({
response,
languageData,
}: {
response: UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderDto;
languageData: ContractServiceResource;
}) {
const router = useRouter();
const uiSchema = createUiSchemaWithResource({
resources: languageData,
schema:
$UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderUpdateDto,
});
return (
<SchemaForm
fields={{}}
formData={response}
onSubmit={(data) => {
const formData = {
id: response.id,
requestBody:
data.formData as UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderUpdateDto,
};
void putRefundFeeHeadersApi(formData).then((res) => {
handlePutResponse(res, router);
});
}}
schema={
$UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderUpdateDto
}
submitText={languageData.Save}
uiSchema={uiSchema}
/>
);
}

export default Form;
Loading

0 comments on commit 7780031

Please sign in to comment.