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

hide room icon if null + localStorage for schedule #576

Merged
merged 3 commits into from
Jul 18, 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
3 changes: 3 additions & 0 deletions front-end/src/components/Library/LibraryFilters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<el-select
v-model="author"
clearable
filterable
placeholder="Все авторы"
class="filters-select"
@change="updateQuery"
Expand All @@ -44,6 +45,7 @@
<el-select
v-model="year"
clearable
filterable
placeholder="Все года"
class="filters-select"
@change="updateQuery"
Expand All @@ -64,6 +66,7 @@
<el-select
v-model="subject"
clearable
filterable
placeholder="Все предметы"
class="filters-select"
@change="updateQuery"
Expand Down
61 changes: 51 additions & 10 deletions front-end/src/components/Schedule/Schedule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@
</div>

<div>
<svg-icon icon-class="map-marker-outline" />
{{ data.lessons.find((x) => x.date === d).room.title }}
<svg-icon
v-if="data.lessons.find((x) => x.date === d).showIcon"
icon-class="map-marker-outline"
/>
{{ findRoom(data, d) }}
</div>

<el-tag
Expand Down Expand Up @@ -345,19 +348,39 @@ export default {

watch: {
milgroups(newValue) {
this.filter.mg = {
id: this.milgroups[0]?.id.toString(),
milspecialty: this.milgroups[0]?.milspecialty.id,
};
if (localStorage.milgroupUpdateId) {
this.filter.mg.id = localStorage.milgroupUpdateId;
this.filter.mg.milfaculty = localStorage.milgroupUpdateMilfaculty;
this.filter.mg.milspecialty = localStorage.milgroupUpdateMilspecialty;
} else {
this.filter.mg = {
id: this.milgroups[0]?.id.toString(),
milspecialty: this.milgroups[0]?.milspecialty.id,
};
}
if (localStorage.dataRange0) {
this.filter.dateRange[0] = localStorage.dataRange0;
this.filter.dateRange[1] = localStorage.dataRange1;
}
this.fetchData();
},
},

async created() {
this.filter.mg = {
id: this.milgroups[0]?.id.toString(),
milspecialty: this.milgroups[0]?.milspecialty.id,
};
if (localStorage.milgroupUpdateId) {
this.filter.mg.id = localStorage.milgroupUpdateId;
this.filter.mg.milfaculty = localStorage.milgroupUpdateMilfaculty;
this.filter.mg.milspecialty = localStorage.milgroupUpdateMilspecialty;
} else {
this.filter.mg = {
id: this.milgroups[0]?.id.toString(),
milspecialty: this.milgroups[0]?.milspecialty.id,
};
}
if (localStorage.dataRange0) {
this.filter.dateRange[0] = localStorage.dataRange0;
this.filter.dateRange[1] = localStorage.dataRange1;
}
if (this.filter.mg.id !== undefined) {
await this.fetchData();
}
Expand Down Expand Up @@ -444,6 +467,13 @@ export default {
this.schedule = response.data;
})
.catch(err => getError("расписания", err.response.status));
localStorage.milgroupUpdateId = this.filter.mg.id;
localStorage.milgroupUpdateMilfaculty = this.filter.mg.milfaculty;
localStorage.milgroupUpdateMilspecialty = this.filter.mg.milspecialty;
// eslint-disable-next-line prefer-destructuring
localStorage.dataRange0 = this.filter.dateRange[0];
// eslint-disable-next-line prefer-destructuring
localStorage.dataRange1 = this.filter.dateRange[1];
},

async getSubjects() {
Expand Down Expand Up @@ -550,6 +580,17 @@ export default {
.catch(err => deleteError("занятия", err.response.status));
});
},

findRoom(data, d) {
if (data.lessons.find(x => x.date === d).room !== null) {
// eslint-disable-next-line no-param-reassign
data.lessons.find(x => x.date === d).showIcon = true;
return data.lessons.find(x => x.date === d).room.title;
}
// eslint-disable-next-line no-param-reassign
data.lessons.find(x => x.date === d).showIcon = false;
return null;
},
},
};
</script>
Expand Down
2 changes: 2 additions & 0 deletions front-end/src/components/Search/PapersAdvanced.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<el-select
v-model="author"
clearable
filterable
placeholder="Все авторы"
class="filters-select"
@change="updateQuery"
Expand All @@ -40,6 +41,7 @@
<el-select
v-model="publisher"
clearable
filterable
placeholder="Все размещения"
class="filters-select"
@change="updateQuery"
Expand Down
Loading