@saasicat/ui-vue 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +47 -0
- package/dist/index.cjs +3776 -0
- package/dist/index.d.cts +2395 -0
- package/dist/index.d.ts +2395 -0
- package/dist/index.js +3659 -0
- package/dist/testing-e2e/admin-pages-suite.cjs +134 -0
- package/dist/testing-e2e/admin-pages-suite.d.cts +37 -0
- package/dist/testing-e2e/admin-pages-suite.d.ts +37 -0
- package/dist/testing-e2e/admin-pages-suite.js +109 -0
- package/package.json +87 -0
- package/src/action-registry.ts +110 -0
- package/src/batch-column-fetcher.ts +152 -0
- package/src/boot-loader.ts +60 -0
- package/src/components/BundleVersionPublishDialog.vue +359 -0
- package/src/components/BusinessTypeVersionEditorDialog.vue +417 -0
- package/src/components/BusinessTypeVersionPublishDialog.vue +258 -0
- package/src/components/FeatureGate.vue +56 -0
- package/src/components/KpiCard.vue +53 -0
- package/src/components/KvBlock.vue +36 -0
- package/src/components/MarketingPromotionsTab.vue +861 -0
- package/src/components/MfaPromptDialog.vue +104 -0
- package/src/components/TenantActionConfirmDialog.vue +252 -0
- package/src/components/VersionDiffPreview.vue +150 -0
- package/src/components/bundle-editor/BundleCreatePanel.vue +681 -0
- package/src/components/bundle-editor/BundleFeaturesEditor.vue +215 -0
- package/src/components/bundle-editor/BundlePlanCompatPicker.vue +316 -0
- package/src/components/bundle-editor/BundleQuotasEditor.vue +219 -0
- package/src/components/bundle-editor/BundleStatusBanner.vue +189 -0
- package/src/components/bundle-editor/BundleVersionInlineEditor.vue +659 -0
- package/src/components/bundle-editor/BundleVersionStrip.vue +207 -0
- package/src/components/bundle-editor/bundle-version-status.ts +164 -0
- package/src/components/bundle-editor/catalog-i18n.ts +85 -0
- package/src/components/dialogs/PilotCreateDialog.vue +780 -0
- package/src/components/dialogs/PilotEditDialog.vue +548 -0
- package/src/components/dialogs/PromoCodeCreateDialog.vue +737 -0
- package/src/components/dialogs/PromoCodeEditDialog.vue +859 -0
- package/src/components/dialogs/types.ts +126 -0
- package/src/components/plan/PlanCycleToggle.vue +99 -0
- package/src/components/plan/PlanGrid.vue +211 -0
- package/src/components/plan/PriceSummary.vue +293 -0
- package/src/components/plan/PromoCodeInput.vue +192 -0
- package/src/components/plan/PublicBundleGrid.vue +287 -0
- package/src/components/plan-cockpit/PlanCockpit.vue +993 -0
- package/src/components/plan-cockpit/PlanCockpitAuditLog.vue +65 -0
- package/src/components/plan-cockpit/PlanCockpitDiffPanel.vue +91 -0
- package/src/components/plan-cockpit/PlanCockpitHeader.vue +98 -0
- package/src/components/plan-cockpit/PlanCockpitImpactPanel.vue +99 -0
- package/src/components/plan-cockpit/PlanCockpitKpis.vue +57 -0
- package/src/components/plan-cockpit/PlanCockpitVersions.vue +226 -0
- package/src/components/plan-cockpit/types.ts +72 -0
- package/src/components/plan-create-dialog/PlanCreateDialog.vue +508 -0
- package/src/components/plan-detail/PlanAuditLog.vue +59 -0
- package/src/components/plan-detail/PlanDetail.vue +1195 -0
- package/src/components/plan-detail/PlanDetailHeader.vue +185 -0
- package/src/components/plan-detail/PlanDetailKpis.vue +57 -0
- package/src/components/plan-detail/PlanTerminateDialog.vue +76 -0
- package/src/components/plan-detail/PlanVersionDiffPanel.vue +149 -0
- package/src/components/plan-detail/PlanVersionsPanel.vue +255 -0
- package/src/components/plan-detail/types.ts +59 -0
- package/src/components/plan-list/PlanList.vue +1067 -0
- package/src/components/plan-matrix/PlanMatrix.vue +1113 -0
- package/src/components/plan-review/PlanReview.vue +742 -0
- package/src/components/plan-version-editor/PlanCatalogPreview.vue +184 -0
- package/src/components/plan-version-editor/PlanComponentPool.vue +272 -0
- package/src/components/plan-version-editor/PlanVersionBasket.vue +281 -0
- package/src/components/plan-version-editor/PlanVersionDiffDialog.vue +84 -0
- package/src/components/plan-version-editor/PlanVersionEditor.vue +1728 -0
- package/src/components/plan-version-editor/PlanVersionEditorHeader.vue +94 -0
- package/src/components/plan-version-editor/types.ts +96 -0
- package/src/components/wizard-stepper/WizardStepper.vue +107 -0
- package/src/create-admin-routes.ts +68 -0
- package/src/create-super-admin-app.ts +345 -0
- package/src/entitlement-provider.ts +36 -0
- package/src/feature-router-guard.ts +77 -0
- package/src/http-json.ts +62 -0
- package/src/index.ts +98 -0
- package/src/manifest-loader.ts +139 -0
- package/src/manifest-store-factory.ts +114 -0
- package/src/nav-builder.ts +274 -0
- package/src/pages-standard/AdminLayout.vue +411 -0
- package/src/pages-standard/AdminManifestErrorPage.vue +79 -0
- package/src/pages-standard/AuditPage.vue +223 -0
- package/src/pages-standard/BundlesPage.vue +910 -0
- package/src/pages-standard/BusinessTypesPage.vue +662 -0
- package/src/pages-standard/DashboardPage.vue +595 -0
- package/src/pages-standard/DiscoveryPage.vue +663 -0
- package/src/pages-standard/EmailHistoryPage.vue +576 -0
- package/src/pages-standard/MarketingCatalogPage.vue +1771 -0
- package/src/pages-standard/PilotsPage.vue +577 -0
- package/src/pages-standard/PlanVersionsPage.vue +216 -0
- package/src/pages-standard/PlansPage.vue +1222 -0
- package/src/pages-standard/PlatformEmailPage.vue +434 -0
- package/src/pages-standard/PromoCodeDetailPage.vue +331 -0
- package/src/pages-standard/PromoCodesPage.vue +589 -0
- package/src/pages-standard/SubscriptionsPage.vue +159 -0
- package/src/pages-standard/SuperAdminLoginPage.vue +299 -0
- package/src/pages-standard/SuperAdminSetupWizard.vue +405 -0
- package/src/pages-standard/TenantDetailPage.vue +432 -0
- package/src/pages-standard/TenantsPage.vue +732 -0
- package/src/pages-standard/UsersPage.vue +504 -0
- package/src/pages-standard/bundles-page/BundleAccordionList.vue +116 -0
- package/src/pages-standard/bundles-page/BundleDetailPanel.vue +193 -0
- package/src/pages-standard/bundles-page/BundlesFilterBar.vue +48 -0
- package/src/pages-standard/bundles-page/BundlesHeader.vue +67 -0
- package/src/pages-standard/bundles-page/BundlesKpis.vue +39 -0
- package/src/pages-standard/bundles-page/types.ts +15 -0
- package/src/pages-standard/discovery-page/CatalogEntryTransPanel.vue +246 -0
- package/src/pages-standard/discovery-page/DiscoveryCapList.vue +171 -0
- package/src/pages-standard/discovery-page/DiscoveryFeatureCard.vue +410 -0
- package/src/pages-standard/discovery-page/DiscoveryHeader.vue +31 -0
- package/src/pages-standard/discovery-page/DiscoveryKpis.vue +47 -0
- package/src/pages-standard/discovery-page/DiscoveryMetaBanner.vue +26 -0
- package/src/pages-standard/discovery-page/DiscoveryQuotaCard.vue +247 -0
- package/src/pages-standard/discovery-page/DiscoveryStatusControl.vue +73 -0
- package/src/pages-standard/discovery-page/discovery-ui.ts +166 -0
- package/src/pages-standard/email-history.types.ts +48 -0
- package/src/pages-standard/marketing-catalog/MarketingCatalogAdmin.vue +448 -0
- package/src/pages-standard/marketing-catalog/MarketingCatalogHeader.vue +93 -0
- package/src/pages-standard/marketing-catalog/MarketingCatalogPreview.vue +138 -0
- package/src/pages-standard/marketing-catalog/MarketingCatalogToolbar.vue +58 -0
- package/src/pages-standard/marketing-catalog/types.ts +43 -0
- package/src/pages-standard/plan-versions/PlanDiffCard.vue +132 -0
- package/src/pages-standard/plan-versions/PlanVersionHeader.vue +293 -0
- package/src/pages-standard/plan-versions/PlanVersionStatusBadge.vue +48 -0
- package/src/pages-standard/plan-versions/PlanVersionsAudit.vue +307 -0
- package/src/pages-standard/plan-versions/PlanVersionsDiff.vue +269 -0
- package/src/pages-standard/plan-versions/PlanVersionsKpi.vue +65 -0
- package/src/pages-standard/plan-versions/PlanVersionsList.vue +292 -0
- package/src/pages-standard/plan-versions/PlanVersionsMatrix.vue +261 -0
- package/src/pages-standard/plan-versions/PlanVersionsTimeline.vue +300 -0
- package/src/pages-standard/plan-versions/VersionDiffPreview.vue +167 -0
- package/src/pages-standard/plan-versions/format.ts +53 -0
- package/src/pages-standard/plan-versions/types.ts +33 -0
- package/src/pages-standard/plans-page/PlanArchiveDialog.vue +50 -0
- package/src/pages-standard/plans-page/PlanBundleOverview.vue +147 -0
- package/src/pages-standard/plans-page/PlanDiscardDraftDialog.vue +46 -0
- package/src/pages-standard/plans-page/PlanPublishDialog.vue +106 -0
- package/src/pages-standard/plans-page/PlansPageToast.vue +69 -0
- package/src/pages-standard/plans-page/types.ts +18 -0
- package/src/pages-standard/platform-email.types.ts +41 -0
- package/src/pages-standard/sa-theme.css +223 -0
- package/src/pages-standard/tenants/StatusPill.vue +62 -0
- package/src/pages-standard/tenants/format.ts +38 -0
- package/src/pages-tenant/LimitsRow.vue +67 -0
- package/src/pages-tenant/MySubscriptionBundlesPage.vue +604 -0
- package/src/pages-tenant/OnboardingConfigurator.vue +417 -0
- package/src/pages-tenant/PackageSnapshotPanel.vue +241 -0
- package/src/pages-tenant/PendingVersionBanner.vue +126 -0
- package/src/pages-tenant/PlanChangeWizard.vue +630 -0
- package/src/pages-tenant/TenantPlanSection.vue +729 -0
- package/src/pages-tenant/UsageBar.vue +107 -0
- package/src/pages-tenant/default-i18n.ts +280 -0
- package/src/pages-tenant/tenant-plan-section/BundlePreviewDialog.vue +304 -0
- package/src/pages-tenant/tenant-plan-section/TenantBundleStore.vue +323 -0
- package/src/pages-tenant/tenant-plan-section/TenantFeatureMatrix.vue +122 -0
- package/src/pages-tenant/tenant-plan-section/TenantPlanCardHeader.vue +67 -0
- package/src/pages-tenant/tenant-plan-section/TenantUsageGrid.vue +31 -0
- package/src/plan-versions-catalog.ts +368 -0
- package/src/platform-loaders.ts +68 -0
- package/src/project-page-host.ts +108 -0
- package/src/testing-e2e/admin-pages-suite.ts +187 -0
- package/src/types.ts +58 -0
- package/src/use-actions.ts +25 -0
- package/src/use-api-list.ts +151 -0
- package/src/use-audit-entries.ts +48 -0
- package/src/use-batch-columns.ts +59 -0
- package/src/use-bulk-publish.ts +150 -0
- package/src/use-bundle-versions-map.ts +112 -0
- package/src/use-bundles.ts +297 -0
- package/src/use-business-types.ts +269 -0
- package/src/use-catalog-entries.ts +243 -0
- package/src/use-discovery.ts +158 -0
- package/src/use-entitlement.ts +87 -0
- package/src/use-live-plan-versions.ts +126 -0
- package/src/use-manifest.ts +57 -0
- package/src/use-marketing-projections.ts +160 -0
- package/src/use-nav.ts +33 -0
- package/src/use-plan-editor.ts +162 -0
- package/src/use-plan-versions.ts +83 -0
- package/src/use-plans.ts +375 -0
- package/src/use-platform-tenant-actions.ts +286 -0
- package/src/use-promotions.ts +126 -0
- package/src/use-public-boot.ts +40 -0
- package/src/use-subscription-draft.ts +355 -0
- package/src/use-super-admin-context.ts +93 -0
- package/src/use-tenant-action-flow.ts +238 -0
- package/src/use-tenant-billing-catalog.ts +160 -0
- package/src/use-tenant-billing.ts +453 -0
- package/src/use-tenant-manifest.ts +94 -0
- package/src/use-tenant-subscription-bundles.ts +148 -0
- package/src/use-tenants.ts +61 -0
- package/src/version.ts +10 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sa-promo-detail">
|
|
3
|
+
<header class="sa-page-head">
|
|
4
|
+
<div>
|
|
5
|
+
<q-btn
|
|
6
|
+
flat
|
|
7
|
+
dense
|
|
8
|
+
icon="arrow_back"
|
|
9
|
+
:label="backLabel"
|
|
10
|
+
:to="backRoute"
|
|
11
|
+
class="sa-promo-detail__back"
|
|
12
|
+
/>
|
|
13
|
+
<h1 class="sa-page-head__title">{{ data?.promo.code ?? promoCodeLabel }}</h1>
|
|
14
|
+
<p class="sa-page-head__sub">
|
|
15
|
+
<template v-if="data">
|
|
16
|
+
{{ data.promo.valueType }} · {{ data.promo.value }} ·
|
|
17
|
+
<q-badge
|
|
18
|
+
:color="resolveStatusColor(String(data.promo.status))"
|
|
19
|
+
:label="String(data.promo.status)"
|
|
20
|
+
/>
|
|
21
|
+
</template>
|
|
22
|
+
<template v-else>—</template>
|
|
23
|
+
</p>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="sa-promo-detail__head-actions">
|
|
26
|
+
<q-btn
|
|
27
|
+
v-if="editSubmit && data"
|
|
28
|
+
color="primary"
|
|
29
|
+
unelevated
|
|
30
|
+
icon="edit"
|
|
31
|
+
:label="editLabel"
|
|
32
|
+
@click="openEdit"
|
|
33
|
+
/>
|
|
34
|
+
<slot name="header-actions" />
|
|
35
|
+
</div>
|
|
36
|
+
</header>
|
|
37
|
+
|
|
38
|
+
<div class="sa-promo-detail__body">
|
|
39
|
+
<div v-if="loading" class="sa-promo-detail__state">
|
|
40
|
+
<q-spinner size="32px" /> wird geladen…
|
|
41
|
+
</div>
|
|
42
|
+
<div v-else-if="!data" class="sa-promo-detail__state">{{ emptyLabel }}</div>
|
|
43
|
+
|
|
44
|
+
<template v-else>
|
|
45
|
+
<div class="sa-card sa-promo-detail__section">
|
|
46
|
+
<div class="sa-promo-detail__section-head">{{ configLabel }}</div>
|
|
47
|
+
<slot name="config" :promo="data.promo">
|
|
48
|
+
<pre class="sa-promo-detail__kv">{{ resolveFormatPromo(data.promo) }}</pre>
|
|
49
|
+
</slot>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div class="sa-card sa-promo-detail__section">
|
|
53
|
+
<div class="sa-promo-detail__section-head">{{ statsLabel }}</div>
|
|
54
|
+
<slot name="stats" :stats="data.stats">
|
|
55
|
+
<pre class="sa-promo-detail__kv">{{
|
|
56
|
+
JSON.stringify(data.stats, null, 2)
|
|
57
|
+
}}</pre>
|
|
58
|
+
</slot>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<div class="sa-card sa-promo-detail__section">
|
|
62
|
+
<div class="sa-promo-detail__section-head">
|
|
63
|
+
{{ redemptionsLabel }} ({{ data.redemptions.length }})
|
|
64
|
+
</div>
|
|
65
|
+
<slot name="redemptions" :redemptions="data.redemptions">
|
|
66
|
+
<q-table
|
|
67
|
+
flat
|
|
68
|
+
:rows="data.redemptions"
|
|
69
|
+
:columns="redemptionsColumns ?? DEFAULT_COLUMNS"
|
|
70
|
+
row-key="id"
|
|
71
|
+
:pagination="{ rowsPerPage: 0 }"
|
|
72
|
+
hide-pagination
|
|
73
|
+
/>
|
|
74
|
+
</slot>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<slot name="extra-sections" :data="data" />
|
|
78
|
+
</template>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<PromoCodeEditDialog
|
|
82
|
+
v-if="editSubmit"
|
|
83
|
+
v-model="editOpen"
|
|
84
|
+
:row="editRow"
|
|
85
|
+
:plans="editPlans ?? []"
|
|
86
|
+
:submit="editSubmit"
|
|
87
|
+
@updated="onEditUpdated"
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<script setup lang="ts">
|
|
93
|
+
import { computed, onMounted, ref } from 'vue';
|
|
94
|
+
import type { RouteLocationRaw } from 'vue-router';
|
|
95
|
+
import type { QTableColumn } from 'quasar';
|
|
96
|
+
import PromoCodeEditDialog, {
|
|
97
|
+
type PromoCodeEditRow,
|
|
98
|
+
} from '../components/dialogs/PromoCodeEditDialog.vue';
|
|
99
|
+
import type { PromoCodePlanOption, PromoCodeUpdatePayload } from '../components/dialogs/types.js';
|
|
100
|
+
|
|
101
|
+
export interface PromoDetailData {
|
|
102
|
+
promo: Record<string, unknown> & {
|
|
103
|
+
code?: string;
|
|
104
|
+
valueType?: string;
|
|
105
|
+
value?: number | string;
|
|
106
|
+
status?: string;
|
|
107
|
+
};
|
|
108
|
+
stats: Record<string, unknown>;
|
|
109
|
+
redemptions: Array<Record<string, unknown> & { id: string }>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const props = withDefaults(
|
|
113
|
+
defineProps<{
|
|
114
|
+
loadDetail: () => Promise<PromoDetailData>;
|
|
115
|
+
backRoute: RouteLocationRaw;
|
|
116
|
+
backLabel?: string;
|
|
117
|
+
promoCodeLabel?: string;
|
|
118
|
+
configLabel?: string;
|
|
119
|
+
statsLabel?: string;
|
|
120
|
+
redemptionsLabel?: string;
|
|
121
|
+
emptyLabel?: string;
|
|
122
|
+
redemptionsColumns?: QTableColumn[];
|
|
123
|
+
/**
|
|
124
|
+
* Maps a status string to a Quasar color name. Default: ACTIVE→positive,
|
|
125
|
+
* PAUSED→amber-7, EXPIRED→grey, else negative.
|
|
126
|
+
*/
|
|
127
|
+
statusColor?: (status: string) => string;
|
|
128
|
+
/**
|
|
129
|
+
* Optional formatter for the Konfiguration JSON block. Default:
|
|
130
|
+
* `JSON.stringify(promo, null, 2)` — the consumer can pass a curated
|
|
131
|
+
* subset (e.g. only marketing-relevant fields).
|
|
132
|
+
*/
|
|
133
|
+
formatPromo?: (promo: Record<string, unknown>) => string;
|
|
134
|
+
/**
|
|
135
|
+
* When set: enables the "Edit" button in the header and opens the
|
|
136
|
+
* {@link PromoCodeEditDialog}. The consumer provides the app-specific
|
|
137
|
+
* PATCH function (e.g. `adminApi.promoCodes.update`). After a
|
|
138
|
+
* successful save, the detail page automatically reloads via
|
|
139
|
+
* `loadDetail()` — the consumer needs to trigger nothing further.
|
|
140
|
+
*/
|
|
141
|
+
editSubmit?: (id: string, payload: PromoCodeUpdatePayload) => Promise<void>;
|
|
142
|
+
editLabel?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Plan list for the plan picker in the edit dialog. When empty, the
|
|
145
|
+
* dialog hides the plan selection.
|
|
146
|
+
*/
|
|
147
|
+
editPlans?: readonly PromoCodePlanOption[];
|
|
148
|
+
}>(),
|
|
149
|
+
{
|
|
150
|
+
backLabel: 'Zurück',
|
|
151
|
+
promoCodeLabel: 'Promo-Code',
|
|
152
|
+
configLabel: 'Konfiguration',
|
|
153
|
+
statsLabel: 'Statistik',
|
|
154
|
+
redemptionsLabel: 'Einlösungen',
|
|
155
|
+
emptyLabel: 'Code nicht gefunden.',
|
|
156
|
+
editLabel: 'Bearbeiten',
|
|
157
|
+
},
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
const data = ref<PromoDetailData | null>(null);
|
|
161
|
+
const loading = ref(false);
|
|
162
|
+
const editOpen = ref(false);
|
|
163
|
+
|
|
164
|
+
async function reload() {
|
|
165
|
+
loading.value = true;
|
|
166
|
+
try {
|
|
167
|
+
data.value = await props.loadDetail();
|
|
168
|
+
} finally {
|
|
169
|
+
loading.value = false;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
onMounted(() => {
|
|
174
|
+
void reload();
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const editRow = computed<PromoCodeEditRow | null>(() => {
|
|
178
|
+
if (!data.value) return null;
|
|
179
|
+
const p = data.value.promo as Record<string, unknown>;
|
|
180
|
+
const id = typeof p.id === 'string' ? p.id : '';
|
|
181
|
+
if (!id) return null;
|
|
182
|
+
const plans = Array.isArray(p.appliesToPlans)
|
|
183
|
+
? (p.appliesToPlans as unknown[]).filter((k): k is string => typeof k === 'string')
|
|
184
|
+
: [];
|
|
185
|
+
const billing = p.appliesToBilling;
|
|
186
|
+
return {
|
|
187
|
+
id,
|
|
188
|
+
code: String(p.code ?? ''),
|
|
189
|
+
status: String(p.status ?? 'ACTIVE'),
|
|
190
|
+
valueType: p.valueType === 'ABSOLUTE' ? 'ABSOLUTE' : 'PERCENT',
|
|
191
|
+
value:
|
|
192
|
+
typeof p.value === 'number'
|
|
193
|
+
? p.value
|
|
194
|
+
: typeof p.value === 'string'
|
|
195
|
+
? Number(p.value) || 0
|
|
196
|
+
: 0,
|
|
197
|
+
durationType:
|
|
198
|
+
p.durationType === 'MONTHS' || p.durationType === 'BILLING_CYCLES'
|
|
199
|
+
? p.durationType
|
|
200
|
+
: 'ONCE',
|
|
201
|
+
durationValue: typeof p.durationValue === 'number' ? p.durationValue : null,
|
|
202
|
+
validFrom: typeof p.validFrom === 'string' ? p.validFrom : null,
|
|
203
|
+
validUntil: typeof p.validUntil === 'string' ? p.validUntil : null,
|
|
204
|
+
maxRedemptions: typeof p.maxRedemptions === 'number' ? p.maxRedemptions : null,
|
|
205
|
+
redemptionsCount: typeof p.redemptionsCount === 'number' ? p.redemptionsCount : 0,
|
|
206
|
+
appliesToPlans: plans,
|
|
207
|
+
appliesToBilling: billing === 'MONTHLY' || billing === 'YEARLY' ? billing : null,
|
|
208
|
+
firstTimeCustomersOnly:
|
|
209
|
+
typeof p.firstTimeCustomersOnly === 'boolean' ? p.firstTimeCustomersOnly : false,
|
|
210
|
+
minimumPlanAmountGross:
|
|
211
|
+
typeof p.minimumPlanAmountGross === 'number'
|
|
212
|
+
? p.minimumPlanAmountGross
|
|
213
|
+
: typeof p.minimumPlanAmountGross === 'string'
|
|
214
|
+
? Number(p.minimumPlanAmountGross) || null
|
|
215
|
+
: null,
|
|
216
|
+
allowZeroInvoice: typeof p.allowZeroInvoice === 'boolean' ? p.allowZeroInvoice : false,
|
|
217
|
+
campaignTag: typeof p.campaignTag === 'string' ? p.campaignTag : null,
|
|
218
|
+
revenueDeductionAccount:
|
|
219
|
+
typeof p.revenueDeductionAccount === 'string' ? p.revenueDeductionAccount : null,
|
|
220
|
+
description: typeof p.description === 'string' ? p.description : null,
|
|
221
|
+
};
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
function openEdit() {
|
|
225
|
+
if (!editRow.value) return;
|
|
226
|
+
editOpen.value = true;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
async function onEditUpdated() {
|
|
230
|
+
await reload();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function resolveStatusColor(s: string): string {
|
|
234
|
+
if (props.statusColor) return props.statusColor(s);
|
|
235
|
+
if (s === 'ACTIVE') return 'positive';
|
|
236
|
+
if (s === 'PAUSED') return 'amber-7';
|
|
237
|
+
if (s === 'EXPIRED') return 'grey';
|
|
238
|
+
return 'negative';
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function resolveFormatPromo(promo: Record<string, unknown>): string {
|
|
242
|
+
if (props.formatPromo) return props.formatPromo(promo);
|
|
243
|
+
return JSON.stringify(promo, null, 2);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const DEFAULT_COLUMNS: QTableColumn[] = [
|
|
247
|
+
{
|
|
248
|
+
name: 'tenant',
|
|
249
|
+
label: 'Tenant',
|
|
250
|
+
field: (r: unknown) =>
|
|
251
|
+
((r as Record<string, unknown>).tenant as { slug?: string } | undefined)?.slug ?? '—',
|
|
252
|
+
align: 'left',
|
|
253
|
+
},
|
|
254
|
+
{ name: 'status', label: 'Status', field: 'status', align: 'left' },
|
|
255
|
+
{
|
|
256
|
+
name: 'startsAt',
|
|
257
|
+
label: 'Start',
|
|
258
|
+
field: (r: unknown) => String((r as Record<string, unknown>).startsAt ?? '').slice(0, 10),
|
|
259
|
+
align: 'left',
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: 'endsAt',
|
|
263
|
+
label: 'Ende',
|
|
264
|
+
field: (r: unknown) => {
|
|
265
|
+
const v = (r as Record<string, unknown>).endsAt;
|
|
266
|
+
return v ? String(v).slice(0, 10) : '∞';
|
|
267
|
+
},
|
|
268
|
+
align: 'left',
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
name: 'redeemedAt',
|
|
272
|
+
label: 'Eingelöst',
|
|
273
|
+
field: (r: unknown) =>
|
|
274
|
+
String((r as Record<string, unknown>).redeemedAt ?? '')
|
|
275
|
+
.slice(0, 19)
|
|
276
|
+
.replace('T', ' '),
|
|
277
|
+
align: 'left',
|
|
278
|
+
},
|
|
279
|
+
];
|
|
280
|
+
</script>
|
|
281
|
+
|
|
282
|
+
<style scoped>
|
|
283
|
+
.sa-promo-detail {
|
|
284
|
+
min-height: calc(100vh - 56px);
|
|
285
|
+
background: var(--sa-bg-app);
|
|
286
|
+
}
|
|
287
|
+
.sa-promo-detail__back {
|
|
288
|
+
margin-bottom: 6px;
|
|
289
|
+
}
|
|
290
|
+
.sa-promo-detail__head-actions {
|
|
291
|
+
display: flex;
|
|
292
|
+
align-items: center;
|
|
293
|
+
gap: 8px;
|
|
294
|
+
margin-left: auto;
|
|
295
|
+
}
|
|
296
|
+
.sa-promo-detail__body {
|
|
297
|
+
padding: 12px 28px 28px;
|
|
298
|
+
display: flex;
|
|
299
|
+
flex-direction: column;
|
|
300
|
+
gap: 14px;
|
|
301
|
+
}
|
|
302
|
+
.sa-promo-detail__section {
|
|
303
|
+
padding: 16px 18px;
|
|
304
|
+
}
|
|
305
|
+
.sa-promo-detail__section-head {
|
|
306
|
+
font-size: 11px;
|
|
307
|
+
font-weight: 700;
|
|
308
|
+
letter-spacing: 0.08em;
|
|
309
|
+
color: var(--sa-muted);
|
|
310
|
+
text-transform: uppercase;
|
|
311
|
+
margin-bottom: 10px;
|
|
312
|
+
font-family: var(--sa-font-head);
|
|
313
|
+
}
|
|
314
|
+
.sa-promo-detail__kv {
|
|
315
|
+
background: #fafbfc;
|
|
316
|
+
border: 1px solid var(--sa-border);
|
|
317
|
+
border-radius: 8px;
|
|
318
|
+
padding: 12px;
|
|
319
|
+
font-size: 12px;
|
|
320
|
+
margin: 0;
|
|
321
|
+
overflow-x: auto;
|
|
322
|
+
font-family: var(--sa-font-mono);
|
|
323
|
+
}
|
|
324
|
+
.sa-promo-detail__state {
|
|
325
|
+
padding: 24px;
|
|
326
|
+
display: flex;
|
|
327
|
+
align-items: center;
|
|
328
|
+
gap: 12px;
|
|
329
|
+
color: var(--sa-muted);
|
|
330
|
+
}
|
|
331
|
+
</style>
|