Skip to content

Commit 5339db6

Browse files
authored
Merge pull request #18 from NSTMS/frontend-development
Frontend development
2 parents b2d64a9 + 1d1abbc commit 5339db6

72 files changed

Lines changed: 1699 additions & 78 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

wms-praktyki-yosi-frontend/src/app/Components/document-pages/add-document/add-document.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ export class AddDocumentComponent {
3535
id: ++this.counter
3636
}
3737
)
38-
3938
}
39+
4040
handleDeleteItem(id : number){
4141
this.data.itemList =this.data.itemList.filter(i => i.id !== id)
4242
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<h1 mat-dialog-title>Put back product</h1>
2+
<div mat-dialog-content>
3+
<mat-form-field appearance="fill" floatLabel="always">
4+
<mat-label>Quantity planned</mat-label>
5+
<input matInput type="number" class="example-right-align" min="0" placeholder=data.quantityPlaned [(ngModel)]="data.quantityDone">
6+
</mat-form-field>
7+
<mat-form-field appearance="fill">
8+
<mat-label>Position</mat-label>
9+
<input matInput class="example-right-align" placeholder="A1/B" [(ngModel)]="data.position">
10+
</mat-form-field>
11+
<mat-form-field appearance="fill">
12+
<mat-label>Tag</mat-label>
13+
<input matInput [(ngModel)]="data.tag">
14+
</mat-form-field>
15+
</div>
16+
<div mat-dialog-actions>
17+
<button mat-button mat-raised-button (click)="onNoClick()" color="primary">close</button>
18+
<button mat-button mat-raised-button [mat-dialog-close]="data" cdkFocusInitial color="accent">sumbit</button>
19+
</div>

wms-praktyki-yosi-frontend/src/app/Components/document-pages/edit-document/edit-document.component.scss renamed to wms-praktyki-yosi-frontend/src/app/Components/document-pages/dialogs/putback-dialog/putback-dialog.component.scss

File renamed without changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { PutbackDialogComponent } from './putback-dialog.component';
4+
5+
describe('PutbackDialogComponent', () => {
6+
let component: PutbackDialogComponent;
7+
let fixture: ComponentFixture<PutbackDialogComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [ PutbackDialogComponent ]
12+
})
13+
.compileComponents();
14+
15+
fixture = TestBed.createComponent(PutbackDialogComponent);
16+
component = fixture.componentInstance;
17+
fixture.detectChanges();
18+
});
19+
20+
it('should create', () => {
21+
expect(component).toBeTruthy();
22+
});
23+
});
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Component,Inject } from '@angular/core';
2+
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
3+
import { documentItem } from '@static/types/documentTypes';
4+
5+
@Component({
6+
selector: 'app-putback-dialog',
7+
templateUrl: './putback-dialog.component.html',
8+
styleUrls: ['./putback-dialog.component.scss']
9+
})
10+
export class PutbackDialogComponent {
11+
constructor(
12+
public dialogRef: MatDialogRef<PutbackDialogComponent>,
13+
@Inject(MAT_DIALOG_DATA) public data: documentItem,
14+
) {
15+
console.log(this.data);
16+
17+
}
18+
19+
onNoClick(): void {
20+
this.dialogRef.close();
21+
}
22+
23+
}

wms-praktyki-yosi-frontend/src/app/Components/document-pages/edit-document/edit-document.component.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

wms-praktyki-yosi-frontend/src/app/Components/document-pages/edit-document/edit-document.component.spec.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

wms-praktyki-yosi-frontend/src/app/Components/document-pages/edit-document/edit-document.component.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

wms-praktyki-yosi-frontend/src/app/Components/document-pages/info-document/info-document.component.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@
104104
</button>
105105
</mat-cell>
106106
</ng-container>
107+
<ng-container matColumnDef="putback" *ngIf="canAddAndDel">
108+
<mat-header-cell *matHeaderCellDef></mat-header-cell>
109+
<mat-cell *matCellDef="let document"
110+
><button mat-flat-button color="warn" (click)="handlePutBack(document.id)">
111+
put back
112+
</button>
113+
</mat-cell>
114+
</ng-container>
107115
<ng-container matColumnDef="edit" *ngIf="canAddAndDel">
108116
<mat-header-cell *matHeaderCellDef></mat-header-cell>
109117
<mat-cell *matCellDef="let document"

wms-praktyki-yosi-frontend/src/app/Components/document-pages/info-document/info-document.component.ts

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ import { MatPaginator } from '@angular/material/paginator';
33
import { MatTableDataSource } from '@angular/material/table';
44
import { ActivatedRoute, Router } from '@angular/router';
55
import { DocumentsService } from '@app/Services/fetching-services/documents.service';
6-
import { detailedDocument, documentItem,EditDialogData, ItemToSend, visitedElement } from '@static/types/documentTypes';
7-
import {
8-
MatDialog,
9-
} from '@angular/material/dialog';
6+
import { detailedDocument, documentItem,EditDialogData} from '@static/types/documentTypes';
7+
import {MatDialog} from '@angular/material/dialog';
108
import { EditDialogComponent } from '../dialogs/edit-dialog/edit-dialog.component';
119
import { VisitDialogComponent } from '../dialogs/visit-dialog/visit-dialog.component';
1210
import { AddDialogComponent } from '../dialogs/add-dialog/add-dialog.component';
11+
import { PutbackDialogComponent } from '../dialogs/putback-dialog/putback-dialog.component';
1312

1413
@Component({
1514
selector: 'app-info-document',
@@ -54,7 +53,7 @@ export class InfoDocumentComponent {
5453
this.canAddAndDel = localStorage.getItem('role') != 'User';
5554

5655
if (this.canAddAndDel)
57-
this.displayedColumns = [...this.columns, 'visit', 'edit', 'delete'];
56+
this.displayedColumns = [...this.columns, 'visit','putback', 'edit', 'delete'];
5857
else this.displayedColumns = [...this.columns];
5958
}
6059

@@ -117,6 +116,10 @@ export class InfoDocumentComponent {
117116
}
118117
}
119118
})
119+
dialogRef.backdropClick().subscribe(() =>{
120+
window.location.reload()
121+
})
122+
120123
}
121124

122125
handleVisit(guid: string) {
@@ -138,12 +141,36 @@ export class InfoDocumentComponent {
138141
quantity : result.quantityDone,
139142
tag : result.tag
140143
}
141-
console.log(result);
142-
144+
143145
await this._service.VisitLocation(this.id, res);
144146
window.location.reload()
145147
}
146148
})
147149
});
148150
}
151+
handlePutBack(guid: string){
152+
const dialogData = this.data.items.filter(d=> d.id == guid)[0] as documentItem
153+
const dialogRef = this.dialog.open(PutbackDialogComponent, {
154+
data: {...dialogData}
155+
})
156+
dialogRef.backdropClick().subscribe(() =>{
157+
window.location.reload()
158+
})
159+
dialogRef.afterClosed().subscribe(result=> {
160+
this.data.items.map(async v =>{
161+
if(v.id == guid)
162+
{
163+
const res =
164+
{
165+
productName : result.productName,
166+
position : result.position,
167+
quantity : result.quantityDone,
168+
tag : result.tag
169+
}
170+
await this._service.PutBackToLocation(this.id, res);
171+
window.location.reload()
172+
}
173+
})
174+
});
175+
}
149176
}

0 commit comments

Comments
 (0)