From 1b442c866e0c69857c705089043108d33d0fb800 Mon Sep 17 00:00:00 2001 From: Yasseen Salama Date: Mon, 21 Nov 2022 12:08:19 +0100 Subject: [PATCH 1/2] removed tags --- src/router/index.js | 7 +------ src/views/Form/Form.js | 36 ++---------------------------------- src/views/Form/Form.scss | 14 -------------- src/views/Form/Form.vue | 6 +----- 4 files changed, 4 insertions(+), 59 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 60e5b21..9f19b60 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -5,14 +5,9 @@ import Form from "../views/Form/Form.vue"; Vue.use(VueRouter); const routes = [ - { - path: "/:id", - name: "Form with tag", - component: Form - }, { path: "/", - name: "Form without tag", + name: "Form", component: Form } // { diff --git a/src/views/Form/Form.js b/src/views/Form/Form.js index ed5f3e4..d62ca53 100644 --- a/src/views/Form/Form.js +++ b/src/views/Form/Form.js @@ -9,46 +9,14 @@ export default { email: "", interests: "", error: "", - isLoading: false, - tags: [] + isLoading: false }; }, - watch: { - "$route.params"(to) { - if (!to.id) this.getTags(); - else this.isValidTag(); - } - }, created() { - if(!this.$route.params?.id) this.getTags(); - else this.isValidTag(); + // this.get(); }, methods: { - async getTags() { - this.error = ""; - try { - const response = await http().get("candidate_tag?page_size=100"); - if(response) { - this.tags = response.data.data.filter(tag => tag["created_at"] >= "2021-10-25T12:53:19+02:00"); - } - }catch(error) { - const errorString: string = error.response?.data?.message || "Sending form failed"; - this.error = "Error: " + errorString; - } - }, - async isValidTag() { - this.error = ""; - try { - const response = await http().get("candidate_tag?page_size=100"); - if(!(response && response.data.data.find(tag => String(tag.id) === this.$route.params?.id))) { - await this.$router.push("/"); - } - } catch(error) { - const errorString: string = error.response?.data?.message || "Sending form failed"; - this.error = "Error: " + errorString; - } - }, async get() { this.error = ""; try { diff --git a/src/views/Form/Form.scss b/src/views/Form/Form.scss index d321973..0e0ba4d 100644 --- a/src/views/Form/Form.scss +++ b/src/views/Form/Form.scss @@ -86,20 +86,6 @@ } } } - - .tags { - display: flex; - flex-direction: column; - - button { - border: 1px solid #ddd; - border-radius: 5px; - padding: 10px; - font-size: 16px; - background: white; - margin: 5px 0; - } - } } .error { diff --git a/src/views/Form/Form.vue b/src/views/Form/Form.vue index 34dc25d..4ea2098 100644 --- a/src/views/Form/Form.vue +++ b/src/views/Form/Form.vue @@ -1,7 +1,7 @@ From 17a84e5b121bf25aa0753fd4abd54e6d4de075a0 Mon Sep 17 00:00:00 2001 From: Yasseen Salama Date: Tue, 13 Dec 2022 16:13:33 +0100 Subject: [PATCH 2/2] Job positions dropdown dialog, XML job positions from personio, Personio API send application --- package.json | 3 ++- src/App.vue | 4 ---- src/main.js | 3 +++ src/router/index.js | 8 -------- src/utils/http.js | 18 ++++++++++++------ src/views/Form/Form.js | 39 +++++++++++++++++++++++---------------- src/views/Form/Form.scss | 1 + src/views/Form/Form.vue | 7 +++++-- 8 files changed, 46 insertions(+), 37 deletions(-) diff --git a/package.json b/package.json index 94d2586..319ff14 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "axios": "^0.19.2", "core-js": "^3.6.4", "vue": "^2.6.11", - "vue-router": "^3.1.5" + "vue-router": "^3.1.5", + "vue-select": "^3.20.0" }, "devDependencies": { "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", diff --git a/src/App.vue b/src/App.vue index 91abe52..9f9d7c1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,9 +1,5 @@ diff --git a/src/main.js b/src/main.js index dffc258..9958986 100644 --- a/src/main.js +++ b/src/main.js @@ -1,6 +1,9 @@ import Vue from "vue"; import App from "./App.vue"; import router from "./router"; +import vSelect from "vue-select"; + +Vue.component("v-select", vSelect); Vue.config.productionTip = false; diff --git a/src/router/index.js b/src/router/index.js index 9f19b60..f598df3 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -10,14 +10,6 @@ const routes = [ name: "Form", component: Form } - // { - // path: '/about', - // name: 'About', - // // route level code-splitting - // // this generates a separate chunk (about.[hash].js) for this route - // // which is lazy-loaded when the route is visited. - // component: () => import(/* webpackChunkName: "about" */ '../views/About.vue') - // } ]; const router = new VueRouter({ diff --git a/src/utils/http.js b/src/utils/http.js index 76273e5..ef420dc 100644 --- a/src/utils/http.js +++ b/src/utils/http.js @@ -1,14 +1,20 @@ import axios from "axios"; +export function xml() { + const axiosInstance = axios.create({ + baseURL: "https://tdsoftware.jobs.personio.de/xml?language=en", + headers: {"Content-Type": "application/xml"} + }); + + return axiosInstance; +} + export function http() { const axiosInstance = axios.create({ - baseURL: "https://api.prescreenapp.io/v1", - headers: { - "Content-Type": "application/json", - "apikey": "ymXfs1OGyuBOLj6zoxtuG27U0O6UULd9" - }, - data: null + baseURL: "https://api.personio.de/v1/recruiting/applications", + headers: { "Accept": "application/json", "Content-Type": "application/json", "Authorization": "Bearer 029f0f7593291293cc5c", "X-Company-Id": ""} }); return axiosInstance; } + diff --git a/src/views/Form/Form.js b/src/views/Form/Form.js index d62ca53..ac7e430 100644 --- a/src/views/Form/Form.js +++ b/src/views/Form/Form.js @@ -1,4 +1,4 @@ -import { http } from "../../utils/http"; +import { xml, http } from "../../utils/http"; export default { name: "Form", @@ -9,21 +9,29 @@ export default { email: "", interests: "", error: "", - isLoading: false + isLoading: false, + openPositions: [], + selectedPosition: "" }; }, created() { - - // this.get(); + this.get(); }, methods: { async get() { this.error = ""; try { - const response = await http().get("candidate?"); - console.log("candidate", response.data); - const response2 = await http().get("application"); - console.log("job", response2.data); + const response = await xml().get(); + console.log("open positions", response.data); + const parser = new DOMParser(); + const xmlDoc = parser.parseFromString(response.data, "application/xml"); + const nameElements = xmlDoc.getElementsByTagName("name"); + for (let i = 0; i < nameElements.length; i++) { + const element = nameElements[i]; + if (element.parentNode.nodeName === "position") { + this.openPositions.push(element.innerHTML); + } + } } catch(error) { const errorString: string = error.response?.data?.message || "Sending form failed"; this.error = "Error: " + errorString; @@ -33,14 +41,13 @@ export default { this.error = ""; this.isLoading = true; try { - await http().post("candidate", { - profile: { - firstname: this.firstName, - lastname: this.lastName - }, - email: this.email, - "candidate_tag_ids": [this.$route.params?.id], - "motivational_letter": this.interests + await http().post("data", { + "first_name": this.firstName, + "last_name": this.lastName, + "email": this.email, + "job_position_id": 893585, + "message": this.selectedPosition + " " + this.interests, + "application_date": new Date().toISOString().split("T")[0] }); this.$toastr.render("Form send successfully"); this.clearForm(); diff --git a/src/views/Form/Form.scss b/src/views/Form/Form.scss index 0e0ba4d..f4e196d 100644 --- a/src/views/Form/Form.scss +++ b/src/views/Form/Form.scss @@ -1,3 +1,4 @@ +@import '~vue-select/dist/vue-select.css'; @keyframes rotate { from { transform: rotate(0deg); diff --git a/src/views/Form/Form.vue b/src/views/Form/Form.vue index 4ea2098..3342207 100644 --- a/src/views/Form/Form.vue +++ b/src/views/Form/Form.vue @@ -9,9 +9,11 @@ - + + +