@things-factory/organization 7.0.51 → 7.0.55

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.
@@ -14,8 +14,9 @@ import { notify, openPopup } from '@operato/layout';
14
14
  import { PageView, store } from '@operato/shell';
15
15
  import { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles';
16
16
  import { isMobileDevice } from '@operato/utils';
17
+ import { p13n } from '@operato/p13n';
17
18
  import { EmployeeImporter } from './employee-importer';
18
- let EmployeeListPage = class EmployeeListPage extends connect(store)(localize(i18next)(ScopedElementsMixin(PageView))) {
19
+ let EmployeeListPage = class EmployeeListPage extends connect(store)(p13n(localize(i18next)(ScopedElementsMixin(PageView)))) {
19
20
  constructor() {
20
21
  super(...arguments);
21
22
  this.mode = isMobileDevice() ? 'CARD' : 'GRID';
@@ -69,16 +70,21 @@ let EmployeeListPage = class EmployeeListPage extends connect(store)(localize(i1
69
70
  render() {
70
71
  const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
71
72
  return html `
72
- <ox-grist .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
73
+ <ox-grist
74
+ .mode=${mode}
75
+ .config=${this.gristConfig}
76
+ .fetchHandler=${this.fetchHandler.bind(this)}
77
+ .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')}
78
+ >
73
79
  <div slot="headroom" class="header">
74
- <div class="title">${i18next.t('title.employee list')}</div>
75
-
76
80
  <div class="filters">
77
81
  <ox-filters-form class="filter" autofocus without-search></ox-filters-form>
78
82
  </div>
79
83
 
80
84
  <ox-context-page-toolbar class="actions" .context=${this.context}></ox-context-page-toolbar>
81
85
  </div>
86
+
87
+ <ox-grist-personalizer slot="setting"></ox-grist-personalizer>
82
88
  </ox-grist>
83
89
  `;
84
90
  }
@@ -131,7 +137,8 @@ let EmployeeListPage = class EmployeeListPage extends connect(store)(localize(i1
131
137
  fixed: true,
132
138
  header: i18next.t('field.name'),
133
139
  record: {
134
- editable: true
140
+ editable: true,
141
+ mandatory: true
135
142
  },
136
143
  filter: 'search',
137
144
  sortable: true,
@@ -180,7 +187,8 @@ let EmployeeListPage = class EmployeeListPage extends connect(store)(localize(i1
180
187
  filter: false,
181
188
  record: {
182
189
  editable: true,
183
- codeName: 'EMPLOYEE_TYPE'
190
+ codeName: 'EMPLOYEE_TYPE',
191
+ selectDispOpt: 'name'
184
192
  }
185
193
  },
186
194
  {
@@ -244,7 +252,8 @@ let EmployeeListPage = class EmployeeListPage extends connect(store)(localize(i1
244
252
  header: { renderer: () => i18next.t('label.type') },
245
253
  record: {
246
254
  editable: false,
247
- codeName: 'EMPLOYEE_TYPE'
255
+ codeName: 'EMPLOYEE_TYPE',
256
+ selectDispOpt: 'name'
248
257
  }
249
258
  },
250
259
  {
@@ -254,7 +263,8 @@ let EmployeeListPage = class EmployeeListPage extends connect(store)(localize(i1
254
263
  header: { renderer: () => i18next.t('label.job-position') },
255
264
  record: {
256
265
  editable: false,
257
- codeName: 'JOB_POSITION'
266
+ codeName: 'JOB_POSITION',
267
+ selectDispOpt: 'name'
258
268
  }
259
269
  },
260
270
  {
@@ -264,14 +274,15 @@ let EmployeeListPage = class EmployeeListPage extends connect(store)(localize(i1
264
274
  header: { renderer: () => i18next.t('label.job-responsibility') },
265
275
  record: {
266
276
  editable: false,
267
- codeName: 'JOB_RESPONSIBILITY'
277
+ codeName: 'JOB_RESPONSIBILITY',
278
+ selectDispOpt: 'name'
268
279
  }
269
280
  },
270
281
  {
271
282
  type: 'date',
272
283
  name: 'hiredOn',
273
284
  header: { renderer: () => i18next.t('field.hired-on') },
274
- width: 100
285
+ width: 120
275
286
  }
276
287
  ],
277
288
  valueField: 'id',
@@ -315,7 +326,8 @@ let EmployeeListPage = class EmployeeListPage extends connect(store)(localize(i1
315
326
  width: 175,
316
327
  record: {
317
328
  editable: true,
318
- codeName: 'JOB_RESPONSIBILITY'
329
+ codeName: 'JOB_RESPONSIBILITY',
330
+ selectDispOpt: 'name'
319
331
  }
320
332
  },
321
333
  {
@@ -325,14 +337,15 @@ let EmployeeListPage = class EmployeeListPage extends connect(store)(localize(i1
325
337
  width: 100,
326
338
  record: {
327
339
  editable: true,
328
- codeName: 'JOB_POSITION'
340
+ codeName: 'JOB_POSITION',
341
+ selectDispOpt: 'name'
329
342
  }
330
343
  },
331
344
  {
332
345
  type: 'date',
333
346
  name: 'hiredOn',
334
347
  header: i18next.t('field.hired-on'),
335
- width: 100,
348
+ width: 120,
336
349
  record: {
337
350
  editable: true
338
351
  },
@@ -342,7 +355,7 @@ let EmployeeListPage = class EmployeeListPage extends connect(store)(localize(i1
342
355
  type: 'date',
343
356
  name: 'retiredAt',
344
357
  header: i18next.t('label.retired-at'),
345
- width: 100,
358
+ width: 120,
346
359
  record: {
347
360
  editable: true
348
361
  }
@@ -685,6 +698,10 @@ EmployeeListPage.styles = [
685
698
  overflow-y: auto;
686
699
  flex: 1;
687
700
  }
701
+
702
+ .header {
703
+ grid-template-areas: 'filters actions';
704
+ }
688
705
  `
689
706
  ];
690
707
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"employee-list-page.js","sourceRoot":"","sources":["../../../client/pages/employee/employee-list-page.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,6CAA6C,CAAA;AACpD,OAAO,yBAAyB,CAAA;AAEhC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,OAAO,EAAE,SAAS,EAA4B,MAAM,qBAAqB,CAAA;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,O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M,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;;;OAMZ;YACD,SAAS,EAAE;gBACT,EAAE,EAAE,MAAM,CAAC,EAAE;gBACb,SAAS,EAAE,OAAO,CAAC,EAAE;aACtB;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAAM;QACxB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;;;OAMZ;YACD,SAAS,EAAE;gBACT,EAAE,EAAE,MAAM,CAAC,EAAE;aACd;SACF,CAAC,CAAA;QAEF,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;;AAlsBM,uBAAM,GAAG;IACd,eAAe;IACf,kBAAkB;IAClB,GAAG,CAAA;;;;;;;;;;;;;;KAcF;CACF,AAlBY,CAkBZ;AAQ2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;+CAAA;AA9BjC,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAosB5B","sourcesContent":["import '@operato/data-grist'\nimport '@operato/context/ox-context-page-toolbar.js'\nimport '@things-factory/contact'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin'\n\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { Contact } from '@operato/contact/ox-contact.js'\nimport { DataGrist, FetchOption, GristRecord } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { PageView, store } from '@operato/shell'\nimport { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { EmployeeImporter } from './employee-importer'\n\n@customElement('employee-list-page')\nexport class EmployeeListPage 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: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n `\n ]\n\n static get scopedElements() {\n return {\n 'employee-importer': EmployeeImporter\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.employee 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/employee',\n actions: [\n {\n icon: 'save',\n title: i18next.t('button.save'),\n action: this._updateEmployee.bind(this)\n },\n {\n icon: 'delete',\n title: i18next.t('button.delete'),\n action: this._deleteEmployee.bind(this),\n emphasis: {\n danger: true\n }\n }\n ],\n exportable: {\n name: i18next.t('title.employee list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\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\">${i18next.t('title.employee list')}</div>\n\n <div class=\"filters\">\n <ox-filters-form class=\"filter\" autofocus without-search></ox-filters-form>\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 pagination: { pages: [50, 100, 200] },\n list: {\n thumbnail: 'profile',\n fields: ['controlNo', 'name'],\n details: ['email', 'department', 'hiredOn', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence', fixed: true },\n { type: 'gutter', gutterName: 'row-selector', multiple: true, fixed: true },\n {\n type: 'gutter',\n gutterName: 'button',\n fixed: true,\n forList: true,\n icon: record => (!record ? 'contact_page' : record.id ? 'contact_page' : ''),\n iconOnly: false,\n title: record =>\n !record ? i18next.t('button.edit-detail') : record.id ? i18next.t('button.edit-detail') : '',\n width: 100,\n handlers: {\n click: async (columns, data, column, record, rowIndex) => {\n if (record.contact) {\n this.openContactPopup(record)\n } else if (record.id) {\n this.openContactSelector(record)\n }\n }\n }\n },\n {\n type: 'string',\n name: 'controlNo',\n fixed: true,\n header: i18next.t('field.control-no'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 105\n },\n {\n type: 'string',\n name: 'name',\n fixed: true,\n header: i18next.t('field.name'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 100\n },\n {\n type: 'string',\n name: 'alias',\n header: i18next.t('label.alias'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 110\n },\n {\n type: 'resource-object',\n name: 'user',\n header: i18next.t('field.user'),\n record: {\n editable: true,\n options: {\n title: i18next.t('title.lookup user'),\n queryName: 'users',\n basicArgs: { filters: [{ name: 'userType', operator: 'eq', value: 'user' }] },\n descriptionField: 'email',\n columns: [\n { name: 'id', hidden: true },\n { name: 'name', header: i18next.t('field.name'), filter: 'search' },\n { name: 'email', header: i18next.t('field.email'), filter: 'search' }\n ],\n list: { fields: ['name', 'email'] }\n }\n },\n sortable: true,\n filter: false,\n width: 100\n },\n {\n type: 'code',\n name: 'type',\n header: i18next.t('field.type'),\n width: 115,\n sortable: false,\n filter: false,\n record: {\n editable: true,\n codeName: 'EMPLOYEE_TYPE'\n }\n },\n {\n type: 'department-object',\n name: 'department',\n header: i18next.t('field.department'),\n record: {\n editable: true\n },\n sortable: true,\n filter: false,\n width: 130\n },\n {\n type: 'resource-object',\n name: 'supervisor',\n header: i18next.t('field.supervisor'),\n record: {\n editable: true,\n options: {\n title: i18next.t('title.employee list'),\n queryName: 'employees',\n pagination: { pages: [50, 100, 200] },\n basicArgs: {\n filters: [\n {\n name: 'active',\n operator: 'eq',\n value: true\n }\n ]\n },\n list: { fields: ['controlNo', 'name', 'alias', 'hiredOn'] },\n columns: [\n { name: 'id', hidden: true },\n {\n name: 'controlNo',\n width: 120,\n header: { renderer: () => i18next.t('field.control-no') },\n filter: 'search',\n sortable: true\n },\n {\n name: 'name',\n width: 120,\n header: { renderer: () => i18next.t('field.name') },\n filter: 'search',\n sortable: true\n },\n {\n name: 'alias',\n width: 150,\n header: { renderer: () => i18next.t('label.alias') },\n filter: 'search',\n sortable: true\n },\n {\n type: 'code',\n name: 'type',\n width: 110,\n header: { renderer: () => i18next.t('label.type') },\n record: {\n editable: false,\n codeName: 'EMPLOYEE_TYPE'\n }\n },\n {\n type: 'code',\n name: 'jobPosition',\n width: 110,\n header: { renderer: () => i18next.t('label.job-position') },\n record: {\n editable: false,\n codeName: 'JOB_POSITION'\n }\n },\n {\n type: 'code',\n name: 'jobResponsibility',\n width: 200,\n header: { renderer: () => i18next.t('label.job-responsibility') },\n record: {\n editable: false,\n codeName: 'JOB_RESPONSIBILITY'\n }\n },\n {\n type: 'date',\n name: 'hiredOn',\n header: { renderer: () => i18next.t('field.hired-on') },\n width: 100\n }\n ],\n valueField: 'id',\n nameField: 'name',\n descriptionField: 'controlNo'\n }\n },\n sortable: true,\n width: 120\n },\n {\n type: 'string',\n name: 'email',\n header: i18next.t('field.email'),\n width: 200,\n record: {\n editable: false,\n renderer: function (value, column, record, rowIndex, field) {\n return record.contact ? record.contact.email : ''\n }\n },\n sortable: true\n },\n {\n type: 'string',\n name: 'phone',\n header: i18next.t('field.phone'),\n width: 110,\n record: {\n editable: false,\n renderer: function (value, column, record, rowIndex, field) {\n return record.contact ? record.contact.phone : ''\n }\n },\n sortable: true\n },\n {\n type: 'code',\n name: 'jobResponsibility',\n header: i18next.t('label.job-responsibility'),\n width: 175,\n record: {\n editable: true,\n codeName: 'JOB_RESPONSIBILITY'\n }\n },\n {\n type: 'code',\n name: 'jobPosition',\n header: i18next.t('label.job-position'),\n width: 100,\n record: {\n editable: true,\n codeName: 'JOB_POSITION'\n }\n },\n {\n type: 'date',\n name: 'hiredOn',\n header: i18next.t('field.hired-on'),\n width: 100,\n record: {\n editable: true\n },\n sortable: true\n },\n {\n type: 'date',\n name: 'retiredAt',\n header: i18next.t('label.retired-at'),\n width: 100,\n record: {\n editable: true\n }\n },\n {\n type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n width: 70,\n record: {\n align: 'center',\n editable: true\n },\n filter: true,\n sortable: true\n },\n {\n type: 'string',\n name: 'note',\n header: i18next.t('field.note'),\n width: 200,\n record: {\n editable: true\n },\n filter: 'search'\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n width: 90,\n sortable: false\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n width: 180,\n sortable: true\n },\n {\n type: 'image',\n name: 'profile',\n record: {\n renderer: function (value, column, record, rowIndex, field) {\n return html`<ox-pfp-view\n style=\"height:90%; width: unset; aspect-ratio: 1 / 1;\"\n .profile=${record.profile}\n .name=${record.name}\n ></ox-pfp-view>`\n }\n },\n hidden: true\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'controlNo'\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: employees(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n controlNo\n name\n alias\n type\n jobResponsibility\n jobPosition\n active\n email\n phone\n user {\n id\n name\n }\n department {\n id\n name\n description\n }\n supervisor {\n id\n name\n controlNo\n }\n note\n hiredOn\n retiredAt\n contact {\n id\n email\n phone\n address\n }\n profile {\n left\n top\n zoom\n picture\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 const records = response.data.responses.items\n\n return {\n total: response.data.responses.total || 0,\n records\n }\n }\n\n async _deleteEmployee() {\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 deleteEmployees(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 _updateEmployee() {\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: [EmployeePatch!]!) {\n updateMultipleEmployee(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 exportHandler() {\n const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set([\n 'id',\n 'controlNo',\n 'name',\n 'alias',\n 'type',\n 'hiredOn',\n 'retiredAt',\n 'active',\n 'note'\n ])\n\n return exportTargets.map(employee => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = employee[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) {\n const popup = openPopup(\n html`\n <employee-importer\n .employees=${records}\n @imported=${() => {\n history.back()\n this.grist.fetch()\n }}\n ></employee-importer>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.import employee')\n }\n )\n\n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n\n async openContactPopup(record: GristRecord) {\n if (!record.contact?.id) {\n return\n }\n\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n contact(id: $id) {\n id\n name\n company\n department\n email\n phone\n address\n note\n items {\n type\n label\n value\n }\n profile {\n left\n top\n zoom\n picture\n }\n }\n }\n `,\n variables: {\n id: record.contact.id\n }\n })\n\n const { contact } = response.data\n\n const popup = openPopup(\n html`\n <contact-popup\n .contact=${contact}\n @change=${() => {\n this.grist.fetch()\n }}\n @detach=${() => {\n this.detachContact(record)\n }}\n detachable\n ></contact-popup>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.contact')\n }\n )\n }\n\n async openContactSelector(record: GristRecord) {\n const popup = openPopup(\n html`\n <contact-selector .confirmCallback=${selected => this.attachContact(record, selected)}></contact-selector>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.contact')\n }\n )\n }\n\n async attachContact(record: GristRecord, contact: Contact) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $contactId: String!) {\n attachContact(id: $id, contactId: $contactId) {\n id\n }\n }\n `,\n variables: {\n id: record.id,\n contactId: contact.id\n }\n })\n\n this.grist.fetch()\n }\n\n async detachContact(record) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!) {\n detachContact(id: $id) {\n id\n }\n }\n `,\n variables: {\n id: record.id\n }\n })\n\n this.grist.fetch()\n }\n}\n"]}
1
+ {"version":3,"file":"employee-list-page.js","sourceRoot":"","sources":["../../../client/pages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CAAC;;AAltBM,uBAAM,GAAG;IACd,eAAe;IACf,kBAAkB;IAClB,GAAG,CAAA;;;;;;;;;;;;;;;;;;KAkBF;CACF,AAtBY,CAsBZ;AAQ2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAoE;AAEpE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;+CAAA;AAlCjC,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAotB5B","sourcesContent":["import '@operato/data-grist'\nimport '@operato/context/ox-context-page-toolbar.js'\nimport '@things-factory/contact'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers/connect-mixin'\n\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements'\nimport { Contact } from '@operato/contact/ox-contact.js'\nimport { DataGrist, FetchOption, GristRecord } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\nimport { PageView, store } from '@operato/shell'\nimport { CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\nimport { p13n } from '@operato/p13n'\n\nimport { EmployeeImporter } from './employee-importer'\n\n@customElement('employee-list-page')\nexport class EmployeeListPage extends connect(store)(p13n(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: #8b0000;\n --grid-record-emphasized-color: #ff6b6b;\n }\n\n ox-grist {\n overflow-y: auto;\n flex: 1;\n }\n\n .header {\n grid-template-areas: 'filters actions';\n }\n `\n ]\n\n static get scopedElements() {\n return {\n 'employee-importer': EmployeeImporter\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.employee 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/employee',\n actions: [\n {\n icon: 'save',\n title: i18next.t('button.save'),\n action: this._updateEmployee.bind(this)\n },\n {\n icon: 'delete',\n title: i18next.t('button.delete'),\n action: this._deleteEmployee.bind(this),\n emphasis: {\n danger: true\n }\n }\n ],\n exportable: {\n name: i18next.t('title.employee list'),\n data: this.exportHandler.bind(this)\n },\n importable: {\n handler: this.importHandler.bind(this)\n },\n toolbar: false\n }\n }\n\n render() {\n const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID')\n\n return html`\n <ox-grist\n .mode=${mode}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}\n >\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-filters-form class=\"filter\" autofocus without-search></ox-filters-form>\n </div>\n\n <ox-context-page-toolbar class=\"actions\" .context=${this.context}></ox-context-page-toolbar>\n </div>\n\n <ox-grist-personalizer slot=\"setting\"></ox-grist-personalizer>\n </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n pagination: { pages: [50, 100, 200] },\n list: {\n thumbnail: 'profile',\n fields: ['controlNo', 'name'],\n details: ['email', 'department', 'hiredOn', 'updatedAt']\n },\n columns: [\n { type: 'gutter', gutterName: 'sequence', fixed: true },\n { type: 'gutter', gutterName: 'row-selector', multiple: true, fixed: true },\n {\n type: 'gutter',\n gutterName: 'button',\n fixed: true,\n forList: true,\n icon: record => (!record ? 'contact_page' : record.id ? 'contact_page' : ''),\n iconOnly: false,\n title: record =>\n !record ? i18next.t('button.edit-detail') : record.id ? i18next.t('button.edit-detail') : '',\n width: 100,\n handlers: {\n click: async (columns, data, column, record, rowIndex) => {\n if (record.contact) {\n this.openContactPopup(record)\n } else if (record.id) {\n this.openContactSelector(record)\n }\n }\n }\n },\n {\n type: 'string',\n name: 'controlNo',\n fixed: true,\n header: i18next.t('field.control-no'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 105\n },\n {\n type: 'string',\n name: 'name',\n fixed: true,\n header: i18next.t('field.name'),\n record: {\n editable: true,\n mandatory: true\n },\n filter: 'search',\n sortable: true,\n width: 100\n },\n {\n type: 'string',\n name: 'alias',\n header: i18next.t('label.alias'),\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 110\n },\n {\n type: 'resource-object',\n name: 'user',\n header: i18next.t('field.user'),\n record: {\n editable: true,\n options: {\n title: i18next.t('title.lookup user'),\n queryName: 'users',\n basicArgs: { filters: [{ name: 'userType', operator: 'eq', value: 'user' }] },\n descriptionField: 'email',\n columns: [\n { name: 'id', hidden: true },\n { name: 'name', header: i18next.t('field.name'), filter: 'search' },\n { name: 'email', header: i18next.t('field.email'), filter: 'search' }\n ],\n list: { fields: ['name', 'email'] }\n }\n },\n sortable: true,\n filter: false,\n width: 100\n },\n {\n type: 'code',\n name: 'type',\n header: i18next.t('field.type'),\n width: 115,\n sortable: false,\n filter: false,\n record: {\n editable: true,\n codeName: 'EMPLOYEE_TYPE',\n selectDispOpt: 'name'\n }\n },\n {\n type: 'department-object',\n name: 'department',\n header: i18next.t('field.department'),\n record: {\n editable: true\n },\n sortable: true,\n filter: false,\n width: 130\n },\n {\n type: 'resource-object',\n name: 'supervisor',\n header: i18next.t('field.supervisor'),\n record: {\n editable: true,\n options: {\n title: i18next.t('title.employee list'),\n queryName: 'employees',\n pagination: { pages: [50, 100, 200] },\n basicArgs: {\n filters: [\n {\n name: 'active',\n operator: 'eq',\n value: true\n }\n ]\n },\n list: { fields: ['controlNo', 'name', 'alias', 'hiredOn'] },\n columns: [\n { name: 'id', hidden: true },\n {\n name: 'controlNo',\n width: 120,\n header: { renderer: () => i18next.t('field.control-no') },\n filter: 'search',\n sortable: true\n },\n {\n name: 'name',\n width: 120,\n header: { renderer: () => i18next.t('field.name') },\n filter: 'search',\n sortable: true\n },\n {\n name: 'alias',\n width: 150,\n header: { renderer: () => i18next.t('label.alias') },\n filter: 'search',\n sortable: true\n },\n {\n type: 'code',\n name: 'type',\n width: 110,\n header: { renderer: () => i18next.t('label.type') },\n record: {\n editable: false,\n codeName: 'EMPLOYEE_TYPE',\n selectDispOpt: 'name'\n }\n },\n {\n type: 'code',\n name: 'jobPosition',\n width: 110,\n header: { renderer: () => i18next.t('label.job-position') },\n record: {\n editable: false,\n codeName: 'JOB_POSITION',\n selectDispOpt: 'name'\n }\n },\n {\n type: 'code',\n name: 'jobResponsibility',\n width: 200,\n header: { renderer: () => i18next.t('label.job-responsibility') },\n record: {\n editable: false,\n codeName: 'JOB_RESPONSIBILITY',\n selectDispOpt: 'name'\n }\n },\n {\n type: 'date',\n name: 'hiredOn',\n header: { renderer: () => i18next.t('field.hired-on') },\n width: 120\n }\n ],\n valueField: 'id',\n nameField: 'name',\n descriptionField: 'controlNo'\n }\n },\n sortable: true,\n width: 120\n },\n {\n type: 'string',\n name: 'email',\n header: i18next.t('field.email'),\n width: 200,\n record: {\n editable: false,\n renderer: function (value, column, record, rowIndex, field) {\n return record.contact ? record.contact.email : ''\n }\n },\n sortable: true\n },\n {\n type: 'string',\n name: 'phone',\n header: i18next.t('field.phone'),\n width: 110,\n record: {\n editable: false,\n renderer: function (value, column, record, rowIndex, field) {\n return record.contact ? record.contact.phone : ''\n }\n },\n sortable: true\n },\n {\n type: 'code',\n name: 'jobResponsibility',\n header: i18next.t('label.job-responsibility'),\n width: 175,\n record: {\n editable: true,\n codeName: 'JOB_RESPONSIBILITY',\n selectDispOpt: 'name'\n }\n },\n {\n type: 'code',\n name: 'jobPosition',\n header: i18next.t('label.job-position'),\n width: 100,\n record: {\n editable: true,\n codeName: 'JOB_POSITION',\n selectDispOpt: 'name'\n }\n },\n {\n type: 'date',\n name: 'hiredOn',\n header: i18next.t('field.hired-on'),\n width: 120,\n record: {\n editable: true\n },\n sortable: true\n },\n {\n type: 'date',\n name: 'retiredAt',\n header: i18next.t('label.retired-at'),\n width: 120,\n record: {\n editable: true\n }\n },\n {\n type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n width: 70,\n record: {\n align: 'center',\n editable: true\n },\n filter: true,\n sortable: true\n },\n {\n type: 'string',\n name: 'note',\n header: i18next.t('field.note'),\n width: 200,\n record: {\n editable: true\n },\n filter: 'search'\n },\n {\n type: 'resource-object',\n name: 'updater',\n header: i18next.t('field.updater'),\n width: 90,\n sortable: false\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: i18next.t('field.updated_at'),\n width: 180,\n sortable: true\n },\n {\n type: 'image',\n name: 'profile',\n record: {\n renderer: function (value, column, record, rowIndex, field) {\n return html`<ox-pfp-view\n style=\"height:90%; width: unset; aspect-ratio: 1 / 1;\"\n .profile=${record.profile}\n .name=${record.name}\n ></ox-pfp-view>`\n }\n },\n hidden: true\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n sorters: [\n {\n name: 'controlNo'\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: employees(filters: $filters, pagination: $pagination, sortings: $sortings) {\n items {\n id\n controlNo\n name\n alias\n type\n jobResponsibility\n jobPosition\n active\n email\n phone\n user {\n id\n name\n }\n department {\n id\n name\n description\n }\n supervisor {\n id\n name\n controlNo\n }\n note\n hiredOn\n retiredAt\n contact {\n id\n email\n phone\n address\n }\n profile {\n left\n top\n zoom\n picture\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 const records = response.data.responses.items\n\n return {\n total: response.data.responses.total || 0,\n records\n }\n }\n\n async _deleteEmployee() {\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 deleteEmployees(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 _updateEmployee() {\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: [EmployeePatch!]!) {\n updateMultipleEmployee(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 exportHandler() {\n const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records\n const targetFieldSet = new Set([\n 'id',\n 'controlNo',\n 'name',\n 'alias',\n 'type',\n 'hiredOn',\n 'retiredAt',\n 'active',\n 'note'\n ])\n\n return exportTargets.map(employee => {\n let tempObj = {}\n for (const field of targetFieldSet) {\n tempObj[field] = employee[field]\n }\n\n return tempObj\n })\n }\n\n async importHandler(records) {\n const popup = openPopup(\n html`\n <employee-importer\n .employees=${records}\n @imported=${() => {\n history.back()\n this.grist.fetch()\n }}\n ></employee-importer>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.import employee')\n }\n )\n\n popup.onclosed = () => {\n this.grist.fetch()\n }\n }\n\n async openContactPopup(record: GristRecord) {\n if (!record.contact?.id) {\n return\n }\n\n const response = await client.query({\n query: gql`\n query ($id: String!) {\n contact(id: $id) {\n id\n name\n company\n department\n email\n phone\n address\n note\n items {\n type\n label\n value\n }\n profile {\n left\n top\n zoom\n picture\n }\n }\n }\n `,\n variables: {\n id: record.contact.id\n }\n })\n\n const { contact } = response.data\n\n const popup = openPopup(\n html`\n <contact-popup\n .contact=${contact}\n @change=${() => {\n this.grist.fetch()\n }}\n @detach=${() => {\n this.detachContact(record)\n }}\n detachable\n ></contact-popup>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.contact')\n }\n )\n }\n\n async openContactSelector(record: GristRecord) {\n const popup = openPopup(\n html`\n <contact-selector .confirmCallback=${selected => this.attachContact(record, selected)}></contact-selector>\n `,\n {\n backdrop: true,\n size: 'large',\n title: i18next.t('title.contact')\n }\n )\n }\n\n async attachContact(record: GristRecord, contact: Contact) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $contactId: String!) {\n attachContact(id: $id, contactId: $contactId) {\n id\n }\n }\n `,\n variables: {\n id: record.id,\n contactId: contact.id\n }\n })\n\n this.grist.fetch()\n }\n\n async detachContact(record) {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!) {\n detachContact(id: $id) {\n id\n }\n }\n `,\n variables: {\n id: record.id\n }\n })\n\n this.grist.fetch()\n }\n}\n"]}
@@ -1 +1 @@
1
- export default function route(page: string): "employees-by-department" | "common-approval-line-templates-page" | "my-approval-line-templates-page" | "employee-list" | "department-tree" | "department-list" | undefined;
1
+ export default function route(page: string): "employee-list" | "department-tree" | "department-list" | "employees-by-department" | "common-approval-line-templates-page" | "my-approval-line-templates-page" | undefined;