mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
[HIMA-328] implementation updates because of the library changes
This commit is contained in:
@@ -109,7 +109,7 @@ export function _feedServiceEndpointProviderFactory(conf: ConfigService) {
|
||||
clockwise: true
|
||||
}),
|
||||
RemissionModule.forRoot({
|
||||
useMock: false,
|
||||
useMock: true,
|
||||
endpoints: {
|
||||
catsearch: 'https://isa.paragon-data.de/catsearch/v5/',
|
||||
remi: 'https://isa.paragon-data.de/inv/v1/',
|
||||
|
||||
@@ -22,7 +22,7 @@ import { ReloadGoodsIn } from '../actions/goods-in.actions';
|
||||
import { ReloadBranchProcess } from '../actions/branch-process.actions';
|
||||
import { ReloadRemission } from '../actions/remission.actions';
|
||||
|
||||
export const SYNC_DATA_VERSION = 63;
|
||||
export const SYNC_DATA_VERSION = 77;
|
||||
|
||||
export class AppStateModel {
|
||||
currentProcesssId: number;
|
||||
|
||||
@@ -292,7 +292,6 @@ export class RemissionFilterItemComponent implements OnInit, OnDestroy {
|
||||
const options = document.getElementById('options');
|
||||
if (options) {
|
||||
const height = options.getBoundingClientRect().height;
|
||||
console.log('SetFilterHeight: ' + height);
|
||||
this.remissionHelper.setFilterHeight(height);
|
||||
} else {
|
||||
this.remissionHelper.setFilterHeight(0);
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<span>{{ product.ean }}</span>
|
||||
</div>
|
||||
<div class="price item">
|
||||
<span class="value">{{ product.price }}</span>
|
||||
<span class="value">{{ product.price | bookPrice }}</span>
|
||||
<span class="currency">{{ product.currency }}</span>
|
||||
</div>
|
||||
<div class="feature-tooltip" [style.marginLeft.px]="tooltipMl" *ngIf="toolTipOpened">
|
||||
@@ -54,9 +54,9 @@
|
||||
<lib-icon (click)="closeTooltip()" height="11px" name="Delete-white"></lib-icon>
|
||||
</div>
|
||||
<div class="feature-tooltip-arrow-down" [style.marginLeft.px]="tooltipArrowMl" *ngIf="toolTipOpened"></div>
|
||||
<div class="features item">
|
||||
<span *ngFor="let feature of product.features; let index = index" (click)="openTooltip(feature.name, index)">{{
|
||||
feature.key
|
||||
<div class="features item" *ngIf="isArray(product.features)">
|
||||
<span *ngFor="let feature of product.features; let index = index" (click)="openTooltip(getObjectValue(feature, 0), index)">{{
|
||||
getObjectKey(feature, 0)
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -110,13 +110,12 @@
|
||||
}
|
||||
|
||||
.feature-tooltip {
|
||||
position: absolute;
|
||||
background-color: #5a728a;
|
||||
margin-top: 30px;
|
||||
margin-left: -10px;
|
||||
margin-top: -56px;
|
||||
color: #ffffff;
|
||||
padding: 12px;
|
||||
border-radius: 5px;
|
||||
width: fit-content;
|
||||
|
||||
lib-icon {
|
||||
margin-left: 5px;
|
||||
@@ -125,14 +124,12 @@
|
||||
}
|
||||
|
||||
.feature-tooltip-arrow-down {
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-left: 10px solid transparent;
|
||||
border-right: 10px solid transparent;
|
||||
border-top: 10px solid #5a728a;
|
||||
margin-top: 75px;
|
||||
margin-left: 5px;
|
||||
margin-top: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,8 +77,10 @@ export class RemissionListCardStartedComponent implements OnInit {
|
||||
}
|
||||
|
||||
remit() {
|
||||
if (this.product.remissionQuantity < 1) {
|
||||
return;
|
||||
}
|
||||
const currentShippingDocument = this.store.selectSnapshot(RemissionSelectors.getRemissionShippingDocument);
|
||||
console.log(this.product);
|
||||
this.remissionService
|
||||
.addProductToShippingDocument({
|
||||
remissionProcessId: this.remissionProcess.id,
|
||||
@@ -94,6 +96,9 @@ export class RemissionListCardStartedComponent implements OnInit {
|
||||
}
|
||||
|
||||
remitPartially(partialRemission: { quantity: number; placementType: string }) {
|
||||
if (this.product.remissionQuantity < 1) {
|
||||
return;
|
||||
}
|
||||
const currentShippingDocument = this.store.selectSnapshot(RemissionSelectors.getRemissionShippingDocument);
|
||||
this.remissionService
|
||||
.addProductToShippingDocument({
|
||||
@@ -113,6 +118,18 @@ export class RemissionListCardStartedComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
isArray(obj) {
|
||||
return Array.isArray(obj);
|
||||
}
|
||||
|
||||
getObjectKey(obj, index) {
|
||||
return Object.keys(obj)[index];
|
||||
}
|
||||
|
||||
getObjectValue(obj, index) {
|
||||
return obj[Object.keys(obj)[index]];
|
||||
}
|
||||
|
||||
detectChanges() {
|
||||
setTimeout(() => {
|
||||
if (this.cdr !== null && this.cdr !== undefined && !(this.cdr as ViewRef_).destroyed) {
|
||||
|
||||
@@ -37,16 +37,17 @@ export class RemissionListComponent implements OnInit, OnDestroy {
|
||||
page = 0;
|
||||
pageSize = 10;
|
||||
totalHits = 0;
|
||||
isItRefetch = false;
|
||||
|
||||
constructor(private remissionService: RemissionService, private remissionHelper: RemissionHelperService) {}
|
||||
|
||||
ngOnInit() {
|
||||
console.log('list init');
|
||||
this.subscribeToFilterHeightChanges();
|
||||
this.subcribeToFilterUpdates();
|
||||
// this.subscribeToListChanges();
|
||||
this.subscribeToRemissionProducts();
|
||||
this.fetchProductPaged(this.page).toPromise();
|
||||
this.subscribeToListChanges();
|
||||
this.fetchProductPaged(this.page).subscribe(data => {
|
||||
this.subscribeToRemissionProducts();
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
@@ -74,27 +75,15 @@ export class RemissionListComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
deleteRemissionProduct = (remissionProduct: RemissionProduct) => {
|
||||
const indexOfItemToDelete = this.products.findIndex(product => product.id === remissionProduct.id);
|
||||
this.products.splice(indexOfItemToDelete, 1);
|
||||
this.totalHits -= 1;
|
||||
this.remissionHelper.setRemissionListHits(this.totalHits);
|
||||
this.refetchLoadedProducts(-1);
|
||||
};
|
||||
|
||||
updateRemissionProduct = (changes: { quantity: number; product: RemissionProduct }) => {
|
||||
const indexOfItemToUpdate = this.products.findIndex(product => product.id === changes.product.id);
|
||||
const updatedProduct = { ...changes.product, remissionQuantity: changes.product.remissionQuantity - changes.quantity };
|
||||
this.products.splice(indexOfItemToUpdate, 1, ...[updatedProduct]);
|
||||
this.refetchLoadedProducts(0);
|
||||
};
|
||||
|
||||
addRemissionProduct = (remissionProduct: RemissionProduct) => {
|
||||
const existingItemIndex = this.products.findIndex(product => product.ean === remissionProduct.ean);
|
||||
if (existingItemIndex !== -1) {
|
||||
this.products[existingItemIndex].remissionQuantity += remissionProduct.remissionQuantity;
|
||||
} else {
|
||||
this.products.push(remissionProduct);
|
||||
this.totalHits += 1;
|
||||
this.remissionHelper.setRemissionListHits(this.totalHits);
|
||||
}
|
||||
this.refetchLoadedProducts(1);
|
||||
};
|
||||
|
||||
subcribeToFilterUpdates() {
|
||||
@@ -107,8 +96,6 @@ export class RemissionListComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
filtersUpdatedHandler = (updates: UpdateFilter) => {
|
||||
console.log('filters remission process: ', this.remissionProcess);
|
||||
console.log('filters: ', updates);
|
||||
const changes = <RemissionFilter>{
|
||||
skip: 0,
|
||||
take: this.pageSize
|
||||
@@ -134,7 +121,6 @@ export class RemissionListComponent implements OnInit, OnDestroy {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('filters updated with: ', changes);
|
||||
this.remissionService
|
||||
.updateRemissionFilter({
|
||||
remissionProcessId: this.remissionProcess.id,
|
||||
@@ -150,7 +136,6 @@ export class RemissionListComponent implements OnInit, OnDestroy {
|
||||
takeUntil(this.destroy$)
|
||||
)
|
||||
.subscribe(height => {
|
||||
console.log('Height:', height);
|
||||
if (height === 0 || height < 810) {
|
||||
this.containerHeight = 0;
|
||||
} else {
|
||||
@@ -160,27 +145,38 @@ export class RemissionListComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
onScrollDown() {
|
||||
console.log('scrolled down!!');
|
||||
this.page += 1;
|
||||
this.fetchProductPaged(this.page).toPromise();
|
||||
}
|
||||
|
||||
onUp() {
|
||||
console.log('scrolled up!');
|
||||
}
|
||||
onUp() {}
|
||||
|
||||
fetchProductPaged(page: number) {
|
||||
console.log(page);
|
||||
return this.remissionService
|
||||
.updateRemissionFilter({
|
||||
remissionProcessId: this.remissionProcess.id,
|
||||
changes: { skip: page * this.pageSize, take: this.pageSize }
|
||||
})
|
||||
.pipe(
|
||||
filter(data => !isNullOrUndefined(data)),
|
||||
take(1),
|
||||
catchError(error => {
|
||||
console.error(error);
|
||||
return of(undefined);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
refetchLoadedProducts(lengthChange: number) {
|
||||
this.isItRefetch = true;
|
||||
return this.remissionService
|
||||
.updateRemissionFilter({
|
||||
remissionProcessId: this.remissionProcess.id,
|
||||
changes: { skip: 0, take: this.products.length + lengthChange }
|
||||
})
|
||||
.pipe(
|
||||
filter(data => !isNullOrUndefined(data)),
|
||||
take(1),
|
||||
tap(data => {
|
||||
console.log('remission filter', data);
|
||||
}),
|
||||
catchError(error => {
|
||||
console.error(error);
|
||||
return of(undefined);
|
||||
@@ -189,7 +185,6 @@ export class RemissionListComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
subscribeToRemissionProducts() {
|
||||
console.log('subscribed to products');
|
||||
this.remissionService
|
||||
.getRemissionProducts({ remissionProcessId: this.remissionProcess.id })
|
||||
.pipe(
|
||||
@@ -197,17 +192,19 @@ export class RemissionListComponent implements OnInit, OnDestroy {
|
||||
takeUntil(this.destroy$)
|
||||
)
|
||||
.subscribe((result: { skip?: number; take?: number; hits?: number; items: RemissionProduct[]; completed: boolean }) => {
|
||||
console.log('get products emit: ', this.page, result);
|
||||
if (this.page === 0 || result.skip === 0) {
|
||||
this.products = [];
|
||||
}
|
||||
this.totalHits = result.hits;
|
||||
this.remissionHelper.setRemissionListHits(result.hits);
|
||||
console.log('pushed: ', result.items);
|
||||
if (result.items && result.items.length > 0) {
|
||||
this.products.push(...result.items);
|
||||
if (!this.isItRefetch) {
|
||||
this.products.push(...result.items);
|
||||
} else {
|
||||
this.products.splice(result.skip, result.items.length, ...result.items);
|
||||
this.isItRefetch = false;
|
||||
}
|
||||
}
|
||||
console.log('Complete list', this.products);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,10 +41,8 @@ export class RemissionShippingDocumentComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
currentShippingDocumentStatusSubscriptionhandler = (status: boolean) => {
|
||||
console.log('shipping document status:', status);
|
||||
const shippingDocument$ = !status ? this.createShippingDocument$() : this.continueExistingShippingDocument();
|
||||
shippingDocument$.toPromise().then(shippingDocument => {
|
||||
console.log('shipping document ready for fetching', shippingDocument);
|
||||
this.shippingDocumentSubscriptionHandler(shippingDocument);
|
||||
this.remissionService
|
||||
.getShippingDocuments({
|
||||
@@ -60,12 +58,10 @@ export class RemissionShippingDocumentComponent implements OnInit, OnDestroy {
|
||||
};
|
||||
|
||||
continueExistingShippingDocument() {
|
||||
console.log('shipping document continued');
|
||||
return this.store.selectOnce(RemissionSelectors.getRemissionShippingDocument);
|
||||
}
|
||||
|
||||
createShippingDocument$(): Observable<ShippingDocument> {
|
||||
console.log('shipping document create called');
|
||||
let params: {
|
||||
remissionProcessId: number;
|
||||
shippingDocumentId?: number;
|
||||
@@ -83,7 +79,6 @@ export class RemissionShippingDocumentComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
shippingDocumentSubscriptionHandler = (shippingDocument: ShippingDocument) => {
|
||||
console.log('shipping document', shippingDocument);
|
||||
this.shippingDocument = shippingDocument;
|
||||
if (shippingDocument.products && shippingDocument.products.length > 0) {
|
||||
this.activeShippingDocument.emit(true);
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<p>
|
||||
remission-to-top-to-bottom-actions works!
|
||||
</p>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RemissionToTopToBottomActionsComponent } from './remission-to-top-to-bottom-actions.component';
|
||||
|
||||
describe('RemissionToTopToBottomActionsComponent', () => {
|
||||
let component: RemissionToTopToBottomActionsComponent;
|
||||
let fixture: ComponentFixture<RemissionToTopToBottomActionsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ RemissionToTopToBottomActionsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(RemissionToTopToBottomActionsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-remission-to-top-to-bottom-actions',
|
||||
templateUrl: './remission-to-top-to-bottom-actions.component.html',
|
||||
styleUrls: ['./remission-to-top-to-bottom-actions.component.scss']
|
||||
})
|
||||
export class RemissionToTopToBottomActionsComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -165,7 +165,6 @@ export class RemissionListCreateComponent implements OnInit, OnDestroy, AfterVie
|
||||
}
|
||||
|
||||
continueProcess() {
|
||||
console.log('process continued');
|
||||
return this.loadCurrentRemissionProcess().pipe(
|
||||
take(1),
|
||||
switchMap(remissionProcess => {
|
||||
@@ -182,7 +181,6 @@ export class RemissionListCreateComponent implements OnInit, OnDestroy, AfterVie
|
||||
};
|
||||
|
||||
createProcess() {
|
||||
console.log('process created');
|
||||
return this.remissionService.createProcess().pipe(tap(this.remissionCreatedSuccesfullyHandler));
|
||||
}
|
||||
|
||||
@@ -206,7 +204,6 @@ export class RemissionListCreateComponent implements OnInit, OnDestroy, AfterVie
|
||||
};
|
||||
|
||||
remisionProcessSubscriptionHandler = (remissionProcess: RemissionProcess) => {
|
||||
console.log(JSON.stringify(remissionProcess));
|
||||
this.remissionProcess = remissionProcess;
|
||||
(!isNullOrUndefined(remissionProcess.capacities)).ifTrue(() => this.capacitiesBinder(remissionProcess.capacities));
|
||||
this.processNeedsToBeRestoredFromCache.ifTrue(() => this.restoreProcess());
|
||||
|
||||
@@ -169,7 +169,6 @@ export class RemissionListStartedComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
continueProcess() {
|
||||
console.log('process continued');
|
||||
return this.loadCurrentRemissionProcess().pipe(
|
||||
take(1),
|
||||
switchMap(remissionProcess => {
|
||||
@@ -186,7 +185,6 @@ export class RemissionListStartedComponent implements OnInit, OnDestroy {
|
||||
};
|
||||
|
||||
createProcess() {
|
||||
console.log('process created');
|
||||
return this.remissionService.createProcess().pipe(tap(this.remissionCreatedSuccesfullyHandler));
|
||||
}
|
||||
|
||||
@@ -211,7 +209,6 @@ export class RemissionListStartedComponent implements OnInit, OnDestroy {
|
||||
};
|
||||
|
||||
remisionProcessSubscriptionHandler = (remissionProcess: RemissionProcess) => {
|
||||
console.log('started remission process', remissionProcess);
|
||||
this.remissionProcess = remissionProcess;
|
||||
(!isNullOrUndefined(remissionProcess.capacities)).ifTrue(() => this.capacitiesBinder(remissionProcess.capacities));
|
||||
this.processNeedsToBeRestoredFromCache.ifTrue(() => this.restoreProcess());
|
||||
@@ -303,11 +300,6 @@ export class RemissionListStartedComponent implements OnInit, OnDestroy {
|
||||
this.store.dispatch(new SetBranchProcessCurrentPath(path));
|
||||
}
|
||||
|
||||
addArticleToRemissionList() {
|
||||
// TODO: Implement method
|
||||
throw new Error('(addArticleToRemissionList) Method not implemented');
|
||||
}
|
||||
|
||||
shippingDocumentHasProducts(hasItems: boolean) {
|
||||
this.disabledCompleteRemissionButton = !hasItems;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import { RemissionAddProductToShippingDocumentDialogComponent } from './componen
|
||||
import { RemissionAddProductToShippingDocumentPartiallyDialogComponent } from './components/remission-add-product-to-shipping-document-partially-dialog/remission-add-product-to-shipping-document-partially-dialog.component';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { InfiniteScrollModule } from 'ngx-infinite-scroll';
|
||||
import { RemissionToTopToBottomActionsComponent } from './components/remission-to-top-to-bottom-actions/remission-to-top-to-bottom-actions.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@@ -46,7 +47,8 @@ import { InfiniteScrollModule } from 'ngx-infinite-scroll';
|
||||
RemissionFinishComponent,
|
||||
RemissionStartDialogComponent,
|
||||
RemissionAddProductToShippingDocumentDialogComponent,
|
||||
RemissionAddProductToShippingDocumentPartiallyDialogComponent
|
||||
RemissionAddProductToShippingDocumentPartiallyDialogComponent,
|
||||
RemissionToTopToBottomActionsComponent
|
||||
],
|
||||
imports: [
|
||||
CommonModule,
|
||||
|
||||
6
package-lock.json
generated
6
package-lock.json
generated
@@ -1095,9 +1095,9 @@
|
||||
}
|
||||
},
|
||||
"@isa/remission": {
|
||||
"version": "0.1.9",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/@isa/remission/-/remission-0.1.9.tgz",
|
||||
"integrity": "sha1-xZW7KUjYrme0R2Rl6+zBv40+jW4=",
|
||||
"version": "0.1.10",
|
||||
"resolved": "https://pkgs.dev.azure.com/hugendubel/_packaging/hugendubel/npm/registry/@isa/remission/-/remission-0.1.10.tgz",
|
||||
"integrity": "sha1-MRcP75Ba94FC9UJpsA3LFl53KXw=",
|
||||
"requires": {
|
||||
"tslib": "^1.9.0"
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
"@isa/catsearch-api": "^0.0.25",
|
||||
"@isa/print-api": "^0.0.25",
|
||||
"@isa/remi-api": "^0.0.25",
|
||||
"@isa/remission": "^0.1.9",
|
||||
"@isa/remission": "^0.1.10",
|
||||
"@ngxs/store": "^3.4.1",
|
||||
"@types/faker": "^4.1.5",
|
||||
"@zxing/ngx-scanner": "^1.3.0",
|
||||
|
||||
Reference in New Issue
Block a user