@sdcorejs/angular 19.3.2 → 19.3.4
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/assets/THEME.md +58 -6
- package/assets/scss/core/form.scss +291 -3
- package/assets/scss/themes/_component-tokens.scss +35 -6
- package/components/badge/index.d.ts +1 -0
- package/components/badge/src/badge.model.d.ts +19 -0
- package/components/query-bar/src/components/actions-bar/actions-bar.component.d.ts +6 -1
- package/components/query-bar/src/components/field-picker/field-picker.component.d.ts +21 -0
- package/components/query-bar/src/components/inline-chip/inline-chip.component.d.ts +7 -1
- package/components/query-bar/src/components/inline-value-chip/inline-value-chip.component.d.ts +7 -1
- package/components/query-bar/src/components/popover-chip/popover-chip.component.d.ts +16 -2
- package/components/query-bar/src/query-bar.component.d.ts +66 -8
- package/components/query-bar/src/query-bar.model.d.ts +44 -1
- package/components/section/index.d.ts +1 -0
- package/components/section/src/section-registry.d.ts +11 -0
- package/components/splitter/index.d.ts +1 -1
- package/components/tab-router/src/actions/tab-router.action.d.ts +1 -1
- package/components/tab-router/src/components/tab-router-item/tab-router-item.component.d.ts +4 -2
- package/components/tab-router/src/components/tab-router-nav/tab-router-nav.component.d.ts +31 -3
- package/components/tab-router/src/components/tab-router-outlet/tab-router-outlet.component.d.ts +6 -1
- package/components/tab-router/src/models/tab-router.model.d.ts +5 -0
- package/components/tab-router/src/pipes/tab-info.pipe.d.ts +7 -0
- package/components/tab-router/src/services/tab-router.service.d.ts +5 -0
- package/components/table/index.d.ts +2 -0
- package/components/table/src/components/config/config-width.util.d.ts +9 -0
- package/components/table/src/components/config/config.component.d.ts +58 -11
- package/components/table/src/components/filter/column-filter/column-filter.component.d.ts +5 -0
- package/components/table/src/components/filter/external-filter/external-filter.component.d.ts +5 -1
- package/components/table/src/components/mobile-cards/mobile-cards.component.d.ts +4 -0
- package/components/table/src/configurations/index.d.ts +1 -0
- package/components/table/src/configurations/table-layout.d.ts +16 -0
- package/components/table/src/configurations/table.configuration.d.ts +7 -1
- package/components/table/src/models/index.d.ts +1 -0
- package/components/table/src/models/table-column.model.d.ts +3 -10
- package/components/table/src/models/table-item.model.d.ts +4 -1
- package/components/table/src/models/table-option-loading.model.d.ts +42 -0
- package/components/table/src/models/table-option.model.d.ts +6 -0
- package/components/table/src/services/column-leaf.util.d.ts +6 -0
- package/components/table/src/services/config-custom.util.d.ts +14 -0
- package/components/table/src/services/table-filter/table-filter.model.d.ts +30 -0
- package/components/table/src/services/table-filter/table-query-bar.util.d.ts +110 -0
- package/components/table/src/services/table-loading/table-loading.util.d.ts +91 -0
- package/components/table/src/services/tree/tree.util.d.ts +2 -0
- package/components/table/src/table.component.d.ts +60 -1
- package/components/upload-file/src/components/file-type-icon/file-type-icon.component.d.ts +15 -0
- package/components/upload-file/src/components/preview/preview.component.d.ts +88 -10
- package/components/upload-file/src/configurations/upload-file.configuration.d.ts +1 -1
- package/components/upload-file/src/helpers/file-type.d.ts +25 -0
- package/components/upload-file/src/pipes/file-meta.pipe.d.ts +9 -0
- package/components/upload-file/src/pipes/file-reason.pipe.d.ts +11 -0
- package/components/upload-file/src/pipes/index.d.ts +2 -0
- package/components/upload-file/src/upload-file.component.d.ts +89 -8
- package/fesm2022/sdcorejs-angular-components-badge.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +3 -3
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +455 -37
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-section.mjs +15 -3
- package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-splitter.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs +390 -75
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +1667 -124
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +886 -173
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +7 -2
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +5 -2
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip.mjs +421 -121
- package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +4 -0
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +4 -0
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +4 -0
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs +17 -2
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input.mjs +4 -0
- package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +26 -20
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs +14 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +350 -5
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-BFxO3eHX.mjs → sdcorejs-angular-modules-generic-generic-configuration.page-Bk3PrEf3.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-configuration.page-BFxO3eHX.mjs.map → sdcorejs-angular-modules-generic-generic-configuration.page-Bk3PrEf3.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-Csy2fShj.mjs → sdcorejs-angular-modules-generic-generic-form-host.page-CwUegGgG.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-form-host.page-Csy2fShj.mjs.map → sdcorejs-angular-modules-generic-generic-form-host.page-CwUegGgG.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-BIIxNR6k.mjs → sdcorejs-angular-modules-generic-generic-list.page-lF2trhfp.mjs} +3 -3
- package/fesm2022/{sdcorejs-angular-modules-generic-generic-list.page-BIIxNR6k.mjs.map → sdcorejs-angular-modules-generic-generic-list.page-lF2trhfp.mjs.map} +1 -1
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DjDsau9C.mjs → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-BbmeOduc.mjs} +4 -4
- package/fesm2022/{sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DjDsau9C.mjs.map → sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-BbmeOduc.mjs.map} +1 -1
- package/fesm2022/sdcorejs-angular-modules-generic.mjs +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +347 -10
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs +23 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-api-error-BBWwQ6h2.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-approval-inbox-BMwD6_FC.mjs +16 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-approval-inbox-BMwD6_FC.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-DK33LxHm.mjs +51 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-base-api.service-DK33LxHm.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-B1BUBiag.mjs +145 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-B1BUBiag.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-B27ZX8Co.mjs +144 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create-side-drawer.component-B27ZX8Co.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-Bi2tMFHf.mjs +460 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-Bi2tMFHf.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CPwGkrNk.mjs +142 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-CPwGkrNk.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-VCbA_FkZ.mjs +113 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-create.component-VCbA_FkZ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs +18 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.model-C3fr4yNw.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-CehsdBRP.mjs +66 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-customer.service-CehsdBRP.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-CPhLTiyx.mjs +148 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail-side-drawer.component-CPhLTiyx.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-5kI7wGdX.mjs +484 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-5kI7wGdX.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CjAy-B9K.mjs +172 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CjAy-B9K.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CnL2FzCx.mjs +90 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-detail.component-CnL2FzCx.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-DObN_wCR.mjs +514 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-flow.component-DObN_wCR.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-DpnYSG2j.mjs +61 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-form-api-errors-DpnYSG2j.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-C_ST-ld5.mjs +170 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-C_ST-ld5.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D6eKR2cq.mjs +87 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-D6eKR2cq.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-FcJS3Nbd.mjs +232 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-form.component-FcJS3Nbd.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-BA-3FR1J.mjs +70 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-general-information-view.component-BA-3FR1J.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-TTrWCXIT.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-index.component-TTrWCXIT.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-table-form.component-B1qePLfk.mjs +812 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-lines-table-form.component-B1qePLfk.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BY5gjtNS.mjs +71 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-BY5gjtNS.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CJ38CJXg.mjs +629 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CJ38CJXg.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CdgPtSjJ.mjs +164 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-CdgPtSjJ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DKIwrluh.mjs +118 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-DKIwrluh.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-W9vY7HrT.mjs +115 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-list.component-W9vY7HrT.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-CI0H_5a4.mjs +1069 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-mock-backend.factory-CI0H_5a4.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BqHwKfoc.mjs +193 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source-viewer-BqHwKfoc.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-CIiLOizq.mjs +99 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-pattern-source.generated-CIiLOizq.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.model-BoHLJ8vf.mjs +12 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.model-BoHLJ8vf.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.service-D829aEk5.mjs +48 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-product.service-D829aEk5.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-BEFVmSSj.mjs +295 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-profile.component-BEFVmSSj.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-1kDb9T7_.mjs +74 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-1kDb9T7_.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-B-TJUSV_.mjs +66 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-B-TJUSV_.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-B6z7KO0P.mjs +45 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-B6z7KO0P.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DS39vgzU.mjs +50 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DS39vgzU.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DVlcUUzh.mjs +43 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DVlcUUzh.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DxWDWUdo.mjs +165 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-DxWDWUdo.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-r9CTj-8C.mjs +74 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-r9CTj-8C.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-xI1XYRo6.mjs +99 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-routes-xI1XYRo6.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-nV5dVFx2.mjs +406 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-sdcorejs-angular-modules-pattern-nV5dVFx2.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-0rRaWsuo.mjs +317 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-shell.component-0rRaWsuo.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-6uH7sDEg.mjs +143 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-6uH7sDEg.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DglN2sS_.mjs +132 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update-side-drawer.component-DglN2sS_.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-BmsOgENL.mjs +359 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-BmsOgENL.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DPZ_ucNB.mjs +138 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DPZ_ucNB.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DkAcDmsZ.mjs +100 -0
- package/fesm2022/sdcorejs-angular-modules-pattern-update.component-DkAcDmsZ.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-pattern.mjs +2 -0
- package/fesm2022/sdcorejs-angular-modules-pattern.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-services-api.mjs +11 -11
- package/fesm2022/sdcorejs-angular-services-api.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-cache.mjs +7 -5
- package/fesm2022/sdcorejs-angular-services-cache.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-storage.mjs +6 -4
- package/fesm2022/sdcorejs-angular-services-storage.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs +104 -4
- package/fesm2022/sdcorejs-angular-services-unsaved-changes.mjs.map +1 -1
- package/forms/chip/src/chip.component.d.ts +135 -19
- package/forms/chip/src/index.d.ts +0 -1
- package/i18n/src/en.d.ts +70 -1
- package/modules/layout/components/index.d.ts +2 -0
- package/modules/layout/components/page/page-form-leave.guard.d.ts +9 -0
- package/modules/layout/components/page/page.component.d.ts +38 -2
- package/modules/layout/components/page-list/page-list.component.d.ts +42 -0
- package/modules/layout/components/shared/context-switcher/context-switcher.component.d.ts +1 -1
- package/modules/pattern/README.md +76 -0
- package/modules/pattern/configurations/pattern.configuration.d.ts +30 -0
- package/modules/pattern/configurations/provide-sd-patterns.d.ts +19 -0
- package/modules/pattern/core/mock-api/mock-api.interceptor.d.ts +8 -0
- package/modules/pattern/core/mock-api/mock-api.model.d.ts +62 -0
- package/modules/pattern/core/mock-api/mock-api.state.d.ts +36 -0
- package/modules/pattern/core/mock-api/mock-backend.d.ts +18 -0
- package/modules/pattern/core/mock-api/mock-backend.factory.d.ts +3 -0
- package/modules/pattern/core/mock-api/prng.d.ts +4 -0
- package/modules/pattern/core/mock-api/resources/approval.resource.d.ts +14 -0
- package/modules/pattern/core/mock-api/resources/category.resource.d.ts +9 -0
- package/modules/pattern/core/mock-api/resources/customer.resource.d.ts +22 -0
- package/modules/pattern/core/mock-api/resources/index.d.ts +3 -0
- package/modules/pattern/core/mock-api/resources/names.d.ts +5 -0
- package/modules/pattern/core/mock-api/resources/order.resource.d.ts +44 -0
- package/modules/pattern/core/mock-api/resources/partner.resource.d.ts +16 -0
- package/modules/pattern/core/mock-api/resources/product.resource.d.ts +13 -0
- package/modules/pattern/core/mock-api/resources/settings.resource.d.ts +18 -0
- package/modules/pattern/core/pattern-shell/catalog/pattern-catalog.d.ts +24 -0
- package/modules/pattern/core/pattern-shell/index/index.component.d.ts +9 -0
- package/modules/pattern/core/pattern-shell/settings/pattern-settings.store.d.ts +57 -0
- package/modules/pattern/core/pattern-shell/settings/settings-button.component.d.ts +44 -0
- package/modules/pattern/core/pattern-shell/shell/pattern-source-viewer.d.ts +8 -0
- package/modules/pattern/core/pattern-shell/shell/shell.component.d.ts +13 -0
- package/modules/pattern/core/pattern-shell/source/pattern-source.generated.d.ts +1 -0
- package/modules/pattern/core/pattern-shell/source/source-drawer.component.d.ts +27 -0
- package/modules/pattern/core/pattern-shell/toolbar/toolbar.component.d.ts +24 -0
- package/modules/pattern/core/permission/pattern-permission.d.ts +15 -0
- package/modules/pattern/core/permission/pattern-role.store.d.ts +13 -0
- package/modules/pattern/core/session-state.d.ts +4 -0
- package/modules/pattern/docs/detail.md +237 -0
- package/modules/pattern/docs/drawer.md +484 -0
- package/modules/pattern/docs/flow.md +631 -0
- package/modules/pattern/docs/form.md +815 -0
- package/modules/pattern/docs/header-actions.md +344 -0
- package/modules/pattern/docs/list.md +247 -0
- package/modules/pattern/docs/relation.md +180 -0
- package/modules/pattern/docs/select.md +214 -0
- package/modules/pattern/docs/split.md +350 -0
- package/modules/pattern/docs/states.md +168 -0
- package/modules/pattern/features/approval/entity.resolver.d.ts +4 -0
- package/modules/pattern/features/approval/entity.resolver.ts +21 -0
- package/modules/pattern/features/approval/pages/detail/detail.component.d.ts +13 -0
- package/modules/pattern/features/approval/pages/detail/detail.component.ts +139 -0
- package/modules/pattern/features/approval/pages/list/approval-inbox.d.ts +7 -0
- package/modules/pattern/features/approval/pages/list/approval-inbox.ts +7 -0
- package/modules/pattern/features/approval/pages/list/list.component.d.ts +26 -0
- package/modules/pattern/features/approval/pages/list/list.component.html +20 -0
- package/modules/pattern/features/approval/pages/list/list.component.ts +149 -0
- package/modules/pattern/features/approval/routes.d.ts +3 -0
- package/modules/pattern/features/approval/routes.ts +30 -0
- package/modules/pattern/features/approval/services/approval.model.d.ts +37 -0
- package/modules/pattern/features/approval/services/approval.model.ts +38 -0
- package/modules/pattern/features/approval/services/approval.service.d.ts +12 -0
- package/modules/pattern/features/approval/services/approval.service.ts +23 -0
- package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.d.ts +23 -0
- package/modules/pattern/features/category/components/create-side-drawer/create-side-drawer.component.ts +130 -0
- package/modules/pattern/features/category/components/general-information-form/general-information-form.component.d.ts +20 -0
- package/modules/pattern/features/category/components/general-information-form/general-information-form.component.ts +61 -0
- package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.d.ts +23 -0
- package/modules/pattern/features/category/components/update-side-drawer/update-side-drawer.component.ts +134 -0
- package/modules/pattern/features/category/entity.resolver.d.ts +6 -0
- package/modules/pattern/features/category/entity.resolver.ts +27 -0
- package/modules/pattern/features/category/pages/list/list.component.d.ts +17 -0
- package/modules/pattern/features/category/pages/list/list.component.html +20 -0
- package/modules/pattern/features/category/pages/list/list.component.ts +105 -0
- package/modules/pattern/features/category/routes.d.ts +3 -0
- package/modules/pattern/features/category/routes.ts +42 -0
- package/modules/pattern/features/category/services/category.model.d.ts +34 -0
- package/modules/pattern/features/category/services/category.model.ts +39 -0
- package/modules/pattern/features/category/services/category.service.d.ts +17 -0
- package/modules/pattern/features/category/services/category.service.ts +36 -0
- package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.d.ts +24 -0
- package/modules/pattern/features/customer/components/create-side-drawer/create-side-drawer.component.ts +138 -0
- package/modules/pattern/features/customer/components/customer-select/customer-select.component.d.ts +20 -0
- package/modules/pattern/features/customer/components/customer-select/customer-select.component.ts +72 -0
- package/modules/pattern/features/customer/components/customer-type-select/customer-type-select.component.d.ts +20 -0
- package/modules/pattern/features/customer/components/customer-type-select/customer-type-select.component.ts +30 -0
- package/modules/pattern/features/customer/components/debts-view/debts-view.component.d.ts +11 -0
- package/modules/pattern/features/customer/components/debts-view/debts-view.component.ts +28 -0
- package/modules/pattern/features/customer/components/detail-side-drawer/detail-side-drawer.component.d.ts +20 -0
- package/modules/pattern/features/customer/components/detail-side-drawer/detail-side-drawer.component.ts +106 -0
- package/modules/pattern/features/customer/components/documents-view/documents-view.component.d.ts +14 -0
- package/modules/pattern/features/customer/components/documents-view/documents-view.component.ts +50 -0
- package/modules/pattern/features/customer/components/general-information-form/general-information-form.component.d.ts +33 -0
- package/modules/pattern/features/customer/components/general-information-form/general-information-form.component.ts +140 -0
- package/modules/pattern/features/customer/components/general-information-view/general-information-view.component.d.ts +9 -0
- package/modules/pattern/features/customer/components/general-information-view/general-information-view.component.ts +39 -0
- package/modules/pattern/features/customer/components/orders-view/orders-view.component.d.ts +11 -0
- package/modules/pattern/features/customer/components/orders-view/orders-view.component.ts +35 -0
- package/modules/pattern/features/customer/components/summary-cards/summary-cards.component.d.ts +22 -0
- package/modules/pattern/features/customer/components/summary-cards/summary-cards.component.ts +101 -0
- package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.d.ts +24 -0
- package/modules/pattern/features/customer/components/update-side-drawer/update-side-drawer.component.ts +127 -0
- package/modules/pattern/features/customer/entity.resolver.d.ts +4 -0
- package/modules/pattern/features/customer/entity.resolver.ts +21 -0
- package/modules/pattern/features/customer/pages/list/list.component.d.ts +19 -0
- package/modules/pattern/features/customer/pages/list/list.component.html +22 -0
- package/modules/pattern/features/customer/pages/list/list.component.ts +113 -0
- package/modules/pattern/features/customer/pages/profile/profile.component.d.ts +31 -0
- package/modules/pattern/features/customer/pages/profile/profile.component.ts +120 -0
- package/modules/pattern/features/customer/pipes/customer-detail.pipe.d.ts +14 -0
- package/modules/pattern/features/customer/pipes/customer-detail.pipe.ts +18 -0
- package/modules/pattern/features/customer/routes.d.ts +6 -0
- package/modules/pattern/features/customer/routes.ts +59 -0
- package/modules/pattern/features/customer/services/customer.model.d.ts +77 -0
- package/modules/pattern/features/customer/services/customer.model.ts +87 -0
- package/modules/pattern/features/customer/services/customer.service.d.ts +24 -0
- package/modules/pattern/features/customer/services/customer.service.ts +79 -0
- package/modules/pattern/features/import/components/mapping-form/mapping-form.component.d.ts +21 -0
- package/modules/pattern/features/import/components/mapping-form/mapping-form.component.ts +41 -0
- package/modules/pattern/features/import/components/preview-view/preview-view.component.d.ts +10 -0
- package/modules/pattern/features/import/components/preview-view/preview-view.component.ts +44 -0
- package/modules/pattern/features/import/pages/flow/flow.component.d.ts +43 -0
- package/modules/pattern/features/import/pages/flow/flow.component.ts +269 -0
- package/modules/pattern/features/import/routes.d.ts +2 -0
- package/modules/pattern/features/import/routes.ts +19 -0
- package/modules/pattern/features/import/services/import.model.d.ts +38 -0
- package/modules/pattern/features/import/services/import.model.ts +82 -0
- package/modules/pattern/features/import/services/import.service.d.ts +15 -0
- package/modules/pattern/features/import/services/import.service.ts +18 -0
- package/modules/pattern/features/order/components/approval-steps/approval-steps.component.d.ts +9 -0
- package/modules/pattern/features/order/components/approval-steps/approval-steps.component.ts +74 -0
- package/modules/pattern/features/order/components/bulk-result/bulk-result.component.d.ts +22 -0
- package/modules/pattern/features/order/components/bulk-result/bulk-result.component.ts +46 -0
- package/modules/pattern/features/order/components/general-information-form/general-information-form.component.d.ts +30 -0
- package/modules/pattern/features/order/components/general-information-form/general-information-form.component.ts +96 -0
- package/modules/pattern/features/order/components/lines-form/lines-form.component.d.ts +19 -0
- package/modules/pattern/features/order/components/lines-form/lines-form.component.ts +182 -0
- package/modules/pattern/features/order/components/lines-form/order-lines.d.ts +35 -0
- package/modules/pattern/features/order/components/lines-form/order-lines.ts +101 -0
- package/modules/pattern/features/order/components/lines-table-form/lines-table-form.component.d.ts +34 -0
- package/modules/pattern/features/order/components/lines-table-form/lines-table-form.component.ts +196 -0
- package/modules/pattern/features/order/components/lines-view/lines-view.component.d.ts +12 -0
- package/modules/pattern/features/order/components/lines-view/lines-view.component.ts +42 -0
- package/modules/pattern/features/order/components/summary-cards/summary-cards.component.d.ts +25 -0
- package/modules/pattern/features/order/components/summary-cards/summary-cards.component.ts +128 -0
- package/modules/pattern/features/order/entity.resolver.d.ts +9 -0
- package/modules/pattern/features/order/entity.resolver.ts +37 -0
- package/modules/pattern/features/order/pages/create/create.component.d.ts +18 -0
- package/modules/pattern/features/order/pages/create/create.component.ts +113 -0
- package/modules/pattern/features/order/pages/detail/detail.component.d.ts +27 -0
- package/modules/pattern/features/order/pages/detail/detail.component.ts +224 -0
- package/modules/pattern/features/order/pages/list/list.component.d.ts +29 -0
- package/modules/pattern/features/order/pages/list/list.component.html +38 -0
- package/modules/pattern/features/order/pages/list/list.component.ts +291 -0
- package/modules/pattern/features/order/pages/update/update.component.d.ts +22 -0
- package/modules/pattern/features/order/pages/update/update.component.ts +126 -0
- package/modules/pattern/features/order/routes.d.ts +7 -0
- package/modules/pattern/features/order/routes.ts +54 -0
- package/modules/pattern/features/order/services/order.model.d.ts +106 -0
- package/modules/pattern/features/order/services/order.model.ts +109 -0
- package/modules/pattern/features/order/services/order.service.d.ts +25 -0
- package/modules/pattern/features/order/services/order.service.ts +63 -0
- package/modules/pattern/features/partner/pages/create/create.component.d.ts +41 -0
- package/modules/pattern/features/partner/pages/create/create.component.ts +324 -0
- package/modules/pattern/features/partner/routes.d.ts +2 -0
- package/modules/pattern/features/partner/routes.ts +20 -0
- package/modules/pattern/features/partner/services/partner.model.d.ts +30 -0
- package/modules/pattern/features/partner/services/partner.model.ts +30 -0
- package/modules/pattern/features/partner/services/partner.service.d.ts +13 -0
- package/modules/pattern/features/partner/services/partner.service.ts +17 -0
- package/modules/pattern/features/product/components/general-information-form/general-information-form.component.d.ts +23 -0
- package/modules/pattern/features/product/components/general-information-form/general-information-form.component.ts +88 -0
- package/modules/pattern/features/product/components/product-select/product-select.component.d.ts +26 -0
- package/modules/pattern/features/product/components/product-select/product-select.component.ts +73 -0
- package/modules/pattern/features/product/components/product-status-select/product-status-select.component.d.ts +22 -0
- package/modules/pattern/features/product/components/product-status-select/product-status-select.component.ts +30 -0
- package/modules/pattern/features/product/entity.resolver.d.ts +4 -0
- package/modules/pattern/features/product/entity.resolver.ts +21 -0
- package/modules/pattern/features/product/pages/create/create.component.d.ts +15 -0
- package/modules/pattern/features/product/pages/create/create.component.ts +92 -0
- package/modules/pattern/features/product/pages/detail/detail.component.d.ts +10 -0
- package/modules/pattern/features/product/pages/detail/detail.component.ts +53 -0
- package/modules/pattern/features/product/pages/list/list.component.d.ts +15 -0
- package/modules/pattern/features/product/pages/list/list.component.html +30 -0
- package/modules/pattern/features/product/pages/list/list.component.ts +71 -0
- package/modules/pattern/features/product/pages/update/update.component.d.ts +16 -0
- package/modules/pattern/features/product/pages/update/update.component.ts +86 -0
- package/modules/pattern/features/product/pipes/product-detail.pipe.d.ts +14 -0
- package/modules/pattern/features/product/pipes/product-detail.pipe.ts +18 -0
- package/modules/pattern/features/product/routes.d.ts +3 -0
- package/modules/pattern/features/product/routes.ts +48 -0
- package/modules/pattern/features/product/services/product.model.d.ts +34 -0
- package/modules/pattern/features/product/services/product.model.ts +38 -0
- package/modules/pattern/features/product/services/product.service.d.ts +17 -0
- package/modules/pattern/features/product/services/product.service.ts +48 -0
- package/modules/pattern/features/settings/pages/update/update.component.d.ts +26 -0
- package/modules/pattern/features/settings/pages/update/update.component.ts +228 -0
- package/modules/pattern/features/settings/routes.d.ts +3 -0
- package/modules/pattern/features/settings/routes.ts +24 -0
- package/modules/pattern/features/settings/services/settings.model.d.ts +17 -0
- package/modules/pattern/features/settings/services/settings.model.ts +18 -0
- package/modules/pattern/features/settings/services/settings.service.d.ts +10 -0
- package/modules/pattern/features/settings/services/settings.service.ts +15 -0
- package/modules/pattern/features/settings/settings.resolver.d.ts +4 -0
- package/modules/pattern/features/settings/settings.resolver.ts +8 -0
- package/modules/pattern/index.d.ts +3 -0
- package/modules/pattern/routes.d.ts +6 -0
- package/modules/pattern/services/base-api.service.d.ts +16 -0
- package/modules/pattern/utils/api-error.d.ts +4 -0
- package/modules/pattern/utils/focus-first-invalid.d.ts +5 -0
- package/modules/pattern/utils/form-api-errors.d.ts +16 -0
- package/modules/pattern/utils/resource-url.d.ts +2 -0
- package/package.json +13 -9
- package/services/api/src/api-handler-registry.d.ts +3 -3
- package/services/api/src/api-route-configurations.d.ts +2 -2
- package/services/api/src/api.model.d.ts +2 -2
- package/services/cache/src/cache.model.d.ts +3 -1
- package/services/storage/src/storage.model.d.ts +2 -0
- package/services/unsaved-changes/src/unsaved-changes.adapters.d.ts +9 -0
- package/services/unsaved-changes/src/unsaved-changes.model.d.ts +2 -0
- package/forms/chip/src/pipes/index.d.ts +0 -1
- package/forms/chip/src/pipes/removable-chip.pipe.d.ts +0 -8
package/modules/pattern/features/order/components/lines-table-form/lines-table-form.component.ts
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { afterNextRender, ChangeDetectionStrategy, Component, effect, inject, Injector, input, untracked, viewChild } from '@angular/core';
|
|
2
|
+
import { SdButton } from '@sdcorejs/angular/components/button';
|
|
3
|
+
import { SdSection } from '@sdcorejs/angular/components/section';
|
|
4
|
+
import {
|
|
5
|
+
SdTable,
|
|
6
|
+
SdTableCellDefDirective,
|
|
7
|
+
SdTableCommandHeaderDefDirective,
|
|
8
|
+
SdTableTitleDefDirective,
|
|
9
|
+
type SdTableOption,
|
|
10
|
+
} from '@sdcorejs/angular/components/table';
|
|
11
|
+
import { SdInputNumber } from '@sdcorejs/angular/forms/input-number';
|
|
12
|
+
import { SdFormatNumberPipe } from '@sdcorejs/angular/pipes';
|
|
13
|
+
import { ProductSelectComponent } from '../../../product/components/product-select/product-select.component';
|
|
14
|
+
import type { OrderLineDto } from '../../services/order.model';
|
|
15
|
+
import type { OrderForm } from '../general-information-form/general-information-form.component';
|
|
16
|
+
import { orderLines, type OrderLineRow } from '../lines-form/order-lines';
|
|
17
|
+
|
|
18
|
+
/** Dòng của `sd-table`: dòng form cộng tên các cột. Ô của mọi cột vẽ bằng `sdTableCellDef` từ `group`/`seed`. */
|
|
19
|
+
interface LineItem extends OrderLineRow {
|
|
20
|
+
readonly productId?: string;
|
|
21
|
+
readonly quantity?: number;
|
|
22
|
+
readonly unitPrice?: number;
|
|
23
|
+
readonly amount?: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Dòng hàng nhập trực tiếp, dựng bằng `sd-table` thay cho `<table>` của `lines-form`; trạng thái dòng vẫn là
|
|
28
|
+
* `orderLines()`. Bảng local, không phân trang, không lọc. Nút thêm dòng nằm ở header cột command
|
|
29
|
+
* (`sdTableCommandHeaderDef`), ngay trên nút xoá của từng dòng; field trong ô dùng `size="sm"` và `hideInlineError`,
|
|
30
|
+
* cột bắt buộc có `*` ở title; số dòng và tổng tiền ở dưới bảng. Dòng đổi thì `reload()` bảng; `rowKey` giữ view
|
|
31
|
+
* của các dòng còn lại nên giá trị đang nhập không mất. `form.lines` chỉ vào form khi bảng đã vẽ dòng (`attach`).
|
|
32
|
+
*/
|
|
33
|
+
@Component({
|
|
34
|
+
selector: 'lines-table-form',
|
|
35
|
+
standalone: true,
|
|
36
|
+
imports: [
|
|
37
|
+
SdSection,
|
|
38
|
+
SdButton,
|
|
39
|
+
SdTable,
|
|
40
|
+
SdTableCellDefDirective,
|
|
41
|
+
SdTableCommandHeaderDefDirective,
|
|
42
|
+
SdTableTitleDefDirective,
|
|
43
|
+
SdInputNumber,
|
|
44
|
+
SdFormatNumberPipe,
|
|
45
|
+
ProductSelectComponent,
|
|
46
|
+
],
|
|
47
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
48
|
+
template: `
|
|
49
|
+
<sd-section title="Dòng hàng">
|
|
50
|
+
<sd-table autoId="order-lines" [option]="option">
|
|
51
|
+
<ng-template sdTableCommandHeaderDef>
|
|
52
|
+
<sd-button
|
|
53
|
+
tooltip="Thêm dòng"
|
|
54
|
+
prefixIcon="add"
|
|
55
|
+
size="sm"
|
|
56
|
+
type="light"
|
|
57
|
+
color="primary"
|
|
58
|
+
autoId="order-line-add"
|
|
59
|
+
(click)="lines.add()" />
|
|
60
|
+
</ng-template>
|
|
61
|
+
<ng-template sdTableTitleDef="productId">Sản phẩm <span class="text-error" aria-hidden="true">*</span></ng-template>
|
|
62
|
+
<ng-template sdTableTitleDef="quantity">Số lượng <span class="text-error" aria-hidden="true">*</span></ng-template>
|
|
63
|
+
<ng-template sdTableTitleDef="unitPrice">Đơn giá (₫) <span class="text-error" aria-hidden="true">*</span></ng-template>
|
|
64
|
+
<ng-template sdTableCellDef="productId" let-row="item">
|
|
65
|
+
@let index = lines.rows().indexOf(row);
|
|
66
|
+
<product-select
|
|
67
|
+
class="lines-table__input"
|
|
68
|
+
size="sm"
|
|
69
|
+
hideInlineError
|
|
70
|
+
[label]="undefined"
|
|
71
|
+
[form]="row.group"
|
|
72
|
+
[model]="row.seed.productId || null"
|
|
73
|
+
[inlineError]="errors()['lines.' + index + '.productId']"
|
|
74
|
+
[autoId]="'order-line-' + index + '-product'"
|
|
75
|
+
(modelChange)="lines.pick(row, $event)"
|
|
76
|
+
required />
|
|
77
|
+
</ng-template>
|
|
78
|
+
<ng-template sdTableCellDef="quantity" let-row="item">
|
|
79
|
+
@let index = lines.rows().indexOf(row);
|
|
80
|
+
<sd-input-number
|
|
81
|
+
class="lines-table__input"
|
|
82
|
+
name="quantity"
|
|
83
|
+
size="sm"
|
|
84
|
+
hideInlineError
|
|
85
|
+
type="positive"
|
|
86
|
+
[precision]="0"
|
|
87
|
+
[form]="row.group"
|
|
88
|
+
[model]="row.seed.quantity"
|
|
89
|
+
[inlineError]="errors()['lines.' + index + '.quantity']"
|
|
90
|
+
[autoId]="'order-line-' + index + '-quantity'"
|
|
91
|
+
required />
|
|
92
|
+
</ng-template>
|
|
93
|
+
<ng-template sdTableCellDef="unitPrice" let-row="item">
|
|
94
|
+
@let index = lines.rows().indexOf(row);
|
|
95
|
+
<sd-input-number
|
|
96
|
+
class="lines-table__input"
|
|
97
|
+
name="unitPrice"
|
|
98
|
+
size="sm"
|
|
99
|
+
hideInlineError
|
|
100
|
+
type="positive"
|
|
101
|
+
[precision]="0"
|
|
102
|
+
[form]="row.group"
|
|
103
|
+
[model]="row.seed.unitPrice"
|
|
104
|
+
[inlineError]="errors()['lines.' + index + '.unitPrice']"
|
|
105
|
+
[autoId]="'order-line-' + index + '-unit-price'"
|
|
106
|
+
required />
|
|
107
|
+
</ng-template>
|
|
108
|
+
<ng-template sdTableCellDef="amount" let-row="item">
|
|
109
|
+
@let index = lines.rows().indexOf(row);
|
|
110
|
+
<strong class="lines-table__amount" [attr.data-autoid]="'order-line-' + index + '-amount'">
|
|
111
|
+
{{ lines.amounts()[index] | sdFormatNumber: 0 }}
|
|
112
|
+
</strong>
|
|
113
|
+
</ng-template>
|
|
114
|
+
</sd-table>
|
|
115
|
+
<div class="lines-table__summary">
|
|
116
|
+
<span>{{ lines.rows().length }} dòng hàng</span>
|
|
117
|
+
<strong
|
|
118
|
+
>Tổng tiền: <span data-autoid="order-total">{{ lines.total() | sdFormatNumber: 0 }}</span> ₫</strong
|
|
119
|
+
>
|
|
120
|
+
</div>
|
|
121
|
+
</sd-section>
|
|
122
|
+
`,
|
|
123
|
+
styles: `
|
|
124
|
+
/* Field trong dòng: 6px trên dưới để dòng 44px vẫn thoáng. */
|
|
125
|
+
.lines-table__input {
|
|
126
|
+
display: block;
|
|
127
|
+
padding-block: 6px;
|
|
128
|
+
}
|
|
129
|
+
.lines-table__amount {
|
|
130
|
+
display: block;
|
|
131
|
+
text-align: right;
|
|
132
|
+
font-variant-numeric: tabular-nums;
|
|
133
|
+
}
|
|
134
|
+
.lines-table__summary {
|
|
135
|
+
display: flex;
|
|
136
|
+
justify-content: space-between;
|
|
137
|
+
gap: 8px;
|
|
138
|
+
padding: 12px 16px;
|
|
139
|
+
color: var(--sd-text-secondary);
|
|
140
|
+
}
|
|
141
|
+
.lines-table__summary strong {
|
|
142
|
+
color: var(--sd-text);
|
|
143
|
+
}
|
|
144
|
+
`,
|
|
145
|
+
})
|
|
146
|
+
export class LinesTableFormComponent {
|
|
147
|
+
readonly form = input.required<OrderForm>();
|
|
148
|
+
/** Dòng ban đầu (cập nhật) hoặc một dòng trống (tạo mới). */
|
|
149
|
+
readonly seed = input.required<readonly OrderLineDto[]>();
|
|
150
|
+
/** Lỗi theo field do API trả về, khoá dạng `lines.<index>.<field>`. */
|
|
151
|
+
readonly errors = input<Readonly<Record<string, string>>>({});
|
|
152
|
+
readonly #injector = inject(Injector);
|
|
153
|
+
private readonly table = viewChild(SdTable<LineItem>);
|
|
154
|
+
protected readonly lines = orderLines(this.form, this.seed, { attach: 'manual' });
|
|
155
|
+
protected readonly option: SdTableOption<LineItem> = {
|
|
156
|
+
type: 'local',
|
|
157
|
+
items: () => [...this.lines.rows()],
|
|
158
|
+
rowKey: 'key',
|
|
159
|
+
filter: { disabled: true },
|
|
160
|
+
paginate: { hidden: true, pageSize: 200 },
|
|
161
|
+
reload: {
|
|
162
|
+
visible: false,
|
|
163
|
+
// why: sd-table vẽ dòng sau lần đọc; field trong ô đăng ký xong thì mới gắn `form.lines` (xem `orderLines`).
|
|
164
|
+
onReload: () => {
|
|
165
|
+
afterNextRender(() => this.lines.attach(), { injector: this.#injector });
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
config: { visible: false },
|
|
169
|
+
columns: [
|
|
170
|
+
{ field: 'productId', title: 'Sản phẩm', type: 'string', minWidth: '180px' },
|
|
171
|
+
{ field: 'quantity', title: 'Số lượng', type: 'number', width: '88px' },
|
|
172
|
+
{ field: 'unitPrice', title: 'Đơn giá (₫)', type: 'number', width: '120px' },
|
|
173
|
+
{ field: 'amount', title: 'Thành tiền (₫)', type: 'number', width: '120px', align: 'right' },
|
|
174
|
+
],
|
|
175
|
+
command: {
|
|
176
|
+
commands: [
|
|
177
|
+
{
|
|
178
|
+
title: 'Xoá dòng',
|
|
179
|
+
icon: 'delete',
|
|
180
|
+
color: 'error',
|
|
181
|
+
disabled: () => this.lines.rows().length === 1,
|
|
182
|
+
click: row => this.lines.remove(row),
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
constructor() {
|
|
189
|
+
// why: bảng local chỉ đọc `items` khi tải; thêm, xoá dòng hay nạp đơn khác đều phải `reload()` để vẽ lại. Gọi sau
|
|
190
|
+
// lượt render, khi `option` của bảng đã được gán.
|
|
191
|
+
effect(() => {
|
|
192
|
+
this.lines.rows();
|
|
193
|
+
untracked(() => afterNextRender(() => void this.table()?.reload(), { injector: this.#injector }));
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type SdTableOption } from '@sdcorejs/angular/components/table';
|
|
2
|
+
import type { OrderLineDto } from '../../services/order.model';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/** Dòng hàng chỉ đọc; tên sản phẩm lấy qua relation `productDetail`, không hiện ID thô. */
|
|
5
|
+
export declare class LinesViewComponent {
|
|
6
|
+
readonly lines: import("@angular/core").InputSignal<readonly OrderLineDto[]>;
|
|
7
|
+
protected readonly option: import("@angular/core").Signal<SdTableOption<OrderLineDto & {
|
|
8
|
+
amount: number;
|
|
9
|
+
}>>;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LinesViewComponent, never>;
|
|
11
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LinesViewComponent, "lines-view", never, { "lines": { "alias": "lines"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AsyncPipe } from '@angular/common';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';
|
|
3
|
+
import { SdSection } from '@sdcorejs/angular/components/section';
|
|
4
|
+
import { SdTable, SdTableCellDefDirective, type SdTableOption } from '@sdcorejs/angular/components/table';
|
|
5
|
+
import { ProductDetailPipe } from '../../../product/pipes/product-detail.pipe';
|
|
6
|
+
import type { OrderLineDto } from '../../services/order.model';
|
|
7
|
+
|
|
8
|
+
/** Dòng hàng chỉ đọc; tên sản phẩm lấy qua relation `productDetail`, không hiện ID thô. */
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'lines-view',
|
|
11
|
+
standalone: true,
|
|
12
|
+
imports: [AsyncPipe, SdSection, SdTable, SdTableCellDefDirective, ProductDetailPipe],
|
|
13
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
14
|
+
template: `
|
|
15
|
+
<sd-section title="Dòng hàng">
|
|
16
|
+
<sd-table autoId="order-lines" [option]="option()">
|
|
17
|
+
<ng-template sdTableCellDef="productId" let-line="item">
|
|
18
|
+
@let product = line.productId | productDetail | async;
|
|
19
|
+
{{ product?.name ?? '…' }}
|
|
20
|
+
</ng-template>
|
|
21
|
+
</sd-table>
|
|
22
|
+
</sd-section>
|
|
23
|
+
`,
|
|
24
|
+
})
|
|
25
|
+
export class LinesViewComponent {
|
|
26
|
+
readonly lines = input.required<readonly OrderLineDto[]>();
|
|
27
|
+
protected readonly option = computed<SdTableOption<OrderLineDto & { amount: number }>>(() => {
|
|
28
|
+
const items = this.lines().map(line => ({ ...line, amount: line.quantity * line.unitPrice }));
|
|
29
|
+
return {
|
|
30
|
+
type: 'local',
|
|
31
|
+
items: () => items,
|
|
32
|
+
paginate: { pageSize: 50 },
|
|
33
|
+
filter: { hideInlineFilter: 'auto' },
|
|
34
|
+
columns: [
|
|
35
|
+
{ field: 'productId', title: 'Sản phẩm', type: 'string', minWidth: '200px' },
|
|
36
|
+
{ field: 'quantity', title: 'Số lượng', type: 'number', width: '110px', align: 'right' },
|
|
37
|
+
{ field: 'unitPrice', title: 'Đơn giá (₫)', type: 'number', width: '140px', align: 'right' },
|
|
38
|
+
{ field: 'amount', title: 'Thành tiền (₫)', type: 'number', width: '150px', align: 'right' },
|
|
39
|
+
],
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { OrderCounts, OrderStatus } from '../../services/order.model';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
type CardKey = 'all' | 'pending' | 'shipping';
|
|
4
|
+
/**
|
|
5
|
+
* Score card của danh sách đơn: ba thẻ đầu lọc theo trạng thái, đồng bộ với tab vì cùng một state; thẻ doanh thu
|
|
6
|
+
* chỉ để xem. Khi `sd-page-list` thu gọn (màn thấp), các thẻ thành một dòng 36px.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SummaryCardsComponent {
|
|
9
|
+
readonly counts: import("@angular/core").InputSignal<OrderCounts | null>;
|
|
10
|
+
/** Trạng thái đang lọc; `null` là tất cả. */
|
|
11
|
+
readonly status: import("@angular/core").ModelSignal<OrderStatus | null>;
|
|
12
|
+
protected readonly cards: import("@angular/core").Signal<{
|
|
13
|
+
value: string;
|
|
14
|
+
key: CardKey;
|
|
15
|
+
label: string;
|
|
16
|
+
}[]>;
|
|
17
|
+
protected readonly compact: import("@angular/core").Signal<boolean>;
|
|
18
|
+
/** Trạng thái chọn từ tab mà không có thẻ (Hoàn tất, Đã huỷ): không thẻ nào sáng. */
|
|
19
|
+
protected readonly selected: import("@angular/core").WritableSignal<CardKey | null>;
|
|
20
|
+
protected readonly revenue: import("@angular/core").Signal<string>;
|
|
21
|
+
protected choose(key: unknown): void;
|
|
22
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SummaryCardsComponent, never>;
|
|
23
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SummaryCardsComponent, "summary-cards", never, { "counts": { "alias": "counts"; "required": false; "isSignal": true; }; "status": { "alias": "status"; "required": false; "isSignal": true; }; }, { "status": "statusChange"; }, never, never, true, never>;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input, linkedSignal, model } from '@angular/core';
|
|
2
|
+
import { SdCard, SdCardGroup } from '@sdcorejs/angular/components/card';
|
|
3
|
+
import { SD_PAGE_LIST } from '@sdcorejs/angular/modules/layout';
|
|
4
|
+
import type { OrderCounts, OrderStatus } from '../../services/order.model';
|
|
5
|
+
|
|
6
|
+
type CardKey = 'all' | 'pending' | 'shipping';
|
|
7
|
+
|
|
8
|
+
const CARDS: readonly { readonly key: CardKey; readonly label: string }[] = [
|
|
9
|
+
{ key: 'all', label: 'Tổng đơn' },
|
|
10
|
+
{ key: 'pending', label: 'Chờ xác nhận' },
|
|
11
|
+
{ key: 'shipping', label: 'Đang giao' },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
/** 1.234.567.890 → "1,2 tỷ"; 350.000.000 → "350 triệu". */
|
|
15
|
+
function money(value: number): string {
|
|
16
|
+
if (value >= 1_000_000_000) return `${(value / 1_000_000_000).toLocaleString('vi-VN', { maximumFractionDigits: 1 })} tỷ`;
|
|
17
|
+
return `${Math.round(value / 1_000_000).toLocaleString('vi-VN')} triệu`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Score card của danh sách đơn: ba thẻ đầu lọc theo trạng thái, đồng bộ với tab vì cùng một state; thẻ doanh thu
|
|
22
|
+
* chỉ để xem. Khi `sd-page-list` thu gọn (màn thấp), các thẻ thành một dòng 36px.
|
|
23
|
+
*/
|
|
24
|
+
@Component({
|
|
25
|
+
selector: 'summary-cards',
|
|
26
|
+
standalone: true,
|
|
27
|
+
imports: [SdCard, SdCardGroup],
|
|
28
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
29
|
+
template: `
|
|
30
|
+
<sd-card-group
|
|
31
|
+
class="summary"
|
|
32
|
+
autoId="order-summary"
|
|
33
|
+
aria-label="Tóm tắt đơn hàng"
|
|
34
|
+
[class.summary--compact]="compact()"
|
|
35
|
+
[(model)]="selected"
|
|
36
|
+
(sdChange)="choose($event)">
|
|
37
|
+
@for (card of cards(); track card.key) {
|
|
38
|
+
<sd-card class="summary__card" [value]="card.key" [autoId]="'order-summary-' + card.key">
|
|
39
|
+
<span class="summary__label">{{ card.label }}</span>
|
|
40
|
+
<strong class="summary__value">{{ card.value }}</strong>
|
|
41
|
+
</sd-card>
|
|
42
|
+
}
|
|
43
|
+
<div class="summary__card summary__card--static" data-autoid="order-summary-revenue">
|
|
44
|
+
<span class="summary__label">Doanh thu hoàn tất</span>
|
|
45
|
+
<strong class="summary__value">{{ revenue() }}</strong>
|
|
46
|
+
</div>
|
|
47
|
+
</sd-card-group>
|
|
48
|
+
`,
|
|
49
|
+
styles: `
|
|
50
|
+
.summary {
|
|
51
|
+
display: grid;
|
|
52
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
53
|
+
gap: 12px;
|
|
54
|
+
}
|
|
55
|
+
.summary__card {
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
gap: 4px;
|
|
59
|
+
padding: 12px 16px;
|
|
60
|
+
}
|
|
61
|
+
.summary__card--static {
|
|
62
|
+
border: 1px solid var(--sd-border);
|
|
63
|
+
border-radius: 8px;
|
|
64
|
+
background: var(--sd-surface);
|
|
65
|
+
}
|
|
66
|
+
.summary__label {
|
|
67
|
+
color: var(--sd-text-secondary);
|
|
68
|
+
font-size: 13px;
|
|
69
|
+
}
|
|
70
|
+
.summary__value {
|
|
71
|
+
font-size: 22px;
|
|
72
|
+
line-height: 28px;
|
|
73
|
+
font-weight: 500;
|
|
74
|
+
font-variant-numeric: tabular-nums;
|
|
75
|
+
}
|
|
76
|
+
.summary--compact {
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
gap: 8px;
|
|
80
|
+
height: 36px;
|
|
81
|
+
}
|
|
82
|
+
.summary--compact .summary__card {
|
|
83
|
+
flex-direction: row;
|
|
84
|
+
align-items: baseline;
|
|
85
|
+
gap: 6px;
|
|
86
|
+
padding: 4px 10px;
|
|
87
|
+
}
|
|
88
|
+
.summary--compact .summary__card--static {
|
|
89
|
+
border: 0;
|
|
90
|
+
background: transparent;
|
|
91
|
+
}
|
|
92
|
+
.summary--compact .summary__value {
|
|
93
|
+
font-size: 14px;
|
|
94
|
+
line-height: 20px;
|
|
95
|
+
}
|
|
96
|
+
@media (max-width: 767px) {
|
|
97
|
+
.summary {
|
|
98
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
`,
|
|
102
|
+
})
|
|
103
|
+
export class SummaryCardsComponent {
|
|
104
|
+
readonly counts = input<OrderCounts | null>(null);
|
|
105
|
+
/** Trạng thái đang lọc; `null` là tất cả. */
|
|
106
|
+
readonly status = model<OrderStatus | null>(null);
|
|
107
|
+
protected readonly cards = computed(() => {
|
|
108
|
+
const counts = this.counts();
|
|
109
|
+
return CARDS.map(card => ({ ...card, value: counts ? counts[card.key].toLocaleString('vi-VN') : '…' }));
|
|
110
|
+
});
|
|
111
|
+
protected readonly compact = inject(SD_PAGE_LIST).compact;
|
|
112
|
+
/** Trạng thái chọn từ tab mà không có thẻ (Hoàn tất, Đã huỷ): không thẻ nào sáng. */
|
|
113
|
+
protected readonly selected = linkedSignal<CardKey | null>(() => {
|
|
114
|
+
const status = this.status();
|
|
115
|
+
return status === null ? 'all' : status === 'pending' || status === 'shipping' ? status : null;
|
|
116
|
+
});
|
|
117
|
+
protected readonly revenue = computed(() => {
|
|
118
|
+
const counts = this.counts();
|
|
119
|
+
return counts ? money(counts.revenue) : '…';
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
protected choose(key: unknown): void {
|
|
123
|
+
// Bấm lại thẻ đang chọn (model về null) hoặc thẻ Tổng đơn đều là bỏ lọc.
|
|
124
|
+
const card = (key as CardKey | null) ?? 'all';
|
|
125
|
+
this.selected.set(card);
|
|
126
|
+
this.status.set(card === 'all' ? null : card);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ResolveFn } from '@angular/router';
|
|
2
|
+
import { type OrderDto } from './services/order.model';
|
|
3
|
+
/** Tải đơn hàng bằng `detail(id)` trước khi mở chi tiết hoặc form; lỗi đi tới navigation error handler của host. */
|
|
4
|
+
export declare const entityResolver: ResolveFn<OrderDto>;
|
|
5
|
+
/**
|
|
6
|
+
* Như `entityResolver`, cho trang cập nhật: đơn không còn sửa được (đã xác nhận, đang duyệt…) mở trang chi tiết, thay vì
|
|
7
|
+
* mở form rồi mới bị API từ chối khi lưu.
|
|
8
|
+
*/
|
|
9
|
+
export declare const updatableEntityResolver: ResolveFn<OrderDto>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { HttpErrorResponse } from '@angular/common/http';
|
|
2
|
+
import { inject } from '@angular/core';
|
|
3
|
+
import { createUrlTreeFromSnapshot, RedirectCommand, type ResolveFn } from '@angular/router';
|
|
4
|
+
import { map, timeout, type Observable } from 'rxjs';
|
|
5
|
+
import { SdNotifyService } from '@sdcorejs/angular/services/notify';
|
|
6
|
+
import { OrderService } from './services/order.service';
|
|
7
|
+
import { canUpdateOrder, type OrderDto } from './services/order.model';
|
|
8
|
+
|
|
9
|
+
/** Tải đơn hàng bằng `detail(id)` trước khi mở chi tiết hoặc form; lỗi đi tới navigation error handler của host. */
|
|
10
|
+
export const entityResolver: ResolveFn<OrderDto> = route => {
|
|
11
|
+
const id = route.paramMap.get('id');
|
|
12
|
+
if (!id?.trim()) throw new HttpErrorResponse({ status: 404 });
|
|
13
|
+
return inject(OrderService)
|
|
14
|
+
.detail(id)
|
|
15
|
+
.pipe(
|
|
16
|
+
timeout(10_000),
|
|
17
|
+
map(entity => {
|
|
18
|
+
if (!entity || entity.id !== id) throw new HttpErrorResponse({ status: 404 });
|
|
19
|
+
return entity;
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Như `entityResolver`, cho trang cập nhật: đơn không còn sửa được (đã xác nhận, đang duyệt…) mở trang chi tiết, thay vì
|
|
26
|
+
* mở form rồi mới bị API từ chối khi lưu.
|
|
27
|
+
*/
|
|
28
|
+
export const updatableEntityResolver: ResolveFn<OrderDto> = (route, state) => {
|
|
29
|
+
const notify = inject(SdNotifyService);
|
|
30
|
+
return (entityResolver(route, state) as Observable<OrderDto>).pipe(
|
|
31
|
+
map(order => {
|
|
32
|
+
if (canUpdateOrder(order)) return order;
|
|
33
|
+
notify.info(`Đơn ${order.code} không còn sửa được.`);
|
|
34
|
+
return new RedirectCommand(createUrlTreeFromSnapshot(route, ['../detail']));
|
|
35
|
+
})
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type OrderForm } from '../../components/general-information-form/general-information-form.component';
|
|
2
|
+
import { type OrderSaveReq } from '../../services/order.model';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/** Tạo đơn hàng: form nhiều nhóm có mục lục (`toc`), dòng hàng nhập trực tiếp, lưu xong sang chi tiết. */
|
|
5
|
+
export declare class CreateComponent {
|
|
6
|
+
#private;
|
|
7
|
+
/** `?lines=sd-table`: dòng hàng dựng bằng `sd-table` (`lines-table-form`) để so với `<table>`. Màn thật chọn một. */
|
|
8
|
+
protected readonly linesTable: boolean;
|
|
9
|
+
protected readonly seed: OrderSaveReq;
|
|
10
|
+
protected readonly form: OrderForm;
|
|
11
|
+
protected readonly saving: import("@angular/core").WritableSignal<boolean>;
|
|
12
|
+
protected readonly apiErrors: import("../../../../utils/form-api-errors").FormApiErrors;
|
|
13
|
+
constructor();
|
|
14
|
+
protected cancel(): void;
|
|
15
|
+
protected save(): Promise<void>;
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CreateComponent, never>;
|
|
17
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CreateComponent, "create", never, {}, {}, never, never, true, never>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { afterNextRender, ChangeDetectionStrategy, Component, DestroyRef, ElementRef, inject, Injector, signal } from '@angular/core';
|
|
2
|
+
import { FormGroup } from '@angular/forms';
|
|
3
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
|
4
|
+
import { firstValueFrom } from 'rxjs';
|
|
5
|
+
import { SdButton } from '@sdcorejs/angular/components/button';
|
|
6
|
+
import { SdSection } from '@sdcorejs/angular/components/section';
|
|
7
|
+
import { SdTextarea } from '@sdcorejs/angular/forms/textarea';
|
|
8
|
+
import { SdPageComponent } from '@sdcorejs/angular/modules/layout';
|
|
9
|
+
import { SdNotifyService } from '@sdcorejs/angular/services/notify';
|
|
10
|
+
import { registerSdUnsavedChangesForm, SdUnsavedChangesService } from '@sdcorejs/angular/services/unsaved-changes';
|
|
11
|
+
import { apiErrorMessage } from '../../../../utils/api-error';
|
|
12
|
+
import { focusFirstInvalid } from '../../../../utils/focus-first-invalid';
|
|
13
|
+
import { formApiErrors } from '../../../../utils/form-api-errors';
|
|
14
|
+
import {
|
|
15
|
+
GeneralInformationFormComponent,
|
|
16
|
+
orderSaveReq,
|
|
17
|
+
type OrderForm,
|
|
18
|
+
} from '../../components/general-information-form/general-information-form.component';
|
|
19
|
+
import { LinesFormComponent } from '../../components/lines-form/lines-form.component';
|
|
20
|
+
import { LinesTableFormComponent } from '../../components/lines-table-form/lines-table-form.component';
|
|
21
|
+
import { OrderService } from '../../services/order.service';
|
|
22
|
+
import { ORDER_CHANNELS, ORDER_PAYMENTS, ORDER_WAREHOUSES, type OrderSaveReq } from '../../services/order.model';
|
|
23
|
+
|
|
24
|
+
/** Tạo đơn hàng: form nhiều nhóm có mục lục (`toc`), dòng hàng nhập trực tiếp, lưu xong sang chi tiết. */
|
|
25
|
+
@Component({
|
|
26
|
+
selector: 'create',
|
|
27
|
+
standalone: true,
|
|
28
|
+
imports: [SdPageComponent, SdButton, SdSection, SdTextarea, GeneralInformationFormComponent, LinesFormComponent, LinesTableFormComponent],
|
|
29
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
30
|
+
template: `
|
|
31
|
+
<sd-page-form title="Tạo mới đơn hàng" [backLink]="['..']" toc>
|
|
32
|
+
<div headerRight class="d-flex align-items-center gap-8">
|
|
33
|
+
<sd-button title="Huỷ" type="outline" autoId="order-cancel" (click)="cancel()" />
|
|
34
|
+
<sd-button
|
|
35
|
+
title="Tạo đơn hàng"
|
|
36
|
+
prefixIcon="save"
|
|
37
|
+
type="fill"
|
|
38
|
+
color="primary"
|
|
39
|
+
autoId="order-save"
|
|
40
|
+
[loading]="saving()"
|
|
41
|
+
(click)="save()" />
|
|
42
|
+
</div>
|
|
43
|
+
<div class="d-flex flex-column gap-16 py-16">
|
|
44
|
+
<general-information-form [form]="form" [seed]="seed" />
|
|
45
|
+
@if (linesTable) {
|
|
46
|
+
<lines-table-form [form]="form" [seed]="seed.lines" [errors]="apiErrors.errors()" />
|
|
47
|
+
} @else {
|
|
48
|
+
<lines-form [form]="form" [seed]="seed.lines" [errors]="apiErrors.errors()" />
|
|
49
|
+
}
|
|
50
|
+
<sd-section title="Ghi chú">
|
|
51
|
+
<div class="px-16 pt-16 pb-8">
|
|
52
|
+
<sd-textarea label="Ghi chú nội bộ" name="note" [form]="form" [model]="seed.note" maxlength="500" />
|
|
53
|
+
</div>
|
|
54
|
+
</sd-section>
|
|
55
|
+
</div>
|
|
56
|
+
</sd-page-form>
|
|
57
|
+
`,
|
|
58
|
+
})
|
|
59
|
+
export class CreateComponent {
|
|
60
|
+
readonly #orderService = inject(OrderService);
|
|
61
|
+
readonly #notify = inject(SdNotifyService);
|
|
62
|
+
readonly #router = inject(Router);
|
|
63
|
+
readonly #route = inject(ActivatedRoute);
|
|
64
|
+
/** `?lines=sd-table`: dòng hàng dựng bằng `sd-table` (`lines-table-form`) để so với `<table>`. Màn thật chọn một. */
|
|
65
|
+
protected readonly linesTable = this.#route.snapshot.queryParamMap.get('lines') === 'sd-table';
|
|
66
|
+
readonly #host: HTMLElement = inject(ElementRef).nativeElement;
|
|
67
|
+
readonly #injector = inject(Injector);
|
|
68
|
+
protected readonly seed: OrderSaveReq = {
|
|
69
|
+
customerId: '',
|
|
70
|
+
channel: ORDER_CHANNELS[0],
|
|
71
|
+
warehouse: ORDER_WAREHOUSES[0],
|
|
72
|
+
payment: ORDER_PAYMENTS[0],
|
|
73
|
+
note: null,
|
|
74
|
+
lines: [],
|
|
75
|
+
};
|
|
76
|
+
protected readonly form: OrderForm = new FormGroup({});
|
|
77
|
+
protected readonly saving = signal(false);
|
|
78
|
+
protected readonly apiErrors = formApiErrors(this.form);
|
|
79
|
+
readonly #unsaved = registerSdUnsavedChangesForm(inject(SdUnsavedChangesService), this.form, { id: 'order-create', dirty: 'value' });
|
|
80
|
+
|
|
81
|
+
constructor() {
|
|
82
|
+
inject(DestroyRef).onDestroy(() => this.#unsaved.destroy());
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
protected cancel(): void {
|
|
86
|
+
void this.#router.navigate(['..'], { relativeTo: this.#route });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
protected async save(): Promise<void> {
|
|
90
|
+
if (this.saving()) return;
|
|
91
|
+
this.form.markAllAsTouched();
|
|
92
|
+
if (this.form.invalid) {
|
|
93
|
+
this.#focusFirstInvalid();
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
this.saving.set(true);
|
|
97
|
+
try {
|
|
98
|
+
const order = await firstValueFrom(this.#orderService.create(orderSaveReq(this.form)));
|
|
99
|
+
this.#unsaved.markPristine();
|
|
100
|
+
this.#notify.success(`Đã tạo đơn ${order.code}.`);
|
|
101
|
+
await this.#router.navigate(['..', order.id, 'detail'], { relativeTo: this.#route, replaceUrl: true });
|
|
102
|
+
} catch (error) {
|
|
103
|
+
if (this.apiErrors.set(error)) this.#focusFirstInvalid();
|
|
104
|
+
else this.#notify.error(apiErrorMessage(error, 'Không thể lưu. Dữ liệu đã nhập vẫn được giữ.'));
|
|
105
|
+
} finally {
|
|
106
|
+
this.saving.set(false);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
#focusFirstInvalid(): void {
|
|
111
|
+
afterNextRender(() => focusFirstInvalid(this.#host), { injector: this.#injector });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type OrderAction, type OrderDto } from '../../services/order.model';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Chi tiết đơn (`:id/detail`, route con của danh sách). Mở trong drawer 600px hoặc trang `sd-page-detail` theo
|
|
5
|
+
* `detail` của `sd-page-list`. Gửi duyệt, Duyệt và Từ chối đều hỏi xác nhận; Từ chối bắt buộc lý do (E13).
|
|
6
|
+
*/
|
|
7
|
+
export declare class DetailComponent {
|
|
8
|
+
#private;
|
|
9
|
+
private readonly drawer;
|
|
10
|
+
protected readonly mode: import("@angular/core").Signal<import("@sdcorejs/angular/modules/layout").SdPageListDetail>;
|
|
11
|
+
/** Đơn do resolver tải; sau mỗi tác vụ thay bằng đơn API trả về. */
|
|
12
|
+
protected readonly entity: import("@angular/core").WritableSignal<OrderDto>;
|
|
13
|
+
protected readonly pending: import("@angular/core").WritableSignal<boolean>;
|
|
14
|
+
protected readonly statusBadge: import("@angular/core").Signal<import("@sdcorejs/angular/components/badge").SdBadgeData>;
|
|
15
|
+
protected readonly approvalBadge: import("@angular/core").Signal<import("@sdcorejs/angular/components/badge").SdBadgeData>;
|
|
16
|
+
/** Trạng thái đơn và trạng thái duyệt: title của trang, dòng "Trạng thái" của drawer. */
|
|
17
|
+
protected readonly badges: import("@angular/core").Signal<import("@sdcorejs/angular/components/badge").SdBadgeData[]>;
|
|
18
|
+
protected readonly editable: import("@angular/core").Signal<boolean>;
|
|
19
|
+
protected readonly submitted: import("@angular/core").Signal<import("../../services/order.model").OrderApprovalStepDto | undefined>;
|
|
20
|
+
protected readonly decided: import("@angular/core").Signal<import("../../services/order.model").OrderApprovalStepDto | undefined>;
|
|
21
|
+
constructor();
|
|
22
|
+
protected closed(): void;
|
|
23
|
+
/** Hỏi xác nhận (Từ chối kèm lý do), gọi API, rồi hiển thị đơn mới; lỗi giữ nguyên màn để thử lại. */
|
|
24
|
+
protected act(action: Extract<OrderAction, 'submit' | 'approve' | 'reject'>): Promise<void>;
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DetailComponent, never>;
|
|
26
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DetailComponent, "detail", never, {}, {}, never, never, true, never>;
|
|
27
|
+
}
|