-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Contracts): merchant contract list & language resources (#789)
- Loading branch information
Showing
11 changed files
with
316 additions
and
116 deletions.
There are no files selected for viewing
116 changes: 116 additions & 0 deletions
116
...rc/app/[lang]/app/[type]/parties/[partyName]/[partyId]/contracts/[contractId]/details.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 |
---|---|---|
@@ -0,0 +1,116 @@ | ||
"use client"; | ||
import type { UniRefund_ContractService_ContractsForMerchant_ContractHeaders_ContractHeaderDetailForMerchantDto as ContractHeaderDetailForMerchantDto } from "@ayasofyazilim/saas/ContractService"; | ||
import { $UniRefund_ContractService_ContractsForMerchant_ContractHeaders_ContractHeaderDetailForMerchantDto as $ContractHeaderDetailForMerchantDto } from "@ayasofyazilim/saas/ContractService"; | ||
import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; | ||
import AutoForm from "@repo/ayasofyazilim-ui/organisms/auto-form"; | ||
import { | ||
SectionLayout, | ||
SectionLayoutContent, | ||
} from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; | ||
import type { ContractServiceResource } from "src/language-data/ContractService"; | ||
|
||
interface DetailsProp { | ||
contractHeaderDetails: ContractHeaderDetailForMerchantDto; | ||
partyName: "merchants"; | ||
partyId: string; | ||
languageData: ContractServiceResource; | ||
} | ||
export default function Details({ ...props }: DetailsProp) { | ||
const { languageData } = props; | ||
return ( | ||
<SectionLayout | ||
defaultActiveSectionId="contract" | ||
sections={[ | ||
{ | ||
id: "contract", | ||
name: languageData["Contracts.Create.ContractHeader"], | ||
}, | ||
{ | ||
id: "rebate-setting", | ||
name: languageData["Contracts.Create.RebateSettings"], | ||
disabled: false, | ||
}, | ||
{ | ||
id: "contract-settings", | ||
name: languageData["Contracts.Create.ContractSettings"], | ||
disabled: false, | ||
}, | ||
]} | ||
vertical | ||
> | ||
<ContractSection {...props} /> | ||
<RebateSettingsSection {...props} /> | ||
{/* <StoresSection {...props} /> */} | ||
<ContractSettingsSection {...props} /> | ||
</SectionLayout> | ||
); | ||
} | ||
|
||
function ContractSection({ ...props }: DetailsProp) { | ||
const $DetailsSchema = createZodObject( | ||
$ContractHeaderDetailForMerchantDto, | ||
[ | ||
"name", | ||
"webSite", | ||
"merchantClassification", | ||
"status", | ||
"isDraft", | ||
"addressCommonData", | ||
"contractHeaderRefundTableHeaders", | ||
], | ||
undefined, | ||
{ | ||
merchantBasicInformationDto: ["name", "numberOfStores"], | ||
addressCommonData: [ | ||
"countryId", | ||
"regionId", | ||
"cityId", | ||
"districtId", | ||
"neighborhoodId", | ||
"addressLine", | ||
"type", | ||
], | ||
}, | ||
); | ||
|
||
return ( | ||
<SectionLayoutContent sectionId="contract"> | ||
<AutoForm | ||
className="grid gap-2 space-y-0 md:grid-cols-2" | ||
fieldConfig={{ | ||
isDraft: { | ||
fieldType: "switch", | ||
}, | ||
merchantBasicInformationDto: { | ||
className: | ||
"md:col-span-2 md:grid md:grid-cols-2 md:space-y-0 md:gap-2", | ||
}, | ||
addressCommonData: { | ||
className: "md:col-span-2", | ||
}, | ||
contractHeaderRefundTableHeaders: { | ||
className: "md:col-span-2", | ||
}, | ||
}} | ||
formSchema={$DetailsSchema} | ||
values={props.contractHeaderDetails} | ||
/> | ||
</SectionLayoutContent> | ||
); | ||
} | ||
|
||
function ContractSettingsSection({ languageData }: DetailsProp) { | ||
return ( | ||
<SectionLayoutContent sectionId="contract-settings"> | ||
<>{languageData["Contracts.Create.ContractSettings"]}</> | ||
</SectionLayoutContent> | ||
); | ||
} | ||
|
||
function RebateSettingsSection({ languageData }: DetailsProp) { | ||
return ( | ||
<SectionLayoutContent sectionId="rebate-setting"> | ||
<>{languageData["Contracts.Create.RebateSettings"]}</> | ||
</SectionLayoutContent> | ||
); | ||
} |
34 changes: 28 additions & 6 deletions
34
...b/src/app/[lang]/app/[type]/parties/[partyName]/[partyId]/contracts/[contractId]/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
82 changes: 0 additions & 82 deletions
82
apps/web/src/app/[lang]/app/[type]/parties/[partyName]/[partyId]/contracts/action.ts
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.