Skip to content

Commit

Permalink
feat(VIST-CPC-913): sorting visits into status tables (#536)
Browse files Browse the repository at this point in the history
JIRA: link to jira ticket
https://champlainsaintlambert.atlassian.net/browse/CPC-913

## Context:
This ticket is regarding making updates to the Visit-List UI. Our team
thought it would be an interesting idea to separate visits into more
than just a single table and, to compliment our recent implementations
of status-button functionalities, we thought it would be best for these
tables to be based on visit status. We now have a total of four tables:
Upcoming Visits, Confirmed Visits, Cancelled Visits and Completed
Visits.

## Changes
- Tweaks to the controller.js file were made to push visitData to the
appropriate status table
- Three new status tables were added to the html template (aside from
our original upcoming visits table that was previously implemented)
- Styling modifications were made to make the UI maintain consistency
and be more visually appealing

## Before and After UI (Required for UI-impacting PRs)
Before changes: 
<img width="1792" alt="273456000-c9c47dd1-d8da-44cc-b0ca-7e873fdfa0ad"
src="https://github.com/cgerard321/champlain_petclinic/assets/77695020/41ebfc68-ad65-4af9-99a4-4a7643ea6db2">

After Changes:

![After_Changes](https://github.com/cgerard321/champlain_petclinic/assets/77695020/cdf1b26c-4eb8-4fa5-8c28-e8a08aead452)


After all visits are removed from a particular table:

![After_Removing_All_Visits_From_A_Table](https://github.com/cgerard321/champlain_petclinic/assets/77695020/8865ad02-fc19-4ef8-a1f3-30be80a0fb4f)


## Dev notes (Optional)
- A table that has no visits in it will be hidden until a new one is
eventually added to it. This is possible through the use of '
ng-show="$ctrl.table.length > 0 '
  • Loading branch information
Iantomasi authored Oct 10, 2023
1 parent fa65b27 commit bc760ba
Show file tree
Hide file tree
Showing 4 changed files with 231 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public Mono<Void> deleteVisitByVisitId(String visitId){
public Mono<Void> deleteAllCancelledVisits(){
return webClient
.delete()
.uri("/visits/cancelled")
.uri("/cancelled")
.retrieve()
.bodyToMono(Void.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ angular.module('visitList')
let self = this;
// Lists holding visits for the tables to display
self.upcomingVisits = []
self.previousVisits = []
self.confirmedVisits = []
self.cancelledVisits = []
self.completedVisits = []

let url
//sorted by order or most to least permissions
if ($window.localStorage.getItem("roles").includes("ADMIN")){
Expand All @@ -19,9 +22,25 @@ angular.module('visitList')
eventSource.addEventListener('message', function (event){
$scope.$apply(function(){
console.log(event.data)
self.upcomingVisits.push(JSON.parse(event.data))
})
})
const visitData = JSON.parse(event.data);
switch (visitData.status) {
case "UPCOMING":
self.upcomingVisits.push(visitData);
break;
case "CONFIRMED":
self.confirmedVisits.push(visitData);
break;
case "CANCELLED":
self.cancelledVisits.push(visitData);
break;
case "COMPLETED":
self.completedVisits.push(visitData);
break;
default:
break;
}
});
});
eventSource.onerror = (error) =>{
if(eventSource.readyState === 0){
eventSource.close()
Expand Down Expand Up @@ -109,7 +128,7 @@ angular.module('visitList')
loadingIndicator.style.display = 'block'
setTimeout(function() {
location.reload()
}, 1000) //delay by 1 second
}, 150) //delay reload to be more graceful
}
function errorCallback(error) {
alert(error.errors)
Expand Down
Loading

0 comments on commit bc760ba

Please sign in to comment.