From f5ee020f8804e9ed404230d8afa87b64f72675ad Mon Sep 17 00:00:00 2001 From: Bacer Date: Mon, 25 Mar 2024 15:44:36 +0300 Subject: [PATCH 1/2] wip --- src/services/dataSlice.js | 60 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/src/services/dataSlice.js b/src/services/dataSlice.js index b1ec720..b4fd28c 100644 --- a/src/services/dataSlice.js +++ b/src/services/dataSlice.js @@ -302,13 +302,71 @@ export function formDataPost(values) { return function (dispatch) { // dispatch(dataSlice.actions.handleLoading(true)); + const whenWork = (value) => { + switch (value) { + case 0: + return "Срочно"; + case 1: + return "Не очень срочно"; + case 2: + return "Времени достаточно"; + default: + return "Срочно"; + } + }; + + const whatNeed = (value) => { + switch (value) { + case 0: + return "Только резюме"; + case 1: + return "Резюме + результаты собеседования"; + default: + return "Только резюме"; + } + }; + + const arrStringToNum = (arr) => { + return arr.map(Number); + }; + + const tmpData = { + name: values.vacancyNameField.name, + specialization_id: values.specialisationField.id, + city_id: values.cityField.id, + salary_from: values.salaryFromField, + salary_to: values.salaryToField, + hr_salary: values.rewardField, + hr_salary_model: Number(values.rewardRadio), + employee_to_search: values.employeeCountField, + number_of_recruiters: Number(values.recruiterCount), + grade: values.grade, + experience: values.expirience, + employment: values.employment, + registration_type: values.registrationType, + when_work: whenWork(Number(values.rewardRadio3)), + what_need: whatNeed(Number(values.whatNeedRadio)), + work_types: values.worktype, + responsibilities_ids: arrStringToNum(values.responsibilitiesCheckboxes), + requirements_ids: arrStringToNum(values.requirementsCheckboxes), + conditions_ids: arrStringToNum(values.conditionsCheckbox), + additional_tasks: values.additionalTasks, + responsibilities_description: values.responsibilitiesField, + requirements_description: values.requirementsField, + conditions_description: values.conditionsField, + special_requirements: values.specialRequirementsField, + show_info: values.companyInfoSwitch, + }; + + console.log(tmpData); + request(`/hrspace/vacancy`, { method: "POST", headers: { "Content-Type": "application/json;charset=utf-8", accept: "application/json", }, - body: JSON.stringify(values), + body: JSON.stringify(tmpData), }) .then(() => { dispatch(handleSuccess(true)); From 6bd2542f35537a1a6a2c9361a9f23ed32d973add Mon Sep 17 00:00:00 2001 From: Bacer Date: Mon, 25 Mar 2024 15:45:07 +0300 Subject: [PATCH 2/2] del log --- src/services/dataSlice.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/dataSlice.js b/src/services/dataSlice.js index b4fd28c..68efdb4 100644 --- a/src/services/dataSlice.js +++ b/src/services/dataSlice.js @@ -358,7 +358,7 @@ export function formDataPost(values) { show_info: values.companyInfoSwitch, }; - console.log(tmpData); + // console.log(tmpData); request(`/hrspace/vacancy`, { method: "POST",