Skip to content

Commit

Permalink
fix: order, bucket name and request button
Browse files Browse the repository at this point in the history
* Fixes order pid extract.
* Fixes bucket name button.
* Fixes request button.

Co-Authored-by: Bertrand Zuchuat <[email protected]>
  • Loading branch information
Garfield-fr committed Feb 19, 2024
1 parent 0cdabe3 commit c44432e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { Observable, Subscription } from 'rxjs';
import { map } from 'rxjs/operators';
import { AcqOrderHistoryVersion, AcqOrderHistoryVersionResponseInterface, AcqOrderStatus, IAcqOrder } from '../../../classes/order';
import { OrderEmailFormComponent } from '../order-email-form/order-email-form.component';
import { extractIdOnRef } from '@rero/ng-core';

@Component({
selector: 'admin-acquisition-order-detail-view',
Expand Down Expand Up @@ -142,6 +143,9 @@ export class OrderDetailViewComponent implements DetailRecord, OnInit, OnDestroy
modalRef.content.closeDialog.subscribe((close: boolean) => modalRef.hide());
modalRef.content.recordChange.subscribe((order: IAcqOrder) => {
if (this.order.pid === order.pid) {
if (order.vendor.$ref) {
order.vendor.pid = extractIdOnRef(order.vendor.$ref);
}
this.order = order;
}
});
Expand Down
4 changes: 3 additions & 1 deletion projects/admin/src/app/service/bucket-name.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* RERO ILS UI
* Copyright (C) 2021-2023 RERO
* Copyright (C) 2021-2024 RERO
* Copyright (C) 2021-2023 UCLouvain
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -32,6 +32,7 @@ export class BucketNameService implements IBucketNameService {
* Constructor
* @param translateService - TranslateService
* @param organisationApiService - OrganisationApiService
* @param libraryApiService - LibraryApiService
*/
constructor(
private translateService: TranslateService,
Expand All @@ -48,6 +49,7 @@ export class BucketNameService implements IBucketNameService {
transform(aggregationKey: string, value: string): Observable<string> {
switch (aggregationKey) {
case 'language': return of(this.translateService.instant(`lang_${value}`));
case 'transaction_library':
case 'library': return this.libraryApiService.getByPid(value).pipe(map(record => record.name));
case 'organisation': return this.organisationApiService.getByPid(value).pipe(map(record => record.name));
default: return of(this.translateService.instant(value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,31 @@
-->
@if (patron) {
@if (!requestDialog) {
<dl id="record-request-{{ record.metadata.pid }}" class="row" [ngClass]="{'row pl-4': recordType === 'item', 'mb-3': recordType === 'holding'}">
@if (recordType !== 'holding') {
<dt class="mt-2 mb-3 col-lg-2 col-sm-3">&nbsp;</dt>
}
<dd class="mt-2 mb-3 col-lg-9 col-sm-8">
<button
id="record-{{ record.metadata.pid }}-request-button"
class="btn btn-sm"
[ngClass]="{'btn-primary': recordType === 'item', 'btn-outline-primary': recordType === 'holding'}"
(click)="showRequestDialog()"
>
@if (recordType === 'item') {
{{ 'Request' | translate }}
} @else {
@if (holdingsItemsCount > 0) {
{{ 'Request another issue' | translate }}
@if (canRequest && canRequest.can) {
<dl id="record-request-{{ record.metadata.pid }}" class="row" [ngClass]="{'row pl-4': recordType === 'item', 'mb-3': recordType === 'holding'}">
@if (recordType !== 'holding') {
<dt class="mt-2 mb-3 col-lg-2 col-sm-3">&nbsp;</dt>
}
<dd class="mt-2 mb-3 col-lg-9 col-sm-8">
<button
id="record-{{ record.metadata.pid }}-request-button"
class="btn btn-sm"
[ngClass]="{'btn-primary': recordType === 'item', 'btn-outline-primary': recordType === 'holding'}"
(click)="showRequestDialog()"
>
@if (recordType === 'item') {
{{ 'Request' | translate }}
} @else {
{{ 'Request an issue' | translate }}
@if (holdingsItemsCount > 0) {
{{ 'Request another issue' | translate }}
} @else {
{{ 'Request an issue' | translate }}
}
}
}
</button>
</dd>
</dl>
</button>
</dd>
</dl>
}
} @else {
<dl class="m-0 ml-4 py-2 row">
@if (recordType !== 'holding') {
Expand Down
4 changes: 2 additions & 2 deletions projects/shared/tsconfig.lib.prod.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
"declarationMap": false,
},
"angularCompilerOptions": {
"compilationMode": "partial"
"compilationMode": "full"
}
}

0 comments on commit c44432e

Please sign in to comment.