diff --git a/abitur_list_client/src/components/AbiturMain.vue b/abitur_list_client/src/components/AbiturMain.vue index 72968a2..2481551 100644 --- a/abitur_list_client/src/components/AbiturMain.vue +++ b/abitur_list_client/src/components/AbiturMain.vue @@ -22,7 +22,7 @@ - +

Добавить результат

@@ -54,15 +54,14 @@ Дата: {{ request['date']}}

- - -

- +

+
@@ -142,6 +141,61 @@ export default { window.location.reload() }, + onRequestButtonClick(requestId) { + this.$router.push( + { + name: "Request", + params: { + requestId: requestId + } + } + ); + }, + + async createNewRequest() { + const axios = require('axios'); + + var requestId = 0; + + let data = JSON.stringify({ + "abitur_id": this.abiturId, + "education_form_id": 2, + "specialization_id": 2 + }); + + let config = { + method: 'post', + maxBodyLength: Infinity, + url: 'http://127.0.0.1:8080/api/request', + headers: { + 'Content-Type': 'application/json' + }, + data : data + }; + + await axios.request(config) + .then((response) => { + requestId = response.data['id'] + }) + .catch((error) => { + console.log(error); + }); + + this.$router.push( + { + name: "Request", + params: { + requestId: requestId + } + } + ); + }, + + async deleteRequest(requestId) { + await axios.delete('http://127.0.0.1:8080/api/request/' + requestId) + window.location.reload() + }, + async refresh() { var response = (await axios.get('http://127.0.0.1:8080/api/examresult/abitur/' + this.abiturId)).data this.examResults = response diff --git a/abitur_list_client/src/components/Request.vue b/abitur_list_client/src/components/Request.vue index a6cbbba..c07a74d 100644 --- a/abitur_list_client/src/components/Request.vue +++ b/abitur_list_client/src/components/Request.vue @@ -1,11 +1,209 @@