@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.
Files changed (193) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +47 -0
  3. package/dist/index.cjs +3776 -0
  4. package/dist/index.d.cts +2395 -0
  5. package/dist/index.d.ts +2395 -0
  6. package/dist/index.js +3659 -0
  7. package/dist/testing-e2e/admin-pages-suite.cjs +134 -0
  8. package/dist/testing-e2e/admin-pages-suite.d.cts +37 -0
  9. package/dist/testing-e2e/admin-pages-suite.d.ts +37 -0
  10. package/dist/testing-e2e/admin-pages-suite.js +109 -0
  11. package/package.json +87 -0
  12. package/src/action-registry.ts +110 -0
  13. package/src/batch-column-fetcher.ts +152 -0
  14. package/src/boot-loader.ts +60 -0
  15. package/src/components/BundleVersionPublishDialog.vue +359 -0
  16. package/src/components/BusinessTypeVersionEditorDialog.vue +417 -0
  17. package/src/components/BusinessTypeVersionPublishDialog.vue +258 -0
  18. package/src/components/FeatureGate.vue +56 -0
  19. package/src/components/KpiCard.vue +53 -0
  20. package/src/components/KvBlock.vue +36 -0
  21. package/src/components/MarketingPromotionsTab.vue +861 -0
  22. package/src/components/MfaPromptDialog.vue +104 -0
  23. package/src/components/TenantActionConfirmDialog.vue +252 -0
  24. package/src/components/VersionDiffPreview.vue +150 -0
  25. package/src/components/bundle-editor/BundleCreatePanel.vue +681 -0
  26. package/src/components/bundle-editor/BundleFeaturesEditor.vue +215 -0
  27. package/src/components/bundle-editor/BundlePlanCompatPicker.vue +316 -0
  28. package/src/components/bundle-editor/BundleQuotasEditor.vue +219 -0
  29. package/src/components/bundle-editor/BundleStatusBanner.vue +189 -0
  30. package/src/components/bundle-editor/BundleVersionInlineEditor.vue +659 -0
  31. package/src/components/bundle-editor/BundleVersionStrip.vue +207 -0
  32. package/src/components/bundle-editor/bundle-version-status.ts +164 -0
  33. package/src/components/bundle-editor/catalog-i18n.ts +85 -0
  34. package/src/components/dialogs/PilotCreateDialog.vue +780 -0
  35. package/src/components/dialogs/PilotEditDialog.vue +548 -0
  36. package/src/components/dialogs/PromoCodeCreateDialog.vue +737 -0
  37. package/src/components/dialogs/PromoCodeEditDialog.vue +859 -0
  38. package/src/components/dialogs/types.ts +126 -0
  39. package/src/components/plan/PlanCycleToggle.vue +99 -0
  40. package/src/components/plan/PlanGrid.vue +211 -0
  41. package/src/components/plan/PriceSummary.vue +293 -0
  42. package/src/components/plan/PromoCodeInput.vue +192 -0
  43. package/src/components/plan/PublicBundleGrid.vue +287 -0
  44. package/src/components/plan-cockpit/PlanCockpit.vue +993 -0
  45. package/src/components/plan-cockpit/PlanCockpitAuditLog.vue +65 -0
  46. package/src/components/plan-cockpit/PlanCockpitDiffPanel.vue +91 -0
  47. package/src/components/plan-cockpit/PlanCockpitHeader.vue +98 -0
  48. package/src/components/plan-cockpit/PlanCockpitImpactPanel.vue +99 -0
  49. package/src/components/plan-cockpit/PlanCockpitKpis.vue +57 -0
  50. package/src/components/plan-cockpit/PlanCockpitVersions.vue +226 -0
  51. package/src/components/plan-cockpit/types.ts +72 -0
  52. package/src/components/plan-create-dialog/PlanCreateDialog.vue +508 -0
  53. package/src/components/plan-detail/PlanAuditLog.vue +59 -0
  54. package/src/components/plan-detail/PlanDetail.vue +1195 -0
  55. package/src/components/plan-detail/PlanDetailHeader.vue +185 -0
  56. package/src/components/plan-detail/PlanDetailKpis.vue +57 -0
  57. package/src/components/plan-detail/PlanTerminateDialog.vue +76 -0
  58. package/src/components/plan-detail/PlanVersionDiffPanel.vue +149 -0
  59. package/src/components/plan-detail/PlanVersionsPanel.vue +255 -0
  60. package/src/components/plan-detail/types.ts +59 -0
  61. package/src/components/plan-list/PlanList.vue +1067 -0
  62. package/src/components/plan-matrix/PlanMatrix.vue +1113 -0
  63. package/src/components/plan-review/PlanReview.vue +742 -0
  64. package/src/components/plan-version-editor/PlanCatalogPreview.vue +184 -0
  65. package/src/components/plan-version-editor/PlanComponentPool.vue +272 -0
  66. package/src/components/plan-version-editor/PlanVersionBasket.vue +281 -0
  67. package/src/components/plan-version-editor/PlanVersionDiffDialog.vue +84 -0
  68. package/src/components/plan-version-editor/PlanVersionEditor.vue +1728 -0
  69. package/src/components/plan-version-editor/PlanVersionEditorHeader.vue +94 -0
  70. package/src/components/plan-version-editor/types.ts +96 -0
  71. package/src/components/wizard-stepper/WizardStepper.vue +107 -0
  72. package/src/create-admin-routes.ts +68 -0
  73. package/src/create-super-admin-app.ts +345 -0
  74. package/src/entitlement-provider.ts +36 -0
  75. package/src/feature-router-guard.ts +77 -0
  76. package/src/http-json.ts +62 -0
  77. package/src/index.ts +98 -0
  78. package/src/manifest-loader.ts +139 -0
  79. package/src/manifest-store-factory.ts +114 -0
  80. package/src/nav-builder.ts +274 -0
  81. package/src/pages-standard/AdminLayout.vue +411 -0
  82. package/src/pages-standard/AdminManifestErrorPage.vue +79 -0
  83. package/src/pages-standard/AuditPage.vue +223 -0
  84. package/src/pages-standard/BundlesPage.vue +910 -0
  85. package/src/pages-standard/BusinessTypesPage.vue +662 -0
  86. package/src/pages-standard/DashboardPage.vue +595 -0
  87. package/src/pages-standard/DiscoveryPage.vue +663 -0
  88. package/src/pages-standard/EmailHistoryPage.vue +576 -0
  89. package/src/pages-standard/MarketingCatalogPage.vue +1771 -0
  90. package/src/pages-standard/PilotsPage.vue +577 -0
  91. package/src/pages-standard/PlanVersionsPage.vue +216 -0
  92. package/src/pages-standard/PlansPage.vue +1222 -0
  93. package/src/pages-standard/PlatformEmailPage.vue +434 -0
  94. package/src/pages-standard/PromoCodeDetailPage.vue +331 -0
  95. package/src/pages-standard/PromoCodesPage.vue +589 -0
  96. package/src/pages-standard/SubscriptionsPage.vue +159 -0
  97. package/src/pages-standard/SuperAdminLoginPage.vue +299 -0
  98. package/src/pages-standard/SuperAdminSetupWizard.vue +405 -0
  99. package/src/pages-standard/TenantDetailPage.vue +432 -0
  100. package/src/pages-standard/TenantsPage.vue +732 -0
  101. package/src/pages-standard/UsersPage.vue +504 -0
  102. package/src/pages-standard/bundles-page/BundleAccordionList.vue +116 -0
  103. package/src/pages-standard/bundles-page/BundleDetailPanel.vue +193 -0
  104. package/src/pages-standard/bundles-page/BundlesFilterBar.vue +48 -0
  105. package/src/pages-standard/bundles-page/BundlesHeader.vue +67 -0
  106. package/src/pages-standard/bundles-page/BundlesKpis.vue +39 -0
  107. package/src/pages-standard/bundles-page/types.ts +15 -0
  108. package/src/pages-standard/discovery-page/CatalogEntryTransPanel.vue +246 -0
  109. package/src/pages-standard/discovery-page/DiscoveryCapList.vue +171 -0
  110. package/src/pages-standard/discovery-page/DiscoveryFeatureCard.vue +410 -0
  111. package/src/pages-standard/discovery-page/DiscoveryHeader.vue +31 -0
  112. package/src/pages-standard/discovery-page/DiscoveryKpis.vue +47 -0
  113. package/src/pages-standard/discovery-page/DiscoveryMetaBanner.vue +26 -0
  114. package/src/pages-standard/discovery-page/DiscoveryQuotaCard.vue +247 -0
  115. package/src/pages-standard/discovery-page/DiscoveryStatusControl.vue +73 -0
  116. package/src/pages-standard/discovery-page/discovery-ui.ts +166 -0
  117. package/src/pages-standard/email-history.types.ts +48 -0
  118. package/src/pages-standard/marketing-catalog/MarketingCatalogAdmin.vue +448 -0
  119. package/src/pages-standard/marketing-catalog/MarketingCatalogHeader.vue +93 -0
  120. package/src/pages-standard/marketing-catalog/MarketingCatalogPreview.vue +138 -0
  121. package/src/pages-standard/marketing-catalog/MarketingCatalogToolbar.vue +58 -0
  122. package/src/pages-standard/marketing-catalog/types.ts +43 -0
  123. package/src/pages-standard/plan-versions/PlanDiffCard.vue +132 -0
  124. package/src/pages-standard/plan-versions/PlanVersionHeader.vue +293 -0
  125. package/src/pages-standard/plan-versions/PlanVersionStatusBadge.vue +48 -0
  126. package/src/pages-standard/plan-versions/PlanVersionsAudit.vue +307 -0
  127. package/src/pages-standard/plan-versions/PlanVersionsDiff.vue +269 -0
  128. package/src/pages-standard/plan-versions/PlanVersionsKpi.vue +65 -0
  129. package/src/pages-standard/plan-versions/PlanVersionsList.vue +292 -0
  130. package/src/pages-standard/plan-versions/PlanVersionsMatrix.vue +261 -0
  131. package/src/pages-standard/plan-versions/PlanVersionsTimeline.vue +300 -0
  132. package/src/pages-standard/plan-versions/VersionDiffPreview.vue +167 -0
  133. package/src/pages-standard/plan-versions/format.ts +53 -0
  134. package/src/pages-standard/plan-versions/types.ts +33 -0
  135. package/src/pages-standard/plans-page/PlanArchiveDialog.vue +50 -0
  136. package/src/pages-standard/plans-page/PlanBundleOverview.vue +147 -0
  137. package/src/pages-standard/plans-page/PlanDiscardDraftDialog.vue +46 -0
  138. package/src/pages-standard/plans-page/PlanPublishDialog.vue +106 -0
  139. package/src/pages-standard/plans-page/PlansPageToast.vue +69 -0
  140. package/src/pages-standard/plans-page/types.ts +18 -0
  141. package/src/pages-standard/platform-email.types.ts +41 -0
  142. package/src/pages-standard/sa-theme.css +223 -0
  143. package/src/pages-standard/tenants/StatusPill.vue +62 -0
  144. package/src/pages-standard/tenants/format.ts +38 -0
  145. package/src/pages-tenant/LimitsRow.vue +67 -0
  146. package/src/pages-tenant/MySubscriptionBundlesPage.vue +604 -0
  147. package/src/pages-tenant/OnboardingConfigurator.vue +417 -0
  148. package/src/pages-tenant/PackageSnapshotPanel.vue +241 -0
  149. package/src/pages-tenant/PendingVersionBanner.vue +126 -0
  150. package/src/pages-tenant/PlanChangeWizard.vue +630 -0
  151. package/src/pages-tenant/TenantPlanSection.vue +729 -0
  152. package/src/pages-tenant/UsageBar.vue +107 -0
  153. package/src/pages-tenant/default-i18n.ts +280 -0
  154. package/src/pages-tenant/tenant-plan-section/BundlePreviewDialog.vue +304 -0
  155. package/src/pages-tenant/tenant-plan-section/TenantBundleStore.vue +323 -0
  156. package/src/pages-tenant/tenant-plan-section/TenantFeatureMatrix.vue +122 -0
  157. package/src/pages-tenant/tenant-plan-section/TenantPlanCardHeader.vue +67 -0
  158. package/src/pages-tenant/tenant-plan-section/TenantUsageGrid.vue +31 -0
  159. package/src/plan-versions-catalog.ts +368 -0
  160. package/src/platform-loaders.ts +68 -0
  161. package/src/project-page-host.ts +108 -0
  162. package/src/testing-e2e/admin-pages-suite.ts +187 -0
  163. package/src/types.ts +58 -0
  164. package/src/use-actions.ts +25 -0
  165. package/src/use-api-list.ts +151 -0
  166. package/src/use-audit-entries.ts +48 -0
  167. package/src/use-batch-columns.ts +59 -0
  168. package/src/use-bulk-publish.ts +150 -0
  169. package/src/use-bundle-versions-map.ts +112 -0
  170. package/src/use-bundles.ts +297 -0
  171. package/src/use-business-types.ts +269 -0
  172. package/src/use-catalog-entries.ts +243 -0
  173. package/src/use-discovery.ts +158 -0
  174. package/src/use-entitlement.ts +87 -0
  175. package/src/use-live-plan-versions.ts +126 -0
  176. package/src/use-manifest.ts +57 -0
  177. package/src/use-marketing-projections.ts +160 -0
  178. package/src/use-nav.ts +33 -0
  179. package/src/use-plan-editor.ts +162 -0
  180. package/src/use-plan-versions.ts +83 -0
  181. package/src/use-plans.ts +375 -0
  182. package/src/use-platform-tenant-actions.ts +286 -0
  183. package/src/use-promotions.ts +126 -0
  184. package/src/use-public-boot.ts +40 -0
  185. package/src/use-subscription-draft.ts +355 -0
  186. package/src/use-super-admin-context.ts +93 -0
  187. package/src/use-tenant-action-flow.ts +238 -0
  188. package/src/use-tenant-billing-catalog.ts +160 -0
  189. package/src/use-tenant-billing.ts +453 -0
  190. package/src/use-tenant-manifest.ts +94 -0
  191. package/src/use-tenant-subscription-bundles.ts +148 -0
  192. package/src/use-tenants.ts +61 -0
  193. package/src/version.ts +10 -0
@@ -0,0 +1,548 @@
1
+ <template>
2
+ <q-dialog
3
+ :model-value="modelValue"
4
+ @update:model-value="emit('update:modelValue', $event)"
5
+ persistent
6
+ >
7
+ <q-card class="ple-dlg">
8
+ <q-card-section class="ple-dlg__head">
9
+ <div>
10
+ <div class="ple-dlg__title">Pilot bearbeiten</div>
11
+ <div class="ple-dlg__sub" v-if="row">
12
+ <strong>{{ row.tenant.name }}</strong>
13
+ <span class="ple-dlg__sep">·</span>
14
+ <code>{{ row.tenant.slug }}</code>
15
+ </div>
16
+ </div>
17
+ <q-btn
18
+ class="ple-dlg__close"
19
+ flat
20
+ dense
21
+ round
22
+ icon="close"
23
+ v-close-popup
24
+ :disable="loading"
25
+ />
26
+ </q-card-section>
27
+
28
+ <q-card-section class="ple-dlg__body">
29
+ <!-- Section 1: Plan -->
30
+ <section class="ple-section">
31
+ <header class="ple-section__head">
32
+ <span class="ple-section__num">1</span>
33
+ <div>
34
+ <div class="ple-section__title">Plan</div>
35
+ <div class="ple-section__sub">
36
+ Aktive Plan-Zuweisung. Legacy-Plans tauchen als „nicht im Katalog"
37
+ auf.
38
+ </div>
39
+ </div>
40
+ </header>
41
+ <div class="ple-plan-select">
42
+ <button
43
+ v-for="p in effectivePlanOptions"
44
+ :key="p.value"
45
+ type="button"
46
+ class="ple-plan-opt"
47
+ :class="{ 'ple-plan-opt--active': form.plan === p.value }"
48
+ @click="form.plan = p.value"
49
+ >
50
+ <span
51
+ class="ple-plan-opt__dot"
52
+ :style="{ background: p.color ?? '#94a3b8' }"
53
+ />
54
+ <div class="ple-plan-opt__text">
55
+ <span class="ple-plan-opt__key">{{ p.value }}</span>
56
+ <span class="ple-plan-opt__label">{{ p.label }}</span>
57
+ </div>
58
+ <q-icon
59
+ v-if="form.plan === p.value"
60
+ name="check"
61
+ size="16px"
62
+ class="ple-plan-opt__check"
63
+ />
64
+ </button>
65
+ </div>
66
+ </section>
67
+
68
+ <!-- Section 2: End date -->
69
+ <section class="ple-section">
70
+ <header class="ple-section__head">
71
+ <span class="ple-section__num">2</span>
72
+ <div>
73
+ <div class="ple-section__title">Enddatum</div>
74
+ <div class="ple-section__sub">
75
+ Leeres Datum = offene Pilotphase ohne Ablauf.
76
+ </div>
77
+ </div>
78
+ </header>
79
+ <div class="ple-end-row">
80
+ <input v-model="form.endsAt" class="ple-input" type="date" />
81
+ <button
82
+ v-if="form.endsAt"
83
+ type="button"
84
+ class="ple-btn-mini"
85
+ title="Datum löschen — offene Pilotphase"
86
+ @click="form.endsAt = ''"
87
+ >
88
+ <q-icon name="close" size="12px" />
89
+ unbegrenzt
90
+ </button>
91
+ </div>
92
+ <div class="ple-end-presets">
93
+ <button
94
+ v-for="p in PRESET_ENDS"
95
+ :key="p.days"
96
+ type="button"
97
+ class="ple-preset-btn"
98
+ @click="setEndsAtDays(p.days)"
99
+ >
100
+ +{{ p.label }}
101
+ </button>
102
+ </div>
103
+ </section>
104
+
105
+ <!-- Section 3: Note -->
106
+ <section class="ple-section">
107
+ <header class="ple-section__head">
108
+ <span class="ple-section__num">3</span>
109
+ <div>
110
+ <div class="ple-section__title">Notiz</div>
111
+ <div class="ple-section__sub">Intern · nicht für Kunden sichtbar.</div>
112
+ </div>
113
+ </header>
114
+ <textarea
115
+ v-model="form.note"
116
+ class="ple-input ple-textarea"
117
+ rows="3"
118
+ :placeholder="notePlaceholder"
119
+ />
120
+ </section>
121
+
122
+ <p v-if="error" class="ple-error">{{ error }}</p>
123
+ </q-card-section>
124
+
125
+ <q-card-actions align="right" class="ple-dlg__foot">
126
+ <q-btn flat label="Abbrechen" v-close-popup :disable="loading" />
127
+ <q-btn
128
+ unelevated
129
+ color="primary"
130
+ label="Speichern"
131
+ :loading="loading"
132
+ :disable="!isDirty"
133
+ @click="onSubmit"
134
+ />
135
+ </q-card-actions>
136
+ </q-card>
137
+ </q-dialog>
138
+
139
+ <MfaPromptDialog
140
+ v-if="requireMfa"
141
+ v-model="showMfa"
142
+ :description="mfaDescription"
143
+ :error="mfaError"
144
+ :setup-hint="mfaSetupHint"
145
+ @confirm="(code) => doSubmit(code)"
146
+ />
147
+ </template>
148
+
149
+ <script setup lang="ts">
150
+ import { computed, reactive, ref, watch } from 'vue';
151
+ import MfaPromptDialog from '../MfaPromptDialog.vue';
152
+ import type { PilotRow } from '../../pages-standard/PilotsPage.vue';
153
+ import {
154
+ DEFAULT_PILOT_COPY,
155
+ type PilotCopy,
156
+ type PilotEditPayload,
157
+ type PilotEditResult,
158
+ } from './types.js';
159
+
160
+ // Platform dialog for editing an existing pilot subscription
161
+ // (sim layout: numbered sections, plan tile picker, ends-at quick sets).
162
+ // Only changed fields are sent — the server leaves fields that are not
163
+ // included untouched.
164
+
165
+ type PlanOption = string | { label?: string; value: string; color?: string };
166
+
167
+ const props = withDefaults(
168
+ defineProps<{
169
+ modelValue: boolean;
170
+ row: PilotRow | null;
171
+ planOptions: readonly PlanOption[];
172
+ /** Tenant-specific labels/placeholders; neutral defaults otherwise. */
173
+ copy?: PilotCopy;
174
+ requireMfa?: boolean;
175
+ mfaSetupHint?: string;
176
+ submit: (
177
+ slug: string,
178
+ payload: PilotEditPayload,
179
+ mfaCode: string,
180
+ ) => Promise<PilotEditResult>;
181
+ }>(),
182
+ { requireMfa: true },
183
+ );
184
+
185
+ const emit = defineEmits<{
186
+ (e: 'update:modelValue', v: boolean): void;
187
+ (e: 'updated', result: PilotEditResult): void;
188
+ }>();
189
+
190
+ const PRESET_ENDS: ReadonlyArray<{ label: string; days: number }> = [
191
+ { label: '30 Tage', days: 30 },
192
+ { label: '90 Tage', days: 90 },
193
+ { label: '6 Monate', days: 180 },
194
+ { label: '1 Jahr', days: 365 },
195
+ ];
196
+
197
+ const notePlaceholder = computed(
198
+ () => props.copy?.notePlaceholder ?? DEFAULT_PILOT_COPY.notePlaceholder,
199
+ );
200
+
201
+ function normalize(opt: PlanOption): { value: string; label: string; color?: string } {
202
+ if (typeof opt === 'string') return { value: opt, label: opt };
203
+ return { value: opt.value, label: opt.label ?? opt.value, color: opt.color };
204
+ }
205
+
206
+ // If the current plan ID is not (or no longer) in the catalog — e.g. a legacy
207
+ // value like "STANDARD" from an earlier seed generation — it still appears in
208
+ // the picker, so the user can see it and deliberately switch away from it.
209
+ const effectivePlanOptions = computed<Array<{ value: string; label: string; color?: string }>>(
210
+ () => {
211
+ const opts = props.planOptions.map(normalize);
212
+ const current = props.row?.plan;
213
+ if (!current) return opts;
214
+ if (opts.some((o) => o.value === current)) return opts;
215
+ return [{ value: current, label: `${current} (nicht im Katalog)` }, ...opts];
216
+ },
217
+ );
218
+
219
+ interface FormState {
220
+ plan: string;
221
+ endsAt: string;
222
+ note: string;
223
+ }
224
+
225
+ function fromRow(row: PilotRow | null): FormState {
226
+ return {
227
+ plan: row?.plan ?? '',
228
+ endsAt: row?.pilotEndsAt ? row.pilotEndsAt.slice(0, 10) : '',
229
+ note: row?.pilotNote ?? '',
230
+ };
231
+ }
232
+
233
+ const form = reactive<FormState>(fromRow(null));
234
+ const initial = ref<FormState>(fromRow(null));
235
+ const loading = ref(false);
236
+ const error = ref('');
237
+ const showMfa = ref(false);
238
+ const mfaError = ref('');
239
+ const mfaDescription = ref('');
240
+
241
+ function setEndsAtDays(days: number): void {
242
+ const d = new Date();
243
+ d.setDate(d.getDate() + days);
244
+ form.endsAt = d.toISOString().slice(0, 10);
245
+ }
246
+
247
+ watch(
248
+ () => props.modelValue,
249
+ (open) => {
250
+ if (open) {
251
+ const fresh = fromRow(props.row);
252
+ Object.assign(form, fresh);
253
+ initial.value = { ...fresh };
254
+ error.value = '';
255
+ }
256
+ },
257
+ );
258
+
259
+ // Send only changed fields to the backend. Empty `endsAt` → `null`
260
+ // (clear the date), empty note → `null`. This keeps unchanged fields
261
+ // stable server-side and the audit log contains only real changes.
262
+ const diff = computed<PilotEditPayload>(() => {
263
+ const out: PilotEditPayload = {};
264
+ if (form.plan !== initial.value.plan) out.plan = form.plan;
265
+ if (form.endsAt !== initial.value.endsAt) {
266
+ out.endsAt = form.endsAt ? form.endsAt : null;
267
+ }
268
+ if (form.note !== initial.value.note) {
269
+ out.note = form.note ? form.note : null;
270
+ }
271
+ return out;
272
+ });
273
+
274
+ const isDirty = computed(() => Object.keys(diff.value).length > 0);
275
+
276
+ function onSubmit(): void {
277
+ if (!isDirty.value || !props.row) return;
278
+ if (props.requireMfa) {
279
+ mfaDescription.value = `Pilot "${props.row.tenant.name}" bearbeiten.`;
280
+ mfaError.value = '';
281
+ showMfa.value = true;
282
+ return;
283
+ }
284
+ void doSubmit('');
285
+ }
286
+
287
+ async function doSubmit(code: string): Promise<void> {
288
+ if (!props.row) return;
289
+ loading.value = true;
290
+ error.value = '';
291
+ try {
292
+ const result = await props.submit(props.row.tenant.slug, diff.value, code);
293
+ showMfa.value = false;
294
+ emit('updated', result);
295
+ emit('update:modelValue', false);
296
+ } catch (err) {
297
+ const response = (
298
+ err as {
299
+ response?: {
300
+ status?: number;
301
+ data?: { reason?: string; message?: string };
302
+ };
303
+ }
304
+ ).response;
305
+ const status = response?.status;
306
+ const reason = response?.data?.reason;
307
+ if (
308
+ props.requireMfa &&
309
+ status === 401 &&
310
+ (reason === 'MFA_FAILED' || reason === 'MFA_REQUIRED')
311
+ ) {
312
+ mfaError.value = 'TOTP-Code ungültig.';
313
+ } else if (props.requireMfa && status === 401 && reason === 'MFA_NOT_SET_UP') {
314
+ mfaError.value =
315
+ response?.data?.message ?? 'MFA ist für diesen Account nicht eingerichtet.';
316
+ } else {
317
+ error.value = response?.data?.message ?? 'Speichern fehlgeschlagen';
318
+ showMfa.value = false;
319
+ }
320
+ } finally {
321
+ loading.value = false;
322
+ }
323
+ }
324
+ </script>
325
+
326
+ <style scoped>
327
+ .ple-dlg {
328
+ width: 640px;
329
+ max-width: 96vw;
330
+ }
331
+ .ple-dlg__head {
332
+ display: flex;
333
+ align-items: flex-start;
334
+ gap: 16px;
335
+ padding: 18px 22px 14px;
336
+ border-bottom: 1px solid var(--sa-border, #e2e8f0);
337
+ }
338
+ .ple-dlg__title {
339
+ font-family: var(--sa-font-head, system-ui, sans-serif);
340
+ font-weight: 700;
341
+ font-size: 17px;
342
+ color: var(--sa-heading, #0f172a);
343
+ letter-spacing: -0.015em;
344
+ }
345
+ .ple-dlg__sub {
346
+ font-size: 12.5px;
347
+ color: var(--sa-muted, #64748b);
348
+ margin-top: 3px;
349
+ }
350
+ .ple-dlg__sep {
351
+ color: #cbd5e1;
352
+ margin: 0 6px;
353
+ }
354
+ .ple-dlg__sub code {
355
+ font-family: var(--sa-font-mono, ui-monospace, monospace);
356
+ background: #f1f5f9;
357
+ color: var(--sa-muted-dark, #475569);
358
+ padding: 1px 6px;
359
+ border-radius: 4px;
360
+ font-size: 11.5px;
361
+ }
362
+ .ple-dlg__close {
363
+ margin-left: auto;
364
+ }
365
+ .ple-dlg__body {
366
+ padding: 20px 22px;
367
+ }
368
+ .ple-dlg__foot {
369
+ border-top: 1px solid var(--sa-border, #e2e8f0);
370
+ background: #fbfbfd;
371
+ padding: 12px 18px;
372
+ }
373
+
374
+ .ple-section {
375
+ margin-bottom: 18px;
376
+ }
377
+ .ple-section:last-of-type {
378
+ margin-bottom: 4px;
379
+ }
380
+ .ple-section__head {
381
+ display: flex;
382
+ align-items: flex-start;
383
+ gap: 12px;
384
+ margin-bottom: 12px;
385
+ padding-bottom: 10px;
386
+ border-bottom: 1px solid #f1f5f9;
387
+ }
388
+ .ple-section__num {
389
+ width: 24px;
390
+ height: 24px;
391
+ background: #eff6ff;
392
+ color: #1d4ed8;
393
+ border-radius: 50%;
394
+ font: 700 12px var(--sa-font-body, system-ui, sans-serif);
395
+ display: grid;
396
+ place-items: center;
397
+ flex: 0 0 auto;
398
+ }
399
+ .ple-section__title {
400
+ font-size: 13.5px;
401
+ font-weight: 700;
402
+ color: var(--sa-heading, #0f172a);
403
+ letter-spacing: -0.005em;
404
+ }
405
+ .ple-section__sub {
406
+ font-size: 11.5px;
407
+ color: #94a3b8;
408
+ margin-top: 2px;
409
+ }
410
+
411
+ .ple-input {
412
+ width: 100%;
413
+ padding: 9px 12px;
414
+ background: #fff;
415
+ border: 1px solid var(--sa-border, #e2e8f0);
416
+ border-radius: 8px;
417
+ font: 13px var(--sa-font-body, system-ui, sans-serif);
418
+ color: var(--sa-body, #1e293b);
419
+ outline: 0;
420
+ transition:
421
+ border-color 0.12s,
422
+ box-shadow 0.12s;
423
+ }
424
+ .ple-input:focus {
425
+ border-color: var(--sa-primary, #3f6bff);
426
+ box-shadow: 0 0 0 3px rgba(63, 107, 255, 0.12);
427
+ }
428
+ .ple-textarea {
429
+ resize: vertical;
430
+ min-height: 64px;
431
+ }
432
+
433
+ .ple-plan-select {
434
+ display: flex;
435
+ flex-direction: column;
436
+ gap: 5px;
437
+ }
438
+ .ple-plan-opt {
439
+ display: flex;
440
+ align-items: center;
441
+ gap: 10px;
442
+ padding: 8px 11px;
443
+ background: #fff;
444
+ border: 1px solid var(--sa-border, #e2e8f0);
445
+ border-radius: 8px;
446
+ cursor: pointer;
447
+ text-align: left;
448
+ font-family: var(--sa-font-body, system-ui, sans-serif);
449
+ transition:
450
+ border-color 0.12s,
451
+ background 0.12s;
452
+ }
453
+ .ple-plan-opt:hover {
454
+ border-color: #93c5fd;
455
+ background: #fafbff;
456
+ }
457
+ .ple-plan-opt--active {
458
+ border-color: var(--sa-primary, #2563eb);
459
+ background: #eff6ff;
460
+ box-shadow: 0 0 0 1px var(--sa-primary, #2563eb) inset;
461
+ }
462
+ .ple-plan-opt__dot {
463
+ width: 10px;
464
+ height: 10px;
465
+ border-radius: 50%;
466
+ flex: 0 0 auto;
467
+ }
468
+ .ple-plan-opt__text {
469
+ display: flex;
470
+ flex-direction: column;
471
+ flex: 1;
472
+ min-width: 0;
473
+ }
474
+ .ple-plan-opt__key {
475
+ font: 700 11px var(--sa-font-mono, ui-monospace, monospace);
476
+ letter-spacing: 0.05em;
477
+ color: var(--sa-heading, #0f172a);
478
+ }
479
+ .ple-plan-opt__label {
480
+ font-size: 11px;
481
+ color: var(--sa-muted, #64748b);
482
+ margin-top: 1px;
483
+ }
484
+ .ple-plan-opt__check {
485
+ color: #1d4ed8;
486
+ }
487
+
488
+ .ple-end-row {
489
+ display: flex;
490
+ align-items: center;
491
+ gap: 6px;
492
+ }
493
+ .ple-end-row .ple-input {
494
+ flex: 1;
495
+ }
496
+ .ple-btn-mini {
497
+ display: inline-flex;
498
+ align-items: center;
499
+ gap: 4px;
500
+ padding: 7px 10px;
501
+ background: #fff;
502
+ border: 1px solid var(--sa-border, #e2e8f0);
503
+ border-radius: 7px;
504
+ color: var(--sa-muted-dark, #475569);
505
+ font: 500 11.5px var(--sa-font-body, system-ui, sans-serif);
506
+ cursor: pointer;
507
+ white-space: nowrap;
508
+ }
509
+ .ple-btn-mini:hover {
510
+ background: #f8fafc;
511
+ border-color: #cbd5e1;
512
+ }
513
+ .ple-end-presets {
514
+ display: flex;
515
+ flex-wrap: wrap;
516
+ gap: 5px;
517
+ margin-top: 5px;
518
+ }
519
+ .ple-preset-btn {
520
+ padding: 4px 9px;
521
+ background: #fff;
522
+ border: 1px dashed #cbd5e1;
523
+ border-radius: 999px;
524
+ font: 600 11px var(--sa-font-body, system-ui, sans-serif);
525
+ color: var(--sa-muted-dark, #475569);
526
+ cursor: pointer;
527
+ transition:
528
+ background 0.12s,
529
+ border-color 0.12s,
530
+ color 0.12s;
531
+ }
532
+ .ple-preset-btn:hover {
533
+ background: #eff6ff;
534
+ border-color: #93c5fd;
535
+ border-style: solid;
536
+ color: #1d4ed8;
537
+ }
538
+
539
+ .ple-error {
540
+ background: #fef2f2;
541
+ border: 1px solid #fecaca;
542
+ color: #b91c1c;
543
+ font-size: 13px;
544
+ margin: 12px 0 0;
545
+ padding: 8px 12px;
546
+ border-radius: 8px;
547
+ }
548
+ </style>