Skip to content
This repository has been archived by the owner on Oct 15, 2023. It is now read-only.

Commit

Permalink
[NEW] Update HomeworkView.vue
Browse files Browse the repository at this point in the history
  • Loading branch information
sivelswhy authored Jun 11, 2023
1 parent d3a17d4 commit f11e241
Showing 1 changed file with 21 additions and 32 deletions.
53 changes: 21 additions & 32 deletions src/views/homework/HomeworkView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
HomeworkItemView: HomeworkItemView,
slides,
currentIndex: this.baseIndex,
rnButtonString2: this.createDateString(this.$rn),
loadedrnButtonString2: this.createDateString(this.$rn),
rnCalendarString2: this.$rn.toISOString().split('T')[0],
rnButtonString: this.createDateString(this.$rn),
loadedrnButtonString: this.createDateString(this.$rn),
rnCalendarString: this.$rn.toISOString().split('T')[0],
days: [],
connected: false,
shouldResetSwiper: false,
Expand Down Expand Up @@ -171,23 +171,23 @@
const indexDiff = this.baseIndex - index;
// get rn
let selectedRN2 = new Date(this.baseRn);
let selectedRN = new Date(this.baseRn);
if(goTo) {
selectedRN2 = new Date(this.$rn);
selectedRN = new Date(this.$rn);
}
selectedRN2.setDate(selectedRN2.getDate() - indexDiff);
selectedRN.setDate(selectedRN.getDate() - indexDiff);
// if i is 1
if(i == 1) {
this.$rn = selectedRN2;
this.rnButtonString2 = this.createDateString(this.$rn);
this.rnCalendarString2 = this.$rn.toISOString().split('T')[0];
this.$rn = selectedRN;
this.rnButtonString = this.createDateString(this.$rn);
this.rnCalendarString = this.$rn.toISOString().split('T')[0];
}
// get homeworks for rn
GetHomeworks(selectedRN2, selectedRN2, force).then((homeworks) => {
GetHomeworks(selectedRN, selectedRN, force).then((homeworks) => {
if(i == 2) {
clearTimeout(startloading);
this.isLoading = false;
Expand All @@ -212,7 +212,7 @@
}
else {
this.days[index] = this.editHomeworks(homeworks);
this.loadedrnButtonString2 = this.createDateString(this.$rn);
this.loadedrnButtonString = this.createDateString(this.$rn);
if(this.days[index]) {
this.days[index].loading = false;
}
Expand All @@ -226,11 +226,8 @@
// set homework to edit
const homework = homeworks[i];
// if homeworks[i].homework.shortContent exists
if(homework.homework.shortContent) {
// remove <br/> tags from homework.homework.shortContent
homeworks[i].homework.shortContent = homework.homework.shortContent.replace(/[<]br[^>]*[>]/gi,"");
}
// remove <br/> tags from homework.homework.content
homeworks[i].homework.shortContent = homework.homework.shortContent.replace(/[<]br[^>]*[>]/gi,"");
}
// set homeworks to edit
Expand Down Expand Up @@ -340,7 +337,7 @@
this.swiper = this.$refs.swiper.$el.swiper;
document.addEventListener('rnChanged', (e) => {
this.rnButtonString2 = this.createDateString(e.detail);
this.rnButtonString = this.createDateString(e.detail);
this.getHomeworks(false, e.detail);
});
Expand Down Expand Up @@ -382,7 +379,7 @@
<ion-button id="rnPickerModalButton" color="dark" @click="changernPickerModalOpen(true)">
<span class="material-symbols-outlined mdls" slot="start">calendar_month</span>

<p>{{ rnButtonString2 }}</p>
<p>{{ rnButtonString }}</p>
</ion-button>
</ion-buttons>

Expand All @@ -405,7 +402,11 @@
</ion-refresher>

<div id="noTouchZone"></div>

<IonFab slot="fixed" vertical="bottom" horizontal="end" class="newCoursBtnFab">
<ion-button @click="addHomework($event)" size="large" shape="round" class="newCoursBtn" mode="md" aria-label="Ajouter un devoir">
<span class="material-symbols-outlined mdls" slot="icon-only">add</span>
</ion-button>
</IonFab>
<swiper class="swiper" ref="swiper" :modules="[Virtual]" virtual :initialSlide="baseIndex" :speed="200" :spaceBetween="10" :preventClicks="true">
<swiper-slide class="slide"
v-for="(slideContent, index) in slides"
Expand Down Expand Up @@ -458,18 +459,6 @@
</div>
</div>

<IonList inset class="hwListItem add">
<IonItem button detail="false" @click="addHomework($event)">
<span class="material-symbols-outlined mdls" slot="start">add</span>
<IonNavLink class="navLink" router-direction="forward" :component="AddHomeworkView">
<IonLabel>
<h2>Ajouter un devoir</h2>
<p>Ajouter un devoir manuellement</p>
</IonLabel>
</IonNavLink>
</IonItem>
</IonList>

</swiper-slide>
</swiper>

Expand All @@ -488,7 +477,7 @@
presentation="date"
ref="rnInput"
size="cover"
:value="rnCalendarString2"
:value="rnCalendarString"
:firstDayOfWeek="1"
:min="minDate"
:max="maxDate"
Expand Down

0 comments on commit f11e241

Please sign in to comment.