Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patron profile: add sort by due date #774

Merged

Conversation

vgranata
Copy link
Contributor

@vgranata vgranata commented Dec 20, 2021

Add sort for due date in patron profile view.

Co-Authored-by: Valeria Granata valeria@chaw.com

Why are you opening this PR?

Closes: rero/rero-ils#2263

Code review check list

  • Commit message template compliance.
  • Commit message without typos.
  • File names.
  • Functions names.
  • Functions docstrings.
  • Unnecessary commited files?
  • Cypress tests successful?

@github-actions github-actions bot added f: circulation Concerns the circulation interface or backend f: public ui Public interface, as opposed to the professional interface f: user management labels Dec 20, 2021
@vgranata vgranata force-pushed the grv-2263-loans-sorted-by-due-date branch from 971b6ba to dbbfa2d Compare December 20, 2021 19:02
@vgranata vgranata force-pushed the grv-2263-loans-sorted-by-due-date branch from dbbfa2d to f8e0abb Compare February 3, 2022 10:28
@vgranata vgranata marked this pull request as ready for review February 3, 2022 10:38
/** Initial records load and sort */
private _initialLoadSorted(): void {
const pgr = this._paginator;
this._loanQueryAll().subscribe((response: Record) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not a good idea to load all the loans at once, because if there are a lot of them, it will make the thing explode. The pager is there to avoid this.

You really need to use the pager.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. You should update the "_loanApiService.getOnLoan()" method to accept a sorting option. This options could be use into

return this._recordService.getRecords(
'loans', this._patronStateQuery(patronPid, loanStates), page, itemsPerPage,
undefined, undefined, headers

to sort result.
Any time a user change the sort criteria clicking on column header, the records must be reloaded on page 1 (even if user is on page 3 at click time)

@zannkukai
Copy link
Contributor

I continue about thinking at this problem during this weekend.
My personal conclusion is that paginator is maybe not a good idea on this page. As an user, I could be great to see all my current loans with one page without click on paginator links.

About technical it should be test with an account with a lot of loans (~100 loans) to check performance.
It should be discuss with other devs/PO members during a daily.

@vgranata vgranata force-pushed the grv-2263-loans-sorted-by-due-date branch 2 times, most recently from a955266 to b5d9e96 Compare February 8, 2022 16:14
@vgranata vgranata changed the title patron profile: add sort for title, library and due date patron profile: add sort for due date Feb 8, 2022
@vgranata vgranata changed the title patron profile: add sort for due date patron profile: add sort by due date Feb 8, 2022
@@ -29,14 +29,17 @@ import { PatronProfileMenuService } from '../patron-profile-menu.service';
export class PatronProfileLoansComponent implements OnInit, OnDestroy {

/** Observable subscription */
private _subscription = new Subscription();
_subscription: Subscription;
Copy link
Contributor

@zannkukai zannkukai Feb 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change ? Especially if you create an subscription into ngOnInit

Comment on lines 81 to 82
this.ngOnDestroy();
this.ngOnInit();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arggh. Is it really a good idea to call life cycle hook function like that ? What's the feeling of @Garfield-fr and/or @jma.

color: white;
}
select#sort-criteria.custom-select {
background-color:#343a40;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to use bootstrap variable here ? maybe $table-dark-color ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file are to overwrite the style of the sort-list ng-core widget.
I'm not sure how to use bootstrap in this case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vgranata

You can check https://github.com/rero/rero-ils-ui/blob/staging/projects/admin/src/app/acquisition/acquisition.scss (and some other files)

@import '~bootstrap/scss/_functions';
@import '~bootstrap/scss/_variables';
@import '/projects/admin/src/app/scss/variables';

allows to use bootstrap variables, bootstrap functions and project variables.

margin-bottom: map-get($spacers, 1);

you can use 1 (small gap space) to 5 (big gap space)
If you can't use a bootstrap variable for the background color ; define a project variable into variables.scss and use this variable in this file

background-color:#343a40;
}
.input-group-text {
background-color:#343a40;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

.input-group-text {
background-color:#343a40;
border: none;
padding: 1px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use bootstrap function map-get if possible :: map-get($spacers, 1)

@vgranata vgranata force-pushed the grv-2263-loans-sorted-by-due-date branch 2 times, most recently from 3bbe84a to 1a95a13 Compare March 16, 2022 13:19
@vgranata vgranata requested a review from zannkukai March 16, 2022 15:08
Copy link
Contributor

@zannkukai zannkukai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still some changes into SCSS file ;-)

color: white;
}
select#sort-criteria.custom-select {
background-color:#343a40;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vgranata

You can check https://github.com/rero/rero-ils-ui/blob/staging/projects/admin/src/app/acquisition/acquisition.scss (and some other files)

@import '~bootstrap/scss/_functions';
@import '~bootstrap/scss/_variables';
@import '/projects/admin/src/app/scss/variables';

allows to use bootstrap variables, bootstrap functions and project variables.

margin-bottom: map-get($spacers, 1);

you can use 1 (small gap space) to 5 (big gap space)
If you can't use a bootstrap variable for the background color ; define a project variable into variables.scss and use this variable in this file

@PascalRepond PascalRepond requested a review from jma March 17, 2022 11:14
Comment on lines -84 to 102
/** OnDestroy hook */
ngOnDestroy(): void {
this._subscription.unsubscribe();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not delete this code

selectingSortCriteria(sortCriteria: string) {
this.sortCriteria = sortCriteria;
this._subscription.unsubscribe();
this._initialisePaginatorAndSubscription();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use le current paginator and change only le value. Not necessary to reinitialize the paginator.

*/
selectingSortCriteria(sortCriteria: string) {
this.sortCriteria = sortCriteria;
this._subscription.unsubscribe();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this code and change with comment below

@jma jma removed their request for review March 17, 2022 12:25
@vgranata vgranata force-pushed the grv-2263-loans-sorted-by-due-date branch from 1a95a13 to 2eab456 Compare March 24, 2022 07:52
@github-actions github-actions bot added the f: professional ui Professional interface label Mar 24, 2022
@vgranata vgranata force-pushed the grv-2263-loans-sorted-by-due-date branch 2 times, most recently from 7085bb5 to 65c98d0 Compare March 24, 2022 08:18
@vgranata vgranata force-pushed the grv-2263-loans-sorted-by-due-date branch 4 times, most recently from e3c2c9f to caa954f Compare March 24, 2022 11:02
@vgranata vgranata force-pushed the grv-2263-loans-sorted-by-due-date branch from caa954f to 6d4587f Compare March 24, 2022 12:39
@PascalRepond
Copy link
Contributor

PascalRepond commented Mar 29, 2022

Works as intended.

  • Non-blocking: The UI of the sort column dropdown could be better. I would keep a similar look as the one in the pro UI. Keep the table heading color, add a fine border, and add the double arrow to the right :
    image
    NPR: problem here is that we barely see that the option is clickable: low contrast of the button + no cursor mousehover
    image
  • NPR: The sort option disappears on mobile phones (and this view should be mobile first...)
  • NPR: Could we change the label of the sort to have: "Due date (earliest)" and "Due date (latest)"?
    • I think the end user (children, old people, etc.) don't understand easily "date ascending"
    • This would have the same scheme than for document for ex ("Date (oldest)", "Date (newest)")
  • PRE: Sort menu should only be visible when "current loans" tab is active, for now. When other tabs are active, it becomes invisible.

@vgranata vgranata force-pushed the grv-2263-loans-sorted-by-due-date branch from 6d4587f to a4ceabb Compare March 30, 2022 12:46
@github-actions github-actions bot removed the f: professional ui Professional interface label Mar 30, 2022
@vgranata vgranata force-pushed the grv-2263-loans-sorted-by-due-date branch from a4ceabb to a5bff64 Compare March 30, 2022 12:51
@vgranata vgranata force-pushed the grv-2263-loans-sorted-by-due-date branch from a5bff64 to f09b5f4 Compare March 31, 2022 13:50
Co-Authored-by: Valeria Granata <valeria@chaw.com>
@vgranata vgranata force-pushed the grv-2263-loans-sorted-by-due-date branch from f09b5f4 to de05524 Compare March 31, 2022 14:54
@PascalRepond PascalRepond merged commit a932e12 into rero:staging Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f: circulation Concerns the circulation interface or backend f: public ui Public interface, as opposed to the professional interface f: user management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loans should be sorted in ascending order on due date
4 participants