From 423a2b827e72eaef6d32b788099720d2fbcefff2 Mon Sep 17 00:00:00 2001 From: eren-ayasofyazilim <163110882+eren-ayasofyazilim@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:41:53 +0300 Subject: [PATCH] Revert "chore:update main branch" --- .github/workflows/publish-dev.yml | 2 +- .../unirefund/ContractService/action.ts | 278 ---------- .../ContractService/delete-actions.ts | 24 - .../unirefund/ContractService/post-actions.ts | 137 ----- .../unirefund/ContractService/put-actions.ts | 70 --- .../actions/unirefund/CrmService/actions.ts | 137 ----- .../unirefund/CrmService/post-actions.ts | 23 - .../unirefund/CrmService/put-actions.ts | 123 ----- .../src/actions/unirefund/CrmService/types.ts | 21 - .../ExportValidationService/actions.ts | 34 -- .../ExportValidationService/post-actions.ts | 16 - .../ExportValidationService/put-actions.ts | 16 - .../unirefund/FinanceService/actions.ts | 33 -- .../unirefund/FinanceService/post-actions.ts | 14 - .../unirefund/FinanceService/put-actions.ts | 16 - .../unirefund/LocationService/actions.ts | 72 --- .../unirefund/LocationService/schemas.tsx | 220 -------- .../unirefund/LocationService/types.ts | 20 - .../LocationService/use-address-hook.tsx.tsx | 97 ---- .../unirefund/LocationService/utils.ts | 97 ---- .../unirefund/RefundService/actions.ts | 14 - .../actions/unirefund/SaasService/actions.ts | 26 - .../unirefund/SaasService/put-actions.ts | 16 - .../actions/unirefund/TagService/actions.ts | 31 -- .../unirefund/TravellerService/actions.ts | 43 -- .../TravellerService/post-actions.ts | 31 -- .../unirefund/TravellerService/put-actions.ts | 45 -- .../finance/billing/[billingId]/form.tsx | 100 ---- .../finance/billing/[billingId]/page.tsx | 55 -- .../(unirefund)/finance/billing/new/form.tsx | 98 ---- .../(unirefund)/finance/billing/new/page.tsx | 37 -- .../(unirefund)/finance/billing/page.tsx | 25 - .../finance/billing/table-data.tsx | 126 ----- .../(unirefund)/finance/billing/table.tsx | 31 -- .../app/[lang]/(unirefund)/home/charts.tsx | 512 ------------------ .../src/app/[lang]/(unirefund)/home/page.tsx | 5 - .../[tagId]/_components/merchant-details.tsx | 54 -- .../[tagId]/_components/tag-summary.tsx | 146 ----- .../details/[tagId]/_components/totals.tsx | 33 -- .../[tagId]/_components/traveller-details.tsx | 62 --- .../operations/details/[tagId]/page.tsx | 28 - .../operations/details/[tagId]/utils.ts | 44 -- .../(unirefund)/operations/details/actions.ts | 104 ---- .../operations/details/add/page.tsx | 323 ----------- .../(unirefund)/operations/details/data.ts | 352 ------------ .../(unirefund)/operations/details/page.tsx | 14 - .../(unirefund)/operations/details/table.tsx | 274 ---------- .../(unirefund)/operations/details/utils.ts | 92 ---- .../export-validation/[exportId]/form.tsx | 102 ---- .../export-validation/[exportId]/page.tsx | 33 -- .../operations/export-validation/new/form.tsx | 106 ---- .../operations/export-validation/new/page.tsx | 21 - .../operations/export-validation/page.tsx | 167 ------ .../[lang]/(unirefund)/operations/filter.ts | 112 ---- .../parties/[partyName]/[partyId]/action.ts | 336 ------------ .../[partyName]/[partyId]/address/form.tsx | 101 ---- .../_components/contract-settings.tsx | 418 -------------- .../[contractId]/contract-settings/page.tsx | 53 -- .../contract/_components/merchant/index.tsx | 177 ------ .../_components/refund-point/index.tsx | 175 ------ .../contracts/[contractId]/contract/page.tsx | 77 --- .../contracts/[contractId]/layout.tsx | 126 ----- .../_components/rebate-settings.tsx | 408 -------------- .../[contractId]/rebate-settings/page.tsx | 47 -- .../stores/_components/table-data.tsx | 91 ---- .../[contractId]/stores/_components/table.tsx | 104 ---- .../contracts/[contractId]/stores/page.tsx | 48 -- .../contract-header-form/merchant/index.tsx | 283 ---------- .../refund-point/index.tsx | 293 ---------- .../_components/contract-widgets.tsx | 179 ------ .../contracts/_components/table-data.tsx | 116 ---- .../[partyId]/contracts/_components/types.ts | 1 - .../[partyId]/contracts/new/page.tsx | 128 ----- .../[partyName]/[partyId]/contracts/table.tsx | 37 -- .../[partyName]/[partyId]/email/form.tsx | 70 --- .../[partyId]/individuals-table/form.tsx | 143 ----- .../[partyId]/individuals-table/table.tsx | 55 -- .../[partyName]/[partyId]/merchant/form.tsx | 119 ---- .../[partyName]/[partyId]/name/form.tsx | 63 --- .../[partyId]/organization/form.tsx | 68 --- .../parties/[partyName]/[partyId]/page.tsx | 216 -------- .../[partyId]/personal-summaries/form.tsx | 63 --- .../[partyId]/subcompanies-table/form.tsx | 57 -- .../[partyName]/[partyId]/telephone/form.tsx | 92 ---- .../parties/[partyName]/[partyId]/types.ts | 146 ----- .../[partyName]/[partyId]/update-data.tsx | 54 -- .../parties/[partyName]/[partyId]/utils.tsx | 36 -- .../(unirefund)/parties/[partyName]/action.ts | 78 --- .../[partyName]/new/crm/individual/form.tsx | 219 -------- .../[partyName]/new/crm/organization/form.tsx | 172 ------ .../[partyName]/new/individual/form.tsx | 176 ------ .../parties/[partyName]/new/page-client.tsx | 90 --- .../parties/[partyName]/new/page.tsx | 35 -- .../parties/customs/customs-table-data.tsx | 93 ---- .../(unirefund)/parties/customs/page.tsx | 37 -- .../(unirefund)/parties/customs/table.tsx | 37 -- .../individuals/individuals-table-data.tsx | 125 ----- .../(unirefund)/parties/individuals/page.tsx | 41 -- .../(unirefund)/parties/individuals/table.tsx | 41 -- .../parties/merchants/merchant-table-data.tsx | 140 ----- .../(unirefund)/parties/merchants/page.tsx | 42 -- .../(unirefund)/parties/merchants/table.tsx | 41 -- .../parties/refund-points/page.tsx | 39 -- .../refund-points-table-data.tsx | 98 ---- .../parties/refund-points/table.tsx | 41 -- .../[lang]/(unirefund)/parties/table-data.tsx | 261 --------- .../(unirefund)/parties/tax-free/page.tsx | 37 -- .../(unirefund)/parties/tax-free/table.tsx | 37 -- .../parties/tax-free/tax-free-table-data.tsx | 95 ---- .../(unirefund)/parties/tax-offices/page.tsx | 39 -- .../(unirefund)/parties/tax-offices/table.tsx | 41 -- .../tax-offices/tax-offices-table-data.tsx | 95 ---- .../parties/travellers/[travellerId]/form.tsx | 161 ------ .../identification-table-data.tsx | 120 ---- .../[identificationId]/form.tsx | 128 ----- .../[identificationId]/page.tsx | 52 -- .../[travellerId]/identification/new/form.tsx | 117 ---- .../[travellerId]/identification/new/page.tsx | 50 -- .../parties/travellers/[travellerId]/page.tsx | 40 -- .../parties/travellers/new/form.tsx | 99 ---- .../parties/travellers/new/page.tsx | 28 - .../(unirefund)/parties/travellers/page.tsx | 55 -- .../(unirefund)/parties/travellers/table.tsx | 45 -- .../travellers/travellers-table-data.tsx | 140 ----- .../app/[lang]/(unirefund)/parties/types.ts | 71 --- .../[lang]/(unirefund)/refund/new/page.tsx | 3 - .../app/[lang]/(unirefund)/refund/page.tsx | 33 -- .../[lang]/(unirefund)/refund/table-data.tsx | 111 ---- .../app/[lang]/(unirefund)/refund/table.tsx | 34 -- .../app/[lang]/(unirefund)/settings/data.ts | 71 --- .../settings/product/[data]/page.tsx | 297 ---------- .../(unirefund)/settings/templates/page.tsx | 6 - .../settings/templates/rebate/[id]/page.tsx | 37 -- .../settings/templates/rebate/new/layout.tsx | 57 -- .../settings/templates/rebate/new/page.tsx | 7 - .../templates/rebate/new/preview/page.tsx | 337 ------------ .../settings/templates/rebate/page.tsx | 30 - .../settings/templates/rebate/rebate-form.tsx | 250 --------- .../settings/templates/rebate/table-data.tsx | 95 ---- .../settings/templates/rebate/table.tsx | 29 - .../templates/refund-fees/[id]/form.tsx | 47 -- .../templates/refund-fees/[id]/page.tsx | 45 -- .../templates/refund-fees/[id]/table.tsx | 124 ----- .../settings/templates/refund-fees/page.tsx | 35 -- .../templates/refund-fees/table-data.tsx | 104 ---- .../settings/templates/refund-fees/table.tsx | 37 -- .../templates/refund-tables/[id]/form.tsx | 46 -- .../templates/refund-tables/[id]/page.tsx | 45 -- .../templates/refund-tables/[id]/table.tsx | 86 --- .../settings/templates/refund-tables/page.tsx | 35 -- .../templates/refund-tables/table-data.tsx | 117 ---- .../templates/refund-tables/table.tsx | 37 -- .../unirefund/CRMService/index.ts | 31 -- .../unirefund/CRMService/resources/en.json | 87 --- .../unirefund/CRMService/resources/tr.json | 87 --- .../unirefund/ContractService/index.ts | 31 -- .../ContractService/resources/en.json | 304 ----------- .../ContractService/resources/tr.json | 304 ----------- .../ExportValidationService/index.ts | 32 -- .../ExportValidationService/resources/en.json | 36 -- .../ExportValidationService/resources/tr.json | 36 -- .../unirefund/FinanceService/index.ts | 32 -- .../FinanceService/resources/en.json | 34 -- .../FinanceService/resources/tr.json | 34 -- .../unirefund/TravellerService/index.ts | 32 -- .../TravellerService/resources/en.json | 52 -- .../TravellerService/resources/tr.json | 52 -- .../language-data/unirefund/language-data.ts | 18 - 168 files changed, 1 insertion(+), 15704 deletions(-) delete mode 100644 apps/web/src/actions/unirefund/ContractService/action.ts delete mode 100644 apps/web/src/actions/unirefund/ContractService/delete-actions.ts delete mode 100644 apps/web/src/actions/unirefund/ContractService/post-actions.ts delete mode 100644 apps/web/src/actions/unirefund/ContractService/put-actions.ts delete mode 100644 apps/web/src/actions/unirefund/CrmService/actions.ts delete mode 100644 apps/web/src/actions/unirefund/CrmService/post-actions.ts delete mode 100644 apps/web/src/actions/unirefund/CrmService/put-actions.ts delete mode 100644 apps/web/src/actions/unirefund/CrmService/types.ts delete mode 100644 apps/web/src/actions/unirefund/ExportValidationService/actions.ts delete mode 100644 apps/web/src/actions/unirefund/ExportValidationService/post-actions.ts delete mode 100644 apps/web/src/actions/unirefund/ExportValidationService/put-actions.ts delete mode 100644 apps/web/src/actions/unirefund/FinanceService/actions.ts delete mode 100644 apps/web/src/actions/unirefund/FinanceService/post-actions.ts delete mode 100644 apps/web/src/actions/unirefund/FinanceService/put-actions.ts delete mode 100644 apps/web/src/actions/unirefund/LocationService/actions.ts delete mode 100644 apps/web/src/actions/unirefund/LocationService/schemas.tsx delete mode 100644 apps/web/src/actions/unirefund/LocationService/types.ts delete mode 100644 apps/web/src/actions/unirefund/LocationService/use-address-hook.tsx.tsx delete mode 100644 apps/web/src/actions/unirefund/LocationService/utils.ts delete mode 100644 apps/web/src/actions/unirefund/RefundService/actions.ts delete mode 100644 apps/web/src/actions/unirefund/SaasService/actions.ts delete mode 100644 apps/web/src/actions/unirefund/SaasService/put-actions.ts delete mode 100644 apps/web/src/actions/unirefund/TagService/actions.ts delete mode 100644 apps/web/src/actions/unirefund/TravellerService/actions.ts delete mode 100644 apps/web/src/actions/unirefund/TravellerService/post-actions.ts delete mode 100644 apps/web/src/actions/unirefund/TravellerService/put-actions.ts delete mode 100644 apps/web/src/app/[lang]/(unirefund)/finance/billing/[billingId]/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/finance/billing/[billingId]/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/finance/billing/new/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/finance/billing/new/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/finance/billing/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/finance/billing/table-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/finance/billing/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/home/charts.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/home/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/_components/merchant-details.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/_components/tag-summary.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/_components/totals.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/_components/traveller-details.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/utils.ts delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/details/actions.ts delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/details/add/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/details/data.ts delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/details/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/details/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/details/utils.ts delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/export-validation/[exportId]/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/export-validation/[exportId]/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/export-validation/new/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/export-validation/new/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/export-validation/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/operations/filter.ts delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/action.ts delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/address/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract-settings/_components/contract-settings.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract-settings/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract/_components/merchant/index.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract/_components/refund-point/index.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/layout.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/rebate-settings/_components/rebate-settings.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/rebate-settings/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/stores/_components/table-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/stores/_components/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/stores/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/contract-header-form/merchant/index.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/contract-header-form/refund-point/index.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/contract-widgets.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/table-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/types.ts delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/new/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/email/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/individuals-table/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/individuals-table/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/merchant/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/name/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/organization/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/personal-summaries/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/subcompanies-table/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/telephone/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/types.ts delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/update-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/utils.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/action.ts delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/crm/individual/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/crm/organization/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/individual/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/page-client.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/customs/customs-table-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/customs/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/customs/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/individuals/individuals-table-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/individuals/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/individuals/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/merchants/merchant-table-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/merchants/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/merchants/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/refund-points/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/refund-points/refund-points-table-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/refund-points/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/table-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/tax-free/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/tax-free/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/tax-free/tax-free-table-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/tax-offices/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/tax-offices/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/tax-offices/tax-offices-table-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification-table-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification/[identificationId]/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification/[identificationId]/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification/new/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification/new/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/travellers/new/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/travellers/new/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/travellers/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/travellers/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/travellers/travellers-table-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/parties/types.ts delete mode 100644 apps/web/src/app/[lang]/(unirefund)/refund/new/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/refund/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/refund/table-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/refund/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/data.ts delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/product/[data]/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/[id]/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/new/layout.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/new/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/new/preview/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/rebate-form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/table-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/[id]/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/[id]/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/[id]/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/table-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/[id]/form.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/[id]/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/[id]/table.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/page.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/table-data.tsx delete mode 100644 apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/table.tsx delete mode 100644 apps/web/src/language-data/unirefund/CRMService/index.ts delete mode 100644 apps/web/src/language-data/unirefund/CRMService/resources/en.json delete mode 100644 apps/web/src/language-data/unirefund/CRMService/resources/tr.json delete mode 100644 apps/web/src/language-data/unirefund/ContractService/index.ts delete mode 100644 apps/web/src/language-data/unirefund/ContractService/resources/en.json delete mode 100644 apps/web/src/language-data/unirefund/ContractService/resources/tr.json delete mode 100644 apps/web/src/language-data/unirefund/ExportValidationService/index.ts delete mode 100644 apps/web/src/language-data/unirefund/ExportValidationService/resources/en.json delete mode 100644 apps/web/src/language-data/unirefund/ExportValidationService/resources/tr.json delete mode 100644 apps/web/src/language-data/unirefund/FinanceService/index.ts delete mode 100644 apps/web/src/language-data/unirefund/FinanceService/resources/en.json delete mode 100644 apps/web/src/language-data/unirefund/FinanceService/resources/tr.json delete mode 100644 apps/web/src/language-data/unirefund/TravellerService/index.ts delete mode 100644 apps/web/src/language-data/unirefund/TravellerService/resources/en.json delete mode 100644 apps/web/src/language-data/unirefund/TravellerService/resources/tr.json delete mode 100644 apps/web/src/language-data/unirefund/language-data.ts diff --git a/.github/workflows/publish-dev.yml b/.github/workflows/publish-dev.yml index d616be6af..6ecdfd02a 100644 --- a/.github/workflows/publish-dev.yml +++ b/.github/workflows/publish-dev.yml @@ -83,4 +83,4 @@ jobs: runs-on: self-hosted steps: - name: Run Core - run: ssh ubuntu "cd ~/frontend/unirefund_dev && chmod 777 publish.sh && ./publish.sh 1453 unirefund_web" + run: ssh ubuntu "cd ~/frontend/core_dev && chmod 777 publish.sh && ./publish.sh 1400 core_web" diff --git a/apps/web/src/actions/unirefund/ContractService/action.ts b/apps/web/src/actions/unirefund/ContractService/action.ts deleted file mode 100644 index 49ec4b33d..000000000 --- a/apps/web/src/actions/unirefund/ContractService/action.ts +++ /dev/null @@ -1,278 +0,0 @@ -"use server"; -import type { - GetApiContractServiceMerchantsByIdContractsContractHeadersData, - GetApiContractServiceMerchantsContractsContractHeadersByIdContractSettingsData, - GetApiContractServiceMerchantsContractsContractHeadersByIdContractStoresData, - GetApiContractServiceRebateTablesRebateTableHeadersTemplatesData, - GetApiContractServiceRefundPointsByIdContractsContractHeadersData, - GetApiContractServiceRefundTablesRefundFeeHeadersByIdData, - GetApiContractServiceRefundTablesRefundFeeHeadersData, - GetApiContractServiceRefundTablesRefundTableHeadersByIdData, - GetApiContractServiceRefundTablesRefundTableHeadersData, - PostApiContractServiceMerchantsByIdContractsContractHeadersData, - PostApiContractServiceMerchantsContractsContractHeadersByIdContractSettingsData, - PostApiContractServiceMerchantsContractsContractHeadersByIdContractStoresData, - PutApiContractServiceMerchantsContractsContractHeadersByIdSetDefaultSettingData, - PutApiContractServiceMerchantsContractsContractSettingsByIdData, -} from "@ayasofyazilim/saas/ContractService"; -import { - getContractServiceClient, - structuredError, - structuredResponse, -} from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function getMerchantContractHeadersByMerchantIdApi( - data: GetApiContractServiceMerchantsByIdContractsContractHeadersData, -) { - try { - const requests = await getApiRequests(); - const dataResponse = - await requests.merchants.getContractHeadersByMerchantId(data); - return structuredResponse(dataResponse); - } catch (error) { - return structuredError(error); - } -} -export async function getMerchantContractHeaderMissingStepsByIdApi(id: string) { - try { - const requests = await getApiRequests(); - const response = - await requests.merchants.getContractHeaderMissingStepsById(id); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function postMerchantContractHeadersByMerchantIdApi( - data: PostApiContractServiceMerchantsByIdContractsContractHeadersData, -) { - try { - const requests = await getApiRequests(); - const response = await requests.merchants.postContractHeadersById(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function getMerchantContractHeadersContractStoresByHeaderIdApi( - data: GetApiContractServiceMerchantsContractsContractHeadersByIdContractStoresData, -) { - try { - const requests = await getApiRequests(); - const response = - await requests.merchants.getContractHeadersContractStoresByHeaderId(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function postMerchantContractHeadersContractStoresByHeaderIdApi( - data: PostApiContractServiceMerchantsContractsContractHeadersByIdContractStoresData, -) { - try { - const requests = await getApiRequests(); - const response = - await requests.merchants.postContractHeadersContractStoresByHeaderId( - data, - ); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function getMerchantContractHeaderByIdApi(id: string) { - try { - const requests = await getApiRequests(); - const response = await requests.merchants.getContractHeaderById(id); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function getMerchantContractHeaderRebateSettingsByHeaderIdApi( - id: string, -) { - try { - const requests = await getContractServiceClient(); - return structuredResponse( - await requests.contractsMerchant.getApiContractServiceMerchantsContractsContractHeadersByIdRebateSettings( - { - id, - }, - ), - ); - } catch (error) { - return structuredError(error); - } -} -export async function getMerchantContractHeaderContractSettingsByHeaderIdApi( - data: GetApiContractServiceMerchantsContractsContractHeadersByIdContractSettingsData, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests.merchants.getContractHeaderContractSettingsByHeaderId( - data, - ), - ); - } catch (error) { - return structuredError(error); - } -} -export async function postMerchantContractHeaderContractSettingsByHeaderIdApi( - data: PostApiContractServiceMerchantsContractsContractHeadersByIdContractSettingsData, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests.merchants.postContractHeaderContractSettingsByHeaderId( - data, - ), - ); - } catch (error) { - return structuredError(error); - } -} -export async function putMerchantContractContractSettingsByIdApi( - data: PutApiContractServiceMerchantsContractsContractSettingsByIdData, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests.merchants.putContractSettingsById(data), - ); - } catch (error) { - return structuredError(error); - } -} -export async function deleteMerchantContractContractSettingsByIdApi( - id: string, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests.merchants.deleteContractSettingsById(id), - ); - } catch (error) { - return structuredError(error); - } -} -export async function putMerchantContractContractHeaderSetDefaultContractSettingByHeaderIdApi( - data: PutApiContractServiceMerchantsContractsContractHeadersByIdSetDefaultSettingData, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests.merchants.putContractHeaderSetDefaultContractSettingByHeaderId( - data, - ), - ); - } catch (error) { - return structuredError(error); - } -} - -export async function getRefundTableHeadersApi( - data: GetApiContractServiceRefundTablesRefundTableHeadersData, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests.templates.getRefundTableHeaders(data), - ); - } catch (error) { - return structuredError(error); - } -} -export async function getRefundTableHeadersById( - data: GetApiContractServiceRefundTablesRefundTableHeadersByIdData, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests.templates.getRefundTableHeadersById(data), - ); - } catch (error) { - return structuredError(error); - } -} -export async function getRefundFeeHeadersApi( - data: GetApiContractServiceRefundTablesRefundFeeHeadersData, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests.templates.getRefundFeeHeaders(data), - ); - } catch (error) { - return structuredError(error); - } -} -export async function getRefundFeeHeadersByIdApi( - data: GetApiContractServiceRefundTablesRefundFeeHeadersByIdData, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests.templates.getRefundFeeHeadersById(data), - ); - } catch (error) { - return structuredError(error); - } -} -export async function getRebateTableHeadersApi( - data: GetApiContractServiceRebateTablesRebateTableHeadersTemplatesData, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests.templates.getRebateTableHeaders(data), - ); - } catch (error) { - return structuredError(error); - } -} -export async function getRebateTableHeadersByIdApi(id: string) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests.templates.getRebateTableHeadersById(id), - ); - } catch (error) { - return structuredError(error); - } -} - -export async function getRefundPointContractHeadersByRefundPointIdApi( - data: GetApiContractServiceRefundPointsByIdContractsContractHeadersData, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests["refund-points"].getContractHeadersByRefundPointId(data), - ); - } catch (error) { - return structuredError(error); - } -} -export async function getRefundPointContractHeaderMissingStepsById(id: string) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests["refund-points"].getContractHeaderMissingStepsById(id), - ); - } catch (error) { - return structuredError(error); - } -} -export async function getRefundPointContractHeaderById(id: string) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests["refund-points"].getContractHeaderById(id), - ); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/ContractService/delete-actions.ts b/apps/web/src/actions/unirefund/ContractService/delete-actions.ts deleted file mode 100644 index 7b0dac25f..000000000 --- a/apps/web/src/actions/unirefund/ContractService/delete-actions.ts +++ /dev/null @@ -1,24 +0,0 @@ -"use server"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function deleteMerchantContractHeaderByIdApi(id: string) { - try { - const requests = await getApiRequests(); - const response = await requests.merchants.deleteContractHeadersById(id); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} - -export async function deleteRefundPointContractHeadersById(id: string) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests["refund-points"].deleteContractHeadersById(id), - ); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/ContractService/post-actions.ts b/apps/web/src/actions/unirefund/ContractService/post-actions.ts deleted file mode 100644 index 95a5099f1..000000000 --- a/apps/web/src/actions/unirefund/ContractService/post-actions.ts +++ /dev/null @@ -1,137 +0,0 @@ -"use server"; - -import type { - PostApiContractServiceMerchantsContractsContractHeadersByIdContractStoresData, - PostApiContractServiceMerchantsContractsContractHeadersByIdRebateSettingsData, - PostApiContractServiceRebateTablesRebateTableHeadersTemplatesData, - PostApiContractServiceRefundPointsByIdContractsContractHeadersData, - PostApiContractServiceRefundTablesRefundFeeHeadersByIdRefundFeeDetailsData, - PostApiContractServiceRefundTablesRefundFeeHeadersData, - PostApiContractServiceRefundTablesRefundTableHeadersByIdRefundTableDetailsData, - PostApiContractServiceRefundTablesRefundTableHeadersData, -} from "@ayasofyazilim/saas/ContractService"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function postRefundTableHeadersApi( - data: PostApiContractServiceRefundTablesRefundTableHeadersData, -) { - try { - const requests = await getApiRequests(); - const response = await requests.templates.postRefundTableHeaders(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function postRefundTableHeadersRefundTableDetailsApi( - data: PostApiContractServiceRefundTablesRefundTableHeadersByIdRefundTableDetailsData, -) { - try { - const requests = await getApiRequests(); - const response = - await requests.templates.postRefundTableHeadersRefundTableDetails(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function postRebateTableHeadersApi( - data: PostApiContractServiceRebateTablesRebateTableHeadersTemplatesData, -) { - try { - const requests = await getApiRequests(); - const response = await requests.templates.postRebateTableHeaders(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function postRefundFeeHeadersApi( - data: PostApiContractServiceRefundTablesRefundFeeHeadersData, -) { - try { - const requests = await getApiRequests(); - const response = await requests.templates.postRefundFeeHeaders(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function postRefundFeeHeadersRefundFeeDetailsApi( - data: PostApiContractServiceRefundTablesRefundFeeHeadersByIdRefundFeeDetailsData, -) { - try { - const requests = await getApiRequests(); - const response = - await requests.templates.postRefundFeeHeadersRefundTableDetails(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function postMerchantContractHeaderRebateSettingByHeaderIdApi( - data: PostApiContractServiceMerchantsContractsContractHeadersByIdRebateSettingsData, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests.merchants.postContractHeaderRebateSettingByHeaderId(data), - ); - } catch (error) { - return structuredError(error); - } -} - -export async function postMerchantContractHeaderValidateByHeaderIdApi( - id: string, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests.merchants.postContractHeaderValidateByHeaderId(id), - ); - } catch (error) { - return structuredError(error); - } -} - -export async function postMerchantContractHeaderContractStoresByHeaderIdApi( - data: PostApiContractServiceMerchantsContractsContractHeadersByIdContractStoresData, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests.merchants.postContractHeadersContractStoresByHeaderId( - data, - ), - ); - } catch (error) { - return structuredError(error); - } -} - -export async function postRefundPointContractHeadersById( - data: PostApiContractServiceRefundPointsByIdContractsContractHeadersData, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests["refund-points"].postContractHeadersById(data), - ); - } catch (error) { - return structuredError(error); - } -} -export async function postRefundPointContractHeaderValidateByHeaderId( - id: string, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests["refund-points"].postContractHeaderValidateByHeaderId(id), - ); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/ContractService/put-actions.ts b/apps/web/src/actions/unirefund/ContractService/put-actions.ts deleted file mode 100644 index eebd7b132..000000000 --- a/apps/web/src/actions/unirefund/ContractService/put-actions.ts +++ /dev/null @@ -1,70 +0,0 @@ -"use server"; -import type { - PutApiContractServiceMerchantsContractsContractHeadersByIdData, - PutApiContractServiceRebateTablesRebateTableHeadersByIdData, - PutApiContractServiceRefundPointsContractsContractHeadersByIdData, - PutApiContractServiceRefundTablesRefundFeeHeadersByIdData, - PutApiContractServiceRefundTablesRefundTableHeadersByIdData, -} from "@ayasofyazilim/saas/ContractService"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function putRebateTableHeadersApi( - data: PutApiContractServiceRebateTablesRebateTableHeadersByIdData, -) { - try { - const requests = await getApiRequests(); - const response = await requests.templates.putRebateTableHeaders(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} - -export async function putRefundTableHeadersApi( - data: PutApiContractServiceRefundTablesRefundTableHeadersByIdData, -) { - try { - const requests = await getApiRequests(); - const response = await requests.templates.putRefundTableHeaders(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function putRefundFeeHeadersApi( - data: PutApiContractServiceRefundTablesRefundFeeHeadersByIdData, -) { - try { - const requests = await getApiRequests(); - const response = await requests.templates.putRefundFeeHeadersApi(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} - -export async function putMerchantContractHeadersByIdApi( - data: PutApiContractServiceMerchantsContractsContractHeadersByIdData, -) { - try { - const requests = await getApiRequests(); - const response = await requests.merchants.putContractHeadersById(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} - -export async function putRefundPointContractHeadersById( - data: PutApiContractServiceRefundPointsContractsContractHeadersByIdData, -) { - try { - const requests = await getApiRequests(); - return structuredResponse( - await requests["refund-points"].putContractHeadersById(data), - ); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/CrmService/actions.ts b/apps/web/src/actions/unirefund/CrmService/actions.ts deleted file mode 100644 index 1e575c1ae..000000000 --- a/apps/web/src/actions/unirefund/CrmService/actions.ts +++ /dev/null @@ -1,137 +0,0 @@ -"use server"; -import type { - GetApiCrmServiceCustomsData, - GetApiCrmServiceIndividualsData, - GetApiCrmServiceMerchantsByIdSubMerchantsData, - GetApiCrmServiceMerchantsData, - GetApiCrmServiceMerchantsResponse, - GetApiCrmServiceRefundPointsData, - GetApiCrmServiceTaxFreesData, - GetApiCrmServiceTaxOfficesData, - UniRefund_CRMService_Merchants_StoreProfilePagedResultDto, -} from "@ayasofyazilim/saas/CRMService"; -import type { ServerResponse } from "src/lib"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function getMerchantsApi( - data: GetApiCrmServiceMerchantsData = {}, -): Promise> { - try { - const requests = await getApiRequests(); - const response = await requests.merchants.get(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function getMerchantByIdApi(id: string) { - try { - const requests = await getApiRequests(); - const response = await requests.merchants.getById(id); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function getSubMerchantsByMerchantIdApi( - data: GetApiCrmServiceMerchantsByIdSubMerchantsData, -): Promise< - ServerResponse -> { - try { - const requests = await getApiRequests(); - const response = await requests.merchants.getSubCompanies({ - ...data, - maxResultCount: data.maxResultCount || 10, - skipCount: data.skipCount || 0, - }); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function getTaxFreesApi(data: GetApiCrmServiceTaxFreesData = {}) { - try { - const requests = await getApiRequests(); - const response = await requests["tax-free"].get(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function getRefundPointsApi( - data: GetApiCrmServiceRefundPointsData = {}, -) { - try { - const requests = await getApiRequests(); - const response = await requests["refund-points"].get(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function getRefundPointDetailsByIdApi(id: string) { - try { - const requests = await getApiRequests(); - const response = await requests["refund-points"].getDetail(id); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function getTaxOfficesApi( - data: GetApiCrmServiceTaxOfficesData = {}, -) { - try { - const requests = await getApiRequests(); - const response = await requests["tax-offices"].get(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} - -export async function getCustomsApi(data: GetApiCrmServiceCustomsData = {}) { - try { - const requests = await getApiRequests(); - const response = await requests.customs.get(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} - -export async function getAdressesApi(id: string, partyName: "merchants") { - try { - const requests = await getApiRequests(); - const response = await requests[partyName].getAdresses({ - id, - }); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} - -export async function getIndividualsApi( - data: GetApiCrmServiceIndividualsData = {}, -) { - try { - const requests = await getApiRequests(); - const response = await requests.individuals.get(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} - -export async function getAffiliationCodeApi(partyName: "individuals") { - try { - const requests = await getApiRequests(); - const response = await requests[partyName].getAffiliationCode(); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/CrmService/post-actions.ts b/apps/web/src/actions/unirefund/CrmService/post-actions.ts deleted file mode 100644 index 2358d9b89..000000000 --- a/apps/web/src/actions/unirefund/CrmService/post-actions.ts +++ /dev/null @@ -1,23 +0,0 @@ -"use server"; - -import type { PostApiCrmServiceMerchantsByIdAffiliationsData } from "@ayasofyazilim/saas/CRMService"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function postAffiliationsApi( - partyType: - | "merchants" - | "refund-points" - | "customs" - | "tax-free" - | "tax-offices", - data: PostApiCrmServiceMerchantsByIdAffiliationsData, -) { - try { - const requests = await getApiRequests(); - const response = await requests[partyType].postAffiliations(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/CrmService/put-actions.ts b/apps/web/src/actions/unirefund/CrmService/put-actions.ts deleted file mode 100644 index 1b062f9e8..000000000 --- a/apps/web/src/actions/unirefund/CrmService/put-actions.ts +++ /dev/null @@ -1,123 +0,0 @@ -"use server"; - -import type { - PutApiCrmServiceMerchantsByIdAddressesByAddressIdData, - PutApiCrmServiceMerchantsByIdData, - PutApiCrmServiceMerchantsByIdIndividualByIndividualIdPersonalSummaryByPersonalSummaryIdData, - PutApiCrmServiceMerchantsByIdEmailsByEmailIdData, - PutApiCrmServiceMerchantsByIdOrganizationsByOrganizationIdData, - PutApiCrmServiceMerchantsByIdIndividualByIndividualIdNameByNameIdData, - PutApiCrmServiceMerchantsByIdTelephonesByTelephoneIdData, -} from "@ayasofyazilim/saas/CRMService"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function putMerchantBaseApi( - data: PutApiCrmServiceMerchantsByIdData, -) { - try { - const requests = await getApiRequests(); - const response = await requests.merchants.putMerchantBase(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} - -export async function putCrmAddressApi( - partyName: - | "merchants" - | "refund-points" - | "customs" - | "tax-offices" - | "tax-free", - data: PutApiCrmServiceMerchantsByIdAddressesByAddressIdData, -) { - try { - const requests = await getApiRequests(); - const response = await requests[partyName].putAddress(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} - -export async function putCrmEmailAddressApi( - partyName: - | "merchants" - | "refund-points" - | "customs" - | "tax-offices" - | "tax-free", - data: PutApiCrmServiceMerchantsByIdEmailsByEmailIdData, -) { - try { - const requests = await getApiRequests(); - const response = await requests[partyName].putEmailAddress(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function putCrmTelephoneApi( - partyName: - | "merchants" - | "refund-points" - | "customs" - | "tax-offices" - | "tax-free", - data: PutApiCrmServiceMerchantsByIdTelephonesByTelephoneIdData, -) { - try { - const requests = await getApiRequests(); - const response = await requests[partyName].putTelephone(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} - -export async function putCrmOrganizationApi( - partyName: - | "merchants" - | "refund-points" - | "customs" - | "tax-offices" - | "tax-free", - data: PutApiCrmServiceMerchantsByIdOrganizationsByOrganizationIdData, -) { - try { - const requests = await getApiRequests(); - const response = await requests[partyName].putOrganization(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function putCrmIndividualNameApi( - partyName: "merchants", - - data: PutApiCrmServiceMerchantsByIdIndividualByIndividualIdNameByNameIdData, -) { - try { - const requests = await getApiRequests(); - const response = await requests[partyName].putIndividualName(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} - -export async function putCrmIndividualPersonalSummaryApi( - partyName: "merchants", - data: PutApiCrmServiceMerchantsByIdIndividualByIndividualIdPersonalSummaryByPersonalSummaryIdData, -) { - try { - const requests = await getApiRequests(); - const response = - await requests[partyName].putIndividualPersonalSummary(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/CrmService/types.ts b/apps/web/src/actions/unirefund/CrmService/types.ts deleted file mode 100644 index f3beeb051..000000000 --- a/apps/web/src/actions/unirefund/CrmService/types.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { - UniRefund_CRMService_AffiliationTypes_CreateAffiliationTypeDto, - UniRefund_CRMService_EmailCommonDatas_UpdateEmailCommonDataDto, - UniRefund_CRMService_NameCommonDatas_UpdateNameCommonDataDto, - UniRefund_CRMService_Organizations_UpdateOrganizationDto, - UniRefund_CRMService_TelephoneTypes_UpdateTelephoneTypeDto, - UniRefund_CRMService_PersonalSummaries_UpdatePersonalSummaryDto, -} from "@ayasofyazilim/saas/CRMService"; - -export type EmailAddressUpdateDto = - UniRefund_CRMService_EmailCommonDatas_UpdateEmailCommonDataDto; -export type TelephoneUpdateDto = - UniRefund_CRMService_TelephoneTypes_UpdateTelephoneTypeDto; -export type IndividualPersonalSummariesUpdateDto = - UniRefund_CRMService_PersonalSummaries_UpdatePersonalSummaryDto; -export type IndividualNameUpdateDto = - UniRefund_CRMService_NameCommonDatas_UpdateNameCommonDataDto; -export type OrganizationUpdateDto = - UniRefund_CRMService_Organizations_UpdateOrganizationDto; -export type AffiliationsPostDto = - UniRefund_CRMService_AffiliationTypes_CreateAffiliationTypeDto; diff --git a/apps/web/src/actions/unirefund/ExportValidationService/actions.ts b/apps/web/src/actions/unirefund/ExportValidationService/actions.ts deleted file mode 100644 index df207ce24..000000000 --- a/apps/web/src/actions/unirefund/ExportValidationService/actions.ts +++ /dev/null @@ -1,34 +0,0 @@ -"use server"; -import type { GetApiExportValidationServiceExportValidationData } from "@ayasofyazilim/saas/ExportValidationService"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function getExportValidationApi( - data: GetApiExportValidationServiceExportValidationData = {}, -) { - try { - const requests = await getApiRequests(); - const response = await requests["export-validation"].get(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function getExportValidationDetailApi(id: string) { - try { - const requests = await getApiRequests(); - const response = await requests["export-validation"].getDetail(id); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function deleteExportValidationApi(id: string) { - try { - const requests = await getApiRequests(); - const response = await requests["export-validation"].deleteRow(id); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/ExportValidationService/post-actions.ts b/apps/web/src/actions/unirefund/ExportValidationService/post-actions.ts deleted file mode 100644 index 50e04171b..000000000 --- a/apps/web/src/actions/unirefund/ExportValidationService/post-actions.ts +++ /dev/null @@ -1,16 +0,0 @@ -"use server"; -import type { PostApiExportValidationServiceExportValidationData } from "@ayasofyazilim/saas/ExportValidationService"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function postExportValidationApi( - data: PostApiExportValidationServiceExportValidationData, -) { - try { - const requests = await getApiRequests(); - const response = await requests["export-validation"].post(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/ExportValidationService/put-actions.ts b/apps/web/src/actions/unirefund/ExportValidationService/put-actions.ts deleted file mode 100644 index 2e767fd97..000000000 --- a/apps/web/src/actions/unirefund/ExportValidationService/put-actions.ts +++ /dev/null @@ -1,16 +0,0 @@ -"use server"; -import type { PutApiExportValidationServiceExportValidationByIdData } from "@ayasofyazilim/saas/ExportValidationService"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function putExportValidationApi( - data: PutApiExportValidationServiceExportValidationByIdData, -) { - try { - const requests = await getApiRequests(); - const response = await requests["export-validation"].put(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/FinanceService/actions.ts b/apps/web/src/actions/unirefund/FinanceService/actions.ts deleted file mode 100644 index 32d11dc45..000000000 --- a/apps/web/src/actions/unirefund/FinanceService/actions.ts +++ /dev/null @@ -1,33 +0,0 @@ -"use server"; -import type { GetApiFinanceServiceBillingsData } from "@ayasofyazilim/saas/FinanceService"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function getBillingApi(data: GetApiFinanceServiceBillingsData) { - try { - const requests = await getApiRequests(); - const dataResponse = await requests.billing.get(data); - return structuredResponse(dataResponse); - } catch (error) { - return structuredError(error); - } -} -export async function getBillingDetailApi(id: string) { - try { - const requests = await getApiRequests(); - const dataResponse = await requests.billing.getDetail(id); - return structuredResponse(dataResponse); - } catch (error) { - return structuredError(error); - } -} - -export async function deleteBillingApi(id: string) { - try { - const requests = await getApiRequests(); - const dataResponse = await requests.billing.deleteRow(id); - return structuredResponse(dataResponse); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/FinanceService/post-actions.ts b/apps/web/src/actions/unirefund/FinanceService/post-actions.ts deleted file mode 100644 index aa36c7688..000000000 --- a/apps/web/src/actions/unirefund/FinanceService/post-actions.ts +++ /dev/null @@ -1,14 +0,0 @@ -"use server"; -import type { PostApiFinanceServiceBillingsData } from "@ayasofyazilim/saas/FinanceService"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function postBillingApi(data: PostApiFinanceServiceBillingsData) { - try { - const requests = await getApiRequests(); - const dataResponse = await requests.billing.post(data); - return structuredResponse(dataResponse); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/FinanceService/put-actions.ts b/apps/web/src/actions/unirefund/FinanceService/put-actions.ts deleted file mode 100644 index f1e9a8237..000000000 --- a/apps/web/src/actions/unirefund/FinanceService/put-actions.ts +++ /dev/null @@ -1,16 +0,0 @@ -"use server"; -import type { PutApiFinanceServiceBillingsByIdData } from "@ayasofyazilim/saas/FinanceService"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function putBillingApi( - data: PutApiFinanceServiceBillingsByIdData, -) { - try { - const requests = await getApiRequests(); - const dataResponse = await requests.billing.put(data); - return structuredResponse(dataResponse); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/LocationService/actions.ts b/apps/web/src/actions/unirefund/LocationService/actions.ts deleted file mode 100644 index 54abbcf0a..000000000 --- a/apps/web/src/actions/unirefund/LocationService/actions.ts +++ /dev/null @@ -1,72 +0,0 @@ -"use server"; - -import type { - GetApiLocationServiceCitiesData, - GetApiLocationServiceCitiesGetListByRegionByRegionIdData, - GetApiLocationServiceCountriesData, - GetApiLocationServiceRegionsGetListByCountryByCountryIdData, -} from "@ayasofyazilim/saas/LocationService"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function getCountriesApi( - data: GetApiLocationServiceCountriesData = { - maxResultCount: 250, - sorting: "name", - }, -) { - try { - const requests = await getApiRequests(); - const response = await requests.locations.getCountries(data); - - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function getRegionsByCountryIdApi( - data: GetApiLocationServiceRegionsGetListByCountryByCountryIdData, -) { - try { - const requests = await getApiRequests(); - const response = await requests.locations.getRegionsByCountryId(data); - - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function getDefaultRegionsByCountryIdApi( - data: GetApiLocationServiceRegionsGetListByCountryByCountryIdData, -) { - try { - const requests = await getApiRequests(); - const response = - await requests.locations.getDefaultRegionsByCountryId(data); - - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} - -export async function getCitiesByRegionId( - data: GetApiLocationServiceCitiesGetListByRegionByRegionIdData, -) { - try { - const requests = await getApiRequests(); - const response = await requests.locations.getCitiesByRegionId(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function getCitiesApi(data: GetApiLocationServiceCitiesData = {}) { - try { - const requests = await getApiRequests(); - const response = await requests.locations.getCities(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/LocationService/schemas.tsx b/apps/web/src/actions/unirefund/LocationService/schemas.tsx deleted file mode 100644 index 8cb06916d..000000000 --- a/apps/web/src/actions/unirefund/LocationService/schemas.tsx +++ /dev/null @@ -1,220 +0,0 @@ -"use client"; -import { $UniRefund_LocationService_AddressCommonDatas_AddressCommonDataDto as AddressDto } from "@ayasofyazilim/saas/LocationService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import type { AutoFormInputComponentProps } from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { - createFieldConfigWithResource, - CustomCombobox, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { CustomCombobox as SchemaFormCustomCombobox } from "@repo/ayasofyazilim-ui/organisms/schema-form/widgets"; -import type { Dispatch, SetStateAction } from "react"; -import type { WidgetProps } from "@repo/ayasofyazilim-ui/organisms/schema-form/types"; -import type { AppLanguageDataResourceType } from "src/language-data/unirefund/language-data"; -import type { - CityDto, - CountryDto, - RegionDto, - SelectedAddressField, -} from "./types"; -import { getCity, getRegion } from "./utils"; - -const AddressFormFields: AddressFormFieldsType[] = [ - "type", - "countryId", - "regionId", - "cityId", - "districtId", - "neighborhoodId", - "addressLine", - "postalCode", -]; -export type AddressFormFieldsType = - | "type" - | "countryId" - | "regionId" - | "cityId" - | "districtId" - | "neighborhoodId" - | "addressLine" - | "postalCode"; - -export function getAddressFieldConfig(params: { - cityList?: CityDto[]; - regionList?: RegionDto[]; - countryList?: CountryDto[]; - languageData: AppLanguageDataResourceType; -}) { - const fieldConfig = { - cityId: { - renderer: (props: AutoFormInputComponentProps) => ( - - childrenProps={props} - emptyValue={params.languageData["City.Select"]} - list={params.cityList} - selectIdentifier="id" - selectLabel="name" - /> - ), - }, - countryId: { - renderer: (props: AutoFormInputComponentProps) => ( - - childrenProps={props} - emptyValue={params.languageData["Country.Select"]} - list={params.countryList} - selectIdentifier="id" - selectLabel="name" - /> - ), - }, - regionId: { - renderer: (props: AutoFormInputComponentProps) => ( - - childrenProps={props} - emptyValue={params.languageData["Region.Select"]} - list={params.regionList} - selectIdentifier="id" - selectLabel="name" - /> - ), - }, - }; - - const translatedForm = createFieldConfigWithResource({ - schema: AddressDto, - resources: params.languageData, - name: "Form.address", - extend: fieldConfig, - }); - - return translatedForm; -} - -export function handleOnAddressValueChange({ - values, - selectedFields, - setSelectedFields, - countryList = [], - regionList, - setRegionList, - setCityList, - languageData, -}: { - values: Record; - setCityList: Dispatch>; - setRegionList?: Dispatch>; - countryList: CountryDto[]; - regionList?: RegionDto[]; - selectedFields: SelectedAddressField; - setSelectedFields: Dispatch>; - languageData: AppLanguageDataResourceType; -}) { - const val = values as { - [key in AddressFormFieldsType]: string; - }; - - if ( - setRegionList && - val.countryId && - val.countryId !== selectedFields.countryId - ) { - setRegionList(undefined); - setCityList(undefined); - setSelectedFields((current) => ({ - ...current, - countryId: val.countryId, - regionId: "", - cityId: "", - })); - void getRegion({ - countryList, - countryId: val.countryId, - setRegionList, - languageData, - }).then((response) => { - if (response) { - setSelectedFields((current) => ({ - ...current, - regionId: response, - })); - void getCity({ regionId: response, setCityList, languageData }); - } - }); - } else if (selectedFields.regionId && !regionList) { - void getCity({ regionId: val.regionId, setCityList, languageData }); - } else if (val.regionId && selectedFields.regionId === "" && regionList) { - setSelectedFields((current) => ({ - ...current, - regionId: val.regionId, - })); - void getCity({ regionId: val.regionId, setCityList, languageData }); - } else if (val.cityId && val.cityId !== selectedFields.cityId) { - setSelectedFields((current) => ({ - ...current, - cityId: val.cityId, - })); - } -} -export function hideAddressFields(hideFields: AddressFormFieldsType[]) { - return AddressFormFields.filter((field) => !hideFields.includes(field)); -} - -export function getAddressSchema(fields: AddressFormFieldsType[] = []) { - const schema = createZodObject(AddressDto, fields); - return schema; -} - -export function getAddressSettingsForSchemaForm(params: { - cityList?: CityDto[]; - regionList?: RegionDto[]; - countryList?: CountryDto[]; - languageData: AppLanguageDataResourceType; -}) { - const widgets = { - cityId: (props: WidgetProps) => ( - - {...props} - emptyValue={params.languageData["City.Select"]} - label={params.languageData["Form.address.cityId"]} - list={params.cityList} - selectIdentifier="id" - selectLabel="name" - /> - ), - countryId: (props: WidgetProps) => ( - - {...props} - emptyValue={params.languageData["Country.Select"]} - label={params.languageData["Form.address.countryId"]} - list={params.countryList} - selectIdentifier="id" - selectLabel="name" - /> - ), - regionId: (props: WidgetProps) => ( - - {...props} - emptyValue={params.languageData["Region.Select"]} - label={params.languageData["Form.address.regionId"]} - list={params.regionList} - selectIdentifier="id" - selectLabel="name" - /> - ), - }; - const uiSchema = { - cityId: { - "ui:widget": "cityId", - "ui:title": params.languageData["Form.address.cityId"], - }, - countryId: { - "ui:widget": "countryId", - "ui:title": params.languageData["Form.address.countryId"], - }, - regionId: { - "ui:widget": "regionId", - "ui:title": params.languageData["Form.address.regionId"], - }, - }; - return { widgets, uiSchema }; -} diff --git a/apps/web/src/actions/unirefund/LocationService/types.ts b/apps/web/src/actions/unirefund/LocationService/types.ts deleted file mode 100644 index 059e339ea..000000000 --- a/apps/web/src/actions/unirefund/LocationService/types.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { - UniRefund_LocationService_AddressCommonDatas_AddressCommonDataUpdateDto, - UniRefund_LocationService_Cities_CityDto, - UniRefund_LocationService_Countries_CountryDto, - UniRefund_LocationService_Districts_DistrictDto, - UniRefund_LocationService_Regions_RegionDto, -} from "@ayasofyazilim/saas/LocationService"; - -export type AddressUpdateDto = - UniRefund_LocationService_AddressCommonDatas_AddressCommonDataUpdateDto; -export type CountryDto = UniRefund_LocationService_Countries_CountryDto; -export type RegionDto = UniRefund_LocationService_Regions_RegionDto; -export type CityDto = UniRefund_LocationService_Cities_CityDto; -export type DistrictDto = UniRefund_LocationService_Districts_DistrictDto; - -export interface SelectedAddressField { - countryId: string; - regionId: string; - cityId: string; -} diff --git a/apps/web/src/actions/unirefund/LocationService/use-address-hook.tsx.tsx b/apps/web/src/actions/unirefund/LocationService/use-address-hook.tsx.tsx deleted file mode 100644 index 8d74f8bae..000000000 --- a/apps/web/src/actions/unirefund/LocationService/use-address-hook.tsx.tsx +++ /dev/null @@ -1,97 +0,0 @@ -import { useState, useEffect } from "react"; -import type { AppLanguageDataResourceType } from "src/language-data/unirefund/language-data"; -import type { - CityDto, - CountryDto, - RegionDto, - SelectedAddressField, -} from "./types"; -import { getAddressList } from "./utils"; -import type { AddressFormFieldsType } from "./schemas"; -import { - getAddressFieldConfig, - getAddressSchema, - handleOnAddressValueChange, - getAddressSettingsForSchemaForm, - hideAddressFields, -} from "./schemas"; - -export function useAddressHook({ - countryList, - selectedFieldsDefaultValue, - fieldsToHideInAddressSchema, - languageData, -}: { - countryList: CountryDto[]; - selectedFieldsDefaultValue: SelectedAddressField; - fieldsToHideInAddressSchema: AddressFormFieldsType[]; - languageData: AppLanguageDataResourceType; -}) { - const [selectedFields, setSelectedFields] = useState( - selectedFieldsDefaultValue, - ); - const [cityList, setCityList] = useState(undefined); - const [regionList, setRegionList] = useState( - undefined, - ); - - if (!regionList || regionList.length === 0) { - fieldsToHideInAddressSchema.push("regionId"); - } - const addressFieldsToShow = hideAddressFields(fieldsToHideInAddressSchema); - const addressSchema = getAddressSchema(addressFieldsToShow); - - const addressSchemaFieldConfig = getAddressFieldConfig({ - cityList, - regionList, - countryList, - languageData, - }); - const addressSettings = getAddressSettingsForSchemaForm({ - cityList, - regionList, - countryList, - languageData, - }); - - useEffect(() => { - getAddressList({ - countryId: selectedFields.countryId, - regionId: selectedFields.regionId, - languageData, - countryList, - setCityList, - setRegionList, - }); - }, []); - - function onAddressValueChanged( - val: Record | Record>, - ) { - let values: Record; - if ("address" in val) { - values = val.address as Record; - } else { - values = val as Record; - } - handleOnAddressValueChange({ - selectedFields, - setSelectedFields, - countryList, - regionList, - values, - setRegionList, - setCityList, - languageData, - }); - } - return { - addressSchema, - addressSchemaFieldConfig, - setRegionList, - onAddressValueChanged, - addressFieldsToShow, - selectedFields, - addressSettings, - }; -} diff --git a/apps/web/src/actions/unirefund/LocationService/utils.ts b/apps/web/src/actions/unirefund/LocationService/utils.ts deleted file mode 100644 index 5e5df47db..000000000 --- a/apps/web/src/actions/unirefund/LocationService/utils.ts +++ /dev/null @@ -1,97 +0,0 @@ -"use client"; - -import { toast } from "@/components/ui/sonner"; -import type { Dispatch, SetStateAction } from "react"; -import type { AppLanguageDataResourceType } from "src/language-data/unirefund/language-data"; -import { - getCitiesByRegionId, - getDefaultRegionsByCountryIdApi, - getRegionsByCountryIdApi, -} from "./actions"; -import type { CityDto, CountryDto, RegionDto } from "./types"; - -export async function getRegion({ - countryList, - countryId, - setRegionList, - languageData, -}: { - countryList: CountryDto[]; - countryId: string; - setRegionList: Dispatch>; - languageData: AppLanguageDataResourceType; -}) { - const selectedCountry = countryList.find( - (country) => country.id === countryId, - ); - if (selectedCountry?.hasRegion) { - const regions = await getRegionsByCountryIdApi({ - countryId, - }); - if (regions.type !== "success") { - setRegionList([]); - toast.error(`location/utils: ${languageData["Fetch.Fail"]}`); - return false; - } - setRegionList(regions.data); - } else { - const regions = await getDefaultRegionsByCountryIdApi({ - countryId, - }); - setRegionList([]); - if (regions.type !== "success") { - toast.error(`location/utils/region: ${languageData["Fetch.Fail"]}`); - return false; - } - return regions.data; - } - return false; -} -export async function getCity({ - regionId, - setCityList, - languageData, -}: { - regionId: string; - setCityList: Dispatch>; - languageData: AppLanguageDataResourceType; -}) { - const cities = await getCitiesByRegionId({ regionId }); - if (cities.type === "success") { - setCityList(cities.data); - return; - } - setCityList([]); - toast.error(`location/utils/city: ${languageData["Fetch.Fail"]}`); -} - -export function getAddressList({ - countryList, - countryId, - regionId, - setRegionList, - setCityList, - languageData, -}: { - countryList: CountryDto[]; - countryId: string; - regionId?: string; - setRegionList: Dispatch>; - setCityList: Dispatch>; - languageData: AppLanguageDataResourceType; -}) { - if (countryId) { - void getRegion({ - countryList, - countryId, - setRegionList, - languageData, - }).then((response) => { - if (response) { - void getCity({ regionId: response, setCityList, languageData }); - } else if (regionId) { - void getCity({ regionId, setCityList, languageData }); - } - }); - } -} diff --git a/apps/web/src/actions/unirefund/RefundService/actions.ts b/apps/web/src/actions/unirefund/RefundService/actions.ts deleted file mode 100644 index 433e7ef6d..000000000 --- a/apps/web/src/actions/unirefund/RefundService/actions.ts +++ /dev/null @@ -1,14 +0,0 @@ -"use server"; -import type { GetApiRefundServiceRefundsData } from "@ayasofyazilim/saas/RefundService"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function getRefundApi(data: GetApiRefundServiceRefundsData = {}) { - try { - const requests = await getApiRequests(); - const response = await requests.refund.get(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/SaasService/actions.ts b/apps/web/src/actions/unirefund/SaasService/actions.ts deleted file mode 100644 index 09fdd4a32..000000000 --- a/apps/web/src/actions/unirefund/SaasService/actions.ts +++ /dev/null @@ -1,26 +0,0 @@ -"use server"; -import type { PutApiSaasEditionsByIdMoveAllTenantsData } from "@ayasofyazilim/saas/SaasService"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function getAllEditionsApi() { - try { - const requests = await getApiRequests(); - const dataResponse = await requests.editions.getAllEditions(); - return structuredResponse(dataResponse); - } catch (error) { - return structuredError(error); - } -} - -export async function moveAllTenantsApi( - data: PutApiSaasEditionsByIdMoveAllTenantsData, -) { - try { - const requests = await getApiRequests(); - const dataResponse = await requests.editions.moveAllTenants(data); - return structuredResponse(dataResponse); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/SaasService/put-actions.ts b/apps/web/src/actions/unirefund/SaasService/put-actions.ts deleted file mode 100644 index 53077e2e8..000000000 --- a/apps/web/src/actions/unirefund/SaasService/put-actions.ts +++ /dev/null @@ -1,16 +0,0 @@ -"use server"; -import type { PutApiSaasTenantsByIdSetPasswordData } from "@ayasofyazilim/saas/SaasService"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function putTenantSetPasswordApi( - data: PutApiSaasTenantsByIdSetPasswordData, -) { - try { - const requests = await getApiRequests(); - const dataResponse = await requests.tenants.putSetPassword(data); - return structuredResponse(dataResponse); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/TagService/actions.ts b/apps/web/src/actions/unirefund/TagService/actions.ts deleted file mode 100644 index 461b1115b..000000000 --- a/apps/web/src/actions/unirefund/TagService/actions.ts +++ /dev/null @@ -1,31 +0,0 @@ -"use server"; -import type { - GetApiTagServiceTagByIdDetailData, - GetApiTagServiceTagData, -} from "@ayasofyazilim/saas/TagService"; -import { - getTagServiceClient, - structuredError, - structuredResponse, -} from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function getTagsApi(data: GetApiTagServiceTagData = {}) { - try { - const requests = await getApiRequests(); - const response = await requests.tags.get(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} - -export async function getTagById(data: GetApiTagServiceTagByIdDetailData) { - try { - const client = await getTagServiceClient(); - const response = await client.tag.getApiTagServiceTagByIdDetail(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/TravellerService/actions.ts b/apps/web/src/actions/unirefund/TravellerService/actions.ts deleted file mode 100644 index fc66e770e..000000000 --- a/apps/web/src/actions/unirefund/TravellerService/actions.ts +++ /dev/null @@ -1,43 +0,0 @@ -"use server"; - -import type { FilterColumnResult } from "@repo/ayasofyazilim-ui/molecules/tables/types"; -import type { GetApiTravellerServiceTravellersData } from "@ayasofyazilim/saas/TravellerService"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests, getTableData } from "../../api-requests"; - -export async function getTravellers(page: number, filter?: FilterColumnResult) { - const response = await getTableData("travellers", page, 10, filter); - return response; -} - -export async function getTravellersApi( - data: GetApiTravellerServiceTravellersData, -) { - try { - const requests = await getApiRequests(); - const response = await requests.travellers.get(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} -export async function getTravellersDetailsApi(id: string) { - try { - const requests = await getApiRequests(); - const response = await requests.travellers.getDetail(id); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} - -export async function deleteTravellerPersonalIdentificationApi(id: string) { - try { - const requests = await getApiRequests(); - const response = - await requests.travellers.deleteTravellerPersonalIdentification(id); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/TravellerService/post-actions.ts b/apps/web/src/actions/unirefund/TravellerService/post-actions.ts deleted file mode 100644 index 97a6d4d76..000000000 --- a/apps/web/src/actions/unirefund/TravellerService/post-actions.ts +++ /dev/null @@ -1,31 +0,0 @@ -"use server"; -import type { - PostApiTravellerServiceTravellersByIdCreatePersonalIdentificationData, - PostApiTravellerServiceTravellersData, -} from "@ayasofyazilim/saas/TravellerService"; -import { structuredError, structuredResponse } from "../../../lib"; -import { getApiRequests } from "../../api-requests"; - -export async function postTravellerApi( - data: PostApiTravellerServiceTravellersData, -) { - try { - const client = await getApiRequests(); - const response = await client.travellers.post(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} - -export async function postTravellerIdentificationApi( - data: PostApiTravellerServiceTravellersByIdCreatePersonalIdentificationData, -) { - try { - const client = await getApiRequests(); - const response = await client.travellers.postTravellerIdentification(data); - return structuredResponse(response); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/actions/unirefund/TravellerService/put-actions.ts b/apps/web/src/actions/unirefund/TravellerService/put-actions.ts deleted file mode 100644 index d9b1dbde6..000000000 --- a/apps/web/src/actions/unirefund/TravellerService/put-actions.ts +++ /dev/null @@ -1,45 +0,0 @@ -"use server"; -import type { - PutApiTravellerServiceTravellersByIdUpdatePersonalIdentificationData, - PutApiTravellerServiceTravellersByIdUpsertPersonalPreferenceData, - PutApiTravellerServiceTravellersByIdUpsertPersonalSummaryData, -} from "@ayasofyazilim/saas/TravellerService"; -import { structuredError, structuredResponse } from "src/lib"; -import { getApiRequests } from "../../api-requests"; - -export async function putTravellerPersonalIdentificationApi( - data: PutApiTravellerServiceTravellersByIdUpdatePersonalIdentificationData, -) { - try { - const requests = await getApiRequests(); - const dataResponse = - await requests.travellers.putPersonalIdentification(data); - return structuredResponse(dataResponse); - } catch (error) { - return structuredError(error); - } -} - -export async function putTravellerPersonalPreferenceApi( - data: PutApiTravellerServiceTravellersByIdUpsertPersonalPreferenceData, -) { - try { - const requests = await getApiRequests(); - const dataResponse = await requests.travellers.putPersonalPreference(data); - return structuredResponse(dataResponse); - } catch (error) { - return structuredError(error); - } -} - -export async function putTravellerPersonalSummaryApi( - data: PutApiTravellerServiceTravellersByIdUpsertPersonalSummaryData, -) { - try { - const requests = await getApiRequests(); - const dataResponse = await requests.travellers.putPersonalSummary(data); - return structuredResponse(dataResponse); - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/app/[lang]/(unirefund)/finance/billing/[billingId]/form.tsx b/apps/web/src/app/[lang]/(unirefund)/finance/billing/[billingId]/form.tsx deleted file mode 100644 index 9f7a1dfc7..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/finance/billing/[billingId]/form.tsx +++ /dev/null @@ -1,100 +0,0 @@ -"use client"; - -import type { UniRefund_CRMService_Merchants_MerchantProfileDto } from "@ayasofyazilim/saas/CRMService"; -import type { - UniRefund_FinanceService_Billings_BillingDto, - UniRefund_FinanceService_Billings_UpdateBillingDto, -} from "@ayasofyazilim/saas/FinanceService"; -import { $UniRefund_FinanceService_Billings_UpdateBillingDto } from "@ayasofyazilim/saas/FinanceService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import AutoForm, { - AutoFormSubmit, - createFieldConfigWithResource, - CustomCombobox, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { useRouter } from "next/navigation"; -import { handlePutResponse } from "src/actions/core/api-utils-client"; -import { putBillingApi } from "src/actions/unirefund/FinanceService/put-actions"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import type { FinanceServiceResource } from "src/language-data/unirefund/FinanceService"; - -const updateBillingSchema = createZodObject( - $UniRefund_FinanceService_Billings_UpdateBillingDto, -); - -export default function Form({ - billingId, - languageData, - billingData, - merchants, -}: { - billingId: string; - billingData: UniRefund_FinanceService_Billings_BillingDto; - languageData: { - crm: CRMServiceServiceResource; - finance: FinanceServiceResource; - }; - merchants: { - success: boolean; - data: UniRefund_CRMService_Merchants_MerchantProfileDto[]; - }; -}) { - const router = useRouter(); - function updateBilling( - data: UniRefund_FinanceService_Billings_UpdateBillingDto, - ) { - void putBillingApi({ - id: billingId, - requestBody: data, - }).then((response) => { - handlePutResponse(response, router); - }); - } - - const translatedForm = createFieldConfigWithResource({ - schema: $UniRefund_FinanceService_Billings_UpdateBillingDto, - resources: languageData.finance, - extend: { - number: { containerClassName: "gap-2" }, - merchantId: { - renderer: (props) => { - return ( - - childrenProps={props} - disabled={!merchants.success} - emptyValue={ - merchants.success - ? languageData.crm["Merchant.Select"] - : languageData.crm["Merchants.Fetch.Fail"] - } - list={merchants.data} - searchPlaceholder={languageData.finance["Select.Placeholder"]} - searchResultLabel={languageData.finance["Select.ResultLabel"]} - selectIdentifier="id" - selectLabel="name" - /> - ); - }, - }, - }, - }); - - return ( - { - updateBilling( - formdata as UniRefund_FinanceService_Billings_UpdateBillingDto, - ); - }} - stickyChildren - values={billingData} - > - - {languageData.finance["Edit.Save"]} - - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/finance/billing/[billingId]/page.tsx b/apps/web/src/app/[lang]/(unirefund)/finance/billing/[billingId]/page.tsx deleted file mode 100644 index c9ca835b3..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/finance/billing/[billingId]/page.tsx +++ /dev/null @@ -1,55 +0,0 @@ -"use server"; -import { getBillingDetailApi } from "src/actions/unirefund/FinanceService/actions"; -import { getResourceData as getFinanceResources } from "src/language-data/unirefund/FinanceService"; -import { getResourceData as getCRMResources } from "src/language-data/unirefund/CRMService"; -import { getMerchantsApi } from "src/actions/unirefund/CrmService/actions"; -import Form from "./form"; - -export default async function Page({ - params, -}: { - params: { lang: string; billingId: string }; -}) { - const { languageData: financeLanguageData } = await getFinanceResources( - params.lang, - ); - const billing = await getBillingDetailApi(params.billingId); - const { languageData: crmLanguageData } = await getCRMResources(params.lang); - const merchant = await getMerchantsApi(); - const merchantsList = - (merchant.type === "success" && merchant.data.items) || []; - - if (billing.type !== "success") { - return ( -
- {billing.type + billing.message || - financeLanguageData["Billing.Fetch.Fail"]} -
- ); - } - - const billingList = billing.data; - - return ( - <> -
-
- {financeLanguageData["Billing.Edit"]} -
-
- {financeLanguageData["Billing.Edit.Description"]} -
- - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/finance/billing/new/form.tsx b/apps/web/src/app/[lang]/(unirefund)/finance/billing/new/form.tsx deleted file mode 100644 index 4bb0b92cc..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/finance/billing/new/form.tsx +++ /dev/null @@ -1,98 +0,0 @@ -"use client"; -import { toast } from "@/components/ui/sonner"; -import type { UniRefund_CRMService_Merchants_MerchantProfileDto } from "@ayasofyazilim/saas/CRMService"; -import type { UniRefund_FinanceService_Billings_CreateBillingDto } from "@ayasofyazilim/saas/FinanceService"; -import { $UniRefund_FinanceService_Billings_CreateBillingDto } from "@ayasofyazilim/saas/FinanceService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import AutoForm, { - AutoFormSubmit, - createFieldConfigWithResource, - CustomCombobox, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { useRouter } from "next/navigation"; -import { postBillingApi } from "src/actions/unirefund/FinanceService/post-actions"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import type { FinanceServiceResource } from "src/language-data/unirefund/FinanceService"; -import { getBaseLink } from "src/utils"; - -const billingSchema = createZodObject( - $UniRefund_FinanceService_Billings_CreateBillingDto, -); - -export default function Page({ - languageData, - merchants, -}: { - languageData: { - crm: CRMServiceServiceResource; - finance: FinanceServiceResource; - }; - merchants: { - success: boolean; - data: UniRefund_CRMService_Merchants_MerchantProfileDto[]; - }; -}) { - const router = useRouter(); - - async function createBilling( - data: UniRefund_FinanceService_Billings_CreateBillingDto, - ) { - const response = await postBillingApi({ requestBody: data }); - if (response.type === "error" || response.type === "api-error") { - toast.error( - response.type + - (response.message || languageData.finance["Billing.New.Error"]), - ); - } else { - toast.success([languageData.finance["Billing.New.Success"]]); - router.push(getBaseLink(`/finance/billing`)); - router.refresh(); - } - } - - const translatedForm = createFieldConfigWithResource({ - schema: $UniRefund_FinanceService_Billings_CreateBillingDto, - resources: languageData.finance, - extend: { - number: { containerClassName: "gap-2" }, - merchantId: { - renderer: (props) => { - return ( - - childrenProps={props} - disabled={!merchants.success} - emptyValue={ - merchants.success - ? languageData.crm["Merchant.Select"] - : languageData.crm["Merchants.Fetch.Fail"] - } - list={merchants.data} - searchPlaceholder={languageData.finance["Select.Placeholder"]} - searchResultLabel={languageData.finance["Select.ResultLabel"]} - selectIdentifier="id" - selectLabel="name" - /> - ); - }, - }, - }, - }); - - return ( - { - void createBilling( - val as UniRefund_FinanceService_Billings_CreateBillingDto, - ); - }} - stickyChildren - > - - {languageData.finance.Save} - - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/finance/billing/new/page.tsx b/apps/web/src/app/[lang]/(unirefund)/finance/billing/new/page.tsx deleted file mode 100644 index efb3a2c94..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/finance/billing/new/page.tsx +++ /dev/null @@ -1,37 +0,0 @@ -"use server"; - -import { getMerchantsApi } from "src/actions/unirefund/CrmService/actions"; -import { getResourceData as getFinanceResources } from "src/language-data/unirefund/FinanceService"; -import { getResourceData as getCRMResources } from "src/language-data/unirefund/CRMService"; -import Form from "./form"; - -export default async function Page({ params }: { params: { lang: string } }) { - const { languageData: financeLanguageData } = await getFinanceResources( - params.lang, - ); - const { languageData: crmLanguageData } = await getCRMResources(params.lang); - const merchant = await getMerchantsApi(); - const merchantsList = - (merchant.type === "success" && merchant.data.items) || []; - - return ( - <> - -
- {financeLanguageData["Billing.New"]} -
-
- {financeLanguageData["Billing.New.Description"]} -
- - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/finance/billing/page.tsx b/apps/web/src/app/[lang]/(unirefund)/finance/billing/page.tsx deleted file mode 100644 index e4f086eff..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/finance/billing/page.tsx +++ /dev/null @@ -1,25 +0,0 @@ -"use server"; - -import type { GetApiFinanceServiceBillingsData } from "@ayasofyazilim/saas/FinanceService"; -import { notFound } from "next/navigation"; -import { getResourceData } from "src/language-data/unirefund/FinanceService"; -import { getBillingApi } from "src/actions/unirefund/FinanceService/actions"; -import BillingTable from "./table"; - -export default async function Page(props: { - params: { lang: string }; - searchParams: Promise; -}) { - const searchParams = await props.searchParams; - const response = await getBillingApi(searchParams); - if (response.type !== "success") return notFound(); - const { languageData } = await getResourceData(props.params.lang); - - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/finance/billing/table-data.tsx b/apps/web/src/app/[lang]/(unirefund)/finance/billing/table-data.tsx deleted file mode 100644 index 02a51f045..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/finance/billing/table-data.tsx +++ /dev/null @@ -1,126 +0,0 @@ -import type { UniRefund_FinanceService_Billings_BillingDto } from "@ayasofyazilim/saas/FinanceService"; -import { $PagedResultDto_BillingDto } from "@ayasofyazilim/saas/FinanceService"; -import type { TanstackTableCreationProps } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/types"; -import { tanstackTableCreateColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; -import { Trash } from "lucide-react"; -import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import { handleDeleteResponse } from "src/actions/core/api-utils-client"; -import { deleteBillingApi } from "src/actions/unirefund/FinanceService/actions"; -import type { FinanceServiceResource } from "src/language-data/unirefund/FinanceService"; - -type BillingTable = - TanstackTableCreationProps; - -const billingColumns = (locale: string, languageData: FinanceServiceResource) => - tanstackTableCreateColumnsByRowData( - { - rows: $PagedResultDto_BillingDto.properties.items.items.properties, - languageData: { - languageData: languageData as Record, - constantKey: "Form", - }, - config: { - locale, - }, - - links: { - merchantName: { - prefix: "billing", - targetAccessorKey: "id", - }, - }, - badges: { - merchantName: { - values: - $PagedResultDto_BillingDto.properties.items.items.properties.paymentStatus.enum.map( - (status) => { - const badgeClasses = { - PAID: "text-green-500 bg-green-100 border-green-500", - NOTPAID: "text-red-500 bg-red-100 border-red-500", - PARTIALLYPAID: - "text-orange-500 bg-orange-100 border-orange-500", - }; - return { - label: languageData[`Form.paymentStatus.${status}`], - badgeClassName: badgeClasses[status], - conditions: [ - { - conditionAccessorKey: "paymentStatus", - when: (value) => value === status, - }, - ], - }; - }, - ), - }, - }, - faceted: { - period: { - options: - $PagedResultDto_BillingDto.properties.items.items.properties.period.enum.map( - (x) => ({ - label: languageData[`Form.period.${x}`], - value: x, - }), - ), - }, - status: { - options: - $PagedResultDto_BillingDto.properties.items.items.properties.status.enum.map( - (x) => ({ - label: languageData[`Form.status.${x}`], - value: x, - }), - ), - }, - }, - }, - ); - -const billingTable = ( - router: AppRouterInstance, - languageData: FinanceServiceResource, -) => { - const table: BillingTable = { - fillerColumn: "merchantName", - columnVisibility: { - type: "hide", - columns: ["id", "merchantId", "paymentStatus"], - }, - tableActions: [ - { - type: "simple", - actionLocation: "table", - cta: languageData["Billing.New"], - onClick: () => { - router.push(`billing/new`); - }, - }, - ], - rowActions: [ - { - actionLocation: "row", - type: "confirmation-dialog", - cta: languageData.Delete, - confirmationText: languageData.Delete, - cancelText: languageData.Cancel, - description: languageData["Delete.Assurance"], - icon: Trash, - onConfirm: (row) => { - void deleteBillingApi(row.id || "").then((response) => { - handleDeleteResponse(response, router); - }); - }, - title: languageData["Billing.Delete"], - }, - ], - }; - return table; -}; - -export const tableData = { - billing: { - columns: billingColumns, - table: billingTable, - }, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/finance/billing/table.tsx b/apps/web/src/app/[lang]/(unirefund)/finance/billing/table.tsx deleted file mode 100644 index ceae8d16d..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/finance/billing/table.tsx +++ /dev/null @@ -1,31 +0,0 @@ -"use client"; - -import type { PagedResultDto_BillingDto } from "@ayasofyazilim/saas/FinanceService"; -import TanstackTable from "@repo/ayasofyazilim-ui/molecules/tanstack-table"; -import { useRouter } from "next/navigation"; -import type { FinanceServiceResource } from "src/language-data/unirefund/FinanceService"; -import { tableData } from "./table-data"; - -function BillingTable({ - locale, - response, - languageData, -}: { - locale: string; - response: PagedResultDto_BillingDto; - languageData: FinanceServiceResource; -}) { - const router = useRouter(); - const columns = tableData.billing.columns(locale, languageData); - const table = tableData.billing.table(router, languageData); - - return ( - - ); -} -export default BillingTable; diff --git a/apps/web/src/app/[lang]/(unirefund)/home/charts.tsx b/apps/web/src/app/[lang]/(unirefund)/home/charts.tsx deleted file mode 100644 index 3680c8b4a..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/home/charts.tsx +++ /dev/null @@ -1,512 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access -- TODO: we need to fix this*/ -"use client"; -import { Button } from "@repo/ayasofyazilim-ui/atoms/button"; -import { - Card, - CardContent, - CardHeader, -} from "@repo/ayasofyazilim-ui/atoms/card"; -import { AreaChart } from "@repo/ayasofyazilim-ui/molecules/area-chart"; -import { BarChart } from "@repo/ayasofyazilim-ui/molecules/bar-chart"; -import { BarList } from "@repo/ayasofyazilim-ui/molecules/bar-list"; -import { CategoryBar } from "@repo/ayasofyazilim-ui/molecules/category-bar"; -import { LineChart } from "@repo/ayasofyazilim-ui/molecules/line-chart"; -import ScrollArea from "@repo/ayasofyazilim-ui/molecules/scroll-area"; -import DataTable from "@repo/ayasofyazilim-ui/molecules/tables"; -import { SortableLayout } from "@repo/ui/sortable-layout"; -import { Grid2X2, SaveAll } from "lucide-react"; -import { useState } from "react"; - -const issuingNationalities = [ - { - name: "Saudi Arabia", - value: 126, - className: "bg-green-500 text-white group-hover:bg-green-600", - }, - { - name: "Iran", - value: 107, - className: "bg-green-400 text-white group-hover:bg-green-500", - }, - { - name: "Russian Federation", - value: 98, - className: "bg-green-300 text-green-600 group-hover:bg-green-400", - }, - { - name: "Egypt", - value: 79, - className: "bg-orange-300 text-orange-600 group-hover:bg-orange-400", - }, - { - name: "United States of America", - value: 27, - className: "bg-orange-200 text-orange-600 group-hover:bg-orange-300", - }, -]; -const issuedTagsByTimeOfDay = [ - { - date: "00:00", - Tags: 336, - }, - { - date: "01:00", - Tags: 0, - }, - { - date: "02:00", - Tags: 0, - }, - { - date: "03:00", - Tags: 0, - }, - { - date: "04:00", - Tags: 0, - }, - { - date: "05:00", - Tags: 3, - }, - { - date: "06:00", - Tags: 3, - }, - { - date: "07:00", - Tags: 40, - }, - { - date: "08:00", - Tags: 98, - }, - { - date: "09:00", - Tags: 180, - }, - { - date: "10:00", - Tags: 226, - }, - { - date: "11:00", - Tags: 272, - }, - { - date: "12:00", - Tags: 225, - }, - { - date: "13:00", - Tags: 225, - }, - { - date: "14:00", - Tags: 216, - }, - { - date: "15:00", - Tags: 164, - }, - { - date: "16:00", - Tags: 198, - }, - { - date: "17:00", - Tags: 166, - }, - { - date: "18:00", - Tags: 156, - }, - { - date: "19:00", - Tags: 48, - }, - { - date: "20:00", - Tags: 19, - }, - { - date: "21:00", - Tags: 31, - }, - { - date: "22:00", - Tags: 17, - }, - { - date: "23:00", - Tags: 2, - }, -]; -const issuedTagsByTimeOfWeekday = [ - { - weekday: "Monday", - Tags: "781", - }, - { - weekday: "Tuesday", - Tags: "763", - }, - { - weekday: "Wednesday", - Tags: "252", - }, - { - weekday: "Thursday", - Tags: "0", - }, - { - weekday: "Friday", - Tags: "0", - }, - { - weekday: "Saturday", - Tags: "19", - }, - { - weekday: "Sunday", - Tags: "840", - }, -]; -const top5Chains = [ - { - id: "m5gr84i9", - tags: 405, - sales: `${Intl.NumberFormat("tr").format(17478068881).toString()}₺`, - vat: `${Intl.NumberFormat("tr").format(2891490255).toString()}₺`, - atv: `${Intl.NumberFormat("tr").format(43155726).toString()}₺`, - result: "Bulgari Turkey Lüks Ürün Ticaret Limited Şirketi", - }, - { - id: "3u1reuv4", - tags: 106, - sales: `${Intl.NumberFormat("tr").format(16223005648).toString()}₺`, - vat: `${Intl.NumberFormat("tr").format(2703834268).toString()}₺`, - atv: `${Intl.NumberFormat("tr").format(1530472223).toString()}₺`, - result: "Times Mağazacılık ve Dış Ticaret Anonim Şirketi", - }, - { - id: "derv1ws0", - tags: 4055, - sales: `${Intl.NumberFormat("tr").format(12793641609).toString()}₺`, - vat: `${Intl.NumberFormat("tr").format(158076342).toString()}₺`, - atv: `${Intl.NumberFormat("tr").format(3155029).toString()}₺`, - result: - "Doğuş Perakende Satış Giyim ve Aksesuar Dış Ticaret Anonim Şirketi", - }, - { - id: "5kma53ae", - tags: 5660, - sales: `${Intl.NumberFormat("tr").format(4166799674).toString()}₺`, - vat: `${Intl.NumberFormat("tr").format(379476978).toString()}₺`, - atv: `${Intl.NumberFormat("tr").format(736184).toString()}₺`, - result: "Barçın Spor Malzemeleri Ticaret ve Sanayi Anonim Şirketi", - }, - { - id: "bhqecj4p", - tags: 16307, - sales: `${Intl.NumberFormat("tr").format(4007679453).toString()}₺`, - vat: `${Intl.NumberFormat("tr").format(373066609).toString()}₺`, - atv: `${Intl.NumberFormat("tr").format(245764).toString()}₺`, - result: "Defacto Perakende Ticaret Anonim Şirketi", - }, -]; -const top5Stores = [ - { - id: "m5gr84i9", - tags: 102, - "%ofTotal": `0,20 %`, - sis: `${Intl.NumberFormat("tr").format(17478068881).toString()}₺`, - vat: `${Intl.NumberFormat("tr").format(2891490255).toString()}₺`, - atv: `${Intl.NumberFormat("tr").format(43155726).toString()}₺`, - result: "Bulgari Turkey Lüks Ürün Ticaret Limited Şirketi", - }, - { - id: "3u1reuv4", - tags: 106, - "%ofTotal": `0,41 %`, - sis: `${Intl.NumberFormat("tr").format(17478068881).toString()}₺`, - vat: `${Intl.NumberFormat("tr").format(2891490255).toString()}₺`, - atv: `${Intl.NumberFormat("tr").format(43155726).toString()}₺`, - result: "Times Mağazacılık ve Dış Ticaret Anonim Şirketi", - }, - { - id: "derv1ws0", - tags: 4055, - "%ofTotal": `0,37 %`, - sis: `${Intl.NumberFormat("tr").format(17478068881).toString()}₺`, - vat: `${Intl.NumberFormat("tr").format(2891490255).toString()}₺`, - atv: `${Intl.NumberFormat("tr").format(43155726).toString()}₺`, - result: - "Doğuş Perakende Satış Giyim ve Aksesuar Dış Ticaret Anonim Şirketi", - }, - { - id: "5kma53ae", - tags: 5660, - "%ofTotal": `0,29 %`, - sis: `${Intl.NumberFormat("tr").format(17478068881).toString()}₺`, - vat: `${Intl.NumberFormat("tr").format(2891490255).toString()}₺`, - atv: `${Intl.NumberFormat("tr").format(43155726).toString()}₺`, - result: "Barçın Spor Malzemeleri Ticaret ve Sanayi Anonim Şirketi", - }, - { - id: "bhqecj4p", - tags: 16307, - "%ofTotal": `98,73 %`, - sis: `${Intl.NumberFormat("tr").format(17478068881).toString()}₺`, - vat: `${Intl.NumberFormat("tr").format(2891490255).toString()}₺`, - atv: `${Intl.NumberFormat("tr").format(43155726).toString()}₺`, - result: "Diğerleri", - }, -]; -const DashboardJson = { - layout: "grid", - items: [ - { - id: 1, - order: 1, - type: "barChart", - title: "Issues tags by weekday", - description: "Issues tags by weekday", - categories: ["Tags"], - index: "date", - data: issuedTagsByTimeOfDay, - }, - { - id: 2, - order: 2, - type: "barChart", - title: "Issues tags by time of week", - description: "Issues tags by time of week", - categories: ["Tags"], - index: "weekday", - data: issuedTagsByTimeOfWeekday, - }, - { - id: 3, - order: 3, - type: "barList", - title: "Top 5 issuing nationalities", - description: "Bar list description", - data: issuingNationalities, - className: "col-span-2", - }, - { - id: 4, - order: 4, - type: "component", - title: "Top 5 Chains", - description: "Bar list description", - data: top5Chains, - component: ( - - ), - className: "", - }, - { - id: 5, - order: 5, - type: "component", - title: "Top 5 Stores", - description: "Bar list description", - data: top5Stores, - component: ( - - ), - className: "", - }, - ], -}; - -export default function Charts() { - const [sortableEditMode, setSortableEditMode] = useState(false); - const [listOrder, setListOrder] = useState(DashboardJson.items); - function getLatestList(list: typeof DashboardJson.items) { - setListOrder( - list.map((item, index: number) => { - return { ...item, order: index + 1 }; - }), - ); - } - function handleEditMode() { - setSortableEditMode(!sortableEditMode); - if (sortableEditMode) { - setListOrder(listOrder); - } - } - - return ( - -
- { - return ( - - {item.title} - - {item.type === "barChart" && } - {item.type === "areaChart" && } - {item.type === "barList" && } - {item.type === "categoryBar" && ( - - )} - {item.type === "lineChart" && } - {item.type === "component" && item.component} - - - ); - }} - /> -
- -
-
-
- ); -} - -function AreaChartHero({ item }: any) { - return ( - - `$${Intl.NumberFormat("us").format(number).toString()}` - } - /> - ); -} -function BarChartHero({ item }: any) { - return ( - - Intl.NumberFormat("us").format(number).toString() - } - /> - ); -} -function BarListHero({ item }: any) { - return ; -} -function CategoryBarHero({ item }: any) { - return ( - - ); -} -function LineChartHero({ item }: any) { - return ( - - `$${Intl.NumberFormat("us").format(number).toString()}` - } - xAxisLabel="Month" - yAxisLabel="Spend Category" - /> - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/home/page.tsx b/apps/web/src/app/[lang]/(unirefund)/home/page.tsx deleted file mode 100644 index a1d802b28..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/home/page.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import Charts from "./charts"; - -export default function Page() { - return ; -} diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/_components/merchant-details.tsx b/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/_components/merchant-details.tsx deleted file mode 100644 index 9cccda259..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/_components/merchant-details.tsx +++ /dev/null @@ -1,54 +0,0 @@ -"use client"; -import { Card, CardHeader, CardTitle } from "@/components/ui/card"; -import type { UniRefund_TagService_Tags_TagDetailDto } from "@ayasofyazilim/saas/TagService"; -import { Store } from "lucide-react"; -import Link from "next/link"; -import { getBaseLink } from "src/utils"; - -function MerchantDetails({ - tagDetail, -}: { - tagDetail: UniRefund_TagService_Tags_TagDetailDto; -}) { - return ( - - - - - Merchant details - - -
-
-
Store Name
-
- - {tagDetail.merchant?.name} - -
-
-
-
Address
-
- {tagDetail.merchant?.address?.fullText} -
-
-
-
Product Groups
-
- {tagDetail.merchant?.productGroups?.join(", ")} -
-
-
-
-
- ); -} - -export default MerchantDetails; diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/_components/tag-summary.tsx b/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/_components/tag-summary.tsx deleted file mode 100644 index c3259a734..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/_components/tag-summary.tsx +++ /dev/null @@ -1,146 +0,0 @@ -"use client"; -import { Card, CardHeader, CardTitle } from "@/components/ui/card"; -import { cn } from "@/lib/utils"; -import type { UniRefund_TagService_Tags_TagDetailDto } from "@ayasofyazilim/saas/TagService"; -import { FileIcon } from "lucide-react"; -import { dateToString, getStatusColor } from "../utils"; - -interface SummaryListType { - title: string; - rows: { - title: string; - content: string; - contentClassName?: string; - }[]; -} - -function SummaryList({ summaryList }: { summaryList: SummaryListType }) { - return ( -
-
{summaryList.title}
- {summaryList.rows.map((row) => ( -
-
{row.title}:
-
- {row.content} -
-
- ))} -
- ); -} - -function TagSummary({ - tagDetail, -}: { - tagDetail: UniRefund_TagService_Tags_TagDetailDto; -}) { - const exportValidation = tagDetail.exportValidation; - const billing = tagDetail.billing; - const refund = tagDetail.refund; - const exportValidationList: SummaryListType = { - title: "Export validation", - rows: [ - { - title: "Status", - content: exportValidation?.status || "", - contentClassName: getStatusColor(exportValidation?.status || ""), - }, - { - title: "Date", - content: dateToString(exportValidation?.date || "", "tr"), - }, - { - title: "Stamp", - content: exportValidation?.stampType || "", - }, - ], - }; - const billingList: SummaryListType = { - title: "Billing", - rows: [ - { - title: "Status", - content: billing?.status?.toString() || "", - contentClassName: getStatusColor(billing?.status?.toString() || ""), - }, - { - title: "Date", - content: dateToString(billing?.billingDate || "", "tr"), - }, - { - title: "Billing No", - content: billing?.billingNumber || "", - }, - ], - }; - const refundList: SummaryListType = { - title: "Refund", - rows: [ - { - title: "Status", - content: refund?.status?.toString() || "", - contentClassName: getStatusColor(refund?.status?.toString() || ""), - }, - { - title: "Date", - content: dateToString(refund?.paidDate || "", "tr"), - }, - { - title: "Refund Method", - content: refund?.refundMethod || "", - }, - { - title: "Location", - content: refund?.refundLocation || "", - }, - ], - }; - return ( - <> - - - - - Tag Summary - - -
-
-
Tax Free Tag ID
-
{tagDetail.tagNumber}
-
-
-
Status
-
- {tagDetail.status} -
-
-
-
Issue Date
-
- {dateToString(tagDetail.issueDate || "", "tr")} -
-
- Exp: {dateToString(tagDetail.expireDate || "", "tr")} -
-
-
-
-
- - -
- - - -
-
-
- - ); -} - -export default TagSummary; diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/_components/totals.tsx b/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/_components/totals.tsx deleted file mode 100644 index 222b41cf7..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/_components/totals.tsx +++ /dev/null @@ -1,33 +0,0 @@ -"use client"; -import type { UniRefund_TagService_Tags_TagDetailDto } from "@ayasofyazilim/saas/TagService"; -import InfoCard from "@repo/ayasofyazilim-ui/molecules/infocard"; -import { DollarSign } from "lucide-react"; -import { useParams } from "next/navigation"; -import { localizeCurrency } from "src/utils/utils-number"; - -function Totals({ - tagDetail, -}: { - tagDetail: UniRefund_TagService_Tags_TagDetailDto; -}) { - const params = useParams<{ lang: "en" }>(); - const currencyFormatter = localizeCurrency(params.lang); - return ( -
- {tagDetail.totals?.map((total) => ( - } - key={total.totalType} - title={total.totalType || ""} - /> - ))} -
- ); -} - -export default Totals; diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/_components/traveller-details.tsx b/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/_components/traveller-details.tsx deleted file mode 100644 index 2160be456..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/_components/traveller-details.tsx +++ /dev/null @@ -1,62 +0,0 @@ -"use client"; -import { Card, CardHeader, CardTitle } from "@/components/ui/card"; -import type { UniRefund_TagService_Tags_TagDetailDto } from "@ayasofyazilim/saas/TagService"; -import { Plane } from "lucide-react"; -import Link from "next/link"; -import { getBaseLink } from "src/utils"; - -function TravellerDetails({ - tagDetail, -}: { - tagDetail: UniRefund_TagService_Tags_TagDetailDto; -}) { - return ( - - - - - Traveller details - - -
-
-
Full Name
-
- - {`${tagDetail.traveller?.firstname} ${tagDetail.traveller?.lastname}`} - -
-
-
-
- Travel Document No: -
-
- {tagDetail.traveller?.travelDocumentNumber} -
-
-
-
- Country of Residence -
-
- {tagDetail.traveller?.countryOfResidence} -
-
-
-
Nationality
-
{tagDetail.traveller?.nationality}
-
-
-
-
- ); -} - -export default TravellerDetails; diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/page.tsx b/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/page.tsx deleted file mode 100644 index 00dbed935..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/page.tsx +++ /dev/null @@ -1,28 +0,0 @@ -"use server"; - -import { notFound } from "next/navigation"; -import { getTagById } from "src/actions/unirefund/TagService/actions"; -import MerchantDetails from "./_components/merchant-details"; -import TagSummary from "./_components/tag-summary"; -import Totals from "./_components/totals"; -import TravellerDetails from "./_components/traveller-details"; - -export default async function Page({ params }: { params: { tagId: string } }) { - const response = await getTagById({ id: params.tagId }); - - if (response.type !== "success") return notFound(); - - const tagDetail = response.data; - return ( -
- -
- -
-
- - -
-
- ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/utils.ts b/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/utils.ts deleted file mode 100644 index 0628f0d30..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/details/[tagId]/utils.ts +++ /dev/null @@ -1,44 +0,0 @@ -"use client"; - -export function getStatusColor(status: string) { - switch (status) { - case "None": - return "text-gray-200"; // Durum belirlenmemiş - case "Open": - case "Issued": - case "ExportValidated": - return "text-green-700"; // İşlem başladı - case "PreIssued": - return "text-yellow-400"; // Hazırlık aşaması - case "WaitingGoodsValidation": - case "WaitingStampValidation": - return "text-yellow-500"; // Bekleyen işlemler - case "Declined": - case "Cancelled": - case "Expired": - return "text-red-500"; // İptal edilmiş, sona ermiş - case "PaymentBlocked": - case "PaymentProblem": - return "text-red-400"; // Ödeme engellenmiş veya problem var - case "PaymentInProgress": - case "Paid": - return "text-blue-500"; // Ödeme süreci veya tamamlanmış ödeme - case "Correction": - return "text-blue-400"; // Düzeltme aşaması - case "OptedOut": - return "text-gray-400"; // Durumdan çıkmış - default: - return "text-gray-400"; // Bilinmeyen durum - } -} -export function dateToString(date: string | null | undefined, locale: string) { - if (!date) return ""; - - return new Date(date).toLocaleDateString(locale, { - day: "2-digit", - month: "short", - year: "numeric", - hour: "2-digit", - minute: "2-digit", - }); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/details/actions.ts b/apps/web/src/app/[lang]/(unirefund)/operations/details/actions.ts deleted file mode 100644 index 07b77b8e4..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/details/actions.ts +++ /dev/null @@ -1,104 +0,0 @@ -"use server"; -import type { - GetApiTagServiceTagByIdDetailResponse, - GetApiTagServiceTagData, - GetApiTagServiceTagResponse, - GetApiTagServiceTagSummaryData, - GetApiTagServiceTagSummaryResponse, - UniRefund_TagService_Tags_CreateTagRequestDto, -} from "@ayasofyazilim/saas/TagService"; -import type { FilterColumnResult } from "@repo/ayasofyazilim-ui/molecules/tables/types"; -import { getMerchantsApi } from "src/actions/unirefund/CrmService/actions"; -import type { ServerResponse } from "src/lib"; -import { getTagServiceClient, structuredError } from "src/lib"; - -export async function getTags( - data: GetApiTagServiceTagData = {}, -): Promise> { - try { - const client = await getTagServiceClient(); - const response = await client.tag.getApiTagServiceTag(data); - return { - data: response, - message: "Tags fetched succesfully", - status: 200, - type: "success", - }; - } catch (error) { - return structuredError(error); - } -} - -export async function createTag( - requestBody: UniRefund_TagService_Tags_CreateTagRequestDto, -) { - try { - const client = await getTagServiceClient(); - const response = await client.tag.postApiTagServiceTag({ requestBody }); - return { - type: "success", - data: response, - status: 200, - message: "Tag created successfully", - }; - } catch (error) { - return structuredError(error); - } -} - -export async function getTagById({ - id, -}: { - id: string; -}): Promise> { - try { - const client = await getTagServiceClient(); - const response = await client.tag.getApiTagServiceTagByIdDetail({ - id, - }); - return { - type: "success", - data: response, - status: 200, - message: "Tag details fetched successfully", - }; - } catch (error) { - return structuredError(error); - } -} - -export async function getSummary( - data: GetApiTagServiceTagSummaryData = {}, -): Promise> { - try { - const client = await getTagServiceClient(); - const response = await client.tag.getApiTagServiceTagSummary(data); - return { - data: response, - message: "Summary fetched succesfully", - status: 200, - type: "success", - }; - } catch (error) { - return structuredError(error); - } -} - -export async function getMerchants(page: number, filter?: FilterColumnResult) { - const response = await getMerchantsApi({ - maxResultCount: 10, - skipCount: page * 10, - ...filter, - }); - if (response.type === "success") { - const data = response.data; - return { - type: "success", - data: { items: data.items || [], totalCount: data.totalCount || 0 }, - }; - } - return { - type: response.type, - data: { items: [], totalCount: 0 }, - }; -} diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/details/add/page.tsx b/apps/web/src/app/[lang]/(unirefund)/operations/details/add/page.tsx deleted file mode 100644 index 1ea7758c6..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/details/add/page.tsx +++ /dev/null @@ -1,323 +0,0 @@ -"use client"; -import { Button } from "@/components/ui/button"; -import { Card } from "@/components/ui/card"; -import { Input } from "@/components/ui/input"; -import { toast } from "@/components/ui/sonner"; -import type { - UniRefund_CRMService_Merchants_MerchantDetailDto as MerchantDetailDto, - PagedResultDto_MerchantProfileDto, -} from "@ayasofyazilim/saas/CRMService"; -import DataTable from "@repo/ayasofyazilim-ui/molecules/tables"; -import AutoForm from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import Stepper, { - StepperContent, -} from "@repo/ayasofyazilim-ui/organisms/stepper"; -import SelectMerchant from "@repo/ui/select-merchant"; -import type { CellContext, ColumnDef } from "@tanstack/react-table"; -import { columnsGenerator } from "node_modules/@repo/ayasofyazilim-ui/src/molecules/tables/columnsGenerator"; -import { useEffect, useState } from "react"; -import { z } from "zod"; -import { getTableDataDetail } from "src/actions/api-requests"; -import { getMerchantsApi } from "src/actions/unirefund/CrmService/actions"; -import { getResourceDataClient } from "src/language-data/unirefund/ContractService"; -import { createTag } from "../actions"; - -interface Payment { - name: string; - tax: number; - minimum?: number; - Sales?: number; -} -const payments: Payment[] = [ - { name: "Income Tax", tax: 15 }, - { name: "Sales Tax", tax: 8.5, minimum: 100 }, - { name: "Luxury Tax", tax: 25 }, -]; - -const tableType = { - $schema: "http://json-schema.org/draft-07/schema#", - title: "Payment", - type: "object", - properties: { - name: { - type: "string", - description: "The name of the payment", - }, - tax: { - type: "number", - description: "The tax rate for the payment", - }, - minimum: { - type: "number", - description: "The optional minimum amount for the payment", - }, - }, - required: ["name", "tax"], - additionalProperties: false, -}; - -function Cell({ - getValue, - row: { index }, - column: { id }, - table, -}: CellContext) { - const initialValue = getValue(); - const [value, setValue] = useState(initialValue); - - const onBlur = () => { - table.options.meta?.updateData(index, id, value); - }; - - useEffect(() => { - setValue(initialValue); - }, [initialValue]); - - return ( - { - setValue(e.target.value); - }} - type="number" - value={value as number} - /> - ); -} - -const salesColumn: ColumnDef = { - accessorKey: "Sales", - header: () =>
Sales
, - cell: (data) => Cell(data), -}; - -export default function Page() { - const columns = columnsGenerator({ - data: { - tableType, - selectable: false, - }, - }); - const customColumns = [...columns, salesColumn] as ColumnDef[]; - const languageData = getResourceDataClient("en"); - const [paymentData, setPaymentData] = useState(payments); - - const [merchantList, setMerchantList] = - useState(); - const [merchantDetails, setMerchantDetails] = useState(); - const [selectedMerchant, setSelectedMerchant] = useState(""); - const [traveller, setTraveller] = useState>(); - const [travellerNext, setTravellerNext] = useState(false); - - useEffect(() => { - void getMerchantsApi().then((response) => { - if (response.type === "success") { - setMerchantList(response.data); - } else if (response.type === "api-error") { - toast.error(response.message || "Merchant loading failed"); - } else { - toast.error("Fatal error"); - } - }); - }, []); - const handleMerchantChange = (value: string) => { - setSelectedMerchant(value); - setMerchantDetails(undefined); - void getTableDataDetail("merchants", value).then((response) => { - if (response.type === "success") { - setMerchantDetails(response.data as MerchantDetailDto); - } else if (response.type === "api-error") { - toast.error(response.message || "Merchant loading failed"); - } else { - toast.error("Fatal error"); - } - }); - }; - - // const [isSubmitStarted, setIsSubmitStarted] = useState(false); - const [step, setStep] = useState(0); - - // const steps: Step[] = [ - // { - // title: "Merchant information", - // autoformArgs: { - // formSchema: z.object({ - // VatNumber: z.string(), - // CountryCode: z.string(), - // BranchId: z.string(), - // }), - // }, - // }, - // { - // title: "Traveller information", - // autoformArgs: { - // formSchema: z.object({ - // documentNumber: z.string(), - // name: z.string(), - // lastName: z.string(), - // residency: z.string(), - // nationality: z.string(), - // expirationDate: z.string(), - // BirthDate: z.string(), - // }), - // }, - // }, - // { - // title: "Tax information", - // autoformArgs: { - // formSchema: z.object({ - // storeName: z.string(), - // facturaNo: z.string(), - // taxes: z.array( - // z.object({ - // taxName: z.string(), - // taxAmount: z.number(), - // }), - // ), - // }), - // fieldConfig: { - // all: { - // withoutBorder: false, - // inputProps: { - // showLabel: true, - // className: "w-full", - // }, - // }, - // taxes: { - // withoutBorder: false, - // inputProps: { - // showLabel: true, - // className: "bg-red-500", - // }, - // }, - // }, - // }, - // }, - // ]; - - return ( -
-
-
- - - - - - - - { - setTraveller(values); - setTravellerNext(true); - }} - onValuesChange={() => { - setTravellerNext(false); - }} - values={traveller} - /> - - - { - setPaymentData(data); - }} - showView={false} - /> - {paymentData.map((payment) => ( -
-

- {payment.name}/{payment.tax}% ={" "} - {(payment.Sales || 0) * (payment.tax / 100)} -

-
- ))} - -
-
-
-
-
-
- ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/details/data.ts b/apps/web/src/app/[lang]/(unirefund)/operations/details/data.ts deleted file mode 100644 index cf88948c9..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/details/data.ts +++ /dev/null @@ -1,352 +0,0 @@ -import type { SchemaType } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; - -export const $schema_details: SchemaType = { - type: "object", - displayName: "Example Schema Display Name", // Add this line - properties: { - taxFreeTagFacturaNumber: { - type: "string", - description: "The tax-free tag or invoice number.", - }, - date: { - type: "string", - format: "date-time", - description: "The date of the transaction.", - }, - traveller: { - type: "string", - description: "The name of the traveller.", - }, - company: { - type: "string", - description: "The name of the company involved in the transaction.", - }, - salesAmount: { - type: "number", - description: "The amount of sales in the transaction.", - }, - refund: { - type: "number", - description: "The amount refunded.", - }, - status: { - type: "string", - enum: ["Pending", "Completed", "Cancelled"], - description: "The status of the transaction.", - }, - }, - required: [ - "taxFreeTagFacturaNumber", - "date", - "traveller", - "company", - "salesAmount", - "refund", - "status", - ], - additionalProperties: false, -}; - -export interface TaxFreeTag { - taxFreeTagFacturaNumber: string; - date: string; - traveller: string; - company: string; - salesAmount: number; - refund: number; - status: "Completed" | "Pending" | "Cancelled"; -} - -export const $schema_list: TaxFreeTag[] = [ - { - taxFreeTagFacturaNumber: "TF123456", - date: "2024-08-01", - traveller: "Alice Johnson", - company: "TravelTech Ltd.", - salesAmount: 1200.0, - refund: 100.0, - status: "Completed", - }, - { - taxFreeTagFacturaNumber: "TF123457", - date: "2024-08-02", - traveller: "Bob Smith", - company: "Global Tours Inc.", - salesAmount: 800.0, - refund: 50.0, - status: "Pending", - }, - { - taxFreeTagFacturaNumber: "TF123458", - date: "2024-08-03", - traveller: "Carol Davis", - company: "Holiday Makers", - salesAmount: 1500.0, - refund: 200.0, - status: "Completed", - }, - { - taxFreeTagFacturaNumber: "TF123459", - date: "2024-08-04", - traveller: "David Wilson", - company: "TravelTech Ltd.", - salesAmount: 500.0, - refund: 0.0, - status: "Cancelled", - }, - { - taxFreeTagFacturaNumber: "TF123460", - date: "2024-08-05", - traveller: "Emma Brown", - company: "Global Tours Inc.", - salesAmount: 1000.0, - refund: 75.0, - status: "Completed", - }, - { - taxFreeTagFacturaNumber: "TF123461", - date: "2024-08-06", - traveller: "Frank Harris", - company: "Holiday Makers", - salesAmount: 600.0, - refund: 60.0, - status: "Pending", - }, - { - taxFreeTagFacturaNumber: "TF123462", - date: "2024-08-07", - traveller: "Grace Lee", - company: "TravelTech Ltd.", - salesAmount: 900.0, - refund: 90.0, - status: "Completed", - }, - { - taxFreeTagFacturaNumber: "TF123463", - date: "2024-08-08", - traveller: "Henry Clark", - company: "Global Tours Inc.", - salesAmount: 750.0, - refund: 30.0, - status: "Completed", - }, - { - taxFreeTagFacturaNumber: "TF123464", - date: "2024-08-09", - traveller: "Ivy Martinez", - company: "Holiday Makers", - salesAmount: 1300.0, - refund: 150.0, - status: "Pending", - }, - { - taxFreeTagFacturaNumber: "TF123465", - date: "2024-08-10", - traveller: "Jack Thompson", - company: "TravelTech Ltd.", - salesAmount: 400.0, - refund: 20.0, - status: "Completed", - }, - { - taxFreeTagFacturaNumber: "TF123466", - date: "2024-08-11", - traveller: "Karen White", - company: "Global Tours Inc.", - salesAmount: 1100.0, - refund: 120.0, - status: "Cancelled", - }, - { - taxFreeTagFacturaNumber: "TF123467", - date: "2024-08-12", - traveller: "Louis Anderson", - company: "Holiday Makers", - salesAmount: 1400.0, - refund: 200.0, - status: "Completed", - }, - { - taxFreeTagFacturaNumber: "TF123468", - date: "2024-08-13", - traveller: "Mona Harris", - company: "TravelTech Ltd.", - salesAmount: 850.0, - refund: 90.0, - status: "Pending", - }, - { - taxFreeTagFacturaNumber: "TF123469", - date: "2024-08-14", - traveller: "Nathan King", - company: "Global Tours Inc.", - salesAmount: 550.0, - refund: 30.0, - status: "Completed", - }, - { - taxFreeTagFacturaNumber: "TF123470", - date: "2024-08-15", - traveller: "Olivia Scott", - company: "Holiday Makers", - salesAmount: 1600.0, - refund: 180.0, - status: "Cancelled", - }, -]; - -const generateTagsFromSchemaList = (schemaList: typeof $schema_list) => { - return schemaList.map((item, index) => { - let statusValue = 1; - switch (item.status) { - case "Completed": - statusValue = 1; - break; - case "Pending": - statusValue = 2; - break; - default: - statusValue = 3; - break; - } - return { - Id: `TAG${index + 1}`, // Example tag ID, you can generate it based on your needs - Summary: { - Tag: item.taxFreeTagFacturaNumber, - Status: statusValue, - RefundMethod: 2, // Assuming a default value, adjust based on your logic - IssuedDate: item.date, - ExpireDate: "2024-12-31", // Default value, adjust based on your logic - }, - ExportValidation: { - Id: `EV${index + 1}`, // Example export validation ID - ExportDate: item.date, - ExportLocation: 101, // Example location, adjust based on your logic - StampType: 3, // Example stamp type, adjust based on your logic - }, - Refund: { - Id: `R${index + 1}`, // Example refund ID - SubmissionDate: item.date, - PaidDate: item.status === "Completed" ? "2024-08-13" : "", // Example logic for PaidDate - RefundLocation: { - ID: "RL001", // Example refund location ID - Name: "Refund Location Name", // Example refund location name - }, - Status: statusValue, - RefundMethod: 2, // Assuming a default value, adjust based on your logic - }, - Invoicing: { - Id: `INV${index + 1}`, // Example invoicing ID - InvoicingDate: "2024-08-09", // Default value, adjust based on your logic - InvoicingNumber: `INV000${index + 1}`, // Example invoicing number - InvoicingStatus: item.status === "Completed" ? 1 : 2, // Example logic for invoicing status - }, - Merchant: { - Id: `M${index + 1}`, // Example merchant ID - Name: item.company, // Using the company name as the merchant name - ProductGroups: [ - { - Id: `PG001`, // Example product group ID - Description: "Product Group 1", // Example product group description - }, - ], - Address: { - Id: `A${index + 1}`, // Example address ID - FullText: "1234 Sample Street, City, Country", // Example address, adjust based on your logic - }, - }, - Traveller: { - Id: `T${index + 1}`, // Example traveller ID - TravelDocumentNumber: "TN123456789", // Example travel document number - CountryOfResidenceCode: 100, // Example country code - CountryOfResidence: "Country Name", // Example country name - NationalityCode: 200, // Example nationality code - Nationality: "Nationality Name", // Example nationality name - Name: item.traveller.split(" ")[0], // Assuming first name from traveller name - Surname: item.traveller.split(" ")[1], // Assuming surname from traveller name - }, - Trip: { - Id: `TR${index + 1}`, // Example trip ID - VisitingDate: "2024-08-01", // Default value, adjust based on your logic - DepartureDate: "2024-08-05", // Default value, adjust based on your logic - FlightNumber: "FL1234", // Example flight number - DepartingAirport: { - Id: "DA001", // Example departing airport ID - Name: "Departing Airport Name", // Example departing airport name - }, - DestinationAirport: { - Id: "DA002", // Example destination airport ID - Name: "Destination Airport Name", // Example destination airport name - }, - }, - Invoices: [ - { - Id: `I${index + 1}`, - Number: `INV00${index + 1}`, - Currency: { - Id: "CUR001", - Currency: "USD", - CurrencySymbol: "$", - }, - TotalAmount: item.salesAmount, - InvoiceLines: [ - { - Id: `IL001`, - ProductGroup: { - Id: "PG001", - Description: "Product Group 1", - }, - Amount: item.salesAmount / 2, // Example logic to split sales amount - Vat: { - Id: "VAT001", - Rate: 5.0, - Amount: (item.salesAmount / 2) * 0.05, // Example VAT calculation - VatBase: (item.salesAmount / 2) * 0.95, // Example VAT base calculation - }, - }, - ], - }, - ], - Totals: [ - { - Description: "Amount", - Amount: item.salesAmount, - }, - { - Description: "Refund", - Amount: item.refund, - }, - { - Description: "Income", - Amount: item.salesAmount - item.refund, - }, - ], - Earnings: [ - { - Description: "Total Earnings", - Amount: item.salesAmount * 0.02, // Example earnings calculation - }, - { - Description: "Customer Earnings", - Amount: item.refund * 0.01, // Example customer earnings calculation - }, - { - Description: "Refund point Earnings", - Amount: item.refund * 0.005, // Example refund point earnings calculation - }, - { - Description: "Merchant Earnings", - Amount: (item.salesAmount - item.refund) * 0.01, // Example merchant earnings calculation - }, - ], - }; - }); -}; - -export function getIndexOfTagByFacturaId(facturaId: string) { - return $schema_list.findIndex( - (item) => item.taxFreeTagFacturaNumber === facturaId, - ); -} - -export const tags = generateTagsFromSchemaList($schema_list); diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/details/page.tsx b/apps/web/src/app/[lang]/(unirefund)/operations/details/page.tsx deleted file mode 100644 index 2a8671a63..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/details/page.tsx +++ /dev/null @@ -1,14 +0,0 @@ -"use server"; - -import { getCountriesApi } from "src/actions/unirefund/LocationService/actions"; -import Table from "./table"; - -export default async function Page() { - const nationalitiesResponse = await getCountriesApi(); - const nationalitiesData = - nationalitiesResponse.type === "success" - ? nationalitiesResponse.data.items || [] - : []; - - return ; -} diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/details/table.tsx b/apps/web/src/app/[lang]/(unirefund)/operations/details/table.tsx deleted file mode 100644 index 5772613f5..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/details/table.tsx +++ /dev/null @@ -1,274 +0,0 @@ -"use client"; -import { toast } from "@/components/ui/sonner"; -import type { PagedResultDto_MerchantProfileDto } from "@ayasofyazilim/saas/CRMService"; -import { $UniRefund_CRMService_Merchants_MerchantProfileDto } from "@ayasofyazilim/saas/CRMService"; -import type { - GetApiTagServiceTagResponse, - GetApiTagServiceTagSummaryResponse, - UniRefund_TagService_Tags_TagListItemDto, -} from "@ayasofyazilim/saas/TagService"; -import { $UniRefund_TagService_Tags_TagListItemDto } from "@ayasofyazilim/saas/TagService"; -import type { - GetApiTravellerServiceTravellersResponse, - PagedResultDto_TravellerListProfileDto, -} from "@ayasofyazilim/saas/TravellerService"; -import { $UniRefund_TravellerService_Travellers_TravellerListProfileDto } from "@ayasofyazilim/saas/TravellerService"; -import type { - ColumnsType, - fetchRequestProps, -} from "@repo/ayasofyazilim-ui/molecules/tables/types"; -import Dashboard from "@repo/ayasofyazilim-ui/templates/dashboard"; -import { ChartBarIncreasing, CreditCard, DollarSign } from "lucide-react"; -import { useParams, useRouter } from "next/navigation"; -import { useEffect, useState } from "react"; -import Link from "next/link"; -import type { CellContext } from "@tanstack/react-table"; -import { getBaseLink } from "src/utils"; -import { localizeCurrency, localizeNumber } from "src/utils/utils-number"; -import { getMerchantsApi } from "src/actions/unirefund/CrmService/actions"; -import { getTravellers } from "src/actions/unirefund/TravellerService/actions"; -import type { CountryDto } from "src/actions/unirefund/LocationService/types"; -import { dataConfigOfParties } from "../../parties/table-data"; -import type { DetailedFilter, TypedFilter } from "../filter"; -import { typedCommonFilter } from "../filter"; -import { getTravellerFilterClient, travellerTableSchema } from "./utils"; -import type { TravllersKeys } from "./utils"; -import { getMerchants, getSummary, getTags } from "./actions"; - -function cellWithLink( - cell: CellContext, -) { - const id = cell.row.original.id || ""; - const tagNumber = cell.getValue() as string; - return ( - - {tagNumber} - - ); -} -function cellWithDate( - cell: CellContext, - lang: Intl.LocalesArgument, -) { - return new Date(cell.getValue() as string).toLocaleDateString(lang, { - day: "2-digit", - month: "short", - year: "numeric", - }); -} - -function Table({ nationalitiesData }: { nationalitiesData: CountryDto[] }) { - const params = useParams<{ - lang: string; - }>(); - const [merchant, setMerchant] = useState( - {}, - ); - const [travellers, setTravellers] = - useState({}); - - const numberFormatter = (value: number) => - localizeNumber(params.lang).format(value); - const currencyFormatter = localizeCurrency(params.lang); - - useEffect(() => { - async function getMerchantsLocally() { - const merchants = await getMerchantsApi(); - if (merchants.type === "success") { - setMerchant(merchants.data); - } - const travellersList = await getTravellers(1); - setTravellers( - travellersList.data as GetApiTravellerServiceTravellersResponse, - ); - } - void getMerchantsLocally(); - }, []); - - const travellerExcludeList: TravllersKeys[] = [ - ...travellerTableSchema.excludeList, - "identificationType", - "languagePreferenceCode", - ]; - const travellerPosition: TravllersKeys[] = [ - "firstName", - "lastName", - "nationalityCountryName", - ]; - - // convert type filter to array - const typedFilters: TypedFilter = { - ...typedCommonFilter, - merchantIds: { - name: "merchantIds", - type: "select-async", - displayName: "Merchant", - value: "", - rowCount: merchant.totalCount || 0, - filterProperty: "id", - showProperty: "name", - data: merchant.items || [], - columnDataType: { - tableType: $UniRefund_CRMService_Merchants_MerchantProfileDto, - ...dataConfigOfParties.merchants.tableSchema, - hideAction: true, - }, - fetchRequest: getMerchants, - detailedFilters: dataConfigOfParties.merchants.detailedFilters, - }, - travellerIds: { - name: "travellerIds", - type: "select-async", - displayName: "Traveller", - value: "", - rowCount: travellers.totalCount || 0, - filterProperty: "id", - showProperty: "firstName", - data: travellers.items || [], - columnDataType: { - tableType: - $UniRefund_TravellerService_Travellers_TravellerListProfileDto, - excludeList: travellerExcludeList, - positions: travellerPosition, - hideAction: true, - }, - fetchRequest: async (page, filter) => { - const response = await getTravellers(page, filter); - if (response.type === "success") { - const data = response.data as PagedResultDto_TravellerListProfileDto; - return { - type: "success", - data: { items: data.items || [], totalCount: data.totalCount || 0 }, - }; - } - return { - type: "success", - data: { items: [], totalCount: 0 }, - }; - }, - detailedFilters: getTravellerFilterClient("en", nationalitiesData), - }, - }; - const filters: DetailedFilter[] = Object.values(typedFilters); - - const router = useRouter(); - const [loading, setLoading] = useState(true); - const [tags, setTags] = useState(); - const [summary, setSummary] = useState(); - const fetchTags = ({ page, filter, pageSize }: fetchRequestProps) => { - const _pageSize = pageSize || 10; - // setLoading(true);s - void getTags({ - maxResultCount: _pageSize, - skipCount: page * _pageSize, - ...filter, - }) - .then((res) => { - if (res.type === "success") { - setTags(res.data); - } - if (res.type === "error" || res.type === "api-error") { - toast.error(res.message); - } - }) - .finally(() => { - setLoading(false); - // handleFilter(filter); - }); - void getSummary({ maxResultCount: 10, skipCount: page * 10, ...filter }) - .then((res) => { - if (res.type === "success") { - setSummary(res.data); - return; - } - toast.error(res.message); - }) - .finally(() => { - // setLoading(false); - // handleFilter(filter); - }); - }; - - useEffect(() => { - async function getTagsFromAPI() { - const tagsList = await getTags(); - if (tagsList.type === "success") { - setTags(tagsList.data); - toast.success(tagsList.message); - setLoading(false); - return; - } - toast.error(tagsList.message); - } - void getTagsFromAPI(); - }, []); - const columnsData: ColumnsType = { - type: "Auto", - data: { - tableType: $UniRefund_TagService_Tags_TagListItemDto, - excludeList: ["id"], - customCells: { - tagNumber: cellWithLink, - issueDate: (cell) => cellWithDate(cell, params.lang), - expireDate: (cell) => cellWithDate(cell, params.lang), - }, - actionList: [ - { - cta: "Open in new page", - type: "Action", - callback: (originalRow: UniRefund_TagService_Tags_TagListItemDto) => { - router.push(getBaseLink(`operations/details/${originalRow.id}`)); - }, - }, - ], - }, - }; - const summaryCards = [ - { - title: "Total Tags", - content: numberFormatter(tags?.totalCount || 0), - icon: , - }, - { - title: "Total Sales", - content: `+${numberFormatter(summary?.totalSalesAmount || 0)}`, - icon: , - }, - { - title: "Total Refunds", - content: currencyFormatter( - summary?.totalRefundAmount || 0, - summary?.currency || "TRY", - ), - icon: , - }, - { - title: "Currency", - content: summary?.currency || "", - footer: "", - }, - ]; - - return ( -
- -
- ); -} - -export default Table; diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/details/utils.ts b/apps/web/src/app/[lang]/(unirefund)/operations/details/utils.ts deleted file mode 100644 index bd1ac05af..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/details/utils.ts +++ /dev/null @@ -1,92 +0,0 @@ -import type { GetApiTravellerServiceTravellersData } from "@ayasofyazilim/saas/TravellerService"; -import { $UniRefund_TravellerService_Travellers_TravellerListProfileDto } from "@ayasofyazilim/saas/TravellerService"; -import type { ColumnFilter } from "@repo/ayasofyazilim-ui/molecules/tables/types"; -import type { TravellerServiceResource } from "src/language-data/unirefund/TravellerService"; -import { getResourceDataClient } from "src/language-data/unirefund/TravellerService"; -import type { CountryDto } from "../../../../../actions/unirefund/LocationService/types"; - -export type TravllersKeys = - keyof typeof $UniRefund_TravellerService_Travellers_TravellerListProfileDto.properties; -const travellerKeys: TravllersKeys[] = [ - "id", - "userAccountId", - "firstName", - "middleName", - "lastName", - "residenceCountryCode2", - "nationalityCountryCode2", - "hasUserAccount", -]; - -export const travellerTableSchema: { - excludeList: TravllersKeys[]; - schema: typeof $UniRefund_TravellerService_Travellers_TravellerListProfileDto; -} = { - excludeList: travellerKeys, - schema: $UniRefund_TravellerService_Travellers_TravellerListProfileDto, -}; -export type DetailedFilterTraveller = ColumnFilter & { - name: keyof GetApiTravellerServiceTravellersData; -}; -export function getTravellerFilterClient( - lang: string, - nationalitiesData: CountryDto[], -) { - const languageData = getResourceDataClient(lang); - return getTravellerFilters(languageData, nationalitiesData); -} - -export function getTravellerFilters( - languageData: TravellerServiceResource, - nationalitiesData: CountryDto[], -) { - const filters: DetailedFilterTraveller[] = [ - { - name: "showExpired", - displayName: languageData["Travellers.ShowExpired"], - type: "boolean", - value: "false", - }, - { - name: "travelDocumentNumber", - displayName: languageData["Travellers.TravelDocumentNumber"], - type: "string", - value: "", - }, - { - name: "fullName", - displayName: languageData.FullName, - type: "string", - value: "", - }, - { - name: "nationalities", - displayName: languageData.Nationalities, - type: "select-multiple", - value: "", - multiSelectProps: { - options: [ - ...nationalitiesData.map((item) => ({ - label: item.name, - value: item.code2, - })), - ], - }, - }, - { - name: "residences", - displayName: languageData.Residences, - type: "select-multiple", - value: "", - multiSelectProps: { - options: [ - ...nationalitiesData.map((item) => ({ - label: item.name, - value: item.code2, - })), - ], - }, - }, - ]; - return filters; -} diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/export-validation/[exportId]/form.tsx b/apps/web/src/app/[lang]/(unirefund)/operations/export-validation/[exportId]/form.tsx deleted file mode 100644 index 2b7cf64ed..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/export-validation/[exportId]/form.tsx +++ /dev/null @@ -1,102 +0,0 @@ -"use client"; - -import { toast } from "@/components/ui/sonner"; -import type { UniRefund_CRMService_Customss_CustomsProfileDto } from "@ayasofyazilim/saas/CRMService"; -import type { - UniRefund_ExportValidationService_ExportValidations_ExportValidationDto, - UniRefund_ExportValidationService_ExportValidations_UpdateExportValidationDto, -} from "@ayasofyazilim/saas/ExportValidationService"; -import { $UniRefund_ExportValidationService_ExportValidations_UpdateExportValidationDto } from "@ayasofyazilim/saas/ExportValidationService"; -import type { UniRefund_TagService_Tags_TagListItemDto } from "@ayasofyazilim/saas/TagService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import AutoForm, { - AutoFormSubmit, - createFieldConfigWithResource, - CustomCombobox, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { putExportValidationApi } from "src/actions/unirefund/ExportValidationService/put-actions"; -import type { ExportValidationServiceResource } from "src/language-data/unirefund/ExportValidationService"; - -const ExportValidationSchema = createZodObject( - $UniRefund_ExportValidationService_ExportValidations_UpdateExportValidationDto, -); - -export default function Form({ - exportId, - languageData, - ExportValidationData, - TagsData, - CustomsData, -}: { - exportId: string; - languageData: ExportValidationServiceResource; - ExportValidationData: UniRefund_ExportValidationService_ExportValidations_ExportValidationDto; - TagsData: UniRefund_TagService_Tags_TagListItemDto[]; - CustomsData: UniRefund_CRMService_Customss_CustomsProfileDto[]; -}) { - async function updateExportValidation( - data: UniRefund_ExportValidationService_ExportValidations_UpdateExportValidationDto, - ) { - const response = await putExportValidationApi({ - id: exportId, - requestBody: data, - }); - if (response.type === "success") { - toast.success(languageData["ExportValidation.Update.Success"]); - window.location.reload(); - } else { - toast.error(response.message); - } - } - - const translatedForm = createFieldConfigWithResource({ - schema: - $UniRefund_ExportValidationService_ExportValidations_UpdateExportValidationDto, - resources: languageData, - extend: { - exportLocationId: { - renderer: (props) => ( - - childrenProps={props} - emptyValue={languageData["Custom.Select"]} - list={CustomsData} - searchPlaceholder={languageData["Select.Placeholder"]} - searchResultLabel={languageData["Select.ResultLabel"]} - selectIdentifier="id" - selectLabel="name" - /> - ), - }, - referenceId: { containerClassName: "gap-2" }, - tagId: { - renderer: (props) => ( - - childrenProps={props} - emptyValue={languageData["Tag.Select"]} - list={TagsData} - searchPlaceholder={languageData["Select.Placeholder"]} - searchResultLabel={languageData["Select.ResultLabel"]} - selectIdentifier="id" - selectLabel="tagNumber" - /> - ), - }, - }, - }); - - return ( - { - void updateExportValidation(formdata); - }} - values={ExportValidationData} - > - - {languageData.Save} - - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/export-validation/[exportId]/page.tsx b/apps/web/src/app/[lang]/(unirefund)/operations/export-validation/[exportId]/page.tsx deleted file mode 100644 index 59cc28f26..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/export-validation/[exportId]/page.tsx +++ /dev/null @@ -1,33 +0,0 @@ -"use server"; - -import { getCustomsApi } from "src/actions/unirefund/CrmService/actions"; -import { getExportValidationDetailApi } from "src/actions/unirefund/ExportValidationService/actions"; -import { getTagsApi } from "src/actions/unirefund/TagService/actions"; -import { getResourceData } from "src/language-data/unirefund/ExportValidationService"; -import Form from "./form"; - -export default async function Page({ - params, -}: { - params: { exportId: string; lang: string }; -}) { - const { languageData } = await getResourceData(params.lang); - const ExportValidation = await getExportValidationDetailApi(params.exportId); - const Customs = await getCustomsApi(); - const Tags = await getTagsApi(); - - const ExportValidationList = - ExportValidation.type === "success" && ExportValidation.data; - const CustomsList = (Customs.type === "success" && Customs.data.items) || []; - const TagsList = (Tags.type === "success" && Tags.data.items) || []; - - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/export-validation/new/form.tsx b/apps/web/src/app/[lang]/(unirefund)/operations/export-validation/new/form.tsx deleted file mode 100644 index 1c2d8eaa8..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/export-validation/new/form.tsx +++ /dev/null @@ -1,106 +0,0 @@ -"use client"; -import { toast } from "@/components/ui/sonner"; -import type { UniRefund_CRMService_Customss_CustomsProfileDto } from "@ayasofyazilim/saas/CRMService"; -import type { UniRefund_ExportValidationService_ExportValidations_CreateExportValidationDto } from "@ayasofyazilim/saas/ExportValidationService"; -import { $UniRefund_ExportValidationService_ExportValidations_CreateExportValidationDto } from "@ayasofyazilim/saas/ExportValidationService"; -import type { UniRefund_TagService_Tags_TagListItemDto } from "@ayasofyazilim/saas/TagService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import AutoForm, { - AutoFormSubmit, - createFieldConfigWithResource, - CustomCombobox, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { useRouter } from "next/navigation"; -import { postExportValidationApi } from "src/actions/unirefund/ExportValidationService/post-actions"; -import type { ExportValidationServiceResource } from "src/language-data/unirefund/ExportValidationService"; -import { getBaseLink } from "src/utils"; - -const ExportValidationSchema = createZodObject( - $UniRefund_ExportValidationService_ExportValidations_CreateExportValidationDto, - [ - "tagId", - "exportLocationId", - "referenceId", - "exportDate", - "status", - "stampType", - "initialValidationResult", - "finalValidationResult", - ], -); - -export default function Page({ - languageData, - CustomsData, - TagsData, -}: { - languageData: ExportValidationServiceResource; - CustomsData: UniRefund_CRMService_Customss_CustomsProfileDto[]; - TagsData: UniRefund_TagService_Tags_TagListItemDto[]; -}) { - const router = useRouter(); - - const translatedForm = createFieldConfigWithResource({ - schema: - $UniRefund_ExportValidationService_ExportValidations_CreateExportValidationDto, - resources: languageData, - extend: { - exportLocationId: { - renderer: (props) => ( - - childrenProps={props} - emptyValue={languageData["Custom.Select"]} - list={CustomsData} - searchPlaceholder={languageData["Select.Placeholder"]} - searchResultLabel={languageData["Select.ResultLabel"]} - selectIdentifier="id" - selectLabel="name" - /> - ), - }, - referenceId: { containerClassName: "gap-2" }, - tagId: { - renderer: (props) => ( - - childrenProps={props} - emptyValue={languageData["Tag.Select"]} - list={TagsData} - searchPlaceholder={languageData["Select.Placeholder"]} - searchResultLabel={languageData["Select.ResultLabel"]} - selectIdentifier="id" - selectLabel="tagNumber" - /> - ), - }, - }, - }); - - async function createExportValidation( - data: UniRefund_ExportValidationService_ExportValidations_CreateExportValidationDto, - ) { - const response = await postExportValidationApi({ requestBody: data }); - if (response.type === "error" || response.type === "api-error") { - toast.error( - response.message || languageData["ExportValidation.New.Error"], - ); - } else { - toast.success([languageData["ExportValidation.New.Success"]]); - router.push(getBaseLink(`/operations/export-validation`)); - } - } - return ( - { - void createExportValidation(val); - }} - stickyChildren - > - - {languageData.Save} - - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/export-validation/new/page.tsx b/apps/web/src/app/[lang]/(unirefund)/operations/export-validation/new/page.tsx deleted file mode 100644 index 4477560d4..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/export-validation/new/page.tsx +++ /dev/null @@ -1,21 +0,0 @@ -"use server"; - -import { getCustomsApi } from "src/actions/unirefund/CrmService/actions"; -import { getTagsApi } from "src/actions/unirefund/TagService/actions"; -import { getResourceData } from "src/language-data/unirefund/ExportValidationService"; -import Form from "./form"; - -export default async function Page({ params }: { params: { lang: string } }) { - const { languageData } = await getResourceData(params.lang); - const Customs = await getCustomsApi(); - const CustomsList = (Customs.type === "success" && Customs.data.items) || []; - const Tag = await getTagsApi(); - const TagsList = (Tag.type === "success" && Tag.data.items) || []; - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/export-validation/page.tsx b/apps/web/src/app/[lang]/(unirefund)/operations/export-validation/page.tsx deleted file mode 100644 index e2c68f8f3..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/export-validation/page.tsx +++ /dev/null @@ -1,167 +0,0 @@ -"use server"; -import type { GetApiExportValidationServiceExportValidationData } from "@ayasofyazilim/saas/ExportValidationService"; -import { - $UniRefund_ExportValidationService_ExportValidations_ExportValidationDto, - $UniRefund_ExportValidationService_ExportValidations_ExportValidationStatusCode, - $UniRefund_ExportValidationService_ExportValidations_StampTypeCode, -} from "@ayasofyazilim/saas/ExportValidationService"; -import { $UniRefund_TagService_Tags_TagListItemDto } from "@ayasofyazilim/saas/TagService"; -import type { - ColumnFilter, - FilterColumnResult, -} from "@repo/ayasofyazilim-ui/molecules/tables/types"; -import TableComponent from "@repo/ui/TableComponent"; -import { getResourceData } from "src/language-data/unirefund/ExportValidationService"; -import { deleteTableRow } from "../../../../../actions/api-requests"; -import { tableFetchRequest } from "../../../../../actions/table-utils"; -import { getTagsApi } from "../../../../../actions/unirefund/TagService/actions"; -import { Commonfilters } from "../filter"; - -export default async function Page({ params }: { params: { lang: string } }) { - async function getTags(page: number, filter?: FilterColumnResult) { - "use server"; - const response = await getTagsApi({ - maxResultCount: 10, - skipCount: page * 10, - ...filter, - }); - if (response.type === "success") { - return { - type: "success", - data: { - items: response.data.items || [], - totalCount: response.data.totalCount || 0, - }, - }; - } - return { - type: response.type, - data: { items: [], totalCount: 0 }, - }; - } - const { languageData } = await getResourceData(params.lang); - const { data } = await getTags(0); - - type FilterType = Partial< - keyof GetApiExportValidationServiceExportValidationData - >; - type DetailedFilter = ColumnFilter & { name: FilterType }; - type TypedFilter = Partial>; - - const typedFilters: TypedFilter = { - tagIds: { - name: "tagIds", - displayName: "Tag", - type: "select-async", - value: "", - rowCount: data.totalCount, - filterProperty: "id", - showProperty: "tagNumber", - data: data.items, - columnDataType: { - tableType: $UniRefund_TagService_Tags_TagListItemDto, - excludeList: ["id"], - }, - fetchRequest: getTags, - detailedFilters: [...Commonfilters], - }, - referenceId: { - name: "referenceId", - displayName: "Reference Id", - type: "string", - value: "", - }, - statuses: { - name: "statuses", - displayName: "Statuses", - type: "select-multiple", - value: "", - multiSelectProps: { - options: [ - ...$UniRefund_ExportValidationService_ExportValidations_ExportValidationStatusCode.enum.map( - (item) => ({ - label: item, - value: item, - }), - ), - ], - }, - }, - stampTypeCodes: { - name: "stampTypeCodes", - displayName: "Stamp Type Codes", - type: "select-multiple", - value: "", - multiSelectProps: { - options: [ - ...$UniRefund_ExportValidationService_ExportValidations_StampTypeCode.enum.map( - (item) => ({ - label: item, - value: item, - }), - ), - ], - }, - }, - exportEndDate: { - name: "exportEndDate", - displayName: "Export End Date", - type: "date", - value: "", - }, - exportStartDate: { - name: "exportStartDate", - displayName: "Export Start Date", - type: "date", - value: "", - }, - sorting: { - name: "sorting", - displayName: "Sorting", - type: "select", - value: "", - options: [ - { label: "Ascending", value: "asc" }, - { label: "Descending", value: "desc" }, - ], - placeholder: "Select Sorting", - }, - }; - - const filters: DetailedFilter[] = Object.values(typedFilters); - - return ( - { - "use server"; - const response = await deleteTableRow("export-validation", id); - return response; - }} - deleteableRow - detailedFilter={filters} - editOnNewPage - fetchRequest={(page, filter) => { - "use server"; - return tableFetchRequest("export-validation", page, filter); - }} - languageData={languageData} - tableSchema={{ - excludeList: [ - "tenantId", - "isDeleted", - "deleterId", - "deletionTime", - "lastModificationTime", - "lastModifierId", - "creationTime", - "creatorId", - "id", - ], - schema: - $UniRefund_ExportValidationService_ExportValidations_ExportValidationDto, - }} - /> - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/operations/filter.ts b/apps/web/src/app/[lang]/(unirefund)/operations/filter.ts deleted file mode 100644 index e2cb372d0..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/operations/filter.ts +++ /dev/null @@ -1,112 +0,0 @@ -import type { GetApiTagServiceTagData } from "@ayasofyazilim/saas/TagService"; -import { - $UniRefund_TagService_Tags_RefundType, - $UniRefund_TagService_Tags_TagStatusType, -} from "@ayasofyazilim/saas/TagService"; -import type { ColumnFilter } from "@repo/ayasofyazilim-ui/molecules/tables/types"; - -export type FilterType = Partial; -export type DetailedFilter = ColumnFilter & { name: FilterType }; -export type TypedFilter = Partial>; - -export const typedCommonFilter: TypedFilter = { - tagNumber: { - name: "tagNumber", - displayName: "Tag Number", - type: "string", - value: "", - }, - travellerDocumentNumber: { - name: "travellerDocumentNumber", - displayName: "Traveller Document Number", - type: "string", - value: "", - }, - travellerFullName: { - name: "travellerFullName", - displayName: "Traveller Name", - type: "string", - value: "", - }, - invoiceNumber: { - name: "invoiceNumber", - displayName: "Invoice Number", - type: "string", - value: "", - }, - paidEndDate: { - name: "paidEndDate", - displayName: "Paid End Date", - type: "date", - value: "", - }, - issuedStartDate: { - name: "issuedStartDate", - displayName: "Issued Start Date", - type: "date", - value: "", - }, - paidStartDate: { - name: "paidStartDate", - displayName: "Paid Start Date", - type: "date", - value: "", - }, - refundTypes: { - name: "refundTypes", - displayName: "Refund Types", - type: "select", - options: [ - ...$UniRefund_TagService_Tags_RefundType.enum.map((item) => ({ - label: item, - value: item, - })), - ], - placeholder: "Select Refund Type", - value: "", - }, - statuses: { - name: "statuses", - displayName: "Statuses", - type: "select", - value: "", - options: [ - ...$UniRefund_TagService_Tags_TagStatusType.enum.map((item) => ({ - label: item, - value: item, - })), - ], - placeholder: "Select Status", - }, - exportEndDate: { - name: "exportEndDate", - displayName: "Export End Date", - type: "date", - value: "", - }, - exportStartDate: { - name: "exportStartDate", - displayName: "Export Start Date", - type: "date", - value: "", - }, - issuedEndDate: { - name: "issuedEndDate", - displayName: "Issued End Date", - type: "date", - value: "", - }, - sorting: { - name: "sorting", - displayName: "Sorting", - type: "select", - value: "", - options: [ - { label: "Ascending", value: "asc" }, - { label: "Descending", value: "desc" }, - ], - placeholder: "Select Sorting", - }, -}; - -export const Commonfilters: DetailedFilter[] = Object.values(typedCommonFilter); diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/action.ts b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/action.ts deleted file mode 100644 index 2a40abef6..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/action.ts +++ /dev/null @@ -1,336 +0,0 @@ -"use server"; -import { getCRMServiceClient, structuredError } from "src/lib"; -import type { PartyNameType } from "../../types"; -import type { - PutAddress, - PutEmail, - PutMerchantBase, - PutMerchantOrganization, - PutName, - PutOrganization, - PutPersonalSummaries, - PutRefundPointOrganization, - PutTaxFreeOrganization, - PutTelephone, -} from "./types"; - -export async function putPartyRequests( - partyType: Exclude, -) { - const client = await getCRMServiceClient(); - const partyRequests = { - merchants: { - putOrganization: async (form: PutOrganization["data"]) => { - const data = form as PutMerchantOrganization; - return await client.merchant.putApiCrmServiceMerchantsByIdOrganizationsByOrganizationId( - { - requestBody: data.requestBody, - organizationId: data.organizationId, - id: data.id, - }, - ); - }, - putTelephone: async (form: PutTelephone["data"]) => { - const data = form; - return await client.merchant.putApiCrmServiceMerchantsByIdTelephonesByTelephoneId( - { - requestBody: data.requestBody, - telephoneId: data.telephoneId, - id: data.id, - }, - ); - }, - putAddress: async (form: PutAddress["data"]) => { - const data = form; - return await client.merchant.putApiCrmServiceMerchantsByIdAddressesByAddressId( - { - requestBody: data.requestBody, - addressId: data.addressId, - id: data.id, - }, - ); - }, - putEmail: async (form: PutEmail["data"]) => { - const data = form; - return await client.merchant.putApiCrmServiceMerchantsByIdEmailsByEmailId( - { - requestBody: data.requestBody, - emailId: data.emailId, - id: data.id, - }, - ); - }, - putName: async (form: PutName["data"]) => { - const data = form; - return await client.merchant.putApiCrmServiceMerchantsByIdIndividualByIndividualIdNameByNameId( - { - requestBody: data.requestBody, - nameId: data.nameId, - individualId: data.individualId, - id: data.id, - }, - ); - }, - putPersonalSummaries: async (form: PutPersonalSummaries["data"]) => { - const data = form; - return await client.merchant.putApiCrmServiceMerchantsByIdIndividualByIndividualIdPersonalSummaryByPersonalSummaryId( - { - requestBody: data.requestBody, - personalSummaryId: data.personalSummaryId, - individualId: data.individualId, - id: data.id, - }, - ); - }, - putMerchantBase: async (form: PutMerchantBase["data"]) => { - return await client.merchant.putApiCrmServiceMerchantsById({ - requestBody: form.requestBody, - id: form.id, - }); - }, - }, - "refund-points": { - putOrganization: async (form: PutOrganization["data"]) => { - const data = form as PutRefundPointOrganization; - return await client.refundPoint.putApiCrmServiceRefundPointsByIdOrganizationsByOrganizationId( - { - requestBody: data.requestBody, - organizationId: data.organizationId, - id: data.id, - }, - ); - }, - putTelephone: async (form: PutTelephone["data"]) => { - const data = form; - return await client.refundPoint.putApiCrmServiceRefundPointsByIdTelephonesByTelephoneId( - { - requestBody: data.requestBody, - telephoneId: data.telephoneId, - id: data.id, - }, - ); - }, - putAddress: async (form: PutAddress["data"]) => { - const data = form; - return await client.refundPoint.putApiCrmServiceRefundPointsByIdAddressesByAddressId( - { - requestBody: data.requestBody, - addressId: data.addressId, - id: data.id, - }, - ); - }, - putEmail: async (form: PutEmail["data"]) => { - const data = form; - return await client.refundPoint.putApiCrmServiceRefundPointsByIdEmailsByEmailId( - { - requestBody: data.requestBody, - emailId: data.emailId, - id: data.id, - }, - ); - }, - putName: () => { - //need for type definition - }, - putPersonalSummaries: () => { - //need for type definition - }, - putMerchantBase: () => { - //need for type definition - }, - }, - customs: { - putOrganization: async (form: PutOrganization["data"]) => { - const data = form as PutRefundPointOrganization; - return await client.customs.putApiCrmServiceCustomsByIdOrganizationsByOrganizationId( - { - requestBody: data.requestBody, - organizationId: data.organizationId, - id: data.id, - }, - ); - }, - putTelephone: async (form: PutTelephone["data"]) => { - const data = form; - return await client.customs.putApiCrmServiceCustomsByIdTelephonesByTelephoneId( - { - requestBody: data.requestBody, - telephoneId: data.telephoneId, - id: data.id, - }, - ); - }, - putAddress: async (form: PutAddress["data"]) => { - const data = form; - return await client.customs.putApiCrmServiceCustomsByIdAddressesByAddressId( - { - requestBody: data.requestBody, - addressId: data.addressId, - id: data.id, - }, - ); - }, - putEmail: async (form: PutEmail["data"]) => { - const data = form; - return await client.customs.putApiCrmServiceCustomsByIdEmailsByEmailId({ - requestBody: data.requestBody, - emailId: data.emailId, - id: data.id, - }); - }, - putName: () => { - //need for type definition - }, - putPersonalSummaries: () => { - //need for type definition - }, - putMerchantBase: () => { - //need for type definition - }, - }, - "tax-free": { - putOrganization: async (form: PutOrganization["data"]) => { - const data = form as PutTaxFreeOrganization; - return await client.taxFree.putApiCrmServiceTaxFreesByIdOrganizationsByOrganizationId( - { - requestBody: data.requestBody, - organizationId: data.organizationId, - id: data.id, - }, - ); - }, - putTelephone: async (form: PutTelephone["data"]) => { - const data = form; - return await client.taxFree.putApiCrmServiceTaxFreesByIdTelephonesByTelephoneId( - { - requestBody: data.requestBody, - telephoneId: data.telephoneId, - id: data.id, - }, - ); - }, - putAddress: async (form: PutAddress["data"]) => { - const data = form; - return await client.taxFree.putApiCrmServiceTaxFreesByIdAddressesByAddressId( - { - requestBody: data.requestBody, - addressId: data.addressId, - id: data.id, - }, - ); - }, - putEmail: async (form: PutEmail["data"]) => { - const data = form; - return await client.taxFree.putApiCrmServiceTaxFreesByIdEmailsByEmailId( - { - requestBody: data.requestBody, - emailId: data.emailId, - id: data.id, - }, - ); - }, - putName: () => { - //need for type definition - }, - putPersonalSummaries: () => { - //need for type definition - }, - putMerchantBase: () => { - //need for type definition - }, - }, - "tax-offices": { - putOrganization: async (form: PutOrganization["data"]) => { - const data = form as PutTaxFreeOrganization; - return await client.taxOffice.putApiCrmServiceTaxOfficesByIdOrganizationsByOrganizationId( - { - requestBody: data.requestBody, - organizationId: data.organizationId, - id: data.id, - }, - ); - }, - putTelephone: async (form: PutTelephone["data"]) => { - const data = form; - return await client.taxOffice.putApiCrmServiceTaxOfficesByIdTelephonesByTelephoneId( - { - requestBody: data.requestBody, - telephoneId: data.telephoneId, - id: data.id, - }, - ); - }, - putAddress: async (form: PutAddress["data"]) => { - const data = form; - return await client.taxOffice.putApiCrmServiceTaxOfficesByIdAddressesByAddressId( - { - requestBody: data.requestBody, - addressId: data.addressId, - id: data.id, - }, - ); - }, - putEmail: async (form: PutEmail["data"]) => { - const data = form; - return await client.taxOffice.putApiCrmServiceTaxOfficesByIdEmailsByEmailId( - { - requestBody: data.requestBody, - emailId: data.emailId, - id: data.id, - }, - ); - }, - putName: () => { - //need for type definition - }, - putPersonalSummaries: () => { - //need for type definition - }, - putMerchantBase: () => { - //need for type definition - }, - }, - }; - return partyRequests[partyType]; -} - -export async function putParty( - partyType: Exclude, - params: - | PutOrganization - | PutTelephone - | PutAddress - | PutEmail - | PutName - | PutPersonalSummaries - | PutMerchantBase, -) { - const client = await putPartyRequests(partyType); - try { - let response; - if (params.action === "merchant-base") { - response = await client.putMerchantBase(params.data); - } else if (params.action === "organization") { - response = await client.putOrganization(params.data); - } else if (params.action === "name") { - response = await client.putName(params.data); - } else if (params.action === "personal-summaries") { - response = await client.putPersonalSummaries(params.data); - } else if (params.action === "telephone") { - response = await client.putTelephone(params.data); - } else if (params.action === "address") { - response = await client.putAddress(params.data); - } else { - response = await client.putEmail(params.data); - } - return { - type: "success", - data: response, - status: 200, - message: "", - }; - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/address/form.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/address/form.tsx deleted file mode 100644 index 74cc613e8..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/address/form.tsx +++ /dev/null @@ -1,101 +0,0 @@ -"use client"; - -import type { - UniRefund_CRMService_Individuals_IndividualDto, - UniRefund_CRMService_Organizations_OrganizationDto, -} from "@ayasofyazilim/saas/CRMService"; -import AutoForm, { - AutoFormSubmit, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { SectionLayoutContent } from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import { useRouter } from "next/navigation"; -import { putCrmAddressApi } from "src/actions/unirefund/CrmService/put-actions"; -import type { - AddressUpdateDto, - CountryDto, - SelectedAddressField, -} from "src/actions/unirefund/LocationService/types"; -import { useAddressHook } from "src/actions/unirefund/LocationService/use-address-hook.tsx"; -import { handlePutResponse } from "src/actions/core/api-utils-client"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import type { PartyNameType } from "../../../types"; - -function Address({ - languageData, - partyName, - countryList, - partyId, - organizationData, -}: { - languageData: CRMServiceServiceResource; - partyName: Exclude; - partyId: string; - countryList: CountryDto[]; - organizationData: - | UniRefund_CRMService_Organizations_OrganizationDto - | UniRefund_CRMService_Individuals_IndividualDto - | undefined; -}) { - const router = useRouter(); - const addressData = - organizationData?.contactInformations?.[0]?.addresses?.[0]; - const selectedFieldsDefaultValue: SelectedAddressField = { - countryId: addressData?.countryId || "", - regionId: addressData?.regionId || "", - cityId: addressData?.cityId || "", - }; - - const { - addressSchema, - selectedFields, - addressSchemaFieldConfig, - onAddressValueChanged, - } = useAddressHook({ - countryList, - selectedFieldsDefaultValue, - fieldsToHideInAddressSchema: ["districtId"], - languageData, - }); - - const addressValues = { - ...addressData, - ...selectedFields, - }; - - function handleSubmit(formData: AddressUpdateDto) { - void putCrmAddressApi(partyName, { - requestBody: formData, - id: partyId, - addressId: addressValues.id || "", - }).then((response) => { - handlePutResponse(response, router); - }); - } - - return ( - - { - const formData = { - ...values, - ...selectedFields, - } as AddressUpdateDto; - handleSubmit(formData); - }} - onValuesChange={(values) => { - onAddressValueChanged(values); - }} - values={addressValues} - > - - {languageData.Save} - - - - ); -} - -export default Address; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract-settings/_components/contract-settings.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract-settings/_components/contract-settings.tsx deleted file mode 100644 index e0c74d490..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract-settings/_components/contract-settings.tsx +++ /dev/null @@ -1,418 +0,0 @@ -"use client"; -import { Button } from "@/components/ui/button"; -import { toast } from "@/components/ui/sonner"; -import { cn } from "@/lib/utils"; -import type { - UniRefund_ContractService_ContractsForMerchant_ContractHeaders_ContractHeaderDetailForMerchantDto as ContractHeaderDetailForMerchantDto, - UniRefund_ContractService_ContractsForMerchant_ContractSettings_ContractSettingCreateDto as ContractSettingCreateUpdateDto, - UniRefund_ContractService_ContractsForMerchant_ContractSettings_ContractSettingDto as ContractSettingDto, - PagedResultDto_ContractSettingDto, -} from "@ayasofyazilim/saas/ContractService"; -import { $UniRefund_ContractService_ContractsForMerchant_ContractSettings_ContractSettingCreateDto as $ContractSettingCreateUpdateDto } from "@ayasofyazilim/saas/ContractService"; -import type { UniRefund_LocationService_AddressCommonDatas_AddressCommonDataDto as AddressCommonDataDto } from "@ayasofyazilim/saas/LocationService"; -import ConfirmDialog from "@repo/ayasofyazilim-ui/molecules/confirm-dialog"; -import TanstackTable from "@repo/ayasofyazilim-ui/molecules/tanstack-table"; -import type { TanstackTableTableActionsType } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/types"; -import { tanstackTableCreateColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; -import { SchemaForm } from "@repo/ayasofyazilim-ui/organisms/schema-form"; -import { - bulkCreateUiSchema, - createUiSchemaWithResource, -} from "@repo/ayasofyazilim-ui/organisms/schema-form/utils"; -import type { Dispatch, SetStateAction } from "react"; -import { useCallback, useState } from "react"; -import { useRouter } from "next/navigation"; -import { - handleDeleteResponse, - handlePostResponse, - handlePutResponse, -} from "src/actions/core/api-utils-client"; -import { - deleteMerchantContractContractSettingsByIdApi, - getMerchantContractHeaderContractSettingsByHeaderIdApi as getContractSettings, - postMerchantContractHeaderContractSettingsByHeaderIdApi, - putMerchantContractContractHeaderSetDefaultContractSettingByHeaderIdApi, - putMerchantContractContractSettingsByIdApi, -} from "src/actions/unirefund/ContractService/action"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; -import { MerchantAddressWidget } from "../../../_components/contract-widgets"; - -interface ContractSettingsTable { - id: string; - name: string; - isDefault?: boolean; - details?: ContractSettingDto; -} -const $ContractSettingsTable = { - id: { - type: "string", - }, - name: { - type: "string", - }, - isDefault: { - type: "boolean", - }, - details: { - type: "string", - }, -}; -export function ContractSettings({ - languageData, - contractSettings, - contractHeaderDetails, - addressList, - lang, -}: { - languageData: ContractServiceResource; - contractSettings: PagedResultDto_ContractSettingDto; - contractHeaderDetails: ContractHeaderDetailForMerchantDto; - addressList: AddressCommonDataDto[]; - lang: string; -}) { - const router = useRouter(); - const [loading, setLoading] = useState(false); - const { items } = contractSettings; - const [settings, setSettings] = useState( - items?.map((item) => { - return { - id: item.id, - name: item.name, - isDefault: item.isDefault, - details: item, - }; - }) || [], - ); - const [tempSettings, setTempSettings] = useState< - ContractSettingsTable | undefined - >(); - - async function handleFetch() { - setLoading(true); - const contractSettingsResponse = await getContractSettings({ - id: contractHeaderDetails.id, - }); - if (contractSettingsResponse.type === "success") { - setSettings( - contractSettingsResponse.data.items?.map((item) => { - return { - id: item.id, - name: item.name, - isDefault: item.isDefault, - details: item, - }; - }) || [], - ); - } else { - toast.error(contractSettingsResponse.message); - } - setLoading(false); - } - - const RowForm = useCallback( - (row: ContractSettingsTable) => { - return ( - - ); - }, - [addressList, tempSettings, contractHeaderDetails], - ); - const SetDefaultAction = useCallback((row: ContractSettingsTable) => { - if (row.isDefault || tempSettings) return <>; - return ( - - ); - }, []); - const columns = tanstackTableCreateColumnsByRowData({ - rows: $ContractSettingsTable, - config: { - locale: lang, - }, - custom: { - isDefault: { - showHeader: false, - content: (row) => SetDefaultAction(row), - }, - }, - badges: { - name: { - values: [ - { - label: languageData["Contracts.Settings.Form.isDefault"], - conditions: [ - { - conditionAccessorKey: "isDefault", - when: (value) => value === true, - }, - ], - }, - ], - }, - }, - expandRowTrigger: "name", - }); - - const tableActions: TanstackTableTableActionsType[] | undefined = - !tempSettings - ? [ - { - actionLocation: "table", - cta: languageData["Contracts.Settings.Form.Add"], - type: "simple", - onClick: () => { - setTempSettings({ name: "New", id: "$temp" }); - }, - }, - ] - : undefined; - if (settings.length > 0) { - return ( - RowForm(row)} - fillerColumn="name" - tableActions={tableActions} - /> - ); - } - return ( - - ); -} -function SchemaFormForContractSettings({ - languageData, - formData, - loading, - setLoading, - addressList, - setTempSettings, - submitId, - type, - handleFetch, -}: { - languageData: ContractServiceResource; - formData: Partial; - loading: boolean; - setLoading: Dispatch>; - setTempSettings?: Dispatch>; - addressList: AddressCommonDataDto[]; - submitId: string; - type: "edit" | "create" | "temp"; - handleFetch: () => Promise; -}) { - const router = useRouter(); - const switchFields: (keyof ContractSettingCreateUpdateDto)[] = [ - "deliveryFee", - "factoring", - "excludeFromCashLimit", - "eTaxFree", - "crossTaxFreeForm", - "facturaNumberIsUnique", - "goodsHaveSerialNumbers", - "excludeFromCashLimit", - "deskoScanner", - ]; - - const uiSchema = createUiSchemaWithResource({ - resources: languageData, - name: "Contracts.Settings.Form", - schema: $ContractSettingCreateUpdateDto, - extend: { - ...bulkCreateUiSchema({ - elements: switchFields, - config: { "ui:widget": "switch" }, - }), - invoicingAddressCommonDataId: { - "ui:className": "md:col-span-2", - "ui:widget": "address", - }, - "ui:className": cn( - "md:grid md:grid-cols-2 md:gap-2", - type === "edit" && "p-4", - ), - isDefault: { - "ui:widget": "switch", - "ui:className": "hidden", - }, - }, - }); - - return ( - > - className="bg-white" - defaultSubmitClassName="pr-4" - disabled={loading} - filter={{ - type: "include", - sort: true, - keys: [ - "name", - "referenceNumber", - "invoiceChannel", - "invoicingFrequency", - "termOfPayment", - "receiptType", - "invoicingAddressCommonDataId", - ...switchFields, - ], - }} - formData={formData} - onSubmit={(data) => { - if (!data.formData) return; - setLoading(true); - if (type === "create" || type === "temp") { - void postMerchantContractHeaderContractSettingsByHeaderIdApi({ - id: submitId, - requestBody: data.formData as ContractSettingCreateUpdateDto, - }) - .then((response) => { - handlePostResponse(response, router); - }) - .finally(() => { - void handleFetch().then(() => { - setLoading(false); - }); - }); - } else { - void putMerchantContractContractSettingsByIdApi({ - id: submitId, - requestBody: data.formData as ContractSettingCreateUpdateDto, - }) - .then((response) => { - handlePostResponse(response, router); - }) - .finally(() => { - void handleFetch().then(() => { - setLoading(false); - }); - }); - } - }} - schema={$ContractSettingCreateUpdateDto} - uiSchema={uiSchema} - useDefaultSubmit={false} - widgets={{ - address: MerchantAddressWidget({ - loading, - addressList, - languageData, - }), - }} - withScrollArea - > -
- - -
- - ); -} - -function DeleteDialog({ - submitId, - languageData, - setLoading, - setTempSettings, - handleFetch, -}: { - submitId: string; - languageData: ContractServiceResource; - setLoading: Dispatch>; - setTempSettings?: Dispatch>; - handleFetch: () => Promise; -}) { - const router = useRouter(); - return ( - { - if (submitId === "$temp" && setTempSettings) { - setTempSettings(undefined); - return; - } - setLoading(true); - void deleteMerchantContractContractSettingsByIdApi(submitId) - .then((response) => { - handleDeleteResponse(response, router); - }) - .finally(() => { - void handleFetch().then(() => { - setLoading(false); - }); - }); - }, - }} - description={languageData["Contracts.Settings.Form.Delete.Description"]} - title={languageData["Contracts.Settings.Form.Delete.Title"]} - triggerProps={{ - type: "button", - variant: "outline", - children: languageData["Contracts.Settings.Form.Delete"], - }} - type="with-trigger" - /> - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract-settings/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract-settings/page.tsx deleted file mode 100644 index 17209feac..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract-settings/page.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { notFound } from "next/navigation"; -import { - getMerchantContractHeaderByIdApi, - getMerchantContractHeaderContractSettingsByHeaderIdApi, - getRefundTableHeadersApi, -} from "src/actions/unirefund/ContractService/action"; -import { getAdressesApi } from "src/actions/unirefund/CrmService/actions"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/ContractService"; -import { ContractSettings } from "./_components/contract-settings"; - -export default async function Page({ - params, -}: { - params: { - lang: string; - partyId: string; - contractId: string; - partyName: "merchants"; - }; -}) { - const { lang, contractId, partyId, partyName } = params; - await isUnauthorized({ - requiredPolicies: ["ContractService.ContractSetting.Edit"], - lang, - }); - - const { languageData } = await getResourceData(lang); - const contractSettings = - await getMerchantContractHeaderContractSettingsByHeaderIdApi({ - id: contractId, - }); - const refundTableHeaders = await getRefundTableHeadersApi({}); - const contractHeaderDetails = - await getMerchantContractHeaderByIdApi(contractId); - const addressList = await getAdressesApi(partyId, partyName); - if ( - contractSettings.type !== "success" || - refundTableHeaders.type !== "success" || - contractHeaderDetails.type !== "success" || - addressList.type !== "success" - ) - return notFound(); - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract/_components/merchant/index.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract/_components/merchant/index.tsx deleted file mode 100644 index 085af32a3..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract/_components/merchant/index.tsx +++ /dev/null @@ -1,177 +0,0 @@ -"use client"; - -import { Button } from "@/components/ui/button"; -import { toast } from "@/components/ui/sonner"; -import type { - UniRefund_ContractService_ContractsForMerchant_ContractHeaders_ContractHeaderDetailForMerchantDto as ContractHeaderDetailForMerchantDto, - UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderDto as RefundTableHeaderDto, -} from "@ayasofyazilim/saas/ContractService"; -import type { UniRefund_LocationService_AddressCommonDatas_AddressCommonDataDto as AddressCommonDataDto } from "@ayasofyazilim/saas/LocationService"; -import ConfirmDialog from "@repo/ayasofyazilim-ui/molecules/confirm-dialog"; -import { CheckCircle, ListTodo, Trash } from "lucide-react"; -import { useRouter } from "next/navigation"; -import type { ComponentType, Dispatch, SetStateAction } from "react"; -import { useState } from "react"; -import { handleDeleteResponse } from "src/actions/core/api-utils-client"; -import { getMerchantContractHeaderMissingStepsByIdApi } from "src/actions/unirefund/ContractService/action"; -import { deleteMerchantContractHeaderByIdApi } from "src/actions/unirefund/ContractService/delete-actions"; -import { postMerchantContractHeaderValidateByHeaderIdApi } from "src/actions/unirefund/ContractService/post-actions"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; -import MerchantContractHeaderForm from "../../../../_components/contract-header-form/merchant"; - -export function ContractHeader({ - contractHeaderDetails, - addressList, - languageData, - refundTableHeaders, -}: { - contractHeaderDetails: ContractHeaderDetailForMerchantDto; - addressList: AddressCommonDataDto[]; - refundTableHeaders: RefundTableHeaderDto[]; - languageData: ContractServiceResource; -}) { - const [loading, setLoading] = useState(false); - return ( -
- - { - return { - validFrom: item.validFrom, - validTo: item.validTo, - isDefault: item.refundTableHeader.isDefault, - refundTableHeaderId: item.refundTableHeader.id, - }; - }, - ), - }} - formType="update" - languageData={languageData} - loading={loading} - refundTableHeaders={refundTableHeaders} - setLoading={setLoading} - /> -
- ); -} - -function ContractActions({ - contractId, - languageData, - loading, - setLoading, -}: { - contractId: string; - languageData: ContractServiceResource; - loading: boolean; - setLoading: Dispatch>; -}) { - const router = useRouter(); - return ( -
- { - setLoading(true); - void postMerchantContractHeaderValidateByHeaderIdApi(contractId) - .then((response) => { - if (response.type === "success" && response.data) { - toast.success( - languageData["Contracts.Actions.Validate.Success"], - ); - } else { - toast.error(response.message); - } - }) - .finally(() => { - setLoading(false); - }); - }} - text={languageData["Contracts.Actions.Validate"]} - /> - - { - setLoading(true); - void getMerchantContractHeaderMissingStepsByIdApi(contractId) - .then((response) => { - if (response.type === "success" && response.data.length === 0) { - toast.success( - languageData["Contracts.Actions.CheckMissingSteps.Success"], - ); - } else { - toast.error(response.message); - } - router.refresh(); - }) - .finally(() => { - setLoading(false); - }); - }} - text={languageData["Contracts.Actions.CheckMissingSteps"]} - /> - { - setLoading(true); - void deleteMerchantContractHeaderByIdApi(contractId) - .then((response) => { - handleDeleteResponse(response, router, "../../"); - }) - .finally(() => { - setLoading(false); - }); - }, - }} - description={languageData["Contracts.Actions.Delete.Description"]} - title={languageData["Contracts.Actions.Delete.Title"]} - type="without-trigger" - > - - -
- ); -} - -function ActionButton({ - loading, - onClick, - text, - icon: Icon, -}: { - loading: boolean; - onClick?: () => void; - text: string; - icon: ComponentType<{ className?: string }>; -}) { - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract/_components/refund-point/index.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract/_components/refund-point/index.tsx deleted file mode 100644 index 2aec97e77..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract/_components/refund-point/index.tsx +++ /dev/null @@ -1,175 +0,0 @@ -"use client"; - -import { Button } from "@/components/ui/button"; -import { toast } from "@/components/ui/sonner"; -import type { - UniRefund_ContractService_ContractsForRefundPoint_ContractHeaders_ContractHeaderDetailForRefundPointDto as ContractHeaderDetailForRefundPointDto, - UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderDto as RefundFeeHeader, -} from "@ayasofyazilim/saas/ContractService"; -import type { UniRefund_LocationService_AddressCommonDatas_AddressCommonDataDto as AddressCommonDataDto } from "@ayasofyazilim/saas/LocationService"; -import ConfirmDialog from "@repo/ayasofyazilim-ui/molecules/confirm-dialog"; -import { CheckCircle, ListTodo, Trash } from "lucide-react"; -import { useRouter } from "next/navigation"; -import type { ComponentType, Dispatch, SetStateAction } from "react"; -import { useState } from "react"; -import { handleDeleteResponse } from "src/actions/core/api-utils-client"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; -import { postRefundPointContractHeaderValidateByHeaderId } from "src/actions/unirefund/ContractService/post-actions"; -import { getRefundPointContractHeaderMissingStepsById } from "src/actions/unirefund/ContractService/action"; -import { deleteRefundPointContractHeadersById } from "src/actions/unirefund/ContractService/delete-actions"; -import RefundPointContractHeaderForm from "../../../../_components/contract-header-form/refund-point"; - -export function ContractHeader({ - contractHeaderDetails, - addressList, - languageData, - refundFeeHeaders, -}: { - contractHeaderDetails: ContractHeaderDetailForRefundPointDto; - addressList: AddressCommonDataDto[]; - refundFeeHeaders: RefundFeeHeader[]; - languageData: ContractServiceResource; -}) { - const [loading, setLoading] = useState(false); - return ( -
- - { - return { - validFrom: item.validFrom, - validTo: item.validTo, - refundFeeHeaderId: item.refundFeeHeader.id, - isDefault: item.isDefault, - }; - }), - }} - formType="update" - languageData={languageData} - loading={loading} - refundFeeHeaders={refundFeeHeaders} - setLoading={setLoading} - /> -
- ); -} - -function ContractActions({ - contractId, - languageData, - loading, - setLoading, -}: { - contractId: string; - languageData: ContractServiceResource; - loading: boolean; - setLoading: Dispatch>; -}) { - const router = useRouter(); - return ( -
- { - setLoading(true); - void postRefundPointContractHeaderValidateByHeaderId(contractId) - .then((response) => { - if (response.type === "success" && response.data) { - toast.success( - languageData["Contracts.Actions.Validate.Success"], - ); - } else { - toast.error(response.message); - } - }) - .finally(() => { - setLoading(false); - }); - }} - text={languageData["Contracts.Actions.Validate"]} - /> - - { - setLoading(true); - void getRefundPointContractHeaderMissingStepsById(contractId) - .then((response) => { - if (response.type === "success" && response.data.length === 0) { - toast.success( - languageData["Contracts.Actions.CheckMissingSteps.Success"], - ); - } else { - toast.error(response.message); - } - router.refresh(); - }) - .finally(() => { - setLoading(false); - }); - }} - text={languageData["Contracts.Actions.CheckMissingSteps"]} - /> - { - setLoading(true); - void deleteRefundPointContractHeadersById(contractId) - .then((response) => { - handleDeleteResponse(response, router, "../../"); - }) - .finally(() => { - setLoading(false); - }); - }, - }} - description={languageData["Contracts.Actions.Delete.Description"]} - title={languageData["Contracts.Actions.Delete.Title"]} - type="without-trigger" - > - - -
- ); -} - -function ActionButton({ - loading, - onClick, - text, - icon: Icon, -}: { - loading: boolean; - onClick?: () => void; - text: string; - icon: ComponentType<{ className?: string }>; -}) { - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract/page.tsx deleted file mode 100644 index fe781489f..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/contract/page.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import { - getRefundPointDetailsByIdApi, - getAdressesApi, -} from "src/actions/unirefund/CrmService/actions"; -import { - getMerchantContractHeaderByIdApi, - getRefundFeeHeadersApi, - getRefundPointContractHeaderById, - getRefundTableHeadersApi, -} from "src/actions/unirefund/ContractService/action"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/ContractService"; -import { isErrorOnRequest } from "src/utils/page-policy/utils"; -import type { ContractPartyName } from "../../_components/types"; -import { ContractHeader as RefundPointContractHeader } from "./_components/refund-point"; -import { ContractHeader as MerchantContractHeader } from "./_components/merchant"; - -export default async function Page({ - params, -}: { - params: { - lang: string; - partyName: ContractPartyName; - partyId: string; - contractId: string; - }; -}) { - const { lang, partyName, partyId, contractId } = params; - const { languageData } = await getResourceData(lang); - if (partyName === "merchants") { - await isUnauthorized({ - requiredPolicies: ["ContractService.ContractHeaderForMerchant.Edit"], - lang, - }); - const refundTableHeaders = await getRefundTableHeadersApi({}); - if (isErrorOnRequest(refundTableHeaders, lang)) return; - const contractHeaderDetails = - await getMerchantContractHeaderByIdApi(contractId); - if (isErrorOnRequest(contractHeaderDetails, lang)) return; - const addressList = await getAdressesApi(partyId, partyName); - if (isErrorOnRequest(addressList, lang)) return; - - return ( - - ); - } - - await isUnauthorized({ - requiredPolicies: ["ContractService.ContractHeaderForRefundPoint.Edit"], - lang, - }); - const refundFeeHeaders = await getRefundFeeHeadersApi({}); - if (isErrorOnRequest(refundFeeHeaders, lang)) return; - const contractHeaderDetails = - await getRefundPointContractHeaderById(contractId); - if (isErrorOnRequest(contractHeaderDetails, lang)) return; - const refundPointDetails = await getRefundPointDetailsByIdApi(params.partyId); - if (isErrorOnRequest(refundPointDetails, lang)) return; - const refundPointDetailsSummary = refundPointDetails.data.entityInformations - ?.at(0) - ?.organizations?.at(0); - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/layout.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/layout.tsx deleted file mode 100644 index e67862864..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/layout.tsx +++ /dev/null @@ -1,126 +0,0 @@ -"use server"; -import { TabLayout } from "@repo/ayasofyazilim-ui/templates/tab-layout"; -import { - getMerchantContractHeaderByIdApi, - getRefundPointContractHeaderById, -} from "src/actions/unirefund/ContractService/action"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/ContractService"; -import { getBaseLink } from "src/utils"; -import { isErrorOnRequest } from "src/utils/page-policy/utils"; -import type { ContractPartyName } from "../_components/types"; - -export default async function Layout({ - children, - params, -}: { - children: React.ReactNode; - params: { - lang: string; - contractId: string; - partyName: ContractPartyName; - partyId: string; - }; -}) { - const { lang, contractId, partyId, partyName } = params; - - const { languageData } = await getResourceData(lang); - if (params.partyName === "merchants") { - await isUnauthorized({ - requiredPolicies: [ - "ContractService.ContractHeaderForMerchant", - "ContractService.ContractSetting.Edit", - "ContractService.RebateSetting.Edit", - "ContractService.ContractHeaderForMerchant.Edit", - ], - lang, - }); - const contractHeaderDetails = - await getMerchantContractHeaderByIdApi(contractId); - if (isErrorOnRequest(contractHeaderDetails, lang)) return; - return ( - <> - - {children} - -
- {languageData["Contracts.Edit.Title"]} - - {contractHeaderDetails.data.name} -
-
- {languageData["Contracts.Edit.Description"]} -
- - - ); - } - - await isUnauthorized({ - requiredPolicies: [ - "ContractService.ContractHeaderForRefundPoint", - "ContractService.ContractHeaderForRefundPoint.Edit", - ], - lang, - }); - const contractHeaderDetails = - await getRefundPointContractHeaderById(contractId); - if (isErrorOnRequest(contractHeaderDetails, lang)) return; - return ( - <> - {children} -
- {languageData["Contracts.Edit.Title"]} - - {contractHeaderDetails.data.name} -
-
- {languageData["Contracts.Edit.Description"]} -
- - - ); -} - -// function BadgeWithTooltip({ -// label, -// languageData, -// }: { -// label: string; -// languageData: ContractServiceResource; -// }) { -// return ( -// -// -//
-// -// {label} -//
-//
-// -// {languageData["Contracts.MissingSteps.Missing"]} -// -//
-// ); -// } diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/rebate-settings/_components/rebate-settings.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/rebate-settings/_components/rebate-settings.tsx deleted file mode 100644 index e8974569f..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/rebate-settings/_components/rebate-settings.tsx +++ /dev/null @@ -1,408 +0,0 @@ -"use client"; - -import { Badge } from "@/components/ui/badge"; -import { Button } from "@/components/ui/button"; -import { - Sheet, - SheetClose, - SheetContent, - SheetFooter, - SheetHeader, - SheetTitle, - SheetTrigger, -} from "@/components/ui/sheet"; -import type { - UniRefund_ContractService_Rebates_MinimumNetCommissions_MinimumNetCommissionCreateDto as MinimumNetCommissionCreateDto, - UniRefund_ContractService_Rebates_RebateSettings_RebateSettingCreateDto as RebateSettingCreateDto, - UniRefund_ContractService_Rebates_RebateTableHeaders_RebateTableHeaderDto as RebateTableHeaderDto, - UniRefund_ContractService_Rebates_RebateTableHeaders_RebateTableHeaderFromTemplateCreateDto as RebateTableHeaderFromTemplateCreateDto, - UniRefund_ContractService_Rebates_RebateTableHeaders_RebateTableHeaderNotTemplateCreateDto as RebateTableHeaderNotTemplateCreateDto, - UniRefund_ContractService_Rebates_RebateSettings_RebateSettingDto as RebateSettingDto, -} from "@ayasofyazilim/saas/ContractService"; -import { - $UniRefund_ContractService_Rebates_MinimumNetCommissions_MinimumNetCommissionCreateDto as $MinimumNetCommissionCreateDto, - $UniRefund_ContractService_Rebates_RebateSettings_RebateSettingCreateDto as $RebateSettingCreateDto, - $UniRefund_ContractService_Rebates_RebateTableHeaders_RebateTableHeaderFromTemplateCreateDto as $RebateTableHeaderFromTemplateCreateDto, -} from "@ayasofyazilim/saas/ContractService"; -import type { UniRefund_CRMService_Merchants_StoreProfileDto as StoreProfileDto } from "@ayasofyazilim/saas/CRMService"; -import { SchemaForm } from "@repo/ayasofyazilim-ui/organisms/schema-form"; -import type { FieldProps } from "@repo/ayasofyazilim-ui/organisms/schema-form/types"; -import { createUiSchemaWithResource } from "@repo/ayasofyazilim-ui/organisms/schema-form/utils"; -import { useState } from "react"; -import { useRouter } from "next/navigation"; -import RebateForm from "src/app/[lang]/(unirefund)/settings/templates/rebate/rebate-form"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; -import { postMerchantContractHeaderRebateSettingByHeaderIdApi } from "src/actions/unirefund/ContractService/post-actions"; -import { handlePostResponse } from "src/actions/core/api-utils-client"; -import { - MerchantStoresWidget, - RebateTableWidget, -} from "../../../_components/contract-widgets"; - -export function RebateSettings({ - languageData, - rebateSettings, - rebateTables, - subMerchants, - contractId, - lang, -}: { - languageData: ContractServiceResource; - rebateSettings: RebateSettingDto; - rebateTables: RebateTableHeaderDto[]; - subMerchants: StoreProfileDto[]; - contractId: string; - lang: string; -}) { - const router = useRouter(); - const [loading, setLoading] = useState(false); - const uiSchema = createUiSchemaWithResource({ - schema: $RebateSettingCreateDto, - resources: languageData, - name: "Rebate.Form", - extend: { - isTrustedMerchant: { - "ui:widget": "switch", - }, - rebateTableHeaders: { - items: { - "ui:field": "CreateRebateTableField", - }, - }, - rebateTableHeadersFromTemplate: { - items: { - "ui:field": "SelectRebateTableField", - }, - }, - minimumNetCommissions: { - items: { - "ui:field": "CreateMinimumNetCommissionField", - }, - }, - }, - }); - const dateFormat: Intl.DateTimeFormatOptions = { - year: "numeric", - month: "short", - day: "2-digit", - }; - return ( - - disabled={loading} - fields={{ - CreateRebateTableField: CreateRebateTableField({ - dateFormat, - lang, - languageData, - }), - SelectRebateTableField: SelectRebateTableField({ - dateFormat, - lang, - languageData, - rebateTableHeaders: rebateTables, - }), - CreateMinimumNetCommissionField: CreateMinimumNetCommissionField({ - dateFormat, - lang, - loading, - languageData, - subMerchants, - }), - }} - formData={rebateSettings} - onSubmit={(data) => { - if (!data.formData) return; - setLoading(true); - void postMerchantContractHeaderRebateSettingByHeaderIdApi({ - id: contractId, - requestBody: data.formData, - }) - .then((res) => { - handlePostResponse(res, router); - }) - .finally(() => { - setLoading(false); - }); - }} - schema={$RebateSettingCreateDto} - uiSchema={uiSchema} - /> - ); -} - -function SelectRebateTableField({ - lang, - dateFormat, - languageData, - rebateTableHeaders, -}: { - lang: string; - dateFormat: Intl.DateTimeFormatOptions; - languageData: ContractServiceResource; - rebateTableHeaders: RebateTableHeaderDto[]; -}) { - function Field(props: FieldProps) { - const _formData = props.formData as RebateTableHeaderFromTemplateCreateDto; - const selectedRebateTableHeader = rebateTableHeaders.find( - (item) => item.id === _formData.id, - ); - const [open, setOpen] = useState(false); - return ( - - - - - - - - {languageData["Rebate.Form.rebateTableHeaders.title"]} - - - - className="h-full p-0 [&>fieldset]:border-0 [&>fieldset]:p-0" - formData={_formData} - onSubmit={(data) => { - props.onChange(data.formData); - setOpen(false); - }} - schema={$RebateTableHeaderFromTemplateCreateDto} - uiSchema={createUiSchemaWithResource({ - schema: $RebateTableHeaderFromTemplateCreateDto, - resources: languageData, - name: "Rebate.Form.rebateTableHeadersFromTemplate", - extend: { - displayLabel: false, - id: { - "ui:widget": "RebateTableWidget", - }, - }, - })} - useDefaultSubmit={false} - widgets={{ - RebateTableWidget: RebateTableWidget({ - languageData, - rebateTableHeaders, - loading: false, - }), - }} - withScrollArea={false} - > - - - - - - - - - - ); - } - return Field; -} - -function CreateRebateTableField({ - lang, - dateFormat, - languageData, -}: { - lang: string; - dateFormat: Intl.DateTimeFormatOptions; - languageData: ContractServiceResource; -}) { - function Field(props: FieldProps) { - const _formData: RebateTableHeaderNotTemplateCreateDto | undefined = - props.formData as RebateTableHeaderNotTemplateCreateDto; - const [open, setOpen] = useState(false); - return ( - - - - - - - - {languageData["Rebate.Form.rebateTableHeaders.title"]} - - - { - props.onChange(data); - setOpen(false); - }} - > - - - - - - - - - - ); - } - return Field; -} - -function CreateMinimumNetCommissionField({ - lang, - dateFormat, - loading, - languageData, - subMerchants, -}: { - lang: string; - dateFormat: Intl.DateTimeFormatOptions; - loading: boolean; - languageData: ContractServiceResource; - subMerchants: StoreProfileDto[]; -}) { - function Field(props: FieldProps) { - const _formData: MinimumNetCommissionCreateDto = - props.formData as MinimumNetCommissionCreateDto; - const hasValue: boolean = Object.keys(props.formData as object).length > 0; - const [open, setOpen] = useState(false); - return ( - - - - - - - Edit - - - className="h-full p-0 [&>fieldset]:border-0 [&>fieldset]:p-0" - filter={{ - type: "include", - sort: true, - keys: ["appliedOrganizationId", "validFrom", "validTo", "amount"], - }} - formData={_formData} - onSubmit={(data) => { - props.onChange(data.formData); - setOpen(false); - }} - schema={$MinimumNetCommissionCreateDto} - uiSchema={createUiSchemaWithResource({ - schema: $MinimumNetCommissionCreateDto, - resources: languageData, - name: "Rebate.Form.minimumNetCommissions", - extend: { - displayLabel: false, - appliedOrganizationId: { - "ui:widget": "MerchantStoresWidget", - }, - }, - })} - useDefaultSubmit={false} - widgets={{ - MerchantStoresWidget: MerchantStoresWidget({ - languageData, - loading, - list: subMerchants, - }), - }} - withScrollArea={false} - > - - - - - - - - - - ); - } - return Field; -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/rebate-settings/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/rebate-settings/page.tsx deleted file mode 100644 index 410e12fd9..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/rebate-settings/page.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { notFound } from "next/navigation"; -import { - getMerchantContractHeaderRebateSettingsByHeaderIdApi, - getRebateTableHeadersApi, -} from "src/actions/unirefund/ContractService/action"; -import { getSubMerchantsByMerchantIdApi } from "src/actions/unirefund/CrmService/actions"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/ContractService"; -import { RebateSettings } from "./_components/rebate-settings"; - -export default async function Page({ - params, -}: { - params: { - lang: string; - partyId: string; - contractId: string; - }; -}) { - const { lang, partyId, contractId } = params; - await isUnauthorized({ - requiredPolicies: ["ContractService.RebateSetting.Edit"], - lang, - }); - - const { languageData } = await getResourceData(lang); - const rebateSettings = - await getMerchantContractHeaderRebateSettingsByHeaderIdApi(contractId); - if (rebateSettings.type !== "success") return notFound(); - const rebateTables = await getRebateTableHeadersApi({}); - const subMerchants = await getSubMerchantsByMerchantIdApi({ - id: partyId, - }); - if (rebateTables.type !== "success" || subMerchants.type !== "success") { - return notFound(); - } - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/stores/_components/table-data.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/stores/_components/table-data.tsx deleted file mode 100644 index 19270e815..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/stores/_components/table-data.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import type { - UniRefund_ContractService_ContractsForMerchant_ContractStores_ContractStoreDetailedDto as ContractStoreDetailedDto, - UniRefund_ContractService_ContractsForMerchant_ContractSettings_ContractSettingDto as ContractSettingDto, -} from "@ayasofyazilim/saas/ContractService"; -import { $UniRefund_ContractService_ContractsForMerchant_ContractStores_ContractStoreDetailedDto as $ContractStoreDetailedDto } from "@ayasofyazilim/saas/ContractService"; -import type { TanstackTableCreationProps } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/types"; -import { tanstackTableEditableColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; - -const contractStoresTableColumns = ({ - languageData, - lang, - contractSettings, -}: { - languageData: ContractServiceResource; - contractSettings: ContractSettingDto[]; - lang: string; -}) => { - return tanstackTableEditableColumnsByRowData({ - rows: { - ...$ContractStoreDetailedDto.properties, - contractSettingId: { - type: "enum", - enum: contractSettings.map((item) => { - return { - label: item.name, - value: item.id, - }; - }), - }, - receiptType: { - type: "enum", - enum: $ContractStoreDetailedDto.properties.receiptType.enum.map( - (item) => { - return { - label: languageData[`Contracts.Stores.receiptType.${item}`], - value: item, - }; - }, - ), - }, - }, - classNames: { - name: [ - { - className: "px-4", - }, - ], - fullAddress: [ - { - className: "px-4", - }, - ], - manager: [ - { - className: "px-4", - }, - ], - }, - config: { - locale: lang, - }, - languageData: { - languageData, - constantKey: "Contracts.Stores", - }, - editableColumns: ["receiptType", "contractSettingId"], - }); -}; - -const contractsTable = () => { - const table: TanstackTableCreationProps = { - fillerColumn: "name", - columnVisibility: { - type: "show", - columns: [ - "name", - "fullAddress", - "manager", - "contractSettingId", - "receiptType", - ], - }, - }; - return table; -}; - -export const tableData = { - columns: contractStoresTableColumns, - table: contractsTable, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/stores/_components/table.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/stores/_components/table.tsx deleted file mode 100644 index cdd192df3..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/stores/_components/table.tsx +++ /dev/null @@ -1,104 +0,0 @@ -"use client"; -import { toast } from "@/components/ui/sonner"; -import type { - UniRefund_ContractService_ContractsForMerchant_ContractSettings_ContractSettingDto as ContractSettingDto, - UniRefund_ContractService_ContractsForMerchant_ContractStores_ContractStoreCreateAndUpdateDto as ContractStoreCreateAndUpdateDto, - UniRefund_ContractService_ContractsForMerchant_ContractStores_ContractStoreDetailedDto as ContractStoreDetailedDto, -} from "@ayasofyazilim/saas/ContractService"; -import ConfirmDialog from "@repo/ayasofyazilim-ui/molecules/confirm-dialog"; -import TanstackTable from "@repo/ayasofyazilim-ui/molecules/tanstack-table"; -import { useParams, useRouter } from "next/navigation"; -import { useState } from "react"; -import { postMerchantContractHeaderContractStoresByHeaderIdApi } from "src/actions/unirefund/ContractService/post-actions"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; -import { tableData } from "./table-data"; - -export function ContractStoresTable({ - languageData, - contractStores, - contractSettings, -}: { - languageData: ContractServiceResource; - contractStores: ContractStoreDetailedDto[]; - contractSettings: ContractSettingDto[]; -}) { - const router = useRouter(); - const [loading, setLoading] = useState(false); - const { lang, contractId } = useParams<{ - lang: string; - contractId: string; - }>(); - const columns = tableData.columns({ - lang, - languageData, - contractSettings, - }); - const table = tableData.table(); - const [updatedData, setUpdatedData] = useState( - [], - ); - return ( -
- { - setUpdatedData(data); - }} - {...table} - /> - { - const mappedData: ContractStoreCreateAndUpdateDto[] = - updatedData.map((item) => { - return { - contractSettingId: item.contractSettingId || "", - receiptType: item.receiptType, - contractTypeIdentifiersSubId: - item.contractTypeIdentifiersSubId, - }; - }); - setLoading(true); - void postMerchantContractHeaderContractStoresByHeaderIdApi({ - id: contractId, - requestBody: { - contractStores: mappedData, - }, - }) - .then((response) => { - if (response.type === "success") { - toast.success(languageData["Contracts.Stores.Save.Success"]); - router.refresh(); - setUpdatedData([]); - } else { - toast.error( - response.message || - languageData["Contracts.Stores.Save.Fail"], - ); - } - }) - .finally(() => { - setLoading(false); - }); - }, - closeAfterConfirm: true, - }} - description={languageData["Contracts.Stores.Save.Description"]} - loading={loading} - title={languageData["Contracts.Stores.Save.Title"]} - triggerProps={{ - className: "w-full max-w-lg", - disabled: updatedData.length === 0 || loading, - children: languageData.Save, - }} - type="with-trigger" - /> -
- ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/stores/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/stores/page.tsx deleted file mode 100644 index d5976f2ae..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/[contractId]/stores/page.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import { notFound } from "next/navigation"; -import { - getMerchantContractHeaderContractSettingsByHeaderIdApi, - getMerchantContractHeadersContractStoresByHeaderIdApi, -} from "src/actions/unirefund/ContractService/action"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/ContractService"; -import { ContractStoresTable } from "./_components/table"; - -export default async function Page({ - params, -}: { - params: { contractId: string; lang: string }; -}) { - const { contractId, lang } = params; - await isUnauthorized({ - requiredPolicies: [ - "ContractService.ContractStore", - "ContractService.ContractStore.Edit", - "ContractService.ContractStore.Delete", - "ContractService.ContractStore.Create", - ], - lang, - }); - - const { languageData } = await getResourceData(lang); - const contractStores = - await getMerchantContractHeadersContractStoresByHeaderIdApi({ - id: contractId, - }); - const contractSettings = - await getMerchantContractHeaderContractSettingsByHeaderIdApi({ - id: contractId, - }); - if ( - contractStores.type !== "success" || - contractSettings.type !== "success" - ) { - return notFound(); - } - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/contract-header-form/merchant/index.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/contract-header-form/merchant/index.tsx deleted file mode 100644 index e4f66fd59..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/contract-header-form/merchant/index.tsx +++ /dev/null @@ -1,283 +0,0 @@ -"use client"; -import { Button } from "@/components/ui/button"; -import { Label } from "@/components/ui/label"; -import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet"; -import type { - UniRefund_ContractService_ContractsForMerchant_ContractHeaders_ContractHeaderForMerchantCreateDto as ContractHeaderForMerchantCreateDto, - UniRefund_ContractService_ContractsForMerchant_ContractHeaders_ContractHeaderForMerchantUpdateDto as ContractHeaderForMerchantUpdateDto, - UniRefund_ContractService_ContractsForMerchant_ContractHeaderRefundTableHeaders_ContractHeaderRefundTableHeaderCreateAndUpdateDto as ContractHeaderRefundTableHeaderCreateAndUpdateDto, - UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderDto as RefundTableHeaderDto, -} from "@ayasofyazilim/saas/ContractService"; -import { - $UniRefund_ContractService_ContractsForMerchant_ContractHeaders_ContractHeaderForMerchantCreateDto as $ContractHeaderForMerchantCreateDto, - $UniRefund_ContractService_ContractsForMerchant_ContractHeaders_ContractHeaderForMerchantUpdateDto as $ContractHeaderForMerchantUpdateDto, -} from "@ayasofyazilim/saas/ContractService"; -import type { UniRefund_LocationService_AddressCommonDatas_AddressCommonDataDto as AddressTypeDto } from "@ayasofyazilim/saas/LocationService"; -import { SchemaForm } from "@repo/ayasofyazilim-ui/organisms/schema-form"; -import type { FieldProps } from "@repo/ayasofyazilim-ui/organisms/schema-form/types"; -import { createUiSchemaWithResource } from "@repo/ayasofyazilim-ui/organisms/schema-form/utils"; -import { useParams, useRouter } from "next/navigation"; -import type { Dispatch, SetStateAction } from "react"; -import { useState } from "react"; -import { - handlePostResponse, - handlePutResponse, -} from "src/actions/core/api-utils-client"; -import { postMerchantContractHeadersByMerchantIdApi } from "src/actions/unirefund/ContractService/action"; -import { putMerchantContractHeadersByIdApi } from "src/actions/unirefund/ContractService/put-actions"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; -import { - MerchantAddressWidget, - RefundTableWidget, -} from "../../contract-widgets"; - -type ContractHeaderFormProps = { - languageData: ContractServiceResource; - addresses: AddressTypeDto[]; - refundTableHeaders: RefundTableHeaderDto[]; - loading: boolean; - setLoading?: Dispatch>; -} & (CreateContractHeaderFormProps | UpdateContractHeaderFormProps); - -interface CreateContractHeaderFormProps { - formType: "create"; -} -interface UpdateContractHeaderFormProps { - formType: "update"; - formData: ContractHeaderForMerchantUpdateDto; - contractId: string; -} - -export default function MerchantContractHeaderForm( - props: ContractHeaderFormProps, -): JSX.Element { - const { languageData, addresses, refundTableHeaders, loading, setLoading } = - props; - const router = useRouter(); - const { partyId, partyName } = useParams<{ - partyId: string; - partyName: string; - }>(); - const [formLoading, setFormLoading] = useState(loading || false); - function handleLoading(_loading: boolean) { - if (setLoading) setLoading(_loading); - setFormLoading(_loading); - } - const $Schema = { - create: $ContractHeaderForMerchantCreateDto, - update: $ContractHeaderForMerchantUpdateDto, - }; - const formData = { - create: {}, - update: props.formType === "update" && props.formData, - }; - - const uiSchema = createUiSchemaWithResource({ - name: "Contracts.Form", - resources: languageData, - schema: $Schema[props.formType], - extend: { - "ui:options": { - expandable: false, - }, - webSite: { - "ui:className": "md:col-span-full", - "ui:options": { - inputType: "url", - }, - }, - "ui:className": "md:grid md:gap-2 md:grid-cols-2", - addressCommonDataId: { - "ui:className": "row-start-2", - "ui:widget": "address", - }, - status: { - "ui:className": "md:col-span-full", - }, - refundTableHeaders: { - "ui:className": "md:col-span-full", - items: { - "ui:field": "RefundTableHeadersItemField", - displayLabel: false, - }, - }, - }, - }); - - return ( - { - if (!data.formData) return; - handleLoading(true); - if (props.formType === "create") { - void postMerchantContractHeadersByMerchantIdApi({ - id: partyId, - requestBody: data.formData as ContractHeaderForMerchantCreateDto, - }) - .then((response) => { - handlePostResponse(response, router, { - prefix: `/parties/${partyName}/${partyId}/contracts`, - suffix: "contract", - identifier: "id", - }); - }) - .finally(() => { - handleLoading(false); - }); - } else { - void putMerchantContractHeadersByIdApi({ - id: props.contractId, - requestBody: data.formData as ContractHeaderForMerchantUpdateDto, - }) - .then((response) => { - handlePutResponse(response, router); - }) - .finally(() => { - handleLoading(false); - }); - } - }} - schema={$Schema[props.formType]} - submitText={languageData["Contracts.Create.Submit"]} - uiSchema={uiSchema} - widgets={{ - address: MerchantAddressWidget({ - loading, - addressList: addresses, - languageData, - }), - }} - withScrollArea - /> - ); -} - -function RefundTableHeadersItemField({ - languageData, - refundTableHeaders, - loading, -}: { - languageData: ContractServiceResource; - refundTableHeaders: RefundTableHeaderDto[]; - loading: boolean; -}) { - function Field(props: FieldProps) { - const [open, setOpen] = useState(false); - - const { schema } = props; - const _formData: ContractHeaderRefundTableHeaderCreateAndUpdateDto = - props.formData as ContractHeaderRefundTableHeaderCreateAndUpdateDto; - const hasValue: boolean = Object.keys(props.formData as object).length > 0; - const [defaultItem, setDefaultItem] = useState( - hasValue ? _formData.isDefault ?? true : props.index === 0, - ); - - const uiSchema = createUiSchemaWithResource({ - name: "Contracts.Form", - resources: languageData, - schema, - extend: { - refundTableHeaderId: { - "ui:widget": "refundTable", - "ui:title": - languageData[ - "Contracts.Form.refundTableHeaders.refundTableHeaderId" - ], - }, - }, - }); - return ( -
-
- { - setDefaultItem(e.target.checked); - }} - type="radio" - /> - -
- - - - - - - formData={_formData} - onSubmit={(data) => { - props.onChange({ ...data.formData, isDefault: defaultItem }); - setOpen(false); - }} - schema={props.schema} - uiSchema={uiSchema} - widgets={{ - refundTable: RefundTableWidget({ - loading, - refundTableHeaders, - languageData, - }), - }} - /> - - -
- ); - } - return Field; -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/contract-header-form/refund-point/index.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/contract-header-form/refund-point/index.tsx deleted file mode 100644 index f39ab0ce5..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/contract-header-form/refund-point/index.tsx +++ /dev/null @@ -1,293 +0,0 @@ -"use client"; -import { Button } from "@/components/ui/button"; -import { Label } from "@/components/ui/label"; -import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet"; -import type { - UniRefund_ContractService_ContractsForRefundPoint_ContractHeaders_ContractHeaderForRefundPointCreateDto as ContractHeaderForRefundPointCreateDto, - UniRefund_ContractService_ContractsForRefundPoint_ContractHeaders_ContractHeaderForRefundPointUpdateDto as ContractHeaderForRefundPointUpdateDto, - UniRefund_ContractService_ContractsForRefundPoint_ContractHeaderRefundFeeHeaders_ContractHeaderRefundFeeHeaderCreateAndUpdateDto as ContractHeaderRefundFeeHeaderCreateAndUpdateDto, - UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderDto as RefundFeeHeaderDto, -} from "@ayasofyazilim/saas/ContractService"; -import { - $UniRefund_ContractService_ContractsForRefundPoint_ContractHeaders_ContractHeaderForRefundPointCreateDto as $ContractHeaderForRefundPointCreateDto, - $UniRefund_ContractService_ContractsForRefundPoint_ContractHeaders_ContractHeaderForRefundPointUpdateDto as $ContractHeaderForRefundPointUpdateDto, -} from "@ayasofyazilim/saas/ContractService"; -import type { UniRefund_LocationService_AddressCommonDatas_AddressCommonDataDto as AddressTypeDto } from "@ayasofyazilim/saas/LocationService"; -import { SchemaForm } from "@repo/ayasofyazilim-ui/organisms/schema-form"; -import type { FieldProps } from "@repo/ayasofyazilim-ui/organisms/schema-form/types"; -import { createUiSchemaWithResource } from "@repo/ayasofyazilim-ui/organisms/schema-form/utils"; -import { useParams, useRouter } from "next/navigation"; -import type { Dispatch, SetStateAction } from "react"; -import { useState } from "react"; -import { postRefundPointContractHeadersById } from "src/actions/unirefund/ContractService/post-actions"; -import { putRefundPointContractHeadersById } from "src/actions/unirefund/ContractService/put-actions"; -import { - handlePostResponse, - handlePutResponse, -} from "src/actions/core/api-utils-client"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; -import { MerchantAddressWidget, RefundFeeWidget } from "../../contract-widgets"; - -type RefundPointContractHeaderFormProps = { - loading: boolean; - setLoading?: Dispatch>; - languageData: ContractServiceResource; - addresses: AddressTypeDto[]; - refundFeeHeaders: RefundFeeHeaderDto[]; -} & ( - | RefundPointContractHeaderUpdateFormProps - | RefundPointContractHeaderCreateFormProps -); -interface RefundPointContractHeaderUpdateFormProps { - formType: "update"; - contractId: string; - formData: ContractHeaderForRefundPointUpdateDto; -} -interface RefundPointContractHeaderCreateFormProps { - formType: "create"; - formData: ContractHeaderForRefundPointCreateDto; -} - -export default function RefundPointContractHeaderForm( - props: RefundPointContractHeaderFormProps, -) { - const { - formData, - loading, - languageData, - addresses, - refundFeeHeaders, - setLoading, - } = props; - const router = useRouter(); - const { partyId, partyName } = useParams<{ - partyId: string; - partyName: string; - }>(); - const [formLoading, setFormLoading] = useState(loading || false); - function handleLoading(_loading: boolean) { - if (setLoading) setLoading(_loading); - setFormLoading(_loading); - } - const $Schema = { - create: $ContractHeaderForRefundPointCreateDto, - update: $ContractHeaderForRefundPointUpdateDto, - }; - const uiSchema = createUiSchemaWithResource({ - name: "Contracts.Form", - resources: languageData, - schema: $Schema[props.formType], - extend: { - "ui:options": { - expandable: false, - }, - webSite: { - "ui:className": "md:col-span-full", - "ui:options": { - inputType: "url", - }, - }, - "ui:className": "md:grid md:gap-2 md:grid-cols-2", - addressCommonDataId: { - "ui:className": "row-start-2", - "ui:widget": "address", - }, - status: { - "ui:className": "md:col-span-full", - }, - earlyRefund: { - "ui:widget": "switch", - }, - refundFeeHeaders: { - "ui:className": "md:col-span-full", - items: { - "ui:field": "RefundFeeHeadersItemField", - displayLabel: false, - }, - }, - }, - }); - return ( - { - if (!submitData) return; - handleLoading(true); - if (props.formType === "create") { - void postRefundPointContractHeadersById({ - id: partyId, - requestBody: submitData as ContractHeaderForRefundPointCreateDto, - }) - .then((response) => { - handlePostResponse(response, router, { - prefix: `/parties/${partyName}/${partyId}/contracts`, - suffix: "contract", - identifier: "id", - }); - }) - .finally(() => { - handleLoading(false); - }); - } else { - void putRefundPointContractHeadersById({ - id: props.contractId, - requestBody: submitData as ContractHeaderForRefundPointUpdateDto, - }) - .then((response) => { - handlePutResponse(response, router); - }) - .finally(() => { - handleLoading(false); - }); - } - }} - schema={$Schema[props.formType]} - uiSchema={uiSchema} - widgets={{ - address: MerchantAddressWidget({ - loading: formLoading || loading, - addressList: addresses, - languageData, - }), - }} - /> - ); -} - -function RefundFeeHeadersItemField({ - languageData, - refundFeeHeaders, - loading, -}: { - languageData: ContractServiceResource; - refundFeeHeaders: RefundFeeHeaderDto[]; - loading: boolean; -}) { - function Field(props: FieldProps) { - const [open, setOpen] = useState(false); - - const { schema } = props; - const _formData: ContractHeaderRefundFeeHeaderCreateAndUpdateDto = - props.formData as ContractHeaderRefundFeeHeaderCreateAndUpdateDto; - const hasValue: boolean = Object.keys(props.formData as object).length > 0; - const [defaultItem, setDefaultItem] = useState( - hasValue ? _formData.isDefault ?? true : props.index === 0, - ); - const _defaults = { - validFrom: new Date().toISOString(), - validTo: new Date( - new Date().setFullYear(new Date().getFullYear() + 1), - ).toISOString(), - refundFeeHeaderId: - refundFeeHeaders.length === 1 - ? refundFeeHeaders.at(0)?.id - : "00000000-0000-0000-0000-000000000000", - }; - const uiSchema = createUiSchemaWithResource({ - name: "Contracts.Form", - resources: languageData, - schema, - extend: { - refundFeeHeaderId: { - "ui:widget": "refundFee", - "ui:title": - languageData["Contracts.Form.refundFeeHeaders.refundFeeHeaderId"], - }, - }, - }); - return ( -
-
- { - setDefaultItem(e.target.checked); - }} - type="radio" - /> - -
- - - - - - - formData={{ - ..._defaults, - ..._formData, - }} - onSubmit={(data) => { - props.onChange({ ...data.formData, isDefault: defaultItem }); - setOpen(false); - }} - schema={props.schema} - uiSchema={uiSchema} - widgets={{ - refundFee: RefundFeeWidget({ - loading, - refundFeeHeaders, - languageData, - }), - }} - /> - - -
- ); - } - return Field; -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/contract-widgets.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/contract-widgets.tsx deleted file mode 100644 index 530a74b8b..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/contract-widgets.tsx +++ /dev/null @@ -1,179 +0,0 @@ -import type { WidgetProps } from "@repo/ayasofyazilim-ui/organisms/schema-form/types"; -import { CustomCombobox } from "@repo/ayasofyazilim-ui/organisms/schema-form/widgets"; -import type { - UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderDto as RefundTableHeaderDto, - UniRefund_ContractService_Rebates_RebateTableHeaders_RebateTableHeaderDto as RebateTableHeaderDto, - UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderDto as RefundFeeHeaderDto, -} from "@ayasofyazilim/saas/ContractService"; -import type { UniRefund_CRMService_Merchants_StoreProfileDto as StoreProfileDto } from "@ayasofyazilim/saas/CRMService"; -import type { UniRefund_LocationService_AddressCommonDatas_AddressCommonDataDto as AddressTypeDto } from "@ayasofyazilim/saas/LocationService"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; - -export function MerchantAddressWidget({ - loading, - languageData, - addressList, -}: { - loading: boolean; - languageData: ContractServiceResource; - addressList: AddressTypeDto[] | undefined; -}) { - function Widget(props: WidgetProps) { - return ( - - {...props} - disabled={loading} - emptyValue={ - languageData["Contracts.Form.addressCommonDataId.emptyValue"] - } - list={addressList} - searchPlaceholder={ - languageData["Contracts.Form.addressCommonDataId.searchPlaceholder"] - } - searchResultLabel={ - languageData["Contracts.Form.addressCommonDataId.searchResultLabel"] - } - selectIdentifier="id" - selectLabel="addressLine" - /> - ); - } - return Widget; -} - -export function RefundTableWidget({ - loading, - languageData, - refundTableHeaders, -}: { - loading: boolean; - languageData: ContractServiceResource; - refundTableHeaders: RefundTableHeaderDto[] | undefined; -}) { - function Widget(comboboxProps: WidgetProps) { - return ( - - {...comboboxProps} - disabled={loading} - emptyValue={ - languageData[ - "Contracts.Form.refundTableHeaders.refundTableHeaderId.emptyValue" - ] - } - list={refundTableHeaders} - searchPlaceholder={ - languageData[ - "Contracts.Form.refundTableHeaders.refundTableHeaderId.searchPlaceholder" - ] - } - searchResultLabel={ - languageData[ - "Contracts.Form.refundTableHeaders.refundTableHeaderId.searchResultLabel" - ] - } - selectIdentifier="id" - selectLabel="name" - /> - ); - } - return Widget; -} - -export function RefundFeeWidget({ - loading, - languageData, - refundFeeHeaders, -}: { - loading: boolean; - languageData: ContractServiceResource; - refundFeeHeaders: RefundFeeHeaderDto[] | undefined; -}) { - function Widget(comboboxProps: WidgetProps) { - return ( - - {...comboboxProps} - disabled={loading} - emptyValue={ - languageData[ - "Contracts.Form.refundFeeHeaders.refundFeeHeaderId.emptyValue" - ] - } - list={refundFeeHeaders} - searchPlaceholder={ - languageData[ - "Contracts.Form.refundFeeHeaders.refundFeeHeaderId.searchPlaceholder" - ] - } - searchResultLabel={ - languageData[ - "Contracts.Form.refundFeeHeaders.refundFeeHeaderId.searchResultLabel" - ] - } - selectIdentifier="id" - selectLabel="name" - /> - ); - } - return Widget; -} - -export function RebateTableWidget({ - loading, - languageData, - rebateTableHeaders, -}: { - loading: boolean; - languageData: ContractServiceResource; - rebateTableHeaders: RebateTableHeaderDto[] | undefined; -}) { - function Widget(comboboxProps: WidgetProps) { - return ( - - {...comboboxProps} - disabled={loading} - emptyValue={ - languageData["Rebate.Form.rebateTableHeadersFromTemplate.id"] - } - list={rebateTableHeaders} - searchPlaceholder={ - languageData[ - "Rebate.Form.rebateTableHeadersFromTemplate.id.searchPlaceholder" - ] - } - searchResultLabel={ - languageData[ - "Rebate.Form.rebateTableHeadersFromTemplate.id.searchResultLabel" - ] - } - selectIdentifier="id" - selectLabel="name" - /> - ); - } - return Widget; -} - -export function MerchantStoresWidget({ - loading, - languageData, - list, -}: { - loading: boolean; - languageData: ContractServiceResource; - list: StoreProfileDto[] | undefined; -}) { - function Widget(props: WidgetProps) { - return ( - - {...props} - disabled={loading} - list={list} - searchPlaceholder={languageData["Select.Placeholder"]} - searchResultLabel={languageData["Select.ResultLabel"]} - selectIdentifier="id" - selectLabel="name" - /> - ); - } - return Widget; -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/table-data.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/table-data.tsx deleted file mode 100644 index 0b78635d0..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/table-data.tsx +++ /dev/null @@ -1,116 +0,0 @@ -import { toast } from "@/components/ui/sonner"; -import type { - UniRefund_ContractService_ContractsForMerchant_ContractHeaders_ContractHeaderDetailForMerchantDto as ContractsForMerchantDto, - UniRefund_ContractService_ContractsForRefundPoint_ContractHeaders_ContractHeaderDetailForRefundPointDto as ContractsForRefundPointDto, -} from "@ayasofyazilim/saas/ContractService"; -import { $UniRefund_ContractService_ContractsForMerchant_ContractHeaders_ContractHeaderDetailForMerchantDto as $ContractsForMerchantDto } from "@ayasofyazilim/saas/ContractService"; -import { OpenInNewWindowIcon } from "@radix-ui/react-icons"; -import type { TanstackTableCreationProps } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/types"; -import { tanstackTableCreateColumnsByRowData as columnsByData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; -import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; -import { getBaseLink } from "src/utils"; -import type { ContractPartyName } from "./types"; - -const contractsTableColumns = ({ - languageData, - lang, - partyName, - partyId, -}: { - languageData: CRMServiceServiceResource & ContractServiceResource; - lang: string; - partyName: ContractPartyName; - partyId: string; -}) => { - return columnsByData({ - rows: $ContractsForMerchantDto.properties, - config: { locale: lang }, - languageData: { - constantKey: "Contracts", - languageData, - }, - badges: { - name: { - values: [ - { - label: languageData["Contracts.draft"], - conditions: [ - { - when: (value) => value === true, - conditionAccessorKey: "isDraft", - }, - ], - }, - { - label: languageData["Contracts.active"], - conditions: [ - { - when: (value) => value === true, - conditionAccessorKey: "isActive", - }, - ], - }, - ], - }, - }, - links: { - name: { - prefix: `/parties/${partyName}/${partyId}/contracts`, - targetAccessorKey: "id", - suffix: "/contract", - }, - }, - icons: { - name: { - icon: OpenInNewWindowIcon, - position: "before", - }, - }, - }); -}; - -const contractsTable = (props: { - languageData: CRMServiceServiceResource & ContractServiceResource; - partyName: ContractPartyName; - partyId: string; - router: AppRouterInstance; -}) => { - const { languageData, partyName, partyId, router } = props; - const table: TanstackTableCreationProps< - ContractsForMerchantDto | ContractsForRefundPointDto - > = { - fillerColumn: "name", - columnVisibility: { - type: "show", - columns: ["name", "validFrom", "validTo"], - }, - tableActions: [ - { - type: "simple", - actionLocation: "table", - cta: languageData["Contracts.New"], - onClick: () => { - router.push( - getBaseLink(`/parties/${partyName}/${partyId}/contracts/new/`), - ); - }, - }, - { - type: "simple", - actionLocation: "table", - cta: languageData.ExportCSV, - onClick: () => { - toast.warning("Not implemented yet"); - }, - }, - ], - }; - return table; -}; - -export const tableData = { - columns: contractsTableColumns, - table: contractsTable, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/types.ts b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/types.ts deleted file mode 100644 index c59c7773a..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/_components/types.ts +++ /dev/null @@ -1 +0,0 @@ -export type ContractPartyName = "merchants" | "refund-points"; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/new/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/new/page.tsx deleted file mode 100644 index 394bd6143..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/new/page.tsx +++ /dev/null @@ -1,128 +0,0 @@ -import { notFound } from "next/navigation"; -import { - getRefundTableHeadersApi, - getRefundFeeHeadersApi, -} from "src/actions/unirefund/ContractService/action"; -import { - getAdressesApi, - getMerchantByIdApi, - getRefundPointDetailsByIdApi, -} from "src/actions/unirefund/CrmService/actions"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; -import { getResourceData } from "src/language-data/unirefund/ContractService"; -import { getBaseLink } from "src/utils"; -import MerchantContractHeaderForm from "../_components/contract-header-form/merchant"; -import RefundPointContractHeaderForm from "../_components/contract-header-form/refund-point"; -import type { ContractPartyName } from "../_components/types"; - -export default async function Page({ - params, -}: { - params: { - partyName: ContractPartyName; - partyId: string; - lang: string; - }; -}) { - await isUnauthorized({ - requiredPolicies: ["ContractService.ContractHeaderForMerchant.Create"], - lang: params.lang, - }); - - const { languageData } = await getResourceData(params.lang); - if (params.partyName === "merchants") { - const addresses = await getAdressesApi(params.partyId, params.partyName); - const refundTableHeaders = await getRefundTableHeadersApi({}); - const merchantDetails = await getMerchantByIdApi(params.partyId); - if ( - addresses.type !== "success" || - refundTableHeaders.type !== "success" || - merchantDetails.type !== "success" - ) { - return notFound(); - } - return ( - <> - - - - ); - } - - const refundPointDetails = await getRefundPointDetailsByIdApi(params.partyId); - const refundFeeHeaders = await getRefundFeeHeadersApi({}); - if ( - refundPointDetails.type !== "success" || - refundFeeHeaders.type !== "success" - ) - return notFound(); - - const refundPointDetailsSummary = refundPointDetails.data.entityInformations - ?.at(0) - ?.organizations?.at(0); - return ( - <> - - - - ); -} - -function PageHeader({ - params, - title, - languageData, -}: { - params: { partyName: string; partyId: string }; - title: string; - languageData: ContractServiceResource; -}) { - return ( - <> -
- {languageData["Contracts.Create.Title"]} - {title} -
-
- {languageData["Contracts.Create.Description"]} -
- - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/table.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/table.tsx deleted file mode 100644 index 113569cdd..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/contracts/table.tsx +++ /dev/null @@ -1,37 +0,0 @@ -"use client"; - -import type { - PagedResultDto_ContractHeaderDetailForMerchantDto, - PagedResultDto_ContractHeaderDetailForRefundPointDto, -} from "@ayasofyazilim/saas/ContractService"; -import TanstackTable from "@repo/ayasofyazilim-ui/molecules/tanstack-table"; -import { SectionLayoutContent } from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import { useRouter } from "next/navigation"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import { tableData } from "./_components/table-data"; -import type { ContractPartyName } from "./_components/types"; - -export default function Contracts(props: { - languageData: CRMServiceServiceResource & ContractServiceResource; - contractsData: - | PagedResultDto_ContractHeaderDetailForMerchantDto - | PagedResultDto_ContractHeaderDetailForRefundPointDto; - partyId: string; - partyName: ContractPartyName; - lang: string; -}) { - const router = useRouter(); - const columns = tableData.columns({ ...props }); - const table = tableData.table({ ...props, router }); - - return ( - - - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/email/form.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/email/form.tsx deleted file mode 100644 index 113b6ad93..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/email/form.tsx +++ /dev/null @@ -1,70 +0,0 @@ -"use client"; - -import type { - UniRefund_CRMService_Individuals_IndividualDto, - UniRefund_CRMService_Organizations_OrganizationDto, -} from "@ayasofyazilim/saas/CRMService"; -import AutoForm, { - AutoFormSubmit, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { SectionLayoutContent } from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import { emailSchema } from "@repo/ui/utils/table/form-schemas"; -import { useRouter } from "next/navigation"; -import { putCrmEmailAddressApi } from "src/actions/unirefund/CrmService/put-actions"; -import type { EmailAddressUpdateDto } from "src/actions/unirefund/CrmService/types"; -import { handlePutResponse } from "src/actions/core/api-utils-client"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import type { PartyNameType } from "../../../types"; - -function Email({ - languageData, - partyName, - partyId, - organizationData, -}: { - languageData: CRMServiceServiceResource; - partyName: Exclude; - partyId: string; - organizationData: - | UniRefund_CRMService_Organizations_OrganizationDto - | UniRefund_CRMService_Individuals_IndividualDto - | undefined; -}) { - const router = useRouter(); - const emailValues = organizationData?.contactInformations?.[0]?.emails?.[0]; - - function handleSubmit(formData: EmailAddressUpdateDto) { - void putCrmEmailAddressApi(partyName, { - requestBody: formData, - id: partyId, - emailId: emailValues?.id || "", - }).then((response) => { - handlePutResponse(response, router); - }); - } - return ( - - { - handleSubmit(values as EmailAddressUpdateDto); - }} - values={emailValues} - > - - {languageData.Save} - - - - ); -} - -export default Email; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/individuals-table/form.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/individuals-table/form.tsx deleted file mode 100644 index 3f3787745..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/individuals-table/form.tsx +++ /dev/null @@ -1,143 +0,0 @@ -"use client"; - -import { toast } from "@/components/ui/sonner"; -import type { - UniRefund_CRMService_AffiliationCodes_AffiliationCodeDto, - UniRefund_CRMService_EmailCommonDatas_UpdateEmailCommonDataDto, -} from "@ayasofyazilim/saas/CRMService"; -import { - $UniRefund_CRMService_AffiliationCodes_CreateAffiliationCodeDto, - $UniRefund_CRMService_EmailCommonDatas_UpdateEmailCommonDataDto, -} from "@ayasofyazilim/saas/CRMService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import type { AutoFormInputComponentProps } from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import AutoForm, { - AutoFormSubmit, - CustomCombobox, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { useRouter } from "next/navigation"; -import { useEffect, useState } from "react"; -import { - getAffiliationCodeApi, - getIndividualsApi, -} from "src/actions/unirefund/CrmService/actions"; -import { postAffiliationsApi } from "src/actions/unirefund/CrmService/post-actions"; -import type { AffiliationsPostDto } from "src/actions/unirefund/CrmService/types"; -import { - handleGetResponseError, - handlePostResponse, -} from "src/actions/core/api-utils-client"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import type { PartyNameType } from "../../../types"; - -interface AutoFormValues { - email: UniRefund_CRMService_EmailCommonDatas_UpdateEmailCommonDataDto; - affilation: AffiliationsPostDto; -} -function AffiliationsForm({ - languageData, - partyName, - partyId, -}: { - languageData: CRMServiceServiceResource; - partyName: Exclude; - partyId: string; -}) { - const [affiliationCodes, setAffiliationCodes] = useState< - UniRefund_CRMService_AffiliationCodes_AffiliationCodeDto[] - >([]); - const router = useRouter(); - - const affiliationsSchema = createZodObject( - { - type: "object", - properties: { - email: $UniRefund_CRMService_EmailCommonDatas_UpdateEmailCommonDataDto, - affilation: - $UniRefund_CRMService_AffiliationCodes_CreateAffiliationCodeDto, - }, - }, - undefined, - undefined, - { - email: ["emailAddress"], - affilation: ["roleId"], - }, - ); - - useEffect(() => { - void getAffiliationCodeApi("individuals").then((response) => { - if (response.type === "success") { - setAffiliationCodes(response.data.items || []); - return; - } - handleGetResponseError(response); - }); - }, []); - - async function handleSubmit(formData: AutoFormValues) { - const email = formData.email.emailAddress; - const doesEmailExistsResponse = await getIndividualsApi({ - email, - maxResultCount: 1, - }); - if (doesEmailExistsResponse.type !== "success") { - toast.error(languageData["Fetch.Fail"]); - return; - } - - if (doesEmailExistsResponse.data.items?.length !== 0) { - const individualId = doesEmailExistsResponse.data.items?.[0].id; - const requestBody: AffiliationsPostDto = { - affiliationCodeId: formData.affilation.affiliationCodeId, - name: "", - description: "", - partyId: individualId, - }; - void postAffiliationsApi(partyName, { - requestBody, - id: partyId, - }).then((response) => { - handlePostResponse(response, router); - }); - return; - } - - toast.error(languageData.NoIndividualFound); - } - - const fieldConfig = { - affilation: { - roleId: { - displayName: languageData.Role, - renderer: (props: AutoFormInputComponentProps) => { - "use client"; - return ( - - childrenProps={props} - list={affiliationCodes} - selectIdentifier="id" - selectLabel="name" - /> - ); - }, - }, - }, - }; - return ( - { - void handleSubmit(values as AutoFormValues); - }} - > - - {languageData.Save} - - - ); -} - -export default AffiliationsForm; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/individuals-table/table.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/individuals-table/table.tsx deleted file mode 100644 index 12b0a97bf..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/individuals-table/table.tsx +++ /dev/null @@ -1,55 +0,0 @@ -"use server"; -import { SectionLayoutContent } from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import TableComponent from "@repo/ui/TableComponent"; -import { deleteTableRow, getApiRequests } from "src/actions/api-requests"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import { dataConfigOfParties } from "../../../table-data"; -import type { PartyNameType } from "../../../types"; - -function Individual({ - languageData, - partyName, - partyId, -}: { - languageData: CRMServiceServiceResource; - partyName: Exclude; - partyId: string; -}) { - const formData = dataConfigOfParties[partyName]; - - return ( - - { - "use server"; - const response = await deleteTableRow(partyName, id); - return response; - }} - deleteableRow - editOnNewPage - editOnNewPageUrl={`/parties/${partyName}`} - fetchRequest={async (page) => { - "use server"; - const requests = await getApiRequests(); - const response = await requests[partyName].getIndivuals({ - id: partyId, - maxResultCount: 10, - skipCount: page * 10, - }); - - return { - type: "success", - data: { - items: response.items || [], - totalCount: response.totalCount || 0, - }, - }; - }} - languageData={languageData} - tableSchema={formData.tableSchema} - /> - - ); -} - -export default Individual; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/merchant/form.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/merchant/form.tsx deleted file mode 100644 index 078d3277c..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/merchant/form.tsx +++ /dev/null @@ -1,119 +0,0 @@ -"use client"; - -import type { - UniRefund_CRMService_Merchants_MerchantProfileDto, - UniRefund_CRMService_Merchants_UpdateMerchantDto, - UniRefund_CRMService_TaxOffices_TaxOfficeProfileDto, -} from "@ayasofyazilim/saas/CRMService"; -import { $UniRefund_CRMService_Merchants_MerchantBaseDto } from "@ayasofyazilim/saas/CRMService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import type { - AutoFormInputComponentProps, - DependenciesType, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import AutoForm, { - AutoFormSubmit, - CustomCombobox, - DependencyType, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { SectionLayoutContent } from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import { useRouter } from "next/navigation"; -import { putMerchantBaseApi } from "src/actions/unirefund/CrmService/put-actions"; -import { handlePutResponse } from "src/actions/core/api-utils-client"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; - -function MerchantForm({ - languageData, - partyId, - taxOfficeList, - merchantList, - merchantBaseData, -}: { - languageData: CRMServiceServiceResource; - partyName: "merchants"; - partyId: string; - taxOfficeList: UniRefund_CRMService_TaxOffices_TaxOfficeProfileDto[]; - merchantList: UniRefund_CRMService_Merchants_MerchantProfileDto[]; - merchantBaseData: UniRefund_CRMService_Merchants_UpdateMerchantDto; -}) { - const router = useRouter(); - const schema = createZodObject( - $UniRefund_CRMService_Merchants_MerchantBaseDto, - ["typeCode", "taxOfficeId", "parentId"], - ); - const dependencies: DependenciesType = [ - { - sourceField: "typeCode", - type: DependencyType.HIDES, - targetField: "parentId", - when: (typeCode: string) => typeCode !== "STORE", - }, - { - sourceField: "typeCode", - type: DependencyType.REQUIRES, - targetField: "parentId", - when: (typeCode: string) => typeCode === "STORE", - }, - ]; - - function handleSubmit( - formData: UniRefund_CRMService_Merchants_UpdateMerchantDto, - ) { - void putMerchantBaseApi({ - requestBody: formData, - id: partyId, - }).then((response) => { - handlePutResponse(response, router); - }); - } - return ( - - { - return ( - - childrenProps={props} - list={taxOfficeList} - selectIdentifier="id" - selectLabel="name" - /> - ); - }, - }, - parentId: { - renderer: (props: AutoFormInputComponentProps) => { - return ( - - childrenProps={props} - list={merchantList} - selectIdentifier="id" - selectLabel="name" - /> - ); - }, - }, - }} - formClassName="pb-40" - formSchema={schema} - onSubmit={(values) => { - if (values.typeCode === "STORE" && !values.parentId) { - return; - } - handleSubmit( - values as UniRefund_CRMService_Merchants_UpdateMerchantDto, - ); - }} - values={merchantBaseData} - > - - {languageData.Save} - - - - ); -} - -export default MerchantForm; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/name/form.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/name/form.tsx deleted file mode 100644 index b2e9f2da8..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/name/form.tsx +++ /dev/null @@ -1,63 +0,0 @@ -"use client"; - -import type { UniRefund_CRMService_NameCommonDatas_NameCommonDataDto } from "@ayasofyazilim/saas/CRMService"; -import { $UniRefund_CRMService_NameCommonDatas_UpdateNameCommonDataDto } from "@ayasofyazilim/saas/CRMService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import AutoForm, { - AutoFormSubmit, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { SectionLayoutContent } from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import { useRouter } from "next/navigation"; -import { handlePutResponse } from "src/actions/core/api-utils-client"; -import { putCrmIndividualNameApi } from "src/actions/unirefund/CrmService/put-actions"; -import type { IndividualNameUpdateDto } from "src/actions/unirefund/CrmService/types"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; - -function NameForm({ - languageData, - partyName, - partyId, - individualData, -}: { - languageData: CRMServiceServiceResource; - partyName: "merchants"; - partyId: string; - individualData: - | UniRefund_CRMService_NameCommonDatas_NameCommonDataDto - | undefined; -}) { - const router = useRouter(); - - const nameSchema = createZodObject( - $UniRefund_CRMService_NameCommonDatas_UpdateNameCommonDataDto, - ); - - function handleSubmit(formData: IndividualNameUpdateDto) { - void putCrmIndividualNameApi(partyName, { - requestBody: formData, - id: partyId, - nameId: individualData?.id || "", - individualId: individualData?.individualId || "", - }).then((response) => { - handlePutResponse(response, router); - }); - } - return ( - - { - handleSubmit(values as IndividualNameUpdateDto); - }} - values={individualData} - > - - {languageData.Save} - - - - ); -} - -export default NameForm; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/organization/form.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/organization/form.tsx deleted file mode 100644 index ce5c2ac7c..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/organization/form.tsx +++ /dev/null @@ -1,68 +0,0 @@ -"use client"; - -import type { UniRefund_CRMService_Organizations_OrganizationDto } from "@ayasofyazilim/saas/CRMService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import AutoForm, { - AutoFormSubmit, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { SectionLayoutContent } from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import { useRouter } from "next/navigation"; -import { putCrmOrganizationApi } from "src/actions/unirefund/CrmService/put-actions"; -import type { OrganizationUpdateDto } from "src/actions/unirefund/CrmService/types"; -import { handlePutResponse } from "src/actions/core/api-utils-client"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import type { PartyNameType } from "../../../types"; -import { editSchemasOfParties } from "../update-data"; - -function OrganizationForm({ - languageData, - partyName, - partyId, - organizationId, - organizationData, -}: { - languageData: CRMServiceServiceResource; - partyName: Exclude; - partyId: string; - organizationId: string; - organizationData: UniRefund_CRMService_Organizations_OrganizationDto; -}) { - const router = useRouter(); - const { organizationSchema, organizationSchemaSubPositions } = - editSchemasOfParties[partyName]; - - //hide branchId & parent because its headquarter - const _organizationSchema = createZodObject( - organizationSchema, - organizationSchemaSubPositions, - ); - - function handleSubmit(formData: OrganizationUpdateDto) { - void putCrmOrganizationApi(partyName, { - requestBody: formData, - id: partyId, - organizationId: organizationId || "", - }).then((response) => { - handlePutResponse(response, router); - }); - } - - return ( - - { - handleSubmit(values as OrganizationUpdateDto); - }} - values={organizationData} - > - - {languageData.Save} - - - - ); -} - -export default OrganizationForm; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/page.tsx deleted file mode 100644 index cc51f4165..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/page.tsx +++ /dev/null @@ -1,216 +0,0 @@ -"use server"; - -import { SectionLayout } from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import { notFound } from "next/navigation"; -import { getTableDataDetail } from "src/actions/api-requests"; -import { - getMerchantContractHeadersByMerchantIdApi, - getRefundPointContractHeadersByRefundPointIdApi, -} from "src/actions/unirefund/ContractService/action"; -import { - getMerchantsApi, - getTaxOfficesApi, -} from "src/actions/unirefund/CrmService/actions"; -import { getCountriesApi } from "src/actions/unirefund/LocationService/actions"; -import { getResourceData as getContractsResourceData } from "src/language-data/unirefund/ContractService"; -import { getResourceData } from "src/language-data/unirefund/CRMService"; -import { dataConfigOfParties } from "../../table-data"; -import type { PartyNameType } from "../../types"; -import Address from "./address/form"; -import Contracts from "./contracts/table"; -import Email from "./email/form"; -import IndividualTable from "./individuals-table/table"; -import MerchantForm from "./merchant/form"; -import NameForm from "./name/form"; -import OrganizationForm from "./organization/form"; -import PersonalSummariesForm from "./personal-summaries/form"; -import SubCompany from "./subcompanies-table/form"; -import Telephone from "./telephone/form"; -import type { GetPartiesDetailResult } from "./types"; - -export default async function Page({ - params, -}: { - params: { - partyId: string; - partyName: Exclude; - lang: string; - }; -}) { - const { languageData } = await getResourceData(params.lang); - const { languageData: contractsLanguageData } = - await getContractsResourceData(params.lang); - const formData = dataConfigOfParties[params.partyName]; - - const partyDetail = await getTableDataDetail( - params.partyName, - params.partyId, - ); - if (partyDetail.type !== "success" || !partyDetail.data) { - notFound(); - } - const partyDetailData = partyDetail.data as GetPartiesDetailResult; - const organizationData = - partyDetailData.entityInformations?.[0]?.organizations?.[0]; - const individualData = - partyDetailData.entityInformations?.[0]?.individuals?.[0]; - if (!organizationData && !individualData) { - return notFound(); - } - - const countries = await getCountriesApi(); - const countryList = - (countries.type === "success" && countries.data.items) || []; - - const merchants = await getMerchantsApi(); - const merchantList = - (merchants.type === "success" && - merchants.data.items?.filter( - (merchant) => merchant.id !== params.partyId, - )) || - []; - - let contracts; - if (params.partyName === "refund-points") { - contracts = await getRefundPointContractHeadersByRefundPointIdApi({ - id: params.partyId, - }); - } - if (params.partyName === "merchants") { - contracts = await getMerchantContractHeadersByMerchantIdApi({ - id: params.partyId, - }); - } - - if (!contracts || contracts.type !== "success") { - notFound(); - } - const taxOffices = await getTaxOfficesApi(); - const taxOfficeList = - (taxOffices.type === "success" && taxOffices.data.items) || []; - - const sections = [ - { name: languageData.Telephone, id: "telephone" }, - { name: languageData.Address, id: "address" }, - { name: languageData.Email, id: "email" }, - { name: languageData[formData.subEntityName], id: "SubCompany" }, - { name: languageData.Individuals, id: "individuals" }, - ]; - - if (organizationData) { - sections.unshift({ - name: languageData["Parties.Organization"], - id: "organization", - }); - } else { - sections.unshift({ - name: languageData.PersonalSummaries, - id: "personal-summaries", - }); - sections.unshift({ name: languageData.Name, id: "name" }); - } - if (params.partyName === "merchants") { - sections.unshift({ - name: languageData.Merchants, - id: "merchant-base", - }); - } - if ( - params.partyName === "refund-points" || - params.partyName === "merchants" - ) { - sections.push({ name: languageData.Contracts, id: "contracts" }); - } - - return ( - <> -
- - {params.partyName === "merchants" && - "taxOfficeId" in partyDetailData && ( - - )} - - {organizationData ? ( - - ) : null} - - {params.partyName === "merchants" && individualData ? ( - <> - - - - ) : null} - - - -
- - - - - {(params.partyName === "merchants" || - params.partyName === "refund-points") && ( - - )} - -
-
- {`${languageData[formData.translationKey]} (${partyDetailData.entityInformations?.[0]?.organizations?.[0]?.name || `${individualData?.name?.firstName} ${individualData?.name?.lastName}`})`} -
- - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/personal-summaries/form.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/personal-summaries/form.tsx deleted file mode 100644 index a352763c7..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/personal-summaries/form.tsx +++ /dev/null @@ -1,63 +0,0 @@ -"use client"; - -import type { UniRefund_CRMService_PersonalSummaries_PersonalSummaryDto } from "@ayasofyazilim/saas/CRMService"; -import { $UniRefund_CRMService_PersonalSummaries_UpdatePersonalSummaryDto } from "@ayasofyazilim/saas/CRMService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import AutoForm, { - AutoFormSubmit, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { SectionLayoutContent } from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import { useRouter } from "next/navigation"; -import { handlePutResponse } from "src/actions/core/api-utils-client"; -import { putCrmIndividualPersonalSummaryApi } from "src/actions/unirefund/CrmService/put-actions"; -import type { IndividualPersonalSummariesUpdateDto } from "src/actions/unirefund/CrmService/types"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; - -function PersonalSummariesForm({ - languageData, - partyName, - partyId, - individualData, -}: { - languageData: CRMServiceServiceResource; - partyName: "merchants"; - partyId: string; - individualData: - | UniRefund_CRMService_PersonalSummaries_PersonalSummaryDto - | undefined; -}) { - const router = useRouter(); - - const schema = createZodObject( - $UniRefund_CRMService_PersonalSummaries_UpdatePersonalSummaryDto, - ); - - function handleSubmit(formData: IndividualPersonalSummariesUpdateDto) { - void putCrmIndividualPersonalSummaryApi(partyName, { - requestBody: formData, - id: partyId, - personalSummaryId: individualData?.id || "", - individualId: individualData?.individualId || "", - }).then((response) => { - handlePutResponse(response, router); - }); - } - return ( - - { - handleSubmit(values as IndividualPersonalSummariesUpdateDto); - }} - values={individualData} - > - - {languageData.Save} - - - - ); -} - -export default PersonalSummariesForm; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/subcompanies-table/form.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/subcompanies-table/form.tsx deleted file mode 100644 index 514843f8a..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/subcompanies-table/form.tsx +++ /dev/null @@ -1,57 +0,0 @@ -"use server"; -import { SectionLayoutContent } from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import TableComponent from "@repo/ui/TableComponent"; -import { deleteTableRow, getApiRequests } from "src/actions/api-requests"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import { dataConfigOfParties } from "../../../table-data"; -import type { PartyNameType } from "../../../types"; - -function SubCompany({ - languageData, - partyName, - partyId, -}: { - languageData: CRMServiceServiceResource; - partyName: Exclude; - partyId: string; -}) { - const formData = dataConfigOfParties[partyName]; - - return ( - - { - "use server"; - const response = await deleteTableRow(partyName, id); - return response; - }} - deleteableRow - editOnNewPage - editOnNewPageUrl={`/parties/${partyName}`} - fetchRequest={async (page) => { - "use server"; - const requests = await getApiRequests(); - const response = await requests[partyName].getSubCompanies({ - id: partyId, - maxResultCount: 10, - skipCount: page * 10, - }); - return { - type: "success", - data: { - items: response.items || [], - totalCount: response.totalCount || 0, - }, - }; - }} - languageData={languageData} - tableSchema={formData.tableSchema} - /> - - ); -} - -export default SubCompany; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/telephone/form.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/telephone/form.tsx deleted file mode 100644 index a0df8d5ae..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/telephone/form.tsx +++ /dev/null @@ -1,92 +0,0 @@ -"use client"; - -import type { - UniRefund_CRMService_Individuals_IndividualDto, - UniRefund_CRMService_Organizations_OrganizationDto, -} from "@ayasofyazilim/saas/CRMService"; -import AutoForm, { - AutoFormSubmit, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { SectionLayoutContent } from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import { telephoneSchema } from "@repo/ui/utils/table/form-schemas"; -import { useRouter } from "next/navigation"; -import { handlePutResponse } from "src/actions/core/api-utils-client"; -import { putCrmTelephoneApi } from "src/actions/unirefund/CrmService/put-actions"; -import type { TelephoneUpdateDto } from "src/actions/unirefund/CrmService/types"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import { isPhoneValid, splitPhone } from "src/utils/utils-phone"; -import type { PartyNameType } from "../../../types"; - -function Telephone({ - languageData, - partyName, - partyId, - organizationData, -}: { - languageData: CRMServiceServiceResource; - partyName: Exclude; - partyId: string; - organizationData: - | UniRefund_CRMService_Organizations_OrganizationDto - | UniRefund_CRMService_Individuals_IndividualDto - | undefined; -}) { - const router = useRouter(); - - const telephoneData = - organizationData?.contactInformations?.[0]?.telephones?.[0]; - const telephoneValues = { - localNumber: - (telephoneData?.ituCountryCode || "+90") + - (telephoneData?.areaCode || "") + - (telephoneData?.localNumber || ""), - primaryFlag: telephoneData?.primaryFlag, - typeCode: telephoneData?.typeCode, - }; - - function handleSubmit(formData: TelephoneUpdateDto) { - void putCrmTelephoneApi(partyName, { - requestBody: formData, - id: partyId, - telephoneId: telephoneData?.id || "", - }).then((response) => { - handlePutResponse(response, router); - }); - } - return ( - - { - const isValid = isPhoneValid(values.localNumber as string); - if (!isValid) { - return; - } - const phoneData = splitPhone(values.localNumber as string); - const formData = { - ...values, - ...phoneData, - } as TelephoneUpdateDto; - handleSubmit(formData); - }} - values={telephoneValues} - > - - {languageData.Save} - - - - ); -} - -export default Telephone; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/types.ts b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/types.ts deleted file mode 100644 index 574a37d2a..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/types.ts +++ /dev/null @@ -1,146 +0,0 @@ -import type { - $UniRefund_CRMService_Customss_UpdateCustomsOrganizationDto, - $UniRefund_CRMService_EmailCommonDatas_UpdateEmailCommonDataDto, - $UniRefund_CRMService_Organizations_UpdateOrganizationDto, - $UniRefund_CRMService_RefundPoints_UpdateRefundPointOrganizationDto, - $UniRefund_CRMService_TelephoneTypes_UpdateTelephoneTypeDto, - PutApiCrmServiceCustomsByIdAddressesByAddressIdData, - PutApiCrmServiceCustomsByIdEmailsByEmailIdData, - PutApiCrmServiceCustomsByIdOrganizationsByOrganizationIdData, - PutApiCrmServiceCustomsByIdTelephonesByTelephoneIdData, - PutApiCrmServiceMerchantsByIdData, - PutApiCrmServiceMerchantsByIdEmailsByEmailIdData, - PutApiCrmServiceMerchantsByIdIndividualByIndividualIdNameByNameIdData, - PutApiCrmServiceMerchantsByIdIndividualByIndividualIdPersonalSummaryByPersonalSummaryIdData, - PutApiCrmServiceMerchantsByIdOrganizationsByOrganizationIdData, - PutApiCrmServiceMerchantsByIdTelephonesByTelephoneIdData, - PutApiCrmServiceRefundPointsByIdEmailsByEmailIdData, - PutApiCrmServiceRefundPointsByIdOrganizationsByOrganizationIdData, - PutApiCrmServiceRefundPointsByIdTelephonesByTelephoneIdData, - PutApiCrmServiceTaxFreesByIdEmailsByEmailIdData, - PutApiCrmServiceTaxFreesByIdOrganizationsByOrganizationIdData, - PutApiCrmServiceTaxFreesByIdTelephonesByTelephoneIdData, - PutApiCrmServiceTaxOfficesByIdEmailsByEmailIdData, - PutApiCrmServiceTaxOfficesByIdOrganizationsByOrganizationIdData, - PutApiCrmServiceTaxOfficesByIdTelephonesByTelephoneIdData, - UniRefund_CRMService_Customss_CustomsDto, - UniRefund_CRMService_Merchants_MerchantDto, - UniRefund_CRMService_RefundPoints_RefundPointDto, - UniRefund_CRMService_TaxFrees_TaxFreeDto, - UniRefund_CRMService_TaxOffices_TaxOfficeDto, -} from "@ayasofyazilim/saas/CRMService"; - -export type PutOrganization = - | { - action: "organization"; - data: PutApiCrmServiceMerchantsByIdOrganizationsByOrganizationIdData; - } - | { - action: "organization"; - data: PutApiCrmServiceCustomsByIdOrganizationsByOrganizationIdData; - } - | { - action: "organization"; - data: PutApiCrmServiceRefundPointsByIdOrganizationsByOrganizationIdData; - } - | { - action: "organization"; - data: PutApiCrmServiceTaxOfficesByIdOrganizationsByOrganizationIdData; - } - | { - action: "organization"; - data: PutApiCrmServiceTaxFreesByIdOrganizationsByOrganizationIdData; - }; - -export type PutTelephone = - | { - action: "telephone"; - data: PutApiCrmServiceMerchantsByIdTelephonesByTelephoneIdData; - } - | { - action: "telephone"; - data: PutApiCrmServiceTaxOfficesByIdTelephonesByTelephoneIdData; - } - | { - action: "telephone"; - data: PutApiCrmServiceTaxFreesByIdTelephonesByTelephoneIdData; - } - | { - action: "telephone"; - data: PutApiCrmServiceCustomsByIdTelephonesByTelephoneIdData; - } - | { - action: "telephone"; - data: PutApiCrmServiceRefundPointsByIdTelephonesByTelephoneIdData; - }; - -export interface PutAddress { - action: "address"; - data: PutApiCrmServiceCustomsByIdAddressesByAddressIdData; -} - -export type PutEmail = - | { - action: "email"; - data: PutApiCrmServiceMerchantsByIdEmailsByEmailIdData; - } - | { - action: "email"; - data: PutApiCrmServiceTaxOfficesByIdEmailsByEmailIdData; - } - | { - action: "email"; - data: PutApiCrmServiceTaxFreesByIdEmailsByEmailIdData; - } - | { - action: "email"; - data: PutApiCrmServiceCustomsByIdEmailsByEmailIdData; - } - | { - action: "email"; - data: PutApiCrmServiceRefundPointsByIdEmailsByEmailIdData; - }; - -export interface PutName { - action: "name"; - data: PutApiCrmServiceMerchantsByIdIndividualByIndividualIdNameByNameIdData; -} -export interface PutPersonalSummaries { - action: "personal-summaries"; - data: PutApiCrmServiceMerchantsByIdIndividualByIndividualIdPersonalSummaryByPersonalSummaryIdData; -} -export interface PutMerchantBase { - action: "merchant-base"; - data: PutApiCrmServiceMerchantsByIdData; -} - -export type GetPartiesDetailResult = - | UniRefund_CRMService_RefundPoints_RefundPointDto - | UniRefund_CRMService_Merchants_MerchantDto - | UniRefund_CRMService_Customss_CustomsDto - | UniRefund_CRMService_TaxFrees_TaxFreeDto - | UniRefund_CRMService_TaxOffices_TaxOfficeDto; - -export type PutMerchantOrganization = - PutApiCrmServiceMerchantsByIdOrganizationsByOrganizationIdData; -export type PutCustomsOrganization = - PutApiCrmServiceCustomsByIdOrganizationsByOrganizationIdData; -export type PutRefundPointOrganization = - PutApiCrmServiceRefundPointsByIdOrganizationsByOrganizationIdData; -export type PutTaxFreeOrganization = - PutApiCrmServiceTaxFreesByIdOrganizationsByOrganizationIdData; -export type PutTaxOfficeOrganization = - PutApiCrmServiceTaxOfficesByIdOrganizationsByOrganizationIdData; - -export type PutActions = "organization" | "telephone" | "address" | "email"; - -export type PartiesOrganizationUpdateType = - | typeof $UniRefund_CRMService_RefundPoints_UpdateRefundPointOrganizationDto - | typeof $UniRefund_CRMService_Customss_UpdateCustomsOrganizationDto - | typeof $UniRefund_CRMService_Organizations_UpdateOrganizationDto; - -export type PartiesTelephoneUpdateType = - typeof $UniRefund_CRMService_TelephoneTypes_UpdateTelephoneTypeDto; - -export type PartiesEmailUpdateType = - typeof $UniRefund_CRMService_EmailCommonDatas_UpdateEmailCommonDataDto; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/update-data.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/update-data.tsx deleted file mode 100644 index 7280f39c5..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/update-data.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import type { - UniRefund_CRMService_EmailCommonDatas_CreateEmailCommonDataWithComponentsDto, - UniRefund_CRMService_TelephoneTypes_CreateTelephoneTypeWithComponentsDto, -} from "@ayasofyazilim/saas/CRMService"; -import { - $UniRefund_CRMService_Customss_UpdateCustomsOrganizationDto, - $UniRefund_CRMService_Organizations_UpdateOrganizationDto, - $UniRefund_CRMService_RefundPoints_UpdateRefundPointOrganizationDto, -} from "@ayasofyazilim/saas/CRMService"; -import type { UniRefund_LocationService_AddressCommonDatas_AddressCommonDataCreateDto } from "@ayasofyazilim/saas/LocationService"; -import { - CustomsFormSubPositions, - MerchantsFormSubPositions, - RefundPointsFormSubPositions, - TaxFreeFormSubPositions, - TaxOfficesFormSubPositions, -} from "../../table-data"; -import type { PutOrganization } from "./types"; - -export interface UpdatePartiesDto { - taxOfficeId: string; - organizationSchema: PutOrganization; - telephone: UniRefund_CRMService_TelephoneTypes_CreateTelephoneTypeWithComponentsDto; - address: UniRefund_LocationService_AddressCommonDatas_AddressCommonDataCreateDto; - email: UniRefund_CRMService_EmailCommonDatas_CreateEmailCommonDataWithComponentsDto; -} - -export const editSchemasOfParties = { - merchants: { - organizationSchema: - $UniRefund_CRMService_Organizations_UpdateOrganizationDto, - organizationSchemaSubPositions: MerchantsFormSubPositions.organization, - }, - "refund-points": { - organizationSchema: - $UniRefund_CRMService_RefundPoints_UpdateRefundPointOrganizationDto, - organizationSchemaSubPositions: RefundPointsFormSubPositions.organization, - }, - customs: { - organizationSchema: - $UniRefund_CRMService_Customss_UpdateCustomsOrganizationDto, - organizationSchemaSubPositions: CustomsFormSubPositions.organization, - }, - "tax-free": { - organizationSchema: - $UniRefund_CRMService_Organizations_UpdateOrganizationDto, - organizationSchemaSubPositions: TaxFreeFormSubPositions.organization, - }, - "tax-offices": { - organizationSchema: - $UniRefund_CRMService_Organizations_UpdateOrganizationDto, - organizationSchemaSubPositions: TaxOfficesFormSubPositions.organization, - }, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/utils.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/utils.tsx deleted file mode 100644 index f05195748..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/[partyId]/utils.tsx +++ /dev/null @@ -1,36 +0,0 @@ -"use client"; - -import { toast } from "@/components/ui/sonner"; -import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import type { PartyNameType } from "../../types"; -import { putParty } from "./action"; -import type { - PutAddress, - PutEmail, - PutMerchantBase, - PutName, - PutOrganization, - PutPersonalSummaries, - PutTelephone, -} from "./types"; - -export async function handleUpdateSubmit( - partyName: Exclude, - putData: - | PutOrganization - | PutTelephone - | PutAddress - | PutEmail - | PutName - | PutPersonalSummaries - | PutMerchantBase, - router: AppRouterInstance, -) { - const response = await putParty(partyName, putData); - if (response.type === "success") { - toast.success("Updated successfully"); - router.refresh(); - } else { - toast.error(response.message); - } -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/action.ts b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/action.ts deleted file mode 100644 index d0f75180a..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/action.ts +++ /dev/null @@ -1,78 +0,0 @@ -"use server"; -import type { UniRefund_CRMService_Individuals_CreateIndividualDto } from "@ayasofyazilim/saas/CRMService"; -import { getCRMServiceClient, structuredError } from "src/lib"; -import type { - CreateCustomsDTO, - CreateMerchantDTO, - CreateRefundPointDTO, - CreateTaxFreeDTO, - CreateTaxOfficeDTO, - PartiesCreateDTOType, - PartyNameType, -} from "../types"; - -export async function getPartyRequests(partyType: PartyNameType) { - const client = await getCRMServiceClient(); - const partyRequests = { - merchants: { - post: async (data: PartiesCreateDTOType) => - await client.merchant.postApiCrmServiceMerchantsWithComponents({ - requestBody: data as CreateMerchantDTO, - }), - }, - "refund-points": { - post: async (data: PartiesCreateDTOType) => - await client.refundPoint.postApiCrmServiceRefundPointsWithComponents({ - requestBody: data as CreateRefundPointDTO, - }), - }, - customs: { - post: async (data: PartiesCreateDTOType) => - await client.customs.postApiCrmServiceCustomsWithComponents({ - requestBody: data as CreateCustomsDTO, - }), - }, - "tax-free": { - post: async (data: PartiesCreateDTOType) => - await client.taxFree.postApiCrmServiceTaxFreesWithComponents({ - requestBody: data as CreateTaxFreeDTO, - }), - }, - "tax-offices": { - post: async (data: PartiesCreateDTOType) => - await client.taxOffice.postApiCrmServiceTaxOfficesWithComponents({ - requestBody: data as CreateTaxOfficeDTO, - }), - }, - individuals: { - post: async ( - form: UniRefund_CRMService_Individuals_CreateIndividualDto, - ) => { - return await client.individual.postApiCrmServiceIndividualsWithComponents( - { - requestBody: form, - }, - ); - }, - }, - }; - return partyRequests[partyType]; -} - -export async function createPartyRow( - partyType: PartyNameType, - data: PartiesCreateDTOType, -) { - const client = await getPartyRequests(partyType); - try { - const response = await client.post(data); - return { - type: "success", - data: response, - status: 200, - message: "", - }; - } catch (error) { - return structuredError(error); - } -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/crm/individual/form.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/crm/individual/form.tsx deleted file mode 100644 index c7707dab2..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/crm/individual/form.tsx +++ /dev/null @@ -1,219 +0,0 @@ -"use client"; - -import { toast } from "@/components/ui/sonner"; -import type { UniRefund_CRMService_TaxOffices_TaxOfficeProfileDto } from "@ayasofyazilim/saas/CRMService"; -import { $UniRefund_CRMService_Merchants_CreateMerchantDto as CreateMerchantSchema } from "@ayasofyazilim/saas/CRMService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import type { AutoFormInputComponentProps } from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import AutoForm, { - AutoFormSubmit, - CustomCombobox, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { useRouter, useSearchParams } from "next/navigation"; -import type { - CountryDto, - SelectedAddressField, -} from "src/actions/unirefund/LocationService/types"; -import { useAddressHook } from "src/actions/unirefund/LocationService/use-address-hook.tsx"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import { getBaseLink } from "src/utils"; -import { isPhoneValid, splitPhone } from "src/utils/utils-phone"; -import type { CreatePartiesDto } from "../../../../table-data"; -import { dataConfigOfParties, localNumber } from "../../../../table-data"; -import type { CreateMerchantDTO } from "../../../../types"; -import { createPartyRow } from "../../../action"; - -function createScheme(schema: typeof CreateMerchantSchema) { - return { - type: "object", - properties: { - taxOfficeId: { - type: "string", - }, - name: schema.properties.entityInformationTypes.items.properties - .individuals.items.properties.name, - personalSummaries: - schema.properties.entityInformationTypes.items.properties.individuals - .items.properties.personalSummaries.items, - telephone: { - ...schema.properties.entityInformationTypes.items.properties.individuals - .items.properties.contactInformations.items.properties.telephones - .items, - properties: { - ...schema.properties.entityInformationTypes.items.properties - .individuals.items.properties.contactInformations.items.properties - .telephones.items.properties, - localNumber, - }, - }, - address: - schema.properties.entityInformationTypes.items.properties.individuals - .items.properties.contactInformations.items.properties.addresses - .items, - email: - schema.properties.entityInformationTypes.items.properties.individuals - .items.properties.contactInformations.items.properties.emails.items, - }, - }; -} - -export default function CrmIndividual({ - partyName, - taxOfficeList, - countryList, - languageData, -}: { - partyName: "merchants"; - taxOfficeList: UniRefund_CRMService_TaxOffices_TaxOfficeProfileDto[]; - countryList: CountryDto[]; - languageData: CRMServiceServiceResource; -}) { - const searchParams = useSearchParams(); - const parentId = searchParams.get("parentId"); - const router = useRouter(); - - const selectedFieldsDefaultValue: SelectedAddressField = { - countryId: "", - regionId: "", - cityId: "", - }; - - const { - selectedFields, - addressFieldsToShow, - addressSchemaFieldConfig, - onAddressValueChanged, - } = useAddressHook({ - countryList, - selectedFieldsDefaultValue, - fieldsToHideInAddressSchema: ["districtId"], - languageData, - }); - - function formSchemaByData() { - const config = dataConfigOfParties[partyName]; - const schema = createScheme(CreateMerchantSchema); - - return createZodObject( - schema, - [ - "name", - "personalSummaries", - "address", - "taxOfficeId", - "telephone", - "email", - ], - undefined, - { - ...config.createFormSchema.formSubPositions, - address: addressFieldsToShow, - }, - ); - } - - const schema = formSchemaByData(); - - const handleSave = async (formData: CreatePartiesDto) => { - const isValid = isPhoneValid(formData.telephone.localNumber); - if (!isValid) { - return; - } - const phoneData = splitPhone(formData.telephone.localNumber); - formData.telephone = { ...formData.telephone, ...phoneData }; - const createformData: CreateMerchantDTO = { - taxOfficeId: formData.taxOfficeId, - typeCode: parentId - ? dataConfigOfParties[partyName].subEntityType - : "HEADQUARTER", - parentId, - entityInformationTypes: [ - { - individuals: [ - { - name: formData.name, - personalSummaries: [formData.personalSummaries], - contactInformations: [ - { - telephones: [{ ...formData.telephone, primaryFlag: true }], - emails: [{ ...formData.email, primaryFlag: true }], - addresses: [ - { - ...formData.address, - ...selectedFields, - primaryFlag: true, - }, - ], - }, - ], - }, - ], - }, - ], - }; - - try { - const response = await createPartyRow(partyName, createformData); - if (response.status === 200) { - toast.success(`${partyName} added successfully`); - router.push(getBaseLink(`/parties/${partyName}`)); - } else { - toast.error(response.message || `Failed to add ${partyName}`); - } - } catch (error) { - toast.error(`An error occurred while saving the ${partyName}`); - } - }; - - return ( - { - return ( - - childrenProps={props} - list={taxOfficeList} - selectIdentifier="id" - selectLabel="name" - /> - ); - }, - }, - address: { ...addressSchemaFieldConfig, className: "row-span-2" }, - organization: { - className: "row-span-2", - }, - email: { - emailAddress: { - inputProps: { - type: "email", - }, - }, - }, - telephone: { - localNumber: { - fieldType: "phone", - displayName: languageData.Telephone, - inputProps: { - showLabel: true, - }, - }, - }, - }} - formClassName="pb-4" - formSchema={schema} - onSubmit={(val) => { - void handleSave(val as CreatePartiesDto); - }} - onValuesChange={(values) => { - onAddressValueChanged(values); - }} - > - - {languageData.Save} - - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/crm/organization/form.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/crm/organization/form.tsx deleted file mode 100644 index f62d4057e..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/crm/organization/form.tsx +++ /dev/null @@ -1,172 +0,0 @@ -"use client"; - -import { toast } from "@/components/ui/sonner"; -import type { UniRefund_CRMService_TaxOffices_TaxOfficeProfileDto } from "@ayasofyazilim/saas/CRMService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import type { AutoFormInputComponentProps } from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import AutoForm, { - AutoFormSubmit, - CustomCombobox, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { type TableData } from "@repo/ui/utils/table/table-utils"; -import { useRouter, useSearchParams } from "next/navigation"; -import { useState } from "react"; -import type { - CountryDto, - SelectedAddressField, -} from "src/actions/unirefund/LocationService/types"; -import { useAddressHook } from "src/actions/unirefund/LocationService/use-address-hook.tsx"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import { getBaseLink } from "src/utils"; -import { isPhoneValid, splitPhone } from "src/utils/utils-phone"; -import type { CreatePartiesDto } from "../../../../table-data"; -import { dataConfigOfParties } from "../../../../table-data"; -import type { PartiesCreateDTOType, PartyNameType } from "../../../../types"; -import { createPartyRow } from "../../../action"; - -export default function CrmOrganization({ - partyName, - taxOfficeList, - countryList, - languageData, -}: { - partyName: Exclude; - taxOfficeList: UniRefund_CRMService_TaxOffices_TaxOfficeProfileDto[]; - countryList: CountryDto[]; - languageData: CRMServiceServiceResource; -}) { - const searchParams = useSearchParams(); - const parentId = searchParams.get("parentId"); - const router = useRouter(); - const [_formData] = useState(dataConfigOfParties[partyName]); - - const selectedFieldsDefaultValue: SelectedAddressField = { - countryId: "", - regionId: "", - cityId: "", - }; - - const { - selectedFields, - addressFieldsToShow, - addressSchemaFieldConfig, - onAddressValueChanged, - } = useAddressHook({ - countryList, - selectedFieldsDefaultValue, - fieldsToHideInAddressSchema: ["districtId"], - languageData, - }); - - function formSchemaByData() { - const config = dataConfigOfParties[partyName]; - - return createZodObject( - config.createFormSchema.schema, - config.createFormSchema.formPositions, - undefined, - { - ...config.createFormSchema.formSubPositions, - address: addressFieldsToShow, - }, - ); - } - - const handleSave = async (formData: CreatePartiesDto) => { - const isValid = isPhoneValid(formData.telephone.localNumber); - if (!isValid) { - return; - } - const phoneData = splitPhone(formData.telephone.localNumber); - formData.telephone = { ...formData.telephone, ...phoneData }; - const createformData: PartiesCreateDTOType = { - taxOfficeId: formData.taxOfficeId, - typeCode: parentId - ? dataConfigOfParties[partyName].subEntityType - : "HEADQUARTER", - parentId, - entityInformationTypes: [ - { - organizations: [ - { - ...formData.organization, - contactInformations: [ - { - telephones: [{ ...formData.telephone, primaryFlag: true }], - emails: [{ ...formData.email, primaryFlag: true }], - addresses: [ - { - ...formData.address, - ...selectedFields, - primaryFlag: true, - }, - ], - }, - ], - }, - ], - }, - ], - }; - - const response = await createPartyRow(partyName, createformData); - if (response.status === 200) { - toast.success(`${partyName} added successfully`); - router.push(getBaseLink(`/parties/${partyName}`)); - } else { - toast.error(response.message || `Failed to add ${partyName}`); - } - }; - - return ( - { - return ( - - childrenProps={props} - list={taxOfficeList} - selectIdentifier="id" - selectLabel="name" - /> - ); - }, - }, - address: { ...addressSchemaFieldConfig, className: "row-span-2" }, - organization: { - className: "row-span-2", - }, - email: { - emailAddress: { - inputProps: { - type: "email", - }, - }, - }, - telephone: { - localNumber: { - fieldType: "phone", - displayName: languageData.Telephone, - inputProps: { - showLabel: true, - }, - }, - }, - }} - formClassName="pb-4" - formSchema={formSchemaByData()} - onSubmit={(val) => { - void handleSave(val as CreatePartiesDto); - }} - onValuesChange={(values) => { - onAddressValueChanged(values); - }} - > - - {languageData.Save} - - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/individual/form.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/individual/form.tsx deleted file mode 100644 index 32e4a1e0f..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/individual/form.tsx +++ /dev/null @@ -1,176 +0,0 @@ -"use client"; - -import { toast } from "@/components/ui/sonner"; -import { $UniRefund_CRMService_Merchants_CreateMerchantDto as CreateMerchantSchema } from "@ayasofyazilim/saas/CRMService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import AutoForm, { - AutoFormSubmit, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { ContactFormSubPositions } from "@repo/ui/utils/table/form-schemas"; -import { useRouter } from "next/navigation"; -import type { - CountryDto, - SelectedAddressField, -} from "src/actions/unirefund/LocationService/types"; -import { useAddressHook } from "src/actions/unirefund/LocationService/use-address-hook.tsx"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import { getBaseLink } from "src/utils"; -import { isPhoneValid, splitPhone } from "src/utils/utils-phone"; -import type { CreatePartiesDto } from "../../../table-data"; -import { dataConfigOfParties, localNumber } from "../../../table-data"; -import type { CreateIndividualDTO } from "../../../types"; -import { createPartyRow } from "../../action"; - -function createScheme(schema: typeof CreateMerchantSchema) { - return { - type: "object", - properties: { - name: schema.properties.entityInformationTypes.items.properties - .individuals.items.properties.name, - personalSummaries: - schema.properties.entityInformationTypes.items.properties.individuals - .items.properties.personalSummaries.items, - telephone: { - ...schema.properties.entityInformationTypes.items.properties.individuals - .items.properties.contactInformations.items.properties.telephones - .items, - properties: { - ...schema.properties.entityInformationTypes.items.properties - .individuals.items.properties.contactInformations.items.properties - .telephones.items.properties, - localNumber, - }, - }, - address: - schema.properties.entityInformationTypes.items.properties.individuals - .items.properties.contactInformations.items.properties.addresses - .items, - email: - schema.properties.entityInformationTypes.items.properties.individuals - .items.properties.contactInformations.items.properties.emails.items, - }, - }; -} - -export default function Individual({ - partyName, - countryList, - languageData, -}: { - partyName: "individuals"; - countryList: CountryDto[]; - languageData: CRMServiceServiceResource; -}) { - const router = useRouter(); - const selectedFieldsDefaultValue: SelectedAddressField = { - countryId: "", - regionId: "", - cityId: "", - }; - - const { - selectedFields, - addressFieldsToShow, - addressSchemaFieldConfig, - onAddressValueChanged, - } = useAddressHook({ - countryList, - selectedFieldsDefaultValue, - fieldsToHideInAddressSchema: ["districtId"], - languageData, - }); - function formSchemaByData() { - const config = dataConfigOfParties[partyName]; - const schema = createScheme(CreateMerchantSchema); - - const formSubPositions = { - ...config.createFormSchema.formSubPositions, - telephone: ContactFormSubPositions.telephone, - email: ContactFormSubPositions.email, - address: addressFieldsToShow, - }; - return createZodObject( - schema, - ["name", "personalSummaries", "address", "telephone", "email"], - undefined, - formSubPositions, - ); - } - - const schema = formSchemaByData(); - - const handleSave = async (formData: CreatePartiesDto) => { - const isValid = isPhoneValid(formData.telephone.localNumber); - if (!isValid) { - return; - } - const phoneData = splitPhone(formData.telephone.localNumber); - formData.telephone = { ...formData.telephone, ...phoneData }; - const createformData: CreateIndividualDTO = { - name: formData.name, - personalSummaries: [formData.personalSummaries], - contactInformations: [ - { - telephones: [{ ...formData.telephone, primaryFlag: true }], - emails: [{ ...formData.email, primaryFlag: true }], - addresses: [ - { - ...formData.address, - ...selectedFields, - primaryFlag: true, - }, - ], - }, - ], - }; - - try { - const response = await createPartyRow(partyName, createformData); - if (response.status === 200) { - toast.success(`${partyName} added successfully`); - router.push(getBaseLink(`/parties/${partyName}`)); - } else { - toast.error(response.message || `Failed to add ${partyName}`); - } - } catch (error) { - toast.error(`An error occurred while saving the ${partyName}`); - } - }; - - return ( - { - void handleSave(val as CreatePartiesDto); - }} - onValuesChange={(values) => { - onAddressValueChanged(values); - }} - > - - {languageData.Save} - - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/page-client.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/page-client.tsx deleted file mode 100644 index 30d04add9..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/page-client.tsx +++ /dev/null @@ -1,90 +0,0 @@ -"use client"; - -import SelectTabs, { - SelectTabsContent, -} from "@repo/ayasofyazilim-ui/molecules/select-tabs"; -import { Building2, User } from "lucide-react"; -import { useState } from "react"; -import type { UniRefund_CRMService_TaxOffices_TaxOfficeProfileDto } from "@ayasofyazilim/saas/CRMService"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import type { CountryDto } from "src/actions/unirefund/LocationService/types"; -import type { PartyNameType } from "../../types"; -import CrmIndividual from "./crm/individual/form"; -import CrmOrganization from "./crm/organization/form"; -import Individual from "./individual/form"; - -type TabSection = "Organization" | "Individual"; -export default function PageClientSide({ - partyName, - taxOfficeList, - countryList, - languageData, -}: { - partyName: PartyNameType; - taxOfficeList: UniRefund_CRMService_TaxOffices_TaxOfficeProfileDto[]; - countryList: CountryDto[]; - languageData: CRMServiceServiceResource; -}) { - const [activeTab, setActiveTab] = useState("Organization"); - - if (partyName === "individuals") { - return ( - - ); - } - - if (partyName !== "merchants") { - return ( - - ); - } - return ( - <> -
- { - setActiveTab(value as TabSection); - }} - value={activeTab} - > - -
- - Organization -
-
- -
- - Individual -
-
-
-
- {activeTab === "Organization" ? ( - - ) : ( - - )} - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/page.tsx deleted file mode 100644 index 2659eacae..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/[partyName]/new/page.tsx +++ /dev/null @@ -1,35 +0,0 @@ -"use server"; - -import { getTaxOfficesApi } from "src/actions/unirefund/CrmService/actions"; -import { getResourceData } from "src/language-data/unirefund/CRMService"; -import { getCountriesApi } from "../../../../../../actions/unirefund/LocationService/actions"; -import type { PartyNameType } from "../../types"; -import PageClientSide from "./page-client"; - -export default async function Page({ - params, -}: { - params: { - partyName: Exclude; - lang: string; - }; -}) { - const { languageData } = await getResourceData(params.lang); - - const countries = await getCountriesApi(); - const countryList = - (countries.type === "success" && countries.data.items) || []; - - const taxOffices = await getTaxOfficesApi(); - const taxOfficeList = - (taxOffices.type === "success" && taxOffices.data.items) || []; - - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/customs/customs-table-data.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/customs/customs-table-data.tsx deleted file mode 100644 index 9a04a9636..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/customs/customs-table-data.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import type { UniRefund_CRMService_Customss_CustomsProfileDto } from "@ayasofyazilim/saas/CRMService"; -import { $UniRefund_CRMService_Customss_CustomsProfileDto } from "@ayasofyazilim/saas/CRMService"; -import type { - TanstackTableColumnLink, - TanstackTableCreationProps, - TanstackTableTableActionsType, -} from "@repo/ayasofyazilim-ui/molecules/tanstack-table/types"; -import { tanstackTableCreateColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; -import { PlusCircle } from "lucide-react"; -import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import isActionGranted from "src/utils/page-policy/action-policy"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import type { Policy } from "src/utils/page-policy/utils"; - -type CustomsTable = - TanstackTableCreationProps; - -const links: Partial< - Record< - keyof UniRefund_CRMService_Customss_CustomsProfileDto, - TanstackTableColumnLink - > -> = {}; - -function customsTableActions( - languageData: CRMServiceServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, -) { - const actions: TanstackTableTableActionsType[] = []; - if (isActionGranted(["CRMService.Customs.Create"], grantedPolicies)) { - actions.push({ - type: "simple", - actionLocation: "table", - cta: languageData.New, - icon: PlusCircle, - onClick() { - router.push("customs/new"); - }, - }); - } - return actions; -} -function customsColumns( - locale: string, - languageData: CRMServiceServiceResource, - grantedPolicies: Record, -) { - if (isActionGranted(["CRMService.Customs.Edit"], grantedPolicies)) { - links.name = { - prefix: "/parties/customs", - targetAccessorKey: "id", - }; - } - return tanstackTableCreateColumnsByRowData( - { - rows: $UniRefund_CRMService_Customss_CustomsProfileDto.properties, - languageData: { - name: languageData.Name, - }, - config: { - locale, - }, - links, - }, - ); -} -function customsTable( - languageData: CRMServiceServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, -) { - const table: CustomsTable = { - fillerColumn: "name", - columnVisibility: { - type: "hide", - columns: ["id", "organizationId", "parentId"], - }, - tableActions: customsTableActions(languageData, router, grantedPolicies), - columnOrder: ["name"], - filters: { - textFilters: ["name"], - }, - }; - return table; -} - -export const tableData = { - customs: { - columns: customsColumns, - table: customsTable, - }, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/customs/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/customs/page.tsx deleted file mode 100644 index 6d103c02b..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/customs/page.tsx +++ /dev/null @@ -1,37 +0,0 @@ -"use server"; - -import type { GetApiCrmServiceCustomsData } from "@ayasofyazilim/saas/CRMService"; -import { notFound } from "next/navigation"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/CRMService"; -import { getCustomsApi } from "src/actions/unirefund/CrmService/actions"; -import CustomsTable from "./table"; - -interface SearchParamType { - maxResultCount?: number; - skipCount?: number; - sorting?: string; - name?: string; -} - -export default async function Page(props: { - params: { lang: string }; - searchParams?: Promise; -}) { - await isUnauthorized({ - requiredPolicies: ["CRMService.Customs"], - lang: props.params.lang, - }); - - const searchParams = await props.searchParams; - const response = await getCustomsApi({ - name: searchParams?.name || "", - maxResultCount: searchParams?.maxResultCount || 10, - skipCount: searchParams?.skipCount || 0, - } as GetApiCrmServiceCustomsData); - - if (response.type !== "success") return notFound(); - - const { languageData } = await getResourceData(props.params.lang); - return ; -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/customs/table.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/customs/table.tsx deleted file mode 100644 index 61171c769..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/customs/table.tsx +++ /dev/null @@ -1,37 +0,0 @@ -"use client"; - -import type { PagedResultDto_CustomsProfileDto } from "@ayasofyazilim/saas/CRMService"; -import TanstackTable from "@repo/ayasofyazilim-ui/molecules/tanstack-table"; -import { useParams, useRouter } from "next/navigation"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import useGrantedPolicies from "src/hooks/use-granted-policies"; -import { tableData } from "./customs-table-data"; - -function CustomsTable({ - response, - languageData, -}: { - response: PagedResultDto_CustomsProfileDto; - languageData: CRMServiceServiceResource; -}) { - const grantedPolicies = useGrantedPolicies(); - const router = useRouter(); - const { lang } = useParams<{ lang: string }>(); - const columns = tableData.customs.columns( - lang, - languageData, - grantedPolicies, - ); - const table = tableData.customs.table(languageData, router, grantedPolicies); - - return ( - - ); -} - -export default CustomsTable; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/individuals/individuals-table-data.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/individuals/individuals-table-data.tsx deleted file mode 100644 index 415a4585c..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/individuals/individuals-table-data.tsx +++ /dev/null @@ -1,125 +0,0 @@ -"use client"; -import type { UniRefund_CRMService_Individuals_IndividualProfileDto } from "@ayasofyazilim/saas/CRMService"; -import { $UniRefund_CRMService_Individuals_IndividualProfileDto } from "@ayasofyazilim/saas/CRMService"; -import type { - TanstackTableColumnLink, - TanstackTableCreationProps, - TanstackTableTableActionsType, -} from "@repo/ayasofyazilim-ui/molecules/tanstack-table/types"; -import { tanstackTableCreateColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; -import { PlusCircle } from "lucide-react"; -import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import isActionGranted from "src/utils/page-policy/action-policy"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import type { Policy } from "src/utils/page-policy/utils"; - -const affiliationTypes = [ - "COFOUNDER", - "PARTNER", - "ABPUSER", - "SUBCOMPANY", - "ACCOUNTMANAGER", - "Franchise", -]; - -const entityPartyTypeCode = [ - "CUSTOMS", - "MERCHANT", - "REFUNDPOINT", - "TAXFREE", - "TAXOFFICE", -]; -type IndividualTable = - TanstackTableCreationProps; - -const links: Partial< - Record< - keyof UniRefund_CRMService_Individuals_IndividualProfileDto, - TanstackTableColumnLink - > -> = {}; -function individualsTableActions( - languageData: CRMServiceServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, -) { - const actions: TanstackTableTableActionsType[] = []; - if (isActionGranted(["CRMService.Individuals.Create"], grantedPolicies)) { - actions.push({ - type: "simple", - actionLocation: "table", - cta: languageData.New, - icon: PlusCircle, - onClick() { - router.push("individuals/new"); - }, - }); - } - return actions; -} - -function individualColumns( - locale: string, - languageData: CRMServiceServiceResource, - grantedPolicies: Record, -) { - if (isActionGranted(["CRMService.Individuals.Edit"], grantedPolicies)) { - links.name = { - prefix: "/parties/individuals", - targetAccessorKey: "id", - }; - } - - return tanstackTableCreateColumnsByRowData( - { - rows: $UniRefund_CRMService_Individuals_IndividualProfileDto.properties, - languageData: { - name: languageData.Name, - }, - config: { - locale, - }, - // links: links, - }, - ); -} -function individualTable( - languageData: CRMServiceServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, -) { - const table: IndividualTable = { - fillerColumn: "name", - columnVisibility: { - type: "hide", - columns: ["id", "affiliationId"], - }, - columnOrder: ["name"], - tableActions: individualsTableActions( - languageData, - router, - grantedPolicies, - ), - filters: { - textFilters: ["name", "email", "telephone"], - facetedFilters: { - affiliationType: { - title: "Type", - options: affiliationTypes.map((x) => ({ label: x, value: x })), - }, - entityPartyTypeCode: { - title: "Entity Type", - options: entityPartyTypeCode.map((x) => ({ label: x, value: x })), - }, - }, - }, - }; - return table; -} - -export const tableData = { - individuals: { - columns: individualColumns, - table: individualTable, - }, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/individuals/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/individuals/page.tsx deleted file mode 100644 index 3845d0b37..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/individuals/page.tsx +++ /dev/null @@ -1,41 +0,0 @@ -"use server"; - -import type { GetApiCrmServiceIndividualsData } from "@ayasofyazilim/saas/CRMService"; -import { notFound } from "next/navigation"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/CRMService"; -import { getIndividualsApi } from "src/actions/unirefund/CrmService/actions"; -import IndividualsTable from "./table"; - -interface SearchParamType { - ids?: string; - name?: string; - maxResultCount?: number; - skipCount?: number; - sorting?: string; - typeCode?: string; - entityPartyTypeCode?: string; -} - -export default async function Page(props: { - params: { lang: string }; - searchParams?: Promise; -}) { - await isUnauthorized({ - requiredPolicies: ["CRMService.Merchants"], - lang: props.params.lang, - }); - - const searchParams = await props.searchParams; - const response = await getIndividualsApi({ - ...searchParams, - typeCodes: searchParams?.typeCode?.split(",") || [], - } as GetApiCrmServiceIndividualsData); - - if (response.type !== "success") return notFound(); - - const { languageData } = await getResourceData(props.params.lang); - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/individuals/table.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/individuals/table.tsx deleted file mode 100644 index d627df36b..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/individuals/table.tsx +++ /dev/null @@ -1,41 +0,0 @@ -"use client"; - -import type { GetApiCrmServiceIndividualsResponse } from "@ayasofyazilim/saas/CRMService"; -import TanstackTable from "@repo/ayasofyazilim-ui/molecules/tanstack-table"; -import { useParams, useRouter } from "next/navigation"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import useGrantedPolicies from "src/hooks/use-granted-policies"; -import { tableData } from "./individuals-table-data"; - -function IndividualsTable({ - response, - languageData, -}: { - response: GetApiCrmServiceIndividualsResponse; - languageData: CRMServiceServiceResource; -}) { - const grantedPolicies = useGrantedPolicies(); - const router = useRouter(); - const { lang } = useParams<{ lang: string }>(); - const columns = tableData.individuals.columns( - lang, - languageData, - grantedPolicies, - ); - const table = tableData.individuals.table( - languageData, - router, - grantedPolicies, - ); - - return ( - - ); -} - -export default IndividualsTable; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/merchants/merchant-table-data.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/merchants/merchant-table-data.tsx deleted file mode 100644 index a2fd22142..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/merchants/merchant-table-data.tsx +++ /dev/null @@ -1,140 +0,0 @@ -"use client"; -import type { UniRefund_CRMService_Merchants_MerchantProfileDto } from "@ayasofyazilim/saas/CRMService"; -import { $UniRefund_CRMService_Merchants_MerchantProfileDto } from "@ayasofyazilim/saas/CRMService"; -import type { - TanstackTableColumnLink, - TanstackTableCreationProps, - TanstackTableTableActionsType, -} from "@repo/ayasofyazilim-ui/molecules/tanstack-table/types"; -import { tanstackTableCreateColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; -import { Building2, PlusCircle, Store } from "lucide-react"; -import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import isActionGranted from "src/utils/page-policy/action-policy"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import type { Policy } from "src/utils/page-policy/utils"; - -type MerchantTable = - TanstackTableCreationProps; - -const links: Partial< - Record< - keyof UniRefund_CRMService_Merchants_MerchantProfileDto, - TanstackTableColumnLink - > -> = {}; - -function merchantTableActions( - languageData: CRMServiceServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, -) { - const actions: TanstackTableTableActionsType[] = []; - if (isActionGranted(["CRMService.Merchants.Create"], grantedPolicies)) { - actions.push({ - type: "simple", - actionLocation: "table", - cta: languageData.New, - icon: PlusCircle, - onClick() { - router.push("merchants/new"); - }, - }); - } - return actions; -} - -function merchantColumns( - locale: string, - languageData: CRMServiceServiceResource, - grantedPolicies: Record, -) { - if (isActionGranted(["CRMService.Merchants.Edit"], grantedPolicies)) { - links.name = { - prefix: "/parties/merchants", - targetAccessorKey: "id", - }; - - links.parentName = { - prefix: "/parties/merchants", - targetAccessorKey: "parentId", - }; - } - - return tanstackTableCreateColumnsByRowData( - { - rows: $UniRefund_CRMService_Merchants_MerchantProfileDto.properties, - languageData: { - name: languageData.Name, - }, - config: { - locale, - }, - links, - faceted: { - typeCode: { - options: [ - { - value: "HEADQUARTER", - label: "Headquarter", - icon: Building2, - }, - { - value: "STORE", - label: "Store", - icon: Store, - }, - ], - }, - }, - }, - ); -} - -function merchantTable( - languageData: CRMServiceServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, -) { - const table: MerchantTable = { - fillerColumn: "name", - columnVisibility: { - type: "hide", - columns: ["id", "organizationId", "individualId", "parentId"], - }, - columnOrder: [ - "name", - "parentName", - "typeCode", - "entityInformationTypeCode", - ], - tableActions: merchantTableActions(languageData, router, grantedPolicies), - filters: { - textFilters: ["name"], - facetedFilters: { - typeCode: { - title: "Type", - options: [ - { - label: "Headquarter", - value: "HEADQUARTER", - icon: Building2, - }, - { - label: "Store", - value: "STORE", - icon: Store, - }, - ], - }, - }, - }, - }; - return table; -} - -export const tableData = { - merchants: { - columns: merchantColumns, - table: merchantTable, - }, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/merchants/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/merchants/page.tsx deleted file mode 100644 index f9153bb4b..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/merchants/page.tsx +++ /dev/null @@ -1,42 +0,0 @@ -"use server"; - -import type { GetApiCrmServiceMerchantsData } from "@ayasofyazilim/saas/CRMService"; -import { notFound } from "next/navigation"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/CRMService"; -import { getMerchantsApi } from "src/actions/unirefund/CrmService/actions"; -import MerchantsTable from "./table"; - -interface SearchParamType { - ids?: string; - name?: string; - maxResultCount?: number; - skipCount?: number; - sorting?: string; - typeCode?: string; -} - -export default async function Page(props: { - params: { lang: string }; - searchParams?: Promise; -}) { - await isUnauthorized({ - requiredPolicies: ["CRMService.Merchants"], - lang: props.params.lang, - }); - - const searchParams = await props.searchParams; - const response = await getMerchantsApi({ - typeCodes: searchParams?.typeCode?.split(",") || [], - name: searchParams?.name || "", - maxResultCount: searchParams?.maxResultCount || 10, - skipCount: searchParams?.skipCount || 0, - } as GetApiCrmServiceMerchantsData); - - if (response.type !== "success") return notFound(); - - const { languageData } = await getResourceData(props.params.lang); - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/merchants/table.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/merchants/table.tsx deleted file mode 100644 index 639657c1c..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/merchants/table.tsx +++ /dev/null @@ -1,41 +0,0 @@ -"use client"; - -import type { PagedResultDto_MerchantProfileDto } from "@ayasofyazilim/saas/CRMService"; -import TanstackTable from "@repo/ayasofyazilim-ui/molecules/tanstack-table"; -import { useParams, useRouter } from "next/navigation"; -import useGrantedPolicies from "src/hooks/use-granted-policies"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import { tableData } from "./merchant-table-data"; - -function MerchantsTable({ - response, - languageData, -}: { - response: PagedResultDto_MerchantProfileDto; - languageData: CRMServiceServiceResource; -}) { - const grantedPolicies = useGrantedPolicies(); - const router = useRouter(); - const { lang } = useParams<{ lang: string }>(); - const columns = tableData.merchants.columns( - lang, - languageData, - grantedPolicies, - ); - const table = tableData.merchants.table( - languageData, - router, - grantedPolicies, - ); - - return ( - - ); -} - -export default MerchantsTable; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/refund-points/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/refund-points/page.tsx deleted file mode 100644 index 6938e6131..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/refund-points/page.tsx +++ /dev/null @@ -1,39 +0,0 @@ -"use server"; - -import type { GetApiCrmServiceRefundPointsData } from "@ayasofyazilim/saas/CRMService"; -import { notFound } from "next/navigation"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/CRMService"; -import { getRefundPointsApi } from "src/actions/unirefund/CrmService/actions"; -import RefundPointsTable from "./table"; - -interface SearchParamType { - maxResultCount?: number; - skipCount?: number; - sorting?: string; - name?: string; -} - -export default async function Page(props: { - params: { lang: string }; - searchParams?: Promise; -}) { - await isUnauthorized({ - requiredPolicies: ["CRMService.RefundPoints"], - lang: props.params.lang, - }); - - const searchParams = await props.searchParams; - const response = await getRefundPointsApi({ - name: searchParams?.name || "", - maxResultCount: searchParams?.maxResultCount || 10, - skipCount: searchParams?.skipCount || 0, - } as GetApiCrmServiceRefundPointsData); - - if (response.type !== "success") return notFound(); - - const { languageData } = await getResourceData(props.params.lang); - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/refund-points/refund-points-table-data.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/refund-points/refund-points-table-data.tsx deleted file mode 100644 index f893d0663..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/refund-points/refund-points-table-data.tsx +++ /dev/null @@ -1,98 +0,0 @@ -import type { UniRefund_CRMService_Merchants_RefundPointProfileDto } from "@ayasofyazilim/saas/CRMService"; -import { $UniRefund_CRMService_Merchants_RefundPointProfileDto } from "@ayasofyazilim/saas/CRMService"; -import type { - TanstackTableColumnLink, - TanstackTableCreationProps, - TanstackTableTableActionsType, -} from "@repo/ayasofyazilim-ui/molecules/tanstack-table/types"; -import { tanstackTableCreateColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; -import { PlusCircle } from "lucide-react"; -import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import isActionGranted from "src/utils/page-policy/action-policy"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import type { Policy } from "src/utils/page-policy/utils"; - -type RefundPointsTable = - TanstackTableCreationProps; - -const links: Partial< - Record< - keyof UniRefund_CRMService_Merchants_RefundPointProfileDto, - TanstackTableColumnLink - > -> = {}; - -function refundPointsTableActions( - languageData: CRMServiceServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, -) { - const actions: TanstackTableTableActionsType[] = []; - if (isActionGranted(["CRMService.RefundPoints.Create"], grantedPolicies)) { - actions.push({ - type: "simple", - actionLocation: "table", - cta: languageData.New, - icon: PlusCircle, - onClick() { - router.push("refund-points/new"); - }, - }); - } - return actions; -} - -function refundPointsColumns( - locale: string, - languageData: CRMServiceServiceResource, - grantedPolicies: Record, -) { - if (isActionGranted(["CRMService.RefundPoints.Edit"], grantedPolicies)) { - links.name = { - prefix: "/parties/refund-points", - targetAccessorKey: "id", - }; - } - return tanstackTableCreateColumnsByRowData( - { - rows: $UniRefund_CRMService_Merchants_RefundPointProfileDto.properties, - languageData: { - name: languageData.Name, - }, - config: { - locale, - }, - links, - }, - ); -} -function refundPointsTable( - languageData: CRMServiceServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, -) { - const table: RefundPointsTable = { - fillerColumn: "name", - columnVisibility: { - type: "hide", - columns: ["id", "organizationId", "parentId"], - }, - tableActions: refundPointsTableActions( - languageData, - router, - grantedPolicies, - ), - columnOrder: ["name"], - filters: { - textFilters: ["name"], - }, - }; - return table; -} - -export const tableData = { - refundPoints: { - columns: refundPointsColumns, - table: refundPointsTable, - }, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/refund-points/table.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/refund-points/table.tsx deleted file mode 100644 index 037a46efd..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/refund-points/table.tsx +++ /dev/null @@ -1,41 +0,0 @@ -"use client"; - -import type { PagedResultDto_RefundPointProfileDto } from "@ayasofyazilim/saas/CRMService"; -import TanstackTable from "@repo/ayasofyazilim-ui/molecules/tanstack-table"; -import { useParams, useRouter } from "next/navigation"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import useGrantedPolicies from "src/hooks/use-granted-policies"; -import { tableData } from "./refund-points-table-data"; - -function RefundPointsTable({ - response, - languageData, -}: { - response: PagedResultDto_RefundPointProfileDto; - languageData: CRMServiceServiceResource; -}) { - const grantedPolicies = useGrantedPolicies(); - const router = useRouter(); - const { lang } = useParams<{ lang: string }>(); - const columns = tableData.refundPoints.columns( - lang, - languageData, - grantedPolicies, - ); - const table = tableData.refundPoints.table( - languageData, - router, - grantedPolicies, - ); - - return ( - - ); -} - -export default RefundPointsTable; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/table-data.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/table-data.tsx deleted file mode 100644 index 16c5cbb3b..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/table-data.tsx +++ /dev/null @@ -1,261 +0,0 @@ -import type { UniRefund_LocationService_AddressCommonDatas_AddressCommonDataCreateDto } from "@ayasofyazilim/saas/LocationService"; -import type { - UniRefund_CRMService_Customss_CreateCustomsOrganizationDto, - UniRefund_CRMService_EmailCommonDatas_CreateEmailCommonDataWithComponentsDto, - UniRefund_CRMService_Merchants_CreateMerchantOrgnaizationDto, - UniRefund_CRMService_NameCommonDatas_CreateNameCommonDataDto, - UniRefund_CRMService_PersonalSummaries_CreatePersonalSummaryDto, - UniRefund_CRMService_RefundPoints_CreateRefundPointOrganizationDto, - UniRefund_CRMService_TaxFrees_CreateTaxFreeOrganizationDto, - UniRefund_CRMService_TaxOffices_CreateTaxOfficeOrganizationDto, - UniRefund_CRMService_TelephoneTypes_CreateTelephoneTypeWithComponentsDto, -} from "@ayasofyazilim/saas/CRMService"; -import { - $UniRefund_CRMService_Customss_CustomsProfileDto, - $UniRefund_CRMService_Individuals_IndividualProfileDto, - $UniRefund_CRMService_Merchants_MerchantProfileDto, - $UniRefund_CRMService_Merchants_RefundPointProfileDto, - $UniRefund_CRMService_TaxFrees_TaxFreeProfileDto, - $UniRefund_CRMService_TaxOffices_TaxOfficeProfileDto, - $UniRefund_CRMService_Customss_CreateCustomsDto as CreateCustomsSchema, - $UniRefund_CRMService_Merchants_CreateMerchantDto as CreateMerchantSchema, - $UniRefund_CRMService_RefundPoints_CreateRefundPointDto as CreateRefundPointSchema, - $UniRefund_CRMService_TaxFrees_CreateTaxFreeDto as CreateTaxFreeSchema, - $UniRefund_CRMService_TaxOffices_CreateTaxOfficeDto as CreateTaxOfficeSchema, -} from "@ayasofyazilim/saas/CRMService"; -import { ContactFormSubPositions } from "@repo/ui/utils/table/form-schemas"; -import { PhoneNumberUtil } from "google-libphonenumber"; -import type { PartiesCreateType } from "./types"; - -export interface CreatePartiesDto { - taxOfficeId: string; - organization: - | UniRefund_CRMService_Merchants_CreateMerchantOrgnaizationDto - | UniRefund_CRMService_Customss_CreateCustomsOrganizationDto - | UniRefund_CRMService_RefundPoints_CreateRefundPointOrganizationDto - | UniRefund_CRMService_TaxFrees_CreateTaxFreeOrganizationDto - | UniRefund_CRMService_TaxOffices_CreateTaxOfficeOrganizationDto; - name: UniRefund_CRMService_NameCommonDatas_CreateNameCommonDataDto; - personalSummaries: UniRefund_CRMService_PersonalSummaries_CreatePersonalSummaryDto; - telephone: UniRefund_CRMService_TelephoneTypes_CreateTelephoneTypeWithComponentsDto; - address: UniRefund_LocationService_AddressCommonDatas_AddressCommonDataCreateDto; - email: UniRefund_CRMService_EmailCommonDatas_CreateEmailCommonDataWithComponentsDto; -} - -const CommonOrganizationFields = ["name", "taxpayerId", "branchId"]; -const OrganizationFields = ["customerNumber", "legalStatusCode"]; -export const MerchantsFormSubPositions = { - organization: [...CommonOrganizationFields, ...OrganizationFields], - ...ContactFormSubPositions, -}; -export const RefundPointsFormSubPositions = { - organization: [...CommonOrganizationFields], - ...ContactFormSubPositions, -}; -export const CustomsFormSubPositions = { - organization: [...CommonOrganizationFields], - ...ContactFormSubPositions, -}; -export const TaxFreeFormSubPositions = { - organization: [...CommonOrganizationFields, ...OrganizationFields], - ...ContactFormSubPositions, -}; -export const TaxOfficesFormSubPositions = { - organization: [...CommonOrganizationFields, ...OrganizationFields], - ...ContactFormSubPositions, -}; - -export const localNumber = { - type: "string", - refine: { - params: { - message: "Please enter a valid phone number.", - }, - callback: (value: string) => { - try { - const phoneUtil = PhoneNumberUtil.getInstance(); - return phoneUtil.isValidNumber(phoneUtil.parseAndKeepRawInput(value)); - } catch (error) { - return false; - } - }, - }, -}; - -function createScheme(schema: PartiesCreateType) { - if (!("entityInformationTypes" in schema.properties)) { - return {}; - } - return { - type: "object", - properties: { - taxOfficeId: { - type: "string", - }, - organization: - schema.properties.entityInformationTypes.items.properties.organizations - .items, - telephone: { - ...schema.properties.entityInformationTypes.items.properties - .organizations.items.properties.contactInformations.items.properties - .telephones.items, - properties: { - ...schema.properties.entityInformationTypes.items.properties - .organizations.items.properties.contactInformations.items.properties - .telephones.items.properties, - localNumber, - }, - }, - address: - schema.properties.entityInformationTypes.items.properties.organizations - .items.properties.contactInformations.items.properties.addresses - .items, - email: - schema.properties.entityInformationTypes.items.properties.organizations - .items.properties.contactInformations.items.properties.emails.items, - }, - }; -} - -export const dataConfigOfParties = { - merchants: { - translationKey: "Merchants" as const, - subEntityName: "Merchants.SubOrganization" as const, - subEntityType: "STORE" as const, - detailedFilters: [ - { - name: "typeCodes", - displayName: "Type Codes", - type: "select-multiple" as const, - value: "HEADQUARTER", - multiSelectProps: { - options: [ - { - label: "HEADQUARTER", - value: "HEADQUARTER", - }, - { - label: "STORE", - value: "STORE", - }, - ], - }, - }, - ], - createFormSchema: { - schema: createScheme(CreateMerchantSchema), - formPositions: [ - "organization", - "telephone", - "address", - "email", - "taxOfficeId", - ], - - formSubPositions: MerchantsFormSubPositions, - convertors: {}, - }, - tableSchema: { - excludeList: [ - "id", - "organizationId", - "individualId", - "parentCompanyId", - "entityInformationTypeCodeName", - ], - schema: $UniRefund_CRMService_Merchants_MerchantProfileDto, - }, - }, - "refund-points": { - translationKey: "RefundPoints" as const, - subEntityName: "Merchants.SubOrganization" as const, - subEntityType: "REFUNDPOINT" as const, - detailedFilters: [], - createFormSchema: { - schema: createScheme(CreateRefundPointSchema), - formPositions: [ - "organization", - "telephone", - "address", - "email", - "taxOfficeId", - ], - formSubPositions: RefundPointsFormSubPositions, - convertors: {}, - }, - tableSchema: { - excludeList: [ - "id", - "organizationId", - "individualId", - "entityInformationTypeCodeValue", - ], - schema: $UniRefund_CRMService_Merchants_RefundPointProfileDto, - }, - }, - customs: { - translationKey: "Customs" as const, - subEntityName: "Merchants.SubOrganization" as const, - subEntityType: "HEADQUARTER" as const, - detailedFilters: [], - createFormSchema: { - schema: createScheme(CreateCustomsSchema), - formPositions: ["organization", "telephone", "address", "email"], - formSubPositions: CustomsFormSubPositions, - convertors: {}, - }, - tableSchema: { - excludeList: ["id", "organizationId"], - schema: $UniRefund_CRMService_Customss_CustomsProfileDto, - }, - }, - "tax-free": { - translationKey: "TaxFree" as const, - subEntityName: "Merchants.SubOrganization" as const, - subEntityType: "HEADQUARTER" as const, - detailedFilters: [], - createFormSchema: { - schema: createScheme(CreateTaxFreeSchema), - formPositions: ["organization", "telephone", "address", "email"], - formSubPositions: TaxFreeFormSubPositions, - convertors: {}, - }, - tableSchema: { - excludeList: ["id", "organizationId"], - schema: $UniRefund_CRMService_TaxFrees_TaxFreeProfileDto, - }, - }, - "tax-offices": { - translationKey: "TaxOffices" as const, - subEntityName: "Merchants.SubOrganization" as const, - subEntityType: "HEADQUARTER" as const, - detailedFilters: [], - createFormSchema: { - schema: createScheme(CreateTaxOfficeSchema), - formPositions: ["organization", "telephone", "address", "email"], - formSubPositions: TaxOfficesFormSubPositions, - convertors: {}, - }, - tableSchema: { - excludeList: ["id", "organizationId"], - schema: $UniRefund_CRMService_TaxOffices_TaxOfficeProfileDto, - }, - }, - individuals: { - translationKey: "Individuals" as const, - subEntityName: "Merchants.SubOrganization" as const, - subEntityType: "STORE" as const, - detailedFilters: [], - createFormSchema: { - schema: {}, - formPositions: ["telephone", "address", "email"], - - formSubPositions: {}, - convertors: {}, - }, - tableSchema: { - excludeList: ["id"], - schema: $UniRefund_CRMService_Individuals_IndividualProfileDto, - }, - }, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/tax-free/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/tax-free/page.tsx deleted file mode 100644 index 55768441d..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/tax-free/page.tsx +++ /dev/null @@ -1,37 +0,0 @@ -"use server"; - -import type { GetApiCrmServiceTaxFreesData } from "@ayasofyazilim/saas/CRMService"; -import { notFound } from "next/navigation"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/CRMService"; -import { getTaxFreesApi } from "src/actions/unirefund/CrmService/actions"; -import TaxFreeTable from "./table"; - -interface SearchParamType { - maxResultCount?: number; - skipCount?: number; - sorting?: string; - name?: string; -} - -export default async function Page(props: { - params: { lang: string }; - searchParams?: Promise; -}) { - await isUnauthorized({ - requiredPolicies: ["CRMService.TaxFrees"], - lang: props.params.lang, - }); - - const searchParams = await props.searchParams; - const response = await getTaxFreesApi({ - name: searchParams?.name || "", - maxResultCount: searchParams?.maxResultCount || 10, - skipCount: searchParams?.skipCount || 0, - } as GetApiCrmServiceTaxFreesData); - - if (response.type !== "success") return notFound(); - - const { languageData } = await getResourceData(props.params.lang); - return ; -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/tax-free/table.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/tax-free/table.tsx deleted file mode 100644 index 987f960ad..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/tax-free/table.tsx +++ /dev/null @@ -1,37 +0,0 @@ -"use client"; - -import type { PagedResultDto_TaxFreeProfileDto } from "@ayasofyazilim/saas/CRMService"; -import TanstackTable from "@repo/ayasofyazilim-ui/molecules/tanstack-table"; -import { useParams, useRouter } from "next/navigation"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import useGrantedPolicies from "src/hooks/use-granted-policies"; -import { tableData } from "./tax-free-table-data"; - -function TaxFreeTable({ - response, - languageData, -}: { - response: PagedResultDto_TaxFreeProfileDto; - languageData: CRMServiceServiceResource; -}) { - const grantedPolicies = useGrantedPolicies(); - const router = useRouter(); - const { lang } = useParams<{ lang: string }>(); - const columns = tableData.taxFrees.columns( - lang, - languageData, - grantedPolicies, - ); - const table = tableData.taxFrees.table(languageData, router, grantedPolicies); - - return ( - - ); -} - -export default TaxFreeTable; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/tax-free/tax-free-table-data.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/tax-free/tax-free-table-data.tsx deleted file mode 100644 index e33353e14..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/tax-free/tax-free-table-data.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import type { UniRefund_CRMService_TaxFrees_TaxFreeProfileDto } from "@ayasofyazilim/saas/CRMService"; -import { $UniRefund_CRMService_TaxFrees_TaxFreeProfileDto } from "@ayasofyazilim/saas/CRMService"; -import type { - TanstackTableColumnLink, - TanstackTableCreationProps, - TanstackTableTableActionsType, -} from "@repo/ayasofyazilim-ui/molecules/tanstack-table/types"; -import { tanstackTableCreateColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; -import { PlusCircle } from "lucide-react"; -import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import isActionGranted from "src/utils/page-policy/action-policy"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import type { Policy } from "src/utils/page-policy/utils"; - -type TaxFreeTable = - TanstackTableCreationProps; - -const links: Partial< - Record< - keyof UniRefund_CRMService_TaxFrees_TaxFreeProfileDto, - TanstackTableColumnLink - > -> = {}; - -function taxFreeTableActions( - languageData: CRMServiceServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, -) { - const actions: TanstackTableTableActionsType[] = []; - if (isActionGranted(["CRMService.TaxFrees.Create"], grantedPolicies)) { - actions.push({ - type: "simple", - actionLocation: "table", - cta: languageData.New, - icon: PlusCircle, - onClick() { - router.push("tax-free/new"); - }, - }); - } - return actions; -} -function taxFreeColumns( - locale: string, - languageData: CRMServiceServiceResource, - grantedPolicies: Record, -) { - if (isActionGranted(["CRMService.TaxFrees.Edit"], grantedPolicies)) { - links.name = { - prefix: "/parties/tax-free", - targetAccessorKey: "id", - }; - } - - return tanstackTableCreateColumnsByRowData( - { - rows: $UniRefund_CRMService_TaxFrees_TaxFreeProfileDto.properties, - languageData: { - name: languageData.Name, - }, - config: { - locale, - }, - links, - faceted: {}, - }, - ); -} -function taxFreeTable( - languageData: CRMServiceServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, -) { - const table: TaxFreeTable = { - fillerColumn: "name", - columnVisibility: { - type: "hide", - columns: ["id", "organizationId", "parentId"], - }, - tableActions: taxFreeTableActions(languageData, router, grantedPolicies), - columnOrder: ["name"], - filters: { - textFilters: ["name"], - }, - }; - return table; -} - -export const tableData = { - taxFrees: { - columns: taxFreeColumns, - table: taxFreeTable, - }, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/tax-offices/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/tax-offices/page.tsx deleted file mode 100644 index 4100b8985..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/tax-offices/page.tsx +++ /dev/null @@ -1,39 +0,0 @@ -"use server"; - -import type { GetApiCrmServiceTaxOfficesData } from "@ayasofyazilim/saas/CRMService"; -import { notFound } from "next/navigation"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/CRMService"; -import { getTaxOfficesApi } from "src/actions/unirefund/CrmService/actions"; -import TaxOfficesTable from "./table"; - -interface SearchParamType { - maxResultCount?: number; - skipCount?: number; - sorting?: string; - name?: string; -} - -export default async function Page(props: { - params: { lang: string }; - searchParams?: Promise; -}) { - await isUnauthorized({ - requiredPolicies: ["CRMService.TaxOffices"], - lang: props.params.lang, - }); - - const searchParams = await props.searchParams; - const response = await getTaxOfficesApi({ - name: searchParams?.name || "", - maxResultCount: searchParams?.maxResultCount || 10, - skipCount: searchParams?.skipCount || 0, - } as GetApiCrmServiceTaxOfficesData); - - if (response.type !== "success") return notFound(); - - const { languageData } = await getResourceData(props.params.lang); - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/tax-offices/table.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/tax-offices/table.tsx deleted file mode 100644 index b872f4e9e..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/tax-offices/table.tsx +++ /dev/null @@ -1,41 +0,0 @@ -"use client"; - -import type { PagedResultDto_TaxOfficeProfileDto } from "@ayasofyazilim/saas/CRMService"; -import TanstackTable from "@repo/ayasofyazilim-ui/molecules/tanstack-table"; -import { useParams, useRouter } from "next/navigation"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import useGrantedPolicies from "src/hooks/use-granted-policies"; -import { tableData } from "./tax-offices-table-data"; - -function TaxOfficesTable({ - response, - languageData, -}: { - response: PagedResultDto_TaxOfficeProfileDto; - languageData: CRMServiceServiceResource; -}) { - const grantedPolicies = useGrantedPolicies(); - const router = useRouter(); - const { lang } = useParams<{ lang: string }>(); - const columns = tableData.taxOffices.columns( - lang, - languageData, - grantedPolicies, - ); - const table = tableData.taxOffices.table( - languageData, - router, - grantedPolicies, - ); - - return ( - - ); -} - -export default TaxOfficesTable; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/tax-offices/tax-offices-table-data.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/tax-offices/tax-offices-table-data.tsx deleted file mode 100644 index 087c99848..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/tax-offices/tax-offices-table-data.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import type { UniRefund_CRMService_TaxOffices_TaxOfficeProfileDto } from "@ayasofyazilim/saas/CRMService"; -import { $UniRefund_CRMService_TaxOffices_TaxOfficeProfileDto } from "@ayasofyazilim/saas/CRMService"; -import type { - TanstackTableColumnLink, - TanstackTableCreationProps, - TanstackTableTableActionsType, -} from "@repo/ayasofyazilim-ui/molecules/tanstack-table/types"; -import { tanstackTableCreateColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; -import { PlusCircle } from "lucide-react"; -import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import isActionGranted from "src/utils/page-policy/action-policy"; -import type { CRMServiceServiceResource } from "src/language-data/unirefund/CRMService"; -import type { Policy } from "src/utils/page-policy/utils"; - -type TaxOfficesTable = - TanstackTableCreationProps; - -const links: Partial< - Record< - keyof UniRefund_CRMService_TaxOffices_TaxOfficeProfileDto, - TanstackTableColumnLink - > -> = {}; - -function taxOfficesTableActions( - languageData: CRMServiceServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, -) { - const actions: TanstackTableTableActionsType[] = []; - if (isActionGranted(["CRMService.TaxOffices.Create"], grantedPolicies)) { - actions.push({ - type: "simple", - actionLocation: "table", - cta: languageData.New, - icon: PlusCircle, - onClick() { - router.push("tax-offices/new"); - }, - }); - } - return actions; -} -function taxOfficesColumns( - locale: string, - languageData: CRMServiceServiceResource, - grantedPolicies: Record, -) { - if (isActionGranted(["CRMService.TaxOffices.Edit"], grantedPolicies)) { - links.name = { - prefix: "/parties/tax-offices", - targetAccessorKey: "id", - }; - } - return tanstackTableCreateColumnsByRowData( - { - rows: $UniRefund_CRMService_TaxOffices_TaxOfficeProfileDto.properties, - languageData: { - name: languageData.Name, - }, - config: { - locale, - }, - links, - faceted: {}, - }, - ); -} - -function taxOfficesTable( - languageData: CRMServiceServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, -) { - const table: TaxOfficesTable = { - fillerColumn: "name", - columnVisibility: { - type: "hide", - columns: ["id", "organizationId", "parentId"], - }, - tableActions: taxOfficesTableActions(languageData, router, grantedPolicies), - columnOrder: ["name"], - filters: { - textFilters: ["name"], - }, - }; - return table; -} - -export const tableData = { - taxOffices: { - columns: taxOfficesColumns, - table: taxOfficesTable, - }, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/form.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/form.tsx deleted file mode 100644 index f44fa8568..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/form.tsx +++ /dev/null @@ -1,161 +0,0 @@ -"use client"; -import type { - UniRefund_TravellerService_PersonalPreferencesTypes_UpsertPersonalPreferenceDto, - UniRefund_TravellerService_PersonalSummaries_UpsertPersonalSummaryDto, - UniRefund_TravellerService_Travellers_TravellerDetailProfileDto, -} from "@ayasofyazilim/saas/TravellerService"; -import { - $UniRefund_TravellerService_PersonalPreferencesTypes_UpsertPersonalPreferenceDto, - $UniRefund_TravellerService_PersonalSummaries_UpsertPersonalSummaryDto, -} from "@ayasofyazilim/saas/TravellerService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import TanstackTable from "@repo/ayasofyazilim-ui/molecules/tanstack-table"; -import AutoForm, { - AutoFormSubmit, - createFieldConfigWithResource, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { - SectionLayout, - SectionLayoutContent, -} from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import { useParams, useRouter } from "next/navigation"; -import { handlePutResponse } from "src/actions/core/api-utils-client"; -import { - putTravellerPersonalPreferenceApi, - putTravellerPersonalSummaryApi, -} from "src/actions/unirefund/TravellerService/put-actions"; -import useGrantedPolicies from "src/hooks/use-granted-policies"; -import type { TravellerServiceResource } from "src/language-data/unirefund/TravellerService"; -import { tableData } from "./identification-table-data"; - -export default function Page({ - languageData, - travellerId, - travellerData, -}: { - languageData: TravellerServiceResource; - travellerId: string; - travellerData: UniRefund_TravellerService_Travellers_TravellerDetailProfileDto; -}) { - const router = useRouter(); - - const updatPersonalPreferenceSchema = createZodObject( - $UniRefund_TravellerService_PersonalPreferencesTypes_UpsertPersonalPreferenceDto, - ); - - const updatPersonalSummarySchema = createZodObject( - $UniRefund_TravellerService_PersonalSummaries_UpsertPersonalSummaryDto, - ); - - const translatedPersonalPreferenceForm = createFieldConfigWithResource({ - schema: - $UniRefund_TravellerService_PersonalPreferencesTypes_UpsertPersonalPreferenceDto, - resources: languageData, - }); - - const translatedPersonalSummaryForm = createFieldConfigWithResource({ - schema: - $UniRefund_TravellerService_PersonalSummaries_UpsertPersonalSummaryDto, - resources: languageData, - name: "Form.Summary", - }); - const grantedPolicies = useGrantedPolicies(); - const { lang } = useParams<{ lang: string }>(); - const columns = tableData.identifications.columns( - lang, - languageData, - grantedPolicies, - travellerId, - ); - const table = tableData.identifications.table( - languageData, - router, - grantedPolicies, - travellerId, - ); - - function updateTravellerPersonalPreference( - data: UniRefund_TravellerService_PersonalPreferencesTypes_UpsertPersonalPreferenceDto, - ) { - void putTravellerPersonalPreferenceApi({ - id: travellerId, - requestBody: data, - }).then((response) => { - handlePutResponse(response, router); - }); - } - - function updateTravellerPersonalSummary( - data: UniRefund_TravellerService_PersonalSummaries_UpsertPersonalSummaryDto, - ) { - void putTravellerPersonalSummaryApi({ - id: travellerId, - requestBody: data, - }).then((response) => { - handlePutResponse(response, router); - }); - } - - return ( - - - - - - - { - updateTravellerPersonalPreference( - values as UniRefund_TravellerService_PersonalPreferencesTypes_UpsertPersonalPreferenceDto, - ); - }} - values={{ - languagePreferenceCode: travellerData.languagePreferenceCode, - }} - > - - {languageData["Edit.Save"]} - - - - - { - updateTravellerPersonalSummary( - values as UniRefund_TravellerService_PersonalSummaries_UpsertPersonalSummaryDto, - ); - }} - values={{ - genderTypeCode: travellerData.gender, - }} - > - - {languageData["Edit.Save"]} - - - - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification-table-data.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification-table-data.tsx deleted file mode 100644 index 10f438ec7..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification-table-data.tsx +++ /dev/null @@ -1,120 +0,0 @@ -import type { UniRefund_TravellerService_PersonalIdentificationCommonDatas_PersonalIdentificationProfileDto } from "@ayasofyazilim/saas/TravellerService"; -import { $UniRefund_TravellerService_PersonalIdentificationCommonDatas_PersonalIdentificationProfileDto } from "@ayasofyazilim/saas/TravellerService"; -import type { - TanstackTableColumnLink, - TanstackTableCreationProps, - TanstackTableTableActionsType, -} from "@repo/ayasofyazilim-ui/molecules/tanstack-table/types"; -import { tanstackTableCreateColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; -import { PlusCircle } from "lucide-react"; -import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import isActionGranted from "src/utils/page-policy/action-policy"; -import type { TravellerServiceResource } from "src/language-data/unirefund/TravellerService"; -import type { Policy } from "src/utils/page-policy/utils"; - -type IdentificationsTable = - TanstackTableCreationProps; - -const links: Partial< - Record< - keyof UniRefund_TravellerService_PersonalIdentificationCommonDatas_PersonalIdentificationProfileDto, - TanstackTableColumnLink - > -> = {}; - -function identificationsTableActions( - languageData: TravellerServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, - travellerId: string, -) { - const actions: TanstackTableTableActionsType[] = []; - if ( - isActionGranted(["TravellerService.Travellers.Create"], grantedPolicies) - ) { - actions.push({ - type: "simple", - actionLocation: "table", - cta: languageData["Travellers.New.Identification"], - icon: PlusCircle, - onClick() { - router.push(`${travellerId}/identification/new`); - }, - }); - } - return actions; -} -function identificationsColumns( - locale: string, - languageData: TravellerServiceResource, - grantedPolicies: Record, - travellerId: string, -) { - if (isActionGranted(["TravellerService.Travellers.Edit"], grantedPolicies)) { - links.travelDocumentNumber = { - prefix: `${travellerId}/identification/`, - targetAccessorKey: "id", - }; - } - - return tanstackTableCreateColumnsByRowData( - { - rows: $UniRefund_TravellerService_PersonalIdentificationCommonDatas_PersonalIdentificationProfileDto.properties, - languageData: { - languageData, - constantKey: "Form.personalIdentification", - }, - config: { - locale, - }, - links, - }, - ); -} - -export function identificationsTable( - languageData: TravellerServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, - travellerId: string, -): IdentificationsTable { - const table: IdentificationsTable = { - fillerColumn: "travelDocumentNumber", - columnVisibility: { - type: "hide", - columns: [ - "id", - "nationalityCountryCode2", - "residenceCountryCode2", - "fullName", - ], - }, - tableActions: identificationsTableActions( - languageData, - router, - grantedPolicies, - travellerId, - ), - columnOrder: [ - "travelDocumentNumber", - "firstName", - "middleName", - "lastName", - "nationalityCountryName", - "residenceCountryName", - "birthDate", - "issueDate", - "expirationDate", - "identificationType", - ], - pinColumns: ["travelDocumentNumber"], - }; - return table; -} - -export const tableData = { - identifications: { - columns: identificationsColumns, - table: identificationsTable, - }, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification/[identificationId]/form.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification/[identificationId]/form.tsx deleted file mode 100644 index 36e393b24..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification/[identificationId]/form.tsx +++ /dev/null @@ -1,128 +0,0 @@ -"use client"; - -import type { - UniRefund_TravellerService_PersonalIdentificationCommonDatas_UpdatePersonalIdentificationDto, - UniRefund_TravellerService_Travellers_TravellerDetailProfileDto, -} from "@ayasofyazilim/saas/TravellerService"; -import { $UniRefund_TravellerService_PersonalIdentificationCommonDatas_UpdatePersonalIdentificationDto } from "@ayasofyazilim/saas/TravellerService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import AutoForm, { - AutoFormSubmit, - createFieldConfigWithResource, - CustomCombobox, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { useRouter } from "next/navigation"; -import { handlePutResponse } from "src/actions/core/api-utils-client"; -import type { CountryDto } from "src/actions/unirefund/LocationService/types"; -import { putTravellerPersonalIdentificationApi } from "src/actions/unirefund/TravellerService/put-actions"; -import type { TravellerServiceResource } from "src/language-data/unirefund/TravellerService"; - -const updateTravellerIdentificationSchema = createZodObject( - $UniRefund_TravellerService_PersonalIdentificationCommonDatas_UpdatePersonalIdentificationDto, - [ - "travelDocumentNumber", - "firstName", - "middleName", - "lastName", - "birthDate", - "issueDate", - "expirationDate", - "nationalityCountryCode2", - "residenceCountryCode2", - "identificationType", - ], -); - -export default function Form({ - languageData, - travellerId, - travellerData, - countryList, - identificationId, -}: { - languageData: TravellerServiceResource; - travellerId: string; - identificationId: string; - travellerData: UniRefund_TravellerService_Travellers_TravellerDetailProfileDto; - countryList: { data: CountryDto[]; success: boolean }; -}) { - const router = useRouter(); - function putTravellerPersonalIdentification( - data: UniRefund_TravellerService_PersonalIdentificationCommonDatas_UpdatePersonalIdentificationDto, - ) { - void putTravellerPersonalIdentificationApi({ - id: travellerId, - requestBody: { ...data, id: identificationId }, - }).then((response) => { - handlePutResponse(response, router); - }); - } - - const translatedForm = createFieldConfigWithResource({ - schema: - $UniRefund_TravellerService_PersonalIdentificationCommonDatas_UpdatePersonalIdentificationDto, - resources: languageData, - name: "Form.personalIdentification", - extend: { - nationalityCountryCode2: { - containerClassName: "gap-2", - renderer: (props) => ( - - childrenProps={props} - disabled={!countryList.success} - emptyValue={ - countryList.success - ? languageData["Country.Select"] - : languageData["Country.Fetch.Fail"] - } - list={countryList.data} - searchPlaceholder={languageData["Select.Placeholder"]} - searchResultLabel={languageData["Select.ResultLabel"]} - selectIdentifier="code2" - selectLabel="name" - /> - ), - }, - residenceCountryCode2: { - containerClassName: "gap-2", - renderer: (props) => ( - - childrenProps={props} - disabled={!countryList.success} - emptyValue={ - countryList.success - ? languageData["Country.Select"] - : languageData["Country.Fetch.Fail"] - } - list={countryList.data} - searchPlaceholder={languageData["Select.Placeholder"]} - searchResultLabel={languageData["Select.ResultLabel"]} - selectIdentifier="code2" - selectLabel="name" - /> - ), - }, - }, - }); - - return ( - { - putTravellerPersonalIdentification( - values as UniRefund_TravellerService_PersonalIdentificationCommonDatas_UpdatePersonalIdentificationDto, - ); - }} - values={travellerData.personalIdentifications.find( - (identification) => identification.id === identificationId, - )} - > - - {languageData["Edit.Save"]} - - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification/[identificationId]/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification/[identificationId]/page.tsx deleted file mode 100644 index 26e6f9157..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification/[identificationId]/page.tsx +++ /dev/null @@ -1,52 +0,0 @@ -"use server"; - -import type { UniRefund_TravellerService_Travellers_TravellerDetailProfileDto } from "@ayasofyazilim/saas/TravellerService"; -import { getCountriesApi } from "src/actions/unirefund/LocationService/actions"; -import { getTravellersDetailsApi } from "src/actions/unirefund/TravellerService/actions"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/TravellerService"; -import { getBaseLink } from "src/utils"; -import Form from "./form"; - -export default async function Page({ - params, -}: { - params: { travellerId: string; lang: string; identificationId: string }; -}) { - await isUnauthorized({ - requiredPolicies: ["TravellerService.Travellers.Edit"], - lang: params.lang, - }); - - const { languageData } = await getResourceData(params.lang); - const traveller = await getTravellersDetailsApi(params.travellerId); - const countries = await getCountriesApi(); - const travellerData = - traveller.data as UniRefund_TravellerService_Travellers_TravellerDetailProfileDto; - const countryList = - (countries.type === "success" && countries.data.items) || []; - - return ( - <> - -
- {`${languageData["Travellers.Personal.Identification"]} (${travellerData.personalIdentifications[0].travelDocumentNumber})`} -
-
- {languageData["Travellers.Identifications.Edit.Description"]} -
- - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification/new/form.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification/new/form.tsx deleted file mode 100644 index 22773057f..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification/new/form.tsx +++ /dev/null @@ -1,117 +0,0 @@ -"use client"; - -import type { UniRefund_TravellerService_PersonalIdentificationCommonDatas_CreatePersonalIdentificationDto } from "@ayasofyazilim/saas/TravellerService"; -import { $UniRefund_TravellerService_PersonalIdentificationCommonDatas_CreatePersonalIdentificationDto } from "@ayasofyazilim/saas/TravellerService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import AutoForm, { - AutoFormSubmit, - createFieldConfigWithResource, - CustomCombobox, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { useRouter } from "next/navigation"; -import { handlePostResponse } from "src/actions/core/api-utils-client"; -import type { CountryDto } from "src/actions/unirefund/LocationService/types"; -import { postTravellerIdentificationApi } from "src/actions/unirefund/TravellerService/post-actions"; -import type { TravellerServiceResource } from "src/language-data/unirefund/TravellerService"; - -const createTravellerIdentificationSchema = createZodObject( - $UniRefund_TravellerService_PersonalIdentificationCommonDatas_CreatePersonalIdentificationDto, - [ - "travelDocumentNumber", - "firstName", - "middleName", - "lastName", - "birthDate", - "issueDate", - "expirationDate", - "nationalityCountryCode2", - "residenceCountryCode2", - "identificationType", - ], -); - -export default function Form({ - languageData, - travellerId, - countryList, -}: { - languageData: TravellerServiceResource; - travellerId: string; - countryList: { data: CountryDto[]; success: boolean }; -}) { - const router = useRouter(); - function postTravellerIdentification( - data: UniRefund_TravellerService_PersonalIdentificationCommonDatas_CreatePersonalIdentificationDto, - ) { - void postTravellerIdentificationApi({ - id: travellerId, - requestBody: data, - }).then((response) => { - handlePostResponse(response, router, `..`); - }); - } - - const translatedForm = createFieldConfigWithResource({ - schema: - $UniRefund_TravellerService_PersonalIdentificationCommonDatas_CreatePersonalIdentificationDto, - resources: languageData, - name: "Form.personalIdentification", - extend: { - nationalityCountryCode2: { - containerClassName: "gap-2", - renderer: (props) => ( - - childrenProps={props} - disabled={!countryList.success} - emptyValue={ - countryList.success - ? languageData["Country.Select"] - : languageData["Country.Fetch.Fail"] - } - list={countryList.data} - searchPlaceholder={languageData["Select.Placeholder"]} - searchResultLabel={languageData["Select.ResultLabel"]} - selectIdentifier="code2" - selectLabel="name" - /> - ), - }, - residenceCountryCode2: { - containerClassName: "gap-2", - renderer: (props) => ( - - childrenProps={props} - disabled={!countryList.success} - emptyValue={ - countryList.success - ? languageData["Country.Select"] - : languageData["Country.Fetch.Fail"] - } - list={countryList.data} - searchPlaceholder={languageData["Select.Placeholder"]} - searchResultLabel={languageData["Select.ResultLabel"]} - selectIdentifier="code2" - selectLabel="name" - /> - ), - }, - }, - }); - - return ( - { - postTravellerIdentification( - values as UniRefund_TravellerService_PersonalIdentificationCommonDatas_CreatePersonalIdentificationDto, - ); - }} - > - - {languageData.Save} - - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification/new/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification/new/page.tsx deleted file mode 100644 index 75fa0b364..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/identification/new/page.tsx +++ /dev/null @@ -1,50 +0,0 @@ -"use server"; - -import type { UniRefund_TravellerService_Travellers_TravellerDetailProfileDto } from "@ayasofyazilim/saas/TravellerService"; -import { getCountriesApi } from "src/actions/unirefund/LocationService/actions"; -import { getTravellersDetailsApi } from "src/actions/unirefund/TravellerService/actions"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/TravellerService"; -import { getBaseLink } from "src/utils"; -import Form from "./form"; - -export default async function Page({ - params, -}: { - params: { travellerId: string; lang: string }; -}) { - await isUnauthorized({ - requiredPolicies: ["TravellerService.Travellers.Create"], - lang: params.lang, - }); - - const { languageData } = await getResourceData(params.lang); - const traveller = await getTravellersDetailsApi(params.travellerId); - const countries = await getCountriesApi(); - const countryList = - (countries.type === "success" && countries.data.items) || []; - const travellerData = - traveller.data as UniRefund_TravellerService_Travellers_TravellerDetailProfileDto; - - return ( - <> - -
- {`${languageData.Traveller} (${travellerData.personalIdentifications[0].fullName})`} -
-
- {languageData["Travellers.Create.Identification.Description"]} -
- - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/page.tsx deleted file mode 100644 index 3fa31b5fb..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/[travellerId]/page.tsx +++ /dev/null @@ -1,40 +0,0 @@ -"use server"; - -import { notFound } from "next/navigation"; -import { getTravellersDetailsApi } from "src/actions/unirefund/TravellerService/actions"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/TravellerService"; -import Form from "./form"; - -export default async function Page({ - params, -}: { - params: { travellerId: string; lang: string }; -}) { - await isUnauthorized({ - requiredPolicies: ["TravellerService.Travellers"], - lang: params.lang, - }); - - const { languageData } = await getResourceData(params.lang); - const traveller = await getTravellersDetailsApi(params.travellerId); - - if (traveller.type !== "success") return notFound(); - const travellerData = traveller.data; - - return ( - <> - -
- {`${languageData.Traveller} (${travellerData.personalIdentifications[0].fullName})`} -
-
- {languageData["Travellers.Edit.Description"]} -
- - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/new/form.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/travellers/new/form.tsx deleted file mode 100644 index 35034849f..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/new/form.tsx +++ /dev/null @@ -1,99 +0,0 @@ -"use client"; - -import { toast } from "@/components/ui/sonner"; -import type { UniRefund_TravellerService_Travellers_CreateTravellerDto as TravellerDto } from "@ayasofyazilim/saas/TravellerService"; -import { $UniRefund_TravellerService_Travellers_CreateTravellerDto } from "@ayasofyazilim/saas/TravellerService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import AutoForm, { - AutoFormSubmit, - createFieldConfigWithResource, - CustomCombobox, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import { useRouter } from "next/navigation"; -import type { CountryDto } from "src/actions/unirefund/LocationService/types"; -import { postTravellerApi } from "src/actions/unirefund/TravellerService/post-actions"; -import type { TravellerServiceResource } from "src/language-data/unirefund/TravellerService"; -import { getBaseLink } from "src/utils"; - -const createTravellerSchema = createZodObject( - $UniRefund_TravellerService_Travellers_CreateTravellerDto, -); - -export default function Form({ - languageData, - countryList, -}: { - languageData: TravellerServiceResource; - countryList: { data: CountryDto[]; success: boolean }; -}) { - const router = useRouter(); - - const translatedForm = createFieldConfigWithResource({ - schema: $UniRefund_TravellerService_Travellers_CreateTravellerDto, - resources: languageData, - extend: { - personalIdentification: { - residenceCountryCode2: { - renderer: (props) => ( - - childrenProps={props} - disabled={!countryList.success} - emptyValue={ - countryList.success - ? languageData["Country.Select"] - : languageData["Country.Fetch.Fail"] - } - list={countryList.data} - searchPlaceholder={languageData["Select.Placeholder"]} - searchResultLabel={languageData["Select.ResultLabel"]} - selectIdentifier="code2" - selectLabel="name" - /> - ), - }, - nationalityCountryCode2: { - renderer: (props) => ( - - childrenProps={props} - disabled={!countryList.success} - emptyValue={ - countryList.success - ? languageData["Country.Select"] - : languageData["Country.Fetch.Fail"] - } - list={countryList.data} - searchPlaceholder={languageData["Select.Placeholder"]} - searchResultLabel={languageData["Select.ResultLabel"]} - selectIdentifier="code2" - selectLabel="name" - /> - ), - }, - }, - }, - }); - async function createTraveller(data: TravellerDto) { - const response = await postTravellerApi({ requestBody: data }); - if (response.type === "error" || response.type === "api-error") { - toast.error(response.message || languageData["Travellers.New.Error"]); - } else { - toast.success([languageData["Travellers.New.Succes"]]); - router.push(getBaseLink(`/parties/traveller`)); - } - } - - return ( - { - void createTraveller(val as TravellerDto); - }} - stickyChildren - > - - {languageData.Save} - - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/new/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/travellers/new/page.tsx deleted file mode 100644 index c6bf5d266..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/new/page.tsx +++ /dev/null @@ -1,28 +0,0 @@ -"use server"; - -import { getCountriesApi } from "src/actions/unirefund/LocationService/actions"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/TravellerService"; -import Form from "./form"; - -export default async function Page({ params }: { params: { lang: string } }) { - await isUnauthorized({ - requiredPolicies: ["TravellerService.Travellers.Create"], - lang: params.lang, - }); - - const { languageData } = await getResourceData(params.lang); - const countries = await getCountriesApi(); - const countryList = - (countries.type === "success" && countries.data.items) || []; - - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/page.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/travellers/page.tsx deleted file mode 100644 index 577ed3e55..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/page.tsx +++ /dev/null @@ -1,55 +0,0 @@ -"use server"; - -import type { GetApiTravellerServiceTravellersData } from "@ayasofyazilim/saas/TravellerService"; -import { notFound } from "next/navigation"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/TravellerService"; -import { getCountriesApi } from "../../../../../actions/unirefund/LocationService/actions"; -import { getTravellersApi } from "../../../../../actions/unirefund/TravellerService/actions"; -import TravellersTable from "./table"; - -interface SearchParamType { - maxResultCount?: number; - skipCount?: number; - sorting?: string; - name?: string; - email?: string; - fullName?: string; - phoneNumber?: string; - travelDocumentNumber?: string; - username?: string; - nationalities?: string; - residences?: string; - showExpired?: boolean; -} - -export default async function Page(props: { - params: { lang: string }; - searchParams?: Promise; -}) { - await isUnauthorized({ - requiredPolicies: ["TravellerService.Travellers"], - lang: props.params.lang, - }); - - const searchParams = await props.searchParams; - const countries = await getCountriesApi(); - const countryList = - (countries.type === "success" && countries.data.items) || []; - const response = await getTravellersApi({ - ...searchParams, - nationalities: searchParams?.nationalities?.split(",") || [], - residences: searchParams?.residences?.split(",") || [], - } as GetApiTravellerServiceTravellersData); - - if (response.type !== "success") return notFound(); - - const { languageData } = await getResourceData(props.params.lang); - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/table.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/travellers/table.tsx deleted file mode 100644 index f02114471..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/table.tsx +++ /dev/null @@ -1,45 +0,0 @@ -"use client"; - -import type { PagedResultDto_TravellerListProfileDto } from "@ayasofyazilim/saas/TravellerService"; -import TanstackTable from "@repo/ayasofyazilim-ui/molecules/tanstack-table"; -import { useParams, useRouter } from "next/navigation"; -import type { TravellerServiceResource } from "src/language-data/unirefund/TravellerService"; -import useGrantedPolicies from "src/hooks/use-granted-policies"; -import type { CountryDto } from "../../../../../actions/unirefund/LocationService/types"; -import { tableData } from "./travellers-table-data"; - -function TravellersTable({ - response, - languageData, - countryList, -}: { - response: PagedResultDto_TravellerListProfileDto; - languageData: TravellerServiceResource; - countryList: CountryDto[]; -}) { - const grantedPolicies = useGrantedPolicies(); - const router = useRouter(); - const { lang } = useParams<{ lang: string }>(); - const columns = tableData.travellers.columns( - lang, - languageData, - grantedPolicies, - ); - const table = tableData.travellers.table( - languageData, - router, - countryList, - grantedPolicies, - ); - - return ( - - ); -} - -export default TravellersTable; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/travellers-table-data.tsx b/apps/web/src/app/[lang]/(unirefund)/parties/travellers/travellers-table-data.tsx deleted file mode 100644 index 05d38c75b..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/travellers/travellers-table-data.tsx +++ /dev/null @@ -1,140 +0,0 @@ -import type { UniRefund_TravellerService_Travellers_TravellerListProfileDto } from "@ayasofyazilim/saas/TravellerService"; -import { $UniRefund_TravellerService_Travellers_TravellerListProfileDto } from "@ayasofyazilim/saas/TravellerService"; -import type { - TanstackTableColumnLink, - TanstackTableCreationProps, - TanstackTableTableActionsType, -} from "@repo/ayasofyazilim-ui/molecules/tanstack-table/types"; -import { tanstackTableCreateColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; -import { PlusCircle } from "lucide-react"; -import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import type { TravellerServiceResource } from "src/language-data/unirefund/TravellerService"; -import type { Policy } from "src/utils/page-policy/utils"; -import isActionGranted from "src/utils/page-policy/action-policy"; -import type { CountryDto } from "../../../../../actions/unirefund/LocationService/types"; - -type TravellersTable = - TanstackTableCreationProps; - -const links: Partial< - Record< - keyof UniRefund_TravellerService_Travellers_TravellerListProfileDto, - TanstackTableColumnLink - > -> = {}; - -function travellersTableActions( - languageData: TravellerServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, -) { - const actions: TanstackTableTableActionsType[] = []; - if ( - isActionGranted(["TravellerService.Travellers.Create"], grantedPolicies) - ) { - actions.push({ - type: "simple", - actionLocation: "table", - cta: languageData["Travellers.New"], - icon: PlusCircle, - onClick() { - router.push("travellers/new"); - }, - }); - } - return actions; -} -function travellersColumns( - locale: string, - languageData: TravellerServiceResource, - grantedPolicies: Record, -) { - if (isActionGranted(["TravellerService.Travellers.Edit"], grantedPolicies)) { - links.fullName = { - prefix: "/parties/travellers", - targetAccessorKey: "id", - }; - } - - return tanstackTableCreateColumnsByRowData( - { - rows: $UniRefund_TravellerService_Travellers_TravellerListProfileDto.properties, - languageData: { - languageData, - constantKey: "Form.personalIdentification", - }, - config: { - locale, - }, - links, - }, - ); -} - -export function travellersTable( - languageData: TravellerServiceResource, - router: AppRouterInstance, - countryList: CountryDto[], - grantedPolicies: Record, -): TravellersTable { - const table: TravellersTable = { - fillerColumn: "fullName", - columnVisibility: { - type: "hide", - columns: [ - "id", - "hasUserAccount", - "nationalityCountryCode2", - "residenceCountryCode2", - "userAccountId", - ], - }, - tableActions: travellersTableActions(languageData, router, grantedPolicies), - columnOrder: [ - "firstName", - "middleName", - "lastName", - "travelDocumentNumber", - "nationalityCountryName", - "residenceCountryName", - "birthDate", - "expirationDate", - "identificationType", - ], - pinColumns: ["fullName"], - filters: { - textFilters: ["fullName", "travelDocumentNumber"], - facetedFilters: { - nationalities: { - title: languageData.Nationalities, - options: countryList.map((x) => ({ - label: x.name, - value: x.code2, - })), - }, - residences: { - title: languageData.Residences, - options: countryList.map((x) => ({ - label: x.name, - value: x.code2, - })), - }, - showExpired: { - title: languageData["Travellers.ShowExpired"], - options: [ - { label: languageData.Yes, value: "true" }, - { label: languageData.No, value: "false" }, - ], - }, - }, - }, - }; - return table; -} - -export const tableData = { - travellers: { - columns: travellersColumns, - table: travellersTable, - }, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/parties/types.ts b/apps/web/src/app/[lang]/(unirefund)/parties/types.ts deleted file mode 100644 index de88d9ac5..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/parties/types.ts +++ /dev/null @@ -1,71 +0,0 @@ -import type { - $UniRefund_CRMService_Customss_CreateCustomsDto as CreateCustomsSchema, - $UniRefund_CRMService_Individuals_CreateIndividualDto as CreateIndividualSchema, - $UniRefund_CRMService_Merchants_CreateMerchantDto as CreateMerchantSchema, - $UniRefund_CRMService_RefundPoints_CreateRefundPointDto as CreateRefundPointSchema, - $UniRefund_CRMService_TaxFrees_CreateTaxFreeDto as CreateTaxFreeSchema, - $UniRefund_CRMService_TaxOffices_CreateTaxOfficeDto as CreateTaxOfficeSchema, - UniRefund_CRMService_Customss_CreateCustomsDto, - UniRefund_CRMService_Customss_CustomsDto, - UniRefund_CRMService_Individuals_CreateIndividualDto, - UniRefund_CRMService_Individuals_IndividualDto, - UniRefund_CRMService_Merchants_CreateMerchantDto, - UniRefund_CRMService_Merchants_MerchantDto, - UniRefund_CRMService_RefundPoints_CreateRefundPointDto, - UniRefund_CRMService_RefundPoints_RefundPointDto, - UniRefund_CRMService_TaxFrees_CreateTaxFreeDto, - UniRefund_CRMService_TaxFrees_TaxFreeDto, - UniRefund_CRMService_TaxOffices_CreateTaxOfficeDto, - UniRefund_CRMService_TaxOffices_TaxOfficeDto, -} from "@ayasofyazilim/saas/CRMService"; - -export type CreateMerchantDTO = - UniRefund_CRMService_Merchants_CreateMerchantDto; -export type CreateCustomsDTO = UniRefund_CRMService_Customss_CreateCustomsDto; -export type CreateRefundPointDTO = - UniRefund_CRMService_RefundPoints_CreateRefundPointDto; -export type CreateTaxFreeDTO = UniRefund_CRMService_TaxFrees_CreateTaxFreeDto; -export type CreateTaxOfficeDTO = - UniRefund_CRMService_TaxOffices_CreateTaxOfficeDto; -export type CreateIndividualDTO = - UniRefund_CRMService_Individuals_CreateIndividualDto; - -export type GetMerchantDTO = UniRefund_CRMService_Merchants_MerchantDto; -export type GetRefundPointDTO = - UniRefund_CRMService_RefundPoints_RefundPointDto; -export type GetCustomsDTO = UniRefund_CRMService_Customss_CustomsDto; -export type GetTaxFreeDTO = UniRefund_CRMService_TaxFrees_TaxFreeDto; -export type GetTaxOfficeDTO = UniRefund_CRMService_TaxOffices_TaxOfficeDto; -export type GetIndividualDTO = UniRefund_CRMService_Individuals_IndividualDto; - -export type PartyNameType = - | "merchants" - | "refund-points" - | "customs" - | "tax-free" - | "tax-offices" - | "individuals"; - -export type PartiesResultType = - | GetMerchantDTO - | GetRefundPointDTO - | GetCustomsDTO - | GetTaxFreeDTO - | GetTaxOfficeDTO - | GetIndividualDTO; - -export type PartiesCreateDTOType = - | CreateMerchantDTO - | CreateCustomsDTO - | CreateRefundPointDTO - | CreateTaxFreeDTO - | CreateTaxOfficeDTO - | CreateIndividualDTO; - -export type PartiesCreateType = - | typeof CreateMerchantSchema - | typeof CreateRefundPointSchema - | typeof CreateCustomsSchema - | typeof CreateTaxFreeSchema - | typeof CreateTaxOfficeSchema - | typeof CreateIndividualSchema; diff --git a/apps/web/src/app/[lang]/(unirefund)/refund/new/page.tsx b/apps/web/src/app/[lang]/(unirefund)/refund/new/page.tsx deleted file mode 100644 index 7c15a88d9..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/refund/new/page.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export default function Page() { - return
...
; -} diff --git a/apps/web/src/app/[lang]/(unirefund)/refund/page.tsx b/apps/web/src/app/[lang]/(unirefund)/refund/page.tsx deleted file mode 100644 index 4c65be277..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/refund/page.tsx +++ /dev/null @@ -1,33 +0,0 @@ -"use server"; - -import type { GetApiRefundServiceRefundsData } from "@ayasofyazilim/saas/RefundService"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { isErrorOnRequest } from "src/utils/page-policy/utils"; -import { getResourceData } from "src/language-data/unirefund/ContractService"; -import { getRefundApi } from "src/actions/unirefund/RefundService/actions"; -import RefundTable from "./table"; - -export default async function Page(props: { - params: { lang: string }; - searchParams?: Promise; -}) { - await isUnauthorized({ - requiredPolicies: ["RefundService.Refunds"], - lang: props.params.lang, - }); - - const searchParams = await props.searchParams; - - const response = await getRefundApi(searchParams); - if (isErrorOnRequest(response, props.params.lang)) return; - - const { languageData } = await getResourceData(props.params.lang); - - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/refund/table-data.tsx b/apps/web/src/app/[lang]/(unirefund)/refund/table-data.tsx deleted file mode 100644 index d463437ff..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/refund/table-data.tsx +++ /dev/null @@ -1,111 +0,0 @@ -import type { UniRefund_RefundService_Refunds_GetListAsync_RefundListItem } from "@ayasofyazilim/saas/RefundService"; -import { - $PagedResultDto_RefundListItem, - $UniRefund_RefundService_Enums_RefundReconciliationStatus, - $UniRefund_RefundService_Enums_RefundStatus, - $UniRefund_TagService_Tags_RefundType, -} from "@ayasofyazilim/saas/RefundService"; -import type { - TanstackTableCreationProps, - TanstackTableLanguageDataType, - TanstackTableTableActionsType, -} from "@repo/ayasofyazilim-ui/molecules/tanstack-table/types"; -import { tanstackTableCreateColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; -import { PlusCircle } from "lucide-react"; -import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import isActionGranted from "src/utils/page-policy/action-policy"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; -import type { Policy } from "src/utils/page-policy/utils"; - -type RefundTable = - TanstackTableCreationProps; - -function refundTableActions( - languageData: ContractServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, -) { - const actions: TanstackTableTableActionsType[] = []; - if (isActionGranted(["RefundService.Refunds.Create"], grantedPolicies)) { - actions.push({ - type: "simple", - actionLocation: "table", - cta: languageData.New, - icon: PlusCircle, - onClick() { - router.push("refund/new"); - }, - }); - } - return actions; -} - -const refundColumns = ( - locale: string, - languageData?: TanstackTableLanguageDataType, -) => - tanstackTableCreateColumnsByRowData( - { - rows: $PagedResultDto_RefundListItem.properties.items.items.properties, - languageData, - config: { - locale, - }, - }, - ); - -function refundTable( - languageData: ContractServiceResource, - router: AppRouterInstance, - grantedPolicies: Record, -): RefundTable { - const table: RefundTable = { - fillerColumn: "userDeviceName", - tableActions: refundTableActions(languageData, router, grantedPolicies), - - filters: { - facetedFilters: { - statusesFilterStatuses: { - title: "Statuses", - options: $UniRefund_RefundService_Enums_RefundStatus.enum.map( - (x) => ({ - label: x, - value: x, - }), - ), - }, - statusesFilterReconciliationStatuses: { - title: "ReconciliationStatuses", - options: - $UniRefund_RefundService_Enums_RefundReconciliationStatus.enum.map( - (x) => ({ - label: x, - value: x, - }), - ), - }, - statusesFilterRefundTypes: { - title: "RefundTypes", - options: $UniRefund_TagService_Tags_RefundType.enum.map((x) => ({ - label: x, - value: x, - })), - }, - }, - dateFilters: [ - { - label: "Creation Time", - startAccessorKey: "timeFilterStartDate", - endAccessorKey: "timeFilterEndDate", - }, - ], - }, - }; - return table; -} -export const tableData = { - refund: { - columns: refundColumns, - table: refundTable, - }, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/refund/table.tsx b/apps/web/src/app/[lang]/(unirefund)/refund/table.tsx deleted file mode 100644 index 4c1d5a8c1..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/refund/table.tsx +++ /dev/null @@ -1,34 +0,0 @@ -"use client"; - -import type { PagedResultDto_RefundListItem } from "@ayasofyazilim/saas/RefundService"; -import TanstackTable from "@repo/ayasofyazilim-ui/molecules/tanstack-table"; -import { useRouter } from "next/navigation"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; -import useGrantedPolicies from "src/hooks/use-granted-policies"; -import { tableData } from "./table-data"; - -function RefundTable({ - locale, - response, - languageData, -}: { - locale: string; - response: PagedResultDto_RefundListItem; - languageData: ContractServiceResource; -}) { - const grantedPolicies = useGrantedPolicies(); - const router = useRouter(); - const columns = tableData.refund.columns(locale); - const table = tableData.refund.table(languageData, router, grantedPolicies); - - return ( - - ); -} - -export default RefundTable; diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/data.ts b/apps/web/src/app/[lang]/(unirefund)/settings/data.ts deleted file mode 100644 index 19bc77a39..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/data.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any -- TODO: we need to fix this*/ -import { - $UniRefund_SettingService_ProductGroups_CreateProductGroupDto, - $UniRefund_SettingService_ProductGroups_ProductGroupDto, - $UniRefund_SettingService_ProductGroups_UpdateProductGroupDto, - $UniRefund_SettingService_Vats_CreateVatDto, - $UniRefund_SettingService_Vats_UpdateVatDto, - $UniRefund_SettingService_Vats_VatDetailDto, -} from "@ayasofyazilim/saas/SettingService"; - -export const dataConfigOfManagement: Record = { - product: { - displayName: "VATSettings", - default: "vats", - vats: { - title: "Vat", - createFormSchema: { - formPositions: ["percent", "minimumTotalAmount", "active"], - schema: $UniRefund_SettingService_Vats_CreateVatDto, - }, - editFormSchema: { - formPositions: ["percent", "minimumTotalAmount", "active"], - schema: $UniRefund_SettingService_Vats_UpdateVatDto, - }, - tableSchema: { - excludeList: [ - "id", - "creationTime", - "creatorId", - "lastModificationTime", - "lastModifierId", - "isDeleted", - "deleterId", - "deletionTime", - ], - schema: $UniRefund_SettingService_Vats_VatDetailDto, - }, - }, - "product-groups": { - title: "Product Group", - createFormSchema: { - formPositions: [ - "name", - "articleCode", - "unitCode", - "companyType", - "vatId", - "active", - "food", - ], - schema: $UniRefund_SettingService_ProductGroups_CreateProductGroupDto, - }, - editFormSchema: { - formPositions: [ - "name", - "articleCode", - "unitCode", - "companyType", - "vatId", - "active", - "food", - ], - schema: $UniRefund_SettingService_ProductGroups_UpdateProductGroupDto, - }, - tableSchema: { - excludeList: ["id"], - schema: $UniRefund_SettingService_ProductGroups_ProductGroupDto, - }, - }, - }, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/product/[data]/page.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/product/[data]/page.tsx deleted file mode 100644 index d37396022..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/product/[data]/page.tsx +++ /dev/null @@ -1,297 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument -- TODO: we need to fix this*/ -"use client"; -import { toast } from "@/components/ui/sonner"; -import type { - PagedResultDto_ProductGroupDto, - PagedResultDto_VatDto, - UniRefund_SettingService_Vats_VatDto, -} from "@ayasofyazilim/saas/SettingService"; -import { - createZodObject, - type SchemaType, -} from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import jsonToCSV from "@repo/ayasofyazilim-ui/lib/json-to-csv"; -import type { - ColumnsType, - fetchRequestProps, - TableAction, -} from "@repo/ayasofyazilim-ui/molecules/tables/types"; -import { - createFieldConfigWithResource, - CustomCombobox, - type AutoFormProps, -} from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import Dashboard from "@repo/ayasofyazilim-ui/templates/dashboard"; -import type { FormModifier, TableData } from "@repo/ui/utils/table/table-utils"; -import { useEffect, useState } from "react"; -import { z } from "zod"; -import { getResourceDataClient } from "src/language-data/core/SettingService"; -import { getBaseLink } from "src/utils"; -import { dataConfigOfManagement } from "../../data"; - -async function controlledFetch( - url: string, - options: RequestInit, - onSuccess: (_data?: any) => void, - successMessage = "Successful", - showToast = true, -) { - try { - const getData = await fetch(url, options); - if (!getData.ok) { - const body = await getData.json(); - toast.error(body.message); - } else { - const data = await getData.json(); - onSuccess(data); - showToast && toast.success(successMessage); - } - } catch (error) { - toast.error(`Fetch error: ${String(error)}`); - } -} - -export default function Page({ - params, -}: { - params: { data: string; domain: string; lang: string }; -}): JSX.Element { - const fetchLink = getBaseLink(`/api/settings/product/${params.data}`); - const [tableData, setTableData] = useState< - PagedResultDto_VatDto | PagedResultDto_ProductGroupDto - >(); - const [isLoading, setIsLoading] = useState(true); - const [formData] = useState( - dataConfigOfManagement.product[params.data], - ); - const languageData = getResourceDataClient(params.lang); - const [vats, setVats] = useState([]); - - async function getVats() { - const url = getBaseLink(`/api/settings/product/vats`); - const response = await fetch(url); - if (response.ok) { - const data = await response.json(); - setVats(data.items); - } else { - toast.error("Failed to fetch VATs"); - } - } - useEffect(() => { - void getVats(); - }, []); - - function getRoles({ page: _page, filter: _filter }: fetchRequestProps) { - let page = _page; - const filter = JSON.stringify(_filter) || ""; - if (typeof page !== "number") { - page = 0; - } - const _fetchLink = `${fetchLink}?page=${page}&filter=${filter}`; - - setIsLoading(true); - function onData(data: any) { - let returnData = data; - if (!data?.items) { - returnData = { - totalCount: data.length, - items: data, - }; - } - const transformedData = returnData.items; - setTableData({ ...returnData, items: transformedData }); - setIsLoading(false); - } - void controlledFetch( - _fetchLink, - { - method: "GET", - } as RequestInit, - onData, - "", - false, - ); - } - - const translationForm = createFieldConfigWithResource({ - schema: formData.createFormSchema?.schema as SchemaType, - resources: languageData, - extend: { - all: { - withoutBorder: true, - }, - vatId: { - renderer: (props) => ( - - childrenProps={props} - emptyValue={languageData["Vat.Select"]} - list={vats} - searchPlaceholder={languageData["Select.Placeholder"]} - searchResultLabel={languageData["Select.ResultLabel"]} - selectIdentifier="id" - selectLabel="percent" - /> - ), - }, - }, - }); - - const createFormSchema = formData.createFormSchema; - let action: TableAction[] | undefined; - if (createFormSchema) { - action = [ - { - cta: languageData[ - `${formData.title?.replaceAll(" ", "")}.New` as keyof typeof languageData - ], - description: - languageData[ - `${formData.title?.replaceAll(" ", "")}.New` as keyof typeof languageData - ], - componentType: "Autoform", - autoFormArgs: { - formSchema: createZodObject( - createFormSchema.schema, - createFormSchema.formPositions || [], - ), - fieldConfig: translationForm, - submit: { - cta: languageData["Setting.Save"], - }, - }, - callback: (e) => { - const transformedData = parseFormValues(createFormSchema, e); - void controlledFetch( - fetchLink, - { - method: "POST", - body: JSON.stringify(transformedData), - }, - getRoles, - "Added Successfully", - ); - }, - type: "Dialog", - }, - { - cta: `Export CSV`, - callback: () => { - jsonToCSV(tableData, params.data); - }, - type: "Action", - }, - ]; - } - - function parseFormValues(schema: FormModifier, data: any) { - const newSchema = createZodObject( - schema.schema, - schema.formPositions || [], - ); - const transformedSchema = newSchema.transform((val) => { - const returnObject = { ...val }; - return returnObject; - }); - const parsed = transformedSchema.parse(data); - return parsed; - } - - const onEdit = (data: any, row: any, editFormSchema: any) => { - const parsedData = parseFormValues(editFormSchema, data); - void controlledFetch( - fetchLink, - { - method: "PUT", - body: JSON.stringify({ - id: row.id, - requestBody: JSON.stringify(parsedData), - }), - }, - getRoles, - "Updated Successfully", - ); - }; - - const onDelete = (row: any) => { - void controlledFetch( - fetchLink, - { - method: "DELETE", - body: JSON.stringify(row.id), - }, - getRoles, - "Deleted Successfully", - ); - }; - - function convertZod(schema: FormModifier) { - const newSchema = createZodObject( - schema.schema, - schema.formPositions || [], - ); - return newSchema; - } - const editFormSchema = formData.editFormSchema; - let editFormSchemaZod, - autoformEditArgs: AutoFormProps = { - formSchema: z.object({}), - }; - if (editFormSchema) { - editFormSchemaZod = convertZod(editFormSchema); - autoformEditArgs = { - formSchema: editFormSchemaZod, - fieldConfig: translationForm, - }; - } - let actionList: TableAction[] = []; - if (formData.tableSchema.actionList) { - actionList = formData.tableSchema.actionList(controlledFetch, getRoles); - } - const columnsData: ColumnsType = { - type: "Auto", - data: { - tableType: formData.tableSchema.schema, - excludeList: formData.tableSchema.excludeList || [], - actionList, - }, - }; - columnsData.data.actionList?.push({ - cta: languageData.Delete, - type: "Dialog", - componentType: "ConfirmationDialog", - description: languageData["Delete.Assurance"], - cancelCTA: languageData.Cancel, - variant: "destructive", - callback: (data) => { - onDelete(data); - }, - }); - columnsData.data.actionList?.push({ - cta: languageData.Edit, - description: languageData.Edit, - type: "Dialog", - componentType: "Autoform", - autoFormArgs: { - ...autoformEditArgs, - submit: { - cta: languageData["Setting.Edit.Save"], - }, - }, - callback: (data, row) => { - onEdit(data, row, editFormSchema); - }, - }); - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/page.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/page.tsx deleted file mode 100644 index b6cdaf55b..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/page.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { redirect } from "next/navigation"; -import { getBaseLink } from "src/utils"; - -export default function Page() { - redirect(getBaseLink("settings/templates/rebate")); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/[id]/page.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/[id]/page.tsx deleted file mode 100644 index 0fdc29c71..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/[id]/page.tsx +++ /dev/null @@ -1,37 +0,0 @@ -"use server"; -import { notFound } from "next/navigation"; -import { getRebateTableHeadersByIdApi } from "src/actions/unirefund/ContractService/action"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/ContractService"; -import RebateForm from "../rebate-form"; - -export default async function Page({ - params, -}: { - params: { lang: string; type: string; id: string }; -}) { - await isUnauthorized({ - requiredPolicies: [ - "ContractService.RebateTableDetail.Create", - "ContractService.RebateTableDetail.Edit", - "ContractService.RebateTableDetail.Delete", - "ContractService.RebateTableHeader.Create", - "ContractService.RebateTableHeader.Edit", - "ContractService.RebateTableHeader.Delete", - ], - lang: params.lang, - }); - - const { languageData } = await getResourceData(params.lang); - const details = await getRebateTableHeadersByIdApi(params.id); - if (details.type !== "success") return notFound(); - - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/new/layout.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/new/layout.tsx deleted file mode 100644 index 499c325c8..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/new/layout.tsx +++ /dev/null @@ -1,57 +0,0 @@ -"use client"; - -import { - SectionLayout, - SectionLayoutContent, -} from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import Link from "next/link"; -import { usePathname } from "next/navigation"; -import { getResourceDataClient } from "src/language-data/unirefund/ContractService"; -import { getBaseLink } from "src/utils"; - -interface LayoutProps { - children: JSX.Element; - params: { lang: string; type: string }; -} - -export default function Layout({ children, params }: LayoutProps) { - const pathname = usePathname(); - const languageData = getResourceDataClient(params.lang); - - const path = pathname.split("templates/rebate/")[1]; - - const navbarItems = [ - { - name: languageData["Rebate.Create"], - id: "new", - link: getBaseLink( - "settings/templates/rebate/new", - true, - params.lang, - true, - "admin", - ), - }, - { - name: languageData["Rebate.Preview"], - id: "new/preview", - link: getBaseLink( - "settings/templates/rebate/new/preview", - true, - params.lang, - true, - "admin", - ), - }, - ]; - return ( - - {children} - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/new/page.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/new/page.tsx deleted file mode 100644 index 2ace15039..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/new/page.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { getResourceData } from "src/language-data/unirefund/ContractService"; -import RebateForm from "../rebate-form"; - -export default async function Page({ params }: { params: { lang: string } }) { - const { languageData } = await getResourceData(params.lang); - return ; -} diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/new/preview/page.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/new/preview/page.tsx deleted file mode 100644 index f5be1bdee..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/new/preview/page.tsx +++ /dev/null @@ -1,337 +0,0 @@ -import React from "react"; -import DataTable from "@repo/ayasofyazilim-ui/molecules/tables"; -import { Input } from "@/components/ui/input"; -import Button from "@repo/ayasofyazilim-ui/molecules/button"; -import { getResourceData } from "src/language-data/unirefund/ContractService"; - -const columns = [ - { - header: "Refund method", - accessorKey: "refundMethod", - }, - { - header: "Vat %", - accessorKey: "vatPercent", - }, - { - header: "VAT", - accessorKey: "vat", - }, - { - header: "GC", - accessorKey: "gc", - }, - { - header: "Rebate", - accessorKey: "rebate", - }, - { - header: "NC", - accessorKey: "nc", - }, - { - header: "Rebate % of GC", - accessorKey: "rebatePercentOfGc", - }, -]; - -const data = [ - { - refundMethod: "Cash", - vatPercent: "20 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Cash", - vatPercent: "18 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Cash", - vatPercent: "10 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Cash", - vatPercent: "8 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Cash", - vatPercent: "1 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Credit or Debit card", - vatPercent: "20 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Credit or Debit card", - vatPercent: "18 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Credit or Debit card", - vatPercent: "10 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Credit or Debit card", - vatPercent: "8 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Credit or Debit card", - vatPercent: "1 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Alipay", - vatPercent: "20 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Alipay", - vatPercent: "18 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Alipay", - vatPercent: "10 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Alipay", - vatPercent: "8 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Alipay", - vatPercent: "1 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "WeChat", - vatPercent: "20 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "WeChat", - vatPercent: "18 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "WeChat", - vatPercent: "10 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "WeChat", - vatPercent: "8 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "WeChat", - vatPercent: "1 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Cash via partner", - vatPercent: "20 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Cash via partner", - vatPercent: "18 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Cash via partner", - vatPercent: "10 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Cash via partner", - vatPercent: "8 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Cash via partner", - vatPercent: "1 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Refund later", - vatPercent: "20 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Refund later", - vatPercent: "18 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Refund later", - vatPercent: "10 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Refund later", - vatPercent: "8 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, - { - refundMethod: "Refund later", - vatPercent: "1 %", - vat: "0", - gc: "0", - rebate: "0", - nc: "0", - rebatePercentOfGc: "0 %", - }, -]; - -async function MyDataTable({ - params, -}: { - params: { lang: string; type: string }; -}) { - const { languageData } = await getResourceData(params.lang); - return ( -
-
- - -
- -
- ); -} - -export default MyDataTable; diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/page.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/page.tsx deleted file mode 100644 index 95a5bf246..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/page.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { notFound } from "next/navigation"; -import { getRebateTableHeadersApi } from "src/actions/unirefund/ContractService/action"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/ContractService"; -import RebateTable from "./table"; - -export default async function Page({ - params, -}: { - params: { lang: string; type: string }; -}) { - await isUnauthorized({ - requiredPolicies: [ - "ContractService.RebateTableHeader", - "ContractService.RebateTableDetail", - ], - lang: params.lang, - }); - - const { languageData } = await getResourceData(params.lang); - const templates = await getRebateTableHeadersApi({}); - if (templates.type !== "success") return notFound(); - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/rebate-form.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/rebate-form.tsx deleted file mode 100644 index e36e48076..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/rebate-form.tsx +++ /dev/null @@ -1,250 +0,0 @@ -"use client"; -import { Button } from "@/components/ui/button"; -import { cn } from "@/lib/utils"; -import type { - UniRefund_ContractService_Rebates_ProcessingFeeDetails_ProcessingFeeDetailCreateDto as ProcessingFeeDetailCreateDto, - UniRefund_ContractService_Rebates_RebateTableDetails_RebateTableDetailCreateDto as RebateTableDetailCreateDto, - UniRefund_ContractService_Rebates_RebateTableHeaders_RebateTableHeaderCreateDto as RebateTableHeaderCreateDto, - UniRefund_ContractService_Rebates_RebateTableHeaders_RebateTableHeaderDto as RebateTableHeaderDto, - UniRefund_ContractService_Rebates_RebateTableHeaders_RebateTableHeaderUpdateDto as RebateTableHeaderUpdateDto, - UniRefund_ContractService_Rebates_RebateTableHeaders_RebateTableHeaderNotTemplateCreateDto as RebateTableHeaderNotTemplateCreateDto, -} from "@ayasofyazilim/saas/ContractService"; -import { - $UniRefund_ContractService_Rebates_ProcessingFeeDetails_ProcessingFeeDetailCreateDto as $ProcessingFeeDetailCreateDto, - $UniRefund_ContractService_Rebates_RebateTableDetails_RebateTableDetailCreateDto as $RebateTableDetailCreateDto, - $UniRefund_ContractService_Rebates_RebateTableHeaders_RebateTableHeaderCreateDto as $RebateTableHeaderCreateDto, - $UniRefund_ContractService_Rebates_RebateTableHeaders_RebateTableHeaderUpdateDto as $RebateTableHeaderUpdateDto, - $UniRefund_ContractService_Rebates_RebateTableHeaders_RebateTableHeaderNotTemplateCreateDto as $RebateTableHeaderNotTemplateCreateDto, -} 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 { createUiSchemaWithResource } from "@repo/ayasofyazilim-ui/organisms/schema-form/utils"; -import { PlusCircle, Trash2 } from "lucide-react"; -import { useRouter } from "next/navigation"; -import { useState } from "react"; -import { - handlePostResponse, - handlePutResponse, -} from "src/actions/core/api-utils-client"; -import { postRebateTableHeadersApi } from "src/actions/unirefund/ContractService/post-actions"; -import { putRebateTableHeadersApi } from "src/actions/unirefund/ContractService/put-actions"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; - -type RebateFormProps = { - languageData: ContractServiceResource; -} & (RebateFormCreateProps | RebateFormUpdateProps | RebateFormAddProps); -interface RebateFormCreateProps { - formType: "create"; -} -interface RebateFormUpdateProps { - formType: "update"; - id: string; - formData: RebateTableHeaderDto; -} - -interface RebateFormAddProps { - formType: "add"; - id?: string; - formData?: RebateTableHeaderNotTemplateCreateDto; - onSubmit: (data: RebateTableHeaderDto) => void; - children?: React.ReactNode; -} - -export default function RebateForm(props: RebateFormProps) { - const { languageData } = props; - const router = useRouter(); - const [loading, setLoading] = useState(false); - const isCreate = props.formType === "create"; - const $Schema = { - create: $RebateTableHeaderCreateDto, - update: $RebateTableHeaderUpdateDto, - add: $RebateTableHeaderNotTemplateCreateDto, - }; - const formData = { - create: {}, - update: props.formType === "update" && props.formData, - add: props.formType === "add" && props.formData, - }; - const RebateTableColumns = - tanstackTableEditableColumnsByRowData({ - rows: { - ...$RebateTableDetailCreateDto.properties, - refundMethod: { - ...$RebateTableDetailCreateDto.properties.refundMethod, - enum: $RebateTableDetailCreateDto.properties.refundMethod.enum.map( - (item) => ({ - value: item, - label: item, - }), - ), - }, - variableFee: { - ...$RebateTableDetailCreateDto.properties.variableFee, - enum: $RebateTableDetailCreateDto.properties.variableFee.enum.map( - (item) => ({ - value: item, - label: item, - }), - ), - }, - }, - languageData: { - constantKey: "Rebate.Form.rebateTableDetails", - languageData, - }, - excludeColumns: ["extraProperties"], - }); - const ProcessingFeeDetailsColumns = - tanstackTableEditableColumnsByRowData({ - rows: $ProcessingFeeDetailCreateDto.properties, - languageData: { - constantKey: "Rebate.Form.processingFeeDetails", - languageData, - }, - excludeColumns: ["extraProperties"], - }); - const uiSchema = createUiSchemaWithResource({ - resources: languageData, - schema: $Schema[props.formType], - name: "Rebate.Form", - extend: { - "ui:className": "md:grid md:grid-cols-2 md:gap-4", - name: { "ui:className": "md:col-span-2" }, - rebateTableDetails: { - "ui:field": "RebateTable", - "ui:className": props.formType === "add" && "md:col-span-full", - }, - processingFeeDetails: { - "ui:field": "ProcessingFeeDetails", - "ui:className": props.formType === "add" && "md:col-span-full", - }, - isTemplate: { - "ui:widget": "switch", - "ui:className": "border rounded-md px-2", - "ui:options": { - disabled: true, - }, - }, - calculateNetCommissionInsteadOfRefund: { - "ui:widget": "switch", - "ui:className": cn( - "border rounded-md px-2", - (props.formType === "create" || props.formType === "add") && - "md:col-span-full", - ), - }, - }, - }); - - return ( - ({ - editable: true, - columns: RebateTableColumns, - data: isCreate ? [] : props.formData?.rebateTableDetails || [], - fillerColumn: "refundMethod", - columnOrder: [ - "refundMethod", - "fixedFeeValue", - "percentFeeValue", - "variableFee", - ], - tableActions: [ - { - type: "create-row", - actionLocation: "table", - cta: languageData["Rebate.Form.rebateTableDetails.add"], - icon: PlusCircle, - }, - ], - rowActions: [ - { - actionLocation: "row", - cta: languageData["Rebate.Form.rebateTableDetails.delete"], - icon: Trash2, - type: "delete-row", - }, - ], - }), - ProcessingFeeDetails: TableField({ - editable: true, - columns: ProcessingFeeDetailsColumns, - data: - props.formType === "create" - ? [] - : props.formData?.processingFeeDetails || [], - fillerColumn: "name", - tableActions: [ - { - type: "create-row", - actionLocation: "table", - cta: languageData["Rebate.Form.processingFeeDetails.add"], - icon: PlusCircle, - }, - ], - rowActions: [ - { - actionLocation: "row", - cta: languageData["Rebate.Form.processingFeeDetails.delete"], - icon: Trash2, - type: "delete-row", - }, - ], - }), - }} - filter={{ - type: "include", - sort: true, - keys: [ - "name", - "calculateNetCommissionInsteadOfRefund", - "validFrom", - "validTo", - "*rebateTableDetails", - "*processingFeeDetails", - ], - }} - formData={formData[props.formType]} - onSubmit={(data) => { - setLoading(true); - if (props.formType === "create") { - void postRebateTableHeadersApi({ - requestBody: data.formData as RebateTableHeaderCreateDto, - }).then((response) => { - handlePostResponse(response, router, "../rebate"); - }); - } else if (props.formType === "update") { - void putRebateTableHeadersApi({ - id: props.id, - requestBody: data.formData as RebateTableHeaderUpdateDto, - }).then((response) => { - handlePutResponse(response, router); - }); - } else { - if (!data.formData) return; - props.onSubmit(data.formData as RebateTableHeaderDto); - } - setLoading(false); - }} - schema={$Schema[props.formType]} - uiSchema={uiSchema} - useDefaultSubmit={false} - > -
- {props.formType === "add" ? ( - props.children - ) : ( - - )} -
-
- ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/table-data.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/table-data.tsx deleted file mode 100644 index 025a08af4..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/table-data.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import type { UniRefund_ContractService_Rebates_RebateTableHeaders_RebateTableHeaderDto as RebateTableHeaderDto } from "@ayasofyazilim/saas/ContractService"; -import { $UniRefund_ContractService_Rebates_RebateTableHeaders_RebateTableHeaderDto as $RebateTableHeaderDto } from "@ayasofyazilim/saas/ContractService"; -import type { TanstackTableCreationProps } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/types"; -import { tanstackTableCreateColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; -import { CheckCircle, PlusCircle, XCircle } from "lucide-react"; -import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; - -type RebateTableHeaders = TanstackTableCreationProps; -const booleanOptions = { - options: [ - { - value: "true", - label: "", - icon: CheckCircle, - iconClassName: "text-green-700", - }, - { - value: "false", - label: "", - icon: XCircle, - iconClassName: "text-red-700", - }, - ], -}; -const rebateTableHeadersColumns = ( - locale: string, - languageData: ContractServiceResource, -) => - tanstackTableCreateColumnsByRowData({ - rows: $RebateTableHeaderDto.properties, - languageData: { - constantKey: "Rebate.Form", - languageData, - }, - config: { - locale, - }, - links: { - name: { - prefix: `/settings/templates/rebate`, - targetAccessorKey: "id", - }, - }, - faceted: { - calculateNetCommissionInsteadOfRefund: booleanOptions, - }, - badges: { - name: { - values: [ - { - label: languageData["Rebate.Form.isTemplate"] || "Template", - conditions: [ - { - conditionAccessorKey: "isTemplate", - when: (value) => value === true, - }, - ], - }, - ], - }, - }, - }); - -const rebateTableHeadersTable = (params: { - languageData: ContractServiceResource; - router: AppRouterInstance; -}) => { - const table: RebateTableHeaders = { - fillerColumn: "name", - columnVisibility: { - type: "show", - columns: ["name", "calculateNetCommissionInsteadOfRefund"], - }, - tableActions: [ - { - actionLocation: "table", - type: "simple", - icon: PlusCircle, - onClick: () => { - params.router.push(`rebate/new`); - }, - cta: params.languageData["Rebate.Create"], - }, - ], - }; - return table; -}; - -export const tableData = { - rebateTableHeaders: { - columns: rebateTableHeadersColumns, - table: rebateTableHeadersTable, - }, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/table.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/table.tsx deleted file mode 100644 index 1030abf20..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/rebate/table.tsx +++ /dev/null @@ -1,29 +0,0 @@ -"use client"; -import type { PagedResultDto_RebateTableHeaderDto } from "@ayasofyazilim/saas/ContractService"; -import TanstackTable from "@repo/ayasofyazilim-ui/molecules/tanstack-table"; -import { useRouter } from "next/navigation"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; -import { tableData } from "./table-data"; - -export default function RebateTable({ - languageData, - templates, - lang, -}: { - languageData: ContractServiceResource; - templates: PagedResultDto_RebateTableHeaderDto; - lang: string; -}) { - const router = useRouter(); - const columns = tableData.rebateTableHeaders.columns(lang, languageData); - const table = tableData.rebateTableHeaders.table({ languageData, router }); - - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/[id]/form.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/[id]/form.tsx deleted file mode 100644 index b16d1f0e3..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/[id]/form.tsx +++ /dev/null @@ -1,47 +0,0 @@ -"use client"; -import type { UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderDto } 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/actions/core/api-utils-client"; -import { putRefundFeeHeadersApi } from "src/actions/unirefund/ContractService/put-actions"; -import type { ContractServiceResource } from "src/language-data/unirefund/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 ( - { - const formData = { - id: response.id, - requestBody: data.formData, - }; - void putRefundFeeHeadersApi(formData).then((res) => { - handlePutResponse(res, router); - }); - }} - schema={ - $UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderUpdateDto - } - submitText={languageData.Save} - uiSchema={uiSchema} - withScrollArea={false} - /> - ); -} - -export default Form; diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/[id]/page.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/[id]/page.tsx deleted file mode 100644 index e32e2f2bc..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/[id]/page.tsx +++ /dev/null @@ -1,45 +0,0 @@ -"use server"; -import { notFound } from "next/navigation"; -import { getRefundFeeHeadersByIdApi } from "src/actions/unirefund/ContractService/action"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/ContractService"; -import Form from "./form"; -import RefundFeeDetailsForm from "./table"; - -export default async function Page({ - params, -}: { - params: { lang: string; id: string }; -}) { - await isUnauthorized({ - requiredPolicies: [ - "ContractService.RefundFeeDetail.Create", - "ContractService.RefundFeeDetail.Edit", - "ContractService.RefundFeeDetail.Delete", - "ContractService.RefundFeeHeader.Create", - "ContractService.RefundFeeHeader.Edit", - "ContractService.RefundFeeHeader.Delete", - ], - lang: params.lang, - }); - - const response = await getRefundFeeHeadersByIdApi({ id: params.id }); - if (response.type !== "success") return notFound(); - - const { languageData } = await getResourceData(params.lang); - return ( - <> - - -
- {response.data.name} -
-
- {languageData["RefundTables.Edit.Description"]} -
- - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/[id]/table.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/[id]/table.tsx deleted file mode 100644 index c0739a6d5..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/[id]/table.tsx +++ /dev/null @@ -1,124 +0,0 @@ -"use client"; -import { - $UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailCreateByListDto, - $UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailDto, -} from "@ayasofyazilim/saas/ContractService"; -import type { - UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailDto, - 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/actions/core/api-utils-client"; -import { postRefundFeeHeadersRefundFeeDetailsApi } from "src/actions/unirefund/ContractService/post-actions"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; - -type TypeWithId = Type & { - id: IdType; -}; - -export default function RefundFeeDetailsForm({ - response, - languageData, -}: { - response: UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderDto; - languageData: ContractServiceResource; -}) { - const router = useRouter(); - const RebateFeeColumns = tanstackTableEditableColumnsByRowData< - TypeWithId - >({ - rows: { - ...$UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailDto.properties, - feeType: { - ...$UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailDto - .properties.feeType, - enum: $UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailDto.properties.feeType.enum.map( - (item) => ({ - value: item, - label: item, - }), - ), - }, - refundMethod: { - ...$UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailDto - .properties.refundMethod, - enum: $UniRefund_ContractService_Refunds_RefundFeeDetails_RefundFeeDetailDto.properties.refundMethod.enum.map( - (item) => ({ - value: item, - label: item, - }), - ), - }, - }, - }); - return ( - - >({ - 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", - }, - ], - columnVisibility: { - type: "hide", - columns: [ - "id", - "creationTime", - "creatorId", - "lastModificationTime", - "lastModifierId", - "isDeleted", - "deleterId", - "deletionTime", - "refundFeeHeaderId", - ], - }, - }), - }} - formData={response.refundFeeDetails || []} - onSubmit={(data) => { - const formData = data.formData; - - 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", - }} - /> - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/page.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/page.tsx deleted file mode 100644 index 7005b24b4..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/page.tsx +++ /dev/null @@ -1,35 +0,0 @@ -"use server"; - -import type { GetApiContractServiceRefundTablesRefundFeeHeadersData } from "@ayasofyazilim/saas/ContractService"; -import { notFound } from "next/navigation"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/ContractService"; -import { getRefundFeeHeadersApi } from "../../../../../../actions/unirefund/ContractService/action"; -import Table from "./table"; - -export default async function Page(props: { - params: { lang: string }; - searchParams: Promise; -}) { - await isUnauthorized({ - requiredPolicies: [ - "ContractService.RefundFeeHeader", - "ContractService.RefundFeeDetail", - ], - lang: props.params.lang, - }); - - const searchParams = await props.searchParams; - const response = await getRefundFeeHeadersApi(searchParams); - if (response.type !== "success") return notFound(); - - const { languageData } = await getResourceData(props.params.lang); - - return ( -
- ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/table-data.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/table-data.tsx deleted file mode 100644 index 35c886dae..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/table-data.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import type { - UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderCreateDto, - UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderDto, -} from "@ayasofyazilim/saas/ContractService"; -import { - $PagedResultDto_RefundFeeHeaderDto, - $UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderCreateDto, -} from "@ayasofyazilim/saas/ContractService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import type { - TanstackTableCreationProps, - TanstackTableLanguageDataType, -} from "@repo/ayasofyazilim-ui/molecules/tanstack-table/types"; -import { tanstackTableCreateColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; -import { CheckCircle, PlusCircle, XCircle } from "lucide-react"; -import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import { handlePostResponse } from "src/actions/core/api-utils-client"; -import { postRefundFeeHeadersApi } from "src/actions/unirefund/ContractService/post-actions"; - -type RefundFeeHeaders = - TanstackTableCreationProps; - -const booleanOptions = { - options: [ - { - value: "true", - label: "", - icon: CheckCircle, - iconClassName: "text-green-700", - }, - { - value: "false", - label: "", - icon: XCircle, - iconClassName: "text-red-700", - }, - ], -}; -const refundFeeHeadersColumns = ( - locale: string, - languageData?: TanstackTableLanguageDataType, -) => - tanstackTableCreateColumnsByRowData( - { - rows: $PagedResultDto_RefundFeeHeaderDto.properties.items.items - .properties, - languageData, - config: { - locale, - }, - faceted: { - isActive: booleanOptions, - }, - links: { - name: { - prefix: `refund-fees`, - targetAccessorKey: "id", - }, - }, - }, - ); - -const refundFeeHeadersTable = (params: { - languageData?: Record; - router: AppRouterInstance; -}) => { - const table: RefundFeeHeaders = { - fillerColumn: "name", - columnVisibility: { - type: "show", - columns: ["name", "creationTime", "isActive", "lastModificationTime"], - }, - columnOrder: ["name", "isActive", "creationTime", "lastModificationTime"], - tableActions: [ - { - type: "autoform-dialog", - actionLocation: "table", - cta: "New", - icon: PlusCircle, - submitText: "Save", - title: "Create", - onSubmit(row) { - void postRefundFeeHeadersApi({ - requestBody: - row as UniRefund_ContractService_Refunds_RefundFeeHeaders_RefundFeeHeaderCreateDto, - }).then((response) => { - handlePostResponse(response, params.router); - }); - }, - schema: createZodObject( - $UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderCreateDto, - ), - }, - ], - }; - return table; -}; - -export const tableData = { - refundFeeHeaders: { - columns: refundFeeHeadersColumns, - table: refundFeeHeadersTable, - }, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/table.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/table.tsx deleted file mode 100644 index 98b0d2987..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-fees/table.tsx +++ /dev/null @@ -1,37 +0,0 @@ -"use client"; -import type { PagedResultDto_RefundFeeHeaderDto } from "@ayasofyazilim/saas/ContractService"; -import TanstackTable from "@repo/ayasofyazilim-ui/molecules/tanstack-table"; -import { useRouter } from "next/navigation"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; -import { tableData } from "./table-data"; - -function Table({ - locale, - response, - languageData, -}: { - locale: string; - response: PagedResultDto_RefundFeeHeaderDto; - languageData: ContractServiceResource; -}) { - const router = useRouter(); - const columns = tableData.refundFeeHeaders.columns(locale, { - name: languageData.Name, - creationTime: languageData.CreationTime, - lastModificationTime: languageData.LastModificationTime, - isDefault: languageData.IsDefault, - isDeleted: languageData.IsDeleted, - isActive: languageData.IsActive, - }); - const table = tableData.refundFeeHeaders.table({ languageData, router }); - return ( - - ); -} - -export default Table; diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/[id]/form.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/[id]/form.tsx deleted file mode 100644 index 862e5c4a6..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/[id]/form.tsx +++ /dev/null @@ -1,46 +0,0 @@ -"use client"; -import type { UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderDto } from "@ayasofyazilim/saas/ContractService"; -import { $UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderUpdateDto } 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/actions/core/api-utils-client"; -import { putRefundTableHeadersApi } from "src/actions/unirefund/ContractService/put-actions"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; - -function Form({ - response, - languageData, -}: { - response: UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderDto; - languageData: ContractServiceResource; -}) { - const router = useRouter(); - const uiSchema = createUiSchemaWithResource({ - resources: languageData, - schema: - $UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderUpdateDto, - }); - return ( - { - const formData = { - id: response.id, - requestBody: data.formData, - }; - void putRefundTableHeadersApi(formData).then((res) => { - handlePutResponse(res, router); - }); - }} - schema={ - $UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderUpdateDto - } - submitText={languageData.Save} - uiSchema={uiSchema} - /> - ); -} - -export default Form; diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/[id]/page.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/[id]/page.tsx deleted file mode 100644 index 8beca75f9..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/[id]/page.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { notFound } from "next/navigation"; -import { getRefundTableHeadersById } from "src/actions/unirefund/ContractService/action"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/ContractService"; -import Form from "./form"; -import RefundTableDetailsForm from "./table"; - -export default async function Page({ - params, -}: { - params: { lang: string; id: string }; -}) { - await isUnauthorized({ - requiredPolicies: [ - "ContractService.RefundTableDetail.Create", - "ContractService.RefundTableDetail.Edit", - "ContractService.RefundTableDetail.Delete", - "ContractService.RefundTableHeader.Create", - "ContractService.RefundTableHeader.Edit", - "ContractService.RefundTableHeader.Delete", - ], - lang: params.lang, - }); - - const response = await getRefundTableHeadersById({ id: params.id }); - if (response.type !== "success") return notFound(); - - const { languageData } = await getResourceData(params.lang); - - return ( - <> - - -
- {response.data.name} -
-
- {languageData["RefundTables.Edit.Description"]} -
- - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/[id]/table.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/[id]/table.tsx deleted file mode 100644 index f387ac8e7..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/[id]/table.tsx +++ /dev/null @@ -1,86 +0,0 @@ -"use client"; -import type { - UniRefund_ContractService_Refunds_RefundTableDetails_RefundTableDetailCreateDto, - UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderDto, -} from "@ayasofyazilim/saas/ContractService"; -import { $UniRefund_ContractService_Refunds_RefundTableDetails_RefundTableDetailCreateByListDto } 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/actions/core/api-utils-client"; -import { postRefundTableHeadersRefundTableDetailsApi } from "src/actions/unirefund/ContractService/post-actions"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; - -type TypeWithId = Type & { - id: IdType; -}; - -export default function RefundTableDetailsForm({ - response, - languageData, -}: { - response: UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderDto; - languageData: ContractServiceResource; -}) { - const router = useRouter(); - const RebateTableColumns = tanstackTableEditableColumnsByRowData< - TypeWithId - >({ - rows: $UniRefund_ContractService_Refunds_RefundTableDetails_RefundTableDetailCreateByListDto - .properties.refundTableDetails.items.properties, - excludeColumns: ["extraProperties"], - }); - return ( - - >({ - editable: true, - columns: RebateTableColumns, - data: response.refundTableDetails || [], - fillerColumn: "id", - tableActions: [ - { - type: "create-row", - actionLocation: "table", - cta: languageData["Rebate.Form.rebateTableDetails.add"], - icon: PlusCircle, - }, - ], - rowActions: [ - { - actionLocation: "row", - cta: languageData["Rebate.Form.rebateTableDetails.delete"], - icon: Trash2, - type: "delete-row", - }, - ], - }), - }} - formData={response.refundTableDetails || []} - onSubmit={(data) => { - const formData = data.formData; - - void postRefundTableHeadersRefundTableDetailsApi({ - id: response.id, - requestBody: { - refundTableDetails: formData, - }, - }).then((res) => { - handlePostResponse(res, router); - }); - }} - schema={ - $UniRefund_ContractService_Refunds_RefundTableDetails_RefundTableDetailCreateByListDto - .properties.refundTableDetails - } - submitText={languageData["RefundTables.Create.Submit"]} - uiSchema={{ - "ui:field": "RebateTable", - }} - /> - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/page.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/page.tsx deleted file mode 100644 index 8ba3aaeb3..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/page.tsx +++ /dev/null @@ -1,35 +0,0 @@ -"use server"; - -import type { GetApiContractServiceRefundTablesRefundTableHeadersData } from "@ayasofyazilim/saas/ContractService"; -import { notFound } from "next/navigation"; -import { isUnauthorized } from "src/utils/page-policy/page-policy"; -import { getResourceData } from "src/language-data/unirefund/ContractService"; -import { getRefundTableHeadersApi } from "../../../../../../actions/unirefund/ContractService/action"; -import RefundTable from "./table"; - -export default async function Page(props: { - params: { lang: string }; - searchParams: Promise; -}) { - await isUnauthorized({ - requiredPolicies: [ - "ContractService.RefundTableHeader", - "ContractService.RefundTableDetail", - ], - lang: props.params.lang, - }); - - const searchParams = await props.searchParams; - const response = await getRefundTableHeadersApi(searchParams); - if (response.type !== "success") return notFound(); - - const { languageData } = await getResourceData(props.params.lang); - - return ( - - ); -} diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/table-data.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/table-data.tsx deleted file mode 100644 index b9c4383a1..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/table-data.tsx +++ /dev/null @@ -1,117 +0,0 @@ -import type { - UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderCreateDto, - UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderDto, -} from "@ayasofyazilim/saas/ContractService"; -import { - $PagedResultDto_RefundTableHeaderDto, - $UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderCreateDto, -} from "@ayasofyazilim/saas/ContractService"; -import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import type { - TanstackTableCreationProps, - TanstackTableLanguageDataType, -} from "@repo/ayasofyazilim-ui/molecules/tanstack-table/types"; -import { tanstackTableCreateColumnsByRowData } from "@repo/ayasofyazilim-ui/molecules/tanstack-table/utils"; -import { CheckCircle, PlusCircle, XCircle } from "lucide-react"; -import type { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import { handlePostResponse } from "src/actions/core/api-utils-client"; -import { postRefundTableHeadersApi } from "src/actions/unirefund/ContractService/post-actions"; - -type RefundTableHeaders = - TanstackTableCreationProps; - -const booleanOptions = { - options: [ - { - value: "true", - label: "", - icon: CheckCircle, - iconClassName: "text-green-700", - }, - { - value: "false", - label: "", - icon: XCircle, - iconClassName: "text-red-700", - }, - ], -}; -const refundTableHeadersColumns = ( - locale: string, - languageData?: TanstackTableLanguageDataType, -) => - tanstackTableCreateColumnsByRowData( - { - rows: $PagedResultDto_RefundTableHeaderDto.properties.items.items - .properties, - languageData, - config: { - locale, - }, - faceted: { - isDefault: booleanOptions, - isBundling: booleanOptions, - }, - links: { - name: { - prefix: `refund-tables`, - targetAccessorKey: "id", - }, - }, - }, - ); - -const refundTableHeadersTable = (params: { - languageData?: Record; - router: AppRouterInstance; -}) => { - const table: RefundTableHeaders = { - fillerColumn: "name", - columnVisibility: { - type: "show", - columns: [ - "name", - "creationTime", - "lastModificationTime", - "isDefault", - "isBundling", - ], - }, - columnOrder: [ - "name", - "creationTime", - "lastModificationTime", - "isDefault", - "isBundling", - ], - tableActions: [ - { - type: "autoform-dialog", - actionLocation: "table", - cta: "New", - icon: PlusCircle, - submitText: "Save", - title: "Create", - onSubmit(row) { - void postRefundTableHeadersApi({ - requestBody: - row as UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderCreateDto, - }).then((response) => { - handlePostResponse(response, params.router); - }); - }, - schema: createZodObject( - $UniRefund_ContractService_Refunds_RefundTableHeaders_RefundTableHeaderCreateDto, - ), - }, - ], - }; - return table; -}; - -export const tableData = { - refundTableHeaders: { - columns: refundTableHeadersColumns, - table: refundTableHeadersTable, - }, -}; diff --git a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/table.tsx b/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/table.tsx deleted file mode 100644 index 472e66f5a..000000000 --- a/apps/web/src/app/[lang]/(unirefund)/settings/templates/refund-tables/table.tsx +++ /dev/null @@ -1,37 +0,0 @@ -"use client"; -import type { PagedResultDto_RefundTableHeaderDto } from "@ayasofyazilim/saas/ContractService"; -import TanstackTable from "@repo/ayasofyazilim-ui/molecules/tanstack-table"; -import { useRouter } from "next/navigation"; -import type { ContractServiceResource } from "src/language-data/unirefund/ContractService"; -import { tableData } from "./table-data"; - -function RefundTable({ - locale, - response, - languageData, -}: { - locale: string; - response: PagedResultDto_RefundTableHeaderDto; - languageData: ContractServiceResource; -}) { - const router = useRouter(); - const columns = tableData.refundTableHeaders.columns(locale, { - name: languageData.Name, - creationTime: languageData.CreationTime, - lastModificationTime: languageData.LastModificationTime, - isDefault: languageData.IsDefault, - isDeleted: languageData.IsDeleted, - isActive: languageData.IsActive, - }); - const table = tableData.refundTableHeaders.table({ languageData, router }); - return ( - - ); -} - -export default RefundTable; diff --git a/apps/web/src/language-data/unirefund/CRMService/index.ts b/apps/web/src/language-data/unirefund/CRMService/index.ts deleted file mode 100644 index 81f40c911..000000000 --- a/apps/web/src/language-data/unirefund/CRMService/index.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { getLocalizationResources } from "src/utils"; -import defaultEn from "../../core/Default/resources/en.json"; -import defaultTr from "../../core/Default/resources/tr.json"; -import en from "./resources/en.json"; -import tr from "./resources/tr.json"; - -export type CRMServiceServiceResource = typeof en & typeof defaultEn; -function getLanguageData(lang: string): CRMServiceServiceResource { - if (lang === "tr") { - return { - ...defaultTr, - ...tr, - }; - } - return { - ...defaultEn, - ...en, - }; -} -export async function getResourceData(lang: string) { - const resources = await getLocalizationResources(lang); - const languageData = getLanguageData(lang); - return { - languageData, - resources, - }; -} -export function getResourceDataClient(lang: string) { - const languageData = getLanguageData(lang); - return languageData; -} diff --git a/apps/web/src/language-data/unirefund/CRMService/resources/en.json b/apps/web/src/language-data/unirefund/CRMService/resources/en.json deleted file mode 100644 index def86414c..000000000 --- a/apps/web/src/language-data/unirefund/CRMService/resources/en.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "Merchants": "Merchants", - "Merchants.Description": "You can view stores from here.", - "Merchant.Select": "Select Merchant", - - "Merchants.New": "New Merchant", - "Merchants.New.Description": "You can create a new store from here.", - "Merchants.New.Success": "Store created successfully.", - "Merchants.New.Fail": "An error occurred while creating the store.", - - "Merchants.Edit": "Edit Merchant", - "Merchants.Edit.Description": "You can update the store's details from here.", - "Merchants.Edit.Success": "Store updated successfully.", - "Merchants.Edit.Fail": "An error occurred while updating the store.", - - "Merchants.Fetch.Success": "Merchants fetched successfully.", - "Merchants.Fetch.Fail": "An error occurred while fetching merchants.", - - "Merchants.SubOrganization": "Sub Stores", - "Merchants.SubOrganization.Description": "You can view sub stores related to the main store from here.", - "Merchants.SubOrganization.New": "New Sub Store", - "Merchants.SubOrganization.New.Description": "You can create a new sub store for the main store from here.", - - "RefundPoints": "Refund Points", - "RefundPoints.Description": "You can view refund points from here.", - - "RefundPoints.New": "New Refund Point", - "RefundPoints.New.Description": "You can create a new refund point from here.", - "RefundPoints.New.Success": "Refund point created successfully.", - "RefundPoints.New.Fail": "An error occurred while creating the refund point.", - - "RefundPoints.Edit": "Edit Refund Point", - "RefundPoints.Edit.Description": "You can update the refund point's details from here.", - "RefundPoints.Edit.Success": "Refund point updated successfully.", - "RefundPoints.Edit.Fail": "An error occurred while updating the refund point.", - - "TaxFree": "Tax Free", - "TaxFree.Description": "You can view Tax Free services from here.", - - "TaxFree.New": "New Tax Free", - "TaxFree.New.Description": "You can create a new Tax Free service from here.", - "TaxFree.New.Success": "Tax Free service created successfully.", - "TaxFree.New.Fail": "An error occurred while creating the Tax Free service.", - - "TaxFree.Edit": "Edit Tax Free", - "TaxFree.Edit.Description": "You can update the details of the Tax Free service from here.", - "TaxFree.Edit.Success": "Tax Free service updated successfully.", - "TaxFree.Edit.Fail": "An error occurred while updating the Tax Free service.", - - "Customs": "Customs", - "Customs.Description": "You can view customs information from here.", - - "Customs.New": "New Custom", - "Customs.New.Description": "You can create a new customs record from here.", - "Customs.New.Success": "Customs record created successfully.", - "Customs.New.Fail": "An error occurred while creating the customs record.", - - "Customs.Edit": "Edit Custom", - "Customs.Edit.Description": "You can update customs details from here.", - "Customs.Edit.Success": "Customs updated successfully.", - "Customs.Edit.Fail": "An error occurred while updating customs.", - - "TaxOffices": "Tax Offices", - "TaxOffices.Description": "You can view tax offices from here.", - - "TaxOffices.New": "New Tax Office", - "TaxOffices.New.Description": "You can create a new tax office record from here.", - "TaxOffices.New.Success": "Tax office created successfully.", - "TaxOffices.New.Fail": "An error occurred while creating the tax office.", - - "TaxOffices.Edit": "Edit Tax Office", - "TaxOffices.Edit.Description": "You can update the details of the tax office from here.", - "TaxOffices.Edit.Success": "Tax office updated successfully.", - "TaxOffices.Edit.Fail": "An error occurred while updating the tax office.", - - "Individuals": "Individuals", - "Individuals.New": "New Individual", - "Individuals.Description": "Add New Individual", - - "Parties.Organization": "Organization", - - "Contracts": "Contracts", - "Contracts.New": "New Contract", - - "NoIndividualFound": "No individual found.", - "Role": "Role" -} diff --git a/apps/web/src/language-data/unirefund/CRMService/resources/tr.json b/apps/web/src/language-data/unirefund/CRMService/resources/tr.json deleted file mode 100644 index 0c01e3ccb..000000000 --- a/apps/web/src/language-data/unirefund/CRMService/resources/tr.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "Merchants": "Mağazalar", - "Merchants.Description": "Mağazaları buradan görüntüleyebilirsiniz.", - "Merchant.Select": "Mağaza seç", - - "Merchants.New": "Yeni Mağaza", - "Merchants.New.Description": "Buradan yeni mağaza oluşturabilirsiniz.", - "Merchants.New.Success": "Mağaza başarıyla oluşturuldu.", - "Merchants.New.Fail": "Mağaza oluşturulurken bir hata oluştu.", - - "Merchants.Edit": "Mağazayı Düzenle", - "Merchants.Edit.Description": "Mağazanın detaylarını buradan güncelleyebilirsiniz.", - "Merchants.Edit.Success": "Mağaza başarıyla güncellendi.", - "Merchants.Edit.Fail": "Mağaza güncellenirken bir hata oluştu.", - - "Merchants.Fetch.Success": "Mağazalar basarıyla getirildi.", - "Merchants.Fetch.Fail": "Mağazalar getirilirken bir hata oluştu.", - - "Merchants.SubOrganization": "Alt Mağazalar", - "Merchants.SubOrganization.Description": "Buradan mağazaya bağlı alt mağazaları görüntüleyebilirsiniz.", - "Merchants.SubOrganization.New": "Yeni Alt Mağaza", - "Merchants.SubOrganization.New.Description": "Buradan mağazaya yeni alt mağaza oluşturabilirsiniz.", - - "RefundPoints": "İade Noktaları", - "RefundPoints.Description": "İade noktalarını buradan görüntüleyebilirsiniz.", - - "RefundPoints.New": "Yeni İade Noktası", - "RefundPoints.New.Description": "Buradan yeni bir iade noktası oluşturabilirsiniz.", - "RefundPoints.New.Success": "İade noktası başarıyla oluşturuldu.", - "RefundPoints.New.Fail": "İade noktası oluşturulurken bir hata oluştu.", - - "RefundPoints.Edit": "İade Noktasını Düzenle", - "RefundPoints.Edit.Description": "İade noktasının detaylarını buradan güncelleyebilirsiniz.", - "RefundPoints.Edit.Success": "İade noktası başarıyla güncellendi.", - "RefundPoints.Edit.Fail": "İade noktası güncellenirken bir hata oluştu.", - - "TaxFree": "Tax Free", - "TaxFree.Description": "Tax Free hizmetlerini buradan görüntüleyebilirsiniz.", - - "TaxFree.New": "Yeni Tax Free", - "TaxFree.New.Description": "Buradan yeni bir Tax Free hizmeti oluşturabilirsiniz.", - "TaxFree.New.Success": "Tax Free hizmeti başarıyla oluşturuldu.", - "TaxFree.New.Fail": "Tax Free hizmeti oluşturulurken bir hata oluştu.", - - "TaxFree.Edit": "Tax Free'yi Düzenle", - "TaxFree.Edit.Description": "Tax Free hizmetinin detaylarını buradan güncelleyebilirsiniz.", - "TaxFree.Edit.Success": "Tax Free hizmeti başarıyla güncellendi.", - "TaxFree.Edit.Fail": "Tax Free hizmeti güncellenirken bir hata oluştu.", - - "Customs": "Gümrükler", - "Customs.Description": "Gümrük bilgilerini buradan görüntüleyebilirsiniz.", - - "Customs.New": "Yeni Gümrük", - "Customs.New.Description": "Buradan yeni bir gümrük kaydı oluşturabilirsiniz.", - "Customs.New.Success": "Gümrük kaydı başarıyla oluşturuldu.", - "Customs.New.Fail": "Gümrük kaydı oluşturulurken bir hata oluştu.", - - "Customs.Edit": "Gümrüğü Düzenle", - "Customs.Edit.Description": "Gümrük detaylarını buradan güncelleyebilirsiniz.", - "Customs.Edit.Success": "Gümrük başarıyla güncellendi.", - "Customs.Edit.Fail": "Gümrük güncellenirken bir hata oluştu.", - - "TaxOffices": "Vergi Ofisleri", - "TaxOffices.Description": "Vergi ofislerini buradan görüntüleyebilirsiniz.", - - "TaxOffices.New": "Yeni Vergi Ofisi", - "TaxOffices.New.Description": "Buradan yeni bir vergi ofisi kaydı oluşturabilirsiniz.", - "TaxOffices.New.Success": "Vergi ofisi başarıyla oluşturuldu.", - "TaxOffices.New.Fail": "Vergi ofisi oluşturulurken bir hata oluştu.", - - "TaxOffices.Edit": "Vergi Ofisini Düzenle", - "TaxOffices.Edit.Description": "Vergi ofisinin detaylarını buradan güncelleyebilirsiniz.", - "TaxOffices.Edit.Success": "Vergi ofisi başarıyla güncellendi.", - "TaxOffices.Edit.Fail": "Vergi ofisi güncellenirken bir hata oluştu.", - - "Individuals": "Bireyler", - "Individuals.New": "Yeni Birey", - "Individuals.Description": "Yeni Birey Ekle", - - "Parties.Organization": "Organizasyon", - - "Contracts": "Sözleşmeler", - "Contracts.New": "Yeni sözleşme", - - "NoIndividualFound": "Böyle bir birey bulunamadı.", - "Role": "Rol" -} diff --git a/apps/web/src/language-data/unirefund/ContractService/index.ts b/apps/web/src/language-data/unirefund/ContractService/index.ts deleted file mode 100644 index 403ba1b75..000000000 --- a/apps/web/src/language-data/unirefund/ContractService/index.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { getLocalizationResources } from "src/utils"; -import defaultEn from "../../core/Default/resources/en.json"; -import defaultTr from "../../core/Default/resources/tr.json"; -import en from "./resources/en.json"; -import tr from "./resources/tr.json"; - -export type ContractServiceResource = typeof en & typeof defaultEn; -function getLanguageData(lang: string): ContractServiceResource { - if (lang === "tr") { - return { - ...defaultTr, - ...tr, - }; - } - return { - ...defaultEn, - ...en, - }; -} -export async function getResourceData(lang: string) { - const resources = await getLocalizationResources(lang); - const languageData = getLanguageData(lang); - return { - languageData, - resources, - }; -} -export function getResourceDataClient(lang: string) { - const languageData = getLanguageData(lang); - return languageData; -} diff --git a/apps/web/src/language-data/unirefund/ContractService/resources/en.json b/apps/web/src/language-data/unirefund/ContractService/resources/en.json deleted file mode 100644 index 9f914656b..000000000 --- a/apps/web/src/language-data/unirefund/ContractService/resources/en.json +++ /dev/null @@ -1,304 +0,0 @@ -{ - "Contracts.Contract": "Contract", - "Contracts.RebateSettings": "Rebate settings", - "Contracts.Stores": "Stores", - "Contracts.ContractSettings": "Contract settings", - - "Refund": "Refund", - "RefundTables": "Refund tables", - - "Contracts.Create.Step.Next": "Next", - "Contracts.Create.Step.Previous": "Previous", - "Contracts.Create.Step.Submit": "Submit", - "Contracts.Create.Step.Merchant": "Select Merchant", - "Contracts.Create.Step.SelectMerchant": "Select merchant", - - "Contracts.Create.Title": "New contract", - "Contracts.Create.Description": "Create a new contract", - "Contracts.Create.Submit": "Save", - - "Contracts.Edit.Title": "Edit contract", - "Contracts.Edit.Description": "Edit selected contract", - "Contracts.Edit.Submit": "Save", - - "Contracts.Create.ContractHeader": "Contract", - "Contracts.Create.RebateSettings": "Rebate settings", - "Contracts.Create.Stores": "Stores", - "Contracts.Create.ContractSettings": "Contract settings", - - "Contracts.Create.Success": "Contract created.", - "Contracts.Create.Fail": "Contract creation failed.", - "Contracts.Update.Success": "Contract updated.", - "Contracts.Update.Fail": "Contract update failed.", - "Contracts.MissingSteps.Fail": "Failed to fetch missing steps.", - "Contracts.MissingSteps.Missing": "This step is not completed yet.", - - "Contracts.name": "Contract Name", - "Contracts.validFrom": "Begin Date", - "Contracts.validTo": "End Date", - "Contracts.draft": "Draft", - "Contracts.active": "Active", - - "Contracts.Actions.Validate": "Validate", - "Contracts.Actions.Validate.Success": "Contract validated successfully.", - "Contracts.Actions.Delete": "Delete", - "Contracts.Actions.Delete.Title": "Delete contract", - "Contracts.Actions.Delete.Description": "Are you sure you want to delete this contract?", - "Contracts.Actions.CheckMissingSteps": "Check Missing Steps", - "Contracts.Actions.CheckMissingSteps.Success": "Congratulations! No missing steps found.", - - "Contracts.Form.webSite": "Web Site", - "Contracts.Form.status": "Status", - "Contracts.Form.status.none": "-", - "Contracts.Form.status.registered": "Registered", - "Contracts.Form.status.deRegistrationRequestedByUniRefund": "De-registration requested by Unirefund", - "Contracts.Form.status.deRegistrationRequestedByAuthories": "De-registration requested by authorities", - "Contracts.Form.status.suspendedInternallyAfterDeRegistrationDecline": "Suspended internally after de-registration decline", - "Contracts.Form.status.deRegisteredAtAuthorities": "De-Registered at authorities", - "Contracts.Form.status.SuspendedInternallyOnly": "Suspended internally only", - "Contracts.Form.status.SuspensionRequestedByUniRefund": "Suspension requested by Unirefund", - "Contracts.Form.status.SuspensionRequestedByAuthorities": "Suspension requested by authorities", - "Contracts.Form.status.UnSuspensionRequestedByUniRefund": "Un-suspension requested by Unirefund", - "Contracts.Form.status.UnSuspensionRequestedByAuthorities": "Un-suspension requested by authorities", - "Contracts.Form.status.SuspendedAtAuthorities": "Suspended at authorities", - "Contracts.Form.status.UnSuspensionForFurtherDeRegistrationInvitedByAuthorities": "Un-suspension for further de-registration invited by authorities", - "Contracts.Form.status.UnSuspensionForFurtherDeRegistrationRequestedByUniRefund": "Un-suspension for further de-registration requested by Unirefund", - "Contracts.Form.status.Terminated": "Terminated", - - "Contracts.Form.merchantClassification": "Merchant Classification", - "Contracts.Form.merchantClassification.ui:placeholder": "Please select an merchant classification", - "Contracts.Form.merchantClassification.excellent": "Excellent", - "Contracts.Form.merchantClassification.good": "Good", - "Contracts.Form.merchantClassification.satisfactory": "Satisfactory", - "Contracts.Form.merchantClassification.low": "Low", - "Contracts.Form.validFrom.ui:placeholder": "From this date", - "Contracts.Form.validTo.ui:placeholder": "To this date", - "Contracts.Form.validFrom": "Begin date", - "Contracts.Form.validTo": "End date", - - "Contracts.Form.addressCommonDataId": "Address", - "Contracts.Form.addressCommonDataId.emptyValue": "Please select an address", - "Contracts.Form.addressCommonDataId.searchPlaceholder": "Search for an address", - "Contracts.Form.addressCommonDataId.searchResultLabel": "There is no address with that value.", - "Contracts.Form.defaultRefundTableHeader": "Default refund table", - "Contracts.Form.defaultRefundTableHeader.undefined": "Please select a default refund table header", - "Contracts.Form.refundTableHeaders": "Refund tables", - "Contracts.Form.refundTableHeaders.refundTableHeaderId": "Refund table", - "Contracts.Form.refundTableHeaders.refundTableHeaderId.emptyValue": "Please select an refund table", - "Contracts.Form.refundTableHeaders.refundTableHeaderId.searchPlaceholder": "Search for an refund table", - "Contracts.Form.refundTableHeaders.refundTableHeaderId.searchResultLabel": "There is no refund table with that value.", - "Contracts.Form.refundTableHeaders.isDefault": "Default", - "Contracts.Form.refundTableHeaders.edit": "Edit", - "Contracts.Form.refundTableHeaders.validFrom": "Begin Date", - "Contracts.Form.refundTableHeaders.validTo": "End Date", - - "Contracts.Form.defaultRefundFeeHeader": "Default refund fee", - "Contracts.Form.defaultRefundFeeHeader.undefined": "Please select a default refund fee header", - "Contracts.Form.refundFeeHeaders": "Refund fees", - "Contracts.Form.refundFeeHeaders.refundFeeHeaderId": "Refund fee", - "Contracts.Form.refundFeeHeaders.refundFeeHeaderId.emptyValue": "Please select an refund fee", - "Contracts.Form.refundFeeHeaders.refundFeeHeaderId.searchPlaceholder": "Search for an refund fee", - "Contracts.Form.refundFeeHeaders.refundFeeHeaderId.searchResultLabel": "There is no refund fee with that value.", - "Contracts.Form.refundFeeHeaders.isDefault": "Default", - "Contracts.Form.refundFeeHeaders.edit": "Edit", - "Contracts.Form.refundFeeHeaders.validFrom": "Begin Date", - "Contracts.Form.refundFeeHeaders.validTo": "End Date", - - "Contracts.Settings.Form.Add": "Add contract setting", - "Contracts.Settings.Form.Delete": "Delete", - "Contracts.Settings.Form.Delete.Title": "Delete contract setting", - "Contracts.Settings.Form.Delete.Description": "Are you sure you want to delete this setting?", - "Contracts.Settings.Form.name": "Setting name", - "Contracts.Settings.Form.referenceNumber": "Reference number", - "Contracts.Settings.Form.termOfPayment": "Payment term", - "Contracts.Settings.Form.invoicingFrequency": "Invoicing frequency", - "Contracts.Settings.Form.invoicingFrequency.ui:placeholder": "Select invoicing frequency", - "Contracts.Settings.Form.invoicingFrequency.oneTimePerMonth": "One time a month", - "Contracts.Settings.Form.invoicingFrequency.twoTimesPerMonth": "Two times a month", - "Contracts.Settings.Form.invoiceChannel": "Invoice channel", - "Contracts.Settings.Form.invoiceChannel.ui:placeholder": "Select invoice channel", - "Contracts.Settings.Form.invoiceChannel.electronicInvoice": "Electronic invoice", - "Contracts.Settings.Form.invoiceChannel.paperInvoice": "Paper invoice", - "Contracts.Settings.Form.invoiceChannel.email": "Email", - "Contracts.Settings.Form.invoicingAddressCommonDataId": "Invoicing address", - "Contracts.Settings.Form.invoicingAddressCommonDataId.emptyValue": "Please select an invoicing address", - "Contracts.Settings.Form.invoicingAddressCommonDataId.searchPlaceholder": "Search invoicing address", - "Contracts.Settings.Form.invoicingAddressCommonDataId.searchResultLabel": "No invoicing address found.", - "Contracts.Settings.Form.receiptType": "Receipt type", - "Contracts.Settings.Form.receiptType.ui:placeholder": "Select receipt type", - "Contracts.Settings.Form.receiptType.none": "-", - "Contracts.Settings.Form.receiptType.noBarcodeNumber": "No barcode number", - "Contracts.Settings.Form.receiptType.noBarcodeText": "No barcode text", - "Contracts.Settings.Form.receiptType.barcode": "Barcode", - "Contracts.Settings.Form.receiptType.qrCodeIntegration": "QR Code integration", - "Contracts.Settings.Form.receiptType.uniRefundVoucherIntegration": "Unirefund voucher integration", - "Contracts.Settings.Form.isDefault": "Default", - "Contracts.Settings.Form.eTaxFree": "Electronic tax free", - "Contracts.Settings.Form.crossTaxFreeForm": "Cross tax free form", - "Contracts.Settings.Form.facturaNumberIsUnique": "Unique factura number", - "Contracts.Settings.Form.excludeFromCashLimit": "Exclude from cash limit", - "Contracts.Settings.Form.deskoScanner": "Desko scanner", - "Contracts.Settings.Form.deliveryFee": "Delivery fee", - "Contracts.Settings.Form.goodsHaveSerialNumbers": "Goods have serial numbers", - "Contracts.Settings.Form.factoring": "Factoring", - "Contracts.Settings.Form.setIsDefault": "Set as Default", - - "Contracts.Settings.SetIsDefault.Success": "Contract setting successfully set.", - "Contracts.Settings.SetIsDefault.Fail": "Contract setting could not be set as default.", - "Contracts.Settings.Delete.Success": "Contract setting deleted successfully.", - "Contracts.Settings.Delete.Fail": "Error while deleting contract setting.", - "Contracts.Settings.Create.Success": "Contract setting created successfully.", - "Contracts.Settings.Create.Fail": "Error while creating contract setting.", - "Contracts.Settings.Edit.Success": "Contract setting saved successfully.", - "Contracts.Settings.Edit.Fail": "Error while saving contract setting.", - - "Contracts.Stores.name": "Store name", - "Contracts.Stores.fullAddress": "Full address", - "Contracts.Stores.manager": "Manager", - "Contracts.Stores.contractSettingId": "Contract setting", - "Contracts.Stores.receiptType": "Receipt type", - "Contracts.Stores.receiptType.None": "-", - "Contracts.Stores.receiptType.NoBarcodeNumber": "No barcode number", - "Contracts.Stores.receiptType.NoBarcodeText": "No barcode text", - "Contracts.Stores.receiptType.Barcode": "Barcode", - "Contracts.Stores.receiptType.QRCodeIntegration": "QR Code integration", - "Contracts.Stores.receiptType.UniRefundVoucherIntegration": "Unirefund voucher integration", - "Contracts.Stores.Save.Title": "Overwrite settings", - "Contracts.Stores.Save.Description": "You are about to overwrite settings for stores. Are you sure you want to continue?", - "Contracts.Stores.Save.Success": "Settings overwritten successfully.", - "Contracts.Stores.Save.Fail": "Error while overwriting settings.", - - "RefundTables.Title": "Refund tables", - "RefundTables.Description": "Manage refund tables", - - "RefundTables.Create.Title": "New refund table", - "RefundTables.Create.Description": "Create a new refund table", - "RefundTables.Create.Submit": "Submit", - - "RefundTables.Edit.Title": "Edit refund table", - "RefundTables.Edit.Description": "Edit selected refund table", - "RefundTables.Edit.Submit": "Submit", - - "RefundTables.Delete.Title": "Delete refund table", - "RefundTables.Delete.Description": "Are you sure you want to delete this refund table?", - "RefundTables.Delete.Cancel": "Cancel", - "RefundTables.Delete.Continue": "Continue", - - "RefundTables.Details": "Details", - "RefundTables.Details.FilterBy {0}": "Filter by {}", - "RefundTables.Details.Save": "Save", - "RefundTables.Details.Delete": "Delete", - "RefundTables.Details.Create.Title": "Create Rule Set", - "RefundTables.Details.Create.Description": "Create a new rule set", - "RefundTables.Details.Create.Submit": "Submit", - "RefundTables.Details.Edit.Title": "Edit rule", - "RefundTables.Details.Edit.Description": "Edit selected rule", - "RefundTables.Details.Delete.Confirm": "Are you sure you want to delete this rule?", - "RefundTables.Details.Delete.Confirm.Title": "Delete rule", - - "RefundTables.Name": "Name", - "RefundTables.ValidFrom": "Valid from", - "RefundTables.ValidTo": "Valid to", - "RefundTables.IsDefault": "Is default", - "RefundTables.IsBundling": "Is bundling", - "RefundTables.LastModificationTime": "Last modification time", - "RefundTables.Actions": "Actions", - "RefundTables.Edit": "Edit", - "RefundTables.Delete": "Delete", - "RefundTables.Cancel": "Cancel", - "RefundTables.Save": "Save", - - "RefundFees.Page.List.Title": "Refund Fees", - "RefundFees.Page.List.Description": "Manage refund fees", - "RefundFees.Page.List.Create": "Create new", - "RefundFees.Page.List.Details": "Details", - "RefundFees.Page.List.Deactivate": "Deactivate", - "RefundFees.Page.List.Create.Save": "Save", - - "RefundFees.Page.Edit.Edit": "Edit", - "RefundFees.Page.Edit.Preview": "Preview", - "RefundFees.Page.Edit.Title": "Edit refund fee {0}", - "RefundFees.Page.Edit.Description": "Edit refund fee", - "RefundFees.Page.Edit.Delete": "Delete", - "RefundFees.Page.Edit.Delete.Title": "Delete refund fee", - "RefundFees.Page.Edit.Delete.Description": "Are you sure you want to delete this refund fee?", - "RefundFees.Page.Edit.Delete.Cancel": "Cancel", - "RefundFees.Page.Edit.Delete.Confirm": "Confirm", - "RefundFees.Page.Edit.Save": "Save", - - "RefundFees.Page.Edit.Fee.Edit": "Edit", - "RefundFees.Page.Edit.Fee.Edit.Title": "Edit refund fee setup", - "RefundFees.Page.Edit.Fee.Edit.Description": "Edit refund fee setup", - "RefundFees.Page.Edit.Fee.Edit.Save": "Save", - - "RefundFees.Page.Edit.Fee.Create": "Create new", - "RefundFees.Page.Edit.Fee.Create.Title": "New refund fee setup", - "RefundFees.Page.Edit.Fee.Create.Description": "Create new refund fee setup", - "RefundFees.Page.Edit.Fee.Create.Save": "Save", - - "RefundFees.Page.Edit.Fee.Delete": "Delete", - - "Rebate.Delete": "Delete", - - "Rebate.Create": "Create", - "Rebate.Create.Submit": "Create", - "Rebate.Create.Success": "Rebate table created successfully.", - "Rebate.Create.Fail": "Error while creating rebate table.", - "Rebate.Update.Submit": "Save", - "Rebate.Update.Success": "Rebate table updated successfully.", - "Rebate.Update.Fail": "Error while updating rebate table.", - - "Rebate.Add.Submit": "Add", - - "Rebate.Preview": "Preview", - "Rebate.Preview.Calculate": "Calculate", - - "Rebate.Form.name": "Rebate table name", - "Rebate.Form.isTemplate": "Template", - "Rebate.Form.rebateTableDetails": "Rebate table details", - "Rebate.Form.rebateTableDetails.add": "Add rebate table detail", - "Rebate.Form.rebateTableDetails.delete": "Delete", - "Rebate.Form.rebateTableDetails.fixedFeeValue": "Fixed fee", - "Rebate.Form.rebateTableDetails.percentFeeValue": "Percent", - "Rebate.Form.rebateTableDetails.refundMethod": "Refund method", - "Rebate.Form.rebateTableDetails.variableFee": "Variable fee", - "Rebate.Form.processingFeeDetails": "Processing fee details", - "Rebate.Form.processingFeeDetails.add": "Add processing fee detail", - "Rebate.Form.processingFeeDetails.delete": "Delete", - "Rebate.Form.processingFeeDetails.name": "Processing fee name", - "Rebate.Form.processingFeeDetails.amount": "Amount", - "Rebate.Form.calculateNetCommissionInsteadOfRefund": "Calculate net commission instead of refund", - "Rebate.Form.validFrom": "Valid from", - "Rebate.Form.validTo": "Valid to", - - "Rebate.Form.referenceNumber": "Reference number", - "Rebate.Form.isTrustedMerchant": "Trusted merchant", - "Rebate.Form.rebateStatementPeriod": "Rebate statement period", - "Rebate.Form.rebateStatementPeriod.ui:placeholder": "Please select an rebate statement period", - "Rebate.Form.rebateStatementPeriod.None": "-", - "Rebate.Form.rebateStatementPeriod.Monthly": "Monthly", - "Rebate.Form.rebateStatementPeriod.Quarterly": "Quarterly", - "Rebate.Form.rebateStatementPeriod.BiAnnualy": "Bi-annualy", - "Rebate.Form.rebateStatementPeriod.Annualy": "Annualy", - - "Rebate.Form.rebateTableHeadersFromTemplate": "Rebate table headers from template", - "Rebate.Form.rebateTableHeadersFromTemplate.title": "Please select an rebate table header template", - "Rebate.Form.rebateTableHeadersFromTemplate.id": "Rebate table headers from template", - "Rebate.Form.rebateTableHeadersFromTemplate.id.emptyValue": "Please select an rebate table", - "Rebate.Form.rebateTableHeadersFromTemplate.id.searchPlaceholder": "Search for an rebate table", - "Rebate.Form.rebateTableHeadersFromTemplate.id.searchResultLabel": "There is no rebate table with that value.", - "Rebate.Form.rebateTableHeadersFromTemplate.validFrom": "Valid from", - "Rebate.Form.rebateTableHeadersFromTemplate.validTo": "Valid to", - "Rebate.Form.contactInformationTypeId": "Contact information type", - "Rebate.Form.minimumNetCommissions": "Minimum net commissions", - "Rebate.Form.minimumNetCommissions.title": "You can add minimum net commission from here", - "Rebate.Form.minimumNetCommissions.amount": "Minimum net commission amount", - "Rebate.Form.minimumNetCommissions.validFrom": "Valid from", - "Rebate.Form.minimumNetCommissions.validTo": "Valid to", - "Rebate.Form.minimumNetCommissions.appliedOrganizationId": "Applied organization", - "Rebate.Form.minimumNetCommissions.appliedOrganizationId.emptyValue": "Please select an organization", - "Rebate.Form.minimumNetCommissions.appliedOrganizationId.searchPlaceholder": "Search for an organization", - "Rebate.Form.minimumNetCommissions.appliedOrganizationId.searchResultLabel": "There is no organization with that value.", - "Rebate.Form.rebateTableHeaders": "Rebate table headers", - "Rebate.Form.rebateTableHeaders.title": "You can create rebate table template from here" -} diff --git a/apps/web/src/language-data/unirefund/ContractService/resources/tr.json b/apps/web/src/language-data/unirefund/ContractService/resources/tr.json deleted file mode 100644 index 60e0585ec..000000000 --- a/apps/web/src/language-data/unirefund/ContractService/resources/tr.json +++ /dev/null @@ -1,304 +0,0 @@ -{ - "Contracts.Contract": "Sözleşme", - "Contracts.RebateSettings": "Komisyon ayarları", - "Contracts.Stores": "Mağazalar", - "Contracts.ContractSettings": "Sözleşme ayarları", - - "Refund": "İade", - "RefundTables": "İade Tabloları", - - "Contracts.Create.Step.Next": "Sonraki", - "Contracts.Create.Step.Previous": "Önceki", - "Contracts.Create.Step.Submit": "Kaydet", - "Contracts.Create.Step.Merchant": "Mağaza Seçin", - "Contracts.Create.Step.SelectMerchant": "Mağaza Seçin", - - "Contracts.Create.Title": "Yeni sözleşme", - "Contracts.Create.Description": "Yeni bir sözleşme oluşturun", - "Contracts.Create.Submit": "Kaydet", - - "Contracts.Edit.Title": "Sözleşmeyi düzenle", - "Contracts.Edit.Description": "Seçili sözleşmeyi düzenle", - "Contracts.Edit.Submit": "Güncelle", - - "Contracts.Create.ContractHeader": "Sözleşme", - "Contracts.Create.RebateSettings": "Komisyon ayarları", - "Contracts.Create.Stores": "Mağazalar", - "Contracts.Create.ContractSettings": "Sözleşme ayarları", - - "Contracts.Create.Success": "Sözleşme oluşturuldu.", - "Contracts.Create.Fail": "Sözleşme oluşturulurken bir hata oluştu.", - "Contracts.Update.Success": "Sözleşme güncellendi.", - "Contracts.Update.Fail": "Sözleşme güncellenirken bir hata oluştu.", - "Contracts.MissingSteps.Fail": "Gerekli adımlar alınırken bir hata oluştu.", - "Contracts.MissingSteps.Missing": "Bu adım henüztamamlanmamış.", - - "Contracts.name": "Kontrat Adı", - "Contracts.validFrom": "Başlangıç Tarihi", - "Contracts.validTo": "Bitiş Tarihi", - "Contracts.draft": "Taslak", - "Contracts.active": "Aktif", - - "Contracts.Actions.Validate": "Doğrula", - "Contracts.Actions.Validate.Success": "Sözleşme basarıyla doğrulandı.", - "Contracts.Actions.Delete": "Sil", - "Contracts.Actions.Delete.Title": "Sözleşmeyi sil", - "Contracts.Actions.Delete.Description": "Bu sözleşmeyi silmek istediğinizden emin misiniz?", - "Contracts.Actions.CheckMissingSteps": "Eksik adımları kontrol et", - "Contracts.Actions.CheckMissingSteps.Success": "Tebrikler! Sözleşmede eksik adım bulunmadı.", - - "Contracts.Form.webSite": "Web Sitesi", - "Contracts.Form.status": "Durum", - "Contracts.Form.status.none": "-", - "Contracts.Form.status.registered": "Kayıtlı", - "Contracts.Form.status.deRegistrationRequestedByUniRefund": "Unirefund tarafından kayıt silme talep edildi", - "Contracts.Form.status.deRegistrationRequestedByAuthories": "Yetkililer tarafından kayıt silme talep edildi", - "Contracts.Form.status.suspendedInternallyAfterDeRegistrationDecline": "Kayıt silme talebi reddedildikten sonra dahili olarak askıya alındı", - "Contracts.Form.status.deRegisteredAtAuthorities": "Yetkililer tarafından kayıt silindi", - "Contracts.Form.status.SuspendedInternallyOnly": "Sadece dahili olarak askıya alındı", - "Contracts.Form.status.SuspensionRequestedByUniRefund": "Unirefund tarafından askıya alma talep edildi", - "Contracts.Form.status.SuspensionRequestedByAuthorities": "Yetkililer tarafından askıya alma talep edildi", - "Contracts.Form.status.UnSuspensionRequestedByUniRefund": "Unirefund tarafından askıya alma kaldırma talep edildi", - "Contracts.Form.status.UnSuspensionRequestedByAuthorities": "Yetkililer tarafından askıya alma kaldırma talep edildi", - "Contracts.Form.status.SuspendedAtAuthorities": "Yetkililer tarafından askıya alındı", - "Contracts.Form.status.UnSuspensionForFurtherDeRegistrationInvitedByAuthorities": "Yetkililer tarafından daha fazla kayıt silme İçin askıya alma kaldırma daveti", - "Contracts.Form.status.UnSuspensionForFurtherDeRegistrationRequestedByUniRefund": "Unirefund tarafından daha fazla kayıt silme İçin askıya alma kaldırma talep edildi", - "Contracts.Form.status.Terminated": "Sonlandırıldı", - - "Contracts.Form.merchantClassification": "Mağaza kategorisi", - "Contracts.Form.merchantClassification.ui:placeholder": "Mağaza kategorisi seçin", - "Contracts.Form.merchantClassification.excellent": "Harika", - "Contracts.Form.merchantClassification.good": "İyi", - "Contracts.Form.merchantClassification.satisfactory": "Tatmin edici", - "Contracts.Form.merchantClassification.low": "Düşük", - "Contracts.Form.validFrom.ui:placeholder": "Bu tarihten", - "Contracts.Form.validTo.ui:placeholder": "Bu tarihe", - "Contracts.Form.validFrom": "Başlangıç Tarihi", - "Contracts.Form.validTo": "Bitiş Tarihi", - - "Contracts.Form.addressCommonDataId": "Adres", - "Contracts.Form.addressCommonDataId.emptyValue": "Lütfen bir adres seçin", - "Contracts.Form.addressCommonDataId.searchPlaceholder": "Adres ara", - "Contracts.Form.addressCommonDataId.searchResultLabel": "Aranan adres bulunamadı.", - "Contracts.Form.defaultRefundTableHeader": "Varsayılan iade tablosu", - "Contracts.Form.defaultRefundTableHeader.undefined": "Lütfen bir varsayılan iade tablosu seçin", - "Contracts.Form.refundTableHeaders": "İade tabloları", - "Contracts.Form.refundTableHeaders.refundTableHeaderId": "İade tablosu", - "Contracts.Form.refundTableHeaders.refundTableHeaderId.emptyValue": "Lütfen bir iade tablosu seçin", - "Contracts.Form.refundTableHeaders.refundTableHeaderId.searchPlaceholder": "İade tablosu ara", - "Contracts.Form.refundTableHeaders.refundTableHeaderId.searchResultLabel": "Aranan iade tablosu bulunamadı.", - "Contracts.Form.refundTableHeaders.isDefault": "Varsayılan", - "Contracts.Form.refundTableHeaders.edit": "Düzenle", - "Contracts.Form.refundTableHeaders.validFrom": "Başlangıç Tarihi", - "Contracts.Form.refundTableHeaders.validTo": "Bitiş Tarihi", - - "Contracts.Form.defaultRefundFeeHeader": "Varsayılan iade ücreti", - "Contracts.Form.defaultRefundFeeHeader.undefined": "Lütfen bir varsayılan iade ücreti seçin", - "Contracts.Form.refundFeeHeaders": "İade ücretleri", - "Contracts.Form.refundFeeHeaders.refundFeeHeaderId": "İade ücreti", - "Contracts.Form.refundFeeHeaders.refundFeeHeaderId.emptyValue": "Lütfen bir iade ücreti seçin", - "Contracts.Form.refundFeeHeaders.refundFeeHeaderId.searchPlaceholder": "İade ücreti ara", - "Contracts.Form.refundFeeHeaders.refundFeeHeaderId.searchResultLabel": "Aranan iade ücreti bulunamadı.", - "Contracts.Form.refundFeeHeaders.isDefault": "Varsayılan", - "Contracts.Form.refundFeeHeaders.edit": "Düzenle", - "Contracts.Form.refundFeeHeaders.validFrom": "Başlangıç Tarihi", - "Contracts.Form.refundFeeHeaders.validTo": "Bitiş Tarihi", - - "Contracts.Settings.Form.Add": "Yeni ayar ekle", - "Contracts.Settings.Form.Delete": "Sil", - "Contracts.Settings.Form.Delete.Description": "Bu kontrat ayarını silmek istediğinize emin misiniz?", - "Contracts.Settings.Form.Delete.Title": "Kontrat ayarını sil", - "Contracts.Settings.Form.name": "Ayar adı", - "Contracts.Settings.Form.referenceNumber": "Referans numarası", - "Contracts.Settings.Form.termOfPayment": "Ödeme sıklığı", - "Contracts.Settings.Form.invoicingFrequency": "Fatura sıklığı", - "Contracts.Settings.Form.invoicingFrequency.ui:placeholder": "Fatura sıklığı seçin", - "Contracts.Settings.Form.invoicingFrequency.oneTimePerMonth": "Ayda bir defa", - "Contracts.Settings.Form.invoicingFrequency.twoTimesPerMonth": "Ayda iki defa", - "Contracts.Settings.Form.invoiceChannel": "Fatura kanalı", - "Contracts.Settings.Form.invoiceChannel.ui:placeholder": "Fatura kanalı seçin", - "Contracts.Settings.Form.invoiceChannel.electronicInvoice": "Elektronik Fatura", - "Contracts.Settings.Form.invoiceChannel.paperInvoice": "Kağıt Fatura", - "Contracts.Settings.Form.invoiceChannel.email": "E-posta", - "Contracts.Settings.Form.invoicingAddressCommonDataId": "Fatura adresi", - "Contracts.Settings.Form.invoicingAddressCommonDataId.emptyValue": "Lütfen bir fatura adresi seçin", - "Contracts.Settings.Form.invoicingAddressCommonDataId.searchPlaceholder": "Fatura adresi ara", - "Contracts.Settings.Form.invoicingAddressCommonDataId.searchResultLabel": "Aranan fatura adresi bulunamadı.", - "Contracts.Settings.Form.receiptType": "Fiş türü", - "Contracts.Settings.Form.receiptType.ui:placeholder": "Fiş türü seçin", - "Contracts.Settings.Form.receiptType.none": "-", - "Contracts.Settings.Form.receiptType.noBarcodeNumber": "Barkod Numarası Yok", - "Contracts.Settings.Form.receiptType.noBarcodeText": "Barkod Yazısı Yok", - "Contracts.Settings.Form.receiptType.barcode": "Barkod", - "Contracts.Settings.Form.receiptType.qrCodeIntegration": "QR Kod Entegrasyonu", - "Contracts.Settings.Form.receiptType.uniRefundVoucherIntegration": "Unirefund Cüzdan Entegrasyonu", - "Contracts.Settings.Form.isDefault": "Varsayılan", - "Contracts.Settings.Form.eTaxFree": "Elektronik TaxFree", - "Contracts.Settings.Form.crossTaxFreeForm": "crossTaxFreeForm?", - "Contracts.Settings.Form.facturaNumberIsUnique": "Benzersiz fatura numarası", - "Contracts.Settings.Form.excludeFromCashLimit": "Nakit limitine dahil etme", - "Contracts.Settings.Form.deskoScanner": "Desko tarayıcı", - "Contracts.Settings.Form.deliveryFee": "Teslimat ücreti", - "Contracts.Settings.Form.goodsHaveSerialNumbers": "Malların seri numaraları var", - "Contracts.Settings.Form.factoring": "Faktoring", - "Contracts.Settings.Form.setIsDefault": "Varsayılan olarak ayarla", - - "Contracts.Settings.SetIsDefault.Success": "Sözleşme ayarı başarıyla varsayılan olarak ayarlandı.", - "Contracts.Settings.SetIsDefault.Fail": "Sözleşme ayarı varsayılan olarak ayarlanamadı.", - "Contracts.Settings.Delete.Success": "Sözleşme ayarı başarıyla silindi.", - "Contracts.Settings.Delete.Fail": "Sözleşme ayarı silinirken bir hata oluştu.", - "Contracts.Settings.Create.Success": "Sözleşme ayarı başarıyla oluşturuldu.", - "Contracts.Settings.Create.Fail": "Sözleşme ayarı oluşturulurken bir hata oluştu.", - "Contracts.Settings.Edit.Success": "Sözleşme ayarı başarıyla kaydedildi.", - "Contracts.Settings.Edit.Fail": "Sözleşme ayarı kaydedilirken bir hata oluştu.", - - "Contracts.Stores.name": "Mağaza adı", - "Contracts.Stores.fullAddress": "Tam adres", - "Contracts.Stores.manager": "Yönetici", - "Contracts.Stores.contractSettingId": "Sözleşme ayarı", - "Contracts.Stores.receiptType": "Fiş türü", - "Contracts.Stores.receiptType.None": "-", - "Contracts.Stores.receiptType.NoBarcodeNumber": "Barkod Numarası Yok", - "Contracts.Stores.receiptType.NoBarcodeText": "Barkod Yazısı Yok", - "Contracts.Stores.receiptType.Barcode": "Barkod", - "Contracts.Stores.receiptType.QRCodeIntegration": "QR Kod Entegrasyonu", - "Contracts.Stores.receiptType.UniRefundVoucherIntegration": "Unirefund Cüzdan Entegrasyonu", - "Contracts.Stores.Save.Title": "Ayarları yenile", - "Contracts.Stores.Save.Description": "Mağazalar için ayarlar yenilenecek. Devam etmek istiyor musunuz?", - "Contracts.Stores.Save.Success": "Ayarlar başarıyla yenilendi.", - "Contracts.Stores.Save.Fail": "Ayarlar yenilenirken bir hata oluştu.", - - "RefundTables.Title": "İade Tabloları", - "RefundTables.Description": "İade tablolarını yönetin", - - "RefundTables.Create.Title": "Yeni iade tablosu", - "RefundTables.Create.Description": "Yeni bir iade tablosu oluşturun", - "RefundTables.Create.Submit": "Oluştur", - - "RefundTables.Edit.Title": "İade tablosunu düzenle", - "RefundTables.Edit.Description": "Seçili iade tablosunu düzenle", - "RefundTables.Edit.Submit": "Kaydet", - - "RefundTables.Delete.Title": "Bu iade tablosunu silmek istediğinizden emin misiniz?", - "RefundTables.Delete.Description": "İade tablosunu sil", - "RefundTables.Delete.Cancel": "İptal", - "RefundTables.Delete.Continue": "Devam et", - - "RefundTables.Details": "Detaylar", - "RefundTables.Details.FilterBy {0}": "{} göre filtrele", - "RefundTables.Details.Save": "Kaydet", - "RefundTables.Details.Delete": "Sil", - "RefundTables.Details.Create.Title": "Yeni kural seti", - "RefundTables.Details.Create.Description": "Yeni kural seti oluşturun", - "RefundTables.Details.Create.Submit": "Oluştur", - "RefundTables.Details.Edit.Title": "Kuralı düzenle", - "RefundTables.Details.Edit.Description": "Seçili kuralı düzenle", - "RefundTables.Details.Delete.Confirm": "Bu kuralı silmek istediğinizden emin misiniz?", - "RefundTables.Details.Delete.Confirm.Title": "Kuralı sil", - - "RefundTables.Name": "Tablo adı", - "RefundTables.ValidFrom": "Geçerli başlangıç tarihi", - "RefundTables.ValidTo": "Geçerli bitiş tarihi", - "RefundTables.IsDefault": "Varsayılan", - "RefundTables.IsBundling": "Paketleme Durumu", - "RefundTables.LastModificationTime": "Son değişiklik", - "RefundTables.Actions": "İşlemler", - "RefundTables.Edit": "Düzenle", - "RefundTables.Delete": "Sil", - "RefundTables.Cancel": "Vazgeç", - "RefundTables.Save": "Kaydet", - - "RefundFees.Page.List.Title": "İade Ücretleri", - "RefundFees.Page.List.Description": "İade ücretlerini yönetin", - "RefundFees.Page.List.Create": "Yeni iade ücreti oluştur", - "RefundFees.Page.List.Details": "Detaylar", - "RefundFees.Page.List.Deactivate": "Pasif et", - "RefundFees.Page.List.Create.Save": "Kaydet", - - "RefundFees.Page.Edit.Edit": "Düzenle", - "RefundFees.Page.Edit.Preview": "Önizleme", - "RefundFees.Page.Edit.Title": "İade ücretini düzenle {0}", - "RefundFees.Page.Edit.Description": "İade ücretini düzenle", - "RefundFees.Page.Edit.Delete": "Sil", - "RefundFees.Page.Edit.Delete.Title": "İade ücterini sil", - "RefundFees.Page.Edit.Delete.Description": "İade ücretini silmek istediğinizden emin misiniz?", - "RefundFees.Page.Edit.Delete.Cancel": "İptal", - "RefundFees.Page.Edit.Delete.Confirm": "Devam et", - "RefundFees.Page.Edit.Save": "Kaydet", - - "RefundFees.Page.Edit.Fee.Edit": "Düzenle", - "RefundFees.Page.Edit.Fee.Edit.Title": "Ücret düzenini düzenle", - "RefundFees.Page.Edit.Fee.Edit.Description": "Ücret düzenini düzenleyin", - "RefundFees.Page.Edit.Fee.Edit.Save": "Kaydet", - - "RefundFees.Page.Edit.Fee.Create": "Yeni düzen oluştur", - "RefundFees.Page.Edit.Fee.Create.Title": "Yeni ücret düzeni", - "RefundFees.Page.Edit.Fee.Create.Description": "Yeni ücret düzeni oluşturun", - "RefundFees.Page.Edit.Fee.Create.Save": "Kaydet", - - "RefundFees.Page.Edit.Fee.Delete": "Sil", - - "Rebate.Delete": "Delete", - - "Rebate.Create": "Oluştur", - "Rebate.Create.Submit": "Oluştur", - "Rebate.Create.Success": "Komisyon tablosu başarıyla oluşturuldu.", - "Rebate.Create.Fail": "Komisyon tablosu oluşturulurken hata oluştu.", - "Rebate.Update.Submit": "Kaydet", - "Rebate.Update.Success": "Komisyon tablosu başarıyla güncellendi.", - "Rebate.Update.Fail": "Komisyon tablosu güncellenirken hata oluştu.", - - "Rebate.Add.Submit": "Add", - - "Rebate.Preview": "Preview", - "Rebate.Preview.Calculate": "Calculate", - - "Rebate.Form.name": "Komisyon Tablosu Adı", - "Rebate.Form.isTemplate": "Şablon", - "Rebate.Form.rebateTableDetails": "Komisyon Tablosu Detayları", - "Rebate.Form.rebateTableDetails.add": "Komisyon tablosu detayı ekle", - "Rebate.Form.rebateTableDetails.delete": "Sil", - "Rebate.Form.rebateTableDetails.fixedFeeValue": "Sabit ücret", - "Rebate.Form.rebateTableDetails.percentFeeValue": "Yüzde", - "Rebate.Form.rebateTableDetails.refundMethod": "İade yöntemi", - "Rebate.Form.rebateTableDetails.variableFee": "Değişken ücret", - "Rebate.Form.processingFeeDetails": "İşlem Ücreti Detayları", - "Rebate.Form.processingFeeDetails.add": "İşlem ücreti detayı ekle", - "Rebate.Form.processingFeeDetails.delete": "Sil", - "Rebate.Form.processingFeeDetails.name": "İşlem ücreti adı", - "Rebate.Form.processingFeeDetails.amount": "Tutar", - "Rebate.Form.calculateNetCommissionInsteadOfRefund": "İade yerine net komisyon hesapla", - "Rebate.Form.validFrom": "Başlangıç tarihi", - "Rebate.Form.validTo": "Bitiş tarihi", - - "Rebate.Form.referenceNumber": "Referans numarası", - "Rebate.Form.isTrustedMerchant": "Güvenilir mağaza", - "Rebate.Form.rebateStatementPeriod": "Komisyon beyanname dönemi", - "Rebate.Form.rebateStatementPeriod.ui:placeholder": "Komisyon beyanname dönemi seçin", - "Rebate.Form.rebateStatementPeriod.None": "-", - "Rebate.Form.rebateStatementPeriod.Monthly": "Aylık", - "Rebate.Form.rebateStatementPeriod.Quarterly": "3 Aylık", - "Rebate.Form.rebateStatementPeriod.BiAnnualy": "6 Aylık", - "Rebate.Form.rebateStatementPeriod.Annualy": "Yıllık", - - "Rebate.Form.rebateTableHeadersFromTemplate": "Komisyon tablosu şablonu", - "Rebate.Form.rebateTableHeadersFromTemplate.id": "Komisyon tablosu şablonu", - "Rebate.Form.rebateTableHeadersFromTemplate.title": "Lütfen bir komisyon tablosu şablonu seçin", - "Rebate.Form.rebateTableHeadersFromTemplate.id.emptyValue": "Lütfen bir komisyon tablosu seçin", - "Rebate.Form.rebateTableHeadersFromTemplate.id.searchPlaceholder": "Bir komisyon tablosu ara", - "Rebate.Form.rebateTableHeadersFromTemplate.id.searchResultLabel": "Girilen değere sahip bir komisyon tablosu yok.", - "Rebate.Form.rebateTableHeadersFromTemplate.validFrom": "Başlangıç tarihi", - "Rebate.Form.rebateTableHeadersFromTemplate.validTo": "Bitiş tarihi", - "Rebate.Form.contactInformationTypeId": "İletişim bilgisi türü", - "Rebate.Form.minimumNetCommissions": "Minimum net komisyonlar", - "Rebate.Form.minimumNetCommissions.title": "Buradan minimum net komisyon ekleyebilirsiniz", - "Rebate.Form.minimumNetCommissions.amount": "Minimum net komisyon tutarı", - "Rebate.Form.minimumNetCommissions.validFrom": "Başlangıç tarihi", - "Rebate.Form.minimumNetCommissions.validTo": "Bitiş tarihi", - "Rebate.Form.minimumNetCommissions.appliedOrganizationId": "Uygulanan organizasyon", - "Rebate.Form.minimumNetCommissions.appliedOrganizationId.emptyValue": "Lütfen bir organizasyon seçin", - "Rebate.Form.minimumNetCommissions.appliedOrganizationId.searchPlaceholder": "Bir organizasyon ara", - "Rebate.Form.minimumNetCommissions.appliedOrganizationId.searchResultLabel": "Girilen değere sahip bir organizasyon yok.", - "Rebate.Form.rebateTableHeaders": "Komisyon tablosu başlıkları", - "Rebate.Form.rebateTableHeaders.title": "Komisyon tablosu şablonu oluşturun" -} diff --git a/apps/web/src/language-data/unirefund/ExportValidationService/index.ts b/apps/web/src/language-data/unirefund/ExportValidationService/index.ts deleted file mode 100644 index 9a55ff12b..000000000 --- a/apps/web/src/language-data/unirefund/ExportValidationService/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { getLocalizationResources } from "src/utils"; -import defaultEn from "../../core/Default/resources/en.json"; -import defaultTr from "../../core/Default/resources/tr.json"; -import en from "./resources/en.json"; -import tr from "./resources/tr.json"; - -export type ExportValidationServiceResource = typeof en & typeof defaultEn; - -function getLanguageData(lang: string): ExportValidationServiceResource { - if (lang === "tr") { - return { - ...defaultTr, - ...tr, - }; - } - return { - ...defaultEn, - ...en, - }; -} -export async function getResourceData(lang: string) { - const resources = await getLocalizationResources(lang); - const languageData = getLanguageData(lang); - return { - languageData, - resources, - }; -} -export function getResourceDataClient(lang: string) { - const languageData = getLanguageData(lang); - return languageData; -} diff --git a/apps/web/src/language-data/unirefund/ExportValidationService/resources/en.json b/apps/web/src/language-data/unirefund/ExportValidationService/resources/en.json deleted file mode 100644 index 7c4dafa83..000000000 --- a/apps/web/src/language-data/unirefund/ExportValidationService/resources/en.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "ExportValidation": "Export Validation", - "ExportValidation.New": "New Export Validation", - "ExportValidation.New.Error": "Failed to add Export Validation", - "ExportValidation.New.Success": "Export Validation created successfully", - "ExportValidation.Update.Success": "Export Validation updated successfully", - "ExportValidation.New.Fail": "An error occurred while saving the Export Validation", - "ExportValidation.Update.Fail": "Failed to update Export Validation", - "Custom.Select": "Select Custom", - "Tag.Select": "Select Tag", - - "Form.tagId": "Tag Name", - "Form.exportLocationId": "Custom Name", - "Form.referenceId": "Reference Name", - "Form.exportDate": "Export Date", - "Form.status": "Status", - "Form.stampType": "Stamp Type", - "Form.initialValidationResult": "Initial Validation Result", - "Form.finalValidationResult": "Final Validation Result", - - "Form.status.None": "None", - "Form.status.Waiting": "Waiting", - "Form.status.Approved": "Approved", - "Form.status.Rejected": "Rejected", - "Form.status.Expired": "Expired", - - "Form.stampType.None": "None", - "Form.stampType.Integration": "Integration", - "Form.stampType.DigitalStamp": "Digital", - - "Form.initialValidationResult.None": "None", - "Form.initialValidationResult.Green": "Green", - - "Form.finalValidationResult.None": "None", - "Form.finalValidationResult.Green": "Green" -} diff --git a/apps/web/src/language-data/unirefund/ExportValidationService/resources/tr.json b/apps/web/src/language-data/unirefund/ExportValidationService/resources/tr.json deleted file mode 100644 index e833b54e5..000000000 --- a/apps/web/src/language-data/unirefund/ExportValidationService/resources/tr.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "ExportValidation": "İhracat Doğrulaması", - "ExportValidation.New": "Yeni İhracat Doğrulaması", - "ExportValidation.New.Error": "İhracat Doğrulaması eklenirken bir hata oluştu", - "ExportValidation.New.Success": "İhracat Doğrulaması başarılıyla eklendi", - "ExportValidation.Update.Success": "İhracat Doğrulaması başarılıyla güncellendi", - "ExportValidation.New.Fail": "İhracat Doğrulaması kaydedilirken bir hata oluştu", - "ExportValidation.Update.Fail": "İhracat Doğrulaması güncellenirken bir hata oluştu", - "Custom.Select": "Gümrük Seçin", - "Tag.Select": "Etiket Seçin", - - "Form.tagId": "Etiket Adı", - "Form.exportLocationId": "Gümrük Adı", - "Form.referenceId": "Referans Adı", - "Form.exportDate": "İhracat Tarihi", - "Form.status": "Durum", - "Form.stampType": "Damga Türü", - "Form.initialValidationResult": "İlk Doğrulama Sonucu", - "Form.finalValidationResult": "Son Doğrulama Sonucu", - - "Form.status.None": "Yok", - "Form.status.Waiting": "Bekleniyor", - "Form.status.Approved": "Onaylandı", - "Form.status.Rejected": "Reddedildi", - "Form.status.Expired": "Sona erdi", - - "Form.stampType.None": "Yok", - "Form.stampType.Integration": "Entegrasyon", - "Form.stampType.DigitalStamp": "Elektronik", - - "Form.initialValidationResult.None": "Yok", - "Form.initialValidationResult.Green": "Yeşil", - - "Form.finalValidationResult.None": "Yok", - "Form.finalValidationResult.Green": "Yeşil" -} diff --git a/apps/web/src/language-data/unirefund/FinanceService/index.ts b/apps/web/src/language-data/unirefund/FinanceService/index.ts deleted file mode 100644 index 0dfdaa306..000000000 --- a/apps/web/src/language-data/unirefund/FinanceService/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { getLocalizationResources } from "src/utils"; -import defaultEn from "../../core/Default/resources/en.json"; -import defaultTr from "../../core/Default/resources/tr.json"; -import en from "./resources/en.json"; -import tr from "./resources/tr.json"; - -export type FinanceServiceResource = typeof en & typeof defaultEn; - -function getLanguageData(lang: string): FinanceServiceResource { - if (lang === "tr") { - return { - ...defaultTr, - ...tr, - }; - } - return { - ...defaultEn, - ...en, - }; -} -export async function getResourceData(lang: string) { - const resources = await getLocalizationResources(lang); - const languageData = getLanguageData(lang); - return { - languageData, - resources, - }; -} -export function getResourceDataClient(lang: string) { - const languageData = getLanguageData(lang); - return languageData; -} diff --git a/apps/web/src/language-data/unirefund/FinanceService/resources/en.json b/apps/web/src/language-data/unirefund/FinanceService/resources/en.json deleted file mode 100644 index 72264be53..000000000 --- a/apps/web/src/language-data/unirefund/FinanceService/resources/en.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "Billing.New": "New Billing", - "Billing.Edit": "Edit Billing", - "Billing.Delete": "Delete Billing", - "Billing.New.Error": "Failed to add Billing", - "Billing.New.Success": " Billing Added Successfully", - "Billing.Update.Success": "Billing Updated Successfully", - "Billing.Update.Fail": "Failed to update Billing", - "Billing.Fetch.Fail": "An error occurred while fetching the billing data. Please try again later.", - "Billing.New.Description": "You can add a new billing from here.", - "Billing.Edit.Description": "You can update the billing details from here.", - - "Form.merchantId": "Merchant Name", - "Form.merchantName": "Merchant Name", - "Form.date": "Date", - "Form.number": "Number", - "Form.dueDate": "Due Date", - "Form.total": "Total", - "Form.unpaid": "Unpaid", - "Form.status": "Status", - "Form.period": "Period", - "Form.paymentStatus": "Payment Status", - "Form.status.PAID": "Paid", - "Form.status.CREDITNOTE": "Credit Note", - "Form.status.CANCELLED": "Cancelled", - "Form.status.UNFINISHED": "Unfinished", - "Form.status.SENT": "Sent", - "Form.period.ONETIMEPERMONTH": "One Time Per Month", - "Form.period.TWOTIMESPERMONTH": "Two Time Per Month", - "Form.period.ONETIMEPERWEEK": "One Time Per Week", - "Form.paymentStatus.PAID": "Paid", - "Form.paymentStatus.NOTPAID": "Not Paid", - "Form.paymentStatus.PARTIALLYPAID": "Partially Paid" -} diff --git a/apps/web/src/language-data/unirefund/FinanceService/resources/tr.json b/apps/web/src/language-data/unirefund/FinanceService/resources/tr.json deleted file mode 100644 index a61a56ced..000000000 --- a/apps/web/src/language-data/unirefund/FinanceService/resources/tr.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "Billing.New": "Yeni fatura", - "Billing.Edit": "Fatura düzenle", - "Billing.Delete": "Fatura sil", - "Billing.New.Error": "Fatura eklenirken bir hata oluştu", - "Billing.New.Success": "Fatura başarıyla eklendi", - "Billing.Update.Success": "Fatura basarıyla güncellendi", - "Billing.Update.Fail": "Fatura guncellenirken bir hata olustu", - "Billing.Fetch.Fail": "Fatura verileri getirilirken bir hata oluştu. Lütfen daha sonra tekrar deneyin.", - "Billing.New.Description": "Buradan yeni fatura ekleyebilirsiniz.", - "Billing.Edit.Description": "Fatura detaylarını buradan güncelleyebilirsiniz.", - - "Form.merchantId": "Mağaza Adı", - "Form.merchantName": "Mağaza Adı", - "Form.date": "Tarih", - "Form.number": "Numara", - "Form.dueDate": "Vade Tarihi", - "Form.total": "Toplam", - "Form.unpaid": "Ödenmemiş", - "Form.status": "Durum", - "Form.period": "Dönem", - "Form.paymentStatus": "Ödeme Durumu", - "Form.status.PAID": "Ödendi", - "Form.status.CREDITNOTE": "Kredi Notu", - "Form.status.CANCELLED": "İptal Edildi", - "Form.status.UNFINISHED": "Tamamlanmamış", - "Form.status.SENT": "Gönderildi", - "Form.period.ONETIMEPERMONTH": "Ayda Bir Kez", - "Form.period.TWOTIMESPERMONTH": "Ayda İki Kez", - "Form.period.ONETIMEPERWEEK": "Haftada Bir Kez", - "Form.paymentStatus.PAID": "Ödendi", - "Form.paymentStatus.NOTPAID": "Ödenmedi", - "Form.paymentStatus.PARTIALLYPAID": "Kısmen Ödendi" -} diff --git a/apps/web/src/language-data/unirefund/TravellerService/index.ts b/apps/web/src/language-data/unirefund/TravellerService/index.ts deleted file mode 100644 index a8deb9016..000000000 --- a/apps/web/src/language-data/unirefund/TravellerService/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { getLocalizationResources } from "src/utils"; -import defaultEn from "../../core/Default/resources/en.json"; -import defaultTr from "../../core/Default/resources/tr.json"; -import en from "./resources/en.json"; -import tr from "./resources/tr.json"; - -export type TravellerServiceResource = typeof en & typeof defaultEn; - -function getLanguageData(lang: string): TravellerServiceResource { - if (lang === "tr") { - return { - ...defaultTr, - ...tr, - }; - } - return { - ...defaultEn, - ...en, - }; -} -export async function getResourceData(lang: string) { - const resources = await getLocalizationResources(lang); - const languageData = getLanguageData(lang); - return { - languageData, - resources, - }; -} -export function getResourceDataClient(lang: string) { - const languageData = getLanguageData(lang); - return languageData; -} diff --git a/apps/web/src/language-data/unirefund/TravellerService/resources/en.json b/apps/web/src/language-data/unirefund/TravellerService/resources/en.json deleted file mode 100644 index e0b904dc2..000000000 --- a/apps/web/src/language-data/unirefund/TravellerService/resources/en.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "Travellers": "Travellers", - "Traveller": "Traveller", - "Travellers.New.Identification": "New identification", - "Travellers.Edit.Description": "You can update the traveller's details from here.", - "Travellers.Identifications.Edit.Description": "You can update the traveller's personal identification from here.", - "Travellers.Personal.Identifications": "Personal Identifications", - "Travellers.Personal.Identification": "Traveller Personal Identification", - "Travellers.Personal.Preferences": "Personal Preferences", - "Travellers.Personal.Summary": "Personal Summary", - "Travellers.Description": "Traveller Details", - "Travellers.Delete.Succes": "Traveller deleted successfully", - "Travellers.Delete.Error": "Traveller could not be deleted", - "Travellers.New.Succes": "Traveller created successfully", - "Travellers.New.Error": "Failed to add Traveller", - "Travellers.New": "New Traveller", - "Travellers.ShowExpired": "Show Expired", - "Travellers.TravelDocumentNumber": "Travel Document Number", - "Travellers.Fail": "An error occurred while saving the Traveller", - "Travellers.Fetch.Fail": "An error occurred while fetching the traveller data. Please try again later.", - "Travellers.Identifications.Delete.Error": "Failed to delete personal identification", - "Travellers.Identifications.Delete.Success": "Personal identification deleted successfully", - "Travellers.Identifications.Update.Success": "personal identification Updated successfully", - "Travellers.Identifications.Update.Error": "Failed to update personal identification", - "Travellers.Create.Identification.Description": "You can add a new personal identification from here.", - - "Form.personalIdentification": "Personal Information", - "Form.personalIdentification.fullName": "Full Name", - "Form.personalIdentification.firstName": "First Name", - "Form.personalIdentification.middleName": "Middle Name", - "Form.personalIdentification.lastName": "Last Name", - "Form.personalIdentification.travelDocumentNumber": "Travel Document Number", - "Form.personalIdentification.nationalityCountryName": "Nationality", - "Form.personalIdentification.residenceCountryName": "Residence Country", - "Form.personalIdentification.languagePreferenceCode": "Language Preference", - "Form.personalIdentification.gender": "Gender", - "Form.personalIdentification.birthDate": "Date of Birth", - "Form.personalIdentification.issueDate": "Issue Date", - "Form.personalIdentification.expirationDate": "Expiry Date", - "Form.personalIdentification.residenceCountryCode2": "Residence Country", - "Form.personalIdentification.nationalityCountryCode2": "Nationality", - "Form.personalIdentification.identificationType": "ID Type", - "Form.personalIdentification.identificationType.passport": "Passport", - - "Form.languagePreferenceCode": "Preferred Language", - "Form.Summary.genderTypeCode": "Gender", - "Form.Summary.genderTypeCode.male": "Male", - "Form.Summary.genderTypeCode.female": "Female", - "Form.gender": "Gender", - "Form.gender.male": "Male", - "Form.gender.female": "Female" -} diff --git a/apps/web/src/language-data/unirefund/TravellerService/resources/tr.json b/apps/web/src/language-data/unirefund/TravellerService/resources/tr.json deleted file mode 100644 index e28b11c14..000000000 --- a/apps/web/src/language-data/unirefund/TravellerService/resources/tr.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "Travellers": "Yolcular", - "Traveller": "Yolcu", - "Travellers.New.Identification": "Yeni kimlik", - "Travellers.Edit.Description": "Yolcu bilgilerini buradan güncelleyebilirsiniz.", - "Travellers.Identifications.Edit.Description": "Yolcu kişisel bilgilerini buradan güncelleyebilirsiniz.", - "Travellers.Personal.Identifications": "Kişisel Kimlikler", - "Travellers.Personal.Identification": "Yolcu Kişisel Kimlik", - "Travellers.Personal.Preferences": "Kişisel Tercihler", - "Travellers.Personal.Summary": "Kişisel Özet", - "Travellers.Description": "Yolcu Detayları", - "Travellers.Delete.Succes": "Yolcu başarılıyla silindi", - "Travellers.Delete.Error": "Yolcu silinirken bir hata oluştu", - "Travellers.New.Succes": "Yolcu başarılıyla eklendi", - "Travellers.New.Error": "Yolcu eklenirken bir hata oluştu", - "Travellers.New": "Yeni Yolcu", - "Travellers.ShowExpired": "Süresi Dolanları Göster", - "Travellers.TravelDocumentNumber": "Seyahat Belge Numarası", - "Travellers.Fail": "Yolcu kaydedilirken bir hata oluştu", - "Travellers.Fetch.Fail": "Yolcu verileri getirilirken bir hata oluştu. Lütfen daha sonra tekrar deneyiniz.", - "Travellers.Identifications.Delete.Error": "Kişisel kimlik silinirken bir hata oluştu.", - "Travellers.Identifications.Delete.Success": "Kişisel kimlik basarılıyla silindi", - "Travellers.Identifications.Update.Success": "Kişisel kimlik başarıyla güncellendi", - "Travellers.Identifications.Update.Error": "Kişisel kimlik güncellenirken bir hata oluştu.", - "Travellers.Create.Identification.Description": "Buradan yeni bir kişisel kimlik ekleyebilirsiniz.", - - "Form.personalIdentification": "Kişisel Bilgiler", - "Form.personalIdentification.fullName": "Ad Soyad", - "Form.personalIdentification.firstName": "Ad", - "Form.personalIdentification.middleName": "Orta Ad", - "Form.personalIdentification.lastName": "Soyad", - "Form.personalIdentification.travelDocumentNumber": "Seyahat Belgesi Numarası", - "Form.personalIdentification.birthDate": "Doğum Tarihi", - "Form.personalIdentification.issueDate": "Veriliş Tarihi", - "Form.personalIdentification.expirationDate": "Son Kullanma Tarihi", - "Form.personalIdentification.nationalityCountryName": "Uyruğu", - "Form.personalIdentification.residenceCountryName": "İkamet Ülkesi", - "Form.personalIdentification.languagePreferenceCode": "Dil Tercihi", - "Form.personalIdentification.gender": "Cinsiyet", - "Form.personalIdentification.residenceCountryCode2": "İkamet Ülkesi", - "Form.personalIdentification.nationalityCountryCode2": "Uyruğu", - "Form.personalIdentification.identificationType": "Kimlik Türü", - "Form.personalIdentification.identificationType.passport": "Pasaport", - - "Form.languagePreferenceCode": "Dil Tercihi", - "Form.Summary.genderTypeCode": "Cinsiyet", - "Form.Summary.genderTypeCode.male": "Erkek", - "Form.Summary.genderTypeCode.female": "Kadın", - "Form.gender": "Cinsiyet", - "Form.gender.male": "Erkek", - "Form.gender.female": "Kadın" -} diff --git a/apps/web/src/language-data/unirefund/language-data.ts b/apps/web/src/language-data/unirefund/language-data.ts deleted file mode 100644 index 22a145a8f..000000000 --- a/apps/web/src/language-data/unirefund/language-data.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { CoreLanguageDataResourceType } from "../core/core-language-data"; -import type { DefaultResource } from "../core/Default"; -import type { ContractServiceResource } from "./ContractService"; -import type { CRMServiceServiceResource } from "./CRMService"; -import type { ExportValidationServiceResource } from "./ExportValidationService"; -import type { FinanceServiceResource } from "./FinanceService"; -import type { TravellerServiceResource } from "./TravellerService"; - -export type AppLanguageDataResourceType = DefaultResource & - ( - | CoreLanguageDataResourceType - | CRMServiceServiceResource - | ContractServiceResource - | FinanceServiceResource - | ExportValidationServiceResource - | TravellerServiceResource - | undefined - );