@open-mercato/core 0.4.5-develop-610fbb24ec → 0.4.5-develop-811deeb983
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/dist/modules/catalog/backend/catalog/categories/[id]/edit/page.js +17 -2
- package/dist/modules/catalog/backend/catalog/categories/[id]/edit/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js +15 -0
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.js +30 -0
- package/dist/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.js.map +2 -2
- package/dist/modules/catalog/data/validators.js +4 -3
- package/dist/modules/catalog/data/validators.js.map +2 -2
- package/dist/modules/catalog/lib/messageObjectPreviews.js +146 -0
- package/dist/modules/catalog/lib/messageObjectPreviews.js.map +7 -0
- package/dist/modules/catalog/message-objects.js +95 -0
- package/dist/modules/catalog/message-objects.js.map +7 -0
- package/dist/modules/currencies/backend/currencies/[id]/page.js +21 -0
- package/dist/modules/currencies/backend/currencies/[id]/page.js.map +2 -2
- package/dist/modules/currencies/lib/messageObjectPreviews.js +51 -0
- package/dist/modules/currencies/lib/messageObjectPreviews.js.map +7 -0
- package/dist/modules/currencies/message-objects.js +41 -0
- package/dist/modules/currencies/message-objects.js.map +7 -0
- package/dist/modules/customers/backend/customers/companies/[id]/page.js +20 -0
- package/dist/modules/customers/backend/customers/companies/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/[id]/page.js +12 -1
- package/dist/modules/customers/backend/customers/deals/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people/[id]/page.js +20 -0
- package/dist/modules/customers/backend/customers/people/[id]/page.js.map +2 -2
- package/dist/modules/customers/components/detail/CompanyHighlights.js +18 -14
- package/dist/modules/customers/components/detail/CompanyHighlights.js.map +2 -2
- package/dist/modules/customers/components/detail/PersonHighlights.js +18 -14
- package/dist/modules/customers/components/detail/PersonHighlights.js.map +2 -2
- package/dist/modules/customers/lib/messageObjectPreviews.js +41 -5
- package/dist/modules/customers/lib/messageObjectPreviews.js.map +2 -2
- package/dist/modules/customers/message-objects.js +31 -11
- package/dist/modules/customers/message-objects.js.map +2 -2
- package/dist/modules/messages/commands/messages.js +3 -0
- package/dist/modules/messages/commands/messages.js.map +2 -2
- package/dist/modules/messages/components/message-detail/panels/objects-panel.js +6 -1
- package/dist/modules/messages/components/message-detail/panels/objects-panel.js.map +2 -2
- package/dist/modules/messages/components/message-detail/panels/thread-panel.js +4 -1
- package/dist/modules/messages/components/message-detail/panels/thread-panel.js.map +2 -2
- package/dist/modules/messages/frontend/messages/view/[token]/page.js +1 -0
- package/dist/modules/messages/frontend/messages/view/[token]/page.js.map +2 -2
- package/dist/modules/resources/backend/resources/resources/[id]/page.js +24 -7
- package/dist/modules/resources/backend/resources/resources/[id]/page.js.map +2 -2
- package/dist/modules/resources/lib/messageObjectPreviews.js +43 -0
- package/dist/modules/resources/lib/messageObjectPreviews.js.map +7 -0
- package/dist/modules/resources/message-objects.js +37 -0
- package/dist/modules/resources/message-objects.js.map +7 -0
- package/dist/modules/sales/backend/sales/channels/[channelId]/edit/page.js +19 -0
- package/dist/modules/sales/backend/sales/channels/[channelId]/edit/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/documents/[id]/page.js +23 -2
- package/dist/modules/sales/backend/sales/documents/[id]/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/quotes/[id]/page.js +1 -1
- package/dist/modules/sales/backend/sales/quotes/[id]/page.js.map +2 -2
- package/dist/modules/sales/lib/messageObjectPreviews.js +49 -4
- package/dist/modules/sales/lib/messageObjectPreviews.js.map +2 -2
- package/dist/modules/sales/message-objects.js +44 -2
- package/dist/modules/sales/message-objects.js.map +2 -2
- package/dist/modules/sales/widgets/messages/SalesDocumentMessageDetail.js +59 -30
- package/dist/modules/sales/widgets/messages/SalesDocumentMessageDetail.js.map +2 -2
- package/dist/modules/sales/widgets/messages/SalesDocumentMessagePreview.js +1 -1
- package/dist/modules/sales/widgets/messages/SalesDocumentMessagePreview.js.map +1 -1
- package/dist/modules/staff/backend/staff/leave-requests/[id]/page.js +8 -30
- package/dist/modules/staff/backend/staff/leave-requests/[id]/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/my-availability/page.js +13 -0
- package/dist/modules/staff/backend/staff/my-availability/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/my-leave-requests/[id]/page.js +8 -31
- package/dist/modules/staff/backend/staff/my-leave-requests/[id]/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/team-members/[id]/page.js +32 -10
- package/dist/modules/staff/backend/staff/team-members/[id]/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/team-roles/[id]/edit/page.js +14 -1
- package/dist/modules/staff/backend/staff/team-roles/[id]/edit/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js +14 -1
- package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js.map +2 -2
- package/dist/modules/staff/components/TeamForm.js +4 -2
- package/dist/modules/staff/components/TeamForm.js.map +2 -2
- package/dist/modules/staff/components/TeamRoleForm.js +4 -2
- package/dist/modules/staff/components/TeamRoleForm.js.map +2 -2
- package/dist/modules/staff/lib/messageObjectPreviews.js +111 -2
- package/dist/modules/staff/lib/messageObjectPreviews.js.map +2 -2
- package/dist/modules/staff/message-objects.js +79 -8
- package/dist/modules/staff/message-objects.js.map +2 -2
- package/package.json +3 -3
- package/src/modules/catalog/backend/catalog/categories/[id]/edit/page.tsx +19 -5
- package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +14 -0
- package/src/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.tsx +40 -0
- package/src/modules/catalog/data/validators.ts +47 -45
- package/src/modules/catalog/lib/messageObjectPreviews.ts +176 -0
- package/src/modules/catalog/message-objects.ts +102 -0
- package/src/modules/currencies/backend/currencies/[id]/page.tsx +20 -0
- package/src/modules/currencies/lib/messageObjectPreviews.ts +65 -0
- package/src/modules/currencies/message-objects.ts +40 -0
- package/src/modules/customers/backend/customers/companies/[id]/page.tsx +19 -0
- package/src/modules/customers/backend/customers/deals/[id]/page.tsx +13 -0
- package/src/modules/customers/backend/customers/people/[id]/page.tsx +19 -0
- package/src/modules/customers/components/detail/CompanyHighlights.tsx +14 -9
- package/src/modules/customers/components/detail/PersonHighlights.tsx +14 -9
- package/src/modules/customers/lib/messageObjectPreviews.ts +43 -3
- package/src/modules/customers/message-objects.ts +31 -11
- package/src/modules/customers/migrations/.snapshot-open-mercato.json +236 -0
- package/src/modules/customers/migrations/.snapshot-openmercato.json +236 -0
- package/src/modules/messages/commands/messages.ts +4 -0
- package/src/modules/messages/components/message-detail/panels/objects-panel.tsx +8 -1
- package/src/modules/messages/components/message-detail/panels/thread-panel.tsx +3 -0
- package/src/modules/messages/frontend/messages/view/[token]/page.tsx +1 -0
- package/src/modules/resources/backend/resources/resources/[id]/page.tsx +20 -4
- package/src/modules/resources/lib/messageObjectPreviews.ts +55 -0
- package/src/modules/resources/message-objects.ts +36 -0
- package/src/modules/sales/backend/sales/channels/[channelId]/edit/page.tsx +18 -0
- package/src/modules/sales/backend/sales/documents/[id]/page.tsx +23 -0
- package/src/modules/sales/backend/sales/quotes/[id]/page.tsx +1 -1
- package/src/modules/sales/lib/messageObjectPreviews.ts +54 -4
- package/src/modules/sales/message-objects.ts +44 -2
- package/src/modules/sales/widgets/messages/SalesDocumentMessageDetail.tsx +72 -34
- package/src/modules/sales/widgets/messages/SalesDocumentMessagePreview.tsx +1 -1
- package/src/modules/staff/backend/staff/leave-requests/[id]/page.tsx +7 -29
- package/src/modules/staff/backend/staff/my-availability/page.tsx +14 -0
- package/src/modules/staff/backend/staff/my-leave-requests/[id]/page.tsx +8 -30
- package/src/modules/staff/backend/staff/team-members/[id]/page.tsx +28 -7
- package/src/modules/staff/backend/staff/team-roles/[id]/edit/page.tsx +12 -0
- package/src/modules/staff/backend/staff/teams/[id]/edit/page.tsx +12 -0
- package/src/modules/staff/components/TeamForm.tsx +3 -0
- package/src/modules/staff/components/TeamRoleForm.tsx +3 -0
- package/src/modules/staff/lib/messageObjectPreviews.ts +133 -2
- package/src/modules/staff/message-objects.ts +79 -8
- package/dist/modules/customers/widgets/messages/CustomerMessageObjectDetail.js +0 -51
- package/dist/modules/customers/widgets/messages/CustomerMessageObjectDetail.js.map +0 -7
- package/dist/modules/customers/widgets/messages/CustomerMessageObjectPreview.js +0 -35
- package/dist/modules/customers/widgets/messages/CustomerMessageObjectPreview.js.map +0 -7
- package/dist/modules/customers/widgets/messages/index.js +0 -7
- package/dist/modules/customers/widgets/messages/index.js.map +0 -7
- package/dist/modules/staff/widgets/messages/StaffMessageObjectDetail.js +0 -51
- package/dist/modules/staff/widgets/messages/StaffMessageObjectDetail.js.map +0 -7
- package/dist/modules/staff/widgets/messages/StaffMessageObjectPreview.js +0 -34
- package/dist/modules/staff/widgets/messages/StaffMessageObjectPreview.js.map +0 -7
- package/dist/modules/staff/widgets/messages/index.js +0 -7
- package/dist/modules/staff/widgets/messages/index.js.map +0 -7
- package/src/modules/customers/widgets/messages/CustomerMessageObjectDetail.tsx +0 -57
- package/src/modules/customers/widgets/messages/CustomerMessageObjectPreview.tsx +0 -49
- package/src/modules/customers/widgets/messages/index.ts +0 -2
- package/src/modules/staff/widgets/messages/StaffMessageObjectDetail.tsx +0 -57
- package/src/modules/staff/widgets/messages/StaffMessageObjectPreview.tsx +0 -44
- package/src/modules/staff/widgets/messages/index.ts +0 -2
|
@@ -14,6 +14,7 @@ import { BooleanIcon } from '@open-mercato/ui/backend/ValueIcons'
|
|
|
14
14
|
import { flash } from '@open-mercato/ui/backend/FlashMessages'
|
|
15
15
|
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
16
16
|
import { TeamForm, type TeamFormValues, buildTeamPayload } from '@open-mercato/core/modules/staff/components/TeamForm'
|
|
17
|
+
import { SendObjectMessageDialog } from '@open-mercato/ui/backend/messages'
|
|
17
18
|
import { extractCustomFieldEntries } from '@open-mercato/shared/lib/crud/custom-fields-client'
|
|
18
19
|
import { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'
|
|
19
20
|
import { Plus } from 'lucide-react'
|
|
@@ -333,6 +334,17 @@ export default function StaffTeamEditPage({ params }: { params?: { id?: string }
|
|
|
333
334
|
onDelete={handleDelete}
|
|
334
335
|
isLoading={!initialValues}
|
|
335
336
|
loadingMessage={t('staff.teams.form.loading', 'Loading team...')}
|
|
337
|
+
extraActions={teamId ? (
|
|
338
|
+
<SendObjectMessageDialog
|
|
339
|
+
object={{
|
|
340
|
+
entityModule: 'staff',
|
|
341
|
+
entityType: 'team',
|
|
342
|
+
entityId: teamId,
|
|
343
|
+
previewData: { title: initialValues?.name ?? ''},
|
|
344
|
+
}}
|
|
345
|
+
viewHref={`/backend/staff/teams/${teamId}/edit`}
|
|
346
|
+
/>
|
|
347
|
+
) : undefined}
|
|
336
348
|
/>
|
|
337
349
|
) : (
|
|
338
350
|
<DataTable<TeamMemberRow>
|
|
@@ -24,6 +24,7 @@ export type TeamFormProps = {
|
|
|
24
24
|
onDelete?: () => Promise<void>
|
|
25
25
|
isLoading?: boolean
|
|
26
26
|
loadingMessage?: string
|
|
27
|
+
extraActions?: React.ReactNode
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
const normalizeCustomFieldSubmitValue = (value: unknown): unknown => {
|
|
@@ -60,6 +61,7 @@ export function TeamForm(props: TeamFormProps) {
|
|
|
60
61
|
onDelete,
|
|
61
62
|
isLoading,
|
|
62
63
|
loadingMessage,
|
|
64
|
+
extraActions,
|
|
63
65
|
} = props
|
|
64
66
|
const t = useT()
|
|
65
67
|
|
|
@@ -91,6 +93,7 @@ export function TeamForm(props: TeamFormProps) {
|
|
|
91
93
|
onDelete={onDelete}
|
|
92
94
|
isLoading={isLoading}
|
|
93
95
|
loadingMessage={loadingMessage}
|
|
96
|
+
extraActions={extraActions}
|
|
94
97
|
/>
|
|
95
98
|
)
|
|
96
99
|
}
|
|
@@ -32,6 +32,7 @@ export type TeamRoleFormProps = {
|
|
|
32
32
|
onDelete?: () => Promise<void>
|
|
33
33
|
isLoading?: boolean
|
|
34
34
|
loadingMessage?: string
|
|
35
|
+
extraActions?: React.ReactNode
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
const normalizeCustomFieldSubmitValue = (value: unknown): unknown => {
|
|
@@ -75,6 +76,7 @@ export function TeamRoleForm(props: TeamRoleFormProps) {
|
|
|
75
76
|
onDelete,
|
|
76
77
|
isLoading,
|
|
77
78
|
loadingMessage,
|
|
79
|
+
extraActions,
|
|
78
80
|
} = props
|
|
79
81
|
const t = useT()
|
|
80
82
|
|
|
@@ -154,6 +156,7 @@ export function TeamRoleForm(props: TeamRoleFormProps) {
|
|
|
154
156
|
onDelete={onDelete}
|
|
155
157
|
isLoading={isLoading}
|
|
156
158
|
loadingMessage={loadingMessage}
|
|
159
|
+
extraActions={extraActions}
|
|
157
160
|
/>
|
|
158
161
|
)
|
|
159
162
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { createRequestContainer } from '@open-mercato/shared/lib/di/container'
|
|
2
|
-
import { findOneWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
2
|
+
import { findOneWithDecryption, findWithDecryption } from '@open-mercato/shared/lib/encryption/find'
|
|
3
3
|
import { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'
|
|
4
4
|
import type { ObjectPreviewData } from '@open-mercato/shared/modules/messages/types'
|
|
5
5
|
import type { EntityManager } from '@mikro-orm/postgresql'
|
|
6
|
-
import { StaffLeaveRequest, StaffTeam, StaffTeamMember } from '../data/entities'
|
|
6
|
+
import { StaffLeaveRequest, StaffTeam, StaffTeamMember, StaffTeamRole } from '../data/entities'
|
|
7
|
+
import { PlannerAvailabilityRuleSet } from '../../planner/data/entities'
|
|
8
|
+
import { User } from '../../auth/data/entities'
|
|
7
9
|
|
|
8
10
|
type PreviewContext = {
|
|
9
11
|
tenantId: string
|
|
@@ -170,6 +172,56 @@ export async function loadTeamMemberPreview(
|
|
|
170
172
|
|
|
171
173
|
const tags = Array.isArray(member.tags) ? member.tags : []
|
|
172
174
|
const metadata: Record<string, string> = {}
|
|
175
|
+
const teamLabel = t('staff.teamMembers.detail.fields.team')
|
|
176
|
+
const userLabel = t('staff.teamMembers.detail.fields.user')
|
|
177
|
+
const rolesLabel = t('staff.teamMembers.detail.fields.roles')
|
|
178
|
+
|
|
179
|
+
if (member.teamId) {
|
|
180
|
+
const team = await findOneWithDecryption(
|
|
181
|
+
em,
|
|
182
|
+
StaffTeam,
|
|
183
|
+
{
|
|
184
|
+
id: member.teamId,
|
|
185
|
+
tenantId: ctx.tenantId,
|
|
186
|
+
organizationId: ctx.organizationId,
|
|
187
|
+
deletedAt: null,
|
|
188
|
+
},
|
|
189
|
+
undefined,
|
|
190
|
+
{ tenantId: ctx.tenantId, organizationId: ctx.organizationId },
|
|
191
|
+
)
|
|
192
|
+
if (team?.name) metadata[teamLabel] = team.name
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (member.userId) {
|
|
196
|
+
const user = await findOneWithDecryption(
|
|
197
|
+
em,
|
|
198
|
+
User,
|
|
199
|
+
{ id: member.userId },
|
|
200
|
+
undefined,
|
|
201
|
+
{ tenantId: ctx.tenantId, organizationId: ctx.organizationId },
|
|
202
|
+
)
|
|
203
|
+
if (user?.email) metadata[userLabel] = user.email
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (Array.isArray(member.roleIds) && member.roleIds.length > 0) {
|
|
207
|
+
const roles = await findWithDecryption(
|
|
208
|
+
em,
|
|
209
|
+
StaffTeamRole,
|
|
210
|
+
{
|
|
211
|
+
id: { $in: member.roleIds },
|
|
212
|
+
tenantId: ctx.tenantId,
|
|
213
|
+
organizationId: ctx.organizationId,
|
|
214
|
+
deletedAt: null,
|
|
215
|
+
},
|
|
216
|
+
{ orderBy: { name: 'ASC' } },
|
|
217
|
+
{ tenantId: ctx.tenantId, organizationId: ctx.organizationId },
|
|
218
|
+
)
|
|
219
|
+
const roleNames = roles
|
|
220
|
+
.map((role) => role.name?.trim())
|
|
221
|
+
.filter((name): name is string => Boolean(name && name.length > 0))
|
|
222
|
+
if (roleNames.length > 0) metadata[rolesLabel] = roleNames.join(', ')
|
|
223
|
+
}
|
|
224
|
+
|
|
173
225
|
if (tags.length > 0) metadata.Tags = tags.slice(0, 5).join(', ')
|
|
174
226
|
|
|
175
227
|
return {
|
|
@@ -180,3 +232,82 @@ export async function loadTeamMemberPreview(
|
|
|
180
232
|
metadata: Object.keys(metadata).length > 0 ? metadata : undefined,
|
|
181
233
|
}
|
|
182
234
|
}
|
|
235
|
+
|
|
236
|
+
export async function loadStaffTeamRolePreview(
|
|
237
|
+
entityId: string,
|
|
238
|
+
ctx: PreviewContext,
|
|
239
|
+
): Promise<ObjectPreviewData> {
|
|
240
|
+
const { t } = await resolveTranslations()
|
|
241
|
+
const defaultTitle = t('staff.messageObjects.teamRole.title')
|
|
242
|
+
|
|
243
|
+
if (!ctx.organizationId) {
|
|
244
|
+
return { title: defaultTitle, subtitle: entityId }
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const { resolve } = await createRequestContainer()
|
|
248
|
+
const em = resolve('em') as EntityManager
|
|
249
|
+
|
|
250
|
+
const role = await findOneWithDecryption(
|
|
251
|
+
em,
|
|
252
|
+
StaffTeamRole,
|
|
253
|
+
{
|
|
254
|
+
id: entityId,
|
|
255
|
+
tenantId: ctx.tenantId,
|
|
256
|
+
organizationId: ctx.organizationId,
|
|
257
|
+
deletedAt: null,
|
|
258
|
+
},
|
|
259
|
+
undefined,
|
|
260
|
+
{ tenantId: ctx.tenantId, organizationId: ctx.organizationId },
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
if (!role) {
|
|
264
|
+
return {
|
|
265
|
+
title: defaultTitle,
|
|
266
|
+
subtitle: entityId,
|
|
267
|
+
status: t('staff.messageObjects.notFound'),
|
|
268
|
+
statusColor: 'gray',
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
return {
|
|
273
|
+
title: role.name,
|
|
274
|
+
subtitle: role.description ?? undefined,
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export async function loadStaffAvailabilityPreview(
|
|
279
|
+
entityId: string,
|
|
280
|
+
ctx: PreviewContext,
|
|
281
|
+
): Promise<ObjectPreviewData> {
|
|
282
|
+
const { t } = await resolveTranslations()
|
|
283
|
+
const defaultTitle = t('staff.messageObjects.myAvailability.title')
|
|
284
|
+
|
|
285
|
+
if (!ctx.organizationId) {
|
|
286
|
+
return { title: defaultTitle, subtitle: entityId }
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const { resolve } = await createRequestContainer()
|
|
290
|
+
const em = resolve('em') as EntityManager
|
|
291
|
+
|
|
292
|
+
const ruleSet = await findOneWithDecryption(
|
|
293
|
+
em,
|
|
294
|
+
PlannerAvailabilityRuleSet,
|
|
295
|
+
{
|
|
296
|
+
id: entityId,
|
|
297
|
+
tenantId: ctx.tenantId,
|
|
298
|
+
organizationId: ctx.organizationId,
|
|
299
|
+
deletedAt: null,
|
|
300
|
+
},
|
|
301
|
+
undefined,
|
|
302
|
+
{ tenantId: ctx.tenantId, organizationId: ctx.organizationId },
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
if (!ruleSet) {
|
|
306
|
+
return { title: defaultTitle, subtitle: entityId }
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return {
|
|
310
|
+
title: ruleSet.name,
|
|
311
|
+
subtitle: ruleSet.description ?? undefined,
|
|
312
|
+
}
|
|
313
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { MessageObjectTypeDefinition } from '@open-mercato/shared/modules/messages/types'
|
|
2
|
+
import { MessageObjectDetail, MessageObjectPreview } from '@open-mercato/ui/backend/messages'
|
|
2
3
|
import { LeaveRequestDetail } from './components/LeaveRequestDetail'
|
|
3
4
|
import { LeaveRequestPreview } from './components/LeaveRequestPreview'
|
|
4
|
-
import { StaffMessageObjectDetail } from './widgets/messages/StaffMessageObjectDetail'
|
|
5
|
-
import { StaffMessageObjectPreview } from './widgets/messages/StaffMessageObjectPreview'
|
|
6
5
|
|
|
7
6
|
export const messageObjectTypes: MessageObjectTypeDefinition[] = [
|
|
8
7
|
{
|
|
@@ -60,9 +59,18 @@ export const messageObjectTypes: MessageObjectTypeDefinition[] = [
|
|
|
60
59
|
optionSubtitleField: 'description',
|
|
61
60
|
labelKey: 'staff.teams.page.title',
|
|
62
61
|
icon: 'users',
|
|
63
|
-
PreviewComponent:
|
|
64
|
-
DetailComponent:
|
|
65
|
-
actions: [
|
|
62
|
+
PreviewComponent: MessageObjectPreview,
|
|
63
|
+
DetailComponent: MessageObjectDetail,
|
|
64
|
+
actions: [
|
|
65
|
+
{
|
|
66
|
+
id: 'view',
|
|
67
|
+
labelKey: 'common.view',
|
|
68
|
+
variant: 'outline',
|
|
69
|
+
href: '/backend/staff/teams/{entityId}/edit',
|
|
70
|
+
icon: 'external-link',
|
|
71
|
+
isTerminal: false,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
66
74
|
loadPreview: async (entityId, ctx) => {
|
|
67
75
|
if (typeof window !== 'undefined') {
|
|
68
76
|
return {
|
|
@@ -83,9 +91,18 @@ export const messageObjectTypes: MessageObjectTypeDefinition[] = [
|
|
|
83
91
|
optionSubtitleField: 'email',
|
|
84
92
|
labelKey: 'staff.teamMembers.page.title',
|
|
85
93
|
icon: 'user-round',
|
|
86
|
-
PreviewComponent:
|
|
87
|
-
DetailComponent:
|
|
88
|
-
actions: [
|
|
94
|
+
PreviewComponent: MessageObjectPreview,
|
|
95
|
+
DetailComponent: MessageObjectDetail,
|
|
96
|
+
actions: [
|
|
97
|
+
{
|
|
98
|
+
id: 'view',
|
|
99
|
+
labelKey: 'common.view',
|
|
100
|
+
variant: 'outline',
|
|
101
|
+
href: '/backend/staff/team-members/{entityId}',
|
|
102
|
+
icon: 'external-link',
|
|
103
|
+
isTerminal: false,
|
|
104
|
+
},
|
|
105
|
+
],
|
|
89
106
|
loadPreview: async (entityId, ctx) => {
|
|
90
107
|
if (typeof window !== 'undefined') {
|
|
91
108
|
return {
|
|
@@ -97,6 +114,60 @@ export const messageObjectTypes: MessageObjectTypeDefinition[] = [
|
|
|
97
114
|
return loadTeamMemberPreview(entityId, ctx)
|
|
98
115
|
},
|
|
99
116
|
},
|
|
117
|
+
{
|
|
118
|
+
module: 'staff',
|
|
119
|
+
entityType: 'team_role',
|
|
120
|
+
messageTypes: ['default', 'messages.defaultWithObjects'],
|
|
121
|
+
entityId: 'staff:staff_team_role',
|
|
122
|
+
optionLabelField: 'name',
|
|
123
|
+
optionSubtitleField: 'description',
|
|
124
|
+
labelKey: 'staff.messageObjects.teamRole.title',
|
|
125
|
+
icon: 'shield',
|
|
126
|
+
PreviewComponent: MessageObjectPreview,
|
|
127
|
+
DetailComponent: MessageObjectDetail,
|
|
128
|
+
actions: [
|
|
129
|
+
{
|
|
130
|
+
id: 'view',
|
|
131
|
+
labelKey: 'common.view',
|
|
132
|
+
variant: 'outline',
|
|
133
|
+
href: '/backend/staff/team-roles/{entityId}/edit',
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
loadPreview: async (entityId, ctx) => {
|
|
137
|
+
if (typeof window !== 'undefined') {
|
|
138
|
+
return { title: 'Team role', subtitle: entityId }
|
|
139
|
+
}
|
|
140
|
+
const { loadStaffTeamRolePreview } = await import('./lib/messageObjectPreviews')
|
|
141
|
+
return loadStaffTeamRolePreview(entityId, ctx)
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
module: 'staff',
|
|
146
|
+
entityType: 'my_availability',
|
|
147
|
+
messageTypes: ['default', 'messages.defaultWithObjects'],
|
|
148
|
+
entityId: 'planner:planner_availability_rule_set',
|
|
149
|
+
optionLabelField: 'name',
|
|
150
|
+
optionSubtitleField: 'description',
|
|
151
|
+
labelKey: 'staff.messageObjects.myAvailability.title',
|
|
152
|
+
icon: 'calendar-clock',
|
|
153
|
+
PreviewComponent: MessageObjectPreview,
|
|
154
|
+
DetailComponent: MessageObjectDetail,
|
|
155
|
+
actions: [
|
|
156
|
+
{
|
|
157
|
+
id: 'view',
|
|
158
|
+
labelKey: 'common.view',
|
|
159
|
+
variant: 'outline',
|
|
160
|
+
href: '/backend/staff/my-availability',
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
loadPreview: async (entityId, ctx) => {
|
|
164
|
+
if (typeof window !== 'undefined') {
|
|
165
|
+
return { title: 'My availability', subtitle: entityId }
|
|
166
|
+
}
|
|
167
|
+
const { loadStaffAvailabilityPreview } = await import('./lib/messageObjectPreviews')
|
|
168
|
+
return loadStaffAvailabilityPreview(entityId, ctx)
|
|
169
|
+
},
|
|
170
|
+
},
|
|
100
171
|
]
|
|
101
172
|
|
|
102
173
|
export default messageObjectTypes
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
5
|
-
import { Button } from "@open-mercato/ui/primitives/button";
|
|
6
|
-
import { CustomerMessageObjectPreview } from "./CustomerMessageObjectPreview.js";
|
|
7
|
-
function CustomerMessageObjectDetail(props) {
|
|
8
|
-
const t = useT();
|
|
9
|
-
const [executingActionId, setExecutingActionId] = React.useState(null);
|
|
10
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-3 rounded border p-3", children: [
|
|
11
|
-
/* @__PURE__ */ jsx(
|
|
12
|
-
CustomerMessageObjectPreview,
|
|
13
|
-
{
|
|
14
|
-
entityId: props.entityId,
|
|
15
|
-
entityModule: props.entityModule,
|
|
16
|
-
entityType: props.entityType,
|
|
17
|
-
snapshot: props.snapshot,
|
|
18
|
-
previewData: props.previewData,
|
|
19
|
-
actionRequired: props.actionRequired,
|
|
20
|
-
actionType: props.actionType,
|
|
21
|
-
actionLabel: props.actionLabel
|
|
22
|
-
}
|
|
23
|
-
),
|
|
24
|
-
props.actions.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: props.actions.map((action) => /* @__PURE__ */ jsx(
|
|
25
|
-
Button,
|
|
26
|
-
{
|
|
27
|
-
type: "button",
|
|
28
|
-
size: "sm",
|
|
29
|
-
variant: action.variant ?? "default",
|
|
30
|
-
disabled: executingActionId !== null,
|
|
31
|
-
onClick: async () => {
|
|
32
|
-
if (executingActionId) return;
|
|
33
|
-
setExecutingActionId(action.id);
|
|
34
|
-
try {
|
|
35
|
-
await props.onAction(action.id, { id: props.entityId });
|
|
36
|
-
} finally {
|
|
37
|
-
setExecutingActionId(null);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
children: executingActionId === action.id ? t("messages.actions.executing", "Executing...") : t(action.labelKey ?? action.id, action.id)
|
|
41
|
-
},
|
|
42
|
-
action.id
|
|
43
|
-
)) }) : null
|
|
44
|
-
] });
|
|
45
|
-
}
|
|
46
|
-
var CustomerMessageObjectDetail_default = CustomerMessageObjectDetail;
|
|
47
|
-
export {
|
|
48
|
-
CustomerMessageObjectDetail,
|
|
49
|
-
CustomerMessageObjectDetail_default as default
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=CustomerMessageObjectDetail.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/modules/customers/widgets/messages/CustomerMessageObjectDetail.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { ObjectDetailProps } from '@open-mercato/shared/modules/messages/types'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { CustomerMessageObjectPreview } from './CustomerMessageObjectPreview'\n\nexport function CustomerMessageObjectDetail(props: ObjectDetailProps) {\n const t = useT()\n const [executingActionId, setExecutingActionId] = React.useState<string | null>(null)\n\n return (\n <div className=\"space-y-3 rounded border p-3\">\n <CustomerMessageObjectPreview\n entityId={props.entityId}\n entityModule={props.entityModule}\n entityType={props.entityType}\n snapshot={props.snapshot}\n previewData={props.previewData}\n actionRequired={props.actionRequired}\n actionType={props.actionType}\n actionLabel={props.actionLabel}\n />\n\n {props.actions.length > 0 ? (\n <div className=\"flex flex-wrap gap-2\">\n {props.actions.map((action) => (\n <Button\n key={action.id}\n type=\"button\"\n size=\"sm\"\n variant={action.variant ?? 'default'}\n disabled={executingActionId !== null}\n onClick={async () => {\n if (executingActionId) return\n setExecutingActionId(action.id)\n try {\n await props.onAction(action.id, { id: props.entityId })\n } finally {\n setExecutingActionId(null)\n }\n }}\n >\n {executingActionId === action.id\n ? t('messages.actions.executing', 'Executing...')\n : t(action.labelKey ?? action.id, action.id)}\n </Button>\n ))}\n </div>\n ) : null}\n </div>\n )\n}\n\nexport default CustomerMessageObjectDetail\n\n"],
|
|
5
|
-
"mappings": ";AAaI,SACE,KADF;AAXJ,YAAY,WAAW;AACvB,SAAS,YAAY;AAErB,SAAS,cAAc;AACvB,SAAS,oCAAoC;AAEtC,SAAS,4BAA4B,OAA0B;AACpE,QAAM,IAAI,KAAK;AACf,QAAM,CAAC,mBAAmB,oBAAoB,IAAI,MAAM,SAAwB,IAAI;AAEpF,SACE,qBAAC,SAAI,WAAU,gCACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,UAAU,MAAM;AAAA,QAChB,cAAc,MAAM;AAAA,QACpB,YAAY,MAAM;AAAA,QAClB,UAAU,MAAM;AAAA,QAChB,aAAa,MAAM;AAAA,QACnB,gBAAgB,MAAM;AAAA,QACtB,YAAY,MAAM;AAAA,QAClB,aAAa,MAAM;AAAA;AAAA,IACrB;AAAA,IAEC,MAAM,QAAQ,SAAS,IACtB,oBAAC,SAAI,WAAU,wBACZ,gBAAM,QAAQ,IAAI,CAAC,WAClB;AAAA,MAAC;AAAA;AAAA,QAEC,MAAK;AAAA,QACL,MAAK;AAAA,QACL,SAAS,OAAO,WAAW;AAAA,QAC3B,UAAU,sBAAsB;AAAA,QAChC,SAAS,YAAY;AACnB,cAAI,kBAAmB;AACvB,+BAAqB,OAAO,EAAE;AAC9B,cAAI;AACF,kBAAM,MAAM,SAAS,OAAO,IAAI,EAAE,IAAI,MAAM,SAAS,CAAC;AAAA,UACxD,UAAE;AACA,iCAAqB,IAAI;AAAA,UAC3B;AAAA,QACF;AAAA,QAEC,gCAAsB,OAAO,KAC1B,EAAE,8BAA8B,cAAc,IAC9C,EAAE,OAAO,YAAY,OAAO,IAAI,OAAO,EAAE;AAAA;AAAA,MAjBxC,OAAO;AAAA,IAkBd,CACD,GACH,IACE;AAAA,KACN;AAEJ;AAEA,IAAO,sCAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Building2, BriefcaseBusiness, UserRound } from "lucide-react";
|
|
4
|
-
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
5
|
-
import { Badge } from "@open-mercato/ui/primitives/badge";
|
|
6
|
-
function CustomerMessageObjectPreview({
|
|
7
|
-
entityType,
|
|
8
|
-
entityId,
|
|
9
|
-
previewData,
|
|
10
|
-
actionRequired,
|
|
11
|
-
actionLabel
|
|
12
|
-
}) {
|
|
13
|
-
const t = useT();
|
|
14
|
-
const isCompany = entityType === "company";
|
|
15
|
-
const isDeal = entityType === "deal";
|
|
16
|
-
const Icon = isDeal ? BriefcaseBusiness : isCompany ? Building2 : UserRound;
|
|
17
|
-
const fallbackTitle = isDeal ? t("customers.deals.list.title", "Deals") : isCompany ? t("customers.companies.list.title", "Companies") : t("customers.people.list.title", "People");
|
|
18
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 rounded-md border bg-muted/20 p-3", children: [
|
|
19
|
-
/* @__PURE__ */ jsx(Icon, { className: "mt-0.5 h-4 w-4 text-muted-foreground" }),
|
|
20
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 space-y-1", children: [
|
|
21
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
22
|
-
/* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium", children: previewData?.title || fallbackTitle }),
|
|
23
|
-
actionRequired ? /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: actionLabel || t("messages.composer.objectActionRequired", "Action required") }) : null
|
|
24
|
-
] }),
|
|
25
|
-
/* @__PURE__ */ jsx("p", { className: "truncate text-xs text-muted-foreground", children: previewData?.subtitle || entityId }),
|
|
26
|
-
previewData?.status ? /* @__PURE__ */ jsx(Badge, { variant: "outline", className: "text-xs", children: previewData.status }) : null
|
|
27
|
-
] })
|
|
28
|
-
] });
|
|
29
|
-
}
|
|
30
|
-
var CustomerMessageObjectPreview_default = CustomerMessageObjectPreview;
|
|
31
|
-
export {
|
|
32
|
-
CustomerMessageObjectPreview,
|
|
33
|
-
CustomerMessageObjectPreview_default as default
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=CustomerMessageObjectPreview.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/modules/customers/widgets/messages/CustomerMessageObjectPreview.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport { Building2, BriefcaseBusiness, UserRound } from 'lucide-react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { ObjectPreviewProps } from '@open-mercato/shared/modules/messages/types'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\n\nexport function CustomerMessageObjectPreview({\n entityType,\n entityId,\n previewData,\n actionRequired,\n actionLabel,\n}: ObjectPreviewProps) {\n const t = useT()\n\n const isCompany = entityType === 'company'\n const isDeal = entityType === 'deal'\n const Icon = isDeal ? BriefcaseBusiness : isCompany ? Building2 : UserRound\n\n const fallbackTitle = isDeal\n ? t('customers.deals.list.title', 'Deals')\n : isCompany\n ? t('customers.companies.list.title', 'Companies')\n : t('customers.people.list.title', 'People')\n\n return (\n <div className=\"flex items-start gap-3 rounded-md border bg-muted/20 p-3\">\n <Icon className=\"mt-0.5 h-4 w-4 text-muted-foreground\" />\n <div className=\"min-w-0 flex-1 space-y-1\">\n <div className=\"flex items-center gap-2\">\n <p className=\"truncate text-sm font-medium\">{previewData?.title || fallbackTitle}</p>\n {actionRequired ? (\n <Badge variant=\"secondary\" className=\"text-xs\">\n {actionLabel || t('messages.composer.objectActionRequired', 'Action required')}\n </Badge>\n ) : null}\n </div>\n <p className=\"truncate text-xs text-muted-foreground\">{previewData?.subtitle || entityId}</p>\n {previewData?.status ? (\n <Badge variant=\"outline\" className=\"text-xs\">{previewData.status}</Badge>\n ) : null}\n </div>\n </div>\n )\n}\n\nexport default CustomerMessageObjectPreview\n\n"],
|
|
5
|
-
"mappings": ";AA4BM,cAEE,YAFF;AA1BN,SAAS,WAAW,mBAAmB,iBAAiB;AACxD,SAAS,YAAY;AAErB,SAAS,aAAa;AAEf,SAAS,6BAA6B;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAuB;AACrB,QAAM,IAAI,KAAK;AAEf,QAAM,YAAY,eAAe;AACjC,QAAM,SAAS,eAAe;AAC9B,QAAM,OAAO,SAAS,oBAAoB,YAAY,YAAY;AAElE,QAAM,gBAAgB,SAClB,EAAE,8BAA8B,OAAO,IACvC,YACE,EAAE,kCAAkC,WAAW,IAC/C,EAAE,+BAA+B,QAAQ;AAE/C,SACE,qBAAC,SAAI,WAAU,4DACb;AAAA,wBAAC,QAAK,WAAU,wCAAuC;AAAA,IACvD,qBAAC,SAAI,WAAU,4BACb;AAAA,2BAAC,SAAI,WAAU,2BACb;AAAA,4BAAC,OAAE,WAAU,gCAAgC,uBAAa,SAAS,eAAc;AAAA,QAChF,iBACC,oBAAC,SAAM,SAAQ,aAAY,WAAU,WAClC,yBAAe,EAAE,0CAA0C,iBAAiB,GAC/E,IACE;AAAA,SACN;AAAA,MACA,oBAAC,OAAE,WAAU,0CAA0C,uBAAa,YAAY,UAAS;AAAA,MACxF,aAAa,SACZ,oBAAC,SAAM,SAAQ,WAAU,WAAU,WAAW,sBAAY,QAAO,IAC/D;AAAA,OACN;AAAA,KACF;AAEJ;AAEA,IAAO,uCAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CustomerMessageObjectDetail } from "./CustomerMessageObjectDetail.js";
|
|
2
|
-
import { CustomerMessageObjectPreview } from "./CustomerMessageObjectPreview.js";
|
|
3
|
-
export {
|
|
4
|
-
CustomerMessageObjectDetail,
|
|
5
|
-
CustomerMessageObjectPreview
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/modules/customers/widgets/messages/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { CustomerMessageObjectDetail } from './CustomerMessageObjectDetail'\nexport { CustomerMessageObjectPreview } from './CustomerMessageObjectPreview'\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,mCAAmC;AAC5C,SAAS,oCAAoC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
5
|
-
import { Button } from "@open-mercato/ui/primitives/button";
|
|
6
|
-
import { StaffMessageObjectPreview } from "./StaffMessageObjectPreview.js";
|
|
7
|
-
function StaffMessageObjectDetail(props) {
|
|
8
|
-
const t = useT();
|
|
9
|
-
const [executingActionId, setExecutingActionId] = React.useState(null);
|
|
10
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-3 rounded border p-3", children: [
|
|
11
|
-
/* @__PURE__ */ jsx(
|
|
12
|
-
StaffMessageObjectPreview,
|
|
13
|
-
{
|
|
14
|
-
entityId: props.entityId,
|
|
15
|
-
entityModule: props.entityModule,
|
|
16
|
-
entityType: props.entityType,
|
|
17
|
-
snapshot: props.snapshot,
|
|
18
|
-
previewData: props.previewData,
|
|
19
|
-
actionRequired: props.actionRequired,
|
|
20
|
-
actionType: props.actionType,
|
|
21
|
-
actionLabel: props.actionLabel
|
|
22
|
-
}
|
|
23
|
-
),
|
|
24
|
-
props.actions.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: props.actions.map((action) => /* @__PURE__ */ jsx(
|
|
25
|
-
Button,
|
|
26
|
-
{
|
|
27
|
-
type: "button",
|
|
28
|
-
size: "sm",
|
|
29
|
-
variant: action.variant ?? "default",
|
|
30
|
-
disabled: executingActionId !== null,
|
|
31
|
-
onClick: async () => {
|
|
32
|
-
if (executingActionId) return;
|
|
33
|
-
setExecutingActionId(action.id);
|
|
34
|
-
try {
|
|
35
|
-
await props.onAction(action.id, { id: props.entityId });
|
|
36
|
-
} finally {
|
|
37
|
-
setExecutingActionId(null);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
children: executingActionId === action.id ? t("messages.actions.executing", "Executing...") : t(action.labelKey ?? action.id, action.id)
|
|
41
|
-
},
|
|
42
|
-
action.id
|
|
43
|
-
)) }) : null
|
|
44
|
-
] });
|
|
45
|
-
}
|
|
46
|
-
var StaffMessageObjectDetail_default = StaffMessageObjectDetail;
|
|
47
|
-
export {
|
|
48
|
-
StaffMessageObjectDetail,
|
|
49
|
-
StaffMessageObjectDetail_default as default
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=StaffMessageObjectDetail.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/modules/staff/widgets/messages/StaffMessageObjectDetail.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { ObjectDetailProps } from '@open-mercato/shared/modules/messages/types'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { StaffMessageObjectPreview } from './StaffMessageObjectPreview'\n\nexport function StaffMessageObjectDetail(props: ObjectDetailProps) {\n const t = useT()\n const [executingActionId, setExecutingActionId] = React.useState<string | null>(null)\n\n return (\n <div className=\"space-y-3 rounded border p-3\">\n <StaffMessageObjectPreview\n entityId={props.entityId}\n entityModule={props.entityModule}\n entityType={props.entityType}\n snapshot={props.snapshot}\n previewData={props.previewData}\n actionRequired={props.actionRequired}\n actionType={props.actionType}\n actionLabel={props.actionLabel}\n />\n\n {props.actions.length > 0 ? (\n <div className=\"flex flex-wrap gap-2\">\n {props.actions.map((action) => (\n <Button\n key={action.id}\n type=\"button\"\n size=\"sm\"\n variant={action.variant ?? 'default'}\n disabled={executingActionId !== null}\n onClick={async () => {\n if (executingActionId) return\n setExecutingActionId(action.id)\n try {\n await props.onAction(action.id, { id: props.entityId })\n } finally {\n setExecutingActionId(null)\n }\n }}\n >\n {executingActionId === action.id\n ? t('messages.actions.executing', 'Executing...')\n : t(action.labelKey ?? action.id, action.id)}\n </Button>\n ))}\n </div>\n ) : null}\n </div>\n )\n}\n\nexport default StaffMessageObjectDetail\n\n"],
|
|
5
|
-
"mappings": ";AAaI,SACE,KADF;AAXJ,YAAY,WAAW;AACvB,SAAS,YAAY;AAErB,SAAS,cAAc;AACvB,SAAS,iCAAiC;AAEnC,SAAS,yBAAyB,OAA0B;AACjE,QAAM,IAAI,KAAK;AACf,QAAM,CAAC,mBAAmB,oBAAoB,IAAI,MAAM,SAAwB,IAAI;AAEpF,SACE,qBAAC,SAAI,WAAU,gCACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,UAAU,MAAM;AAAA,QAChB,cAAc,MAAM;AAAA,QACpB,YAAY,MAAM;AAAA,QAClB,UAAU,MAAM;AAAA,QAChB,aAAa,MAAM;AAAA,QACnB,gBAAgB,MAAM;AAAA,QACtB,YAAY,MAAM;AAAA,QAClB,aAAa,MAAM;AAAA;AAAA,IACrB;AAAA,IAEC,MAAM,QAAQ,SAAS,IACtB,oBAAC,SAAI,WAAU,wBACZ,gBAAM,QAAQ,IAAI,CAAC,WAClB;AAAA,MAAC;AAAA;AAAA,QAEC,MAAK;AAAA,QACL,MAAK;AAAA,QACL,SAAS,OAAO,WAAW;AAAA,QAC3B,UAAU,sBAAsB;AAAA,QAChC,SAAS,YAAY;AACnB,cAAI,kBAAmB;AACvB,+BAAqB,OAAO,EAAE;AAC9B,cAAI;AACF,kBAAM,MAAM,SAAS,OAAO,IAAI,EAAE,IAAI,MAAM,SAAS,CAAC;AAAA,UACxD,UAAE;AACA,iCAAqB,IAAI;AAAA,UAC3B;AAAA,QACF;AAAA,QAEC,gCAAsB,OAAO,KAC1B,EAAE,8BAA8B,cAAc,IAC9C,EAAE,OAAO,YAAY,OAAO,IAAI,OAAO,EAAE;AAAA;AAAA,MAjBxC,OAAO;AAAA,IAkBd,CACD,GACH,IACE;AAAA,KACN;AAEJ;AAEA,IAAO,mCAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { UserRound, Users } from "lucide-react";
|
|
4
|
-
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
5
|
-
import { Badge } from "@open-mercato/ui/primitives/badge";
|
|
6
|
-
function StaffMessageObjectPreview({
|
|
7
|
-
entityType,
|
|
8
|
-
entityId,
|
|
9
|
-
previewData,
|
|
10
|
-
actionRequired,
|
|
11
|
-
actionLabel
|
|
12
|
-
}) {
|
|
13
|
-
const t = useT();
|
|
14
|
-
const isTeam = entityType === "team";
|
|
15
|
-
const Icon = isTeam ? Users : UserRound;
|
|
16
|
-
const fallbackTitle = isTeam ? t("staff.teams.page.title", "Teams") : t("staff.teamMembers.page.title", "Team members");
|
|
17
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 rounded-md border bg-muted/20 p-3", children: [
|
|
18
|
-
/* @__PURE__ */ jsx(Icon, { className: "mt-0.5 h-4 w-4 text-muted-foreground" }),
|
|
19
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 space-y-1", children: [
|
|
20
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
21
|
-
/* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium", children: previewData?.title || fallbackTitle }),
|
|
22
|
-
actionRequired ? /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: actionLabel || t("messages.composer.objectActionRequired", "Action required") }) : null
|
|
23
|
-
] }),
|
|
24
|
-
/* @__PURE__ */ jsx("p", { className: "truncate text-xs text-muted-foreground", children: previewData?.subtitle || entityId }),
|
|
25
|
-
previewData?.status ? /* @__PURE__ */ jsx(Badge, { variant: "outline", className: "text-xs", children: previewData.status }) : null
|
|
26
|
-
] })
|
|
27
|
-
] });
|
|
28
|
-
}
|
|
29
|
-
var StaffMessageObjectPreview_default = StaffMessageObjectPreview;
|
|
30
|
-
export {
|
|
31
|
-
StaffMessageObjectPreview,
|
|
32
|
-
StaffMessageObjectPreview_default as default
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=StaffMessageObjectPreview.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/modules/staff/widgets/messages/StaffMessageObjectPreview.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\"\n\nimport { UserRound, Users } from 'lucide-react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { ObjectPreviewProps } from '@open-mercato/shared/modules/messages/types'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\n\nexport function StaffMessageObjectPreview({\n entityType,\n entityId,\n previewData,\n actionRequired,\n actionLabel,\n}: ObjectPreviewProps) {\n const t = useT()\n const isTeam = entityType === 'team'\n const Icon = isTeam ? Users : UserRound\n const fallbackTitle = isTeam\n ? t('staff.teams.page.title', 'Teams')\n : t('staff.teamMembers.page.title', 'Team members')\n\n return (\n <div className=\"flex items-start gap-3 rounded-md border bg-muted/20 p-3\">\n <Icon className=\"mt-0.5 h-4 w-4 text-muted-foreground\" />\n <div className=\"min-w-0 flex-1 space-y-1\">\n <div className=\"flex items-center gap-2\">\n <p className=\"truncate text-sm font-medium\">{previewData?.title || fallbackTitle}</p>\n {actionRequired ? (\n <Badge variant=\"secondary\" className=\"text-xs\">\n {actionLabel || t('messages.composer.objectActionRequired', 'Action required')}\n </Badge>\n ) : null}\n </div>\n <p className=\"truncate text-xs text-muted-foreground\">{previewData?.subtitle || entityId}</p>\n {previewData?.status ? (\n <Badge variant=\"outline\" className=\"text-xs\">{previewData.status}</Badge>\n ) : null}\n </div>\n </div>\n )\n}\n\nexport default StaffMessageObjectPreview\n\n"],
|
|
5
|
-
"mappings": ";AAuBM,cAEE,YAFF;AArBN,SAAS,WAAW,aAAa;AACjC,SAAS,YAAY;AAErB,SAAS,aAAa;AAEf,SAAS,0BAA0B;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAuB;AACrB,QAAM,IAAI,KAAK;AACf,QAAM,SAAS,eAAe;AAC9B,QAAM,OAAO,SAAS,QAAQ;AAC9B,QAAM,gBAAgB,SAClB,EAAE,0BAA0B,OAAO,IACnC,EAAE,gCAAgC,cAAc;AAEpD,SACE,qBAAC,SAAI,WAAU,4DACb;AAAA,wBAAC,QAAK,WAAU,wCAAuC;AAAA,IACvD,qBAAC,SAAI,WAAU,4BACb;AAAA,2BAAC,SAAI,WAAU,2BACb;AAAA,4BAAC,OAAE,WAAU,gCAAgC,uBAAa,SAAS,eAAc;AAAA,QAChF,iBACC,oBAAC,SAAM,SAAQ,aAAY,WAAU,WAClC,yBAAe,EAAE,0CAA0C,iBAAiB,GAC/E,IACE;AAAA,SACN;AAAA,MACA,oBAAC,OAAE,WAAU,0CAA0C,uBAAa,YAAY,UAAS;AAAA,MACxF,aAAa,SACZ,oBAAC,SAAM,SAAQ,WAAU,WAAU,WAAW,sBAAY,QAAO,IAC/D;AAAA,OACN;AAAA,KACF;AAEJ;AAEA,IAAO,oCAAQ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/modules/staff/widgets/messages/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { StaffMessageObjectDetail } from './StaffMessageObjectDetail'\nexport { StaffMessageObjectPreview } from './StaffMessageObjectPreview'\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,gCAAgC;AACzC,SAAS,iCAAiC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|