Проекты
-
+
Интервал выполнения
-
-
-
-
+
+
+
+
-
@@ -70,11 +87,7 @@ export default {
endDate: '',
startDate: '',
selectedStatus: '',
- items: [
- {
- type: 'newProjectButton',
- },
- ],
+ items: [],
statuses: [
{ text: 'Готово' },
{ text: 'Опоздание'},
@@ -83,6 +96,7 @@ export default {
{ text: 'Нет статуса' },
{ text: 'Новый' }
],
+ currentPage: 1,
};
},
computed: {
@@ -90,6 +104,20 @@ export default {
const user = this.$store.getters.getUser[0];
return user ? user.role : null;
},
+ itemsPerPage() {
+ if (this.currentPage === 1 && (this.userRole === 'Рабочий' || this.userRole === 'Прораб')) {
+ return 7;
+ }
+ return 6;
+ },
+ paginatedItems() {
+ const start = (this.currentPage - 1) * this.itemsPerPage;
+ const end = start + this.itemsPerPage;
+ return this.items.slice(start, end);
+ },
+ totalPages() {
+ return Math.ceil(this.items.length / this.itemsPerPage);
+ },
},
methods: {
formatToDateTime(date) {
@@ -97,8 +125,7 @@ export default {
},
async applyFilters() {
try {
- const params = new URLSearchParams({
- });
+ const params = new URLSearchParams({});
if (this.endDate) {
params.append('end_date', this.formatToDateTime(this.endDate));
@@ -124,7 +151,7 @@ export default {
projectId: project.id,
})),
];
- // console.log(response.data);
+ this.currentPage = 1;
} catch (error) {
if(error.response.status === 401){
this.$store.commit('removeUsers');
@@ -151,6 +178,7 @@ export default {
projectId: project.id,
})),
];
+ this.currentPage = 1;
} catch (error) {
if (error.response.status === 401) {
this.$store.commit('removeUsers'); // Изменяем состояние
@@ -174,6 +202,21 @@ export default {
this.selectedStatus = '';
this.fetchProjects();
},
+ prevPage() {
+ if (this.currentPage > 1) {
+ this.currentPage--;
+ }
+ },
+ nextPage() {
+ if (this.currentPage < this.totalPages) {
+ this.currentPage++;
+ }
+ },
+ goToPage(page) {
+ if (page >= 1 && page <= this.totalPages) {
+ this.currentPage = page;
+ }
+ },
},
beforeMount() {
this.fetchProjects();
@@ -192,7 +235,7 @@ export default {
justify-content: space-between;
align-items: center;
background-color: #fff;
- padding: 10px 20px;
+ /*padding: 10px 20px;*/
}
.search-input {
@@ -265,4 +308,34 @@ button:hover {
.project-item {
box-sizing: border-box;
}
-
+
+.pagination {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ margin-top: 20px;
+}
+
+.pagination button {
+ background-color: #6e6b93;
+ color: white;
+ padding: 8px 15px;
+ border: none;
+ border-radius: 5px;
+ cursor: pointer;
+ margin: 0 10px;
+}
+
+.pagination button.active {
+ background-color: #5c5583;
+}
+
+.pagination button:hover {
+ background-color: #5c5583;
+}
+
+.pagination button:disabled {
+ background-color: #ccc;
+ cursor: not-allowed;
+}
+
\ No newline at end of file
diff --git a/frontend/src/src/components/project/NewProjectButton.vue b/frontend/src/src/components/project/NewProjectButton.vue
index 5140835..d377ffe 100644
--- a/frontend/src/src/components/project/NewProjectButton.vue
+++ b/frontend/src/src/components/project/NewProjectButton.vue
@@ -18,7 +18,7 @@
+
+
+
+
+
+
+ ...
+
+
+
+
+
+ ...
+
+
+
+
+