Commit 49cbb6bc authored by Laurent's avatar Laurent
Browse files

show holds and loans in tab views

parent b7972db7
......@@ -85,12 +85,12 @@ Label {
}
#items .list-item .title {
.list-item .title {
background-color: #ccc;
}
#items .list-item GridLayout.late .date_due{
.list-item GridLayout.late .date_due{
color: red;
}
......@@ -129,3 +129,9 @@ Label {
color:white;
}
TabView {
selected-tab-text-color: #185a9d;
android-selected-tab-highlight-color: #185a9d;
}
......@@ -52,7 +52,7 @@ export class AccountsController extends Controller {
library_controller.doRefreshLoansAndHolds();
this.navigate({
moduleName: "views/library/loans",
moduleName: "views/library/items",
bindingContext: library_controller
});
}
......@@ -132,7 +132,7 @@ export class AccountsController extends Controller {
public openAccountAction(args) {
let account = this._accounts.getItem(args.index);
this.navigate({moduleName: "views/library/loans",
this.navigate({moduleName: "views/library/items",
bindingContext: new LibraryController(account)});
}
......
......@@ -110,8 +110,8 @@ export class LibraryController extends Controller {
}
public openLoansAction() {
this.navigate({ moduleName: "views/library/loans",
public openLoansAndHoldsAction() {
this.navigate({ moduleName: "views/library/items",
bindingContext: this });
}
......@@ -200,7 +200,11 @@ export class LibraryController extends Controller {
.then(() => {
this
._loadLoansAndHolds()
._turnBusyIndicator('off');})
._turnBusyIndicator('off');
this._view.getViewById("loans").notifyPullToRefreshFinished();
this._view.getViewById("holds").notifyPullToRefreshFinished();
})
.then( () => {
return this._portal.updateAccountInfo(this._account);})
......@@ -382,16 +386,14 @@ export class LibraryController extends Controller {
}
protected _turnBusyIndicator(state:string): LibraryController {
if (!this._view)
return;
let indicator = this._view.getViewById("activity-indicator");
let items = this._view.getViewById("items");
protected _turnBusyIndicator(state:string): this {
this.set('busy', state);
if (!this._view)
return this;
if (!items || !indicator || (undefined == indicator.animate))
let indicator = this._view.getViewById("activity-indicator");
if (!indicator || (undefined == indicator.animate))
return this;
indicator.animate({
......@@ -399,11 +401,6 @@ export class LibraryController extends Controller {
duration: 1000
});
if (state == "off")
items.notifyPullToRefreshFinished();
return this;
}
}
}
......@@ -56,4 +56,7 @@
<string name="card_number">Card number</string>
<string name="novelties">Novelties</string>
<string name="card_expire_at">Expire at</string>
<string name="holds">Holds</string>
<string name="no_holds">No holds. Pull to refresh.</string>
<string name="loans_and_holds">Loans / Holds</string>
</resources>
......@@ -56,4 +56,7 @@
<string name="card_number">Numéro de tarjeta</string>
<string name="novelties">Nuevo</string>
<string name="card_expire_at">Vence en</string>
<string name="holds">Reservas</string>
<string name="no_holds">No hay reserva. Dezliza para refrescar.</string>
<string name="loans_and_holds">Prestamos / Reservas</string>
</resources>
......@@ -56,4 +56,7 @@
<string name="card_number">Numéro de carte</string>
<string name="novelties">Nouveautés</string>
<string name="card_expire_at">Expire le</string>
<string name="holds">Réservations</string>
<string name="no_hold">Aucune réservation. Tirez pour rafraîchir.</string>
<string name="loans_and_holds">Prêts / Réservations</string>
</resources>
<GridLayout colums="auto" row="auto" xmlns:lv="nativescript-ui-listview">
<Label visibility="{{ holds.length || busy == 'on' ? 'collapsed' : 'visible' }}" style="text-align: center; height: 100dip" text="{{ L('no_holds') }}"/>
<lv:RadListView col="0" row="0"
items="{{ holds }}"
id="holds"
itemTap="{{ onHoldTap }}"
separatorColor="transparent"
pullToRefresh="true"
pullToRefreshInitiated="{{ refreshLoansAndHoldsAction }}">
<lv:RadListView.itemTemplate>
<StackLayout class="list-item">
<GridLayout columns="100, *" rows="auto,auto,auto,auto,auto" class="hold">
<Label text="{{ getTitle() }}" class="title" textWrap="true" col="0" row="0" colSpan="3"/>
<Image src="{{ getRecordThumbnail() }}" visibility="{{ getRecordThumbnail().length ? 'visible' : 'collapsed' }}" col="0" row="1" stretch="aspectFill" rowSpan="4"/>
<Label text="{{ L('author') + ':'}}" col="{{ getRecordThumbnail().length ? '1' : '0' }}" row="1" class="form_label"/>
<Label text="{{ getAuthor() }}" textWrap="true" col="1" row="{{ getRecordThumbnail().length ? '2' : '1' }}"/>
</GridLayout>
</StackLayout>
</lv:RadListView.itemTemplate>
</lv:RadListView>
</GridLayout>
<Page xmlns:nsDrawer="nativescript-ui-sidedrawer" xmlns:shared="views/shared" loaded="{{ onPageLoaded }}">
<Page.actionBar>
<ActionBar title="{{ page_title }}" icon="">
<NavigationButton android.systemIcon="ic_menu_back" tap="{{ goHomeAction }}"/>
<ActionItem text="{{ L('refresh') }}" tap="{{ refreshLoansAndHoldsAction }}">
<ActionItem.actionView>
<Label text='&#xf021;'/>
</ActionItem.actionView>
</ActionItem>
<ActionItem text="{{ L('menu) }}" tap="{{ toggleDrawerAction }}">
<ActionItem.actionView>
<Label text='&#xf0c9;'/>
</ActionItem.actionView>
</ActionItem>
</ActionBar>
</Page.actionBar>
<nsDrawer:RadSideDrawer id="sideDrawer" drawerLocation="Right" drawerTransition="PushTransition">
<nsDrawer:RadSideDrawer.drawerContent xmlns:nsDrawer="nativescript-pro-ui/sidedrawer">
<shared:sidedrawer />
</nsDrawer:RadSideDrawer.drawerContent>
<nsDrawer:RadSideDrawer.mainContent>
<GridLayout columns="*" rows="*" stretchLastChild="true" >
<TabView androidTabsPosition="bottom" xmlns:library="views/library" col="0" row="0" >
<TabView.items>
<TabViewItem title="{{ '&#xf02d; ' + L('loans') }}">
<TabViewItem.view>
<library:loans />
</TabViewItem.view>
</TabViewItem>
<TabViewItem title="{{ '&#xf08d; ' + L('holds') }}">
<TabViewItem.view>
<library:holds />
</TabViewItem.view>
</TabViewItem>
</TabView.items>
</TabView>
<ActivityIndicator style="opacity: 0; height:50dip; width:50dip" id="activity-indicator" col="0" row="0" busy="true"/>
</GridLayout>
</nsDrawer:RadSideDrawer.mainContent>
</nsDrawer:RadSideDrawer>
</Page>
<Page xmlns:nsDrawer="nativescript-ui-sidedrawer" xmlns:lv="nativescript-ui-listview" xmlns:shared="views/shared" loaded="{{ onPageLoaded }}">
<Page.actionBar>
<ActionBar title="{{ page_title }}" icon="">
<NavigationButton android.systemIcon="ic_menu_back" tap="{{ goHomeAction }}"/>
<ActionItem text="{{ L('refresh') }}" tap="{{ refreshLoansAndHoldsAction }}">
<ActionItem.actionView>
<Label text='&#xf021;'/>
</ActionItem.actionView>
</ActionItem>
<ActionItem text="{{ L('menu) }}" tap="{{ toggleDrawerAction }}">
<ActionItem.actionView>
<Label text='&#xf0c9;'/>
</ActionItem.actionView>
</ActionItem>
</ActionBar>
</Page.actionBar>
<GridLayout colums="auto" row="auto" xmlns:lv="nativescript-ui-listview">
<Label visibility="{{ loans.length || busy == 'on' ? 'collapsed' : 'visible' }}" style="text-align: center; height: 100dip" text="{{ L('no_loans') }}"/>
<nsDrawer:RadSideDrawer id="sideDrawer" drawerLocation="Right" drawerTransition="PushTransition">
<nsDrawer:RadSideDrawer.drawerContent xmlns:nsDrawer="nativescript-pro-ui/sidedrawer">
<shared:sidedrawer />
</nsDrawer:RadSideDrawer.drawerContent>
<nsDrawer:RadSideDrawer.mainContent>
<GridLayout colums="auto" row="auto">
<Label id="no-loans" visibility="{{ loans.length || busy == 'on' ? 'collapsed' : 'visible' }}" style="text-align: center; height: 100dip" text="{{ L('no_loans') }}"/>
<lv:RadListView col="0" row="0"
items="{{ loans }}"
id="items"
itemTap="{{ onLoanTap }}"
separatorColor="transparent"
pullToRefresh="true"
pullToRefreshInitiated="{{ refreshLoansAndHoldsAction }}">
<lv:RadListView.itemTemplate>
<StackLayout class="list-item">
<GridLayout columns="100, *" rows="auto,auto,auto,auto,auto" class="{{ 'loan' + (isLate() ? ' late' : '')}}">
<Label text="{{ getTitle() }}" class="title" textWrap="true" col="0" row="0" colSpan="3"/>
<Image src="{{ getRecordThumbnail() }}" visibility="{{ getRecordThumbnail().length ? 'visible' : 'collapsed' }}" col="0" row="1" stretch="aspectFill" rowSpan="4"/>
<Label text="{{ L('author') + ':'}}" col="{{ getRecordThumbnail().length ? '1' : '0' }}" row="1" class="form_label"/>
<Label text="{{ getAuthor() }}" textWrap="true" col="1" row="{{ getRecordThumbnail().length ? '2' : '1' }}"/>
<Label text="{{ L('date_due') + ':'}}" col="{{ getRecordThumbnail().length ? '1' : '0' }}" row="3" class="form_label"/>
<Label text="{{ formattedDateDue() }}" col="1" row="{{ getRecordThumbnail().length ? '4' : '3' }}" class="date_due"/>
</GridLayout>
</StackLayout>
</lv:RadListView.itemTemplate>
</lv:RadListView>
<ActivityIndicator style="opacity: 0; height:50dip; width:50dip" col="0" row="0" id="activity-indicator" busy="true"/>
</GridLayout>
</nsDrawer:RadSideDrawer.mainContent>
<lv:RadListView col="0" row="0"
items="{{ loans }}"
id="loans"
itemTap="{{ onLoanTap }}"
separatorColor="transparent"
pullToRefresh="true"
pullToRefreshInitiated="{{ refreshLoansAndHoldsAction }}">
<lv:RadListView.itemTemplate>
<StackLayout class="list-item">
<GridLayout columns="100, *" rows="auto,auto,auto,auto,auto" class="{{ 'loan' + (isLate() ? ' late' : '')}}">
<Label text="{{ getTitle() }}" class="title" textWrap="true" col="0" row="0" colSpan="3"/>
</nsDrawer:RadSideDrawer>
<Image src="{{ getRecordThumbnail() }}" visibility="{{ getRecordThumbnail().length ? 'visible' : 'collapsed' }}" col="0" row="1" stretch="aspectFill" rowSpan="4"/>
<Label text="{{ L('author') + ':'}}" col="{{ getRecordThumbnail().length ? '1' : '0' }}" row="1" class="form_label"/>
<Label text="{{ getAuthor() }}" textWrap="true" col="1" row="{{ getRecordThumbnail().length ? '2' : '1' }}"/>
<Label text="{{ L('date_due') + ':'}}" col="{{ getRecordThumbnail().length ? '1' : '0' }}" row="3" class="form_label"/>
<Label text="{{ formattedDateDue() }}" col="1" row="{{ getRecordThumbnail().length ? '4' : '3' }}" class="date_due"/>
</GridLayout>
</StackLayout>
</lv:RadListView.itemTemplate>
</lv:RadListView>
</GridLayout>
</Page>
<Page xmlns:nsDrawer="nativescript-ui-sidedrawer" xmlns:shared="views/shared" loaded="{{ onPageLoaded }}">
<Page.actionBar>
<ActionBar title="{{ page_title }}" icon="">
<NavigationButton android.systemIcon="ic_menu_back" tap="{{ goHomeAction }}"/>
<NavigationButton android.systemIcon="ic_menu_back" tap="{{ goBack }}"/>
<ActionItem text="{{ L('menu) }}" tap="{{ toggleDrawerAction }}">
<ActionItem.actionView>
......
<StackLayout id="sideDrawerContent" >
<ScrollView>
<StackLayout>
<StackLayout tap="{{ openLoansAction }}" >
<Label text="{{ '&#xf02d; ' + L('loans') }}" class="fa" />
<StackLayout tap="{{ openLoansAndHoldsAction }}" >
<Label text="{{ '&#xf02d; ' + L('loans_and_holds') }}" class="fa" />
</StackLayout>
<StackLayout tap="{{ showCardAction }}" visibility="{{ card, card.number ? 'visible' : 'collapsed' }}" >
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment