@things-factory/saas 10.1.259 → 10.1.261
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-client/pages/saas-account-list.d.ts +4 -1
- package/dist-client/pages/saas-account-list.js +44 -21
- package/dist-client/pages/saas-account-list.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/saas-access.d.ts +1 -7
- package/dist-server/service/saas-access.js +3 -4
- package/dist-server/service/saas-access.js.map +1 -1
- package/dist-server/service/saas-mutation.js +2 -2
- package/dist-server/service/saas-mutation.js.map +1 -1
- package/dist-server/service/saas-query.js +4 -4
- package/dist-server/service/saas-query.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -11
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import '@operato/data-grist/ox-grist.js';
|
|
2
2
|
import '@operato/data-grist/ox-filters-form.js';
|
|
3
|
+
import '@things-factory/ai-assistant/dist-client/index.js';
|
|
3
4
|
import { FetchOption } from '@operato/data-grist';
|
|
4
5
|
import { PageView } from '@operato/shell';
|
|
5
6
|
declare const SaasAccountList_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
|
|
@@ -23,9 +24,10 @@ export declare class SaasAccountList extends SaasAccountList_base {
|
|
|
23
24
|
handler: () => void;
|
|
24
25
|
};
|
|
25
26
|
actions: ({
|
|
27
|
+
id: string;
|
|
26
28
|
title: string;
|
|
27
29
|
icon: string;
|
|
28
|
-
action: () =>
|
|
30
|
+
action: () => import("@operato/data-grist").GristRecord;
|
|
29
31
|
} | {
|
|
30
32
|
icon: string;
|
|
31
33
|
emphasis: {
|
|
@@ -34,6 +36,7 @@ export declare class SaasAccountList extends SaasAccountList_base {
|
|
|
34
36
|
dense: boolean;
|
|
35
37
|
danger: boolean;
|
|
36
38
|
};
|
|
39
|
+
id: string;
|
|
37
40
|
title: string;
|
|
38
41
|
action: () => Promise<void>;
|
|
39
42
|
})[];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import '@operato/data-grist/ox-grist.js';
|
|
3
3
|
import '@operato/data-grist/ox-filters-form.js';
|
|
4
|
+
import '@things-factory/ai-assistant/dist-client/index.js';
|
|
4
5
|
import gql from 'graphql-tag';
|
|
5
|
-
import { html } from 'lit';
|
|
6
|
+
import { html, nothing } from 'lit';
|
|
6
7
|
import { customElement, query, state } from 'lit/decorators.js';
|
|
7
8
|
import { DataGrist, getEditor } from '@operato/data-grist';
|
|
8
9
|
import { client } from '@operato/graphql';
|
|
@@ -14,6 +15,10 @@ import { isMobileDevice } from '@operato/utils';
|
|
|
14
15
|
/* The register grids' save, the asset module's - this module saves its grids the same way. */
|
|
15
16
|
import { saveGrid } from '@things-factory/asset/dist-client';
|
|
16
17
|
import { ACCOUNT_STATUSES, fieldWord, filterOptionsOf, optionsOf, picker } from '../words.js';
|
|
18
|
+
/** What a new row starts with - 「행 추가」 and a paste past the last row alike. */
|
|
19
|
+
const DRAFT = () => ({ currency: 'KRW', status: 'ACTIVE' });
|
|
20
|
+
/** The column layout the name-first order is made on - a person's older column order gives way to it. */
|
|
21
|
+
const COLUMNS_VERSION = 'lead-2026-11-08';
|
|
17
22
|
const FIELDS = ['name', 'counterparty', 'identifier', 'parent', 'purpose', 'billingEmail', 'paymentAccount', 'currency', 'secretLocation', 'status', 'closedOn', 'description'];
|
|
18
23
|
const ACCOUNT_FIELDS = `
|
|
19
24
|
id name counterparty { id name } identifier parent { id name } purpose admins { id name } billingEmail
|
|
@@ -39,15 +44,26 @@ let SaasAccountList = class SaasAccountList extends localize(i18next)(PageView)
|
|
|
39
44
|
actions: this.mine
|
|
40
45
|
? []
|
|
41
46
|
: [
|
|
42
|
-
{ title: i18next.t('button.add'), icon: 'add', action: () => this.grist.
|
|
43
|
-
{ title: i18next.t('button.
|
|
44
|
-
{ title: i18next.t('button.save'), action: () => this.save(), ...CommonButtonStyles.save }
|
|
47
|
+
{ id: 'add-row', title: i18next.t('button.add-row'), icon: 'add', action: () => this.grist.addNewRecord() },
|
|
48
|
+
{ id: 'save', title: i18next.t('button.save'), action: () => this.save(), ...CommonButtonStyles.save }
|
|
45
49
|
],
|
|
46
50
|
exportable: { name: title, data: () => this.grist.exportRecords() }
|
|
47
51
|
};
|
|
48
52
|
}
|
|
53
|
+
/*
|
|
54
|
+
* The kept list holds its search, filters, sort and page in the address (FOOTER-BUTTON-REVIEW G09) and deletes the
|
|
55
|
+
* picked rows from the selection bar over the grid (F06). One's own accounts are read whole, with nothing to pick.
|
|
56
|
+
*/
|
|
49
57
|
render() {
|
|
50
|
-
return html
|
|
58
|
+
return html `${this.mine
|
|
59
|
+
? nothing
|
|
60
|
+
: html `<ox-assistant-selection-bar
|
|
61
|
+
.gridOf=${() => this.grist}
|
|
62
|
+
name=${i18next.t('title.saas-account-list')}
|
|
63
|
+
.assistant=${false}
|
|
64
|
+
.actions=${[{ id: 'delete', title: i18next.t('button.delete'), icon: 'delete_outline', emphasis: { danger: true }, action: () => this.save(true) }]}
|
|
65
|
+
></ox-assistant-selection-bar>`}
|
|
66
|
+
<ox-grist class="page-fill" search-mode="term" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${this.active && !this.mine}>
|
|
51
67
|
<div slot="headroom" class="header">
|
|
52
68
|
<div class="filters"><ox-filters-form without-search autofocus></ox-filters-form></div>
|
|
53
69
|
</div>
|
|
@@ -65,7 +81,12 @@ let SaasAccountList = class SaasAccountList extends localize(i18next)(PageView)
|
|
|
65
81
|
});
|
|
66
82
|
const open = (record) => record?.id && navigate(`saas-account-page?id=${record.id}`);
|
|
67
83
|
this.gristConfig = {
|
|
68
|
-
|
|
84
|
+
/*
|
|
85
|
+
* No empty row under the records. The kept list starts a row with 「행 추가」, and a paste past the last row adds rows
|
|
86
|
+
* with the same draft; one's own accounts are read here, not created.
|
|
87
|
+
*/
|
|
88
|
+
rows: { appendable: false, pasteAppendable: !this.mine, newRecord: DRAFT, selectable: { multiple: !this.mine } },
|
|
89
|
+
columnsVersion: COLUMNS_VERSION,
|
|
69
90
|
pagination: { limit: 100, pages: [50, 100] },
|
|
70
91
|
emptyNote: {
|
|
71
92
|
title: i18next.t(this.mine ? 'text.my-saas-account-empty' : 'text.saas-account-empty'),
|
|
@@ -73,15 +94,23 @@ let SaasAccountList = class SaasAccountList extends localize(i18next)(PageView)
|
|
|
73
94
|
},
|
|
74
95
|
list: { fields: ['name', 'identifier'], details: ['purpose', 'admins'] },
|
|
75
96
|
columns: [
|
|
97
|
+
/* A row's state (new, changed); a new row's mark removes it until it is saved (data-grist 행 제거). */
|
|
98
|
+
{ type: 'gutter', gutterName: 'dirty' },
|
|
76
99
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
77
100
|
...(this.mine ? [] : [{ type: 'gutter', gutterName: 'row-selector', multiple: true }]),
|
|
78
101
|
{ type: 'gutter', gutterName: 'button', icon: 'open_in_new', handlers: { click: (_c, _d, _col, record) => open(record) } },
|
|
79
|
-
/* The name opens the account's 360 (ADR-0067); a new row is typed into. */
|
|
80
|
-
text('name', 180, { record: { mandatory: true, renderer: (value, _c, record) => (record?.id ? entity360Name({ __typename: 'SaasAccount', ...record }, value) : value ?? '') } }),
|
|
81
|
-
object('counterparty', 150, 'counterpartyChoices', [{ name: 'name', header: fieldWord('saas-account', 'counterparty') }]),
|
|
102
|
+
/* The name opens the account's 360 (ADR-0067) and stays in view; a new row is typed into. */
|
|
103
|
+
text('name', 180, { fixed: true, record: { mandatory: true, renderer: (value, _c, record) => (record?.id ? entity360Name({ __typename: 'SaasAccount', ...record }, value) : value ?? '') } }),
|
|
82
104
|
text('identifier', 150),
|
|
83
|
-
|
|
84
|
-
|
|
105
|
+
{
|
|
106
|
+
type: 'select',
|
|
107
|
+
name: 'status',
|
|
108
|
+
header: fieldWord('saas-account', 'status'),
|
|
109
|
+
width: 80,
|
|
110
|
+
sortable: true,
|
|
111
|
+
record: { ...editable, options: optionsOf('saas-account-status', ACCOUNT_STATUSES) },
|
|
112
|
+
filter: { type: 'select', operator: 'eq', options: filterOptionsOf('saas-account-status', ACCOUNT_STATUSES) }
|
|
113
|
+
},
|
|
85
114
|
{
|
|
86
115
|
type: 'string',
|
|
87
116
|
name: 'admins',
|
|
@@ -91,18 +120,12 @@ let SaasAccountList = class SaasAccountList extends localize(i18next)(PageView)
|
|
|
91
120
|
},
|
|
92
121
|
object('paymentAccount', 150, 'bankAccounts', [{ name: 'name', header: fieldWord('saas-account', 'paymentAccount') }]),
|
|
93
122
|
text('currency', 60, { record: { align: 'center' } }),
|
|
123
|
+
text('closedOn', 100, { record: { align: 'center' } }),
|
|
124
|
+
object('counterparty', 150, 'counterpartyChoices', [{ name: 'name', header: fieldWord('saas-account', 'counterparty') }]),
|
|
125
|
+
object('parent', 140, 'saasAccounts', [{ name: 'name', header: fieldWord('saas-account', 'parent') }]),
|
|
126
|
+
text('purpose', 120),
|
|
94
127
|
text('billingEmail', 160, { hidden: true }),
|
|
95
128
|
text('secretLocation', 160),
|
|
96
|
-
{
|
|
97
|
-
type: 'select',
|
|
98
|
-
name: 'status',
|
|
99
|
-
header: fieldWord('saas-account', 'status'),
|
|
100
|
-
width: 80,
|
|
101
|
-
sortable: true,
|
|
102
|
-
record: { ...editable, options: optionsOf('saas-account-status', ACCOUNT_STATUSES) },
|
|
103
|
-
filter: { type: 'select', operator: 'eq', options: filterOptionsOf('saas-account-status', ACCOUNT_STATUSES) }
|
|
104
|
-
},
|
|
105
|
-
text('closedOn', 100, { record: { align: 'center' } }),
|
|
106
129
|
text('description', 200)
|
|
107
130
|
],
|
|
108
131
|
sorters: [{ name: 'name' }]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saas-account-list.js","sourceRoot":"","sources":["../../client/pages/saas-account-list.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAA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IAAI,EAAE,CAAC;SAC1F,CAAC,CAAA;QACF,IAAI,MAAM,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC;YAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IAClI,CAAC;;AAnHQ;IAAR,KAAK,EAAE;;oDAAiB;AACE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;8CAAA;AAPjC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA0H3B;;AAED,kHAAkH;AAE3G,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,eAAe;IAA/C;;QACK,SAAI,GAAG,IAAI,CAAA;IACvB,CAAC;CAAA,CAAA;AAFY,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CAE7B","sourcesContent":["import '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\n\nimport gql from 'graphql-tag'\nimport { html } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\n\nimport { DataGrist, FetchOption, getEditor } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { entity360Name } from '@operato/layout'\nimport { navigate, PageView } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n/* The register grids' save, the asset module's - this module saves its grids the same way. */\nimport { saveGrid } from '@things-factory/asset/dist-client'\n\nimport { ACCOUNT_STATUSES, fieldWord, filterOptionsOf, optionsOf, picker } from '../words.js'\n\nconst FIELDS = ['name', 'counterparty', 'identifier', 'parent', 'purpose', 'billingEmail', 'paymentAccount', 'currency', 'secretLocation', 'status', 'closedOn', 'description']\nconst ACCOUNT_FIELDS = `\n id name counterparty { id name } identifier parent { id name } purpose admins { id name } billingEmail\n paymentAccount { id name } currency secretLocation status closedOn description\n`\n\n/**\n * 구독 서비스 — the accounts the domain holds with vendors (ADR-0177 decision 2), typed like a spreadsheet and saved together.\n * An account opens to its subscriptions, their seats and its admins. Its money is a recurring item's (개정 7).\n */\n@customElement('saas-account-list')\nexport class SaasAccountList extends localize(i18next)(PageView) {\n static styles = [WorkSurfacePageStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles]\n\n /** Only the accounts the signed-in person administers, opened and not kept here. */\n protected mine = false\n\n @state() gristConfig: any\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n const title = i18next.t(this.mine ? 'title.my-saas-account-list' : 'title.saas-account-list')\n return {\n title,\n search: { handler: (search: string) => (this.grist.searchText = search), value: this.grist?.searchText || '' },\n filter: { handler: () => this.grist.toggleHeadroom() },\n actions: this.mine\n ? []\n : [\n { title: i18next.t('button.add'), icon: 'add', action: () => this.grist.addRecordToTop({ currency: 'KRW', status: 'ACTIVE' }) },\n { title: i18next.t('button.delete'), action: () => this.save(true), ...CommonButtonStyles.delete },\n { title: i18next.t('button.save'), action: () => this.save(), ...CommonButtonStyles.save }\n ],\n exportable: { name: title, data: () => this.grist.exportRecords() }\n }\n }\n\n render() {\n return html`<ox-grist class=\"page-fill\" search-mode=\"term\" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\"><ox-filters-form without-search autofocus></ox-filters-form></div>\n </div>\n </ox-grist>`\n }\n\n async pageInitialized() {\n const editable = { editable: !this.mine }\n const text = (name: string, width: number, extra: any = {}) => ({ type: 'string', name, header: fieldWord('saas-account', name), width, sortable: true, ...extra, record: { ...editable, ...extra.record } })\n const object = (name: string, width: number, queryName: string, columns: { name: string; header?: string }[]) => ({\n type: 'object',\n name,\n header: fieldWord('saas-account', name),\n width,\n record: { ...editable, editor: getEditor('resource-object'), options: picker(queryName, columns) }\n })\n const open = (record: any) => record?.id && navigate(`saas-account-page?id=${record.id}`)\n this.gristConfig = {\n rows: { appendable: !this.mine, selectable: { multiple: !this.mine } },\n pagination: { limit: 100, pages: [50, 100] },\n emptyNote: {\n title: i18next.t(this.mine ? 'text.my-saas-account-empty' : 'text.saas-account-empty'),\n description: i18next.t(this.mine ? 'text.my-saas-account-empty-description' : 'text.saas-account-empty-description')\n },\n list: { fields: ['name', 'identifier'], details: ['purpose', 'admins'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n ...(this.mine ? [] : [{ type: 'gutter', gutterName: 'row-selector', multiple: true }]),\n { type: 'gutter', gutterName: 'button', icon: 'open_in_new', handlers: { click: (_c: any, _d: any, _col: any, record: any) => open(record) } },\n /* The name opens the account's 360 (ADR-0067); a new row is typed into. */\n text('name', 180, { record: { mandatory: true, renderer: (value: string, _c: any, record: any) => (record?.id ? entity360Name({ __typename: 'SaasAccount', ...record }, value) : value ?? '') } }),\n object('counterparty', 150, 'counterpartyChoices', [{ name: 'name', header: fieldWord('saas-account', 'counterparty') }]),\n text('identifier', 150),\n object('parent', 140, 'saasAccounts', [{ name: 'name', header: fieldWord('saas-account', 'parent') }]),\n text('purpose', 120),\n {\n type: 'string',\n name: 'admins',\n header: fieldWord('saas-account', 'admins'),\n width: 160,\n record: { renderer: (value: any[]) => (value ?? []).map(one => one.name).join(', ') }\n },\n object('paymentAccount', 150, 'bankAccounts', [{ name: 'name', header: fieldWord('saas-account', 'paymentAccount') }]),\n text('currency', 60, { record: { align: 'center' } }),\n text('billingEmail', 160, { hidden: true }),\n text('secretLocation', 160),\n {\n type: 'select',\n name: 'status',\n header: fieldWord('saas-account', 'status'),\n width: 80,\n sortable: true,\n record: { ...editable, options: optionsOf('saas-account-status', ACCOUNT_STATUSES) },\n filter: { type: 'select', operator: 'eq', options: filterOptionsOf('saas-account-status', ACCOUNT_STATUSES) }\n },\n text('closedOn', 100, { record: { align: 'center' } }),\n text('description', 200)\n ],\n sorters: [{ name: 'name' }]\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [], search }: FetchOption) {\n if (this.mine) {\n const response = await client.query({ query: gql`query { rows: mySaasAccounts { ${ACCOUNT_FIELDS} } }`, fetchPolicy: 'network-only' })\n if (response.errors?.length) throw response\n return { total: response.data.rows.length, records: response.data.rows }\n }\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $search: String) {\n responses: saasAccounts(filters: $filters, pagination: $pagination, sortings: $sortings, search: $search) {\n items { ${ACCOUNT_FIELDS} }\n total\n }\n }\n `,\n variables: { filters, pagination: { page, limit }, sortings, search: search?.trim() || undefined },\n fetchPolicy: 'network-only'\n })\n if (response.errors?.length) throw response\n return { total: response.data.responses.total, records: response.data.responses.items }\n }\n\n private async save(deleting = false) {\n /* A picked row goes as its id. */\n const shape = ({ counterparty, parent, paymentAccount, ...patch }: any) => ({\n ...patch,\n ...(counterparty === undefined ? {} : { counterpartyId: counterparty?.id ?? null }),\n ...(parent === undefined ? {} : { parentId: parent?.id ?? null }),\n ...(paymentAccount === undefined ? {} : { paymentAccountId: paymentAccount?.id ?? null })\n })\n if (await saveGrid(this.grist, FIELDS, 'updateMultipleSaasAccount', 'SaasAccountPatch', {}, deleting, shape)) this.grist.fetch()\n }\n}\n\n/** 내가 관리하는 구독 서비스 — the accounts the signed-in person is named an admin of, whatever their seat (ADR-0177 Q4). */\n@customElement('my-saas-account-list')\nexport class MySaasAccountList extends SaasAccountList {\n protected mine = true\n}\n"]}
|
|
1
|
+
{"version":3,"file":"saas-account-list.js","sourceRoot":"","sources":["../../client/pages/saas-account-list.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AACxC,OAAO,wCAAwC,CAAA;AAC/C,OAAO,mDAAmD,CAAA;AAE1D,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,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/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@things-factory/ai-assistant/dist-client/index.js'\n\nimport gql from 'graphql-tag'\nimport { html, nothing } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\n\nimport { DataGrist, FetchOption, getEditor } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { entity360Name } from '@operato/layout'\nimport { navigate, PageView } from '@operato/shell'\nimport { CommonButtonStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n/* The register grids' save, the asset module's - this module saves its grids the same way. */\nimport { saveGrid } from '@things-factory/asset/dist-client'\n\nimport { ACCOUNT_STATUSES, fieldWord, filterOptionsOf, optionsOf, picker } from '../words.js'\n\n/** What a new row starts with - 「행 추가」 and a paste past the last row alike. */\nconst DRAFT = () => ({ currency: 'KRW', status: 'ACTIVE' })\n\n/** The column layout the name-first order is made on - a person's older column order gives way to it. */\nconst COLUMNS_VERSION = 'lead-2026-11-08'\n\nconst FIELDS = ['name', 'counterparty', 'identifier', 'parent', 'purpose', 'billingEmail', 'paymentAccount', 'currency', 'secretLocation', 'status', 'closedOn', 'description']\nconst ACCOUNT_FIELDS = `\n id name counterparty { id name } identifier parent { id name } purpose admins { id name } billingEmail\n paymentAccount { id name } currency secretLocation status closedOn description\n`\n\n/**\n * 구독 서비스 — the accounts the domain holds with vendors (ADR-0177 decision 2), typed like a spreadsheet and saved together.\n * An account opens to its subscriptions, their seats and its admins. Its money is a recurring item's (개정 7).\n */\n@customElement('saas-account-list')\nexport class SaasAccountList extends localize(i18next)(PageView) {\n static styles = [WorkSurfacePageStyles, CommonGristStyles, CommonHeaderStyles, ScrollbarStyles]\n\n /** Only the accounts the signed-in person administers, opened and not kept here. */\n protected mine = false\n\n @state() gristConfig: any\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n const title = i18next.t(this.mine ? 'title.my-saas-account-list' : 'title.saas-account-list')\n return {\n title,\n search: { handler: (search: string) => (this.grist.searchText = search), value: this.grist?.searchText || '' },\n filter: { handler: () => this.grist.toggleHeadroom() },\n actions: this.mine\n ? []\n : [\n { id: 'add-row', title: i18next.t('button.add-row'), icon: 'add', action: () => this.grist.addNewRecord() },\n { id: 'save', title: i18next.t('button.save'), action: () => this.save(), ...CommonButtonStyles.save }\n ],\n exportable: { name: title, data: () => this.grist.exportRecords() }\n }\n }\n\n /*\n * The kept list holds its search, filters, sort and page in the address (FOOTER-BUTTON-REVIEW G09) and deletes the\n * picked rows from the selection bar over the grid (F06). One's own accounts are read whole, with nothing to pick.\n */\n render() {\n return html`${this.mine\n ? nothing\n : html`<ox-assistant-selection-bar\n .gridOf=${() => this.grist}\n name=${i18next.t('title.saas-account-list')}\n .assistant=${false}\n .actions=${[{ id: 'delete', title: i18next.t('button.delete'), icon: 'delete_outline', emphasis: { danger: true }, action: () => this.save(true) }]}\n ></ox-assistant-selection-bar>`}\n <ox-grist class=\"page-fill\" search-mode=\"term\" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${this.active && !this.mine}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\"><ox-filters-form without-search autofocus></ox-filters-form></div>\n </div>\n </ox-grist>`\n }\n\n async pageInitialized() {\n const editable = { editable: !this.mine }\n const text = (name: string, width: number, extra: any = {}) => ({ type: 'string', name, header: fieldWord('saas-account', name), width, sortable: true, ...extra, record: { ...editable, ...extra.record } })\n const object = (name: string, width: number, queryName: string, columns: { name: string; header?: string }[]) => ({\n type: 'object',\n name,\n header: fieldWord('saas-account', name),\n width,\n record: { ...editable, editor: getEditor('resource-object'), options: picker(queryName, columns) }\n })\n const open = (record: any) => record?.id && navigate(`saas-account-page?id=${record.id}`)\n this.gristConfig = {\n /*\n * No empty row under the records. The kept list starts a row with 「행 추가」, and a paste past the last row adds rows\n * with the same draft; one's own accounts are read here, not created.\n */\n rows: { appendable: false, pasteAppendable: !this.mine, newRecord: DRAFT, selectable: { multiple: !this.mine } },\n columnsVersion: COLUMNS_VERSION,\n pagination: { limit: 100, pages: [50, 100] },\n emptyNote: {\n title: i18next.t(this.mine ? 'text.my-saas-account-empty' : 'text.saas-account-empty'),\n description: i18next.t(this.mine ? 'text.my-saas-account-empty-description' : 'text.saas-account-empty-description')\n },\n list: { fields: ['name', 'identifier'], details: ['purpose', 'admins'] },\n columns: [\n /* A row's state (new, changed); a new row's mark removes it until it is saved (data-grist 행 제거). */\n { type: 'gutter', gutterName: 'dirty' },\n { type: 'gutter', gutterName: 'sequence' },\n ...(this.mine ? [] : [{ type: 'gutter', gutterName: 'row-selector', multiple: true }]),\n { type: 'gutter', gutterName: 'button', icon: 'open_in_new', handlers: { click: (_c: any, _d: any, _col: any, record: any) => open(record) } },\n /* The name opens the account's 360 (ADR-0067) and stays in view; a new row is typed into. */\n text('name', 180, { fixed: true, record: { mandatory: true, renderer: (value: string, _c: any, record: any) => (record?.id ? entity360Name({ __typename: 'SaasAccount', ...record }, value) : value ?? '') } }),\n text('identifier', 150),\n {\n type: 'select',\n name: 'status',\n header: fieldWord('saas-account', 'status'),\n width: 80,\n sortable: true,\n record: { ...editable, options: optionsOf('saas-account-status', ACCOUNT_STATUSES) },\n filter: { type: 'select', operator: 'eq', options: filterOptionsOf('saas-account-status', ACCOUNT_STATUSES) }\n },\n {\n type: 'string',\n name: 'admins',\n header: fieldWord('saas-account', 'admins'),\n width: 160,\n record: { renderer: (value: any[]) => (value ?? []).map(one => one.name).join(', ') }\n },\n object('paymentAccount', 150, 'bankAccounts', [{ name: 'name', header: fieldWord('saas-account', 'paymentAccount') }]),\n text('currency', 60, { record: { align: 'center' } }),\n text('closedOn', 100, { record: { align: 'center' } }),\n object('counterparty', 150, 'counterpartyChoices', [{ name: 'name', header: fieldWord('saas-account', 'counterparty') }]),\n object('parent', 140, 'saasAccounts', [{ name: 'name', header: fieldWord('saas-account', 'parent') }]),\n text('purpose', 120),\n text('billingEmail', 160, { hidden: true }),\n text('secretLocation', 160),\n text('description', 200)\n ],\n sorters: [{ name: 'name' }]\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [], search }: FetchOption) {\n if (this.mine) {\n const response = await client.query({ query: gql`query { rows: mySaasAccounts { ${ACCOUNT_FIELDS} } }`, fetchPolicy: 'network-only' })\n if (response.errors?.length) throw response\n return { total: response.data.rows.length, records: response.data.rows }\n }\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $search: String) {\n responses: saasAccounts(filters: $filters, pagination: $pagination, sortings: $sortings, search: $search) {\n items { ${ACCOUNT_FIELDS} }\n total\n }\n }\n `,\n variables: { filters, pagination: { page, limit }, sortings, search: search?.trim() || undefined },\n fetchPolicy: 'network-only'\n })\n if (response.errors?.length) throw response\n return { total: response.data.responses.total, records: response.data.responses.items }\n }\n\n private async save(deleting = false) {\n /* A picked row goes as its id. */\n const shape = ({ counterparty, parent, paymentAccount, ...patch }: any) => ({\n ...patch,\n ...(counterparty === undefined ? {} : { counterpartyId: counterparty?.id ?? null }),\n ...(parent === undefined ? {} : { parentId: parent?.id ?? null }),\n ...(paymentAccount === undefined ? {} : { paymentAccountId: paymentAccount?.id ?? null })\n })\n if (await saveGrid(this.grist, FIELDS, 'updateMultipleSaasAccount', 'SaasAccountPatch', {}, deleting, shape)) this.grist.fetch()\n }\n}\n\n/** 내가 관리하는 구독 서비스 — the accounts the signed-in person is named an admin of, whatever their seat (ADR-0177 Q4). */\n@customElement('my-saas-account-list')\nexport class MySaasAccountList extends SaasAccountList {\n protected mine = true\n}\n"]}
|