@things-factory/operato-pms 3.8.13 → 3.8.26

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.
Files changed (60) hide show
  1. package/client/pages/dispatchment/daily-dispatch-detail.js +1 -1
  2. package/client/pages/dispatchment/dispatchment-create-record.js +20 -44
  3. package/client/pages/harvesting/daily-harvesting-detail.js +2 -2
  4. package/client/pages/harvesting/edit-harvesting-record.js +2 -2
  5. package/client/pages/harvesting/harvesting-create-record.js +2 -2
  6. package/client/pages/inventory/inventory-ramp-tonnage.js +23 -31
  7. package/client/pages/report/report-daily-ffb-dispatch-and-production.js +167 -124
  8. package/client/pages/report/report-ffb-tonnage-between-individual-block.js +12 -7
  9. package/dist-server/constants/transaction.js +2 -1
  10. package/dist-server/constants/transaction.js.map +1 -1
  11. package/dist-server/entities/daily-dispatch.js +1 -2
  12. package/dist-server/entities/daily-dispatch.js.map +1 -1
  13. package/dist-server/graphql/resolvers/daily-dispatch/update-daily-dispatch.js +1 -1
  14. package/dist-server/graphql/resolvers/daily-dispatch/update-daily-dispatch.js.map +1 -1
  15. package/dist-server/graphql/resolvers/daily-harvest/generate-daily-harvest.js +2 -2
  16. package/dist-server/graphql/resolvers/daily-harvest/generate-daily-harvest.js.map +1 -1
  17. package/dist-server/graphql/resolvers/daily-loading/update-daily-loading.js +19 -6
  18. package/dist-server/graphql/resolvers/daily-loading/update-daily-loading.js.map +1 -1
  19. package/dist-server/graphql/resolvers/dashboard/dashboard-query.js +165 -43
  20. package/dist-server/graphql/resolvers/dashboard/dashboard-query.js.map +1 -1
  21. package/dist-server/graphql/resolvers/report/daily-ffb-dispatch-production-reports.js +111 -0
  22. package/dist-server/graphql/resolvers/report/daily-ffb-dispatch-production-reports.js.map +1 -0
  23. package/dist-server/graphql/resolvers/report/daily-production-reports.js +6 -6
  24. package/dist-server/graphql/resolvers/report/index.js +2 -1
  25. package/dist-server/graphql/resolvers/report/index.js.map +1 -1
  26. package/dist-server/graphql/resolvers/report/monthly-block-dispatch-reports.js +10 -8
  27. package/dist-server/graphql/resolvers/report/monthly-block-dispatch-reports.js.map +1 -1
  28. package/dist-server/graphql/resolvers/report/monthly-ffb-sale-reports.js +1 -1
  29. package/dist-server/graphql/resolvers/report/monthly-production-reports.js +1 -1
  30. package/dist-server/graphql/types/report/daily-ffb-dispatch-production-report-list.js +14 -0
  31. package/dist-server/graphql/types/report/daily-ffb-dispatch-production-report-list.js.map +1 -0
  32. package/dist-server/graphql/types/report/daily-ffb-dispatch-production-report.js +15 -0
  33. package/dist-server/graphql/types/report/daily-ffb-dispatch-production-report.js.map +1 -0
  34. package/dist-server/graphql/types/report/index.js +13 -0
  35. package/dist-server/graphql/types/report/index.js.map +1 -1
  36. package/dist-server/utils/core-values.js +2 -2
  37. package/dist-server/utils/transaction-util.js +2 -1
  38. package/dist-server/utils/transaction-util.js.map +1 -1
  39. package/package.json +4 -4
  40. package/server/constants/transaction.ts +2 -1
  41. package/server/entities/daily-dispatch.ts +1 -4
  42. package/server/graphql/resolvers/daily-dispatch/update-daily-dispatch.ts +2 -2
  43. package/server/graphql/resolvers/daily-harvest/generate-daily-harvest.ts +2 -2
  44. package/server/graphql/resolvers/daily-loading/update-daily-loading.ts +39 -11
  45. package/server/graphql/resolvers/dashboard/dashboard-query.ts +208 -52
  46. package/server/graphql/resolvers/report/daily-ffb-dispatch-production-reports.ts +138 -0
  47. package/server/graphql/resolvers/report/daily-production-reports.ts +6 -6
  48. package/server/graphql/resolvers/report/index.ts +3 -1
  49. package/server/graphql/resolvers/report/monthly-block-dispatch-reports.ts +11 -9
  50. package/server/graphql/resolvers/report/monthly-ffb-sale-reports.ts +1 -1
  51. package/server/graphql/resolvers/report/monthly-production-reports.ts +1 -1
  52. package/server/graphql/types/report/daily-ffb-dispatch-production-report-list.ts +8 -0
  53. package/server/graphql/types/report/daily-ffb-dispatch-production-report.ts +9 -0
  54. package/server/graphql/types/report/index.ts +13 -0
  55. package/server/utils/core-values.ts +2 -2
  56. package/server/utils/transaction-util.ts +2 -1
  57. package/translations/en.json +7 -6
  58. package/translations/ko.json +7 -6
  59. package/translations/ms.json +10 -9
  60. package/translations/zh.json +7 -6
@@ -127,7 +127,7 @@ class DailyDispatchDetail extends localize(i18next)(PageView) {
127
127
  <label>${i18next.t('label.chit_no')}</label>
128
128
  <input name="chitNo" />
129
129
 
130
- <label>${i18next.t('label.percentage')}</label>
130
+ <label>${i18next.t('label.oer_percentage')}</label>
131
131
  <input name="percentage" type="number" min="0" />
132
132
  </fieldset>
133
133
  </form>
@@ -141,7 +141,7 @@ class DispatchmentCreateRecord extends localize(i18next)(PageView) {
141
141
  <label>${i18next.t('label.chit_no')}</label>
142
142
  <input name="chitNo" />
143
143
 
144
- <label>${i18next.t('label.percentage')}</label>
144
+ <label>${i18next.t('label.oer_percentage')}</label>
145
145
  <input name="percentage" type="number" min="0" />
146
146
  </fieldset>
147
147
  </form>
@@ -196,7 +196,7 @@ class DispatchmentCreateRecord extends localize(i18next)(PageView) {
196
196
  this.dispatchmentGristConfig = {
197
197
  pagination: { infinite: true },
198
198
  list: {
199
- fields: ['plantationInventory', 'totalTonnage', 'releaseTonange']
199
+ fields: ['ramp', 'totalTonnage', 'releaseTonange']
200
200
  },
201
201
  columns: [
202
202
  { type: 'gutter', gutterName: 'sequence' },
@@ -215,38 +215,22 @@ class DispatchmentCreateRecord extends localize(i18next)(PageView) {
215
215
  },
216
216
  {
217
217
  type: 'object',
218
- name: 'plantationInventory',
218
+ name: 'ramp',
219
219
  header: i18next.t('field.ramp'),
220
220
  record: {
221
221
  editable: true,
222
222
  options: {
223
- queryName: 'plantationInventories',
224
- nameField: 'rampName',
225
- basicArgs: {
226
- filters: [{ name: 'type', value: 'RAMP_TONNAGE', operator: 'eq' }]
227
- },
223
+ queryName: 'ramps',
224
+ basicArgs: { filters: [] },
228
225
  select: [
229
226
  { name: 'id', hidden: true },
230
- { name: 'rampId', hidden: true },
231
- { name: 'rampName', header: i18next.t('field.ramp'), width: 200 },
232
- {
233
- name: 'totalTonnage',
234
- type: 'float',
235
- header: i18next.t('field.remaining_tonnage'),
236
- width: 200,
237
- ignoreCondition: true
238
- }
227
+ { name: 'name', header: i18next.t('field.name'), width: 200 },
228
+ { name: 'block', type: 'object', queryName: 'blocks', field: 'name', width: 200 }
239
229
  ],
240
- list: { fields: ['rampName', 'totalTonnage'] }
230
+ list: { fields: ['id', 'name', 'block'] }
241
231
  }
242
232
  },
243
- width: 300
244
- },
245
- {
246
- type: 'integer',
247
- name: 'totalTonnage',
248
- header: i18next.t('field.available_tonnage'),
249
- width: 140
233
+ width: 130
250
234
  },
251
235
  {
252
236
  type: 'float',
@@ -286,7 +270,7 @@ class DispatchmentCreateRecord extends localize(i18next)(PageView) {
286
270
 
287
271
  try {
288
272
  if (changedColumn === 'collectedRampWeight') {
289
- this._validateReleaseTonnage(changeRecord.collectedRampWeight, changeRecord.totalTonnage)
273
+ this._validateReleaseTonnage(changeRecord.collectedRampWeight)
290
274
  }
291
275
  this._updateInventoryList()
292
276
  } catch (e) {
@@ -300,34 +284,29 @@ class DispatchmentCreateRecord extends localize(i18next)(PageView) {
300
284
  }
301
285
  }
302
286
 
303
- _validateReleaseTonnage(collectedRampWeight, totalTonnage) {
304
- if (totalTonnage === undefined) throw new Error(i18next.t('text.there_is_no_selected_items'))
305
- if (collectedRampWeight > totalTonnage) {
306
- throw new Error(i18next.t('text.available_tonnage_insufficient'))
307
- } else if (collectedRampWeight <= 0) {
287
+ _validateReleaseTonnage(collectedRampWeight) {
288
+ if (collectedRampWeight <= 0 || isNaN(collectedRampWeight)) {
308
289
  throw new Error(i18next.t('text.invalid_tonnage_input'))
309
290
  }
310
291
  }
311
292
 
312
293
  async _updateInventoryList() {
313
- const _selectedInventories = (this.dispatchmentGrist.dirtyData.records || []).map(
314
- record => record.plantationInventory.id
315
- )
294
+ const _selectedRamp = (this.dispatchmentGrist.dirtyData.records || []).map(record => record.ramp.id)
316
295
  this.dispatchmentGristConfig = {
317
296
  ...this.dispatchmentGristConfig,
318
297
  columns: this.dispatchmentGristConfig.columns.map(column => {
319
- if (column.name === 'plantationInventory') {
298
+ if (column.name === 'ramp') {
320
299
  column.record.options.basicArgs = {
321
300
  ...column.record.options.basicArgs,
322
301
  filters: [...column.record.options.basicArgs.filters.filter(filter => filter.name !== 'id')]
323
302
  }
324
303
 
325
- if (_selectedInventories.length)
304
+ if (_selectedRamp.length)
326
305
  column.record.options.basicArgs.filters = [
327
306
  ...column.record.options.basicArgs.filters,
328
307
  {
329
308
  name: 'id',
330
- value: _selectedInventories,
309
+ value: _selectedRamp,
331
310
  operator: 'notin'
332
311
  }
333
312
  ]
@@ -359,7 +338,8 @@ class DispatchmentCreateRecord extends localize(i18next)(PageView) {
359
338
  ...dailyDispatch,
360
339
  driver: { id: this.selectedDriverID, name: this.selectedDriverName },
361
340
  transport: { id: this.selectedTruckID, name: this.selectedTruckName },
362
- dispatchTo: { id: this.selectedMillID, name: this.selectedMillName }
341
+ dispatchTo: { id: this.selectedMillID, name: this.selectedMillName },
342
+ percentage: parseFloat(dailyDispatch.percentage)
363
343
  }
364
344
 
365
345
  const response = await client.mutate({
@@ -385,8 +365,6 @@ class DispatchmentCreateRecord extends localize(i18next)(PageView) {
385
365
  }
386
366
 
387
367
  _validateForm() {
388
- if (!this.dispatchmentForm.checkValidity()) throw new Error(i18next.t('text.dispatch_record_invalid'))
389
-
390
368
  if (this.percentageInput?.value) {
391
369
  if (isNaN(this.percentageInput.value) || this.percentageInput?.value <= 0) {
392
370
  throw new Error(i18next.t('text.x_has_invalid_value', { state: 'label.percentage' }))
@@ -399,16 +377,14 @@ class DispatchmentCreateRecord extends localize(i18next)(PageView) {
399
377
  if (!this.dispatchmentGrist.dirtyData.records || !this.dispatchmentGrist.dirtyData.records.length)
400
378
  throw new Error(i18next.t('text.no_records_in_dispatchment_list'))
401
379
 
402
- if (
403
- this.dispatchmentGrist.dirtyData.records.filter(record => !record.rampName || !record.collectedRampWeight).length
404
- )
380
+ if (this.dispatchmentGrist.dirtyData.records.filter(record => !record.ramp || !record.collectedRampWeight).length)
405
381
  throw new Error(i18next.t('text.empty_value_in_dispatchment_data'))
406
382
  }
407
383
 
408
384
  _getDispatchDetails() {
409
385
  return this.dispatchmentGrist.dirtyData.records.map(record => {
410
386
  let dailyDispatchDetails = {
411
- ramp: { id: record.plantationInventory.rampId, name: record.plantationInventory.rampName },
387
+ ramp: { id: record.ramp.id, name: record.ramp.name },
412
388
  collectedRampWeight: Number(record.collectedRampWeight),
413
389
  remark: record?.remark ? record.remark : null
414
390
  }
@@ -197,9 +197,9 @@ class DailyHarvestingDetail extends localize(i18next)(PageView) {
197
197
  {
198
198
  type: 'float',
199
199
  name: 'totalTonnageHarvested',
200
- header: i18next.t('field.total_tonnage_harvested'),
200
+ header: i18next.t('field.total_tonnage_estimated'),
201
201
  label: true,
202
- width: 150
202
+ width: 200
203
203
  },
204
204
  {
205
205
  type: 'string',
@@ -215,9 +215,9 @@ class EditHarvestingRecord extends localize(i18next)(PageView) {
215
215
  {
216
216
  type: 'float',
217
217
  name: 'totalTonnageHarvested',
218
- header: i18next.t('field.total_tonnage_harvested'),
218
+ header: i18next.t('field.total_tonnage_estimated'),
219
219
  record: { editable: true },
220
- width: 150
220
+ width: 200
221
221
  },
222
222
  {
223
223
  type: 'string',
@@ -210,9 +210,9 @@ class HarvestingCreateRecord extends localize(i18next)(PageView) {
210
210
  {
211
211
  type: 'float',
212
212
  name: 'totalTonnageHarvested',
213
- header: i18next.t('field.total_tonnage_harvested'),
213
+ header: i18next.t('field.total_tonnage_estimated'),
214
214
  record: { editable: true },
215
- width: 150
215
+ width: 200
216
216
  },
217
217
  {
218
218
  type: 'string',
@@ -1,14 +1,16 @@
1
1
  import '@things-factory/form-ui'
2
2
  import '@things-factory/grist-ui'
3
+ import './inventory-history-by-tonnage'
4
+
5
+ import gql from 'graphql-tag'
6
+ import { css, html } from 'lit-element'
7
+ import { connect } from 'pwa-helpers/connect-mixin'
8
+
3
9
  import { i18next, localize } from '@things-factory/i18n-base'
4
10
  import { openPopup } from '@things-factory/layout-base'
5
11
  import { client, PageView, store } from '@things-factory/shell'
6
12
  import { ScrollbarStyles } from '@things-factory/styles'
7
13
  import { isMobileDevice } from '@things-factory/utils'
8
- import gql from 'graphql-tag'
9
- import { css, html } from 'lit-element'
10
- import { connect } from 'pwa-helpers/connect-mixin'
11
- import './inventory-history-by-tonnage'
12
14
 
13
15
  class InventoryRampTonnage extends connect(store)(localize(i18next)(PageView)) {
14
16
  static get styles() {
@@ -79,20 +81,20 @@ class InventoryRampTonnage extends connect(store)(localize(i18next)(PageView)) {
79
81
  }
80
82
 
81
83
  async pageInitialized() {
82
- const _blocks = await this.fetchBlocks()
84
+ const _ramps = await this._fetchRamp()
83
85
 
84
86
  this._searchFields = [
85
87
  {
86
- label: i18next.t('field.block'),
87
- name: 'blockId',
88
+ label: i18next.t('field.ramp'),
89
+ name: 'rampId',
88
90
  type: 'select',
89
91
  options: [
90
92
  { value: '' },
91
- ..._blocks
92
- .map(block => {
93
+ ..._ramps
94
+ .map(ramp => {
93
95
  return {
94
- name: block.name,
95
- value: block.id
96
+ name: ramp.name,
97
+ value: ramp.id
96
98
  }
97
99
  })
98
100
  .sort(this._compareValues('name', 'asc'))
@@ -103,15 +105,10 @@ class InventoryRampTonnage extends connect(store)(localize(i18next)(PageView)) {
103
105
 
104
106
  this.config = {
105
107
  list: {
106
- fields: ['block', 'ramp', 'tonnage', 'updatedAt']
107
- },
108
- pagination: { pages: [10, 20, 50, 2500] },
109
- rows: {
110
- selectable: {
111
- multiple: true
112
- },
113
- appendable: false
108
+ fields: ['ramp', 'tonnage', 'updatedAt']
114
109
  },
110
+ pagination: { pages: [10, 20, 50, 100] },
111
+ rows: { appendable: false },
115
112
  columns: [
116
113
  { type: 'gutter', gutterName: 'sequence' },
117
114
  {
@@ -122,20 +119,13 @@ class InventoryRampTonnage extends connect(store)(localize(i18next)(PageView)) {
122
119
  click: this._showTonnageMovement.bind(this)
123
120
  }
124
121
  },
125
- {
126
- type: 'object',
127
- name: 'block',
128
- header: i18next.t('field.block'),
129
- imex: { header: i18next.t('field.block'), key: 'block', width: 50, type: 'string' },
130
- sortable: true,
131
- width: 150
132
- },
133
122
  {
134
123
  type: 'object',
135
124
  name: 'ramp',
136
125
  header: i18next.t('field.ramp'),
137
126
  imex: { header: i18next.t('field.ramp'), key: 'ramp', width: 50, type: 'string' },
138
127
  sortable: true,
128
+ label: true,
139
129
  width: 150
140
130
  },
141
131
  {
@@ -144,6 +134,7 @@ class InventoryRampTonnage extends connect(store)(localize(i18next)(PageView)) {
144
134
  header: i18next.t('field.tonnage_remaining'),
145
135
  imex: { header: i18next.t('field.tonnage_remaining'), key: 'tonnage', width: 30, type: 'string' },
146
136
  sortable: true,
137
+ label: true,
147
138
  width: 200
148
139
  },
149
140
  {
@@ -151,6 +142,7 @@ class InventoryRampTonnage extends connect(store)(localize(i18next)(PageView)) {
151
142
  name: 'updatedAt',
152
143
  header: i18next.t('field.updated_at'),
153
144
  sortable: true,
145
+ label: true,
154
146
  imex: { header: i18next.t('field.updated_at'), key: 'updatedAt', width: 75, type: 'date' },
155
147
  width: 150
156
148
  }
@@ -233,12 +225,12 @@ class InventoryRampTonnage extends connect(store)(localize(i18next)(PageView)) {
233
225
  }
234
226
  }
235
227
 
236
- async fetchBlocks() {
228
+ async _fetchRamp() {
237
229
  const filters = []
238
230
  const response = await client.query({
239
231
  query: gql`
240
- query blocks($filters: [Filter]) {
241
- blocks(filters: $filters) {
232
+ query ramps($filters: [Filter]) {
233
+ ramps(filters: $filters) {
242
234
  items {
243
235
  id
244
236
  name
@@ -249,7 +241,7 @@ class InventoryRampTonnage extends connect(store)(localize(i18next)(PageView)) {
249
241
  `,
250
242
  variables: { filters }
251
243
  })
252
- return response.data.blocks.items
244
+ return response.data.ramps.items
253
245
  }
254
246
 
255
247
  _showTonnageMovement(columns, data, column, record, rowIndex) {