Merge branch '3-transition-medical-card' into 'master'
Добавил параметры роута Closes #3 See merge request astra/astra-frontend!501
This commit is contained in:
@@ -140,13 +140,9 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
filterDataBenefit(text) {
|
||||
if (text.length > 1) {
|
||||
localStorage.setItem("searchBenefit", text);
|
||||
this.$store.dispatch("getBenefitDataSearch");
|
||||
} else {
|
||||
this.$store.dispatch("getBenefitData");
|
||||
localStorage.removeItem("searchBenefit", text);
|
||||
}
|
||||
if (text.length > 1)
|
||||
return this.$store.dispatch("getBenefitDataSearch", text);
|
||||
this.$store.dispatch("getBenefitData", text);
|
||||
},
|
||||
removeImage(docKey, field) {
|
||||
this.basic[docKey][field] = {};
|
||||
|
||||
@@ -191,8 +191,7 @@ export default {
|
||||
checkChangeInput(val, key) {
|
||||
if (key === "last_name") {
|
||||
if (val.length > 0) {
|
||||
localStorage.setItem("searchConfidant", val);
|
||||
this.$store.dispatch("getPersonsFiltredList").then((res) => {
|
||||
this.$store.dispatch("getPersonsFiltredList", val).then((res) => {
|
||||
if (res.length > 0) {
|
||||
this.listPersons = res;
|
||||
this.isOpenListConfidant = true;
|
||||
@@ -225,7 +224,8 @@ export default {
|
||||
getRequestConfidant(
|
||||
this.confidant,
|
||||
initConfidantData,
|
||||
this.initPerson
|
||||
this.initPerson,
|
||||
this.$route.params.id
|
||||
).then(() => {
|
||||
this.$store.dispatch("getMedicalCardData");
|
||||
this.isLoadingData = false;
|
||||
@@ -259,9 +259,7 @@ export default {
|
||||
if (this.confidant.id) {
|
||||
fetchWrapper
|
||||
.del(
|
||||
`medical_card/medical_history/${localStorage.getItem(
|
||||
"medicalId"
|
||||
)}/delete_confidant/`,
|
||||
`medical_card/medical_history/${this.$route.params.id}/delete_confidant/`,
|
||||
{
|
||||
confidants: [
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ export default {
|
||||
methods: {
|
||||
removeMedicalCard() {
|
||||
this.changeShownRemoveModal(false);
|
||||
this.$store.dispatch("removeMedicalCardData");
|
||||
this.$store.dispatch("removeMedicalCardData", this.$route.params.id);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -249,11 +249,7 @@ export default {
|
||||
!!tooth.tooth_mobility &&
|
||||
!!tooth.dental_condition;
|
||||
if (isCreate) {
|
||||
requestCreateMedicalCard(
|
||||
tooth,
|
||||
key,
|
||||
localStorage.getItem("medicalId")
|
||||
);
|
||||
requestCreateMedicalCard(tooth, key, this.$route.params.id);
|
||||
}
|
||||
if (
|
||||
toothResponse &&
|
||||
@@ -273,7 +269,7 @@ export default {
|
||||
requestCreateMedicalCard(
|
||||
this.dentalIndications[key],
|
||||
key,
|
||||
localStorage.getItem("medicalId")
|
||||
this.$route.params.id
|
||||
);
|
||||
}
|
||||
if (
|
||||
@@ -385,11 +381,7 @@ export default {
|
||||
},
|
||||
async fetchDataMedicalCard() {
|
||||
await fetchWrapper
|
||||
.get(
|
||||
`medical_card/medical_history/${localStorage.getItem(
|
||||
"medicalId"
|
||||
)}/detail/`
|
||||
)
|
||||
.get(`medical_card/medical_history/${this.$route.params.id}/detail/`)
|
||||
.then((res) => this.saveDataMedical(res));
|
||||
},
|
||||
},
|
||||
|
||||
@@ -89,8 +89,8 @@ export function getRequestNote(note, initNote, personId) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
export function getRequestConfidant(confidant, initConfidant, initPerson) {
|
||||
const medicalId = localStorage.getItem("medicalId");
|
||||
export function getRequestConfidant(confidant, initConfidant, initPerson, id) {
|
||||
const medicalId = id;
|
||||
const fullName = `${confidant.last_name.value} ${confidant.first_name.value} ${confidant.patronymic.value}`;
|
||||
let contacts = [];
|
||||
const phone = confidant.phone.value
|
||||
|
||||
@@ -259,7 +259,7 @@ const getters = {
|
||||
state.medicalCard?.person?.contacts
|
||||
?.filter((el) => el.category === "PHONE")
|
||||
?.map((el) => {
|
||||
el.value = el.value.slice(1);
|
||||
el.value = el.value.length > 10 ? el.value.slice(1) : el.value;
|
||||
return { ...el };
|
||||
}) || [];
|
||||
let emails =
|
||||
@@ -443,12 +443,10 @@ const actions = {
|
||||
commit("setBenefitData", res.results);
|
||||
});
|
||||
},
|
||||
getBenefitDataSearch({ commit }) {
|
||||
fetchWrapper
|
||||
.get(`general/benefit/?name=${localStorage.getItem("searchBenefit")}`)
|
||||
.then((res) => {
|
||||
commit("setBenefitData", res.results);
|
||||
});
|
||||
getBenefitDataSearch({ commit }, text) {
|
||||
fetchWrapper.get(`general/benefit/?name=${text}`).then((res) => {
|
||||
commit("setBenefitData", res.results);
|
||||
});
|
||||
},
|
||||
createMedicalCard(ctx, id) {
|
||||
fetchWrapper.post("medical_cards", {
|
||||
@@ -489,11 +487,9 @@ const actions = {
|
||||
commit("setEventsPersonData", data?.person?.id);
|
||||
});
|
||||
},
|
||||
getPersonsFiltredList() {
|
||||
getPersonsFiltredList(value) {
|
||||
return fetchWrapper
|
||||
.get(
|
||||
`general/person/?last_name=${localStorage.getItem("searchConfidant")}`
|
||||
)
|
||||
.get(`general/person/?last_name=${value}`)
|
||||
.then((res) => res.results);
|
||||
},
|
||||
returnInitData({ commit }) {
|
||||
@@ -502,18 +498,11 @@ const actions = {
|
||||
commit("setAllergiesData");
|
||||
commit("setConfidantData");
|
||||
},
|
||||
removeMedicalCardData({ commit, rootState }) {
|
||||
fetchWrapper
|
||||
.del(
|
||||
`medical_card/medical_history/${localStorage.getItem(
|
||||
"medicalId"
|
||||
)}/delete/`
|
||||
)
|
||||
.then(() => {
|
||||
rootState.routingHistory.back();
|
||||
commit("setMedicalCard", {});
|
||||
localStorage.removeItem("medicalId");
|
||||
});
|
||||
removeMedicalCardData({ commit, rootState }, id) {
|
||||
fetchWrapper.del(`medical_card/medical_history/${id}/delete/`).then(() => {
|
||||
rootState.routingHistory.back();
|
||||
commit("setMedicalCard", {});
|
||||
});
|
||||
},
|
||||
createProtocol({ commit, rootGetters, state }, data) {
|
||||
data.employee = rootGetters.getUserData;
|
||||
|
||||
Reference in New Issue
Block a user