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

#192 dashboard-slides #35

Merged
merged 20 commits into from
Nov 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
71b14e3
#192 create initial structure to rearrange slides
KiSobral Nov 18, 2019
523600d
#192 update harvest digest and reorder slides content
KiSobral Nov 18, 2019
825b453
#192 fix layout errors
KiSobral Nov 19, 2019
615116f
#192 merge branch develop to get updated API routes
KiSobral Nov 19, 2019
fbd884b
#192 get user's harvest from backend
KiSobral Nov 19, 2019
f3d94ff
#192 fix harvest digest image
KiSobral Nov 22, 2019
ed8a693
#192 update web browser icon and title
KiSobral Nov 22, 2019
78c821e
#192 add internationalization
KiSobral Nov 22, 2019
9709678
#192 fix lint errors
KiSobral Nov 22, 2019
a5864af
#192 merge branch devel and fix some errors
KiSobral Nov 22, 2019
62ec233
Fix layout of propertyDigest
mardntas Nov 22, 2019
ed0b6ff
#192 add no harvest error message and update property digest color
KiSobral Nov 23, 2019
4b2d10b
#192 Increase color contrast to better visualization
shayanealcantara Nov 23, 2019
680c6f2
#192 Correct colors and property title position
shayanealcantara Nov 23, 2019
4a4cf1f
Add alert of no harvests has been found
mardntas Nov 23, 2019
9c3371c
Merge branch 'feature/192-dashboard-slides' of https://github.com/fga…
mardntas Nov 23, 2019
8a8e042
Add title of component when harvest is not found
mardntas Nov 23, 2019
e65e31d
Merge branch 'develop' into feature/192-dashboard-slides
fabiola-m Nov 23, 2019
fad576c
#192 fix windows titles bugs
KiSobral Nov 23, 2019
11571bf
Merge branch 'develop' into feature/192-dashboard-slides
shayanealcantara Nov 23, 2019
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
Binary file removed public/favicon.ico
Binary file not shown.
6 changes: 3 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link rel="icon" type="image/png" href="<%= BASE_URL %>favicon.png">
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet">
<title>acacia</title>
<title>Acácia</title>
</head>
<body>
<noscript>
<strong>We're sorry but acacia doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
<strong>We're sorry but Acácia doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app">
</div>
Expand Down
139 changes: 117 additions & 22 deletions src/components/layout/HarvestCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,22 @@
<v-sheet
min-height="200"
max-height="300"
style="overflow:auto"
class="sheet-contailer"
>
<!-- User's harvests -->
<!-- User's properties -->
<div v-if="n == 1">
<h3 class="title-content roboto-regular">
{{ $t('HarvestDigest.userProperties') }}
</h3>

<div v-if="$store.state.getRefreshToken()">
<div v-if="!propertiesGet">
<v-progress-circular
:size="50"
color="primary"
indeterminate
class="mt-5"
></v-progress-circular>
/>
</div>
<div v-else-if="userProperties.length == 0">
<div
Expand All @@ -55,7 +56,64 @@
<v-divider v-if="index != userProperties.length - 1" />
</div>
</div>
</div>
<div
v-else
class="message-content raleway-regular"
>
<div
class="centralize-container"
>
<h4
style="width: 90%"
>
{{ $t('HarvestDigest.accessproperties') }}
</h4>
</div>
</div>
</div>


<!-- User's harvests -->
<div
v-else-if="n==2"
>
<h3 class="title-content roboto-regular">
{{ $t('HarvestDigest.yourharvests') }}
</h3>

<div
v-if="$store.state.getRefreshToken()"
>
<div
v-if="userHarvests.length > 0"
>
<div
v-for="(harvest, index) in userHarvests"
:key="index"
>
<HarvestDigest
:harvest="harvest"
/>
<v-divider v-if="index < userHarvests.length" />
</div>
</div>
<div
v-else
class="message-content raleway-regular"
>
<div
class="centralize-container"
>
<h4
style="width: 90%"
>
{{ $t('HarvestDigest.noUserHarvests') }}
</h4>
</div>
</div>
</div>

<div
v-else
class="message-content raleway-regular"
Expand All @@ -66,7 +124,7 @@
<h4
style="width: 90%"
>
{{ signinMessage }}
{{ $t('HarvestDigest.accessharvests') }}
</h4>
</div>
</div>
Expand All @@ -83,7 +141,7 @@
color="primary"
indeterminate
class="mt-5"
></v-progress-circular>
/>
</div>
<div
v-else-if="allHarvests.length == 0"
Expand All @@ -105,11 +163,9 @@
>
<div
v-for="(harvest, index) in allHarvests"
:key="harvest.date"
:key="harvest.pk"
>
<a :href="'/harvest/' + harvest.property_id + '/' + harvest.pk">
<HarvestDigest :harvest="harvest" />
</a>
<HarvestDigest :harvest="harvest" />
<v-divider v-if="index != allHarvests.length - 1" />
</div>
</div>
Expand Down Expand Up @@ -148,20 +204,17 @@
<script>
import HarvestDigest from '@/components/visualization/HarvestDigest'
import PropertyDigest from '@/components/visualization/PropertyDigest'

export default {
name: 'CardComponent',

components: {
HarvestDigest,
PropertyDigest
},

model: {
prop: "window",
event: "window-change",
},

props: {
window: {
default: 0,
Expand All @@ -170,13 +223,13 @@ export default {
},

data: () => ({
length: 2,
length: 3,
allHarvests: [],
userProperties: [],
userHarvests: [],
propertiesGet: false,
harvestGet: false
}),

computed: {
localwindow: {
get: function() {
Expand All @@ -199,12 +252,11 @@ export default {
return this.$t('HarvestDigest.noharvest')
},
},

created() {
this.getUserProperties();
this.getAllHarvests();
this.getUserHarvests();
},

methods: {
getAllHarvests() {
this.$store.state.noAuthRequest('harvests/', 'GET')
Expand Down Expand Up @@ -249,41 +301,84 @@ export default {
this.propertiesGet = true
})
},
getUserHarvests() {
let properties
let harvests
this.$store.state.authRequest('properties/', 'GET')
.then(response => {
this.userProperties = response.data
for (properties of this.userProperties) {
for (harvests of properties.harvests) {
this.userHarvests.push(harvests)
}
}
})
.catch((error) => {
console.log(error)
})
},
validateList() {
// Check if date is out of bounds (front end validation)
let filtered = []
let dateList = this.generateWeeksDaysList()
this.allHarvests.forEach( harvest => {
let found = false;
dateList.forEach( validDate => {
if (validDate == harvest.date) {
found = true;
}
});
if (found) {
filtered.push(harvest);
}
})
this.allHarvests = filtered;
},
generateWeeksDaysList() {
// Generates a list of the current and the next six days as ISO strings
let dateList = [];
let today = new Date();
let dayInMilissecond = 1000 * 60 * 60 * 24;
for (let i = 0; i < 7; i++) {
let dateString = today.toISOString().slice(0,10)
dateList.push(today.toISOString().slice(0,10))
today.setTime(dayInMilissecond + today.valueOf());
}
return dateList
},
},
}
</script>

<style lang="scss" scoped>

.card-container {
padding-bottom: 15px;
overflow: auto;
border-radius: 12px;
box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.25);
}

.title-content {
text-align: left;
color: #2D9CDB;
margin-left: 5px;
margin-top: 10px;
margin-bottom: 5px;
margin-bottom: 20px;
}

.v-btn--icon.v-size--default {
height: 20px;
width: 20px;
}

.message-content {
text-align: justify;
margin-top: 25px;
}

.centralize-container {
width: 100%;
display: flex;
flex-direction: row;
justify-content: center;
}
.sheet-contailer {
overflow: auto;
}
</style>
Loading