@cratis/scene.blueprint.orders 0.0.0-stage → 4.59.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/README.md +66 -2
- package/blueprint.ts +16 -0
- package/blueprintCatalog.json +107 -0
- package/dist/cjs/blueprint.js +19 -0
- package/dist/cjs/blueprint.js.map +1 -0
- package/dist/cjs/index.js +68 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/manifest.js +65 -0
- package/dist/cjs/manifest.js.map +1 -0
- package/dist/cjs/navigation.js +109 -0
- package/dist/cjs/navigation.js.map +1 -0
- package/dist/cjs/ordersApplication.js +49 -0
- package/dist/cjs/ordersApplication.js.map +1 -0
- package/dist/cjs/ordersParts.js +151 -0
- package/dist/cjs/ordersParts.js.map +1 -0
- package/dist/cjs/ordersQueries.js +66 -0
- package/dist/cjs/ordersQueries.js.map +1 -0
- package/dist/cjs/ordersScreenSet.js +40 -0
- package/dist/cjs/ordersScreenSet.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/packageName.js +8 -0
- package/dist/cjs/packageName.js.map +1 -0
- package/dist/cjs/screens/index.js +22 -0
- package/dist/cjs/screens/index.js.map +1 -0
- package/dist/cjs/templateProvenance.js +24 -0
- package/dist/cjs/templateProvenance.js.map +1 -0
- package/dist/cjs/templates/boardTemplate.js +60 -0
- package/dist/cjs/templates/boardTemplate.js.map +1 -0
- package/dist/cjs/templates/deliveryTemplate.js +88 -0
- package/dist/cjs/templates/deliveryTemplate.js.map +1 -0
- package/dist/cjs/templates/formTemplates.js +50 -0
- package/dist/cjs/templates/formTemplates.js.map +1 -0
- package/dist/cjs/templates/index.js +23 -0
- package/dist/cjs/templates/index.js.map +1 -0
- package/dist/cjs/templates/listTemplates.js +145 -0
- package/dist/cjs/templates/listTemplates.js.map +1 -0
- package/dist/cjs/templates/recordTemplates.js +101 -0
- package/dist/cjs/templates/recordTemplates.js.map +1 -0
- package/dist/esm/blueprint.d.ts +3 -0
- package/dist/esm/blueprint.d.ts.map +1 -0
- package/dist/esm/blueprint.js +17 -0
- package/dist/esm/blueprint.js.map +1 -0
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +18 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/manifest.d.ts +3 -0
- package/dist/esm/manifest.d.ts.map +1 -0
- package/dist/esm/manifest.js +63 -0
- package/dist/esm/manifest.js.map +1 -0
- package/dist/esm/navigation.d.ts +5 -0
- package/dist/esm/navigation.d.ts.map +1 -0
- package/dist/esm/navigation.js +105 -0
- package/dist/esm/navigation.js.map +1 -0
- package/dist/esm/ordersApplication.d.ts +10 -0
- package/dist/esm/ordersApplication.d.ts.map +1 -0
- package/dist/esm/ordersApplication.js +44 -0
- package/dist/esm/ordersApplication.js.map +1 -0
- package/dist/esm/ordersParts.d.ts +16 -0
- package/dist/esm/ordersParts.d.ts.map +1 -0
- package/dist/esm/ordersParts.js +133 -0
- package/dist/esm/ordersParts.js.map +1 -0
- package/dist/esm/ordersQueries.d.ts +40 -0
- package/dist/esm/ordersQueries.d.ts.map +1 -0
- package/dist/esm/ordersQueries.js +58 -0
- package/dist/esm/ordersQueries.js.map +1 -0
- package/dist/esm/ordersScreenSet.d.ts +7 -0
- package/dist/esm/ordersScreenSet.d.ts.map +1 -0
- package/dist/esm/ordersScreenSet.js +38 -0
- package/dist/esm/ordersScreenSet.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/packageName.d.ts +2 -0
- package/dist/esm/packageName.d.ts.map +1 -0
- package/dist/esm/packageName.js +6 -0
- package/dist/esm/packageName.js.map +1 -0
- package/dist/esm/screens/index.d.ts +3 -0
- package/dist/esm/screens/index.d.ts.map +1 -0
- package/dist/esm/screens/index.js +20 -0
- package/dist/esm/screens/index.js.map +1 -0
- package/dist/esm/templateProvenance.d.ts +3 -0
- package/dist/esm/templateProvenance.d.ts.map +1 -0
- package/dist/esm/templateProvenance.js +22 -0
- package/dist/esm/templateProvenance.js.map +1 -0
- package/dist/esm/templates/boardTemplate.d.ts +3 -0
- package/dist/esm/templates/boardTemplate.d.ts.map +1 -0
- package/dist/esm/templates/boardTemplate.js +58 -0
- package/dist/esm/templates/boardTemplate.js.map +1 -0
- package/dist/esm/templates/deliveryTemplate.d.ts +3 -0
- package/dist/esm/templates/deliveryTemplate.d.ts.map +1 -0
- package/dist/esm/templates/deliveryTemplate.js +86 -0
- package/dist/esm/templates/deliveryTemplate.js.map +1 -0
- package/dist/esm/templates/formTemplates.d.ts +3 -0
- package/dist/esm/templates/formTemplates.d.ts.map +1 -0
- package/dist/esm/templates/formTemplates.js +48 -0
- package/dist/esm/templates/formTemplates.js.map +1 -0
- package/dist/esm/templates/index.d.ts +8 -0
- package/dist/esm/templates/index.d.ts.map +1 -0
- package/dist/esm/templates/index.js +15 -0
- package/dist/esm/templates/index.js.map +1 -0
- package/dist/esm/templates/listTemplates.d.ts +3 -0
- package/dist/esm/templates/listTemplates.d.ts.map +1 -0
- package/dist/esm/templates/listTemplates.js +143 -0
- package/dist/esm/templates/listTemplates.js.map +1 -0
- package/dist/esm/templates/recordTemplates.d.ts +3 -0
- package/dist/esm/templates/recordTemplates.d.ts.map +1 -0
- package/dist/esm/templates/recordTemplates.js +99 -0
- package/dist/esm/templates/recordTemplates.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/index.ts +14 -0
- package/manifest.ts +41 -0
- package/navigation.ts +53 -0
- package/ordersApplication.ts +28 -0
- package/ordersParts.ts +58 -0
- package/ordersQueries.ts +58 -0
- package/ordersScreenSet.ts +21 -0
- package/package.json +78 -4
- package/packageName.ts +5 -0
- package/sampleData/orders-en.json +952 -0
- package/screens/index.ts +20 -0
- package/templateProvenance.ts +15 -0
- package/templates/boardTemplate.ts +34 -0
- package/templates/deliveryTemplate.ts +31 -0
- package/templates/formTemplates.ts +33 -0
- package/templates/index.ts +15 -0
- package/templates/listTemplates.ts +93 -0
- package/templates/recordTemplates.ts +43 -0
- package/thumbnails/OrderPage.svg +18 -0
- package/thumbnails/OrdersDeliveryCalendar.svg +16 -0
- package/thumbnails/OrdersFulfilmentBoard.svg +23 -0
- package/thumbnails/OrdersList.svg +29 -0
- package/thumbnails/OrdersQuickCreateOrder.svg +12 -0
- package/thumbnails/orders.svg +14 -0
package/screens/index.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { Screen } from '@cratis/scene.model';
|
|
5
|
+
import { LayoutName } from '@cratis/scene.blueprint.default';
|
|
6
|
+
import { ordersScreenDefinitions } from '../ordersScreenSet';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The ready-to-use screens: real `Screen` instances, one for each entry of the manifest's `blueprint.screenSet`, each filling the screen template it names in
|
|
10
|
+
* the foundation's application shell. A new application that adopts the blueprint gets these, wired into its navigation (`ordersNavigation`).
|
|
11
|
+
*/
|
|
12
|
+
export const ordersScreens: Screen[] = ordersScreenDefinitions.map(definition => ({
|
|
13
|
+
name: definition.name,
|
|
14
|
+
layout: LayoutName.AppShell,
|
|
15
|
+
screenTemplate: definition.template,
|
|
16
|
+
slotContent: {},
|
|
17
|
+
forms: [],
|
|
18
|
+
contributions: [],
|
|
19
|
+
path: definition.name.split('.'),
|
|
20
|
+
}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { TemplateMetadata } from '@cratis/scene.model';
|
|
5
|
+
|
|
6
|
+
/** The compatibility, attribution and license metadata every template this blueprint ships carries. */
|
|
7
|
+
export const ordersTemplateProvenance: Pick<TemplateMetadata, 'compatibility' | 'attribution' | 'license' | 'licenseUrl'> = {
|
|
8
|
+
compatibility: {
|
|
9
|
+
scene: '^4.13.0',
|
|
10
|
+
packages: [{ name: 'Cratis.Blueprint.Default', versionRange: '^1.0.0' }],
|
|
11
|
+
},
|
|
12
|
+
attribution: { author: 'Cratis', url: 'https://github.com/Cratis/Scene/tree/main/Source/JavaScript/blueprint.orders' },
|
|
13
|
+
license: 'MIT',
|
|
14
|
+
licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',
|
|
15
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { ScreenTemplate, TemplateScope } from '@cratis/scene.model';
|
|
5
|
+
import { boardScreenTemplate } from '@cratis/scene.blueprint.default';
|
|
6
|
+
import { OrdersEntityKind, OrdersQuery, fromQuery, localeOfData, ordersQueriesOf } from '../ordersQueries';
|
|
7
|
+
import { actionButton, component, opensDialog, ordersMetadata, withBehaviors } from '../ordersParts';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The fulfilment board: the foundation `BoardScreen` with a column for each step an order goes through - new, picking, shipped, delivered - and a card for each
|
|
11
|
+
* order with its customer, delivery date and channel. An order moves to the next step by dragging or by its own Move-to menu, and the columns say in words when
|
|
12
|
+
* a limit is exceeded.
|
|
13
|
+
*/
|
|
14
|
+
export const fulfilmentBoardTemplate: ScreenTemplate = {
|
|
15
|
+
name: 'OrdersFulfilmentBoard',
|
|
16
|
+
fitsSlot: 'content',
|
|
17
|
+
slots: boardScreenTemplate.slots,
|
|
18
|
+
arrangement: boardScreenTemplate.arrangement,
|
|
19
|
+
content: {
|
|
20
|
+
header: [component('OrdersFulfilmentBoard-header', 'pageHeader', { title: 'Fulfilment', subtitle: 'Drag an order to its next step' }, {
|
|
21
|
+
actions: [withBehaviors(actionButton('OrdersFulfilmentBoard-new', 'New order', 'primary'), opensDialog('OrdersQuickCreateOrder'))],
|
|
22
|
+
})],
|
|
23
|
+
toolbar: [
|
|
24
|
+
component('OrdersFulfilmentBoard-search', 'globalSearch', { placeholder: 'Search the board', label: 'Search the board' }),
|
|
25
|
+
component('OrdersFulfilmentBoard-views', 'savedViewsMenu', { views: fromQuery(ordersQueriesOf(OrdersEntityKind.Order).views), savePermission: 'enabled', managePermission: 'enabled' }),
|
|
26
|
+
],
|
|
27
|
+
board: [component('OrdersFulfilmentBoard-columns', 'kanbanBoard', {
|
|
28
|
+
columns: fromQuery(OrdersQuery.FulfilmentColumns), cards: fromQuery(OrdersQuery.FulfilmentCards), editPermission: 'enabled', label: 'Orders by fulfilment step', ...localeOfData,
|
|
29
|
+
})],
|
|
30
|
+
},
|
|
31
|
+
displayName: 'Orders fulfilment board',
|
|
32
|
+
description: 'Orders as cards in a column for each fulfilment step, moved by dragging or by menu.',
|
|
33
|
+
metadata: ordersMetadata('OrdersFulfilmentBoard', 'Board', [TemplateScope.Module, TemplateScope.Feature]),
|
|
34
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { ScreenTemplate, TemplateScope, WidthSizeClass } from '@cratis/scene.model';
|
|
5
|
+
import { column, grid, slotLeaf } from '@cratis/scene.blueprint.default';
|
|
6
|
+
import { OrdersQuery, fromQuery, localeOfData } from '../ordersQueries';
|
|
7
|
+
import { actionButton, component, goesTo, ordersMetadata, withBehaviors } from '../ordersParts';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The delivery calendar: the day each open order is due to arrive, on a month, a week or as an agenda (the foundation's `calendarGrid`). The status is told in
|
|
11
|
+
* words as well as by color, the day and view are kept in the address, and the list beside it names every order due in the period.
|
|
12
|
+
*/
|
|
13
|
+
export const deliveryCalendarTemplate: ScreenTemplate = {
|
|
14
|
+
name: 'OrdersDeliveryCalendar',
|
|
15
|
+
fitsSlot: 'content',
|
|
16
|
+
slots: [{ name: 'header' }, { name: 'calendar' }, { name: 'due' }],
|
|
17
|
+
arrangement: {
|
|
18
|
+
root: column([slotLeaf('header'), grid([slotLeaf('calendar', { span: 2 }), slotLeaf('due')], 3, 16)], 16),
|
|
19
|
+
overrides: [{ width: WidthSizeClass.Compact, root: column([slotLeaf('header'), slotLeaf('calendar'), slotLeaf('due')], 16) }],
|
|
20
|
+
},
|
|
21
|
+
content: {
|
|
22
|
+
header: [component('OrdersDeliveryCalendar-header', 'pageHeader', { title: 'Deliveries', subtitle: 'When each order is due to arrive' }, {
|
|
23
|
+
actions: [withBehaviors(actionButton('OrdersDeliveryCalendar-orders', 'Open the orders', 'secondary'), goesTo('orders.list'))],
|
|
24
|
+
})],
|
|
25
|
+
calendar: [component('OrdersDeliveryCalendar-grid', 'calendarGrid', { label: 'Deliveries', events: fromQuery(OrdersQuery.DeliveryEvents), date: fromQuery(OrdersQuery.Settings, '0.today'), urlKey: 'day', ...localeOfData })],
|
|
26
|
+
due: [component('OrdersDeliveryCalendar-due', 'dataList', { label: 'Due in this period', rows: fromQuery(OrdersQuery.DeliveryEvents), columns: fromQuery(OrdersQuery.DeliveryColumns), titleField: 'title', pageSize: 6, ...localeOfData })],
|
|
27
|
+
},
|
|
28
|
+
displayName: 'Orders delivery calendar',
|
|
29
|
+
description: 'The day each open order is due to arrive, on a month, a week or as an agenda.',
|
|
30
|
+
metadata: ordersMetadata('OrdersDeliveryCalendar', 'Calendar', [TemplateScope.Module, TemplateScope.Feature]),
|
|
31
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { DialogTemplate, TemplateScope } from '@cratis/scene.model';
|
|
5
|
+
import { quickCreateDialogTemplate } from '@cratis/scene.blueprint.default';
|
|
6
|
+
import { OrdersQuery, fromQuery, localeOfData } from '../ordersQueries';
|
|
7
|
+
import { closesDialog, component, ordersMetadata, withBehaviors } from '../ordersParts';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* One quick-create dialog: the foundation `QuickCreateDialog` - a short form opened from a page to make one record without leaving it - with the fields
|
|
11
|
+
* that thing needs to get started.
|
|
12
|
+
*/
|
|
13
|
+
function quickCreateOf(name: string, title: string, sections: string, noun: string): DialogTemplate {
|
|
14
|
+
return {
|
|
15
|
+
name,
|
|
16
|
+
slots: quickCreateDialogTemplate.slots,
|
|
17
|
+
content: {
|
|
18
|
+
header: [component(`${name}-frame`, 'dialogFrame', { title, subtitle: 'Only what is needed to get started' })],
|
|
19
|
+
body: [withBehaviors(component(`${name}-form`, 'formScreenBody', {
|
|
20
|
+
mode: 'create', saveAndNew: false, strings: { formSave: 'Create' }, sections: fromQuery(sections), errors: fromQuery(OrdersQuery.FormErrors, '0'), ...localeOfData,
|
|
21
|
+
}), closesDialog())],
|
|
22
|
+
actions: [],
|
|
23
|
+
},
|
|
24
|
+
displayName: `Orders quick create ${noun}`,
|
|
25
|
+
description: `A short form that creates one ${noun} without leaving the page.`,
|
|
26
|
+
metadata: ordersMetadata(name, 'Dialog', [TemplateScope.Slice]),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** The quick creation of an order. */
|
|
31
|
+
export const ordersDialogs: DialogTemplate[] = [
|
|
32
|
+
quickCreateOf('OrdersQuickCreateOrder', 'New order', 'OrderQuickSections', 'order'),
|
|
33
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { fulfilmentBoardTemplate } from './boardTemplate';
|
|
2
|
+
import { deliveryCalendarTemplate } from './deliveryTemplate';
|
|
3
|
+
import { ordersListTemplate } from './listTemplates';
|
|
4
|
+
import { orderPageTemplate } from './recordTemplates';
|
|
5
|
+
|
|
6
|
+
export * from './listTemplates';
|
|
7
|
+
export * from './recordTemplates';
|
|
8
|
+
export * from './boardTemplate';
|
|
9
|
+
export * from './deliveryTemplate';
|
|
10
|
+
export * from './formTemplates';
|
|
11
|
+
|
|
12
|
+
/** Every screen template this blueprint provides, in the order the manifest lists them. */
|
|
13
|
+
export const ordersScreenTemplates = [ordersListTemplate, orderPageTemplate, fulfilmentBoardTemplate, deliveryCalendarTemplate];
|
|
14
|
+
|
|
15
|
+
export { ordersDialogs as ordersDialogTemplates } from './formTemplates';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { InteractionActionKind, InteractionTriggerKind, NotificationLevel, NotifyAction, ScreenTemplate, TemplateScope } from '@cratis/scene.model';
|
|
5
|
+
import { listScreenTemplate } from '@cratis/scene.blueprint.default';
|
|
6
|
+
import { OrdersEntityKind, fromQuery, ordersQueriesOf, localeOfData } from '../ordersQueries';
|
|
7
|
+
import { actionButton, component, goesTo, ordersMetadata, opensDialog, opensRecordOnSelect, withBehaviors } from '../ordersParts';
|
|
8
|
+
|
|
9
|
+
const listScopes = [TemplateScope.Module, TemplateScope.Feature];
|
|
10
|
+
|
|
11
|
+
/** The Export button: it tells the user the export has started, which is what the shell does for a long-running action it does not wait on. */
|
|
12
|
+
const exportAction = (id: string) => withBehaviors(actionButton(id, 'Export', 'secondary'), [{
|
|
13
|
+
bindings: [{
|
|
14
|
+
trigger: { kind: InteractionTriggerKind.Click },
|
|
15
|
+
actions: [{ kind: InteractionActionKind.Notify, level: NotificationLevel.Info, message: { text: 'The export has started.' } } as unknown as NotifyAction],
|
|
16
|
+
}],
|
|
17
|
+
}]);
|
|
18
|
+
|
|
19
|
+
interface ListOptions {
|
|
20
|
+
name: string;
|
|
21
|
+
entity: OrdersEntityKind;
|
|
22
|
+
displayName: string;
|
|
23
|
+
description: string;
|
|
24
|
+
title: string;
|
|
25
|
+
subtitle: string;
|
|
26
|
+
searchLabel: string;
|
|
27
|
+
urlKey: string;
|
|
28
|
+
/** The primary action of the header: a quick-create dialog to open, or a screen to go to. */
|
|
29
|
+
primary: { label: string; dialog?: string; screen?: string };
|
|
30
|
+
rowActions: string[];
|
|
31
|
+
bulkActions: string[];
|
|
32
|
+
titleField: string;
|
|
33
|
+
/** The screen a chosen row opens; the list then selects one row at a time. Absent, rows are selected many at a time for the bulk bar. */
|
|
34
|
+
recordScreen?: string;
|
|
35
|
+
/** The side sheet a chosen row opens instead of a record page; the list then selects one row at a time. */
|
|
36
|
+
recordDialog?: string;
|
|
37
|
+
/** Group the rows (`variant: grouped`) by this field. */
|
|
38
|
+
grouped?: { groupBy: string };
|
|
39
|
+
/** Rows are not selectable at all: a record of what happened, which nobody edits. */
|
|
40
|
+
readOnly?: boolean;
|
|
41
|
+
/** Show the records as cards, each with the picture its `imageField` names. */
|
|
42
|
+
cards?: { imageField?: string };
|
|
43
|
+
/** Tint a row by the tone in this field (always beside a status column that says the same in words). */
|
|
44
|
+
toneField?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* One orders list: the foundation `ListScreen` with its header, toolbar, filters, list and bulk bar filled for an entity. The slots, arrangement and
|
|
49
|
+
* every behavior - sort, search, paging and selection in the address, the table collapsing to cards on a phone - are the foundation's.
|
|
50
|
+
*/
|
|
51
|
+
function listTemplateOf(options: ListOptions): ScreenTemplate {
|
|
52
|
+
const queries = ordersQueriesOf(options.entity);
|
|
53
|
+
const id = options.name;
|
|
54
|
+
const listId = `${id}-records`;
|
|
55
|
+
const primary = withBehaviors(actionButton(`${id}-primary`, options.primary.label, 'primary'), options.primary.dialog ? opensDialog(options.primary.dialog) : goesTo(options.primary.screen!));
|
|
56
|
+
const list = component(listId, 'dataList', {
|
|
57
|
+
label: options.title, rows: fromQuery(queries.rows), columns: fromQuery(queries.columns), titleField: options.titleField, pageSize: options.cards ? 12 : 10, urlKey: options.urlKey, ...localeOfData,
|
|
58
|
+
rowActions: options.rowActions,
|
|
59
|
+
...(options.readOnly ? {} : { selectionMode: options.recordScreen || options.recordDialog ? 'single' : 'multiple' }),
|
|
60
|
+
...(options.cards ? { variant: 'cards', ...(options.cards.imageField ? { imageField: options.cards.imageField } : {}) } : {}),
|
|
61
|
+
...(options.grouped ? { variant: 'grouped', groupBy: options.grouped.groupBy } : {}),
|
|
62
|
+
...(options.toneField ? { toneField: options.toneField } : {}),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
name: options.name,
|
|
67
|
+
fitsSlot: 'content',
|
|
68
|
+
slots: listScreenTemplate.slots,
|
|
69
|
+
arrangement: listScreenTemplate.arrangement,
|
|
70
|
+
content: {
|
|
71
|
+
header: [component(`${id}-header`, 'pageHeader', { title: options.title, subtitle: options.subtitle }, { actions: [exportAction(`${id}-export`), primary] })],
|
|
72
|
+
toolbar: [
|
|
73
|
+
component(`${id}-search`, 'globalSearch', { placeholder: options.searchLabel, label: options.searchLabel, urlKey: `${options.urlKey}q` }),
|
|
74
|
+
component(`${id}-views`, 'savedViewsMenu', { views: fromQuery(queries.views), savePermission: 'enabled', managePermission: 'enabled' }),
|
|
75
|
+
component(`${id}-columns`, 'columnChooser', { columns: fromQuery(queries.columnChoices) }),
|
|
76
|
+
],
|
|
77
|
+
filters: [component(`${id}-filter`, 'filterBuilder', { fields: fromQuery(queries.filterFields), ...localeOfData })],
|
|
78
|
+
list: [options.recordScreen ? withBehaviors(list, opensRecordOnSelect(listId, options.recordScreen)) : list],
|
|
79
|
+
bulkBar: options.recordScreen || options.recordDialog || options.readOnly ? [] : [component(`${id}-bulk`, 'bulkBar', { selection: fromQuery(queries.selection), actions: options.bulkActions })],
|
|
80
|
+
footer: [],
|
|
81
|
+
},
|
|
82
|
+
displayName: options.displayName,
|
|
83
|
+
description: options.description,
|
|
84
|
+
metadata: ordersMetadata(options.name, 'List', listScopes),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** The orders: every order with its customer, dates, total and status, filtered by customer, status and channel. Choosing an order opens it. */
|
|
89
|
+
export const ordersListTemplate = listTemplateOf({
|
|
90
|
+
name: 'OrdersList', entity: OrdersEntityKind.Order, displayName: 'Orders list', description: 'Every order with customer, placed and delivery dates, total and status, filtered by customer, status, channel and date.',
|
|
91
|
+
title: 'Orders', subtitle: 'Everything customers have ordered', searchLabel: 'Search orders', urlKey: 'orders', primary: { label: 'New order', dialog: 'OrdersQuickCreateOrder' },
|
|
92
|
+
rowActions: ['Open', 'Cancel order'], bulkActions: [], titleField: 'number', recordScreen: 'orders.record',
|
|
93
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { ScreenTemplate, TemplateScope } from '@cratis/scene.model';
|
|
5
|
+
import { recordPageTemplate } from '@cratis/scene.blueprint.default';
|
|
6
|
+
import { OrdersEntityKind, OrdersQuery, fromQuery, localeOfData, ordersQueriesOf, currencyOfData } from '../ordersQueries';
|
|
7
|
+
import { actionButton, component, goesTo, ordersMetadata, withBehaviors } from '../ordersParts';
|
|
8
|
+
|
|
9
|
+
const order = ordersQueriesOf(OrdersEntityKind.Order);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The order page: the foundation `RecordPage` with the order number as its title, its status, total and days to delivery as key facts, the order's fields, its
|
|
13
|
+
* lines and shipments in the main region, and the activity beside it.
|
|
14
|
+
*/
|
|
15
|
+
export const orderPageTemplate: ScreenTemplate = {
|
|
16
|
+
name: 'OrderPage',
|
|
17
|
+
fitsSlot: 'content',
|
|
18
|
+
slots: recordPageTemplate.slots,
|
|
19
|
+
arrangement: recordPageTemplate.arrangement,
|
|
20
|
+
content: {
|
|
21
|
+
header: [component('OrderPage-header', 'pageHeader', { title: fromQuery(order.record, '0.number'), subtitle: fromQuery(order.record, '0.summary') }, {
|
|
22
|
+
actions: [withBehaviors(actionButton('OrderPage-back', 'Back to orders', 'secondary'), goesTo('orders.list'))],
|
|
23
|
+
})],
|
|
24
|
+
summary: [
|
|
25
|
+
component('OrderPage-status', 'statusChip', { status: fromQuery(order.summary, '0.status'), tone: fromQuery(order.summary, '0.tone') }),
|
|
26
|
+
component('OrderPage-total', 'statCard', { label: 'Order total', value: fromQuery(order.summary, '0.total'), format: 'currency', ...currencyOfData }),
|
|
27
|
+
component('OrderPage-items', 'statCard', { label: 'Items', value: fromQuery(order.summary, '0.items'), ...localeOfData }),
|
|
28
|
+
component('OrderPage-days', 'statCard', { label: 'Days to delivery', value: fromQuery(order.summary, '0.daysToDelivery'), ...localeOfData }),
|
|
29
|
+
],
|
|
30
|
+
tabs: [component('OrderPage-tabs', 'tabSet', { tabs: fromQuery(OrdersQuery.RecordTabs), urlKey: 'tab', label: 'Order sections' })],
|
|
31
|
+
main: [
|
|
32
|
+
component('OrderPage-form', 'formScreenBody', { mode: 'readOnly', sections: fromQuery(order.sections), values: fromQuery(order.record, '0'), ...currencyOfData }),
|
|
33
|
+
component('OrderPage-lines', 'dataList', { label: 'Order lines', rows: fromQuery(OrdersQuery.Lines), columns: fromQuery(OrdersQuery.LineColumns), titleField: 'name', pageSize: 8, ...currencyOfData }),
|
|
34
|
+
component('OrderPage-shipments', 'dataList', { label: 'Shipments', rows: fromQuery(OrdersQuery.Shipments), columns: fromQuery(OrdersQuery.ShipmentColumns), titleField: 'reference', ...localeOfData }),
|
|
35
|
+
],
|
|
36
|
+
related: [],
|
|
37
|
+
activity: [component('OrderPage-activity', 'activityFeed', { label: 'Activity', entries: fromQuery(order.activity), ...localeOfData })],
|
|
38
|
+
aside: [],
|
|
39
|
+
},
|
|
40
|
+
displayName: 'Order page',
|
|
41
|
+
description: 'One order: key facts, its lines and shipments, and its activity.',
|
|
42
|
+
metadata: ordersMetadata('OrderPage', 'Detail', [TemplateScope.Feature, TemplateScope.Subfeature]),
|
|
43
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="320" height="200" viewBox="0 0 320 200" role="img" aria-label="OrderPage">
|
|
2
|
+
<rect x="0" y="0" width="320" height="200" rx="8" fill="#f4f5f7"/>
|
|
3
|
+
<rect x="12" y="12" width="296" height="20" rx="4" fill="#ea580c"/>
|
|
4
|
+
<rect x="12" y="40" width="64" height="148" rx="4" fill="#d5d9df"/>
|
|
5
|
+
<rect x="84" y="40" width="224" height="30" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
6
|
+
<rect x="90" y="47" width="46" height="16" rx="3" fill="#d5d9df"/>
|
|
7
|
+
<rect x="144" y="47" width="46" height="16" rx="3" fill="#d5d9df"/>
|
|
8
|
+
<rect x="198" y="47" width="46" height="16" rx="3" fill="#d5d9df"/>
|
|
9
|
+
<rect x="252" y="47" width="46" height="16" rx="3" fill="#d5d9df"/>
|
|
10
|
+
<rect x="84" y="78" width="140" height="110" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
11
|
+
<rect x="92" y="90" width="120" height="6" rx="3" fill="#9aa3b2"/>
|
|
12
|
+
<rect x="92" y="107" width="98" height="6" rx="3" fill="#9aa3b2"/>
|
|
13
|
+
<rect x="92" y="124" width="120" height="6" rx="3" fill="#9aa3b2"/>
|
|
14
|
+
<rect x="92" y="141" width="98" height="6" rx="3" fill="#9aa3b2"/>
|
|
15
|
+
<rect x="92" y="158" width="120" height="6" rx="3" fill="#9aa3b2"/>
|
|
16
|
+
<rect x="232" y="78" width="76" height="52" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
17
|
+
<rect x="232" y="136" width="76" height="52" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="320" height="200" viewBox="0 0 320 200" role="img" aria-label="OrdersDeliveryCalendar">
|
|
2
|
+
<rect width="320" height="200" rx="8" fill="#f4f5f7"/>
|
|
3
|
+
<rect x="0" y="0" width="320" height="22" fill="#0f766e"/>
|
|
4
|
+
<rect x="0" y="22" width="56" height="178" fill="#e3e5ea"/>
|
|
5
|
+
<rect x="64" y="30" width="90" height="12" rx="3" fill="#ffffff" stroke="#d5d9df"/>
|
|
6
|
+
<rect x="64" y="48" width="170" height="140" fill="#ffffff" stroke="#d5d9df"/>
|
|
7
|
+
<rect x="64" y="48" width="170" height="14" fill="#e3e5ea"/>
|
|
8
|
+
<path d="M64 90H234M64 118H234M64 146H234M98 62V188M132 62V188M166 62V188M200 62V188" stroke="#d5d9df"/>
|
|
9
|
+
<rect x="68" y="96" width="60" height="6" rx="2" fill="#16a34a"/>
|
|
10
|
+
<rect x="136" y="124" width="26" height="6" rx="2" fill="#d97706"/>
|
|
11
|
+
<rect x="102" y="152" width="94" height="6" rx="2" fill="#16a34a"/>
|
|
12
|
+
<rect x="244" y="48" width="66" height="140" rx="3" fill="#ffffff" stroke="#d5d9df"/>
|
|
13
|
+
<rect x="250" y="58" width="54" height="5" rx="2" fill="#d5d9df"/>
|
|
14
|
+
<rect x="250" y="70" width="54" height="5" rx="2" fill="#d5d9df"/>
|
|
15
|
+
<rect x="250" y="82" width="54" height="5" rx="2" fill="#d5d9df"/>
|
|
16
|
+
</svg>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="320" height="200" viewBox="0 0 320 200" role="img" aria-label="OrdersFulfilmentBoard">
|
|
2
|
+
<rect x="0" y="0" width="320" height="200" rx="8" fill="#f4f5f7"/>
|
|
3
|
+
<rect x="12" y="12" width="296" height="20" rx="4" fill="#ea580c"/>
|
|
4
|
+
<rect x="12" y="40" width="64" height="148" rx="4" fill="#d5d9df"/>
|
|
5
|
+
<rect x="84" y="40" width="52" height="148" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
6
|
+
<rect x="88" y="46" width="30" height="6" rx="3" fill="#ea580c"/>
|
|
7
|
+
<rect x="88" y="60" width="44" height="32" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
8
|
+
<rect x="88" y="100" width="44" height="32" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
9
|
+
<rect x="88" y="140" width="44" height="32" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
10
|
+
<rect x="141" y="40" width="52" height="148" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
11
|
+
<rect x="145" y="46" width="30" height="6" rx="3" fill="#ea580c"/>
|
|
12
|
+
<rect x="145" y="60" width="44" height="32" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
13
|
+
<rect x="145" y="100" width="44" height="32" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
14
|
+
<rect x="198" y="40" width="52" height="148" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
15
|
+
<rect x="202" y="46" width="30" height="6" rx="3" fill="#ea580c"/>
|
|
16
|
+
<rect x="202" y="60" width="44" height="32" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
17
|
+
<rect x="202" y="100" width="44" height="32" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
18
|
+
<rect x="202" y="140" width="44" height="32" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
19
|
+
<rect x="255" y="40" width="52" height="148" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
20
|
+
<rect x="259" y="46" width="30" height="6" rx="3" fill="#ea580c"/>
|
|
21
|
+
<rect x="259" y="60" width="44" height="32" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
22
|
+
<rect x="259" y="100" width="44" height="32" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
23
|
+
</svg>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="320" height="200" viewBox="0 0 320 200" role="img" aria-label="OrdersList">
|
|
2
|
+
<rect x="0" y="0" width="320" height="200" rx="8" fill="#f4f5f7"/>
|
|
3
|
+
<rect x="12" y="12" width="296" height="20" rx="4" fill="#ea580c"/>
|
|
4
|
+
<rect x="12" y="40" width="64" height="148" rx="4" fill="#d5d9df"/>
|
|
5
|
+
<rect x="84" y="40" width="68" height="70" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
6
|
+
<rect x="88" y="44" width="60" height="30" rx="4" fill="#d5d9df"/>
|
|
7
|
+
<rect x="90" y="82" width="40" height="5" rx="3" fill="#ea580c"/>
|
|
8
|
+
<rect x="90" y="94" width="52" height="5" rx="3" fill="#9aa3b2"/>
|
|
9
|
+
<rect x="160" y="40" width="68" height="70" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
10
|
+
<rect x="164" y="44" width="60" height="30" rx="4" fill="#d5d9df"/>
|
|
11
|
+
<rect x="166" y="82" width="40" height="5" rx="3" fill="#ea580c"/>
|
|
12
|
+
<rect x="166" y="94" width="52" height="5" rx="3" fill="#9aa3b2"/>
|
|
13
|
+
<rect x="236" y="40" width="68" height="70" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
14
|
+
<rect x="240" y="44" width="60" height="30" rx="4" fill="#d5d9df"/>
|
|
15
|
+
<rect x="242" y="82" width="40" height="5" rx="3" fill="#ea580c"/>
|
|
16
|
+
<rect x="242" y="94" width="52" height="5" rx="3" fill="#9aa3b2"/>
|
|
17
|
+
<rect x="84" y="116" width="68" height="70" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
18
|
+
<rect x="88" y="120" width="60" height="30" rx="4" fill="#d5d9df"/>
|
|
19
|
+
<rect x="90" y="158" width="40" height="5" rx="3" fill="#ea580c"/>
|
|
20
|
+
<rect x="90" y="170" width="52" height="5" rx="3" fill="#9aa3b2"/>
|
|
21
|
+
<rect x="160" y="116" width="68" height="70" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
22
|
+
<rect x="164" y="120" width="60" height="30" rx="4" fill="#d5d9df"/>
|
|
23
|
+
<rect x="166" y="158" width="40" height="5" rx="3" fill="#ea580c"/>
|
|
24
|
+
<rect x="166" y="170" width="52" height="5" rx="3" fill="#9aa3b2"/>
|
|
25
|
+
<rect x="236" y="116" width="68" height="70" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
26
|
+
<rect x="240" y="120" width="60" height="30" rx="4" fill="#d5d9df"/>
|
|
27
|
+
<rect x="242" y="158" width="40" height="5" rx="3" fill="#ea580c"/>
|
|
28
|
+
<rect x="242" y="170" width="52" height="5" rx="3" fill="#9aa3b2"/>
|
|
29
|
+
</svg>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="320" height="200" viewBox="0 0 320 200" role="img" aria-label="OrdersQuickCreateOrder">
|
|
2
|
+
<rect x="0" y="0" width="320" height="200" rx="8" fill="#f4f5f7"/>
|
|
3
|
+
<rect x="12" y="12" width="296" height="20" rx="4" fill="#ea580c"/>
|
|
4
|
+
<rect x="12" y="40" width="64" height="148" rx="4" fill="#d5d9df"/>
|
|
5
|
+
<rect x="84" y="40" width="224" height="148" rx="4" fill="#e6e9ee"/>
|
|
6
|
+
<rect x="114" y="62" width="164" height="108" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
7
|
+
<rect x="124" y="70" width="60" height="6" rx="3" fill="#ea580c"/>
|
|
8
|
+
<rect x="124" y="88" width="144" height="14" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
9
|
+
<rect x="124" y="108" width="144" height="14" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
10
|
+
<rect x="124" y="140" width="54" height="20" rx="4" fill="#ea580c"/>
|
|
11
|
+
<rect x="184" y="140" width="54" height="20" rx="4" fill="#d5d9df"/>
|
|
12
|
+
</svg>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="320" height="200" viewBox="0 0 320 200" role="img" aria-label="Orders blueprint">
|
|
2
|
+
<rect x="0" y="0" width="320" height="200" rx="8" fill="#f4f5f7"/>
|
|
3
|
+
<rect x="12" y="12" width="296" height="20" rx="4" fill="#ea580c"/>
|
|
4
|
+
<rect x="12" y="40" width="64" height="148" rx="4" fill="#d5d9df"/>
|
|
5
|
+
<rect x="84" y="40" width="70" height="30" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
6
|
+
<rect x="160" y="40" width="70" height="30" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
7
|
+
<rect x="236" y="40" width="70" height="30" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
8
|
+
<rect x="84" y="78" width="224" height="110" rx="4" fill="#ffffff" stroke="#d5d9df"/>
|
|
9
|
+
<rect x="94" y="90" width="200" height="6" rx="3" fill="#9aa3b2"/>
|
|
10
|
+
<rect x="94" y="107" width="164" height="6" rx="3" fill="#9aa3b2"/>
|
|
11
|
+
<rect x="94" y="124" width="200" height="6" rx="3" fill="#9aa3b2"/>
|
|
12
|
+
<rect x="94" y="141" width="164" height="6" rx="3" fill="#9aa3b2"/>
|
|
13
|
+
<rect x="94" y="158" width="200" height="6" rx="3" fill="#9aa3b2"/>
|
|
14
|
+
</svg>
|