feat: add front pages

This commit is contained in:
Володя 2024-12-17 13:21:54 +04:00
parent e2b185804e
commit a32bff5d3a
60 changed files with 16825 additions and 553 deletions

View File

@ -29,7 +29,7 @@ public final class myTimer {
LocalDateTime later = LocalDateTime.now().plusDays(10);
Date LaterAsDate = Date.from(later.atZone(ZoneId.systemDefault()).toInstant());
this.date = later;
new Timer().schedule(new Task(orderService), LaterAsDate);
}

View File

@ -54,6 +54,7 @@ public class AchievementsController {
}
catch (Exception ex)
{
System.out.println(ex.getMessage());
return new ResponseEntity<>
(null, HttpStatus.INTERNAL_SERVER_ERROR);
}

View File

@ -40,10 +40,13 @@ public class TrainingDto {
this.num = training.getNum();
this.desc = training.getDesc();
if(training.getExams() != null){
for(var exam: training.getExams())
{
this.exams.add(exam.getExam().getTitle() + " (" + exam.getPoints() + "б.)");
}
}
this.prof = training.getProf();
this.basic_places = training.getBasic_places();

View File

@ -17,7 +17,7 @@ public class TrainingExamDto {
private int exam ;
private String title;
private String title = null;
private int points ;

View File

@ -1,10 +1,7 @@
package putBit.app.controllers.Dto;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.*;
import putBit.app.models.User;
import putBit.app.models.enums.Role;
@ -16,19 +13,19 @@ public class UserDto {
private int id ;
private String role = null;
private String role ;
private String email = null;
private String email;
private String password = null;
private String password ;
private String AgainPassword = null;
private String againPassword ;
private String phone = null;
private String phone ;
private String name = null;
private String name ;
private String snils = null;
private String snils ;
public UserDto(User user){

View File

@ -18,12 +18,12 @@ import java.util.List;
public class OrderController {
private final OrderService orderService;
@PostMapping("/")
public ResponseEntity<OrderDto> create(@RequestBody OrderDto examDto) {
@PostMapping("/{userID}/{trainingId}")
public ResponseEntity<OrderDto> create(@PathVariable int userID, @PathVariable int trainingId) {
try
{
return new ResponseEntity<>
(new OrderDto(orderService.create(examDto)), HttpStatus.OK);
(new OrderDto(orderService.create(userID,trainingId)), HttpStatus.OK);
}
catch (ValidationException ex)
{
@ -32,18 +32,19 @@ public class OrderController {
}
catch (Exception ex)
{
System.out.println(ex.getMessage());
return new ResponseEntity<>
(null, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@DeleteMapping("/{userId}/{trainingId}")
public ResponseEntity<OrderDto> delete(@PathVariable int userId, @PathVariable int trainingId) {
@DeleteMapping("/{userId}")
public ResponseEntity<OrderDto> delete(@PathVariable int userId) {
try
{
return new ResponseEntity<>
(new OrderDto(orderService.delete(userId, trainingId)), HttpStatus.OK);
(new OrderDto(orderService.delete(userId)), HttpStatus.OK);
}
catch (ValidationException ex)
{
@ -59,7 +60,7 @@ public class OrderController {
}
@GetMapping("/benefit/{id}")
public ResponseEntity<List<OrderDto>> getBenefit(@PathVariable int id) {
public ResponseEntity<List<OrderDto>> getOrderForBenefit(@PathVariable int id) {
try
{
return new ResponseEntity<>
@ -79,7 +80,7 @@ public class OrderController {
}
@GetMapping("/basic/{id}")
public ResponseEntity<List<OrderDto>> getBasic(@PathVariable int id) {
public ResponseEntity<List<OrderDto>> getOrderOfBasic(@PathVariable int id) {
try
{
return new ResponseEntity<>

View File

@ -27,11 +27,13 @@ public class TrainingController {
}
catch (ValidationException ex)
{
System.out.println(ex.getMessage());
return new ResponseEntity<>
(null, HttpStatus.BAD_REQUEST);
}
catch (Exception ex)
{
System.out.println(ex.getMessage());
return new ResponseEntity<>
(null, HttpStatus.INTERNAL_SERVER_ERROR);
}
@ -121,6 +123,26 @@ public class TrainingController {
}
@GetMapping("/search/{title}")
public ResponseEntity<List<TrainingDto>> search(@PathVariable String title) {
try
{
return new ResponseEntity<>
(trainingService.findByTitle(title).stream().map(TrainingDto::new).toList(), HttpStatus.OK);
}
catch (ValidationException ex)
{
return new ResponseEntity<>
(null, HttpStatus.BAD_REQUEST);
}
catch (Exception ex)
{
return new ResponseEntity<>
(null, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
}

View File

@ -105,7 +105,7 @@ public class TrainingExamController {
}
@GetMapping("/forTraining/{id}")
public ResponseEntity<List<TrainingExamDto>> getForUser(@PathVariable int id) {
public ResponseEntity<List<TrainingExamDto>> getForTraining(@PathVariable int id) {
try
{
return new ResponseEntity<>

View File

@ -4,13 +4,11 @@ import lombok.AllArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import putBit.app.controllers.Dto.ExamResultDto;
import putBit.app.controllers.Dto.UserDto;
import putBit.app.services.*;
import putBit.app.services.exceptions.EntityNotFoundException;
import putBit.app.services.exceptions.ValidationException;
import java.util.List;
@AllArgsConstructor
@ -32,6 +30,7 @@ public class UserController {
}
catch (ValidationException ex)
{
System.out.println(ex.getMessage());
return new ResponseEntity<>
(null, HttpStatus.BAD_REQUEST);
}
@ -43,20 +42,104 @@ public class UserController {
}
@GetMapping("/auth")
public ResponseEntity<UserDto> auth(@RequestBody UserDto userDto) {
@PostMapping("/achievement/{user}/{achievement}")
public ResponseEntity<UserDto> addAchievement(@PathVariable int user, @PathVariable int achievement) {
try
{
return new ResponseEntity<>
(new UserDto(userService.auth(userDto)), HttpStatus.OK);
(new UserDto(userService.addAchievement(user,achievement)), HttpStatus.OK);
}
catch (ValidationException ex)
{
System.out.println(ex.getMessage());
return new ResponseEntity<>
(null, HttpStatus.BAD_REQUEST);
}
catch (EntityNotFoundException ex)
catch (Exception ex)
{
return new ResponseEntity<>
(null, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@PostMapping("/benefit/{user}/{benefit}")
public ResponseEntity<UserDto> addBenefit(@PathVariable int user, @PathVariable int benefit) {
try
{
return new ResponseEntity<>
(new UserDto(userService.addBenefit(user,benefit)), HttpStatus.OK);
}
catch (ValidationException ex)
{
System.out.println(ex.getMessage());
return new ResponseEntity<>
(null, HttpStatus.BAD_REQUEST);
}
catch (Exception ex)
{
return new ResponseEntity<>
(null, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@DeleteMapping("/achievement/{user}/{achievement}")
public ResponseEntity<UserDto> removeAchievement(@PathVariable int user, @PathVariable int achievement) {
try
{
return new ResponseEntity<>
(new UserDto(userService.removeAchievement(user,achievement)), HttpStatus.OK);
}
catch (ValidationException ex)
{
System.out.println(ex.getMessage());
return new ResponseEntity<>
(null, HttpStatus.BAD_REQUEST);
}
catch (Exception ex)
{
return new ResponseEntity<>
(null, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@DeleteMapping("/benefit/{user}/{benefit}")
public ResponseEntity<UserDto> removeBenefit(@PathVariable int user, @PathVariable int benefit) {
try
{
return new ResponseEntity<>
(new UserDto(userService.removeBenefit(user,benefit)), HttpStatus.OK);
}
catch (ValidationException ex)
{
System.out.println(ex.getMessage());
return new ResponseEntity<>
(null, HttpStatus.BAD_REQUEST);
}
catch (Exception ex)
{
return new ResponseEntity<>
(null, HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@GetMapping("/{email}/{password}")
public ResponseEntity<UserDto> auth(@PathVariable String email, @PathVariable String password) {
try
{
UserDto userDto = UserDto.builder()
.email(email)
.password(password)
.build();
return new ResponseEntity<>
(new UserDto(userService.auth(userDto)), HttpStatus.OK);
}
catch (ValidationException | EntityNotFoundException ex)
{
System.out.println(ex.getMessage());
return new ResponseEntity<>
(null, HttpStatus.BAD_REQUEST);
}
@ -77,6 +160,7 @@ public class UserController {
}
catch (ValidationException ex)
{
System.out.println(ex.getMessage());
return new ResponseEntity<>
(null, HttpStatus.BAD_REQUEST);
}

View File

@ -31,7 +31,7 @@ public class ExamResultService {
ExamResult newExam = ExamResult.builder()
.user(user)
.exam(exam)
.points(0)
.points(examResult.getPoints())
.build();
return examResultRepository.save(newExam);
}

View File

@ -16,6 +16,7 @@ import putBit.app.repositories.TrainingRepository;
import putBit.app.repositories.UserRepository;
import putBit.app.services.WorkEmail.EmailWork;
import putBit.app.services.exceptions.EntityNotFoundException;
import putBit.app.services.exceptions.ValidationException;
import putBit.app.services.help.OrderPoints;
import java.util.ArrayList;
@ -46,9 +47,9 @@ public class OrderService {
}
@Transactional
public Order create(OrderDto order){
User user = userService.findById(order.getUser());
Training training = trainingService.findById(order.getTraining());
public Order create(int userID, int trainingId){
User user = userService.findById(userID);
Training training = trainingService.findById(trainingId);
int limit = 0;
for(TrainingExam exam:
training.getExams())
@ -57,14 +58,14 @@ public class OrderService {
for(ExamResult result:
user.getExams())
{
if(result.getExam().getId() == exam.getExam().getId())
if(result.getExam().getId() == exam.getExam().getId() && result.getPoints() >= exam.getPoints())
{
check = true;
break;
}
}
if(!check)
return null;
throw new ValidationException("Нет нужных экзаменов");
}
for(TrainingExam exam:
@ -97,8 +98,9 @@ public class OrderService {
.orElseThrow(() -> new EntityNotFoundException("Заявка не найдена"));
}
@Transactional
public Order delete(int userId, int trainId){
Order currentOrder = findById(userId,trainId);
public Order delete(int userId){
User user = userService.findById(userId);
Order currentOrder = orderRepository.findByUser(user).orElseThrow();
orderRepository.deleteByUser(userId);
return currentOrder;
@ -177,6 +179,6 @@ public class OrderService {
}
orderRepository.saveAll(orderToUpdate);
}
//emailSend();
emailSend();
}
}

View File

@ -29,7 +29,7 @@ public class TrainingExamService {
TrainingExam newExam = TrainingExam.builder()
.training(training)
.exam(exam)
.points(0)
.points(trainingExam.getPoints())
.build();
return trainingExamRepository.save(newExam);
}

View File

@ -19,10 +19,10 @@ public class TrainingService {
private final TrainingRepository trainingRepository;
public Training create(TrainingDto training){
System.out.println(training.getNum());
if(training.getTitle().isEmpty() || (training.getTitle().length() < 2 || training.getTitle().length() > 50 ) )
throw new ValidationException("Неверное название");
if(training.getNum().isEmpty() || (training.getNum().length() < 8 || training.getTitle().length() > 11 ) )
if(training.getNum().isEmpty() || (training.getNum().length() < 8 || training.getNum().length() > 11 ) )
throw new ValidationException("Неверный номер");
if(training.getDesc().isEmpty() || (training.getDesc().length() < 10 || training.getDesc().length() > 300 ) )
throw new ValidationException("Неверное описание");

View File

@ -33,14 +33,14 @@ public class UserService {
}
public User create(UserDto user){
System.out.println(user);
if(patternMatches(user.getEmail()) )
throw new ValidationException("Неверная почта");
if(user.getName().isEmpty() || (user.getName().length() < 3 || user.getName().length() > 80 ) )
throw new ValidationException("Неверное ФИО");
if(user.getSnils().length() != 11)
throw new ValidationException("Неверный снилс");
if(user.getPassword().isEmpty() || (user.getPassword().length() < 6 || user.getName().length() > 20 ) )
if(user.getPassword().isEmpty() || (user.getPassword().length() < 6 || user.getPassword().length() > 20 ) )
throw new ValidationException("Неверный пароль");
if(user.getPhone().length() != 11)
throw new ValidationException("Неверный номер телефона");
@ -76,7 +76,7 @@ public class UserService {
throw new ValidationException("Неверное ФИО");
if(user.getSnils().length() != 11)
throw new ValidationException("Неверный снилс");
if(user.getPassword().isEmpty() || (user.getPassword().length() < 6 || user.getName().length() > 20 ) )
if(user.getPassword().isEmpty() || (user.getPassword().length() < 6 || user.getPassword().length() > 20 ) )
throw new ValidationException("Неверный пароль");
if(user.getPhone().length() > 12 || user.getPhone().length() < 11)
throw new ValidationException("Неверный номер телефона");
@ -97,30 +97,30 @@ public class UserService {
return userRepository.save(currentUser);
}
public User addAchievement(UserDto user, AchievementDto achievement){
User currentUser = findById(user.getId());
Achievement newAch = achievementService.findById(achievement.getId());
public User addAchievement(int userId, int achId){
User currentUser = findById(userId);
Achievement newAch = achievementService.findById(achId);
currentUser.addAchievement(newAch);
return userRepository.save(currentUser);
}
public User addBenefit(UserDto user, BenefitDto benefit){
User currentUser = findById(user.getId());
Benefit newBen = benefitService.findById(benefit.getId());
public User addBenefit(int userId, int benId){
User currentUser = findById(userId);
Benefit newBen = benefitService.findById(benId);
currentUser.addBenefit(newBen);
return userRepository.save(currentUser);
}
public User removeAchievement(UserDto user,AchievementDto achievement){
User currentUser = findById(user.getId());
Achievement newAch = achievementService.findById(achievement.getId());
public User removeAchievement(int userId, int achId){
User currentUser = findById(userId);
Achievement newAch = achievementService.findById(achId);
if (!currentUser.deleteAchievement(newAch))
throw new RuntimeException("нет такой ачивки у этого человека");
return userRepository.save(currentUser);
}
public User removeBenefit(UserDto user,BenefitDto benefit){
User currentUser = findById(user.getId());
Benefit newBen = benefitService.findById(benefit.getId());
public User removeBenefit(int userId, int benId){
User currentUser = findById(userId);
Benefit newBen = benefitService.findById(benId);
if (!currentUser.deleteBenefit(newBen))
throw new RuntimeException("нет такой ачивки у этого человека");
return userRepository.save(currentUser);

File diff suppressed because it is too large Load Diff

23
front/.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

24
front/README.md Normal file
View File

@ -0,0 +1,24 @@
# frontvid
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

5
front/babel.config.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

19
front/jsconfig.json Normal file
View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}

12719
front/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

52
front/package.json Normal file
View File

@ -0,0 +1,52 @@
{
"name": "frontvid",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^1.4.0",
"bootstrap": "^4.6.0",
"core-js": "^3.8.3",
"jquery": "^3.6.4",
"popper.js": "^1.16.1",
"vue": "^3.2.13",
"vue-router": "^4.1.6"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"node-sass": "^9.0.0",
"sass-loader": "^16.0.4"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "@babel/eslint-parser"
},
"rules": {
"vue/multi-word-component-names": 0
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead",
"not ie 11"
]
}

BIN
front/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

18
front/public/index.html Normal file
View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="">
<head>
<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">
<title><%= htmlWebpackPlugin.options.title %></title>
<link type="text/css" rel="stylesheet" href="//unpkg.com/bootstrap/dist/css/bootstrap.min.css" />
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

50
front/src/App.vue Normal file
View File

@ -0,0 +1,50 @@
<template>
<div id="app" class="my">
<div>
<router-view />
</div>
</div>
</template>
<script>
import UserSevice from './services/UserSevice';
export default {
name: "app",
created() {
if(localStorage.getItem('user') != "" && localStorage.getItem('user') != null){
UserSevice.get(localStorage.getItem('user')).then(response =>{
if(response.data.role == "USER"){
this.$router.push('/profile')
}else{
this.$router.push('/trains')
}
})
}
else
{
localStorage.clear()
this.$router.push("/login")
}
},
};
</script>
<style>
.my
{
position:relative ;
top:0;
right: 0;
bottom: 0;
left: 0;
min-height: calc(108vh - 3em - 10px);
background-image:
linear-gradient(#ffbb768f, #ffbb768f),
url("./assets/mainBackground.jpg");
background-repeat: repeat-y;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
front/src/assets/logo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

BIN
front/src/assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 892 KiB

View File

@ -0,0 +1,25 @@
<template>
<div>
<div class="container2">
<slot></slot>
</div>
</div>
</template>
<script>
export default {
name: 'LayoutDiv',
};
</script>
<style>
.container2 {
position: fixed;
top:0;
right: 0;
bottom: 0;
left: 0;
background-image: url("../assets/backgroundAuthReg.jpg");
background-size: cover;
}
</style>

View File

@ -0,0 +1,195 @@
<template>
<div v-if="show" class="modal-shadow" @click.self="closeModal">
<div class="container">
<form >
<div class="mb-3">
<label
htmlFor="num"
class="form-label">Номер
</label>
<input
type="text"
class="form-control"
id="num"
name="num"
v-model="num"
/>
</div>
<div class="mb-3">
<label
htmlFor="title"
class="form-label">Название
</label>
<input
type="text"
class="form-control"
id="title"
name="title"
v-model="title"
/>
</div>
<div class="mb-3">
<label
htmlFor="basic"
class="form-label">Базовые места
</label>
<input
type="number"
class="form-control"
id="basic"
name="basic"
v-model="basic"
/>
</div>
<div class="mb-3">
<label
htmlFor="benefits"
class="form-label">Льготные места
</label>
<input
type="number"
class="form-control"
id="benefits"
name="benefits"
v-model="benefits"
/>
</div>
<div class="mb-3">
<label
htmlFor="desc"
class="form-label">Описание
</label>
<textarea
type="text"
class="form-control"
id="desc"
name="desc"
v-model="desc"
></textarea>
</div>
<div class="mb-3">
<label
htmlFor="prof"
class="form-label">Возможные профессии
</label>
<textarea
type="prof"
class="form-control"
id="prof"
name="prof"
v-model="prof"
></textarea>
</div>
<div class="d-grid gap-2">
<button
@click="create"
type="button"
class="btn btn-primary btn-block">Добавить
</button>
</div>
</form>
</div>
</div>
</template>
<script>
import TrainingSevice from '@/services/TrainingSevice';
export default {
name: "ModalWindow",
data: function () {
return {
show: false,
num:'',
title:'',
desc:'',
prof: '',
basic:0,
benefits:0
}
},
methods: {
closeModal() {
this.show = false
this.num=''
this.title =''
this.desc=''
this.prof= ''
this.basic=0
this.benefits=0
},
create(){
let data = {
id:null,
num:this.num,
title:this.title,
desc:this.desc,
prof: this.prof,
basic_places: this.basic,
benefit_places: this.benefits
}
console.log(data)
TrainingSevice.create(data).then(res => {
console.log(res.data)
window.location.reload()
})
}
}
}
</script>
<style scoped >
.modal-shadow {
position: absolute;
top: 0;
left: 0;
min-height: 100%;
width: 100%;
padding: 50px ;
background: rgba(0, 0, 0, 0.39);
}
.container {
position: absolute;
min-width: 100px;
height: fit-content;
top: 50%;
left: 50%;
padding: 1%;
transform: translate(-50%, -50%);
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);
}
.modal-close {
border-radius: 50%;
color: #fff;
background: #2a4cc7;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 7px;
right: 7px;
width: 30px;
height: 30px;
cursor: pointer;
}
.modal-title {
color: #0971c7;
}
.modal-content {
margin-bottom: 20px
}
</style>

View File

@ -0,0 +1,140 @@
<template>
<div v-if="show" class="modal-shadow " @click.self="closeModal">
<div class="container row ">
<div class="col col-lg-5 rounded-card addScroll">
<H3>Направления</H3>
<div>
<div class="rounded-card" v-for="row in trainings" :key="row.id" style="min-width:max-content;" @click="clickOnCard(row)">
<h4>{{ row.num }}</h4>
<h5>{{ row.title }}</h5>
</div>
</div>
</div>
<div class="col rounded-card">
<div class="mt-3" >
<label for="num" style="color: black;font-weight: bold;">Номер:</label>
<span v-if="currentTraining"> {{ currentTraining.num }}</span>
</div>
<div class="mt-3" >
<label for="title" style="color: black;font-weight: bold;">Название:</label>
<span v-if="currentTraining"> {{ currentTraining.title }}</span>
</div>
<div class="mt-3" >
<label for="desc" style="color: black;font-weight: bold;">Описание:</label>
<span v-if="currentTraining"> {{ currentTraining.desc }}</span>
</div>
<div class="mt-3" >
<label for="prof" style="color: black;font-weight: bold;">Возможные профессии:</label>
<span v-if="currentTraining"> {{ currentTraining.prof }}</span>
</div>
<div class="mt-3" v-if="currentTraining">
<label for="exams" style="color: black;font-weight: bold;">Экзамены:</label><p></p>
<span v-for="exam in currentTraining.exams" :key="exam">{{ exam }} <p></p></span>
</div>
</div>
<div class="row rounded-card">
<button class="btn-success" @click="sendOrder" :disabled="isSelected">Отправить</button>
</div>
</div>
</div>
</template>
<script>
import OrderSevice from '@/services/OrderSevice';
import TrainingSevice from '@/services/TrainingSevice';
export default {
name: "ModalWindow",
data: function () {
return {
show: false,
trainings: [],
currentTraining:null,
isSelected:true
}
},
beforeCreate(){
TrainingSevice.getAll().then(response =>{
this.trainings = response.data
})
},
methods: {
closeModal() {
this.show = false
},
sendOrder(){
OrderSevice.create(localStorage.getItem('user'), this.currentTraining.id).then(res => {
console.log(res.data)
window.location.reload()
})
},
clickOnCard(data){
this.currentTraining = data;
this.isSelected = false
}
}
}
</script>
<style scoped >
.modal-shadow {
position: absolute;
top: 0;
left: 0;
min-height: 100%;
width: 100%;
padding: 50px ;
background: rgba(0, 0, 0, 0.39);
}
.rounded-card{
border: 5px solid #3f8ba2;
padding:6px;
margin:6px;
border-radius:8px;
align-items: center;
}
.container {
position: absolute;
min-width: max-content;
min-height: 70%;
max-height: fit-content;
padding: 3%;
margin: 3%;
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);
}
.modal-close {
border-radius: 50%;
color: #fff;
background: #2a4cc7;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 7px;
right: 7px;
width: 30px;
height: 30px;
cursor: pointer;
}
.modal-title {
color: #0971c7;
}
.modal-content {
margin-bottom: 20px
}
.addScroll{
overflow-y:auto;
height: 400px;
}
</style>

View File

@ -0,0 +1,190 @@
<template>
<div v-if="show" class="modal-shadow" @click.self="closeModal">
<div class="container">
<form >
<div class="mb-3">
<label
htmlFor="name"
class="form-label">Номер
</label>
<input
type="text"
class="form-control"
id="name"
name="name"
v-model="num"
/>
</div>
<div class="mb-3">
<label
htmlFor="phone"
class="form-label">Название
</label>
<input
type="text"
class="form-control"
id="phone"
name="phone"
v-model="title"
/>
</div>
<div class="mb-3">
<label
htmlFor="phone"
class="form-label">Базовые места
</label>
<input
type="number"
class="form-control"
id="phone"
name="phone"
v-model="basic"
/>
</div>
<div class="mb-3">
<label
htmlFor="phone"
class="form-label">Льготные места
</label>
<input
type="number"
class="form-control"
id="phone"
name="phone"
v-model="benefits"
/>
</div>
<div class="mb-3">
<label
htmlFor="snils"
class="form-label">Описание
</label>
<textarea
type="text"
class="form-control"
id="snils"
name="snils"
v-model="desc"
></textarea>
</div>
<div class="mb-3">
<label
htmlFor="email"
class="form-label">Возможные профессии
</label>
<textarea
type="email"
class="form-control"
id="email"
name="email"
v-model="prof"
></textarea>
</div>
<div class="d-grid gap-2">
<button
@click="updateTraining()"
type="button"
class="btn btn-primary btn-block">Обновить
</button>
</div>
</form>
</div>
</div>
</template>
<script>
import TrainingSevice from '@/services/TrainingSevice';
export default {
name: "ModalWindow",
data: function () {
return {
show: false,
id:-1,
num:'',
title:'',
desc:'',
prof: '',
basic:0,
benefits:0
}
},
methods: {
closeModal() {
this.show = false
},
updateTraining(){
let data = {
id:this.id,
num:this.num,
title:this.title,
desc:this.desc,
prof: this.prof,
basic_places: this.basic,
benefit_places: this.benefits
}
console.log(data)
TrainingSevice.update(data).then(res => {
console.log(res.data)
window.location.reload()
})
}
}
}
</script>
<style scoped >
.modal-shadow {
position: absolute;
top: 0;
left: 0;
min-height: 100%;
width: 100%;
padding: 50px ;
background: rgba(0, 0, 0, 0.39);
}
.container {
position: absolute;
min-width: 100px;
height: fit-content;
top: 50%;
left: 50%;
padding: 1%;
transform: translate(-50%, -60%);
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);
}
.modal-close {
border-radius: 50%;
color: #fff;
background: #2a4cc7;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 7px;
right: 7px;
width: 30px;
height: 30px;
cursor: pointer;
}
.modal-title {
color: #0971c7;
}
.modal-content {
margin-bottom: 20px
}
</style>

View File

@ -0,0 +1,177 @@
<template>
<div v-if="show" class="modal-shadow" @click.self="closeModal">
<div class="container">
<form >
<div class="mb-3">
<label
htmlFor="name"
class="form-label">ФИО
</label>
<input
type="text"
class="form-control"
id="name"
name="name"
v-model="name"
/>
</div>
<div class="mb-3">
<label
htmlFor="phone"
class="form-label">Телефон
</label>
<input
type="text"
class="form-control"
id="phone"
name="phone"
v-model="phone"
/>
</div>
<div class="mb-3">
<label
htmlFor="snils"
class="form-label">СНИЛС
</label>
<input
type="text"
class="form-control"
id="snils"
name="snils"
v-model="snils"
/>
</div>
<div class="mb-3">
<label
htmlFor="email"
class="form-label">Почта
</label>
<input
type="email"
class="form-control"
id="email"
name="email"
v-model="email"
/>
</div>
<div class="mb-3">
<label
htmlFor="password"
class="form-label">Пароль
</label>
<input
type="password"
class="form-control"
id="password"
name="password"
v-model="password"
/>
</div>
<div class="d-grid gap-2">
<button
@click="updateUser()"
type="button"
class="btn btn-primary btn-block">Обновить
</button>
</div>
</form>
</div>
</div>
</template>
<script>
import UserSevice from '@/services/UserSevice';
export default {
name: "ModalWindow",
data: function () {
return {
show: false,
name:'',
email:'',
password:'',
phone: '',
snils: '',
AgainPassword:'',
}
},
methods: {
closeModal() {
this.show = false
},
updateUser(){
let data = {
id: localStorage.getItem('user'),
role: "",
name:this.name,
email: this.email,
phone: this.phone,
snils: this.snils,
password: this.password,
againPassword: ""
}
console.log(data)
UserSevice.update(data).then(res => {
console.log(res.data)
window.location.reload()
})
}
}
}
</script>
<style scoped >
.modal-shadow {
position: absolute;
top: 0;
left: 0;
min-height: 100%;
width: 100%;
padding: 50px ;
background: rgba(0, 0, 0, 0.39);
}
.container {
position: absolute;
min-width: 100px;
height: fit-content;
top: 50%;
left: 50%;
padding: 1%;
transform: translate(-50%, -105%);
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);
}
.modal-close {
border-radius: 50%;
color: #fff;
background: #2a4cc7;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 7px;
right: 7px;
width: 30px;
height: 30px;
cursor: pointer;
}
.modal-title {
color: #0971c7;
}
.modal-content {
margin-bottom: 20px
}
</style>

View File

@ -0,0 +1,134 @@
<template>
<div v-if="show" class="modal-shadow" @click.self="closeModal">
<div class="container">
<form >
<div class="mb-3">
<label
htmlFor="num"
class="form-label">Название
</label>
<input
type="text"
class="form-control"
id="num"
name="num"
v-model="title"
/>
</div>
<div class="mb-3">
<label
htmlFor="benefits"
class="form-label">Баллы
</label>
<input
type="number"
min="0"
max="10"
class="form-control"
id="benefits"
name="benefits"
v-model="points"
/>
</div>
<div class="d-grid gap-2">
<button
@click="create"
type="button"
class="btn btn-primary btn-block">Добавить
</button>
</div>
</form>
</div>
</div>
</template>
<script>
import AchievementSevice from '@/services/AchievementSevice';
export default {
name: "ModalWindow",
data: function () {
return {
show: false,
id:'',
title:'',
points:0,
}
},
methods: {
closeModal() {
this.show = false
this.num=''
this.title =''
this.points=0
},
create(){
let data = {
id:null,
num:this.num,
title:this.title,
points:this.points
}
console.log(data)
AchievementSevice.create(data).then(res => {
console.log(res.data)
window.location.reload()
})
}
}
}
</script>
<style scoped >
.modal-shadow {
position: absolute;
top: 0;
left: 0;
min-height: 100%;
width: 100%;
padding: 50px ;
background: rgba(0, 0, 0, 0.39);
}
.container {
position: absolute;
min-width: 100px;
height: fit-content;
top: 50%;
left: 50%;
padding: 1%;
transform: translate(-50%, -50%);
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);
}
.modal-close {
border-radius: 50%;
color: #fff;
background: #2a4cc7;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 7px;
right: 7px;
width: 30px;
height: 30px;
cursor: pointer;
}
.modal-title {
color: #0971c7;
}
.modal-content {
margin-bottom: 20px
}
</style>

View File

@ -0,0 +1,132 @@
<template>
<div v-if="show" class="modal-shadow" @click.self="closeModal">
<div class="container">
<form >
<div class="mb-3">
<label
htmlFor="num"
class="form-label">Название
</label>
<input
type="text"
class="form-control"
id="num"
name="num"
v-model="title"
/>
</div>
<div class="mb-3">
<label
htmlFor="benefits"
class="form-label">Баллы
</label>
<input
type="number"
class="form-control"
id="benefits"
name="benefits"
v-model="points"
/>
</div>
<div class="d-grid gap-2">
<button
@click="create"
type="button"
class="btn btn-primary btn-block">Обновить
</button>
</div>
</form>
</div>
</div>
</template>
<script>
import AchievementSevice from '@/services/AchievementSevice';
export default {
name: "ModalWindow",
data: function () {
return {
show: false,
id:'',
title:'',
points:0,
}
},
methods: {
closeModal() {
this.show = false
this.num=''
this.title =''
this.points=0
},
create(){
let data = {
id:this.id,
num:this.num,
title:this.title,
points:this.points
}
console.log(data)
AchievementSevice.update(data).then(res => {
console.log(res.data)
window.location.reload()
})
}
}
}
</script>
<style scoped >
.modal-shadow {
position: absolute;
top: 0;
left: 0;
min-height: 100%;
width: 100%;
padding: 50px ;
background: rgba(0, 0, 0, 0.39);
}
.container {
position: absolute;
min-width: 100px;
height: fit-content;
top: 50%;
left: 50%;
padding: 1%;
transform: translate(-50%, -50%);
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);
}
.modal-close {
border-radius: 50%;
color: #fff;
background: #2a4cc7;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 7px;
right: 7px;
width: 30px;
height: 30px;
cursor: pointer;
}
.modal-title {
color: #0971c7;
}
.modal-content {
margin-bottom: 20px
}
</style>

View File

@ -0,0 +1,106 @@
<template>
<AdminHeader />
<div>
<div class="container m-3">
<div class="rounded-card row">
<H1>Достижения</H1>
<div style="min-width:max-content;" class="m-2">
<div class="row">
<button class="btn-success border border-transparent rounded shadow-sm " @click="showCreate">Добавить</button>
</div>
<table class="table table-hover table-bordered">
<tbody>
<tr>
<td>Номер</td>
<td>Названией</td>
<td>Баллы</td>
<td></td>
</tr>
<tr v-for="(row, index) in achievements" :key="index" style="min-width:max-content;" >
<td @click="showUpd(row.id,row.title,row.points)">{{ index+1 }}</td>
<td @click="showUpd(row.id,row.title,row.points)">{{ row.title }}</td>
<td @click="showUpd(row.id,row.title,row.points)">{{ row.points }}</td>
<td><button class="btn btn-outline-danger" @click="deleteAch(row.id)">Удалить</button></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<achCreate ref="modalCreate"></achCreate>
<achUpd ref="modalUpdate"></achUpd>
</template>
<script scoped>
import AchievementSevice from '@/services/AchievementSevice';
import AdminHeader from '@/elemets/adminHeader.vue';
import achCreate from './achCreate.vue';
import achUpd from './achUpd.vue';
export default{
name:"achievements",
data(){
return{
achievements: [],
}
},
components: {
AdminHeader,
achCreate,
achUpd
},
beforeCreate(){
AchievementSevice.getAll().then(response =>{
this.achievements = response.data
})
},
methods:{
showUpd(id,title,points) {
this.$refs.modalUpdate.show = true;
this.$refs.modalUpdate.id = id
this.$refs.modalUpdate.title = title
this.$refs.modalUpdate.points = points
},
showCreate() {
this.$refs.modalCreate.show = true;
},
deleteAch(id){
AchievementSevice.delete(id).then(response =>{
console.log(response.data)
AchievementSevice.getAll().then(response =>{
this.achievements = response.data
})
}).catch(e => {
console.log(e.data)
})
}
}
}
</script>
<style scoped>
.container
{
position:absolute ;
min-width:calc(205vh);
background-color: #6ec0d9e9 ;
border: 5px solid #3f8ba2;
padding:12px;
align-items: center;
border-radius:8px;
}
.rounded-card{
border: 5px solid #3f8ba2;
padding:6px;
margin:6px;
border-radius:8px;
align-items: center;
}
</style>

View File

@ -0,0 +1,113 @@
<template>
<div v-if="show" class="modal-shadow" @click.self="closeModal">
<div class="container">
<form >
<div class="mb-3">
<label
htmlFor="num"
class="form-label">Название
</label>
<input
type="text"
class="form-control"
id="num"
name="num"
v-model="title"
/>
</div>
<div class="d-grid gap-2">
<button
@click="create"
type="button"
class="btn btn-primary btn-block">Добавить
</button>
</div>
</form>
</div>
</div>
</template>
<script>
import BenefitSevice from '@/services/BenefitSevice';
export default {
name: "ModalWindow",
data: function () {
return {
show: false,
id:'',
title:'',
}
},
methods: {
closeModal() {
this.show = false
this.title =''
},
create(){
let data = {
id:null,
title:this.title,
}
console.log(data)
BenefitSevice.create(data).then(res => {
console.log(res.data)
window.location.reload()
})
}
}
}
</script>
<style scoped >
.modal-shadow {
position: absolute;
top: 0;
left: 0;
min-height: 100%;
width: 100%;
padding: 50px ;
background: rgba(0, 0, 0, 0.39);
}
.container {
position: absolute;
min-width: 100px;
height: fit-content;
top: 50%;
left: 50%;
padding: 1%;
transform: translate(-50%, -50%);
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);
}
.modal-close {
border-radius: 50%;
color: #fff;
background: #2a4cc7;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 7px;
right: 7px;
width: 30px;
height: 30px;
cursor: pointer;
}
.modal-title {
color: #0971c7;
}
.modal-content {
margin-bottom: 20px
}
</style>

View File

@ -0,0 +1,114 @@
<template>
<div v-if="show" class="modal-shadow" @click.self="closeModal">
<div class="container">
<form >
<div class="mb-3">
<label
htmlFor="num"
class="form-label">Название
</label>
<input
type="text"
class="form-control"
id="num"
name="num"
v-model="title"
/>
</div>
<div class="d-grid gap-2">
<button
@click="create"
type="button"
class="btn btn-primary btn-block">Обновить
</button>
</div>
</form>
</div>
</div>
</template>
<script>
import BenefitSevice from '@/services/BenefitSevice';
export default {
name: "ModalWindow",
data: function () {
return {
show: false,
id:'',
title:'',
}
},
methods: {
closeModal() {
this.show = false
this.title =''
},
create(){
let data = {
id:this.id,
title:this.title,
}
console.log(data)
BenefitSevice.update(data).then(res => {
console.log(res.data)
window.location.reload()
})
}
}
}
</script>
<style scoped >
.modal-shadow {
position: absolute;
top: 0;
left: 0;
min-height: 100%;
width: 100%;
padding: 50px ;
background: rgba(0, 0, 0, 0.39);
}
.container {
position: absolute;
min-width: 100px;
height: fit-content;
top: 50%;
left: 50%;
padding: 1%;
transform: translate(-50%, -50%);
background-color: #fff;
border-radius: 2px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);
}
.modal-close {
border-radius: 50%;
color: #fff;
background: #2a4cc7;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 7px;
right: 7px;
width: 30px;
height: 30px;
cursor: pointer;
}
.modal-title {
color: #0971c7;
}
.modal-content {
margin-bottom: 20px
}
</style>

View File

@ -0,0 +1,104 @@
<template>
<AdminHeader />
<div>
<div class="container m-3">
<div class="rounded-card row">
<H1>Льготы</H1>
<div style="min-width:max-content;" class="m-2">
<div class="row">
<button class="btn-success border border-transparent rounded shadow-sm " @click="showCreate">Добавить</button>
</div>
<table class="table table-hover table-bordered">
<tbody>
<tr>
<td>Номер</td>
<td>Названией</td>
<td></td>
</tr>
<tr v-for="(row, index) in benefits" :key="index" style="min-width:max-content;" >
<td @click="showUpd(row.id,row.title)">{{ index+1 }}</td>
<td @click="showUpd(row.id,row.title)">{{ row.title }}</td>
<td><button class="btn btn-outline-danger" @click="deleteAch(row.id)">Удалить</button></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<benCreate ref="modalCreate"></benCreate>
<benUpd ref="modalUpdate"></benUpd>
</template>
<script scoped>
import BenefitSevice from '@/services/BenefitSevice';
import AdminHeader from '@/elemets/adminHeader.vue';
import benCreate from './benCreate.vue';
import benUpd from './benUpd.vue';
export default{
name:"benefits",
data(){
return{
benefits: [],
}
},
components: {
AdminHeader,
benCreate,
benUpd
},
beforeCreate(){
BenefitSevice.getAll().then(response =>{
this.benefits = response.data
})
},
methods:{
showUpd(id,title) {
this.$refs.modalUpdate.show = true;
this.$refs.modalUpdate.id = id
this.$refs.modalUpdate.title = title
},
showCreate() {
this.$refs.modalCreate.show = true;
},
deleteAch(id){
BenefitSevice.delete(id).then(response =>{
console.log(response.data)
BenefitSevice.getAll().then(response =>{
this.benefits = response.data
})
}).catch(e => {
console.log(e.data)
})
}
}
}
</script>
<style scoped>
.container
{
position:absolute ;
min-width:calc(205vh);
background-color: #6ec0d9e9 ;
border: 5px solid #3f8ba2;
padding:12px;
align-items: center;
border-radius:8px;
}
.rounded-card{
border: 5px solid #3f8ba2;
padding:6px;
margin:6px;
border-radius:8px;
align-items: center;
}
</style>

View File

@ -0,0 +1,100 @@
<template>
<layout-div>
<div class="row justify-content-md-center mt-5">
<div class="col-4">
<div class="card">
<div class="card-body">
<h5 class="card-title mb-4">Вход</h5>
<form>
<p v-if="Object.keys(validationErrors).length != 0" class='text-center '><small class='text-danger'>Incorrect Email or Password</small></p>
<div class="mb-3">
<label
htmlFor="email"
class="form-label">
Почта
</label>
<input
v-model="email"
type="email"
class="form-control"
id="email"
name="email"
/>
</div>
<div class="mb-3">
<label
htmlFor="password"
class="form-label">Пароль
</label>
<input
v-model="password"
type="password"
class="form-control"
id="password"
name="password"
/>
</div>
<div class="d-grid gap-2">
<button
:disabled="isSubmitting"
@click="loginAction()"
type="button"
class="btn btn-primary btn-block">Войти</button>
<p class="text-center">Еще не зарегистрированы?
<router-link to="/register">Зарегистрироваться </router-link>
</p>
</div>
</form>
</div>
</div>
</div>
</div>
</layout-div>
</template>
<script>
import UserService from '../services/UserSevice';
import LayoutDiv from './LayoutDiv.vue';
export default {
name: 'LoginPage',
components: {
LayoutDiv,
},
data() {
return {
email:'',
password:'',
validationErrors:{},
isSubmitting:false,
};
},
created() {
if(localStorage.getItem('user') != "" && localStorage.getItem('user') != null){
this.$router.push('/profile')
}
},
methods: {
loginAction(){
this.isSubmitting = true
UserService.auth(this.email, this.password)
.then(response => {
localStorage.setItem('user', response.data.id)
if(response.data.role == 'USER'){
this.$router.push('/profile')
}
else{
this.$router.push('/trains')
}
return response.data
})
.catch(error => {
this.isSubmitting = false
console.log(error);
return error
});
}
},
};
</script>

View File

@ -0,0 +1,196 @@
<template>
<HeaderUser />
<div class="container">
<div class="rounded-card row">
<H1>Заявления</H1>
<input
type="text"
class="form-control"
id="name"
placeholder="Название направления"
name="name"
v-model="search_value"
/>
<button class="btn-secondary border border-transparent rounded shadow-sm " @click="search">Поиск</button>
<div style="min-width:max-content;" class="m-2">
<h2>Льготные места</h2>
<table class="table table-hover table-bordered">
<tbody>
<tr>
<td>Место</td>
<td>ФИО</td>
<td>СНИЛС</td>
<td>Баллы</td>
<td>Поступление</td>
</tr>
<tr v-for="row in benefits" :key="row.id_table" style="min-width:max-content;">
<td>{{ row.id_table}}</td>
<td>{{ row.name }}</td>
<td>{{ row.snils }}</td>
<td>{{ row.points }}</td>
<td>
<p v-if="row.confirm">+</p>
<p v-else>-</p>
</td>
</tr>
</tbody>
</table>
</div>
<div style="min-width:max-content;" class="m-2">
<h2>Базовые места</h2>
<table class="table table-hover table-bordered">
<tbody>
<tr>
<td>Место</td>
<td>ФИО</td>
<td>СНИЛС</td>
<td>Баллы</td>
<td>Поступление</td>
</tr>
<tr v-for="row in basics" :key="row.id_table" style="min-width:max-content;">
<td>{{ row.id_table}}</td>
<td>{{ row.name }}</td>
<td>{{ row.snils }}</td>
<td>{{ row.points }}</td>
<td>
<p v-if="row.confirm">+</p>
<p v-else>-</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</template>
<script scoped>
import HeaderUser from '@/elemets/headerUser.vue';
import OrderSevice from '@/services/OrderSevice';
export default {
name: 'Page2',
data () {
return {
id: 0,
num: "",
title:"",
basics:[],
benefits:[],
search_value:"",
}
},
components: {
HeaderUser,
},
created() {
this.id = this.$route.params.id;
OrderSevice.getBasic(this.id).then(response =>{
this.basics = response.data;
this.basics.sort(function(a,b){
if (a.points > b.points) {
return -1;
}
if (a.points < b.points) {
return 1;
}
// a должно быть равным b
return 0;
})
let id = 1;
this.basics.forEach((val) =>{
val.id_table = id;
id++;
})
})
OrderSevice.getBenefit(this.id).then(response =>{
this.benefits = response.data;
this.benefits.sort(function(a,b){
if (a.points > b.points) {
return -1;
}
if (a.points < b.points) {
return 1;
}
// a должно быть равным b
return 0;
})
let id = 1;
this.benefits.forEach((val) =>{
val.id_table = id;
id++;
})
})
},
methods: {
search(){
if(this.search_value.length > 0) {
this.basics = this.basics.filter((place) => place.name.toUpperCase().indexOf(this.search_value.toUpperCase())>-1)
this.benefits = this.benefits.filter((place) => place.name.toUpperCase().indexOf(this.search_value.toUpperCase())>-1)
}else{
OrderSevice.getBasic(this.id).then(response =>{
this.basics = response.data;
this.basics.sort(function(a,b){
if (a.points > b.points) {
return -1;
}
if (a.points < b.points) {
return 1;
}
// a должно быть равным b
return 0;
})
let id = 1;
this.basics.forEach((val) =>{
val.id_table = id;
id++;
})
})
OrderSevice.getBenefit(this.id).then(response =>{
this.benefits = response.data;
this.benefits.sort(function(a,b){
if (a.points > b.points) {
return -1;
}
if (a.points < b.points) {
return 1;
}
// a должно быть равным b
return 0;
})
let id = 1;
this.benefits.forEach((val) =>{
val.id_table = id;
id++;
})
})
}
}
}
}
</script>
<style scoped>
.container
{
position:absolute ;
min-width:calc(205vh);
background-color: #6ec0d9e9 ;
border: 5px solid #3f8ba2;
padding:12px;
align-items: center;
border-radius:8px;
}
.rounded-card{
border: 5px solid #3f8ba2;
padding:6px;
margin:6px;
border-radius:8px;
align-items: center;
}
</style>

View File

@ -0,0 +1,409 @@
<script>
import HeaderUser from '@/elemets/headerUser.vue';
import UserSevice from '@/services/UserSevice';
import AchievementSevice from '@/services/AchievementSevice';
import BenefitSevice from '@/services/BenefitSevice';
import ExamResultSevice from '@/services/ExamResultSevice';
import ExamSevice from '@/services/ExamSevice';
import ModalUser from './ModalUser.vue';
export default {
name: "user",
components: {
HeaderUser,
ModalUser
},
data() {
return {
currentUser: null,
myExams:[],
exams:[],
myAchievements:[],
achievements:[],
myBenefits:[],
benefits:[],
selectedExam:null,
selectedAchievement: null,
selectedBenefit:null,
ExamPoints:0,
message: ''
};
},
beforeCreate() {
if (localStorage.getItem("user") == null) {
this.$router.push("/login");
}
UserSevice.get(localStorage.getItem("user"))
.then(response => {
this.currentUser = response.data;
console.log(response.data);
})
.catch(e => {
console.log(e);
});
AchievementSevice.getForUser(localStorage.getItem("user"))
.then(response =>{
this.myAchievements = response.data;
console.log("myAch");
console.log(response.data);
} ) .catch(e => {
console.log(e);
});
AchievementSevice.getForUserNot(localStorage.getItem("user"))
.then(response =>{
this.achievements = response.data;
if (this.achievements.length > 0){
this.selectedAchievement = this.achievements[0];
}else{
this.selectedAchievement = {id:-1};
}
console.log("allAch");
console.log(response.data);
} ) .catch(e => {
console.log(e);
});
BenefitSevice.getForUser(localStorage.getItem("user"))
.then(response =>{
this.myBenefits = response.data;
console.log("myBen");
console.log(response.data);
} ) .catch(e => {
console.log(e);
});
BenefitSevice.getForUserNot(localStorage.getItem("user"))
.then(response =>{
this.benefits = response.data;
if(this.benefits.length >0){
this.selectedBenefit = this.benefits[0];
}else{
this.selectedBenefit = {id:-1};
}
console.log(response.data);
} ) .catch(e => {
console.log(e);
});
ExamResultSevice.getForUser(localStorage.getItem("user"))
.then(response =>{
this.myExams = response.data;
console.log(response.data);
} ) .catch(e => {
console.log(e);
});
ExamSevice.getForUser(localStorage.getItem("user"))
.then(response =>{
this.exams = response.data;
if(this.exams.length > 0)
{
this.selectedExam = this.exams[0];
}else{
this.selectedExam = {id:-1};
}
} ) .catch(e => {
console.log(e);
});
},
methods: {
getUser(id) {
UserSevice.get(id)
.then(response => {
this.currentUser = response.data;
console.log(response.data);
})
.catch(e => {
console.log(e);
});
},
showModal() {
this.$refs.modal.show = true;
this.$refs.modal.name = this.currentUser.name;
this.$refs.modal.email = this.currentUser.email;
this.$refs.modal.password = this.currentUser.password;
this.$refs.modal.phone = this.currentUser.phone;
this.$refs.modal.snils = this.currentUser.snils;
this.$refs.modal.AgainPassword = this.currentUser.AgainPassword;
},
handleChange(e)
{
if (+e.target.value > 100) {
e.target.value = 100;
} else if (+e.target.value < 0) {
e.target.value = 0;
}
if(+e.target.value == ""){
e.target.value = 0;
}
},
addExam(){
let data = {
user: localStorage.getItem("user"),
exam: this.selectedExam.id,
points:this.ExamPoints,
}
ExamResultSevice.create(data).then(otver =>{
ExamResultSevice.getForUser(localStorage.getItem("user")).then(res =>{
console.log(otver.data)
this.myExams = res.data;
ExamSevice.getForUser(localStorage.getItem("user")).then(response =>{
this.exams = response.data;
if(this.exams.length > 0)
{
this.selectedExam = this.exams[0];
}
else{
this.selectedExam = {id:-1};
}
this.ExamPoints = 0;
})
})
})
},
addAchievement(){
UserSevice.addAchievement(localStorage.getItem("user"), this.selectedAchievement.id)
.then(value => {
console.log(value);
this.achievements = []
this.myAchievements = [];
AchievementSevice.getForUser(localStorage.getItem("user")).then(response =>
{
this.myAchievements = response.data;
AchievementSevice.getForUserNot(localStorage.getItem("user")).then(result =>{
this.achievements = result.data
if(this.achievements.length > 0){
this.selectedAchievement = this.achievements[0];
}else
{
this.selectedAchievement = {id:-1};
}
})
})
})
.catch(e => {
console.log(e)
})
console.log('add achievement')
},
deleteAchievement(id){
UserSevice.removeAchievement(localStorage.getItem("user"), id).then(response => {
console.log(response.data)
AchievementSevice.getForUser(localStorage.getItem("user")).then(response =>
{
this.myAchievements = response.data;
AchievementSevice.getForUserNot(localStorage.getItem("user")).then(result =>{
this.achievements = result.data
if(this.achievements.length > 0){
this.selectedAchievement = this.achievements[0];
}
})
})
})
console.log('remove achievement')
},
addBenefit(){
UserSevice.addBenefit(localStorage.getItem("user"), this.selectedBenefit.id)
.then(value => {
console.log(value);
this.benefits = []
this.myBenefits = [];
BenefitSevice.getForUser(localStorage.getItem("user")).then(response =>
{
this.myBenefits = response.data;
BenefitSevice.getForUserNot(localStorage.getItem("user")).then(result =>{
this.benefits = result.data
if(this.benefits.length > 0){
this.selectedBenefit = this.benefits[0];
}else{
this.selectedBenefit = {id:-1};
}
})
})
})
.catch(e => {
console.log(e)
})
console.log('add benefit')
},
deleteBenefit(id){
UserSevice.removeBenefit(localStorage.getItem("user"), id).then(response => {
console.log(response.data)
BenefitSevice.getForUser(localStorage.getItem("user")).then(response =>
{
this.myBenefits = response.data;
BenefitSevice.getForUserNot(localStorage.getItem("user")).then(result =>{
this.benefits = result.data
if(this.benefits.length > 0){
this.selectedBenefit = this.benefits[0];
}
})
})
})
console.log('remove achievement')
},
deletexam(id)
{
ExamResultSevice.delete(localStorage.getItem("user"),id).then(response =>{
console.log(response.data)
this.myExams = [];
ExamResultSevice.getForUser(localStorage.getItem("user")).then(res => {
this.myExams = res.data;
ExamSevice.getForUser(localStorage.getItem("user")).then(es => {
this.exams = es.data;
if(this.exams.length > 0){
this.selectedExam = this.exams[0];
}else{
this.selectedExam = {id:-1};
}
})
})
})
},
logout() {
localStorage.removeItem('user');
this.$router.push("/login");
}
},
};
</script>
<style scoped>
.container
{
position:relative ;
top:0;
right: 0;
bottom: 0;
left: 0;
min-width: calc(205vh);;
background-color: #6ec0d9e9 ;
}
.rounded-card{
border: 5px solid #3f8ba2;
padding:6px;
margin:6px;
border-radius:8px;
}
.table
{
background-color: #fecb98;
}
</style>
<template>
<HeaderUser />
<div class="container p-1 m-1" id="allInfo">
<div id="textInfo" class="rounded-card">
<label for="profile" style="color: black;font-weight:bolder;">Профиль</label>
<div class="mt-3" >
<label for="nickName" style="color: black;font-weight: bold;">ФИО:</label>
<span> {{ currentUser.name }}</span>
</div>
<div class="mt-3">
<label for="email" style="color: black;font-weight: bold;">Почта:</label>
<span> {{ currentUser.email }}</span>
</div>
<div class="mt-3">
<label for="snils" style="color: black;font-weight: bold;">СНИЛС:</label>
<span> {{ currentUser.snils }}</span>
</div>
<div class="mt-3">
<label for="phone" style="color: black;font-weight: bold;">Телефон:</label>
<span> {{ currentUser.phone }}</span>
</div>
<div >
<button class="btn btn-warning m-5" @click="showModal">Обновить данные</button>
<button class="btn btn-warning" @click="logout">Выйти</button>
</div>
</div>
<div id="textExams" class="rounded-card justify m-5" style="min-width:auto; gap: 80px; ">
<label for="exams" style="color: black;font-weight:bolder;">Экзамены</label>
<div style="min-width:max-content; display: flex; align-items: center; gap: 80px;">
<select style="min-width: 200px;" v-model="selectedExam">
<option v-for="exam in exams" :key="exam.id" v-bind:value="exam">{{exam.title}}</option>
</select>
<input type="number" min="0" max="100" class="justify" v-model="ExamPoints" placeholder="Введите баллы" required @change="(e) => handleChange(e)">
<button class="btn-warning border border-transparent rounded shadow-sm " @click="addExam">Добавить</button>
</div>
<div style="min-width:max-content;" class="m-2">
<table class="table table-hover table-bordered">
<tbody>
<tr v-for="row in myExams" :key="row.exam" style="min-width:max-content;">
<td>{{ row.title }}</td>
<td>{{ row.points }}</td>
<td><button class="btn btn-outline-danger" @click="deletexam(row.exam)">Удалить</button></td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="textAchievements" class="rounded-card justify m-5" style="min-width:auto; gap: 80px; ">
<label for="achievements" style="color: black;font-weight:bolder;">Достижения</label>
<div style="min-width:max-content; display: flex; align-items: center; gap: 80px;">
<select style="min-width: 200px;" v-model="selectedAchievement">
<option v-for="achievement in achievements" :key="achievement.id" v-bind:value="achievement">{{achievement.title}}</option>
</select>
<button class="btn-warning border border-transparent rounded shadow-sm " @click="addAchievement">Добавить</button>
</div>
<div style="min-width:max-content;" class="m-2">
<table class="table table-hover table-bordered">
<tbody>
<tr v-for="row in myAchievements" :key="row.id" style="min-width:max-content;">
<td>{{ row.title }}</td>
<td><button class="btn btn-outline-danger" @click="deleteAchievement(row.id)">Удалить</button></td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="textBenefits" class="rounded-card justify m-5" style="min-width:auto; gap: 80px; ">
<label for="benefit" style="color: black;font-weight:bolder;">Льготы</label>
<div style="min-width:max-content; display: flex; align-items: center; gap: 80px;">
<select style="min-width: 200px;" v-model="selectedBenefit">
<option v-for="benefit in benefits" :key="benefit.id" v-bind:value="benefit">{{benefit.title}}</option>
</select>
<Button class="btn-warning border border-transparent rounded shadow-sm " @click="addBenefit">Добавить</Button>
</div>
<div style="min-width:max-content;" class="m-2">
<table class="table table-hover table-bordered">
<tbody>
<tr v-for="row in myBenefits" :key="row.id" style="min-width:max-content;">
<td>{{ row.title }}</td>
<td><button class="btn btn-outline-danger" @click="deleteBenefit(row.id)">Удалить</button></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<ModalUser ref="modal"></ModalUser>
</template>

View File

@ -0,0 +1,189 @@
<template>
<layout-div>
<div class="row justify-content-md-center mt-5">
<div class="col-4">
<div class="card">
<div class="card-body">
<h5 class="card-title mb-4">Регистрация</h5>
<form >
<div class="mb-3">
<label
htmlFor="name"
class="form-label">ФИО
</label>
<input
type="text"
class="form-control"
id="name"
name="name"
v-model="name"
/>
<div v-if="validationErrors.name" class="flex flex-col">
<small class="text-danger">
{{validationErrors?.name[0]}}
</small >
</div>
</div>
<div class="mb-3">
<label
htmlFor="phone"
class="form-label">Телефон
</label>
<input
type="text"
class="form-control"
id="phone"
name="phone"
v-model="phone"
/>
<div v-if="validationErrors.phone" class="flex flex-col">
<small class="text-danger">
{{validationErrors?.phone[0]}}
</small >
</div>
</div>
<div class="mb-3">
<label
htmlFor="snils"
class="form-label">СНИЛС
</label>
<input
type="text"
class="form-control"
id="snils"
name="snils"
v-model="snils"
/>
<div v-if="validationErrors.snils" class="flex flex-col">
<small class="text-danger">
{{validationErrors?.snils[0]}}
</small >
</div>
</div>
<div class="mb-3">
<label
htmlFor="email"
class="form-label">Почта
</label>
<input
type="email"
class="form-control"
id="email"
name="email"
v-model="email"
/>
<div v-if="validationErrors.email" class="flex flex-col">
<small class="text-danger">
{{validationErrors?.email[0]}}
</small >
</div>
</div>
<div class="mb-3">
<label
htmlFor="password"
class="form-label">Пароль
</label>
<input
type="password"
class="form-control"
id="password"
name="password"
v-model="password"
/>
<div v-if="validationErrors.password" class="flex flex-col">
<small class="text-danger">
{{validationErrors?.password[0]}}
</small >
</div>
</div>
<div class="mb-3">
<label
htmlFor="confirm_password"
class="form-label">Подтверждение пароля
</label>
<input
type="password"
class="form-control"
id="AgainPassword"
name="AgainPassword"
v-model="AgainPassword"
/>
</div>
<div class="d-grid gap-2">
<button
:disabled="isSubmitting"
@click="registerAction()"
type="button"
class="btn btn-primary btn-block">Зарегистрироваться
</button>
<p
class="text-center">Уже зарегистрированы? <router-link to="/login">Войти</router-link>
</p>
</div>
</form>
</div>
</div>
</div>
</div>
</layout-div>
</template>
<script>
import UserService from '../services/UserSevice';
import LayoutDiv from './LayoutDiv.vue';
export default {
name: 'RegisterPage',
components: {
LayoutDiv,
},
data() {
return {
id:null,
role: null,
name:'',
email:'',
password:'',
phone: '',
snils: '',
AgainPassword:'',
validationErrors:{},
isSubmitting:false,
};
},
created() {
if(localStorage.getItem('user') != "" && localStorage.getItem('user') != null){
this.$router.push('/profile')
}
},
methods: {
registerAction(){
this.isSubmitting = true
let payload = {
id: 0,
role: "",
name:this.name,
email: this.email,
phone: this.phone,
snils: this.snils,
password: this.password,
againPassword: this.AgainPassword
}
UserService.create(payload)
.then(response => {
localStorage.setItem('user', response.data)
localStorage.setItem('role', response.data.role)
this.$router.push('/profile')
return response
})
.catch(error => {
this.isSubmitting = false
if (error.response.data.errors != undefined) {
this.validationErrors = error.response.data.errors
}
return error
});
}
},
};
</script>

View File

@ -0,0 +1,230 @@
<template>
<AdminHeader />
<div class="container p-1 m-1" id="allInfo">
<div id="textInfo" class="rounded-card">
<label for="profile" style="color: black;font-weight:bolder;">Направление</label>
<div class="mt-3" >
<label for="nickName" style="color: black;font-weight: bold;">Номер:</label>
<span> {{ currentTraining.num }}</span>
</div>
<div class="mt-3">
<label for="email" style="color: black;font-weight: bold;">Название:</label>
<span> {{ currentTraining.title }}</span>
</div>
<div class="mt-3">
<label for="email" style="color: black;font-weight: bold;">Базовые места:</label>
<span> {{ currentTraining.basic_places }}</span>
</div>
<div class="mt-3">
<label for="email" style="color: black;font-weight: bold;">Льготные места:</label>
<span> {{ currentTraining.benefit_places }}</span>
</div>
<div class="mt-3">
<label for="snils" style="color: black;font-weight: bold;">Описание:</label>
<span> {{ currentTraining.desc }}</span>
</div>
<div class="mt-3">
<label for="phone" style="color: black;font-weight: bold;">Профессии:</label>
<span> {{ currentTraining.prof }}</span>
</div>
<div >
<button class="btn btn-warning m-5" @click="showModal">Обновить данные</button>
</div>
</div>
<div id="textExams" class="rounded-card justify m-5" style="min-width:auto; gap: 80px; ">
<label for="exams" style="color: black;font-weight:bolder;">Экзамены</label>
<div style="min-width:max-content; display: flex; align-items: center; gap: 80px;">
<select style="min-width: 200px;" v-model="selectedExam">
<option v-for="exam in exams" :key="exam.id" v-bind:value="exam">{{exam.title}}</option>
</select>
<input type="number" min="0" max="100" class="justify" v-model="ExamPoints" placeholder="Введите баллы" required @change="(e) => handleChange(e)">
<button class="btn-warning border border-transparent rounded shadow-sm " @click="addExam">Добавить</button>
</div>
<div style="min-width:max-content;" class="m-2">
<table class="table table-hover table-bordered">
<tbody>
<tr v-for="row in myExams" :key="row.exam" style="min-width:max-content;">
<td>{{ row.title }}</td>
<td>{{ row.points }}</td>
<td><button class="btn btn-outline-danger" @click="deletexam(row.exam)">Удалить</button></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<ModalUpdTraining ref="modal"></ModalUpdTraining>
</template>
<script scoped>
import AdminHeader from '@/elemets/adminHeader.vue';
import TrainingSevice from '@/services/TrainingSevice';
import TrainingExamSevice from '@/services/TrainingExamSevice';
import ExamSevice from '@/services/ExamSevice';
import ModalUpdTraining from './ModalUpdTraining.vue';
export default {
name: "user",
components: {
AdminHeader,
ModalUpdTraining
},
data() {
return {
id:0,
currentTraining: null,
myExams:[],
exams:[],
selectedExam:null,
ExamPoints:0,
message: ''
};
},
created() {
if (localStorage.getItem("user") == null) {
this.$router.push("/login");
}
this.id = this.$route.params.id;
TrainingSevice.get(this.id)
.then(response => {
this.currentTraining = response.data;
})
.catch(e => {
console.log(e);
});
TrainingExamSevice.getForTraining(this.id)
.then(response =>{
this.myExams = response.data;
console.log(response.data);
} ) .catch(e => {
console.log(e);
});
ExamSevice.getForTraining(this.id)
.then(response =>{
this.exams = response.data;
if(this.exams.length > 0)
{
this.selectedExam = this.exams[0];
}else{
this.selectedExam = {id:-1};
}
} ) .catch(e => {
console.log(e);
});
},
methods: {
showModal() {
this.$refs.modal.show = true;
this.$refs.modal.id = this.id;
this.$refs.modal.title = this.currentTraining.title;
this.$refs.modal.num = this.currentTraining.num;
this.$refs.modal.desc = this.currentTraining.desc;
this.$refs.modal.prof = this.currentTraining.prof;
this.$refs.modal.basic = this.currentTraining.basic_places;
this.$refs.modal.benefits = this.currentTraining.benefit_places;
},
handleChange(e)
{
if (+e.target.value > 100) {
e.target.value = 100;
} else if (+e.target.value < 0) {
e.target.value = 0;
}
if(+e.target.value == ""){
e.target.value = 0;
}
},
addExam(){
let data = {
training: this.id,
exam: this.selectedExam.id,
title: "",
points:this.ExamPoints,
}
TrainingExamSevice.create(data).then(otver =>{
TrainingExamSevice.getForTraining(this.id).then(res =>{
console.log(otver.data)
this.myExams = res.data;
ExamSevice.getForTraining(this.id).then(response =>{
this.exams = response.data;
if(this.exams.length > 0)
{
this.selectedExam = this.exams[0];
}
else{
this.selectedExam = {id:-1};
}
this.ExamPoints = 0;
})
})
})
},
deletexam(id)
{
TrainingExamSevice.delete(this.id,id).then(response =>{
console.log(response.data)
this.myExams = [];
TrainingExamSevice.getForTraining(this.id).then(res => {
this.myExams = res.data;
ExamSevice.getForTraining(this.id).then(es => {
this.exams = es.data;
if(this.exams.length > 0){
this.selectedExam = this.exams[0];
}else{
this.selectedExam = {id:-1};
}
})
})
})
},
},
};
</script>
<style scoped>
.container
{
position:relative ;
top:0;
right: 0;
bottom: 0;
left: 0;
min-width: calc(205vh);;
background-color: #6ec0d9e9 ;
}
.rounded-card{
border: 5px solid #3f8ba2;
padding:6px;
margin:6px;
border-radius:8px;
}
.table
{
background-color: #fecb98;
}
</style>

View File

@ -0,0 +1,141 @@
<template>
<HeaderUser />
<div>
<div class="container m-3">
<div class="rounded-card">
<H1>Мое заявление</H1>
<div v-if="myOrder">
<table class="table table-hover table-bordered">
<tbody>
<tr>
<td>Номер</td>
<td>Название</td>
<td></td>
</tr>
<tr style="min-width:max-content;">
<td>{{ myOrder.num }}</td>
<td>{{ myOrder.title }}</td>
<td><button class="btn btn-outline-danger" @click="deleteOrder">Удалить</button></td>
</tr>
</tbody>
</table>
</div>
<div v-else><h2>Вы еще не подали заявление</h2>
<button class="btn-secondary" @click="showModal">Подать заявление</button></div>
</div>
<div class="rounded-card row">
<H1>Заявления</H1>
<input
type="text"
class="form-control"
id="name"
placeholder="Название направления"
name="name"
v-model="search_value"
/>
<button class="btn-secondary border border-transparent rounded shadow-sm " @click="search">Поиск</button>
<div style="min-width:max-content;" class="m-2">
<table class="table table-hover table-bordered">
<tbody>
<tr>
<td>Номер</td>
<td>Зазвание</td>
<td>Места обычные</td>
<td>Места льготные</td>
</tr>
<tr v-for="row in trainings" :key="row.id" style="min-width:max-content;" @click="clickOnTraining(row.id)">
<td>{{ row.num }}</td>
<td>{{ row.title }}</td>
<td>{{ row.basic_places }}</td>
<td>{{ row.benefit_places }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<ModalTraining ref="modal"></ModalTraining>
</template>
<script scoped>
import TrainingSevice from '@/services/TrainingSevice';
import OrderSevice from '@/services/OrderSevice';
import HeaderUser from '@/elemets/headerUser.vue';
import ModalTraining from './ModalTraining.vue';
export default{
name:"trainings",
data(){
return{
trainings: [],
myOrder: null,
search_value: ""
}
},
components: {
HeaderUser,
ModalTraining
},
beforeCreate(){
TrainingSevice.getAll().then(response =>{
this.trainings = response.data
})
OrderSevice.getForUser(localStorage.getItem('user')).then(response =>{
if(response.data){
TrainingSevice.get(response.data.training).then(res => {
this.myOrder = res.data
})
}
})
},
methods:{
search(){
if(this.search_value.length > 0){
TrainingSevice.search(this.search_value).then(response =>{
this.trainings = response.data
})
}else{
TrainingSevice.getAll().then(response =>{
this.trainings = response.data
})
}
},
showModal(){
this.$refs.modal.show = true;
},
deleteOrder(){
OrderSevice.delete(localStorage.getItem('user')).then(res => {
console.log(res.data)
this.myOrder = null;
})
},
clickOnTraining(id){
this.$router.push({ name: 'orders', params: { id: id} })
},
}
}
</script>
<style scoped>
.container
{
position:absolute ;
min-width:calc(205vh);
background-color: #6ec0d9e9 ;
border: 5px solid #3f8ba2;
padding:12px;
align-items: center;
border-radius:8px;
}
.rounded-card{
border: 5px solid #3f8ba2;
padding:6px;
margin:6px;
border-radius:8px;
align-items: center;
}
</style>

View File

@ -0,0 +1,123 @@
<template>
<AdminHeader />
<div>
<div class="container m-3">
<div class="rounded-card row">
<H1>Заявления</H1>
<input
type="text"
class="form-control"
id="name"
placeholder="Название направления"
name="name"
v-model="search_value"
/>
<button class="btn-secondary border border-transparent rounded shadow-sm " @click="search">Поиск</button>
<div style="min-width:max-content;" class="m-2">
<div class="row">
<button class="btn-success border border-transparent rounded shadow-sm " @click="showModal">Добавить</button>
</div>
<table class="table table-hover table-bordered">
<tbody>
<tr>
<td>Номер</td>
<td>Зазвание</td>
<td>Места обычные</td>
<td>Места льготные</td>
<td></td>
</tr>
<tr v-for="row in trainings" :key="row.id" style="min-width:max-content;" >
<td @click="clickOnTraining(row.id)">{{ row.num }}</td>
<td @click="clickOnTraining(row.id)">{{ row.title }}</td>
<td @click="clickOnTraining(row.id)">{{ row.basic_places }}</td>
<td @click="clickOnTraining(row.id)">{{ row.benefit_places }}</td>
<td><button class="btn btn-outline-danger" @click="deleteTrain(row.id)">Удалить</button></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<ModalCreateTraining ref="modal"></ModalCreateTraining>
</template>
<script scoped>
import TrainingSevice from '@/services/TrainingSevice';
import AdminHeader from '@/elemets/adminHeader.vue';
import ModalCreateTraining from './ModalCreateTraining.vue';
export default{
name:"trainings",
data(){
return{
trainings: [],
myOrder: null,
search_value: ""
}
},
components: {
AdminHeader,
ModalCreateTraining
},
beforeCreate(){
TrainingSevice.getAll().then(response =>{
this.trainings = response.data
})
},
methods:{
search(){
if(this.search_value.length > 0){
TrainingSevice.search(this.search_value).then(response =>{
this.trainings = response.data
})
}else{
TrainingSevice.getAll().then(response =>{
this.trainings = response.data
})
}
},
clickOnTraining(id){
this.$router.push({ name: 'training', params: { id: id} })
},
showModal() {
this.$refs.modal.show = true;
},
deleteTrain(id){
TrainingSevice.delete(id).then(response =>{
console.log(response.data)
TrainingSevice.getAll().then(response =>{
this.trainings = response.data
})
}).catch(e => {
console.log(e.data)
})
}
}
}
</script>
<style scoped>
.container
{
position:absolute ;
min-width:calc(205vh);
background-color: #6ec0d9e9 ;
border: 5px solid #3f8ba2;
padding:12px;
align-items: center;
border-radius:8px;
}
.rounded-card{
border: 5px solid #3f8ba2;
padding:6px;
margin:6px;
border-radius:8px;
align-items: center;
}
</style>

View File

@ -0,0 +1,38 @@
<script scoped>
import UserSevice from '@/services/UserSevice';
export default {
name: "admHeader",
methods:{
logout(){
UserSevice.logout()
}
}
};
</script>
<template>
<div >
<nav class="navbar navbar-expand navbar-dark">
<div class="navbar-nav mr-auto">
<li class="nav-item">
<router-link to="/trains" class="nav-link" style="color: black;font-weight: bold;">Направления</router-link>
</li>
<li class="nav-item">
<router-link to="/benefits" class="nav-link" style="color: black;font-weight: bold;">Льготы</router-link>
</li>
<li class="nav-item">
<router-link to="/achievements" class="nav-link" style="color: black;font-weight: bold;">Достижения</router-link>
</li>
<li class="nav-item" >
<Button class="btn-secondary nav-link" @click="logout">Выйти</Button>
</li>
</div>
</nav>
</div>
</template>
<style>
.navbar{
background-color: #6EC0D9;
}
</style>

View File

@ -0,0 +1,20 @@
<template>
<div >
<nav class="navbar navbar-expand navbar-dark">
<div class="navbar-nav mr-auto">
<li class="nav-item">
<router-link to="/profile" class="nav-link" style="color: black;font-weight: bold;">Профиль</router-link>
</li>
<li class="nav-item">
<router-link to="/trainings" class="nav-link" style="color: black;font-weight: bold;">Направления</router-link>
</li>
</div>
</nav>
</div>
</template>
<style>
.navbar{
background-color: #6EC0D9;
}
</style>

9
front/src/http-common.js Normal file
View File

@ -0,0 +1,9 @@
import axios from "axios";
//const VIDEOS_API_BASE_URL = 'http://localhost:8080/api';
export default axios.create({
baseURL: "http://localhost:8080/api",
headers: {
"Content-type": "application/json"
}
});

8
front/src/main.js Normal file
View File

@ -0,0 +1,8 @@
import App from './App.vue'
import { createApp } from 'vue'
import router from './router'
import 'bootstrap'
import 'bootstrap/dist/css/bootstrap.min.css'
createApp(App).use(router).mount('#app')

62
front/src/router.js Normal file
View File

@ -0,0 +1,62 @@
import { createRouter, createWebHistory } from "vue-router";
const routes = [
{
path: "/login",
alias: "/login",
name: "login",
component: () => import("./components/login.vue")
},
{
path: "/register",
alias: "/register",
name: "register",
component: () => import("./components/register.vue")
},
{
path: "/profile",
alias: "/profile",
name: "profile",
component: () => import("./components/profile.vue")
},
{
path: "/trainings",
alias: "/trainings",
name: "trainings",
component: () => import("./components/trainings.vue")
},
{
path: '/orders/:id',
name: 'orders',
component: () => import("./components/orders.vue")
},
{
path: '/training/:id',
name: 'training',
component: () => import("./components/training.vue")
},
{
path: "/trains",
alias: "/trains",
name: "trains",
component: () => import("./components/trains.vue")
},
{
path: "/benefits",
alias: "/benefits",
name: "benefits",
component: () => import("./components/benefits.vue")
},
{
path: "/achievements",
alias: "/achievements",
name: "achievements",
component: () => import("./components/achievements.vue")
},
]
const router = createRouter({
routes,
history: createWebHistory()
})
export default router;

View File

@ -0,0 +1,37 @@
import axios from "../http-common";
class AchievementService {
create(data) {
return axios.post( `/achievement/`, data);
}
update(data) {
return axios.put(`/achievement/`, data);
}
delete(id) {
return axios.delete(`/achievement/${id}`);
}
getAll() {
return axios.get( "/achievement/");
}
get(id) {
return axios.get( `/achievement/${id}`);
}
getForUser(id) {
return axios.get( `/achievement/forUser/${id}`);
}
getForUserNot(id) {
return axios.get( `/achievement/forUserNot/${id}`);
}
}
export default new AchievementService();

View File

@ -0,0 +1,37 @@
import axios from "../http-common";
class BenefitService {
create(data) {
return axios.post( `/benefit/`, data);
}
update(data) {
return axios.put(`/benefit/`, data);
}
delete(id) {
return axios.delete(`/benefit/${id}`);
}
getAll() {
return axios.get( "/benefit/");
}
get(id) {
return axios.get( `/benefit/${id}`);
}
getForUser(id) {
return axios.get( `/benefit/forUser/${id}`);
}
getForUserNot(id) {
return axios.get( `/benefit/forUserNot/${id}`);
}
}
export default new BenefitService();

View File

@ -0,0 +1,29 @@
import axios from "../http-common";
class ExamResultService {
create(data) {
return axios.post( `/exam_result/`, data);
}
update(data) {
return axios.put(`/exam_result/`, data);
}
delete(userId, examId) {
return axios.delete(`/exam_result/${userId}/${examId}`);
}
get(userId, examId) {
return axios.get( `/exam_result/${userId}/${examId}`);
}
getForUser(id) {
return axios.get( `/exam_result/forUser/${id}`);
}
}
export default new ExamResultService();

View File

@ -0,0 +1,37 @@
import axios from "../http-common";
class ExamService {
create(data) {
return axios.post( `/exam/`, data);
}
update(data) {
return axios.put(`/exam/`, data);
}
delete(id) {
return axios.delete(`/exam/${id}`);
}
getAll() {
return axios.get( "/exam/");
}
get(id) {
return axios.get( `/exam/${id}`);
}
getForUser(id) {
return axios.get( `/exam/forUser/${id}`);
}
getForTraining(id) {
return axios.get( `/exam/forTraining/${id}`);
}
}
export default new ExamService();

View File

@ -0,0 +1,35 @@
import axios from "../http-common";
class OrderService {
create(user,training) {
return axios.post( `/order/${user}/${training}`);
}
delete(userId) {
return axios.delete(`/order/${userId}`);
}
get(id) {
return axios.get( `/order/${id}`);
}
getBenefit(id) {
return axios.get( `/order/benefit/${id}`);
}
getBasic(id) {
return axios.get( `/order/basic/${id}`);
}
getSearch(id, value) {
return axios.get( `/order/search/${id}/${value}`);
}
getForUser(id) {
return axios.get( `/order/forUser/${id}`);
}
}
export default new OrderService();

View File

@ -0,0 +1,29 @@
import axios from "../http-common";
class TrainingExamService {
create(data) {
return axios.post( `/training_exam/`, data);
}
update(data) {
return axios.put(`/training_exam/`, data);
}
delete(trainingId, examId) {
return axios.delete(`/training_exam/${trainingId}/${examId}`);
}
get(trainingId, examId) {
return axios.get( `/training_exam/${trainingId}/${examId}`);
}
getForTraining(id) {
return axios.get( `/training_exam/forTraining/${id}`);
}
}
export default new TrainingExamService();

View File

@ -0,0 +1,34 @@
import axios from "../http-common";
class TrainingService {
create(data) {
return axios.post( `/training/`, data);
}
update(data) {
return axios.put(`/training/`, data);
}
delete(id) {
return axios.delete(`/training/${id}`);
}
getAll() {
return axios.get( "/training/");
}
get(id) {
return axios.get( `/training/${id}`);
}
search(title) {
return axios.get( `/training/search/${title}`);
}
}
export default new TrainingService();

View File

@ -0,0 +1,46 @@
import router from "@/router";
import axios from "../http-common";
class UserService {
create(data) {
return axios.post( `/user/`, data);
}
update(data) {
return axios.put(`/user/`, data);
}
get(id) {
return axios.get( `/user/${id}`);
}
auth(email,pass) {
return axios.get( `/user/${email}/${pass}`);
}
logout() {
localStorage.removeItem('user');
router.push('/login')
}
addAchievement(userId, achievementId){
return axios.post(`/user/achievement/${userId}/${achievementId}`)
}
addBenefit(userId, benefitId){
return axios.post(`/user/benefit/${userId}/${benefitId}`)
}
removeAchievement(userId, achievementId){
return axios.delete(`/user/achievement/${userId}/${achievementId}`)
}
removeBenefit(userId, benefitId){
return axios.delete(`/user/benefit/${userId}/${benefitId}`)
}
}
export default new UserService();

9
front/vue.config.js Normal file
View File

@ -0,0 +1,9 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true
})
module.exports = {
devServer: {
port: 8081
}
}