forked from rero/rero-ils-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
circulation: checkin operations when item/patron barcode are identical
* Closes rero/rero-ils#2597. Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
- Loading branch information
1 parent
4241991
commit bce1b3e
Showing
5 changed files
with
235 additions
and
54 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
projects/admin/src/app/circulation/checkin/checkin-action/checkin-action.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!-- | ||
RERO ILS UI | ||
Copyright (C) 2021 RERO | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, version 3 of the License. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
<div class="modal show d-block" role="dialog" (window:keypress)="checkinItemOnReturnKey($event)"> | ||
<div class="modal-dialog modal-dialog-centered" role="checking"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" translate>Circulation action</h5> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
<span aria-hidden="true" data-dismiss="modal" (click)="closeModal()">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<div class="font-weight-bold" translate> | ||
One item and one patron were found. | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button id="action-patron" type="button" class="btn btn-outline-primary" (click)="setAction('patron')"> | ||
<i class="fa fa-user mr-1"></i> {{ 'Patron account' | translate }} | ||
</button> | ||
<button id="action-item" type="button" class="btn btn-primary" (click)="setAction('item')"> | ||
<i class="fa fa-file-o mr-1"></i> {{ 'Checkin the item' | translate }} | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
65 changes: 65 additions & 0 deletions
65
projects/admin/src/app/circulation/checkin/checkin-action/checkin-action.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* RERO ILS UI | ||
* Copyright (C) 2021 RERO | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, version 3 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { DebugElement } from '@angular/core'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { By } from '@angular/platform-browser'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { CirculationModule } from '../../circulation.module'; | ||
import { CheckinActionComponent } from './checkin-action.component'; | ||
|
||
|
||
describe('CheckinActionComponent', () => { | ||
let component: CheckinActionComponent; | ||
let fixture: ComponentFixture<CheckinActionComponent> | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ | ||
CirculationModule, | ||
TranslateModule.forRoot(), | ||
HttpClientTestingModule, | ||
RouterTestingModule | ||
], | ||
declarations: [ CheckinActionComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(CheckinActionComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should return the item action with a click on the button Check the item', () => { | ||
const itemButton: DebugElement = fixture.debugElement.query(By.css('button[id=action-item]')); | ||
itemButton.triggerEventHandler('click', null); | ||
expect(component.action).toEqual('item'); | ||
}); | ||
|
||
it('should return the patron action with a click on the button Patron account', () => { | ||
const itemButton: DebugElement = fixture.debugElement.query(By.css('button[id=action-patron]')); | ||
itemButton.triggerEventHandler('click', null); | ||
expect(component.action).toEqual('patron'); | ||
}); | ||
}); |
55 changes: 55 additions & 0 deletions
55
projects/admin/src/app/circulation/checkin/checkin-action/checkin-action.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* RERO ILS UI | ||
* Copyright (C) 2021 RERO | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, version 3 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import { Component } from '@angular/core'; | ||
import { BsModalService } from 'ngx-bootstrap/modal'; | ||
|
||
@Component({ | ||
selector: 'admin-checkin-action', | ||
templateUrl: './checkin-action.component.html' | ||
}) | ||
export class CheckinActionComponent { | ||
|
||
/** Checkin action */ | ||
public action: 'patron' | 'item'; | ||
|
||
/** | ||
* Constructor | ||
* @param _modalService - BsModalService | ||
*/ | ||
constructor(private _modalService: BsModalService) { } | ||
|
||
/** | ||
* Set checkin action selected by user | ||
* @param action - string | ||
*/ | ||
setAction(action: 'patron' | 'item') { | ||
this.action = action; | ||
this.closeModal(); | ||
} | ||
|
||
checkinItemOnReturnKey(event) { | ||
if (event.keyCode === 13) { | ||
this.action = 'item'; | ||
this.closeModal(); | ||
} | ||
} | ||
|
||
/** Close modal box */ | ||
closeModal() { | ||
this._modalService.hide(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters