Skip to content

Commit

Permalink
big update front
Browse files Browse the repository at this point in the history
  • Loading branch information
Dariiiii committed Dec 20, 2024
1 parent a1f8a8a commit 3e2ab62
Show file tree
Hide file tree
Showing 14 changed files with 1,677 additions and 202 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<li v-if="isClient"><router-link to="/client/request">Заявки</router-link></li>
<li v-if="isAdmin"><router-link to="/admin/statistics">Cтатистика</router-link></li>
<li v-if="isAdmin"><router-link to="/admin/request">Заявки</router-link></li>
<!-- <li v-if="isAdmin"><router-link to="/admin/main">История</router-link></li> -->
<li v-if="isAdmin"><router-link to="/history">История</router-link></li>
<li v-if="isClient && !isOnProfilePage"><router-link to="/client/profile">{{ userName }}</router-link></li>
<li v-if="isAdmin && !isOnProfilePage"><router-link to="/admin/profile">{{ userName }}</router-link></li>
<li v-if="isClient && isOnProfilePage"><a href="#" @click.prevent="logout">Выход</a></li>
Expand All @@ -27,7 +27,7 @@ export default {
return localStorage.getItem('userType') === 'admin';
},
userName() {
return localStorage.getItem('userName') || 'Пользователь';
return localStorage.getItem('userName') || 'Не найдено';
},
isOnProfilePage() {
return this.$route.path === '/client/profile' || this.$route.path === '/admin/profile';
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import ClientLoanApplication from '../views/client/LoanApplication.vue';
import Statistics from '../views/admin/Statistics.vue';
import RequestDetail from '../views/RequestDetail.vue';
import CreditDetail from '../views/CreditDetail.vue';
import History from '../views/admin/History.vue';
import ClientCreditHistory from '../views/admin/ClientCreditHistory.vue';

const routes = [
// { path: '/', redirect: '/login' },
Expand All @@ -24,6 +26,8 @@ const routes = [
{ path: '/admin/request', component: AdminRequest },
{ path: '/request', component: RequestDetail},
{ path: '/credit', component: CreditDetail },
{ path: '/history', component: History },
{ path: '/client_credit_history', component: ClientCreditHistory },
{ path: '/client/profile', component: ClientProfile },
{ path: '/admin/profile', component: AdminProfile },
{ path: '/admin/statistics', component: Statistics },
Expand Down
15 changes: 13 additions & 2 deletions frontend/src/views/CreditDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h1>Детали кредита</h1>
<div v-if="request">
<div><strong>Название кредита:</strong> {{ request.loan_name }}</div>
<div><strong>Дата открытия:</strong> {{ formatDate(request.opening_date) }}</div>
<div><strong>Дата открытия:</strong> {{ formatDateTime(request.opening_date) }}</div>
<div><strong>Сумма:</strong> {{ request.amount }} руб.</div>
<div><strong>Ставка:</strong> {{ request.interest_rate }} %</div>
<div><strong>Срок:</strong> {{ request.expiration_time }} мес.</div>
Expand All @@ -30,6 +30,9 @@ export default {
created() {
this.getCreditDetails();
},
mounted() {
document.title = "Детали кредита";
},
methods: {
async getCreditDetails() {
try {
Expand All @@ -44,7 +47,7 @@ export default {
console.log('Ошибка при получении данных кредита:', error);
}
},
formatDate(date) {
formatDateTime(date) {
const options = {
year: 'numeric',
month: 'long',
Expand All @@ -54,6 +57,14 @@ export default {
second: '2-digit'
};
return new Date(date).toLocaleString('ru-RU', options);
},
formatDate(date) {
const options = {
year: 'numeric',
month: 'long',
day: 'numeric'
};
return new Date(date).toLocaleString('ru-RU', options);
}
}
};
Expand Down
7 changes: 5 additions & 2 deletions frontend/src/views/RequestDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h1>Детали заявки</h1>
<div v-if="request">
<div><strong>Название кредита:</strong> {{ request.loan_name }}</div>
<div><strong>Дата заявки:</strong> {{ formatDate(request.request_time) }}</div>
<div><strong>Дата заявки:</strong> {{ formatDateTime(request.request_time) }}</div>
<div><strong>Статус:</strong> {{ request.status }}</div>
<div><strong>Сумма:</strong> {{ request.amount }} руб.</div>
<div><strong>Ставка:</strong> {{ request.interest_rate }} %</div>
Expand Down Expand Up @@ -44,6 +44,9 @@ export default {
created() {
this.getRequestDetails();
},
mounted() {
document.title = "Детали заявки";
},
methods: {
async getRequestDetails() {
try {
Expand All @@ -59,7 +62,7 @@ export default {
console.log('Ошибка при получении данных заявки:', error);
}
},
formatDate(date) {
formatDateTime(date) {
const options = {
year: 'numeric',
month: 'long',
Expand Down
Loading

0 comments on commit 3e2ab62

Please sign in to comment.