@things-factory/operato-pms 3.8.0 → 3.8.13
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/bootstrap.js +20 -7
- package/client/component/block-selector-popup.js +125 -24
- package/client/component/driver-selector-popup.js +223 -0
- package/client/component/mill-selector-popup.js +200 -0
- package/client/component/tracked-plantation-setting.js +113 -0
- package/client/component/truck-selector-popup.js +202 -0
- package/client/menu.js +34 -2
- package/client/pages/constants/index.js +1 -0
- package/client/pages/constants/organization.js +5 -0
- package/client/pages/dispatchment/daily-dispatch-detail.js +57 -18
- package/client/pages/dispatchment/dispatchment-create-record.js +140 -13
- package/client/pages/dispatchment/dispatchment-list.js +26 -34
- package/client/pages/harvesting/daily-harvesting-detail.js +55 -18
- package/client/pages/harvesting/edit-harvesting-record.js +89 -23
- package/client/pages/harvesting/harvesting-create-record.js +102 -16
- package/client/pages/harvesting/harvesting-list.js +58 -12
- package/client/pages/inventory/inventory-field-bunches.js +6 -4
- package/client/pages/loading/daily-loading-detail.js +47 -93
- package/client/pages/loading/edit-loading-record.js +75 -294
- package/client/pages/loading/loading-create-record.js +52 -329
- package/client/pages/loading/loading-list.js +20 -83
- package/client/pages/master/block.js +1 -0
- package/client/pages/master/company.js +26 -13
- package/client/pages/master/home.js +67 -65
- package/client/pages/master/ramp.js +1 -0
- package/client/pages/master/staff.js +54 -3
- package/client/pages/master/truck.js +416 -0
- package/client/pages/report/home.js +72 -65
- package/client/pages/report/report-daily-ffb-dispatch-and-production.js +393 -0
- package/client/pages/report/report-daily-production.js +38 -6
- package/client/pages/report/report-daily-staff-harvest.js +50 -5
- package/client/pages/report/report-ffb-tonnage-between-individual-block.js +393 -0
- package/client/pages/report/report-monthly-ffb-sale.js +413 -0
- package/client/pages/report/report-monthly-production.js +33 -4
- package/client/pages/report/report-yearly-production.js +24 -8
- package/client/pages/setting/home.js +107 -0
- package/client/pages/setting/plantation-setting.js +109 -0
- package/client/route.js +25 -0
- package/dist-server/constants/index.js +1 -0
- package/dist-server/constants/index.js.map +1 -1
- package/dist-server/constants/organization.js +9 -0
- package/dist-server/constants/organization.js.map +1 -0
- package/dist-server/controllers/render-dispatchment.js +1 -1
- package/dist-server/controllers/render-dispatchment.js.map +1 -1
- package/dist-server/entities/daily-dispatch.js +19 -4
- package/dist-server/entities/daily-dispatch.js.map +1 -1
- package/dist-server/entities/daily-harvest-detail.js +9 -11
- package/dist-server/entities/daily-harvest-detail.js.map +1 -1
- package/dist-server/entities/daily-harvest.js +16 -6
- package/dist-server/entities/daily-harvest.js.map +1 -1
- package/dist-server/entities/daily-loading-detail.js +14 -6
- package/dist-server/entities/daily-loading-detail.js.map +1 -1
- package/dist-server/entities/daily-loading.js +3 -11
- package/dist-server/entities/daily-loading.js.map +1 -1
- package/dist-server/entities/index.js +7 -1
- package/dist-server/entities/index.js.map +1 -1
- package/dist-server/entities/organization-staff.js +5 -1
- package/dist-server/entities/organization-staff.js.map +1 -1
- package/dist-server/entities/plantation-inventory.js +4 -10
- package/dist-server/entities/plantation-inventory.js.map +1 -1
- package/dist-server/entities/plantation-setting.js +76 -0
- package/dist-server/entities/plantation-setting.js.map +1 -0
- package/dist-server/entities/truck.js +77 -0
- package/dist-server/entities/truck.js.map +1 -0
- package/dist-server/graphql/resolvers/daily-dispatch/daily-dispatch-query.js +13 -2
- package/dist-server/graphql/resolvers/daily-dispatch/daily-dispatch-query.js.map +1 -1
- package/dist-server/graphql/resolvers/daily-dispatch/generate-daily-dispatch.js +25 -11
- package/dist-server/graphql/resolvers/daily-dispatch/generate-daily-dispatch.js.map +1 -1
- package/dist-server/graphql/resolvers/daily-dispatch/update-daily-dispatch.js +3 -2
- package/dist-server/graphql/resolvers/daily-dispatch/update-daily-dispatch.js.map +1 -1
- package/dist-server/graphql/resolvers/daily-harvest/daily-harvest-query.js +3 -1
- package/dist-server/graphql/resolvers/daily-harvest/daily-harvest-query.js.map +1 -1
- package/dist-server/graphql/resolvers/daily-harvest/generate-daily-harvest.js +21 -2
- package/dist-server/graphql/resolvers/daily-harvest/generate-daily-harvest.js.map +1 -1
- package/dist-server/graphql/resolvers/daily-harvest/update-daily-harvest.js +8 -2
- package/dist-server/graphql/resolvers/daily-harvest/update-daily-harvest.js.map +1 -1
- package/dist-server/graphql/resolvers/daily-loading/daily-loading-query.js +4 -6
- package/dist-server/graphql/resolvers/daily-loading/daily-loading-query.js.map +1 -1
- package/dist-server/graphql/resolvers/daily-loading/generate-daily-loading.js +20 -54
- package/dist-server/graphql/resolvers/daily-loading/generate-daily-loading.js.map +1 -1
- package/dist-server/graphql/resolvers/daily-loading/update-daily-loading.js +17 -105
- package/dist-server/graphql/resolvers/daily-loading/update-daily-loading.js.map +1 -1
- package/dist-server/graphql/resolvers/dashboard/dashboard-query.js +82 -0
- package/dist-server/graphql/resolvers/dashboard/dashboard-query.js.map +1 -0
- package/dist-server/graphql/resolvers/dashboard/index.js +8 -0
- package/dist-server/graphql/resolvers/dashboard/index.js.map +1 -0
- package/dist-server/graphql/resolvers/index.js +9 -6
- package/dist-server/graphql/resolvers/index.js.map +1 -1
- package/dist-server/graphql/resolvers/organization-staff/organization-staff-query.js +7 -3
- package/dist-server/graphql/resolvers/organization-staff/organization-staff-query.js.map +1 -1
- package/dist-server/graphql/resolvers/plantation-setting/create-plantation-setting.js +12 -0
- package/dist-server/graphql/resolvers/plantation-setting/create-plantation-setting.js.map +1 -0
- package/dist-server/graphql/resolvers/plantation-setting/delete-plantation-setting.js +13 -0
- package/dist-server/graphql/resolvers/plantation-setting/delete-plantation-setting.js.map +1 -0
- package/dist-server/graphql/resolvers/plantation-setting/delete-plantation-settings.js +16 -0
- package/dist-server/graphql/resolvers/plantation-setting/delete-plantation-settings.js.map +1 -0
- package/dist-server/graphql/resolvers/plantation-setting/index.js +15 -0
- package/dist-server/graphql/resolvers/plantation-setting/index.js.map +1 -0
- package/dist-server/graphql/resolvers/plantation-setting/plantation-setting-query.js +33 -0
- package/dist-server/graphql/resolvers/plantation-setting/plantation-setting-query.js.map +1 -0
- package/dist-server/graphql/resolvers/plantation-setting/update-multiple-plantation-setting.js +31 -0
- package/dist-server/graphql/resolvers/plantation-setting/update-multiple-plantation-setting.js.map +1 -0
- package/dist-server/graphql/resolvers/plantation-setting/update-plantation-setting.js +16 -0
- package/dist-server/graphql/resolvers/plantation-setting/update-plantation-setting.js.map +1 -0
- package/dist-server/graphql/resolvers/report/daily-production-reports.js +46 -33
- package/dist-server/graphql/resolvers/report/daily-production-reports.js.map +1 -1
- package/dist-server/graphql/resolvers/report/daily-staff-harvest-reports.js +21 -10
- package/dist-server/graphql/resolvers/report/daily-staff-harvest-reports.js.map +1 -1
- package/dist-server/graphql/resolvers/report/index.js +4 -1
- package/dist-server/graphql/resolvers/report/index.js.map +1 -1
- package/dist-server/graphql/resolvers/report/monthly-block-dispatch-reports.js +89 -0
- package/dist-server/graphql/resolvers/report/monthly-block-dispatch-reports.js.map +1 -0
- package/dist-server/graphql/resolvers/report/monthly-dispatch-summary-reports.js +89 -0
- package/dist-server/graphql/resolvers/report/monthly-dispatch-summary-reports.js.map +1 -0
- package/dist-server/graphql/resolvers/report/monthly-ffb-sale-reports.js +87 -0
- package/dist-server/graphql/resolvers/report/monthly-ffb-sale-reports.js.map +1 -0
- package/dist-server/graphql/resolvers/report/monthly-production-reports.js +46 -31
- package/dist-server/graphql/resolvers/report/monthly-production-reports.js.map +1 -1
- package/dist-server/graphql/resolvers/report/yearly-production-reports.js +38 -28
- package/dist-server/graphql/resolvers/report/yearly-production-reports.js.map +1 -1
- package/dist-server/graphql/resolvers/truck/delete-trucks.js +18 -0
- package/dist-server/graphql/resolvers/truck/delete-trucks.js.map +1 -0
- package/dist-server/graphql/resolvers/truck/index.js +12 -0
- package/dist-server/graphql/resolvers/truck/index.js.map +1 -0
- package/dist-server/graphql/resolvers/truck/truck-query.js +46 -0
- package/dist-server/graphql/resolvers/truck/truck-query.js.map +1 -0
- package/dist-server/graphql/resolvers/truck/update-multiple-truck.js +40 -0
- package/dist-server/graphql/resolvers/truck/update-multiple-truck.js.map +1 -0
- package/dist-server/graphql/types/daily-dispatch/daily-dispatch-patch.js +4 -1
- package/dist-server/graphql/types/daily-dispatch/daily-dispatch-patch.js.map +1 -1
- package/dist-server/graphql/types/daily-dispatch/daily-dispatch.js +4 -1
- package/dist-server/graphql/types/daily-dispatch/daily-dispatch.js.map +1 -1
- package/dist-server/graphql/types/daily-dispatch/index.js +6 -1
- package/dist-server/graphql/types/daily-dispatch/index.js.map +1 -1
- package/dist-server/graphql/types/daily-dispatch/new-daily-dispatch.js +4 -1
- package/dist-server/graphql/types/daily-dispatch/new-daily-dispatch.js.map +1 -1
- package/dist-server/graphql/types/daily-harvest/daily-harvest-patch.js +5 -2
- package/dist-server/graphql/types/daily-harvest/daily-harvest-patch.js.map +1 -1
- package/dist-server/graphql/types/daily-harvest/daily-harvest.js +3 -0
- package/dist-server/graphql/types/daily-harvest/daily-harvest.js.map +1 -1
- package/dist-server/graphql/types/daily-harvest/new-daily-harvest.js +4 -1
- package/dist-server/graphql/types/daily-harvest/new-daily-harvest.js.map +1 -1
- package/dist-server/graphql/types/daily-harvest-detail/daily-harvest-detail-patch.js +1 -0
- package/dist-server/graphql/types/daily-harvest-detail/daily-harvest-detail-patch.js.map +1 -1
- package/dist-server/graphql/types/daily-harvest-detail/daily-harvest-detail.js +1 -0
- package/dist-server/graphql/types/daily-harvest-detail/daily-harvest-detail.js.map +1 -1
- package/dist-server/graphql/types/daily-harvest-detail/new-daily-harvest-detail.js +1 -0
- package/dist-server/graphql/types/daily-harvest-detail/new-daily-harvest-detail.js.map +1 -1
- package/dist-server/graphql/types/daily-loading/daily-loading-patch.js +0 -2
- package/dist-server/graphql/types/daily-loading/daily-loading-patch.js.map +1 -1
- package/dist-server/graphql/types/daily-loading/daily-loading.js +0 -2
- package/dist-server/graphql/types/daily-loading/daily-loading.js.map +1 -1
- package/dist-server/graphql/types/daily-loading/new-daily-loading.js +0 -2
- package/dist-server/graphql/types/daily-loading/new-daily-loading.js.map +1 -1
- package/dist-server/graphql/types/daily-loading-detail/daily-loading-detail-patch.js +6 -3
- package/dist-server/graphql/types/daily-loading-detail/daily-loading-detail-patch.js.map +1 -1
- package/dist-server/graphql/types/daily-loading-detail/daily-loading-detail.js +3 -0
- package/dist-server/graphql/types/daily-loading-detail/daily-loading-detail.js.map +1 -1
- package/dist-server/graphql/types/daily-loading-detail/new-daily-loading-detail.js +6 -3
- package/dist-server/graphql/types/daily-loading-detail/new-daily-loading-detail.js.map +1 -1
- package/dist-server/graphql/types/dashboard/bunches-count.js +15 -0
- package/dist-server/graphql/types/dashboard/bunches-count.js.map +1 -0
- package/dist-server/graphql/types/dashboard/index.js +32 -0
- package/dist-server/graphql/types/dashboard/index.js.map +1 -0
- package/dist-server/graphql/types/dashboard/productions-overview.js +15 -0
- package/dist-server/graphql/types/dashboard/productions-overview.js.map +1 -0
- package/dist-server/graphql/types/dashboard/tonnage-bunches-inventories.js +14 -0
- package/dist-server/graphql/types/dashboard/tonnage-bunches-inventories.js.map +1 -0
- package/dist-server/graphql/types/dashboard/tonnage-production.js +17 -0
- package/dist-server/graphql/types/dashboard/tonnage-production.js.map +1 -0
- package/dist-server/graphql/types/dashboard/yield-production.js +17 -0
- package/dist-server/graphql/types/dashboard/yield-production.js.map +1 -0
- package/dist-server/graphql/types/index.js +9 -6
- package/dist-server/graphql/types/index.js.map +1 -1
- package/dist-server/graphql/types/organization-staff/organization-staff-patch.js +2 -0
- package/dist-server/graphql/types/organization-staff/organization-staff-patch.js.map +1 -1
- package/dist-server/graphql/types/organization-staff/organization-staff.js +3 -0
- package/dist-server/graphql/types/organization-staff/organization-staff.js.map +1 -1
- package/dist-server/graphql/types/plantation-setting/index.js +36 -0
- package/dist-server/graphql/types/plantation-setting/index.js.map +1 -0
- package/dist-server/graphql/types/plantation-setting/new-plantation-setting.js +16 -0
- package/dist-server/graphql/types/plantation-setting/new-plantation-setting.js.map +1 -0
- package/dist-server/graphql/types/plantation-setting/plantation-setting-list.js +14 -0
- package/dist-server/graphql/types/plantation-setting/plantation-setting-list.js.map +1 -0
- package/dist-server/graphql/types/plantation-setting/plantation-setting-patch.js +18 -0
- package/dist-server/graphql/types/plantation-setting/plantation-setting-patch.js.map +1 -0
- package/dist-server/graphql/types/plantation-setting/plantation-setting.js +22 -0
- package/dist-server/graphql/types/plantation-setting/plantation-setting.js.map +1 -0
- package/dist-server/graphql/types/report/index.js +20 -0
- package/dist-server/graphql/types/report/index.js.map +1 -1
- package/dist-server/graphql/types/report/monthly-block-dispatch-report-list.js +14 -0
- package/dist-server/graphql/types/report/monthly-block-dispatch-report-list.js.map +1 -0
- package/dist-server/graphql/types/report/monthly-block-dispatch-report.js +19 -0
- package/dist-server/graphql/types/report/monthly-block-dispatch-report.js.map +1 -0
- package/dist-server/graphql/types/report/monthly-dispatch-summary-report-list.js +14 -0
- package/dist-server/graphql/types/report/monthly-dispatch-summary-report-list.js.map +1 -0
- package/dist-server/graphql/types/report/monthly-dispatch-summary-report.js +25 -0
- package/dist-server/graphql/types/report/monthly-dispatch-summary-report.js.map +1 -0
- package/dist-server/graphql/types/report/monthly-ffb-sale-report-list.js +14 -0
- package/dist-server/graphql/types/report/monthly-ffb-sale-report-list.js.map +1 -0
- package/dist-server/graphql/types/report/monthly-ffb-sale-report.js +24 -0
- package/dist-server/graphql/types/report/monthly-ffb-sale-report.js.map +1 -0
- package/dist-server/graphql/types/truck/index.js +33 -0
- package/dist-server/graphql/types/truck/index.js.map +1 -0
- package/dist-server/graphql/types/truck/new-truck.js +14 -0
- package/dist-server/graphql/types/truck/new-truck.js.map +1 -0
- package/dist-server/graphql/types/truck/truck-list.js +14 -0
- package/dist-server/graphql/types/truck/truck-list.js.map +1 -0
- package/dist-server/graphql/types/truck/truck-patch.js +17 -0
- package/dist-server/graphql/types/truck/truck-patch.js.map +1 -0
- package/dist-server/graphql/types/truck/truck.js +22 -0
- package/dist-server/graphql/types/truck/truck.js.map +1 -0
- package/package.json +2 -2
- package/server/constants/index.ts +1 -0
- package/server/constants/organization.ts +5 -0
- package/server/controllers/render-dispatchment.ts +1 -1
- package/server/entities/daily-dispatch.ts +21 -5
- package/server/entities/daily-harvest-detail.ts +10 -11
- package/server/entities/daily-harvest.ts +16 -7
- package/server/entities/daily-loading-detail.ts +14 -6
- package/server/entities/daily-loading.ts +7 -11
- package/server/entities/index.ts +6 -0
- package/server/entities/organization-staff.ts +6 -1
- package/server/entities/plantation-inventory.ts +6 -10
- package/server/entities/plantation-setting.ts +60 -0
- package/server/entities/truck.ts +58 -0
- package/server/graphql/resolvers/daily-dispatch/daily-dispatch-query.ts +15 -2
- package/server/graphql/resolvers/daily-dispatch/generate-daily-dispatch.ts +40 -14
- package/server/graphql/resolvers/daily-dispatch/update-daily-dispatch.ts +6 -2
- package/server/graphql/resolvers/daily-harvest/daily-harvest-query.ts +7 -2
- package/server/graphql/resolvers/daily-harvest/generate-daily-harvest.ts +50 -4
- package/server/graphql/resolvers/daily-harvest/update-daily-harvest.ts +12 -2
- package/server/graphql/resolvers/daily-loading/daily-loading-query.ts +6 -6
- package/server/graphql/resolvers/daily-loading/generate-daily-loading.ts +27 -109
- package/server/graphql/resolvers/daily-loading/update-daily-loading.ts +27 -213
- package/server/graphql/resolvers/dashboard/dashboard-query.ts +96 -0
- package/server/graphql/resolvers/dashboard/index.ts +5 -0
- package/server/graphql/resolvers/index.ts +10 -6
- package/server/graphql/resolvers/organization-staff/organization-staff-query.ts +13 -4
- package/server/graphql/resolvers/plantation-setting/create-plantation-setting.ts +16 -0
- package/server/graphql/resolvers/plantation-setting/delete-plantation-setting.ts +13 -0
- package/server/graphql/resolvers/plantation-setting/delete-plantation-settings.ts +16 -0
- package/server/graphql/resolvers/plantation-setting/index.ts +19 -0
- package/server/graphql/resolvers/plantation-setting/plantation-setting-query.ts +38 -0
- package/server/graphql/resolvers/plantation-setting/update-multiple-plantation-setting.ts +46 -0
- package/server/graphql/resolvers/plantation-setting/update-plantation-setting.ts +19 -0
- package/server/graphql/resolvers/report/daily-production-reports.ts +55 -44
- package/server/graphql/resolvers/report/daily-staff-harvest-reports.ts +28 -20
- package/server/graphql/resolvers/report/index.ts +7 -1
- package/server/graphql/resolvers/report/monthly-block-dispatch-reports.ts +112 -0
- package/server/graphql/resolvers/report/monthly-dispatch-summary-reports.ts +110 -0
- package/server/graphql/resolvers/report/monthly-ffb-sale-reports.ts +107 -0
- package/server/graphql/resolvers/report/monthly-production-reports.ts +54 -40
- package/server/graphql/resolvers/report/yearly-production-reports.ts +43 -38
- package/server/graphql/resolvers/truck/delete-trucks.ts +21 -0
- package/server/graphql/resolvers/truck/index.ts +12 -0
- package/server/graphql/resolvers/truck/truck-query.ts +52 -0
- package/server/graphql/resolvers/truck/update-multiple-truck.ts +55 -0
- package/server/graphql/types/daily-dispatch/daily-dispatch-patch.ts +4 -1
- package/server/graphql/types/daily-dispatch/daily-dispatch.ts +4 -1
- package/server/graphql/types/daily-dispatch/index.ts +6 -1
- package/server/graphql/types/daily-dispatch/new-daily-dispatch.ts +4 -1
- package/server/graphql/types/daily-harvest/daily-harvest-patch.ts +5 -2
- package/server/graphql/types/daily-harvest/daily-harvest.ts +3 -0
- package/server/graphql/types/daily-harvest/new-daily-harvest.ts +4 -1
- package/server/graphql/types/daily-harvest-detail/daily-harvest-detail-patch.ts +1 -0
- package/server/graphql/types/daily-harvest-detail/daily-harvest-detail.ts +1 -0
- package/server/graphql/types/daily-harvest-detail/new-daily-harvest-detail.ts +1 -0
- package/server/graphql/types/daily-loading/daily-loading-patch.ts +0 -2
- package/server/graphql/types/daily-loading/daily-loading.ts +0 -2
- package/server/graphql/types/daily-loading/new-daily-loading.ts +0 -2
- package/server/graphql/types/daily-loading-detail/daily-loading-detail-patch.ts +6 -3
- package/server/graphql/types/daily-loading-detail/daily-loading-detail.ts +3 -0
- package/server/graphql/types/daily-loading-detail/new-daily-loading-detail.ts +6 -3
- package/server/graphql/types/dashboard/bunches-count.ts +9 -0
- package/server/graphql/types/dashboard/index.ts +17 -0
- package/server/graphql/types/dashboard/productions-overview.ts +9 -0
- package/server/graphql/types/dashboard/tonnage-bunches-inventories.ts +8 -0
- package/server/graphql/types/dashboard/tonnage-production.ts +11 -0
- package/server/graphql/types/dashboard/yield-production.ts +11 -0
- package/server/graphql/types/index.ts +10 -6
- package/server/graphql/types/organization-staff/organization-staff-patch.ts +2 -0
- package/server/graphql/types/organization-staff/organization-staff.ts +3 -0
- package/server/graphql/types/plantation-setting/index.ts +21 -0
- package/server/graphql/types/plantation-setting/new-plantation-setting.ts +10 -0
- package/server/graphql/types/plantation-setting/plantation-setting-list.ts +8 -0
- package/server/graphql/types/plantation-setting/plantation-setting-patch.ts +12 -0
- package/server/graphql/types/plantation-setting/plantation-setting.ts +16 -0
- package/server/graphql/types/report/index.ts +20 -0
- package/server/graphql/types/report/monthly-block-dispatch-report-list.ts +7 -0
- package/server/graphql/types/report/monthly-block-dispatch-report.ts +13 -0
- package/server/graphql/types/report/monthly-dispatch-summary-report-list.ts +7 -0
- package/server/graphql/types/report/monthly-dispatch-summary-report.ts +19 -0
- package/server/graphql/types/report/monthly-ffb-sale-report-list.ts +7 -0
- package/server/graphql/types/report/monthly-ffb-sale-report.ts +18 -0
- package/server/graphql/types/truck/index.ts +18 -0
- package/server/graphql/types/truck/new-truck.ts +8 -0
- package/server/graphql/types/truck/truck-list.ts +8 -0
- package/server/graphql/types/truck/truck-patch.ts +11 -0
- package/server/graphql/types/truck/truck.ts +16 -0
- package/things-factory.config.js +27 -1
- package/translations/en.json +78 -16
- package/translations/ko.json +77 -48
- package/translations/ms.json +74 -45
- package/translations/zh.json +77 -48
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { MultiColumnFormStyles } from '@things-factory/form-ui'
|
|
2
1
|
import '@things-factory/grist-ui'
|
|
2
|
+
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
import { css, html } from 'lit-element'
|
|
5
|
+
|
|
6
|
+
import { MultiColumnFormStyles } from '@things-factory/form-ui'
|
|
3
7
|
import { i18next, localize } from '@things-factory/i18n-base'
|
|
4
|
-
import { openPopup } from '@things-factory/layout-base'
|
|
5
8
|
import { client, CustomAlert, navigate, PageView } from '@things-factory/shell'
|
|
6
9
|
import { CommonButtonStyles } from '@things-factory/styles'
|
|
7
10
|
import { isMobileDevice } from '@things-factory/utils'
|
|
8
|
-
import gql from 'graphql-tag'
|
|
9
|
-
import { css, html } from 'lit-element'
|
|
10
|
-
import { INVENTORY_TYPE } from '../constants'
|
|
11
|
-
import '../../component/block-selector-popup'
|
|
12
11
|
|
|
13
12
|
class LoadingCreateRecord extends localize(i18next)(PageView) {
|
|
14
13
|
static get properties() {
|
|
@@ -21,7 +20,8 @@ class LoadingCreateRecord extends localize(i18next)(PageView) {
|
|
|
21
20
|
blocks: Array,
|
|
22
21
|
totalBunchesAvailable: Number,
|
|
23
22
|
totalTonnageAvailable: Number,
|
|
24
|
-
totalBunchLoaded: Number
|
|
23
|
+
totalBunchLoaded: Number,
|
|
24
|
+
trackedInventory: Boolean
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -94,20 +94,9 @@ class LoadingCreateRecord extends localize(i18next)(PageView) {
|
|
|
94
94
|
return html`
|
|
95
95
|
<form name="dailyLoading" class="multi-column-form" autocomplete="off">
|
|
96
96
|
<fieldset>
|
|
97
|
-
<legend>${i18next.t('title.
|
|
98
|
-
<label>${i18next.t('label.
|
|
97
|
+
<legend>${i18next.t('title.field_loading_contractor_daily_loading_record')}</legend>
|
|
98
|
+
<label>${i18next.t('label.date')}</label>
|
|
99
99
|
<input type="date" name="loadingDate" required />
|
|
100
|
-
|
|
101
|
-
<label>${i18next.t('label.block')}</label>
|
|
102
|
-
<input name="block" readonly @click="${this._openBlockSelector.bind(this)}" />
|
|
103
|
-
|
|
104
|
-
<label>${i18next.t('label.current_bunch_at_field')}</label>
|
|
105
|
-
<input
|
|
106
|
-
type="number"
|
|
107
|
-
name="totalBunches"
|
|
108
|
-
value="${this.totalBunchesAvailable ? this.totalBunchesAvailable : 0}"
|
|
109
|
-
readonly
|
|
110
|
-
/>
|
|
111
100
|
</fieldset>
|
|
112
101
|
</form>
|
|
113
102
|
|
|
@@ -122,45 +111,14 @@ class LoadingCreateRecord extends localize(i18next)(PageView) {
|
|
|
122
111
|
.data="${this.loadingData}"
|
|
123
112
|
@record-change="${this._onRecordChangeHandler.bind(this)}"
|
|
124
113
|
></data-grist>
|
|
125
|
-
|
|
126
|
-
<h2><mwc-icon>list_alt</mwc-icon>${i18next.t('title.ramp_loading_data')}</h2>
|
|
127
|
-
|
|
128
|
-
<data-grist
|
|
129
|
-
id="ramp-grist"
|
|
130
|
-
.mode=${isMobileDevice() ? 'LIST' : 'GRID'}
|
|
131
|
-
.config=${this.rampGristConfig}
|
|
132
|
-
.data="${this.rampData}"
|
|
133
|
-
@record-change="${this._onRampRecordChangeHandler.bind(this)}"
|
|
134
|
-
></data-grist>
|
|
135
114
|
</div>
|
|
136
115
|
</div>
|
|
137
|
-
|
|
138
|
-
<form name="loadingSummary" class="multi-column-form" autocomplete="off">
|
|
139
|
-
<fieldset>
|
|
140
|
-
<label>${i18next.t('label.total_bunch_loaded')}</label>
|
|
141
|
-
<input
|
|
142
|
-
type="number"
|
|
143
|
-
name="totalBunchLoaded"
|
|
144
|
-
value="${this.totalBunchLoaded ? this.totalBunchLoaded : 0}"
|
|
145
|
-
readonly
|
|
146
|
-
/>
|
|
147
|
-
|
|
148
|
-
<label>${i18next.t('label.total_tonnage_loaded')}</label>
|
|
149
|
-
<input
|
|
150
|
-
type="number"
|
|
151
|
-
name="totalWeight"
|
|
152
|
-
value="${this.totalTonnageAvailable ? this.totalTonnageAvailable : 0}"
|
|
153
|
-
readonly
|
|
154
|
-
/>
|
|
155
|
-
</fieldset>
|
|
156
|
-
</form>
|
|
157
116
|
`
|
|
158
117
|
}
|
|
159
118
|
|
|
160
119
|
constructor() {
|
|
161
120
|
super()
|
|
162
121
|
this.loadingData = { records: [] }
|
|
163
|
-
this.rampData = { records: [] }
|
|
164
122
|
}
|
|
165
123
|
|
|
166
124
|
get loadingForm() {
|
|
@@ -171,27 +129,11 @@ class LoadingCreateRecord extends localize(i18next)(PageView) {
|
|
|
171
129
|
return this.shadowRoot.querySelector('data-grist#loading-grist')
|
|
172
130
|
}
|
|
173
131
|
|
|
174
|
-
|
|
175
|
-
return this.shadowRoot.querySelector('data-grist#ramp-grist')
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
get blockInput() {
|
|
179
|
-
return this.shadowRoot.querySelector('input[name=block]')
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
get bunchesInput() {
|
|
183
|
-
return this.shadowRoot.querySelector('input[name=totalBunches]')
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
get tonnageInput() {
|
|
187
|
-
return this.shadowRoot.querySelector('input[name=totalWeight]')
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
async pageInitialized() {
|
|
132
|
+
pageInitialized() {
|
|
191
133
|
this.loadingGristConfig = {
|
|
192
134
|
pagination: { infinite: true },
|
|
193
135
|
list: {
|
|
194
|
-
fields: ['
|
|
136
|
+
fields: ['truck', 'totalBunchWeight', 'ramp', 'remark']
|
|
195
137
|
},
|
|
196
138
|
columns: [
|
|
197
139
|
{ type: 'gutter', gutterName: 'sequence' },
|
|
@@ -204,86 +146,57 @@ class LoadingCreateRecord extends localize(i18next)(PageView) {
|
|
|
204
146
|
const newData = data.records.filter((_, idx) => idx !== rowIndex)
|
|
205
147
|
this.loadingData = { ...this.loadingData, records: newData }
|
|
206
148
|
this.loadingGrist.dirtyData.records = newData
|
|
207
|
-
const sumOfTotalBunchLoaded = this.loadingGrist.dirtyData.records.reduce((total, currentValue) => {
|
|
208
|
-
total += currentValue.totalBunchLoaded
|
|
209
|
-
return total
|
|
210
|
-
}, 0)
|
|
211
|
-
this.totalBunchLoaded = sumOfTotalBunchLoaded
|
|
212
|
-
|
|
213
|
-
const newTotalAvailableBunches = this.totalBunchesAvailable - sumOfTotalBunchLoaded
|
|
214
|
-
this.bunchesInput.value = newTotalAvailableBunches
|
|
215
149
|
}
|
|
216
150
|
}
|
|
217
151
|
},
|
|
218
152
|
{
|
|
219
153
|
type: 'object',
|
|
220
|
-
name: '
|
|
221
|
-
header: i18next.t('field.
|
|
154
|
+
name: 'truck',
|
|
155
|
+
header: i18next.t('field.truck_no'),
|
|
222
156
|
record: {
|
|
223
157
|
editable: true,
|
|
224
|
-
align: 'center',
|
|
225
158
|
options: {
|
|
226
|
-
queryName: '
|
|
159
|
+
queryName: 'trucks',
|
|
227
160
|
select: [
|
|
228
161
|
{ name: 'id', hidden: true },
|
|
229
|
-
{ name: 'staffId', header: i18next.t('field.staff_id'), width: 200 },
|
|
230
162
|
{ name: 'name', header: i18next.t('field.name'), width: 200 }
|
|
231
163
|
],
|
|
232
|
-
list: { fields: ['
|
|
164
|
+
list: { fields: ['id', 'name'] }
|
|
233
165
|
}
|
|
234
166
|
},
|
|
235
|
-
width:
|
|
167
|
+
width: 130
|
|
236
168
|
},
|
|
237
169
|
{
|
|
238
|
-
type: '
|
|
170
|
+
type: 'object',
|
|
171
|
+
name: 'block',
|
|
172
|
+
header: i18next.t('field.block'),
|
|
173
|
+
record: {
|
|
174
|
+
editable: true,
|
|
175
|
+
options: {
|
|
176
|
+
queryName: 'blocks',
|
|
177
|
+
select: [
|
|
178
|
+
{ name: 'id', hidden: true },
|
|
179
|
+
{ name: 'name', header: i18next.t('field.name'), width: 200 }
|
|
180
|
+
],
|
|
181
|
+
list: { fields: ['id', 'name'] }
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
width: 130
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
type: 'float',
|
|
239
188
|
name: 'totalBunchLoaded',
|
|
240
|
-
header: i18next.t('field.
|
|
189
|
+
header: i18next.t('field.total_bunch'),
|
|
241
190
|
record: { editable: true },
|
|
242
191
|
width: 150
|
|
243
192
|
},
|
|
244
193
|
{
|
|
245
194
|
type: 'float',
|
|
246
195
|
name: 'totalBunchWeight',
|
|
247
|
-
header: i18next.t('field.
|
|
196
|
+
header: i18next.t('field.total_tonnage'),
|
|
248
197
|
record: { editable: true },
|
|
249
198
|
width: 150
|
|
250
199
|
},
|
|
251
|
-
{
|
|
252
|
-
type: 'string',
|
|
253
|
-
name: 'remark',
|
|
254
|
-
header: i18next.t('field.remarks'),
|
|
255
|
-
record: { editable: true },
|
|
256
|
-
width: 300
|
|
257
|
-
}
|
|
258
|
-
]
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
this.rampGristConfig = {
|
|
262
|
-
pagination: { infinite: true },
|
|
263
|
-
list: {
|
|
264
|
-
fields: ['ramp', 'totalWeight', 'remark']
|
|
265
|
-
},
|
|
266
|
-
columns: [
|
|
267
|
-
{ type: 'gutter', gutterName: 'sequence' },
|
|
268
|
-
{
|
|
269
|
-
type: 'gutter',
|
|
270
|
-
gutterName: 'button',
|
|
271
|
-
icon: 'close',
|
|
272
|
-
handlers: {
|
|
273
|
-
click: (columns, data, column, record, rowIndex) => {
|
|
274
|
-
const newData = data.records.filter((_, idx) => idx !== rowIndex)
|
|
275
|
-
this.rampData = { ...this.rampData, records: newData }
|
|
276
|
-
this.rampGrist.dirtyData.records = newData
|
|
277
|
-
const sumOfTotalBunchWeight = this.rampGrist.dirtyData.records.reduce((total, currentValue) => {
|
|
278
|
-
total += currentValue.totalBunchWeight
|
|
279
|
-
return total
|
|
280
|
-
}, 0)
|
|
281
|
-
|
|
282
|
-
const newTotalAvailableTonnage = this.totalTonnageAvailable - sumOfTotalBunchWeight
|
|
283
|
-
this.tonnageInput.value = newTotalAvailableTonnage
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
},
|
|
287
200
|
{
|
|
288
201
|
type: 'object',
|
|
289
202
|
name: 'ramp',
|
|
@@ -296,17 +209,17 @@ class LoadingCreateRecord extends localize(i18next)(PageView) {
|
|
|
296
209
|
{ name: 'id', hidden: true },
|
|
297
210
|
{ name: 'name', header: i18next.t('field.name'), width: 200 }
|
|
298
211
|
],
|
|
299
|
-
list: { fields: ['name'] }
|
|
212
|
+
list: { fields: ['id', 'name'] }
|
|
300
213
|
}
|
|
301
214
|
},
|
|
302
|
-
width:
|
|
215
|
+
width: 130
|
|
303
216
|
},
|
|
304
217
|
{
|
|
305
|
-
type: '
|
|
306
|
-
name: '
|
|
307
|
-
header: i18next.t('field.
|
|
218
|
+
type: 'string',
|
|
219
|
+
name: 'remark',
|
|
220
|
+
header: i18next.t('field.remarks'),
|
|
308
221
|
record: { editable: true },
|
|
309
|
-
width:
|
|
222
|
+
width: 300
|
|
310
223
|
}
|
|
311
224
|
]
|
|
312
225
|
}
|
|
@@ -314,79 +227,20 @@ class LoadingCreateRecord extends localize(i18next)(PageView) {
|
|
|
314
227
|
|
|
315
228
|
_onRecordChangeHandler(event) {
|
|
316
229
|
try {
|
|
317
|
-
this._checkStaffDuplication()
|
|
318
|
-
|
|
319
|
-
if (!this.blockInput?.value) throw new Error(i18next.t('text.kindly_select_a_block_first'))
|
|
320
|
-
|
|
321
|
-
let changeRecord = event.detail.after
|
|
322
230
|
const changedColumn = event.detail.column.name
|
|
323
|
-
let
|
|
324
|
-
|
|
325
|
-
if (changedColumn === 'totalBunchLoaded') {
|
|
326
|
-
const sumOfTotalBunchLoaded = this.loadingGrist.dirtyData.records.reduce((total, currentValue) => {
|
|
327
|
-
total += currentValue.totalBunchLoaded
|
|
328
|
-
return total
|
|
329
|
-
}, 0)
|
|
330
|
-
|
|
331
|
-
this.totalBunchLoaded = sumOfTotalBunchLoaded
|
|
332
|
-
|
|
333
|
-
const newTotalAvailableBunches = this.totalBunchesAvailable - sumOfTotalBunchLoaded
|
|
334
|
-
if (newTotalAvailableBunches < 0) {
|
|
335
|
-
throw new Error(i18next.t('text.insufficient_bunches_to_be_loaded'))
|
|
336
|
-
}
|
|
337
|
-
this.bunchesInput.value = newTotalAvailableBunches
|
|
338
|
-
|
|
339
|
-
if (!totalBunchLoaded || totalBunchLoaded < 0)
|
|
340
|
-
throw new Error(i18next.t('text.total_bunches_loaded_should_be_positive'))
|
|
341
|
-
}
|
|
231
|
+
let changeRecord = event.detail.after
|
|
232
|
+
let { totalBunchWeight, totalBunchLoaded } = changeRecord
|
|
342
233
|
|
|
343
234
|
if (changedColumn === 'totalBunchWeight') {
|
|
344
235
|
if (!totalBunchWeight || totalBunchWeight < 0) {
|
|
345
236
|
throw new Error(i18next.t('text.total_bunch_weight_should_be_positive'))
|
|
346
237
|
}
|
|
347
|
-
const sumOfTotalTonnage = this.loadingGrist.dirtyData.records.reduce((total, currentValue) => {
|
|
348
|
-
total += currentValue.totalBunchWeight
|
|
349
|
-
return total
|
|
350
|
-
}, 0)
|
|
351
|
-
|
|
352
|
-
const newTotalAvailableTonnage = this.totalTonnageAvailable + sumOfTotalTonnage
|
|
353
|
-
this.tonnageInput.value = newTotalAvailableTonnage
|
|
354
|
-
}
|
|
355
|
-
} catch (e) {
|
|
356
|
-
const beforeValue = event.detail.before && event.detail.before[event.detail.column.name]
|
|
357
|
-
if (beforeValue) {
|
|
358
|
-
event.detail.after[event.detail.column.name] = beforeValue
|
|
359
|
-
} else {
|
|
360
|
-
delete event.detail.after[event.detail.column.name]
|
|
361
238
|
}
|
|
362
239
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
_onRampRecordChangeHandler(event) {
|
|
368
|
-
try {
|
|
369
|
-
this._checkRampDuplication()
|
|
370
|
-
let changeRecord = event.detail.after
|
|
371
|
-
const changedColumn = event.detail.column.name
|
|
372
|
-
let { totalBunchWeight } = changeRecord
|
|
373
|
-
|
|
374
|
-
if (changedColumn === 'totalBunchWeight') {
|
|
375
|
-
const sumOfLoadedWeight = this.loadingGrist.dirtyData.records.reduce((total, currentValue) => {
|
|
376
|
-
total += currentValue.totalBunchWeight
|
|
377
|
-
return total
|
|
378
|
-
}, 0)
|
|
379
|
-
|
|
380
|
-
const sumOfRampWeight = this.rampGrist.dirtyData.records.reduce((total, currentValue) => {
|
|
381
|
-
total += currentValue.totalBunchWeight
|
|
382
|
-
return total
|
|
383
|
-
}, 0)
|
|
384
|
-
|
|
385
|
-
if (sumOfRampWeight > sumOfLoadedWeight)
|
|
386
|
-
throw new Error(i18next.t('text.insufficient_weight_to_be_allocated_into_ramp'))
|
|
387
|
-
|
|
388
|
-
if (!totalBunchWeight || totalBunchWeight < 0)
|
|
389
|
-
throw new Error(i18next.t('text.total_bunches_loaded_should_be_positive'))
|
|
240
|
+
if (changedColumn === 'totalBunchLoaded') {
|
|
241
|
+
if (totalBunchLoaded < 0) {
|
|
242
|
+
throw new Error(i18next.t('text.total_bunch_loaded_should_be_positive'))
|
|
243
|
+
}
|
|
390
244
|
}
|
|
391
245
|
} catch (e) {
|
|
392
246
|
const beforeValue = event.detail.before && event.detail.before[event.detail.column.name]
|
|
@@ -400,98 +254,6 @@ class LoadingCreateRecord extends localize(i18next)(PageView) {
|
|
|
400
254
|
}
|
|
401
255
|
}
|
|
402
256
|
|
|
403
|
-
_checkStaffDuplication() {
|
|
404
|
-
// organization staff
|
|
405
|
-
let isDuplicated = false
|
|
406
|
-
const completedRows = this.loadingGrist.dirtyData.records
|
|
407
|
-
.filter(record => record.organizationStaff.id)
|
|
408
|
-
.map(record => `${record.organizationStaff.id}`)
|
|
409
|
-
|
|
410
|
-
completedRows.forEach((row, idx, rows) => {
|
|
411
|
-
if (rows.lastIndexOf(row) !== idx) {
|
|
412
|
-
isDuplicated = true
|
|
413
|
-
}
|
|
414
|
-
})
|
|
415
|
-
|
|
416
|
-
if (isDuplicated) {
|
|
417
|
-
throw new Error(i18next.t('text.there_is_duplicated_staff_in_record'))
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
_checkRampDuplication() {
|
|
422
|
-
// ramp
|
|
423
|
-
let isDuplicated = false
|
|
424
|
-
const completedRows = this.rampGrist.dirtyData.records
|
|
425
|
-
.filter(record => record.ramp.id)
|
|
426
|
-
.map(record => `${record.ramp.id}`)
|
|
427
|
-
|
|
428
|
-
completedRows.forEach((row, idx, rows) => {
|
|
429
|
-
if (rows.lastIndexOf(row) !== idx) {
|
|
430
|
-
isDuplicated = true
|
|
431
|
-
}
|
|
432
|
-
})
|
|
433
|
-
|
|
434
|
-
if (isDuplicated) {
|
|
435
|
-
throw new Error(i18next.t('text.selected_ramp_has_been_existed_in_record'))
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
_openBlockSelector() {
|
|
440
|
-
openPopup(
|
|
441
|
-
html`
|
|
442
|
-
<block-selector-popup
|
|
443
|
-
@selected="${e => {
|
|
444
|
-
this.blockInput.value = e.detail.name
|
|
445
|
-
const blockId = e.detail.id
|
|
446
|
-
this.fetchBunchesInventory(blockId)
|
|
447
|
-
}}"
|
|
448
|
-
></block-selector-popup>
|
|
449
|
-
`,
|
|
450
|
-
{
|
|
451
|
-
backdrop: true,
|
|
452
|
-
size: 'large',
|
|
453
|
-
title: i18next.t('title.select_block')
|
|
454
|
-
}
|
|
455
|
-
)
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
async fetchBunchesInventory(blockId) {
|
|
459
|
-
try {
|
|
460
|
-
if (!blockId) throw new Error('Block information not found')
|
|
461
|
-
const response = await client.query({
|
|
462
|
-
query: gql`
|
|
463
|
-
query plantationInventory($blockId: String!, $type: String!) {
|
|
464
|
-
plantationInventory(blockId: $blockId, type: $type) {
|
|
465
|
-
id
|
|
466
|
-
name
|
|
467
|
-
totalBunches
|
|
468
|
-
updatedAt
|
|
469
|
-
updater {
|
|
470
|
-
id
|
|
471
|
-
name
|
|
472
|
-
description
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
`,
|
|
477
|
-
variables: {
|
|
478
|
-
blockId,
|
|
479
|
-
type: INVENTORY_TYPE.FIELD_BUNCHES.value
|
|
480
|
-
}
|
|
481
|
-
})
|
|
482
|
-
|
|
483
|
-
if (!response.errors) {
|
|
484
|
-
const totalBunches = response.data.plantationInventory?.totalBunches
|
|
485
|
-
? response.data.plantationInventory.totalBunches
|
|
486
|
-
: 0
|
|
487
|
-
this.totalBunchesAvailable = totalBunches
|
|
488
|
-
this.totalTonnageAvailable = 0
|
|
489
|
-
}
|
|
490
|
-
} catch (e) {
|
|
491
|
-
this._showToast(e)
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
|
|
495
257
|
async _generateLoadingRecord() {
|
|
496
258
|
try {
|
|
497
259
|
this._validateForm()
|
|
@@ -507,10 +269,7 @@ class LoadingCreateRecord extends localize(i18next)(PageView) {
|
|
|
507
269
|
if (!result.value) return
|
|
508
270
|
|
|
509
271
|
let dailyLoading = this._getFormInfo()
|
|
510
|
-
delete dailyLoading.totalBunches
|
|
511
|
-
delete dailyLoading.totalWeight
|
|
512
272
|
dailyLoading.dailyLoadingDetails = this._getLoadingDetails()
|
|
513
|
-
dailyLoading.dailyLoadingRamps = this._getLoadingRampDetails()
|
|
514
273
|
|
|
515
274
|
const response = await client.mutate({
|
|
516
275
|
mutation: gql`
|
|
@@ -543,31 +302,8 @@ class LoadingCreateRecord extends localize(i18next)(PageView) {
|
|
|
543
302
|
if (!this.loadingGrist.dirtyData.records || !this.loadingGrist.dirtyData.records.length)
|
|
544
303
|
throw new Error(i18next.t('text.no_records_in_loading_list'))
|
|
545
304
|
|
|
546
|
-
if (
|
|
547
|
-
this.loadingGrist.dirtyData.records.filter(
|
|
548
|
-
record => !record.organizationStaff || !record.totalBunchLoaded || !record.totalBunchWeight
|
|
549
|
-
).length
|
|
550
|
-
)
|
|
305
|
+
if (this.loadingGrist.dirtyData.records.filter(record => !record.totalBunchWeight).length)
|
|
551
306
|
throw new Error(i18next.t('text.empty_value_in_loading_data'))
|
|
552
|
-
|
|
553
|
-
if (!this.rampGrist.dirtyData.records || !this.rampGrist.dirtyData.records.length)
|
|
554
|
-
throw new Error(i18next.t('text.no_records_in_ramp_loading_list'))
|
|
555
|
-
|
|
556
|
-
if (this.rampGrist.dirtyData.records.filter(record => !record.ramp || !record.totalBunchWeight).length)
|
|
557
|
-
throw new Error(i18next.t('text.empty_value_in_ramp_loading_data'))
|
|
558
|
-
|
|
559
|
-
const sumOfLoadedWeight = this.loadingGrist.dirtyData.records.reduce((total, currentValue) => {
|
|
560
|
-
total += currentValue.totalBunchWeight
|
|
561
|
-
return total
|
|
562
|
-
}, 0)
|
|
563
|
-
|
|
564
|
-
const sumOfRampWeight = this.rampGrist.dirtyData.records.reduce((total, currentValue) => {
|
|
565
|
-
total += currentValue.totalBunchWeight
|
|
566
|
-
return total
|
|
567
|
-
}, 0)
|
|
568
|
-
|
|
569
|
-
if (sumOfLoadedWeight != sumOfRampWeight)
|
|
570
|
-
throw new Error(i18next.t('text.bunches_weight_is_not_fully_allocated_into_ramp'))
|
|
571
307
|
}
|
|
572
308
|
|
|
573
309
|
_getFormInfo() {
|
|
@@ -577,7 +313,9 @@ class LoadingCreateRecord extends localize(i18next)(PageView) {
|
|
|
577
313
|
_getLoadingDetails() {
|
|
578
314
|
return this.loadingGrist.dirtyData.records.map(record => {
|
|
579
315
|
let dailyLoadingDetails = {
|
|
580
|
-
|
|
316
|
+
truck: { id: record.truck.id, name: record.truck.name },
|
|
317
|
+
block: { id: record.block.id, name: record.block.name },
|
|
318
|
+
ramp: { id: record.ramp.id, name: record.ramp.name },
|
|
581
319
|
totalBunchLoaded: Number(record.totalBunchLoaded),
|
|
582
320
|
totalBunchWeight: Number(record.totalBunchWeight),
|
|
583
321
|
remark: record?.remark ? record.remark : null
|
|
@@ -587,24 +325,9 @@ class LoadingCreateRecord extends localize(i18next)(PageView) {
|
|
|
587
325
|
})
|
|
588
326
|
}
|
|
589
327
|
|
|
590
|
-
_getLoadingRampDetails() {
|
|
591
|
-
return this.rampGrist.dirtyData.records.map(record => {
|
|
592
|
-
let dailyLoadingRamps = {
|
|
593
|
-
ramp: { id: record.ramp.id, name: record.ramp.name },
|
|
594
|
-
totalBunchWeight: Number(record.totalBunchWeight)
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
return dailyLoadingRamps
|
|
598
|
-
})
|
|
599
|
-
}
|
|
600
|
-
|
|
601
328
|
_clearView() {
|
|
602
329
|
this.loadingForm.reset()
|
|
603
330
|
this.loadingData = { ...this.loadingData, records: [] }
|
|
604
|
-
this.rampData = { ...this.rampData, records: [] }
|
|
605
|
-
this.totalBunchesAvailable = 0
|
|
606
|
-
this.totalTonnageAvailable = 0
|
|
607
|
-
this.totalBunchLoaded = 0
|
|
608
331
|
}
|
|
609
332
|
|
|
610
333
|
_serializeForm(form) {
|