@things-factory/organization 6.2.54 → 6.2.64
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/client/pages/approval-line/common-approval-line-templates-page.ts +15 -35
- package/client/pages/approval-line/my-approval-line-templates-page.ts +15 -35
- package/client/pages/department/department-list-page.ts +25 -15
- package/client/pages/employee/employee-list-page.ts +70 -72
- package/client/pages/employee/employees-by-department.ts +47 -44
- package/dist-client/pages/approval-line/common-approval-line-templates-page.d.ts +2 -7
- package/dist-client/pages/approval-line/common-approval-line-templates-page.js +20 -35
- package/dist-client/pages/approval-line/common-approval-line-templates-page.js.map +1 -1
- package/dist-client/pages/approval-line/my-approval-line-templates-page.d.ts +2 -7
- package/dist-client/pages/approval-line/my-approval-line-templates-page.js +20 -35
- package/dist-client/pages/approval-line/my-approval-line-templates-page.js.map +1 -1
- package/dist-client/pages/department/department-list-page.d.ts +2 -6
- package/dist-client/pages/department/department-list-page.js +35 -6
- package/dist-client/pages/department/department-list-page.js.map +1 -1
- package/dist-client/pages/employee/employee-list-page.d.ts +2 -7
- package/dist-client/pages/employee/employee-list-page.js +40 -37
- package/dist-client/pages/employee/employee-list-page.js.map +1 -1
- package/dist-client/pages/employee/employees-by-department.js +15 -9
- package/dist-client/pages/employee/employees-by-department.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -7,8 +7,6 @@ import { customElement, property, query, state } from 'lit/decorators.js'
|
|
|
7
7
|
import { ScopedElementsMixin } from '@open-wc/scoped-elements'
|
|
8
8
|
import { client } from '@operato/graphql'
|
|
9
9
|
import { i18next, localize } from '@operato/i18n'
|
|
10
|
-
import { notify, openPopup } from '@operato/layout'
|
|
11
|
-
import { OxPopup } from '@operato/popup'
|
|
12
10
|
import { DataGrist, FetchOption, GristRecord } from '@operato/data-grist'
|
|
13
11
|
|
|
14
12
|
import { connect } from 'pwa-helpers/connect-mixin'
|
|
@@ -17,7 +15,6 @@ import gql from 'graphql-tag'
|
|
|
17
15
|
import { DepartmentImporter } from '../department/department-importer'
|
|
18
16
|
import { Department } from '../../types/department'
|
|
19
17
|
|
|
20
|
-
import { DepartmentView } from '../../component/department-view'
|
|
21
18
|
import { EmployeeListPage } from './employee-list-page'
|
|
22
19
|
|
|
23
20
|
const departmentFragment = gql`
|
|
@@ -98,11 +95,11 @@ export class EmployeesByDepartment extends connect(store)(localize(i18next)(Scop
|
|
|
98
95
|
></ox-tree>
|
|
99
96
|
|
|
100
97
|
<ox-grist .config=${this.gristConfig} .fetchHandler=${this.fetchEmployees.bind(this)}>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
<div slot="headroom">
|
|
99
|
+
<div id="filters">
|
|
100
|
+
<ox-filters-form autofocus></ox-filters-form>
|
|
101
|
+
</div>
|
|
104
102
|
</div>
|
|
105
|
-
</div>
|
|
106
103
|
</ox-grist>
|
|
107
104
|
`
|
|
108
105
|
}
|
|
@@ -207,9 +204,13 @@ export class EmployeesByDepartment extends connect(store)(localize(i18next)(Scop
|
|
|
207
204
|
queryName: 'employees',
|
|
208
205
|
pagination: { pages: [50, 100, 200] },
|
|
209
206
|
basicArgs: {
|
|
210
|
-
filters: [
|
|
211
|
-
|
|
212
|
-
|
|
207
|
+
filters: [
|
|
208
|
+
{
|
|
209
|
+
name: 'active',
|
|
210
|
+
operator: 'eq',
|
|
211
|
+
value: true
|
|
212
|
+
}
|
|
213
|
+
]
|
|
213
214
|
},
|
|
214
215
|
list: { fields: ['controlNo', 'name', 'alias', 'hiredOn'] },
|
|
215
216
|
columns: [
|
|
@@ -221,54 +222,54 @@ export class EmployeesByDepartment extends connect(store)(localize(i18next)(Scop
|
|
|
221
222
|
filter: 'search',
|
|
222
223
|
sortable: true
|
|
223
224
|
},
|
|
224
|
-
{
|
|
225
|
+
{
|
|
225
226
|
name: 'name',
|
|
226
227
|
width: 120,
|
|
227
|
-
header: { renderer: () => i18next.t('field.name') },
|
|
228
|
+
header: { renderer: () => i18next.t('field.name') },
|
|
228
229
|
filter: 'search',
|
|
229
230
|
sortable: true
|
|
230
231
|
},
|
|
231
|
-
{
|
|
232
|
-
name: 'alias',
|
|
232
|
+
{
|
|
233
|
+
name: 'alias',
|
|
233
234
|
width: 150,
|
|
234
|
-
header: { renderer: () => i18next.t('label.alias') },
|
|
235
|
+
header: { renderer: () => i18next.t('label.alias') },
|
|
235
236
|
filter: 'search',
|
|
236
237
|
sortable: true
|
|
237
238
|
},
|
|
238
|
-
{
|
|
239
|
-
type: 'code',
|
|
240
|
-
name: 'type',
|
|
239
|
+
{
|
|
240
|
+
type: 'code',
|
|
241
|
+
name: 'type',
|
|
241
242
|
width: 110,
|
|
242
|
-
header: { renderer: () => i18next.t('label.type') },
|
|
243
|
-
record: {
|
|
244
|
-
editable: false,
|
|
245
|
-
codeName: 'EMPLOYEE_TYPE'
|
|
243
|
+
header: { renderer: () => i18next.t('label.type') },
|
|
244
|
+
record: {
|
|
245
|
+
editable: false,
|
|
246
|
+
codeName: 'EMPLOYEE_TYPE'
|
|
246
247
|
}
|
|
247
248
|
},
|
|
248
|
-
{
|
|
249
|
-
type: 'code',
|
|
250
|
-
name: 'jobPosition',
|
|
249
|
+
{
|
|
250
|
+
type: 'code',
|
|
251
|
+
name: 'jobPosition',
|
|
251
252
|
width: 110,
|
|
252
|
-
header: { renderer: () => i18next.t('label.job-position') },
|
|
253
|
-
record: {
|
|
254
|
-
editable: false,
|
|
255
|
-
codeName: 'JOB_POSITION'
|
|
253
|
+
header: { renderer: () => i18next.t('label.job-position') },
|
|
254
|
+
record: {
|
|
255
|
+
editable: false,
|
|
256
|
+
codeName: 'JOB_POSITION'
|
|
256
257
|
}
|
|
257
258
|
},
|
|
258
|
-
{
|
|
259
|
-
type: 'code',
|
|
260
|
-
name: 'jobResponsibility',
|
|
259
|
+
{
|
|
260
|
+
type: 'code',
|
|
261
|
+
name: 'jobResponsibility',
|
|
261
262
|
width: 200,
|
|
262
|
-
header: { renderer: () => i18next.t('label.job-responsibility') },
|
|
263
|
-
record: {
|
|
264
|
-
editable: false,
|
|
265
|
-
codeName: 'JOB_RESPONSIBILITY'
|
|
263
|
+
header: { renderer: () => i18next.t('label.job-responsibility') },
|
|
264
|
+
record: {
|
|
265
|
+
editable: false,
|
|
266
|
+
codeName: 'JOB_RESPONSIBILITY'
|
|
266
267
|
}
|
|
267
268
|
},
|
|
268
269
|
{
|
|
269
270
|
type: 'date',
|
|
270
271
|
name: 'hiredOn',
|
|
271
|
-
header: { renderer: () => i18next.t('field.hired-on') },
|
|
272
|
+
header: { renderer: () => i18next.t('field.hired-on') },
|
|
272
273
|
width: 100
|
|
273
274
|
}
|
|
274
275
|
],
|
|
@@ -288,7 +289,7 @@ export class EmployeesByDepartment extends connect(store)(localize(i18next)(Scop
|
|
|
288
289
|
record: {
|
|
289
290
|
editable: false,
|
|
290
291
|
renderer: function (value, column, record, rowIndex, field) {
|
|
291
|
-
return record.contact ? record.contact.email : ''
|
|
292
|
+
return record.contact ? record.contact.email : ''
|
|
292
293
|
}
|
|
293
294
|
},
|
|
294
295
|
sortable: true
|
|
@@ -301,7 +302,7 @@ export class EmployeesByDepartment extends connect(store)(localize(i18next)(Scop
|
|
|
301
302
|
record: {
|
|
302
303
|
editable: false,
|
|
303
304
|
renderer: function (value, column, record, rowIndex, field) {
|
|
304
|
-
return record.contact ? record.contact.phone : ''
|
|
305
|
+
return record.contact ? record.contact.phone : ''
|
|
305
306
|
}
|
|
306
307
|
},
|
|
307
308
|
sortable: true
|
|
@@ -374,10 +375,12 @@ export class EmployeesByDepartment extends connect(store)(localize(i18next)(Scop
|
|
|
374
375
|
multiple: false
|
|
375
376
|
}
|
|
376
377
|
},
|
|
377
|
-
sorters: [
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
378
|
+
sorters: [
|
|
379
|
+
{
|
|
380
|
+
name: 'controlNo'
|
|
381
|
+
}
|
|
382
|
+
]
|
|
383
|
+
}
|
|
381
384
|
|
|
382
385
|
this.fetchDepartments()
|
|
383
386
|
}
|
|
@@ -506,4 +509,4 @@ export class EmployeesByDepartment extends connect(store)(localize(i18next)(Scop
|
|
|
506
509
|
|
|
507
510
|
this.root = response.data.responses
|
|
508
511
|
}
|
|
509
|
-
}
|
|
512
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import '@operato/data-grist';
|
|
2
|
+
import '@operato/context/ox-context-page-toolbar.js';
|
|
2
3
|
import '../../component/approval-line-items-editor-popup';
|
|
3
4
|
import { PageView } from '@operato/shell';
|
|
4
5
|
import { FetchOption } from '@operato/data-grist';
|
|
@@ -14,7 +15,6 @@ export declare class CommonApprovalLineTemplatesPage extends CommonApprovalLineT
|
|
|
14
15
|
gristConfig: any;
|
|
15
16
|
mode: 'CARD' | 'GRID' | 'LIST';
|
|
16
17
|
private grist;
|
|
17
|
-
private sortersControl;
|
|
18
18
|
get context(): {
|
|
19
19
|
title: string;
|
|
20
20
|
search: {
|
|
@@ -27,15 +27,10 @@ export declare class CommonApprovalLineTemplatesPage extends CommonApprovalLineT
|
|
|
27
27
|
help: string;
|
|
28
28
|
actions: {
|
|
29
29
|
icon: string;
|
|
30
|
-
emphasis: {
|
|
31
|
-
raised: boolean;
|
|
32
|
-
outlined: boolean;
|
|
33
|
-
dense: boolean;
|
|
34
|
-
danger: boolean;
|
|
35
|
-
};
|
|
36
30
|
title: string;
|
|
37
31
|
action: () => Promise<void>;
|
|
38
32
|
}[];
|
|
33
|
+
toolbar: boolean;
|
|
39
34
|
};
|
|
40
35
|
render(): import("lit-html").TemplateResult<1>;
|
|
41
36
|
pageInitialized(lifecycle: any): Promise<void>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import '@operato/data-grist';
|
|
3
|
+
import '@operato/context/ox-context-page-toolbar.js';
|
|
3
4
|
import '../../component/approval-line-items-editor-popup';
|
|
4
|
-
import {
|
|
5
|
+
import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles';
|
|
5
6
|
import { PageView, store } from '@operato/shell';
|
|
6
7
|
import { css, html } from 'lit';
|
|
7
8
|
import { customElement, property, query } from 'lit/decorators.js';
|
|
@@ -10,7 +11,6 @@ import { getRenderer, DataGrist } from '@operato/data-grist';
|
|
|
10
11
|
import { client } from '@operato/graphql';
|
|
11
12
|
import { i18next, localize } from '@operato/i18n';
|
|
12
13
|
import { notify, openPopup } from '@operato/layout';
|
|
13
|
-
import { OxPopup } from '@operato/popup';
|
|
14
14
|
import { adjustFilters, isMobileDevice } from '@operato/utils';
|
|
15
15
|
import { connect } from 'pwa-helpers/connect-mixin';
|
|
16
16
|
import gql from 'graphql-tag';
|
|
@@ -36,42 +36,31 @@ let CommonApprovalLineTemplatesPage = class CommonApprovalLineTemplatesPage exte
|
|
|
36
36
|
},
|
|
37
37
|
help: 'organization/approval-line',
|
|
38
38
|
actions: [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
{
|
|
40
|
+
icon: 'save',
|
|
41
|
+
title: i18next.t('button.save'),
|
|
42
|
+
action: this.updateApprovalLines.bind(this)
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
icon: 'delete',
|
|
46
|
+
title: i18next.t('button.delete'),
|
|
47
|
+
action: this.deleteApprovalLines.bind(this)
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
toolbar: false
|
|
42
51
|
};
|
|
43
52
|
}
|
|
44
53
|
render() {
|
|
45
54
|
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
|
|
46
55
|
return html `
|
|
47
56
|
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
48
|
-
<div slot="headroom">
|
|
49
|
-
<div
|
|
50
|
-
<
|
|
57
|
+
<div slot="headroom" class="header">
|
|
58
|
+
<div class="title">
|
|
59
|
+
<mwc-icon>summarize</mwc-icon>
|
|
60
|
+
${i18next.t('title.common-approval-line template list')}
|
|
51
61
|
</div>
|
|
52
62
|
|
|
53
|
-
<
|
|
54
|
-
Sort
|
|
55
|
-
<mwc-icon
|
|
56
|
-
@click=${e => {
|
|
57
|
-
const target = e.currentTarget;
|
|
58
|
-
this.sortersControl.open({
|
|
59
|
-
right: 0,
|
|
60
|
-
top: target.offsetTop + target.offsetHeight
|
|
61
|
-
});
|
|
62
|
-
}}
|
|
63
|
-
>expand_more</mwc-icon
|
|
64
|
-
>
|
|
65
|
-
<ox-popup id="sorter-control">
|
|
66
|
-
<ox-sorters-control> </ox-sorters-control>
|
|
67
|
-
</ox-popup>
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
<div id="modes">
|
|
71
|
-
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
|
|
72
|
-
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
|
|
73
|
-
<mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
|
|
74
|
-
</div>
|
|
63
|
+
<ox-context-page-toolbar class="actions" .context=${this.context}></ox-context-page-toolbar>
|
|
75
64
|
</div>
|
|
76
65
|
</ox-grist>
|
|
77
66
|
`;
|
|
@@ -341,7 +330,7 @@ let CommonApprovalLineTemplatesPage = class CommonApprovalLineTemplatesPage exte
|
|
|
341
330
|
};
|
|
342
331
|
CommonApprovalLineTemplatesPage.styles = [
|
|
343
332
|
ScrollbarStyles,
|
|
344
|
-
|
|
333
|
+
CommonHeaderStyles,
|
|
345
334
|
css `
|
|
346
335
|
:host {
|
|
347
336
|
display: flex;
|
|
@@ -365,10 +354,6 @@ __decorate([
|
|
|
365
354
|
query('ox-grist'),
|
|
366
355
|
__metadata("design:type", DataGrist)
|
|
367
356
|
], CommonApprovalLineTemplatesPage.prototype, "grist", void 0);
|
|
368
|
-
__decorate([
|
|
369
|
-
query('#sorter-control'),
|
|
370
|
-
__metadata("design:type", OxPopup)
|
|
371
|
-
], CommonApprovalLineTemplatesPage.prototype, "sortersControl", void 0);
|
|
372
357
|
CommonApprovalLineTemplatesPage = __decorate([
|
|
373
358
|
customElement('common-approval-line-templates-page')
|
|
374
359
|
], CommonApprovalLineTemplatesPage);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-approval-line-templates-page.js","sourceRoot":"","sources":["../../../client/pages/approval-line/common-approval-line-templates-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,kDAAkD,CAAA;AAEzD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAa,WAAW,EAAgB,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE9D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,GAAG,MAAM,aAAa,CAAA;AAGtB,IAAM,+BAA+B,GAArC,MAAM,+BAAgC,SAAQ,OAAO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AAM,EAAE;gBACpB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;aACnB;SACF;IACH,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,EAAE,EAAE,KAAK;QAChC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;OAgBZ;YACD,SAAS,EAAE;gBACT,EAAE;gBACF,KAAK,EAAE;oBACL,KAAK;oBACL,MAAM,EAAE,GAAG;iBACZ;aACF;SACF,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACpB,MAAM,QAAQ,CAAC,aAAa,CAC1B,IAAI,WAAW,CAAC,QAAQ,EAAE;gBACxB,MAAM,EAAE;oBACN,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,0BAA0B,EAAE;wBAC7C,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC;qBAC5B,CAAC;iBACH;aACF,CAAC,CACH,CAAA;SACF;IACH,CAAC;;AAhXM,sCAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;KASF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oEAAiB;AAC5C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6DAAoE;AAE/F;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;8DAAA;AAC5C;IAAC,KAAK,CAAC,iBAAiB,CAAC;8BAA0B,OAAO;uEAAA;AApB/C,+BAA+B;IAD3C,aAAa,CAAC,qCAAqC,CAAC;GACxC,+BAA+B,CAkX3C;SAlXY,+BAA+B","sourcesContent":["import '@operato/data-grist'\nimport '../../component/approval-line-items-editor-popup'\n\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView, store } from '@operato/shell'\nimport { css, html } from 'lit'\n\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { getEditor, getRenderer, ColumnConfig, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPopup } from '@operato/popup'\nimport { adjustFilters, isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\n@customElement('common-approval-line-templates-page')\nexport class CommonApprovalLineTemplatesPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: red;\n --grid-record-emphasized-color: yellow;\n }\n `\n ]\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n @query('#sorter-control') private sortersControl!: OxPopup\n\n get context() {\n return {\n title: i18next.t('title.common-approval-line template list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n help: 'organization/approval-line',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this.updateApprovalLines.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this.deleteApprovalLines.bind(this),\n ...CommonButtonStyles.delete\n }\n ]\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\">\n <div id=\"filters\">\n <ox-filters-form autofocus without-search></ox-filters-form>\n </div>\n\n <div id=\"sorters\">\n Sort\n <mwc-icon\n @click=${e => {\n const target = e.currentTarget\n this.sortersControl.open({\n right: 0,\n top: target.offsetTop + target.offsetHeight\n })\n }}\n >expand_more</mwc-icon\n >\n <ox-popup id=\"sorter-control\">\n <ox-sorters-control> </ox-sorters-control>\n </ox-popup>\n </div>\n\n <div id=\"modes\">\n <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['name', 'description'],\n details: ['updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'reorder',\n handlers: {\n click: (columns, data, column, record, rowIndex) => {\n if (!record.id) {\n return\n }\n\n const { id, model } = record\n const popup = openPopup(\n html`\n <approval-line-items-editor-popup\n .confirmCallback=${async model => {\n await this.updateApprovalLine(id, model)\n await this.grist.fetch()\n }}\n .value=${model}\n ></approval-line-items-editor-popup>\n `,\n {\n backdrop: true,\n help: 'organization/approval-line-items-editor',\n size: 'large',\n title: i18next.t('title.approval-line item list')\n }\n )\n popup.onclosed = () => {\n this.grist?.fetch()\n }\n }\n }\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 300\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 325\n },\n {\n type: 'string',\n name: 'ownerType',\n header: i18next.t('field.owner-type'),\n width: 120\n },\n {\n type: 'resource-object',\n name: 'owner',\n header: i18next.t('field.owner'),\n record: {\n editable: false,\n renderer: function (value, column, record, rowIndex, field) {\n var options = {}\n switch (record.ownerType) {\n case 'Employee':\n options = {\n valueField: 'id',\n nameField: 'name',\n descriptionField: 'controlNo'\n }\n break\n case 'Common':\n default:\n return\n }\n\n var dynamicRecord = { ...column.record, options }\n\n return getRenderer(column.type)(value, { ...column, record: dynamicRecord }, record, rowIndex, field)\n }\n },\n width: 180\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n sortable: true,\n width: 90\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: approvalLines(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n ownerType\n owner {\n id\n name\n description\n controlNo\n }\n model {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n updater {\n id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters: adjustFilters(filters, [{ name: 'ownerType', operator: 'eq', value: 'Common' }]),\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async deleteApprovalLines() {\n if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteApprovalLines(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async updateApprovalLines() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n\n patchField['ownerType'] = 'Common'\n patchField['owner'] = null\n\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [ApprovalLinePatch!]!) {\n updateMultipleApprovalLine(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n\n async updateApprovalLine(id, model) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: ApprovalLinePatch!) {\n updateApprovalLine(id: $id, patch: $patch) {\n id\n name\n model {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n }\n }\n `,\n variables: {\n id,\n patch: {\n model,\n cuFlag: 'M'\n }\n }\n })\n if (!response.errors) {\n await document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.info_x_successfully', {\n x: i18next.t('button.save')\n })\n }\n })\n )\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"common-approval-line-templates-page.js","sourceRoot":"","sources":["../../../client/pages/approval-line/common-approval-line-templates-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,6CAA6C,CAAA;AACpD,OAAO,kDAAkD,CAAA;AAEzD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA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AMZ;gBACD,SAAS,EAAE;oBACT,OAAO;iBACR;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;gBACpB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;aACnB;SACF;IACH,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,EAAE,EAAE,KAAK;QAChC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;OAgBZ;YACD,SAAS,EAAE;gBACT,EAAE;gBACF,KAAK,EAAE;oBACL,KAAK;oBACL,MAAM,EAAE,GAAG;iBACZ;aACF;SACF,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACpB,MAAM,QAAQ,CAAC,aAAa,CAC1B,IAAI,WAAW,CAAC,QAAQ,EAAE;gBACxB,MAAM,EAAE;oBACN,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,0BAA0B,EAAE;wBAC7C,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC;qBAC5B,CAAC;iBACH;aACF,CAAC,CACH,CAAA;SACF;IACH,CAAC;;AA5VM,sCAAM,GAAG;IACd,eAAe;IACf,kBAAkB;IAClB,GAAG,CAAA;;;;;;;;;KASF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oEAAiB;AAC5C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6DAAoE;AAE/F;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;8DAAA;AAnBjC,+BAA+B;IAD3C,aAAa,CAAC,qCAAqC,CAAC;GACxC,+BAA+B,CA8V3C;SA9VY,+BAA+B","sourcesContent":["import '@operato/data-grist'\nimport '@operato/context/ox-context-page-toolbar.js'\nimport '../../component/approval-line-items-editor-popup'\n\nimport { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView, store } from '@operato/shell'\nimport { css, html } from 'lit'\n\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { getRenderer, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { adjustFilters, isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\n@customElement('common-approval-line-templates-page')\nexport class CommonApprovalLineTemplatesPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {\n static styles = [\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: red;\n --grid-record-emphasized-color: yellow;\n }\n `\n ]\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.common-approval-line template list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n help: 'organization/approval-line',\n actions: [\n {\n icon: 'save',\n title: i18next.t('button.save'),\n action: this.updateApprovalLines.bind(this)\n },\n {\n icon: 'delete',\n title: i18next.t('button.delete'),\n action: this.deleteApprovalLines.bind(this)\n }\n ],\n toolbar: false\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"title\">\n <mwc-icon>summarize</mwc-icon>\n ${i18next.t('title.common-approval-line template list')}\n </div>\n\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}></ox-context-page-toolbar>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['name', 'description'],\n details: ['updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'reorder',\n handlers: {\n click: (columns, data, column, record, rowIndex) => {\n if (!record.id) {\n return\n }\n\n const { id, model } = record\n const popup = openPopup(\n html`\n <approval-line-items-editor-popup\n .confirmCallback=${async model => {\n await this.updateApprovalLine(id, model)\n await this.grist.fetch()\n }}\n .value=${model}\n ></approval-line-items-editor-popup>\n `,\n {\n backdrop: true,\n help: 'organization/approval-line-items-editor',\n size: 'large',\n title: i18next.t('title.approval-line item list')\n }\n )\n popup.onclosed = () => {\n this.grist?.fetch()\n }\n }\n }\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 300\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 325\n },\n {\n type: 'string',\n name: 'ownerType',\n header: i18next.t('field.owner-type'),\n width: 120\n },\n {\n type: 'resource-object',\n name: 'owner',\n header: i18next.t('field.owner'),\n record: {\n editable: false,\n renderer: function (value, column, record, rowIndex, field) {\n var options = {}\n switch (record.ownerType) {\n case 'Employee':\n options = {\n valueField: 'id',\n nameField: 'name',\n descriptionField: 'controlNo'\n }\n break\n case 'Common':\n default:\n return\n }\n\n var dynamicRecord = { ...column.record, options }\n\n return getRenderer(column.type)(value, { ...column, record: dynamicRecord }, record, rowIndex, field)\n }\n },\n width: 180\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n sortable: true,\n width: 90\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: approvalLines(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n ownerType\n owner {\n id\n name\n description\n controlNo\n }\n model {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n updater {\n id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters: adjustFilters(filters, [{ name: 'ownerType', operator: 'eq', value: 'Common' }]),\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async deleteApprovalLines() {\n if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteApprovalLines(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async updateApprovalLines() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n\n patchField['ownerType'] = 'Common'\n patchField['owner'] = null\n\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [ApprovalLinePatch!]!) {\n updateMultipleApprovalLine(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n\n async updateApprovalLine(id, model) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: ApprovalLinePatch!) {\n updateApprovalLine(id: $id, patch: $patch) {\n id\n name\n model {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n }\n }\n `,\n variables: {\n id,\n patch: {\n model,\n cuFlag: 'M'\n }\n }\n })\n if (!response.errors) {\n await document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.info_x_successfully', {\n x: i18next.t('button.save')\n })\n }\n })\n )\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import '@operato/data-grist';
|
|
2
|
+
import '@operato/context/ox-context-page-toolbar.js';
|
|
2
3
|
import '../../component/approval-line-items-editor-popup';
|
|
3
4
|
import { PageView } from '@operato/shell';
|
|
4
5
|
import { FetchOption } from '@operato/data-grist';
|
|
@@ -14,7 +15,6 @@ export declare class MyApprovalLineTemplatesPage extends MyApprovalLineTemplates
|
|
|
14
15
|
gristConfig: any;
|
|
15
16
|
mode: 'CARD' | 'GRID' | 'LIST';
|
|
16
17
|
private grist;
|
|
17
|
-
private sortersControl;
|
|
18
18
|
get context(): {
|
|
19
19
|
title: string;
|
|
20
20
|
search: {
|
|
@@ -27,15 +27,10 @@ export declare class MyApprovalLineTemplatesPage extends MyApprovalLineTemplates
|
|
|
27
27
|
help: string;
|
|
28
28
|
actions: {
|
|
29
29
|
icon: string;
|
|
30
|
-
emphasis: {
|
|
31
|
-
raised: boolean;
|
|
32
|
-
outlined: boolean;
|
|
33
|
-
dense: boolean;
|
|
34
|
-
danger: boolean;
|
|
35
|
-
};
|
|
36
30
|
title: string;
|
|
37
31
|
action: () => Promise<void>;
|
|
38
32
|
}[];
|
|
33
|
+
toolbar: boolean;
|
|
39
34
|
};
|
|
40
35
|
render(): import("lit-html").TemplateResult<1>;
|
|
41
36
|
pageInitialized(lifecycle: any): Promise<void>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import '@operato/data-grist';
|
|
3
|
+
import '@operato/context/ox-context-page-toolbar.js';
|
|
3
4
|
import '../../component/approval-line-items-editor-popup';
|
|
4
|
-
import {
|
|
5
|
+
import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles';
|
|
5
6
|
import { PageView, store } from '@operato/shell';
|
|
6
7
|
import { css, html } from 'lit';
|
|
7
8
|
import { customElement, property, query } from 'lit/decorators.js';
|
|
@@ -10,7 +11,6 @@ import { getRenderer, DataGrist } from '@operato/data-grist';
|
|
|
10
11
|
import { client } from '@operato/graphql';
|
|
11
12
|
import { i18next, localize } from '@operato/i18n';
|
|
12
13
|
import { notify, openPopup } from '@operato/layout';
|
|
13
|
-
import { OxPopup } from '@operato/popup';
|
|
14
14
|
import { isMobileDevice } from '@operato/utils';
|
|
15
15
|
import { connect } from 'pwa-helpers/connect-mixin';
|
|
16
16
|
import gql from 'graphql-tag';
|
|
@@ -36,42 +36,31 @@ let MyApprovalLineTemplatesPage = class MyApprovalLineTemplatesPage extends conn
|
|
|
36
36
|
},
|
|
37
37
|
help: 'organization/approval-line',
|
|
38
38
|
actions: [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
{
|
|
40
|
+
icon: 'save',
|
|
41
|
+
title: i18next.t('button.save'),
|
|
42
|
+
action: this.updateApprovalLines.bind(this)
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
icon: 'delete',
|
|
46
|
+
title: i18next.t('button.delete'),
|
|
47
|
+
action: this.deleteApprovalLines.bind(this)
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
toolbar: false
|
|
42
51
|
};
|
|
43
52
|
}
|
|
44
53
|
render() {
|
|
45
54
|
const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
|
|
46
55
|
return html `
|
|
47
56
|
<ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
48
|
-
<div slot="headroom">
|
|
49
|
-
<div
|
|
50
|
-
<
|
|
57
|
+
<div slot="headroom" class="header">
|
|
58
|
+
<div class="title">
|
|
59
|
+
<mwc-icon>summarize</mwc-icon>
|
|
60
|
+
${i18next.t('title.my-approval-line template list')}
|
|
51
61
|
</div>
|
|
52
62
|
|
|
53
|
-
<
|
|
54
|
-
Sort
|
|
55
|
-
<mwc-icon
|
|
56
|
-
@click=${e => {
|
|
57
|
-
const target = e.currentTarget;
|
|
58
|
-
this.sortersControl.open({
|
|
59
|
-
right: 0,
|
|
60
|
-
top: target.offsetTop + target.offsetHeight
|
|
61
|
-
});
|
|
62
|
-
}}
|
|
63
|
-
>expand_more</mwc-icon
|
|
64
|
-
>
|
|
65
|
-
<ox-popup id="sorter-control">
|
|
66
|
-
<ox-sorters-control> </ox-sorters-control>
|
|
67
|
-
</ox-popup>
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
<div id="modes">
|
|
71
|
-
<mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>
|
|
72
|
-
<mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>
|
|
73
|
-
<mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
|
|
74
|
-
</div>
|
|
63
|
+
<ox-context-page-toolbar class="actions" .context=${this.context}></ox-context-page-toolbar>
|
|
75
64
|
</div>
|
|
76
65
|
</ox-grist>
|
|
77
66
|
`;
|
|
@@ -345,7 +334,7 @@ let MyApprovalLineTemplatesPage = class MyApprovalLineTemplatesPage extends conn
|
|
|
345
334
|
};
|
|
346
335
|
MyApprovalLineTemplatesPage.styles = [
|
|
347
336
|
ScrollbarStyles,
|
|
348
|
-
|
|
337
|
+
CommonHeaderStyles,
|
|
349
338
|
css `
|
|
350
339
|
:host {
|
|
351
340
|
display: flex;
|
|
@@ -369,10 +358,6 @@ __decorate([
|
|
|
369
358
|
query('ox-grist'),
|
|
370
359
|
__metadata("design:type", DataGrist)
|
|
371
360
|
], MyApprovalLineTemplatesPage.prototype, "grist", void 0);
|
|
372
|
-
__decorate([
|
|
373
|
-
query('#sorter-control'),
|
|
374
|
-
__metadata("design:type", OxPopup)
|
|
375
|
-
], MyApprovalLineTemplatesPage.prototype, "sortersControl", void 0);
|
|
376
361
|
MyApprovalLineTemplatesPage = __decorate([
|
|
377
362
|
customElement('my-approval-line-templates-page')
|
|
378
363
|
], MyApprovalLineTemplatesPage);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"my-approval-line-templates-page.js","sourceRoot":"","sources":["../../../client/pages/approval-line/my-approval-line-templates-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,kDAAkD,CAAA;AAEzD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAa,WAAW,EAAgB,SAAS,EAA+B,MAAM,qBAAqB,CAAA;AAClH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,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AAI,CAAC,QAAQ,CAAC,MAAM,EAAE;gBACpB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;aACnB;SACF;IACH,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,EAAE,EAAE,KAAK;QAChC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;OAgBZ;YACD,SAAS,EAAE;gBACT,EAAE;gBACF,KAAK,EAAE;oBACL,KAAK;oBACL,MAAM,EAAE,GAAG;iBACZ;aACF;SACF,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACpB,MAAM,QAAQ,CAAC,aAAa,CAC1B,IAAI,WAAW,CAAC,QAAQ,EAAE;gBACxB,MAAM,EAAE;oBACN,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,0BAA0B,EAAE;wBAC7C,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC;qBAC5B,CAAC;iBACH;aACF,CAAC,CACH,CAAA;SACF;IACH,CAAC;;AAjXM,kCAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;KASF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gEAAiB;AAC5C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAAoE;AAE/F;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;0DAAA;AAC5C;IAAC,KAAK,CAAC,iBAAiB,CAAC;8BAA0B,OAAO;mEAAA;AApB/C,2BAA2B;IADvC,aAAa,CAAC,iCAAiC,CAAC;GACpC,2BAA2B,CAmXvC;SAnXY,2BAA2B","sourcesContent":["import '@operato/data-grist'\nimport '../../component/approval-line-items-editor-popup'\n\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView, store } from '@operato/shell'\nimport { css, html } from 'lit'\n\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { getEditor, getRenderer, ColumnConfig, DataGrist, FetchOption, SortersControl } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { OxPopup } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\n@customElement('my-approval-line-templates-page')\nexport class MyApprovalLineTemplatesPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: red;\n --grid-record-emphasized-color: yellow;\n }\n `\n ]\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n @query('#sorter-control') private sortersControl!: OxPopup\n\n get context() {\n return {\n title: i18next.t('title.my-approval-line template list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n help: 'organization/approval-line',\n actions: [\n {\n title: i18next.t('button.save'),\n action: this.updateApprovalLines.bind(this),\n ...CommonButtonStyles.save\n },\n {\n title: i18next.t('button.delete'),\n action: this.deleteApprovalLines.bind(this),\n ...CommonButtonStyles.delete\n }\n ]\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\">\n <div id=\"filters\">\n <ox-filters-form autofocus without-search></ox-filters-form>\n </div>\n\n <div id=\"sorters\">\n Sort\n <mwc-icon\n @click=${e => {\n const target = e.currentTarget\n this.sortersControl.open({\n right: 0,\n top: target.offsetTop + target.offsetHeight\n })\n }}\n >expand_more</mwc-icon\n >\n <ox-popup id=\"sorter-control\">\n <ox-sorters-control> </ox-sorters-control>\n </ox-popup>\n </div>\n\n <div id=\"modes\">\n <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>\n </div>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['name', 'description'],\n details: ['updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'reorder',\n handlers: {\n click: (columns, data, column, record, rowIndex) => {\n if (!record.id) {\n return\n }\n\n const { id, model } = record\n const popup = openPopup(\n html`\n <approval-line-items-editor-popup\n .confirmCallback=${async model => {\n await this.updateApprovalLine(id, model)\n await this.grist.fetch()\n }}\n .value=${model}\n ></approval-line-items-editor-popup>\n `,\n {\n backdrop: true,\n help: 'organization/approval-line-items-editor',\n size: 'large',\n title: i18next.t('title.approval-line item list')\n }\n )\n popup.onclosed = () => {\n this.grist?.fetch()\n }\n }\n }\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 300\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 325\n },\n {\n type: 'string',\n name: 'ownerType',\n header: i18next.t('field.owner-type'),\n width: 120\n },\n {\n type: 'resource-object',\n name: 'owner',\n header: i18next.t('field.owner'),\n record: {\n editable: false,\n renderer: function (value, column, record, rowIndex, field) {\n var options = {}\n switch (record.ownerType) {\n case 'Employee':\n options = {\n valueField: 'id',\n nameField: 'name',\n descriptionField: 'controlNo'\n }\n break\n case 'Common':\n default:\n return\n }\n\n var dynamicRecord = { ...column.record, options }\n return getRenderer(column.type)(value, { ...column, record: dynamicRecord }, record, rowIndex, field)\n }\n },\n width: 180\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: {\n editable: false\n },\n sortable: true,\n width: 90\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: myApprovalLines(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n ownerType\n owner {\n id\n name\n description\n controlNo\n }\n model {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n updater {\n id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async deleteApprovalLines() {\n if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteMyApprovalLines(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async updateApprovalLines() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [ApprovalLinePatch!]!) {\n updateMultipleMyApprovalLine(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n\n async updateApprovalLine(id, model) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: ApprovalLinePatch!) {\n updateApprovalLine(id: $id, patch: $patch) {\n id\n name\n model {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n }\n }\n `,\n variables: {\n id,\n patch: {\n model,\n cuFlag: 'M'\n }\n }\n })\n if (!response.errors) {\n await document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.info_x_successfully', {\n x: i18next.t('button.save')\n })\n }\n })\n )\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"my-approval-line-templates-page.js","sourceRoot":"","sources":["../../../client/pages/approval-line/my-approval-line-templates-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,6CAA6C,CAAA;AACpD,OAAO,kDAAkD,CAAA;AAEzD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,mBAAmB,E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;IAED,KAAK,CAAC,kBAAkB,CAAC,EAAE,EAAE,KAAK;QAChC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;OAgBZ;YACD,SAAS,EAAE;gBACT,EAAE;gBACF,KAAK,EAAE;oBACL,KAAK;oBACL,MAAM,EAAE,GAAG;iBACZ;aACF;SACF,CAAC,CAAA;QACF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACpB,MAAM,QAAQ,CAAC,aAAa,CAC1B,IAAI,WAAW,CAAC,QAAQ,EAAE;gBACxB,MAAM,EAAE;oBACN,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,0BAA0B,EAAE;wBAC7C,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC;qBAC5B,CAAC;iBACH;aACF,CAAC,CACH,CAAA;SACF;IACH,CAAC;;AA7VM,kCAAM,GAAG;IACd,eAAe;IACf,kBAAkB;IAClB,GAAG,CAAA;;;;;;;;;KASF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gEAAiB;AAC5C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yDAAoE;AAE/F;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;0DAAA;AAnBjC,2BAA2B;IADvC,aAAa,CAAC,iCAAiC,CAAC;GACpC,2BAA2B,CA+VvC;SA/VY,2BAA2B","sourcesContent":["import '@operato/data-grist'\nimport '@operato/context/ox-context-page-toolbar.js'\nimport '../../component/approval-line-items-editor-popup'\n\nimport { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView, store } from '@operato/shell'\nimport { css, html } from 'lit'\n\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { getRenderer, DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { connect } from 'pwa-helpers/connect-mixin'\nimport gql from 'graphql-tag'\n\n@customElement('my-approval-line-templates-page')\nexport class MyApprovalLineTemplatesPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {\n static styles = [\n ScrollbarStyles,\n CommonHeaderStyles,\n css`\n :host {\n display: flex;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: red;\n --grid-record-emphasized-color: yellow;\n }\n `\n ]\n\n @property({ type: Object }) gristConfig: any\n @property({ type: String }) mode: 'CARD' | 'GRID' | 'LIST' = isMobileDevice() ? 'CARD' : 'GRID'\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.my-approval-line template list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n },\n help: 'organization/approval-line',\n actions: [\n {\n icon: 'save',\n title: i18next.t('button.save'),\n action: this.updateApprovalLines.bind(this)\n },\n {\n icon: 'delete',\n title: i18next.t('button.delete'),\n action: this.deleteApprovalLines.bind(this)\n }\n ],\n toolbar: false\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"title\">\n <mwc-icon>summarize</mwc-icon>\n ${i18next.t('title.my-approval-line template list')}\n </div>\n\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}></ox-context-page-toolbar>\n </div>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n list: {\n fields: ['name', 'description'],\n details: ['updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'reorder',\n handlers: {\n click: (columns, data, column, record, rowIndex) => {\n if (!record.id) {\n return\n }\n\n const { id, model } = record\n const popup = openPopup(\n html`\n <approval-line-items-editor-popup\n .confirmCallback=${async model => {\n await this.updateApprovalLine(id, model)\n await this.grist.fetch()\n }}\n .value=${model}\n ></approval-line-items-editor-popup>\n `,\n {\n backdrop: true,\n help: 'organization/approval-line-items-editor',\n size: 'large',\n title: i18next.t('title.approval-line item list')\n }\n )\n popup.onclosed = () => {\n this.grist?.fetch()\n }\n }\n }\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 300\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n filter: 'search',\n width: 325\n },\n {\n type: 'string',\n name: 'ownerType',\n header: i18next.t('field.owner-type'),\n width: 120\n },\n {\n type: 'resource-object',\n name: 'owner',\n header: i18next.t('field.owner'),\n record: {\n editable: false,\n renderer: function (value, column, record, rowIndex, field) {\n var options = {}\n switch (record.ownerType) {\n case 'Employee':\n options = {\n valueField: 'id',\n nameField: 'name',\n descriptionField: 'controlNo'\n }\n break\n case 'Common':\n default:\n return\n }\n\n var dynamicRecord = { ...column.record, options }\n return getRenderer(column.type)(value, { ...column, record: dynamicRecord }, record, rowIndex, field)\n }\n },\n width: 180\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n record: {\n editable: false\n },\n sortable: true,\n width: 90\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'name'\n }\n ]\n }\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (this.active) {\n // do something here when this page just became as active\n }\n }\n\n async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {\n responses: myApprovalLines(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n name\n description\n ownerType\n owner {\n id\n name\n description\n controlNo\n }\n model {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n updater {\n id\n name\n }\n updatedAt\n }\n total\n }\n }\n `,\n variables: {\n filters,\n pagination: { page, limit },\n sortings\n }\n })\n\n return {\n total: response.data.responses.total || 0,\n records: response.data.responses.items || []\n }\n }\n\n async deleteApprovalLines() {\n if (confirm(i18next.t('text.sure_to_x', { x: i18next.t('text.delete') }))) {\n const ids = this.grist.selected.map(record => record.id)\n if (ids && ids.length > 0) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($ids: [String!]!) {\n deleteMyApprovalLines(ids: $ids)\n }\n `,\n variables: {\n ids\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({\n message: i18next.t('text.info_x_successfully', { x: i18next.t('text.delete') })\n })\n }\n }\n }\n }\n\n async updateApprovalLines() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.id ? { id: patch.id } : {}\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n patchField.cuFlag = patch.__dirty__\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($patches: [ApprovalLinePatch!]!) {\n updateMultipleMyApprovalLine(patches: $patches) {\n name\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n }\n }\n }\n\n async updateApprovalLine(id, model) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $patch: ApprovalLinePatch!) {\n updateApprovalLine(id: $id, patch: $patch) {\n id\n name\n model {\n type\n approver {\n id\n name\n description\n controlNo\n }\n }\n }\n }\n `,\n variables: {\n id,\n patch: {\n model,\n cuFlag: 'M'\n }\n }\n })\n if (!response.errors) {\n await document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n message: i18next.t('text.info_x_successfully', {\n x: i18next.t('button.save')\n })\n }\n })\n )\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import '@operato/data-tree';
|
|
2
|
+
import '@operato/context/ox-context-page-toolbar.js';
|
|
2
3
|
import { PageView } from '@operato/shell';
|
|
3
4
|
import { DepartmentImporter } from './department-importer';
|
|
4
5
|
import { Department } from '../../types/department';
|
|
@@ -23,12 +24,6 @@ export declare class DepartmentListPage extends DepartmentListPage_base {
|
|
|
23
24
|
help: string;
|
|
24
25
|
actions: ({
|
|
25
26
|
icon: string;
|
|
26
|
-
emphasis: {
|
|
27
|
-
raised: boolean;
|
|
28
|
-
outlined: boolean;
|
|
29
|
-
dense: boolean;
|
|
30
|
-
danger: boolean;
|
|
31
|
-
};
|
|
32
27
|
title: string;
|
|
33
28
|
action: () => void;
|
|
34
29
|
} | null)[];
|
|
@@ -39,6 +34,7 @@ export declare class DepartmentListPage extends DepartmentListPage_base {
|
|
|
39
34
|
importable: {
|
|
40
35
|
handler: (records: any) => Promise<void>;
|
|
41
36
|
};
|
|
37
|
+
toolbar: boolean;
|
|
42
38
|
};
|
|
43
39
|
render(): import("lit-html").TemplateResult<1>;
|
|
44
40
|
onSelect(e: CustomEvent): void;
|