From 3dc4bc39983b33fb0ab07ab2efe751f3c059822f Mon Sep 17 00:00:00 2001 From: Kaviya Periyasamy Date: Tue, 15 Jun 2021 10:49:33 +0530 Subject: [PATCH 1/5] update purchase order module --- .../manufacturing-routing.module.ts | 4 + .../manufacturing/manufacturing.component.ts | 1 + .../manufacturing/manufacturing.module.ts | 16 +- .../purchase-order-list.component.html | 12 + .../purchase-order-list.component.scss | 0 .../purchase-order-list.component.spec.ts | 25 ++ .../purchase-order-list.component.ts | 21 ++ .../purchase-order.component.html | 292 ++++++++++++++++++ .../purchase-order.component.scss | 3 + .../purchase-order.component.spec.ts | 25 ++ .../purchase-order.component.ts | 113 +++++++ 11 files changed, 509 insertions(+), 3 deletions(-) create mode 100644 src/app/modules/manufacturing/purchase-order/purchase-order-list/purchase-order-list.component.html create mode 100644 src/app/modules/manufacturing/purchase-order/purchase-order-list/purchase-order-list.component.scss create mode 100644 src/app/modules/manufacturing/purchase-order/purchase-order-list/purchase-order-list.component.spec.ts create mode 100644 src/app/modules/manufacturing/purchase-order/purchase-order-list/purchase-order-list.component.ts create mode 100644 src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.html create mode 100644 src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.scss create mode 100644 src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.spec.ts create mode 100644 src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.ts diff --git a/src/app/modules/manufacturing/manufacturing-routing.module.ts b/src/app/modules/manufacturing/manufacturing-routing.module.ts index bb4972f..a8cf7c1 100644 --- a/src/app/modules/manufacturing/manufacturing-routing.module.ts +++ b/src/app/modules/manufacturing/manufacturing-routing.module.ts @@ -3,6 +3,8 @@ import { RouterModule, Routes } from '@angular/router'; import { ManufacturingComponent } from './manufacturing.component'; import { NewdcComponent } from './newdc/newdc.component'; import { NewgrnComponent } from './newgrn/newgrn.component'; +import { PurchaseOrderListComponent } from './purchase-order/purchase-order-list/purchase-order-list.component'; +import { PurchaseOrderComponent } from './purchase-order/purchase-order/purchase-order.component'; import { ViewdcComponent } from './viewdc/viewdc.component'; import { ViewgrnComponent } from './viewgrn/viewgrn.component'; @@ -15,6 +17,8 @@ const routes: Routes = [ { path: 'viewdc', component: ViewdcComponent }, { path: 'newgrn', component: NewgrnComponent }, { path: 'viewgrn', component: ViewgrnComponent }, + { path: 'purchase-order/purchase-order-list', component: PurchaseOrderListComponent }, + { path: 'purchase-order/new-purchase-order', component: PurchaseOrderComponent }, { path: '', redirectTo: 'newdc', pathMatch: 'full' }, ], }, diff --git a/src/app/modules/manufacturing/manufacturing.component.ts b/src/app/modules/manufacturing/manufacturing.component.ts index c1b2e61..9da69f6 100644 --- a/src/app/modules/manufacturing/manufacturing.component.ts +++ b/src/app/modules/manufacturing/manufacturing.component.ts @@ -11,6 +11,7 @@ export class ManufacturingComponent implements OnInit { { name: 'View DC', path: '/home/mfg/viewdc' }, { name: 'New GRN', path: '/home/mfg/newgrn' }, { name: 'View GRN', path: '/home/mfg/viewgrn' }, + { name: 'Purchase Order', path: '/home/mfg/purchase-order/purchase-order-list' } ]; constructor() {} diff --git a/src/app/modules/manufacturing/manufacturing.module.ts b/src/app/modules/manufacturing/manufacturing.module.ts index ae60dea..fc89040 100644 --- a/src/app/modules/manufacturing/manufacturing.module.ts +++ b/src/app/modules/manufacturing/manufacturing.module.ts @@ -1,6 +1,5 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; - import { ManufacturingRoutingModule } from './manufacturing-routing.module'; import { ManufacturingComponent } from './manufacturing.component'; import { NewdcComponent } from './newdc/newdc.component'; @@ -8,6 +7,11 @@ import { ViewdcComponent } from './viewdc/viewdc.component'; import { NewgrnComponent } from './newgrn/newgrn.component'; import { ViewgrnComponent } from './viewgrn/viewgrn.component'; import { NavbarModule } from 'src/app/shared/navbar/navbar.module'; +import { PurchaseOrderListComponent } from './purchase-order/purchase-order-list/purchase-order-list.component'; +import { PurchaseOrderComponent } from './purchase-order/purchase-order/purchase-order.component'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgMultiSelectDropDownModule } from 'ng-multiselect-dropdown'; @NgModule({ @@ -16,12 +20,18 @@ import { NavbarModule } from 'src/app/shared/navbar/navbar.module'; NewdcComponent, ViewdcComponent, NewgrnComponent, - ViewgrnComponent + ViewgrnComponent, + PurchaseOrderListComponent, + PurchaseOrderComponent ], imports: [ CommonModule, ManufacturingRoutingModule, - NavbarModule + NavbarModule, + NgbModule, + ReactiveFormsModule, + FormsModule, + NgMultiSelectDropDownModule.forRoot() ] }) export class ManufacturingModule { } diff --git a/src/app/modules/manufacturing/purchase-order/purchase-order-list/purchase-order-list.component.html b/src/app/modules/manufacturing/purchase-order/purchase-order-list/purchase-order-list.component.html new file mode 100644 index 0000000..9dbbe19 --- /dev/null +++ b/src/app/modules/manufacturing/purchase-order/purchase-order-list/purchase-order-list.component.html @@ -0,0 +1,12 @@ + +
+
+
Purchase Order
+
+
+ +
+
\ No newline at end of file diff --git a/src/app/modules/manufacturing/purchase-order/purchase-order-list/purchase-order-list.component.scss b/src/app/modules/manufacturing/purchase-order/purchase-order-list/purchase-order-list.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/modules/manufacturing/purchase-order/purchase-order-list/purchase-order-list.component.spec.ts b/src/app/modules/manufacturing/purchase-order/purchase-order-list/purchase-order-list.component.spec.ts new file mode 100644 index 0000000..937e0be --- /dev/null +++ b/src/app/modules/manufacturing/purchase-order/purchase-order-list/purchase-order-list.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PurchaseOrderListComponent } from './purchase-order-list.component'; + +describe('PurchaseOrderListComponent', () => { + let component: PurchaseOrderListComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ PurchaseOrderListComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(PurchaseOrderListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/modules/manufacturing/purchase-order/purchase-order-list/purchase-order-list.component.ts b/src/app/modules/manufacturing/purchase-order/purchase-order-list/purchase-order-list.component.ts new file mode 100644 index 0000000..4dfbadf --- /dev/null +++ b/src/app/modules/manufacturing/purchase-order/purchase-order-list/purchase-order-list.component.ts @@ -0,0 +1,21 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; + +@Component({ + selector: 'app-purchase-order-list', + templateUrl: './purchase-order-list.component.html', + styleUrls: ['./purchase-order-list.component.scss'] +}) +export class PurchaseOrderListComponent implements OnInit { + + constructor(private router: Router) { } + + ngOnInit(): void { + } + navigateToPO(){ + var previous_url = this.router.url.substr(this.router.url.lastIndexOf('/') + 1) + '$'; + var current_url = this.router.url.replace( new RegExp(previous_url), 'new-purchase-order' ); + this.router.navigateByUrl(current_url); + } + +} diff --git a/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.html b/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.html new file mode 100644 index 0000000..54a2006 --- /dev/null +++ b/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.html @@ -0,0 +1,292 @@ + + +
+
+
New Purchase Order
+
+
+ +
+
+ +
+
+
+
+
+ + +
+
+ *Series is required. +
+
+
+
+ +
+ +
+ +
+
+
+
+ *Date is required. +
+
+
+
+ +
+
+ + +
+
+ *Supplier is required. +
+
+
+
+ + +
+
+ +
+
+ + + +
+
+ *Lot is required. +
+
+
+
+ + +
+
+
+
+
+ +
+
+ Item Details + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Item NameQtyRateAction
+ + + + + +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + +
Lot.No.QtyAction
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
DateLocationQtyAction
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+ Comments +
+
+
+
+ +
+
+
+
diff --git a/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.scss b/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.scss new file mode 100644 index 0000000..d3af4d6 --- /dev/null +++ b/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.scss @@ -0,0 +1,3 @@ +td { + word-break:break-all; + } \ No newline at end of file diff --git a/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.spec.ts b/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.spec.ts new file mode 100644 index 0000000..f1c76c2 --- /dev/null +++ b/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PurchaseOrderComponent } from './purchase-order.component'; + +describe('PurchaseOrderComponent', () => { + let component: PurchaseOrderComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ PurchaseOrderComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(PurchaseOrderComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.ts b/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.ts new file mode 100644 index 0000000..3e9554e --- /dev/null +++ b/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.ts @@ -0,0 +1,113 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { IDropdownSettings } from 'ng-multiselect-dropdown'; +import {NgbTypeahead} from '@ng-bootstrap/ng-bootstrap'; +import {Observable, Subject, merge, OperatorFunction} from 'rxjs'; +import {debounceTime, distinctUntilChanged, filter, map} from 'rxjs/operators'; +import { ToastService } from 'src/app/core/services/toast/toast.service'; + +const items = ['Test Item 1', + 'Test Item 2', + 'Test Item 3', + 'Test Item 4', + 'Test Item 5', + 'Test Item 6']; +@Component({ + selector: 'app-purchase-order', + templateUrl: './purchase-order.component.html', + styleUrls: ['./purchase-order.component.scss'] +}) +export class PurchaseOrderComponent implements OnInit { + poDetailsForm!: FormGroup; + itemCommentForm!: FormGroup; + itemDetailsSectionCollapsed = false; + rowCollapsed = false; + commentForm!: FormGroup; + lotDropdownSettings!: IDropdownSettings; + selectedLot = []; + lot_list = [ + { lot_id: 1, lot_text: 'LOT-0001' }, + { lot_id: 2, lot_text: 'LOT-0002' }, + { lot_id: 3, lot_text: 'LOT-0003' }, + { lot_id: 4, lot_text: 'LOT-0004' }, + { lot_id: 5, lot_text: 'LOT-0005' } + ]; + itemTableMapping: Array = []; + selectedItemRow: any = {}; + lotTableMapping: Array = []; + selectedLotRow: any = {}; + deliveryTableMapping: Array = []; + selectedDeliveryRow: any = {}; + + constructor(private fb: FormBuilder, public toast: ToastService) { + this.poDetailsForm = this.fb.group({ + series: ['', [Validators.required]], + po_date: ['', [Validators.required]], + supplier: ['', [Validators.required]], + supplier_address: ['', []], + lot: ['', [Validators.required]], + delivery_location: ['', []] + }); + this.commentForm = this.fb.group({ + comment: ['', []] + }); + } + + ngOnInit(): void { + this.lotDropdownSettings = { + singleSelection: false, + idField: 'lot_id', + textField: 'lot_text', + selectAllText: 'Select All', + unSelectAllText: 'UnSelect All', + itemsShowLimit: 3, + allowSearchFilter: true + }; + } + + @ViewChild('instance', { static: true }) + instance!: NgbTypeahead; + focus$ = new Subject(); + click$ = new Subject(); + + search: OperatorFunction = (text$: Observable) => { + const debouncedText$ = text$.pipe(debounceTime(200), distinctUntilChanged()); + const clicksWithClosedPopup$ = this.click$.pipe(filter(() => !this.instance.isPopupOpen())); + const inputFocus$ = this.focus$; + + return merge(debouncedText$, inputFocus$, clicksWithClosedPopup$).pipe( + map(term => (term === '' ? items + : items.filter(v => v.toLowerCase().indexOf(term.toLowerCase()) > -1)).slice(0, 10)) + ); + } + addItemTableRow() { + this.itemTableMapping.push(this.selectedItemRow) + this.selectedItemRow = {}; + } + addLotTableRow() { + this.lotTableMapping.push(this.selectedLotRow) + this.selectedLotRow = {}; + } + addDeliveryTableRow() { + this.deliveryTableMapping.push(this.selectedDeliveryRow) + this.selectedDeliveryRow = {}; + } + deleteItemTableRow(index: number) { + this.itemTableMapping.splice(index, 1); + } + deleteLotTableRow(index: number) { + this.lotTableMapping.splice(index, 1); + } + deleteDeliveryTableRow(index: number) { + this.deliveryTableMapping.splice(index, 1); + } + submitPo(){ + if (this.poDetailsForm.invalid) { + this.toast.showDanger('Please enter required details'); + return; + } + } + on_supplier_selection(e: any){ + this.poDetailsForm.controls['supplier_address'].setValue('123, Test Address'); + } +} \ No newline at end of file From 4b76663dad209449cc902b127cb9676fe6d5824d Mon Sep 17 00:00:00 2001 From: Kaviya Periyasamy Date: Tue, 15 Jun 2021 11:02:12 +0530 Subject: [PATCH 2/5] format code --- .../purchase-order.component.html | 342 +++++++++--------- .../purchase-order.component.ts | 12 +- 2 files changed, 177 insertions(+), 177 deletions(-) diff --git a/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.html b/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.html index 54a2006..6fc1950 100644 --- a/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.html +++ b/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.html @@ -1,12 +1,12 @@
-
-
New Purchase Order
-
-
- -
+
+
New Purchase Order
+
+
+ +
@@ -14,25 +14,25 @@
New Purchase Order
- - -
-
- *Series is required. -
-
+ + +
+
+ *Series is required. +
+
- -
- -
+ +
+ +
@@ -44,19 +44,19 @@
New Purchase Order
- - -
-
- *Supplier is required. -
-
+ + +
+
+ *Supplier is required. +
+
@@ -84,13 +84,13 @@
New Purchase Order
- +
@@ -146,133 +146,133 @@
New Purchase Order
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - + + + + + + + + - - - - - -
Lot.No.QtyAction
- - - - - -
+ + + +
+
+ + + + + + + + + + + + + + + - - - - - - -
Lot.No.QtyAction
+ + + + + +
- - - - - - - - - - - - - - - - - + + + + + + +
DateLocationQtyAction
- -
- -
-
- -
+ + + + + + + + + + + + + + + + + - - + + + + + + +
DateLocationQtyAction
+ +
+ +
+
+ +
- -
- +
+ +
+ +
+
+ +
+
+
-
- - -
- -
- -
- - + +
+ +
@@ -283,10 +283,10 @@
New Purchase Order
Comments
-
-
- -
-
-
+
+
+ +
+
+
diff --git a/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.ts b/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.ts index 3e9554e..cc5458b 100644 --- a/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.ts +++ b/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.ts @@ -6,12 +6,12 @@ import {Observable, Subject, merge, OperatorFunction} from 'rxjs'; import {debounceTime, distinctUntilChanged, filter, map} from 'rxjs/operators'; import { ToastService } from 'src/app/core/services/toast/toast.service'; -const items = ['Test Item 1', - 'Test Item 2', - 'Test Item 3', - 'Test Item 4', - 'Test Item 5', - 'Test Item 6']; +const items = [ 'Test Item 1', + 'Test Item 2', + 'Test Item 3', + 'Test Item 4', + 'Test Item 5', + 'Test Item 6']; @Component({ selector: 'app-purchase-order', templateUrl: './purchase-order.component.html', From f3c4c4f6356e8c526adf3b6bc8cb819dc61a057c Mon Sep 17 00:00:00 2001 From: Kaviya Periyasamy Date: Wed, 16 Jun 2021 10:13:42 +0530 Subject: [PATCH 3/5] update item master --- .../item/item-list/item-list.component.html | 12 + .../item/item-list/item-list.component.scss | 0 .../item-list/item-list.component.spec.ts | 25 + .../item/item-list/item-list.component.ts | 21 + .../master/item/item/item.component.html | 446 ++++++++++++++++++ .../master/item/item/item.component.scss | 3 + .../master/item/item/item.component.spec.ts | 25 + .../master/item/item/item.component.ts | 189 ++++++++ .../modules/master/master-routing.module.ts | 4 + src/app/modules/master/master.component.ts | 1 + src/app/modules/master/master.module.ts | 15 +- 11 files changed, 739 insertions(+), 2 deletions(-) create mode 100644 src/app/modules/master/item/item-list/item-list.component.html create mode 100644 src/app/modules/master/item/item-list/item-list.component.scss create mode 100644 src/app/modules/master/item/item-list/item-list.component.spec.ts create mode 100644 src/app/modules/master/item/item-list/item-list.component.ts create mode 100644 src/app/modules/master/item/item/item.component.html create mode 100644 src/app/modules/master/item/item/item.component.scss create mode 100644 src/app/modules/master/item/item/item.component.spec.ts create mode 100644 src/app/modules/master/item/item/item.component.ts diff --git a/src/app/modules/master/item/item-list/item-list.component.html b/src/app/modules/master/item/item-list/item-list.component.html new file mode 100644 index 0000000..4e11626 --- /dev/null +++ b/src/app/modules/master/item/item-list/item-list.component.html @@ -0,0 +1,12 @@ + +
+
+
Item
+
+
+ +
+
\ No newline at end of file diff --git a/src/app/modules/master/item/item-list/item-list.component.scss b/src/app/modules/master/item/item-list/item-list.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/modules/master/item/item-list/item-list.component.spec.ts b/src/app/modules/master/item/item-list/item-list.component.spec.ts new file mode 100644 index 0000000..20727f6 --- /dev/null +++ b/src/app/modules/master/item/item-list/item-list.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ItemListComponent } from './item-list.component'; + +describe('ItemListComponent', () => { + let component: ItemListComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ ItemListComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(ItemListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/modules/master/item/item-list/item-list.component.ts b/src/app/modules/master/item/item-list/item-list.component.ts new file mode 100644 index 0000000..7da2451 --- /dev/null +++ b/src/app/modules/master/item/item-list/item-list.component.ts @@ -0,0 +1,21 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; + +@Component({ + selector: 'app-item-list', + templateUrl: './item-list.component.html', + styleUrls: ['./item-list.component.scss'] +}) +export class ItemListComponent implements OnInit { + + constructor(private router: Router) { } + + ngOnInit(): void { + } + navigateToItem(){ + var previous_url = this.router.url.substr(this.router.url.lastIndexOf('/') + 1) + '$'; + var current_url = this.router.url.replace( new RegExp(previous_url), 'new-item' ); + this.router.navigateByUrl(current_url); + } + +} \ No newline at end of file diff --git a/src/app/modules/master/item/item/item.component.html b/src/app/modules/master/item/item/item.component.html new file mode 100644 index 0000000..68acd8b --- /dev/null +++ b/src/app/modules/master/item/item/item.component.html @@ -0,0 +1,446 @@ + + +
+
+
New Item
+
+
+ +
+
+ +
+
+ Item Details +
+
+
+
+
+ + +
+
+ *Item name is required. +
+
+
+
+ + + +
+
+ *Category is required. +
+
+
+
+
+
+ + +
+
+ *Default UOM is required. +
+
+
+ +
+ + +
+
+ *Default Attribute is required. +
+
+
+
+
+
+ + +
+
+
+ + +
+
+
+
+
+
+ +
+
+ Item Attribute Details + + + +
+
+ + + + + + + + + + + + + + + + + + + + +
AttributeAttribute ValueAction
+ + + + + + +
+ + + + + + +
+
+
+ +
+
+ Unit of Measure + + + +
+
+ + + + + + + + + + + + + + + + + + + + +
UOMConversion FactorAction
+ + + + + +
+ + + + + +
+
+
+ +
+
+ BOM Details + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Item NameQty of ProductQty of Required ItemAction
+ + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + +
Item Attribute ValueAccessory Attribute ValueAction
+ + + + + + + +
+ +
+
+ + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + +
Item Attribute ValueAccessory Attribute ValueAction
+ + + + + + + +
+ +
+
+
+
\ No newline at end of file diff --git a/src/app/modules/master/item/item/item.component.scss b/src/app/modules/master/item/item/item.component.scss new file mode 100644 index 0000000..d3af4d6 --- /dev/null +++ b/src/app/modules/master/item/item/item.component.scss @@ -0,0 +1,3 @@ +td { + word-break:break-all; + } \ No newline at end of file diff --git a/src/app/modules/master/item/item/item.component.spec.ts b/src/app/modules/master/item/item/item.component.spec.ts new file mode 100644 index 0000000..0516e6b --- /dev/null +++ b/src/app/modules/master/item/item/item.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ItemComponent } from './item.component'; + +describe('ItemComponent', () => { + let component: ItemComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ ItemComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(ItemComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/modules/master/item/item/item.component.ts b/src/app/modules/master/item/item/item.component.ts new file mode 100644 index 0000000..53976cc --- /dev/null +++ b/src/app/modules/master/item/item/item.component.ts @@ -0,0 +1,189 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { IDropdownSettings } from 'ng-multiselect-dropdown/multiselect.model'; +import {NgbTypeahead} from '@ng-bootstrap/ng-bootstrap'; +import {Observable, Subject, merge, OperatorFunction} from 'rxjs'; +import {debounceTime, distinctUntilChanged, filter, map} from 'rxjs/operators'; +import { ToastService } from 'src/app/core/services/toast/toast.service'; + +const items = ['Test Item 1', + 'Test Item 2', + 'Test Item 3', + 'Test Item 4', + 'Test Item 5', + 'Test Item 6']; +@Component({ + selector: 'app-item', + templateUrl: './item.component.html', + styleUrls: ['./item.component.scss'] +}) +export class ItemComponent implements OnInit { + itemDetailsForm!: FormGroup; + rowCollapsed = true; + bomDetailsSectionCollapsed = false; + itemAttrDetailsSectionCollapsed = false; + uomSectionCollapsed = false; + disableAttribute = true; + itemAttributeDetails: Array = []; + selectedItemAttributeRow: any = {}; + uomDetails: Array = []; + selectedUomRow: any = {}; + bomDetails: Array = []; + selectedBomRow: any = {}; + attributeMappings: Array = []; + selectedAttrMappingRow: any = {}; + category_list = [ + { category_id: 1, category_text: 'Raw Material' }, + { category_id: 2, category_text: 'Products' }, + { category_id: 3, category_text: 'Sub Assemblies' }, + { category_id: 4, category_text: 'Consumable' }, + { category_id: 5, category_text: 'Services' } + ]; + uom_list = [ + { uom_id: 1, uom_text: 'Nos' }, + { uom_id: 2, uom_text: 'Box' }, + { uom_id: 3, uom_text: 'Meter' }, + { uom_id: 4, uom_text: 'Unit' }, + { uom_id: 5, uom_text: 'Set' } + ]; + attribute_list = [ + { attr_id: 1, attr_text: 'Size' }, + { attr_id: 2, attr_text: 'Colour' }, + { attr_id: 3, attr_text: 'Part' }, + { attr_id: 4, attr_text: 'Dia' } + ]; + attribute_value_list = [ + { attr_val_id: 1, attr_val_text: 'S' }, + { attr_val_id: 2, attr_val_text: 'M' }, + { attr_val_id: 3, attr_val_text: 'L' }, + { attr_val_id: 4, attr_val_text: 'XL' } + ]; + categoryDropdownSettings!: IDropdownSettings; + selectedCategory = []; + uomDropdownSettings!: IDropdownSettings; + selectedUom = []; + attributeDropdownSettings!: IDropdownSettings; + selectedAttribute = []; + attributeValueDropdownSettings!: IDropdownSettings; + selected_attr = '' + selected_attr_value = [] + + constructor(private fb: FormBuilder, public toast: ToastService) { + this.itemDetailsForm = this.fb.group({ + item_name: ['', [Validators.required]], + category: ['', [Validators.required]], + hsn_code: ['', []], + disabled: ['', []], + default_uom: ['', [Validators.required]], + default_attribute: ['', [Validators.required]] + }); + } + + ngOnInit(): void { + this.categoryDropdownSettings = { + singleSelection: false, + idField: 'category_id', + textField: 'category_text', + selectAllText: 'Select All', + unSelectAllText: 'UnSelect All', + itemsShowLimit: 3, + allowSearchFilter: true + }; + this.uomDropdownSettings = { + singleSelection: false, + idField: 'uom_id', + textField: 'uom_text', + selectAllText: 'Select All', + unSelectAllText: 'UnSelect All', + itemsShowLimit: 3, + allowSearchFilter: true + }; + this.attributeDropdownSettings = { + singleSelection: false, + idField: 'attr_id', + textField: 'attr_text', + selectAllText: 'Select All', + unSelectAllText: 'UnSelect All', + itemsShowLimit: 3, + allowSearchFilter: true + }; + this.attributeValueDropdownSettings = { + singleSelection: false, + idField: 'attr_val_id', + textField: 'attr_val_text', + selectAllText: 'Select All', + unSelectAllText: 'UnSelect All', + itemsShowLimit: 3, + allowSearchFilter: true + }; + } + @ViewChild('instance', { static: true }) + instance!: NgbTypeahead; + focus$ = new Subject(); + click$ = new Subject(); + + search: OperatorFunction = (text$: Observable) => { + const debouncedText$ = text$.pipe(debounceTime(200), distinctUntilChanged()); + const clicksWithClosedPopup$ = this.click$.pipe(filter(() => !this.instance.isPopupOpen())); + const inputFocus$ = this.focus$; + + return merge(debouncedText$, inputFocus$, clicksWithClosedPopup$).pipe( + map(term => (term === '' ? items + : items.filter(v => v.toLowerCase().indexOf(term.toLowerCase()) > -1)).slice(0, 10)) + ); + } + on_attribute_selection(e: any){ + this.disableAttribute = false + if(e.target.value == 'Size'){ + this.attribute_value_list = [ + { attr_val_id: 1, attr_val_text: 'S' }, + { attr_val_id: 2, attr_val_text: 'M' }, + { attr_val_id: 3, attr_val_text: 'L' }, + { attr_val_id: 4, attr_val_text: 'XL' } + ]; + } + if(e.target.value == 'Colour'){ + this.attribute_value_list = [ + { attr_val_id: 1, attr_val_text: 'Red' }, + { attr_val_id: 2, attr_val_text: 'Green' }, + { attr_val_id: 3, attr_val_text: 'Blue' }, + { attr_val_id: 4, attr_val_text: 'White' } + ]; + } + } + addAttributeDetails() { + this.itemAttributeDetails.push(this.selectedItemAttributeRow) + this.selectedItemAttributeRow = {}; + } + deleteAttributeDetails(index: number) { + this.itemAttributeDetails.splice(index, 1); + } + addUomDetails() { + this.uomDetails.push(this.selectedUomRow) + this.selectedUomRow = {}; + } + deleteUomDetails(index: number) { + this.uomDetails.splice(index, 1); + } + addBomDetails() { + this.selectedBomRow['expanded'] = false + this.bomDetails.push(this.selectedBomRow) + this.selectedBomRow = {}; + } + deleteBomDetails(index: number) { + this.bomDetails.splice(index, 1); + } + addAttributeMapping() { + this.attributeMappings.push(this.selectedAttrMappingRow) + this.selectedAttrMappingRow = {}; + } + deleteAttributeMapping(index: number) { + this.attributeMappings.splice(index, 1); + } + saveItem(){ + if (this.itemDetailsForm.invalid) { + this.toast.showDanger('Please enter required details'); + return; + } + } +} \ No newline at end of file diff --git a/src/app/modules/master/master-routing.module.ts b/src/app/modules/master/master-routing.module.ts index e92b7bd..362aad6 100644 --- a/src/app/modules/master/master-routing.module.ts +++ b/src/app/modules/master/master-routing.module.ts @@ -1,5 +1,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { ItemListComponent } from './item/item-list/item-list.component'; +import { ItemComponent } from './item/item/item.component'; import { MasterComponent } from './master.component'; import { SupplierComponent } from './supplier/supplier.component'; @@ -9,6 +11,8 @@ const routes: Routes = [ component: MasterComponent, children: [ { path: 'supplier', component: SupplierComponent }, + { path: 'item/item-list', component: ItemListComponent }, + { path: 'item/new-item', component: ItemComponent }, { path: '', redirectTo: 'supplier', pathMatch: 'full'} ] } diff --git a/src/app/modules/master/master.component.ts b/src/app/modules/master/master.component.ts index 863606a..620549f 100644 --- a/src/app/modules/master/master.component.ts +++ b/src/app/modules/master/master.component.ts @@ -8,6 +8,7 @@ import { Component, OnInit } from '@angular/core'; export class MasterComponent implements OnInit { links = [ { name: 'Supplier', path: '/home/master/supplier' }, + { name: 'Item', path: '/home/master/item/item-list' } ]; constructor() {} diff --git a/src/app/modules/master/master.module.ts b/src/app/modules/master/master.module.ts index 3072b7e..48bc4b7 100644 --- a/src/app/modules/master/master.module.ts +++ b/src/app/modules/master/master.module.ts @@ -5,17 +5,28 @@ import { MasterRoutingModule } from './master-routing.module'; import { MasterComponent } from './master.component'; import { SupplierComponent } from './supplier/supplier.component'; import { NavbarModule } from 'src/app/shared/navbar/navbar.module'; +import { ItemListComponent } from './item/item-list/item-list.component'; +import { ItemComponent } from './item/item/item.component'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { NgMultiSelectDropDownModule } from 'ng-multiselect-dropdown'; @NgModule({ declarations: [ MasterComponent, - SupplierComponent + SupplierComponent, + ItemListComponent, + ItemComponent ], imports: [ CommonModule, MasterRoutingModule, - NavbarModule + NavbarModule, + NgbModule, + FormsModule, + ReactiveFormsModule, + NgMultiSelectDropDownModule.forRoot() ] }) export class MasterModule { } From b3e643ee74ace6f39c1eae1e644685218ae9fad6 Mon Sep 17 00:00:00 2001 From: Kaviya Periyasamy Date: Wed, 16 Jun 2021 10:16:39 +0530 Subject: [PATCH 4/5] format doc --- .../master/item/item/item.component.html | 404 +++++++++--------- 1 file changed, 200 insertions(+), 204 deletions(-) diff --git a/src/app/modules/master/item/item/item.component.html b/src/app/modules/master/item/item/item.component.html index 68acd8b..5d38a68 100644 --- a/src/app/modules/master/item/item/item.component.html +++ b/src/app/modules/master/item/item/item.component.html @@ -6,7 +6,7 @@
New Item
-
+
@@ -18,8 +18,10 @@
New Item
- -
+ +
*Item name is required.
@@ -27,24 +29,22 @@
New Item
- - -
+ + +
*Category is required.
-
+
- @@ -52,27 +52,30 @@
New Item
-
-
- *Default UOM is required. +
+
+ *Default UOM is required. +
-
- +
- -
+
*Default Attribute is required.
-
+
@@ -92,14 +95,15 @@
New Item
-
- Item Attribute Details +
+ Item Attribute Details
-
+
@@ -111,8 +115,8 @@
New Item
@@ -164,9 +163,9 @@
New Item
-
- Unit of Measure +
+ Unit of Measure @@ -183,7 +182,7 @@
New Item
@@ -209,10 +210,12 @@
New Item
@@ -222,15 +225,16 @@
New Item
-
- BOM Details +
+ BOM Details
-
-
- @@ -121,23 +125,20 @@
New Item
- - + + - +
- @@ -146,16 +147,14 @@
New Item
- + - +
- @@ -192,10 +191,12 @@
New Item
- + - +
- + - +
+
+
@@ -242,37 +246,33 @@
New Item
- - - - + + + + - + - + - + - - - + + +
Item Name
- - - - - - - + + + + + + +
- @@ -292,154 +292,150 @@
New Item
Action
- + - + - +
- - + + + + + + +
- + - + + [(ngModel)]="selectedBomRow.product_qty" autofocus /> - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Item Attribute ValueAccessory Attribute ValueAction
- - - - - - - -
- -
- - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Item Attribute ValueAccessory Attribute ValueAction
+ + + + + + + +
+ + + + + + +
+ + +
From 7682bf2a9b18c1ad31c4d2310050b666839b4569 Mon Sep 17 00:00:00 2001 From: Kaviya Periyasamy Date: Wed, 16 Jun 2021 10:41:36 +0530 Subject: [PATCH 5/5] table row expandable fixes --- .../purchase-order.component.html | 402 ++++++++++++------ .../purchase-order.component.ts | 3 +- 2 files changed, 283 insertions(+), 122 deletions(-) diff --git a/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.html b/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.html index 6fc1950..8cfc25d 100644 --- a/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.html +++ b/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.html @@ -15,11 +15,12 @@
New Purchase Order
- -
+
*Series is required.
@@ -28,31 +29,35 @@
New Purchase Order
- +
- +
-
+
*Date is required.
-
+
- -
+
*Supplier is required.
@@ -60,8 +65,8 @@
New Purchase Order
-
@@ -69,14 +74,11 @@
New Purchase Order
- + -
+
*Lot is required.
@@ -84,28 +86,29 @@
New Purchase Order
- -
+
-
- Item Details +
+ Item Details
-
+
@@ -113,60 +116,190 @@
New Purchase Order
- - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - + - - - + + +
Qty Rate Action
- - - - - -
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + +
Lot.No.QtyAction
+ + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
DateLocationQtyAction
+
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+
+
+
- + + + + - -
@@ -180,10 +313,11 @@
New Purchase Order
Action
- @@ -192,23 +326,30 @@
New Purchase Order
- + - +
@@ -222,52 +363,71 @@
New Purchase Order
Action - + -
- -
- + +
+ +
+ +
-
- - + + + - + -
- -
- + +
+ +
+ +
-
- - - + + + + +
- +
@@ -279,14 +439,14 @@
New Purchase Order
-
- Comments +
+ Comments
- +
-
+
\ No newline at end of file diff --git a/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.ts b/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.ts index cc5458b..e2cbf24 100644 --- a/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.ts +++ b/src/app/modules/manufacturing/purchase-order/purchase-order/purchase-order.component.ts @@ -21,7 +21,7 @@ export class PurchaseOrderComponent implements OnInit { poDetailsForm!: FormGroup; itemCommentForm!: FormGroup; itemDetailsSectionCollapsed = false; - rowCollapsed = false; + rowCollapsed = true; commentForm!: FormGroup; lotDropdownSettings!: IDropdownSettings; selectedLot = []; @@ -81,6 +81,7 @@ export class PurchaseOrderComponent implements OnInit { ); } addItemTableRow() { + this.selectedItemRow['expanded'] = false this.itemTableMapping.push(this.selectedItemRow) this.selectedItemRow = {}; }