Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display Handout Branch Name on Bulk #699

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"@angular/platform-browser": "^11.2.4",
"@angular/platform-browser-dynamic": "^11.2.4",
"@angular/router": "^11.2.4",
"@boklisten/bl-connect": "^0.19.0",
"@boklisten/bl-login": "^1.2.3",
"@boklisten/bl-connect": "^0.19.6",
"@boklisten/bl-login": "^1.2.4",
"@boklisten/bl-reporter": "^0.4.6",
"@fortawesome/angular-fontawesome": "^0.8.2",
"@fortawesome/fontawesome-svg-core": "^1.2.34",
Expand Down Expand Up @@ -51,7 +51,7 @@
"@angular/compiler-cli": "^11.2.4",
"@angular/language-service": "^11.2.4",
"@angularclass/hmr": "^3.0.0",
"@boklisten/bl-model": "^0.25.8",
"@boklisten/bl-model": "0.25.20",
"@types/jasmine": "~3.6.6",
"@types/jasminewd2": "~2.0.8",
"@types/node": "^14.14.33",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, Input, OnInit } from "@angular/core";
import { ItemService } from "@boklisten/bl-connect";
import { ScannedBook } from "@boklisten/bl-model/dist/bulk-collection/bulk-collection";
import { ScannedBook } from "@boklisten/bl-model/bulk-collection/bulk-collection";
import { NgbActiveModal } from "@ng-bootstrap/ng-bootstrap";

@Component({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, Input, OnInit } from "@angular/core";
import { ScannedBook } from "@boklisten/bl-model/dist/bulk-collection/bulk-collection";
import { ScannedBook } from "@boklisten/bl-model/bulk-collection/bulk-collection";
import { NgbModal } from "@ng-bootstrap/ng-bootstrap";
import { BookDetailModalContentComponent } from "./book-detail-modal-content/book-detail-modal-content.component";

Expand Down
2 changes: 2 additions & 0 deletions src/app/bulk-collection/bulk-collection.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ <h1>Bulk-innsamling</h1>
<thead>
<tr>
<th scope="col">Tittel</th>
<th scope="col">Utdelt på</th>
<th scope="col">Frist</th>
<th scope="col">Lånt av</th>
</tr>
Expand All @@ -43,6 +44,7 @@ <h1>Bulk-innsamling</h1>
[scannedBook]="book"
></app-book-detail-modal>
</td>
<td>{{ book.handoutBranchName }}</td>
<td
[title]="
deadlineHasPassed(book.deadline)
Expand Down
2 changes: 1 addition & 1 deletion src/app/bulk-collection/bulk-collection.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, OnInit } from "@angular/core";
import { ToasterService } from "../toaster/toaster.service";
import { BulkCollectionService } from "./bulk-collection.service";
import { ScannedBook } from "@boklisten/bl-model/dist/bulk-collection/bulk-collection";
import { ScannedBook } from "@boklisten/bl-model/bulk-collection/bulk-collection";
import { CustomerItemService } from "@boklisten/bl-connect";
import moment from "moment";
import { Router } from "@angular/router";
Expand Down
24 changes: 20 additions & 4 deletions src/app/bulk-collection/bulk-collection.service.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { Injectable } from "@angular/core";
import { CustomerItemService, OrderService } from "@boklisten/bl-connect";
import {
BranchService,
CustomerItemService,
OrderService,
UserDetailService,
} from "@boklisten/bl-connect";
import { CustomerItem, OrderItem } from "@boklisten/bl-model";
import { ScannedBook } from "@boklisten/bl-model/dist/bulk-collection/bulk-collection";
import { ScannedBook } from "@boklisten/bl-model/bulk-collection/bulk-collection";
import { OrderGeneratorService } from "../order/order-generator/order-generator.service";
import { PriceService } from "../price/price.service";
import { ToasterService } from "../toaster/toaster.service";
import { UniqueItemStoreService } from "../unique-item/unique-item-store.service";
import { BranchStoreService } from "../branch/branch-store.service";

@Injectable({
providedIn: "root",
Expand All @@ -15,8 +21,10 @@ export class BulkCollectionService {
private _orderService: OrderService,
private _priceService: PriceService,
private _orderGeneratorService: OrderGeneratorService,
private _uniqeItemStoreService: UniqueItemStoreService,
private _uniqueItemStoreService: UniqueItemStoreService,
private _customerItemService: CustomerItemService,
private _branchService: BranchService,
private _branchStoreService: BranchStoreService,
private _toasterService: ToasterService
) {}

Expand Down Expand Up @@ -57,7 +65,7 @@ export class BulkCollectionService {
): Promise<ScannedBook> {
try {
const result = await Promise.all([
this._uniqeItemStoreService.get(blid),
this._uniqueItemStoreService.get(blid),
this.getCustomerItem(blid, initialCustomerItem),
]);
const uniqueItem = result[0];
Expand All @@ -71,6 +79,13 @@ export class BulkCollectionService {
? buybackInfo?.time
: customerItem.returnInfo?.time;

let handoutBranch = this._branchStoreService.getCurrentBranch();
if (handoutBranch.id !== customerItem.handoutInfo.handoutById) {
handoutBranch = await this._branchService.getById(
customerItem.handoutInfo.handoutById
);
}

return {
id: customerItem.id,
customerId: customerItem.customer as string,
Expand All @@ -79,6 +94,7 @@ export class BulkCollectionService {
deadline: this.prettyDate(customerItem.deadline),
title: uniqueItem.title,
customerName: customerItem.customerInfo.name,
handoutBranchName: handoutBranch.name,
collectedAt: this.prettyTime(collectionTime),
type: customerItem.type,
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit } from "@angular/core";
import { Order } from "@boklisten/bl-model";
import { ScannedBook } from "@boklisten/bl-model/dist/bulk-collection/bulk-collection";
import { ScannedBook } from "@boklisten/bl-model/bulk-collection/bulk-collection";
import { BranchStoreService } from "../../branch/branch-store.service";
import { DatabaseReportOrderFilter } from "../../database/database-reports/database-report-order/database-report-order-filter";
import { DatabaseReportOrderService } from "../../database/database-reports/database-report-order/database-report-order.service";
Expand Down Expand Up @@ -79,6 +79,7 @@ export class BulkHistoryComponent implements OnInit {
item: "",
orderId: order.id,
collectedAt: collectionTime,
handoutBranchName: "",
},
]);
customerIndex = this.history.length - 1;
Expand All @@ -92,6 +93,7 @@ export class BulkHistoryComponent implements OnInit {
id: orderItem.customerItem as string,
item: "",
orderId: order.id,
handoutBranchName: "",
});
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core";
import { Router } from "@angular/router";
import { ScannedBook } from "@boklisten/bl-model/dist/bulk-collection/bulk-collection";
import { ScannedBook } from "@boklisten/bl-model/bulk-collection/bulk-collection";

@Component({
selector: "app-user-order-summary",
Expand Down
2 changes: 1 addition & 1 deletion src/app/date/date.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from "@angular/core";
import { Period } from "@boklisten/bl-model/dist/period/period";
import { Period } from "@boklisten/bl-model/period/period";
import { BranchStoreService } from "../branch/branch-store.service";
import * as moment from "moment";
import { BranchHelperService } from "../branch/branch-helper/branch-helper.service";
Expand Down
2 changes: 1 addition & 1 deletion src/app/price/branch-price/branch-price.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from "@angular/core";
import { BranchStoreService } from "../../branch/branch-store.service";
import { Branch, Item } from "@boklisten/bl-model";
import { Period } from "@boklisten/bl-model/dist/period/period";
import { Period } from "@boklisten/bl-model/period/period";

@Injectable()
export class BranchPriceService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from "@angular/core";
import { CustomerItem, Item } from "@boklisten/bl-model";
import { Period } from "@boklisten/bl-model/dist/period/period";
import { Period } from "@boklisten/bl-model/period/period";
import { BranchStoreService } from "../../branch/branch-store.service";
import { PriceService } from "../price.service";
import { BranchService, OrderService } from "@boklisten/bl-connect";
Expand Down
2 changes: 1 addition & 1 deletion src/app/price/item-price/item-price.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from "@angular/core";
import { BranchStoreService } from "../../branch/branch-store.service";
import { Item } from "@boklisten/bl-model";
import { Period } from "@boklisten/bl-model/dist/period/period";
import { Period } from "@boklisten/bl-model/period/period";
import { BranchPriceService } from "../branch-price/branch-price.service";
import { PriceService } from "../price.service";
import { PriceInformation } from "../price-information";
Expand Down
4 changes: 2 additions & 2 deletions src/app/price/order-item-price/order-item-price.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
OrderItem,
} from "@boklisten/bl-model";
import { ItemPriceService } from "../item-price/item-price.service";
import { OrderItemType } from "@boklisten/bl-model/dist/order/order-item/order-item-type";
import { Period } from "@boklisten/bl-model/dist/period/period";
import { OrderItemType } from "@boklisten/bl-model/order/order-item/order-item-type";
import { Period } from "@boklisten/bl-model/period/period";
import { BranchStoreService } from "../../branch/branch-store.service";
import { PriceService } from "../price.service";
import { PriceInformation } from "../price-information";
Expand Down
31 changes: 19 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1253,30 +1253,37 @@
dependencies:
tslib "^2.1.0"

"@boklisten/bl-login@^1.2.3":
version "1.2.3"
resolved "https://registry.yarnpkg.com/@boklisten/bl-login/-/bl-login-1.2.3.tgz#2ba81e065d5b977ffe94f2acf4ac05acdbd84466"
integrity sha512-N3R7Q88DvGX5SSo+qiRhLLdIkQUIKR923obXwJ7N7+GaXkSC9BFva91fsvvKUviCmWgeofKYNr/HocipWqxvkQ==
"@boklisten/bl-connect@^0.19.6":
version "0.19.6"
resolved "https://registry.yarnpkg.com/@boklisten/bl-connect/-/bl-connect-0.19.6.tgz#af327ff85a7829f0d137fc265a599363ae43bf81"
integrity sha512-r7s2GNeHxRo3vQNc0zC9yuhcPDPpYwcs9nzSTTyksLZgAcmAXHUn2FV721p3RFEJVisAyBPc52hSfKgZjHuEoA==
dependencies:
tslib "^2.1.0"

"@boklisten/bl-login@^1.2.4":
version "1.2.4"
resolved "https://registry.yarnpkg.com/@boklisten/bl-login/-/bl-login-1.2.4.tgz#d5f5043f89025af9e2d367ad0612985ccf6026cf"
integrity sha512-rGgkBpHEk+d+Gl523kJtk+OXVru0CzAnPV9C0mC8vff7nUX28UPeM4UaIukLVCfdiJFDX8iXMTWIGr4GivQ0CA==
dependencies:
"@auth0/angular-jwt" "^5.0.2"
"@boklisten/bl-connect" "^0.19.0"
"@boklisten/bl-connect" "^0.19.6"
date-fns "^2.17.0"
tslib "^2.1.0"

"@boklisten/[email protected]":
version "0.25.20"
resolved "https://registry.yarnpkg.com/@boklisten/bl-model/-/bl-model-0.25.20.tgz#17d6ddaacdcd842accbcc0b249d73d8189e21a55"
integrity sha512-9YhGzZMt4GY4tnIyuqkrQTSSfUv0dwy9mFSt0MZEj1eMW0Ri5g0PVem1UPnCoXHUmRklBJs4xwdnUhZ92kcRwA==
dependencies:
typescript "^4.5.2"

"@boklisten/bl-model@^0.25.0":
version "0.25.5"
resolved "https://registry.npmjs.org/@boklisten/bl-model/-/bl-model-0.25.5.tgz"
integrity sha512-6qZu/ydLhW1GLBGPVywRmGvoY+EL7OP2u+bZIiGHagkQefBJi8wEiVF7duadYtVN54WaQ/JyAalW3iYM+2hE3g==
dependencies:
typescript "^4.2.4"

"@boklisten/bl-model@^0.25.8":
version "0.25.8"
resolved "https://registry.yarnpkg.com/@boklisten/bl-model/-/bl-model-0.25.8.tgz#b74f5066500f6b703ba87aae19821ba4c7f5be5b"
integrity sha512-6G8DjQkb/kMJWl8FABAzTiXXREhSJsSFXwcBHGFuoCAIrwxsS6QZBe3YxZEQsHOwXV6NxmM20TtCkpogZxRB/A==
dependencies:
typescript "^4.5.2"

"@boklisten/bl-reporter@^0.4.6":
version "0.4.6"
resolved "https://registry.yarnpkg.com/@boklisten/bl-reporter/-/bl-reporter-0.4.6.tgz#d420202b597be71afeea6c2109d631caf50f2d0d"
Expand Down
Loading