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

feat(CSTM-CPC-876)Finalize Owner Details Page #570

Merged
merged 3 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions api-gateway/src/main/resources/static/css/ownerdetail.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
border-bottom: 1.5px solid rgba(0,0,0,0.1);
color: #2f2b2b;
}
.ownerRow{
display: flex;
}
.ownerCol{
flex: .35;
padding: 1em;
}

.hrColor{
border-top: 1px solid rgba(143,143,143,.30);
}

.ownerDetailContainer {
background-Color:white;
Expand All @@ -18,5 +29,15 @@
text-align:left;
color:rgba(0,0,0,0.25);
}


.photoBorder{
border: 1px solid rgba(143,143,143,.5);
box-shadow: 0 0 5px rgba(143,143,143,.5);
}
.petBody{
);
box-shadow: 0 0 5px rgba(143,143,143,.5);
}
.petBody:hover{
border: 1px solid #6db33f;
box-shadow: 0 0 5px #6db33f;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@
// Function to get pet type name based on petTypeId


vm.getBirthday = function(birthday) {

Check notice on line 17 in api-gateway/src/main/resources/static/scripts/owner-details/owner-details.controller.js

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Duplicated code fragment

Duplicated code
if (birthday) {
var date = new Date(birthday);
var year = date.getUTCFullYear();
var month = (date.getUTCMonth() + 1).toString().padStart(2, '0'); // Months are zero-based, so we add 1
var day = date.getUTCDate().toString().padStart(2, '0');
return year + ' / ' + month + ' / ' + day;
} else {
return '';
}
};


// Fetch owner data
$http.get('api/gateway/owners/' + $stateParams.ownerId)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
<link href="/css/ownerdetail.css" rel="stylesheet" type="text/css"/>

<div ng-controller="OwnerDetailsController" ng-app="ownerDetails" class="d-flex justify-content-center mt-5 mb-5 gap-5">
<div class="d-flex flex-column">
<div class=" d-flex flex-column p-5 shadow">
<div ng-controller="OwnerDetailsController" ng-app="ownerDetails" class="ownerRow justify-content-center mt-5 mb-5 gap-5">
<div class="ownerCol d-flex flex-column">
<div class=" d-flex flex-column p-5 shadow rounded">
<div class="d-flex flex-row justify-content-between">
<h3 class="">Owner Details</h3>

<h3 class="">Owner Details</h3>
<div class="d-flex flex-row">
<a style="color: rgba(0,0,0,0.5);" class="btn btn-light mx-2 px-2" ui-sref="ownerEdit({ownerId: $ctrl.owner.ownerId, method: 'edit'})">Edit</a>

<div class="bg-white shadow-sm mt-3 mb-1" style="width: 75px; height: 75px; border-radius: 50px;">
<img style="width: 100%; height: 100%; border-radius: 50px" src="../../images/default-owner-profile-picture.jpg"/>
<a style="color: rgba(0,0,0,0.5);" class="btn btn-light mx-2 px-2" ui-sref="ownerEdit({ownerId: $ctrl.owner.ownerId, method: 'delete'})">Delete</a>
</div>
</div>


<div class="bg-white shadow-sm photoBorder mt-3 mb-1" style="width: 75px; height: 75px; border-radius: 50px;">
<img style="width: 100%; height: 100%; border-radius: 50px" src="../../images/default-user-icon.png"/>
</div>

<form action="" class="pt-3">
Expand Down Expand Up @@ -51,43 +59,34 @@ <h3 class="">Owner Details</h3>
<label class="inputLabel">Phone Number</label>
</div>
</div>

<div class="d-flex flex-row gap-3 justify-content-end">
<div>
<a style="color: rgba(0,0,0,0.5);" class="btn btn-light" ui-sref="ownerEdit({ownerId: $ctrl.owner.ownerId, method: 'edit'})">Edit</a>
</div>
<div>
<a style="color: rgba(0,0,0,0.5);" class="btn btn-light" ui-sref="ownerEdit({ownerId: $ctrl.owner.ownerId, method: 'delete'})">Delete</a>
</div>
</div>

</form>

</div>

</div>
<div class="ownerCol d-flex flex-column">
<div class="d-flex h-100 flex-column p-5 shadow rounded">

<div class="d-flex flex-column">
<div class="d-flex flex-column p-5 shadow">
<div class="d-flex justify-content-between gap-5">
<h3 class="">Pet Details</h3>


<h3 class="">Pets</h3>
<div class="border-5 rounded">
<a style="color: rgba(0,0,0,0.5);" class="btn btn-light" ui-sref="ownerEdit({ownerId: $ctrl.owner.ownerId, method: 'edit'})">Add Pet</a>
<a style="color: rgba(0,0,0,0.5);" class="btn btn-light" ui-sref="petRegister({ownerId: $ctrl.owner.ownerId})">+</a>
</div>
</div>
<hr class="hrColor">
<div class="w-100">
<!-- Use ng-repeat to iterate through the owner's pets -->
<div ng-repeat="pet in $ctrl.pets" class="petBody d-flex m-2" ui-sref="petDetails({petId: pet.petId})">
<div class="bg-white shadow-sm m-2" style="width: 40px; height: 40px; border-radius: 50px;">
<img style="width: 100%; height: 100%; border-radius: 50px" src="../../images/animaldefault.png"/>

<div>
<!-- Use ng-repeat to iterate through the owner's pets -->
<div ng-repeat="pet in $ctrl.pets" class="d-flex justify-content-between">
<div class="mt-3">
<a style="color: rgba(0,0,0,0.5);" class="btn btn-light" ui-sref="editPet({ownerId: $ctrl.owner.ownerId, petId: pet.petId, method: 'edit'})">Edit Pet</a>
<p ui-sref="petDetails({petId: pet.petId})">Name: {{ pet.name }}</p>
<p>Pet Id: {{pet.petId}}</p>
<!-- Add more pet details as needed -->
</div>
</div>
<div class="d-flex align-items-center">
<p class="mt-2 mx-4">({{$ctrl.getPetTypeName(pet.petTypeId)}}) - {{pet.name}}<br>
{{$ctrl.getBirthday(pet.birthDate)}}</p>
</div>
</div>
</div>

</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ function PetDetailsController($http, $state, $stateParams, $scope, $timeout, $q)
});



vm.getBirthday = function(birthday) {
if (birthday) {
var date = new Date(birthday);
var year = date.getUTCFullYear();
var month = (date.getUTCMonth() + 1).toString().padStart(2, '0'); // Months are zero-based, so we add 1
var day = date.getUTCDate().toString().padStart(2, '0');
return year + ' / ' + month + ' / ' + day;
} else {
return '';
}
};


// Toggle pet's active status
vm.toggleActiveStatus = function (petId) {
return $http.get('api/gateway/pets/' +$stateParams.petId + '?_=' + new Date().getTime(), { headers: { 'Cache-Control': 'no-cache' } })
Expand Down Expand Up @@ -100,5 +114,4 @@ function PetDetailsController($http, $state, $stateParams, $scope, $timeout, $q)
$state.go('ownerDetails', {ownerId: vm.pet.ownerId});
};


}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h3>No pet found</h3>


<div class="bg-white shadow-sm mt-3 mb-1" style="width: 75px; height: 75px; border-radius: 50px;">
<img style="width: 100%; height: 100%; border-radius: 50px" src="../../images/default-owner-profile-picture.jpg"/>
<img style="width: 100%; height: 100%; border-radius: 50px" src="../../images/animaldefault.png"/>
</div>

<form action="" class="pt-3">
Expand All @@ -37,7 +37,7 @@ <h3>No pet found</h3>
<label class="inputLabel">Name</label>
</div>
<div class="d-flex flex-column">
<input class="inputFieldsStyle bg-white" value="{{$ctrl.pet.birthDate | date:'yyyy-MM-dd'}}" readonly disabled/>
<input class="inputFieldsStyle bg-white" value="{{$ctrl.getBirthday($ctrl.pet.birthDate)}}" readonly disabled/>
<label class="inputLabel">Birthday</label>
</div>
</div>
Expand Down
Loading