Skip to content
Snippets Groups Projects
Commit 24cec81f authored by Håkon Eilertsen Røskaft's avatar Håkon Eilertsen Røskaft
Browse files

Improved the color scheme and user friendliness of the rent button

parent b7b37880
No related branches found
No related tags found
1 merge request!81Renting
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<UserListItemCard :user="userForId"></UserListItemCard> <UserListItemCard :user="userForId"></UserListItemCard>
</div> </div>
<div class="mt-4"> <div class="mt-4">
<h3 class="text-base font-base text-gray-900">Ledige tidspunkter</h3> <h3 class="text-base font-base text-gray-900">Tidspunkter</h3>
<div> <div>
<p class="text-sm text-gray-900"> <p class="text-sm text-gray-900">
...@@ -65,7 +65,9 @@ ...@@ -65,7 +65,9 @@
Total pris: {{ totPrice }} kr Total pris: {{ totPrice }} kr
</p> </p>
<button <button
class="px-4 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-primary-medium rounded-md hover:bg-primary-light focus:outline-none focus:ring focus:ring-opacity-80" class="px-4 py-2 font-medium tracking-wide text-white capitalize transition-colors duration-200 transform bg-gray-600 rounded-md focus:outline-none focus:ring focus:ring-opacity-80"
v-bind:class="{ colorChange: allowForRent }"
@click="sendToConfirm()"
> >
<!-- This button should send you to the rent page --> <!-- This button should send you to the rent page -->
Rent now Rent now
...@@ -112,6 +114,7 @@ export default { ...@@ -112,6 +114,7 @@ export default {
rentingEndDate: null, rentingEndDate: null,
totPrice: 0, totPrice: 0,
dateMessage: "Venligst velg dato for leieperioden", dateMessage: "Venligst velg dato for leieperioden",
allowForRent: false,
}; };
}, },
components: { components: {
...@@ -152,15 +155,27 @@ export default { ...@@ -152,15 +155,27 @@ export default {
this.userForId = await getUser(userId); this.userForId = await getUser(userId);
}, },
setDate(dateOfsomthing) { setDate(dateOfsomthing) {
this.rentingStartDate = dateOfsomthing.startDate; if(dateOfsomthing.startDate == null || dateOfsomthing.endDate == null) {
this.rentingEndDate = dateOfsomthing.endDate; this.totPrice = this.item.pricePerDay;
this.calculateTotPrice(); this.allowForRent = false;
} else {
this.rentingStartDate = dateOfsomthing.startDate;
this.rentingEndDate = dateOfsomthing.endDate;
this.calculateTotPrice();
this.allowForRent = true;
}
}, },
calculateTotPrice() { calculateTotPrice() {
let amountOfDays = this.rentingEndDate - this.rentingStartDate; let amountOfDays = this.rentingEndDate - this.rentingStartDate;
amountOfDays = amountOfDays / 86400000; amountOfDays = amountOfDays / 86400000;
this.totPrice = this.item.pricePerDay * amountOfDays; this.totPrice = this.item.pricePerDay * amountOfDays;
} },
sendToConfirm() {
if(this.allowForRent) {
//TODO change this to a componet change
alert("Hei");
}
},
}, },
async beforeMount() { async beforeMount() {
await this.getItemPictures(); await this.getItemPictures();
...@@ -170,4 +185,12 @@ export default { ...@@ -170,4 +185,12 @@ export default {
}; };
</script> </script>
<style></style> <style>
.colorChange {
background-color: #004aad;
}
.colorChange:hover {
background-color: #306EC1;
}
</style>
...@@ -102,6 +102,10 @@ export default { ...@@ -102,6 +102,10 @@ export default {
this.endDate = null; this.endDate = null;
this.value = null; this.value = null;
this.error = false; this.error = false;
this.$emit("value", {
startDate: null,
endDate: null,
});
}, },
complete() { complete() {
if (this.error) return; if (this.error) return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment