Loading packages/admin-web-angular/src/app/@shared/warehouse/+warehouse-order-modal/make-order-comment.component.ts 0 → 100644 +34 −0 Original line number Diff line number Diff line import { Component, EventEmitter, Input, Output } from '@angular/core'; import { ViewCell } from 'ng2-smart-table'; @Component({ styles: [ ` .order-comment-wrapper textarea { width: 100%; } `, ], template: ` <div class="order-comment-wrapper"> <textarea (blur)="setComment($event)"></textarea> </div> `, }) export class MakeOrderCommentComponent implements ViewCell { @Input() value; @Input() rowData: any; @Output() comment = new EventEmitter<string>(); get productId(): string { return this.value.productId; } setComment(e) { this.comment.emit(e.target.value); } } packages/admin-web-angular/src/app/@shared/warehouse/+warehouse-order-modal/warehouse-order-modal.component.ts +30 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ import { ProductLocalesService } from '@modules/client.common.angular2/locale/pr import { ILocaleMember } from '@modules/server.common/interfaces/ILocale'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { takeUntil } from 'rxjs/operators'; import { MakeOrderCommentComponent } from './make-order-comment.component'; @Component({ selector: 'ea-warehouse-order-modal', Loading Loading @@ -78,6 +79,7 @@ export class WarehouseOrderModalComponent implements OnInit, OnDestroy { PRICE: `${basePrefix}.${smartTableTitlesPrefix}.PRICE`, AVAILABLE: `${basePrefix}.${smartTableTitlesPrefix}.AVAILABLE`, AMOUNT: `${basePrefix}.${smartTableTitlesPrefix}.AMOUNT`, COMMENT: `${basePrefix}.${smartTableTitlesPrefix}.COMMENT`, }, }, }; Loading Loading @@ -141,6 +143,7 @@ export class WarehouseOrderModalComponent implements OnInit, OnDestroy { return { productId: wp.productId, count: 0, comment: '', }; } ); Loading @@ -149,7 +152,7 @@ export class WarehouseOrderModalComponent implements OnInit, OnDestroy { (wp: WarehouseProduct) => { return { img: ` <img src="${this._getTranslate(wp.product['images'])}" height="68px"/> <img src="${this._getTranslate(wp.product['images'])}" height="50px"/> `, product: ` <span class="float-left">${this._getTranslate(wp.product['title'])}</span> Loading @@ -159,6 +162,7 @@ export class WarehouseOrderModalComponent implements OnInit, OnDestroy { <div class="badge badge-pill badge-secondary">${wp.count}</div> `, amount: { productId: wp.productId, available: wp.count }, comment: { productId: wp.productId }, }; } ); Loading Loading @@ -214,6 +218,10 @@ export class WarehouseOrderModalComponent implements OnInit, OnDestroy { this.TRANSLATE_PREFIXES.SMART_TABLE.TITLES.AMOUNT ); const comment = this._translate( this.TRANSLATE_PREFIXES.SMART_TABLE.TITLES.COMMENT ); this.settingsSmartTable = { actions: false, pager: { perPage: 5 }, Loading Loading @@ -270,6 +278,27 @@ export class WarehouseOrderModalComponent implements OnInit, OnDestroy { }); }, }, comment: { title: comment, filter: false, type: 'custom', renderComponent: MakeOrderCommentComponent, onComponentInitFunction: ( childInstance: MakeOrderCommentComponent ) => { childInstance.comment .pipe(takeUntil(this._ngDestroy$)) .subscribe((comment) => { const wProduct = this._orderProducts.find( ({ productId }) => productId === childInstance.productId ); wProduct.comment = comment; }); }, }, }, }; } Loading packages/admin-web-angular/src/app/@shared/warehouse/+warehouse-order-modal/warehouse-order-modal.module.ts +11 −2 Original line number Diff line number Diff line Loading @@ -6,8 +6,13 @@ import { WarehouseOrderModalComponent } from './warehouse-order-modal.component' import { WarehouseOrderInputComponent } from './warehouse-order-input.component'; import { TranslateModule } from '@ngx-translate/core'; import { NbSpinnerModule, NbButtonModule } from '@nebular/theme'; import { MakeOrderCommentComponent } from './make-order-comment.component'; const COMPONENTS = [WarehouseOrderModalComponent, WarehouseOrderInputComponent]; const COMPONENTS = [ WarehouseOrderModalComponent, WarehouseOrderInputComponent, MakeOrderCommentComponent, ]; @NgModule({ imports: [ Loading @@ -19,7 +24,11 @@ const COMPONENTS = [WarehouseOrderModalComponent, WarehouseOrderInputComponent]; TranslateModule.forChild(), NbButtonModule, ], declarations: [WarehouseOrderModalComponent, WarehouseOrderInputComponent], declarations: [ WarehouseOrderModalComponent, WarehouseOrderInputComponent, MakeOrderCommentComponent, ], entryComponents: COMPONENTS, exports: COMPONENTS, }) Loading packages/admin-web-angular/src/app/pages/+orders/+order/order-products/order-products.component.ts +10 −2 Original line number Diff line number Diff line Loading @@ -82,6 +82,8 @@ export class OrderProductsComponent implements OnInit, OnChanges, OnDestroy { async loadDataSmartTable() { const loadData = () => { if (this.order) { console.error(); const productsVM = this.order.products.map( (product: OrderProduct) => { return { Loading @@ -89,6 +91,7 @@ export class OrderProductsComponent implements OnInit, OnChanges, OnDestroy { price: product.price, qty: product.count, product: product.product, comment: product.comment, image: this._productLocalesService.getTranslate( product.product['images'] ), Loading Loading @@ -238,10 +241,11 @@ export class OrderProductsComponent implements OnInit, OnChanges, OnDestroy { getTranslate('IMAGE'), getTranslate('NAME'), getTranslate('QTY'), getTranslate('PRICE') getTranslate('PRICE'), getTranslate('COMMENT') ) .pipe(takeUntil(this._ngDestroy$)) .subscribe(([id, image, name, qty, price]) => { .subscribe(([id, image, name, qty, price, comment]) => { this.settingsSmartTable = { actions: false, selectMode: 'multi', Loading @@ -251,6 +255,10 @@ export class OrderProductsComponent implements OnInit, OnChanges, OnDestroy { renderComponent: ProductTitleRedirectComponent, type: 'custom', }, comment: { title: comment, width: '15%', }, qty: { title: qty, class: 'text-center', Loading packages/admin-web-angular/src/app/pages/+warehouses/+warehouse/warehouse.component.ts +1 −1 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ export class WarehouseComponent implements OnDestroy, AfterViewInit, OnChanges { const modalRef: NgbModalRef = this.modalService.open( WarehouseOrderComponent, { size: 'lg', size: 'xl', container: 'nb-layout', windowClass: 'ng-custom', backdrop: 'static', Loading Loading
packages/admin-web-angular/src/app/@shared/warehouse/+warehouse-order-modal/make-order-comment.component.ts 0 → 100644 +34 −0 Original line number Diff line number Diff line import { Component, EventEmitter, Input, Output } from '@angular/core'; import { ViewCell } from 'ng2-smart-table'; @Component({ styles: [ ` .order-comment-wrapper textarea { width: 100%; } `, ], template: ` <div class="order-comment-wrapper"> <textarea (blur)="setComment($event)"></textarea> </div> `, }) export class MakeOrderCommentComponent implements ViewCell { @Input() value; @Input() rowData: any; @Output() comment = new EventEmitter<string>(); get productId(): string { return this.value.productId; } setComment(e) { this.comment.emit(e.target.value); } }
packages/admin-web-angular/src/app/@shared/warehouse/+warehouse-order-modal/warehouse-order-modal.component.ts +30 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ import { ProductLocalesService } from '@modules/client.common.angular2/locale/pr import { ILocaleMember } from '@modules/server.common/interfaces/ILocale'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { takeUntil } from 'rxjs/operators'; import { MakeOrderCommentComponent } from './make-order-comment.component'; @Component({ selector: 'ea-warehouse-order-modal', Loading Loading @@ -78,6 +79,7 @@ export class WarehouseOrderModalComponent implements OnInit, OnDestroy { PRICE: `${basePrefix}.${smartTableTitlesPrefix}.PRICE`, AVAILABLE: `${basePrefix}.${smartTableTitlesPrefix}.AVAILABLE`, AMOUNT: `${basePrefix}.${smartTableTitlesPrefix}.AMOUNT`, COMMENT: `${basePrefix}.${smartTableTitlesPrefix}.COMMENT`, }, }, }; Loading Loading @@ -141,6 +143,7 @@ export class WarehouseOrderModalComponent implements OnInit, OnDestroy { return { productId: wp.productId, count: 0, comment: '', }; } ); Loading @@ -149,7 +152,7 @@ export class WarehouseOrderModalComponent implements OnInit, OnDestroy { (wp: WarehouseProduct) => { return { img: ` <img src="${this._getTranslate(wp.product['images'])}" height="68px"/> <img src="${this._getTranslate(wp.product['images'])}" height="50px"/> `, product: ` <span class="float-left">${this._getTranslate(wp.product['title'])}</span> Loading @@ -159,6 +162,7 @@ export class WarehouseOrderModalComponent implements OnInit, OnDestroy { <div class="badge badge-pill badge-secondary">${wp.count}</div> `, amount: { productId: wp.productId, available: wp.count }, comment: { productId: wp.productId }, }; } ); Loading Loading @@ -214,6 +218,10 @@ export class WarehouseOrderModalComponent implements OnInit, OnDestroy { this.TRANSLATE_PREFIXES.SMART_TABLE.TITLES.AMOUNT ); const comment = this._translate( this.TRANSLATE_PREFIXES.SMART_TABLE.TITLES.COMMENT ); this.settingsSmartTable = { actions: false, pager: { perPage: 5 }, Loading Loading @@ -270,6 +278,27 @@ export class WarehouseOrderModalComponent implements OnInit, OnDestroy { }); }, }, comment: { title: comment, filter: false, type: 'custom', renderComponent: MakeOrderCommentComponent, onComponentInitFunction: ( childInstance: MakeOrderCommentComponent ) => { childInstance.comment .pipe(takeUntil(this._ngDestroy$)) .subscribe((comment) => { const wProduct = this._orderProducts.find( ({ productId }) => productId === childInstance.productId ); wProduct.comment = comment; }); }, }, }, }; } Loading
packages/admin-web-angular/src/app/@shared/warehouse/+warehouse-order-modal/warehouse-order-modal.module.ts +11 −2 Original line number Diff line number Diff line Loading @@ -6,8 +6,13 @@ import { WarehouseOrderModalComponent } from './warehouse-order-modal.component' import { WarehouseOrderInputComponent } from './warehouse-order-input.component'; import { TranslateModule } from '@ngx-translate/core'; import { NbSpinnerModule, NbButtonModule } from '@nebular/theme'; import { MakeOrderCommentComponent } from './make-order-comment.component'; const COMPONENTS = [WarehouseOrderModalComponent, WarehouseOrderInputComponent]; const COMPONENTS = [ WarehouseOrderModalComponent, WarehouseOrderInputComponent, MakeOrderCommentComponent, ]; @NgModule({ imports: [ Loading @@ -19,7 +24,11 @@ const COMPONENTS = [WarehouseOrderModalComponent, WarehouseOrderInputComponent]; TranslateModule.forChild(), NbButtonModule, ], declarations: [WarehouseOrderModalComponent, WarehouseOrderInputComponent], declarations: [ WarehouseOrderModalComponent, WarehouseOrderInputComponent, MakeOrderCommentComponent, ], entryComponents: COMPONENTS, exports: COMPONENTS, }) Loading
packages/admin-web-angular/src/app/pages/+orders/+order/order-products/order-products.component.ts +10 −2 Original line number Diff line number Diff line Loading @@ -82,6 +82,8 @@ export class OrderProductsComponent implements OnInit, OnChanges, OnDestroy { async loadDataSmartTable() { const loadData = () => { if (this.order) { console.error(); const productsVM = this.order.products.map( (product: OrderProduct) => { return { Loading @@ -89,6 +91,7 @@ export class OrderProductsComponent implements OnInit, OnChanges, OnDestroy { price: product.price, qty: product.count, product: product.product, comment: product.comment, image: this._productLocalesService.getTranslate( product.product['images'] ), Loading Loading @@ -238,10 +241,11 @@ export class OrderProductsComponent implements OnInit, OnChanges, OnDestroy { getTranslate('IMAGE'), getTranslate('NAME'), getTranslate('QTY'), getTranslate('PRICE') getTranslate('PRICE'), getTranslate('COMMENT') ) .pipe(takeUntil(this._ngDestroy$)) .subscribe(([id, image, name, qty, price]) => { .subscribe(([id, image, name, qty, price, comment]) => { this.settingsSmartTable = { actions: false, selectMode: 'multi', Loading @@ -251,6 +255,10 @@ export class OrderProductsComponent implements OnInit, OnChanges, OnDestroy { renderComponent: ProductTitleRedirectComponent, type: 'custom', }, comment: { title: comment, width: '15%', }, qty: { title: qty, class: 'text-center', Loading
packages/admin-web-angular/src/app/pages/+warehouses/+warehouse/warehouse.component.ts +1 −1 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ export class WarehouseComponent implements OnDestroy, AfterViewInit, OnChanges { const modalRef: NgbModalRef = this.modalService.open( WarehouseOrderComponent, { size: 'lg', size: 'xl', container: 'nb-layout', windowClass: 'ng-custom', backdrop: 'static', Loading