File
Implements
Metadata
selector |
item-transfer |
styleUrls |
./item-transfer.component.scss |
templateUrl |
./item-transfer.component.html |
Index
Properties
|
|
Methods
|
|
Inputs
|
|
transfer
|
Default value : () => {...}
|
|
|
import { Component, OnInit, Input } from '@angular/core';
import { Borrowing } from 'src/app/models/Borrowings';
import { SwalService } from 'src/app/services/swal/swal.service';
import { BookService } from 'src/app/services/book/book.service';
@Component({
selector: 'item-transfer',
templateUrl: './item-transfer.component.html',
styleUrls: ['./item-transfer.component.scss']
})
export class ItemTransferComponent implements OnInit {
@Input() moveHeader: Function;
@Input() subscribeToTransferReq: Function;
@Input() borrowDetails: Borrowing;
constructor(private swalService: SwalService, private bookService: BookService) {}
ngOnInit() {}
/**
* Initiate a book transfer
*/
transfer = () => {
this.swalService.displayConfirmation(
'Confirm Transfer',
'You are about transfer your book would you like to proceed',
async data => {
if (data) {
await this.bookService.placeABookTransfer(this.borrowDetails);
this.moveHeader();
this.subscribeToTransferReq();
}
}
);
};
}
<ion-card>
<ion-card-header>
<ion-card-title>{{ borrowDetails.title }}</ion-card-title>
<ion-grid>
<ion-row>
<ion-col>
Issue date - <span>{{ borrowDetails.issuedate }}</span>
</ion-col>
<ion-col class="ion-text-end">
Due date -<span>{{ borrowDetails.date_due }}</span>
</ion-col>
</ion-row>
</ion-grid>
</ion-card-header>
<div class="button-pannel">
<ion-button size="small" (click)="transfer()">
<!-- <ion-button size="small" (click)="transfer()" [disabled]="borrowDetails.status === 'overdue'"> -->
Transfer
</ion-button>
<ion-button color="danger" size="small" *ngIf="borrowDetails.status === 'overdue'"
>Pay</ion-button
>
</div>
</ion-card>
.button-pannel {
float: right;
padding: 10px;
}
.date-panel {
display: flex;
justify-content: space-between;
}
Legend
Html element with directive