Skip to content

Commit

Permalink
circulation: Fees tab implementation
Browse files Browse the repository at this point in the history
* Implements Fee tab for a patron account.
* Adapts existing features concerning fees.
* Create PatronTransaction service.

Co-Authored-by: Renaud Michotte <renaud.michotte@gmail.com>
  • Loading branch information
zannkukai committed Feb 14, 2020
1 parent 455c594 commit d026376
Show file tree
Hide file tree
Showing 34 changed files with 1,568 additions and 114 deletions.
91 changes: 40 additions & 51 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion projects/admin/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
import { MenuComponent } from './menu/menu.component';
import { CollapseModule, BsDatepickerModule, TypeaheadModule } from 'ngx-bootstrap';
import { CollapseModule, BsDatepickerModule, TypeaheadModule, BsDropdownModule } from 'ngx-bootstrap';
import { RecordModule } from '@rero/ng-core';
import { HttpClientModule } from '@angular/common/http';
import { TranslateModule } from '@ngx-translate/core';
Expand All @@ -36,6 +36,7 @@ describe('AppComponent', () => {
RecordModule,
HttpClientModule,
BsDatepickerModule.forRoot(),
BsDropdownModule.forRoot(),
TranslateModule.forRoot({}),
TypeaheadModule.forRoot()
],
Expand Down
2 changes: 2 additions & 0 deletions projects/admin/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {MenuComponent} from './menu/menu.component';
import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http';
import {
BsDatepickerModule,
BsDropdownModule,
BsLocaleService,
CollapseModule,
TabsModule,
Expand Down Expand Up @@ -172,6 +173,7 @@ import { FrontpageSubBoardComponent } from './frontpage/frontpage-sub-board/fron
BrowserAnimationsModule,
BrowserModule,
BsDatepickerModule.forRoot(),
BsDropdownModule.forRoot(),
CollapseModule.forRoot(),
FormsModule,
HttpClientModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { MainComponent } from './patron/main/main.component';
import { ProfileComponent } from './patron/profile/profile.component';
import { RequestedComponent } from './patron/requested/requested.component';
import { PickupComponent } from './patron/pickup/pickup.component';
import { PatronTransactionsComponent } from './patron/patron-transactions/patron-transactions.component';

const routes: Routes = [
{
Expand Down Expand Up @@ -55,6 +56,10 @@ const routes: Routes = [
{
path: 'profile',
component: ProfileComponent
},
{
path: 'fees',
component: PatronTransactionsComponent
}
]
}, {
Expand Down
43 changes: 33 additions & 10 deletions projects/admin/src/app/circulation/circulation.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,37 @@
*/


import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RecordModule } from '@rero/ng-core';
import { BsDropdownModule, CollapseModule } from 'ngx-bootstrap';
import { CardComponent } from './patron/card/card.component';
import { CheckoutComponent } from './checkout/checkout.component';
import { CirculationRoutingModule } from './circulation-routing.module';
import { CommonModule } from '@angular/common';
import { FormlyModule } from '@ngx-formly/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { ItemComponent } from './item/item.component';
import { ItemsListComponent } from './items-list/items-list.component';
import { MainRequestComponent } from './main-request/main-request.component';
import { CardComponent } from './patron/card/card.component';
import { LoanComponent } from './patron/loan/loan.component';
import { MainComponent } from './patron/main/main.component';
import { RequestedItemsListComponent } from './requested-items-list/requested-items-list.component';
import { MainRequestComponent } from './main-request/main-request.component';
import { NgModule } from '@angular/core';
import { PatronTransactionsComponent } from './patron/patron-transactions/patron-transactions.component';
import {
PatronTransactionComponent
} from './patron/patron-transactions/patron-transaction/patron-transaction.component';
import {
PatronTransactionEventComponent
} from './patron/patron-transactions/patron-transaction-event/patron-transaction-event.component';
import {
PatronTransactionEventFormComponent
} from './patron/patron-transactions/patron-transaction-event-form/patron-transaction-event-form.component';
import { PickupComponent } from './patron/pickup/pickup.component';
import { PickupItemComponent } from './patron/pickup/pickup-item/pickup-item.component';
import { ProfileComponent } from './patron/profile/profile.component';
import { RecordModule } from '@rero/ng-core';
import { RequestedComponent } from './patron/requested/requested.component';
import { RequestedItemComponent } from './patron/requested/requested-item/requested-item.component';
import { PickupComponent } from './patron/pickup/pickup.component';
import { PickupItemComponent } from './patron/pickup/pickup-item/pickup-item.component';
import { RequestedItemsListComponent } from './requested-items-list/requested-items-list.component';


@NgModule({
declarations: [
Expand All @@ -49,14 +62,24 @@ import { PickupItemComponent } from './patron/pickup/pickup-item/pickup-item.com
RequestedComponent,
RequestedItemComponent,
PickupComponent,
PickupItemComponent
PickupItemComponent,
PatronTransactionsComponent,
PatronTransactionComponent,
PatronTransactionEventComponent,
PatronTransactionEventFormComponent
],
imports: [
CommonModule,
CirculationRoutingModule,
BsDropdownModule.forRoot(),
CollapseModule.forRoot(),
RecordModule
RecordModule,
FormsModule,
ReactiveFormsModule,
FormlyModule
],
entryComponents: [
PatronTransactionEventFormComponent
]
})
export class CirculationModule { }
20 changes: 10 additions & 10 deletions projects/admin/src/app/circulation/item/item.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@

<div [ngClass]="{'border-danger': patronLoan && (item.status === 'in_transit' || item.pending_loans || totalAmountOfFee > 0),
'text-secondary': item.status !== 'on_loan'}"
class="row p-2 mb-1 border rounded align-middle"
*ngIf="item">
class="row p-2 mb-1 border rounded align-middle"
*ngIf="item">
<!-- BARCODE -->
<div class="col-lg-3">
<button *ngIf="item.loan || totalAmountOfFee || item.pending_loans || notifications$" type="button" class="pl-0 pt-0 btn" (click)="isCollapsed = !isCollapsed" [attr.aria-expanded]="!isCollapsed"
aria-controls="collapse">
aria-controls="collapse">
<i [ngClass]="{ 'fa-caret-down': !isCollapsed, 'fa-caret-right': isCollapsed }" class="fa" aria-hidden="true"></i>
</button>
<a [routerLink]="['/records','items','detail', item.pid]">{{ item.barcode }}</a>
</div>
<!-- TITLE -->
<div class="col-lg-6"><a
[routerLink]="['/records','documents','detail', item.document.pid]">{{ item.document.title | truncateText: 12 }}</a>
[routerLink]="['/records','documents','detail', item.document.pid]">{{ item.document.title | truncateText: 12 }}</a>
</div>
<!-- CIRCULATION INFO -->
<div class="col-lg-3">
Expand All @@ -44,15 +44,15 @@
</ng-container>
<!-- RENEWALS, FEES, REQUESTS -->
<li>
<span title="{{'Renewals' | translate }}" class="badge badge-secondary font-weight-normal mr-1"
*ngIf="item.loan && item.loan.extension_count">
<span title="{{ 'Renewals' | translate }}" class="badge badge-secondary font-weight-normal mr-1"
*ngIf="item.loan && item.loan.extension_count">
{{ item.loan.extension_count }} <i class="fa fa-refresh"></i>
</span>
<span title="{{'Fees' | translate }}" class="badge badge-secondary font-weight-normal mr-1"
*ngIf="totalAmountOfFee > 0">
<span title="{{ 'Fees' | translate }}" class="badge badge-warning font-weight-normal mr-1"
*ngIf="totalAmountOfFee > 0">
{{ totalAmountOfFee | currency: organisation.default_currency }}</span>
<span title="{{'Requests' | translate }}" class="badge badge-secondary font-weight-normal mr-1"
*ngIf="item.pending_loans && item.pending_loans.length">
<span title="{{ 'Requests' | translate }}" class="badge badge-secondary font-weight-normal mr-1"
*ngIf="item.pending_loans && item.pending_loans.length">
{{ item.pending_loans.length }} <i class="fa fa-exclamation-circle"></i>
</span>
</li>
Expand Down
Loading

0 comments on commit d026376

Please sign in to comment.