78 lines
2.2 KiB
JavaScript
78 lines
2.2 KiB
JavaScript
// import { getLsItem, setLsItem } from "~/services/localStorage.service.js";
|
|
// import chatApi from "~/apis/chatApi";
|
|
import { useStorage } from "@vueuse/core";
|
|
import repoApi from "~/apis/repoApi";
|
|
|
|
export default {
|
|
methods: {
|
|
entityFieldsGetter(entity_field_id) {
|
|
return this.entityFields[entity_field_id][2];
|
|
},
|
|
async getSections() {
|
|
// let localStoageSections = getLsItem("sections_" + 2);
|
|
let localStorageSections = useStorage("sections_" + 2, []);
|
|
if (localStoageSections) {
|
|
this.issueSections = JSON.parse(localStoageSections);
|
|
return;
|
|
}
|
|
|
|
let payload = {
|
|
// entity_id: 2, // 2 : means issues
|
|
type_id: 2,
|
|
};
|
|
|
|
// let url = repoApi.entityFields.list;
|
|
let url = "keyvalue/" + repoApi.entityFields.list;
|
|
|
|
return await this.httpService
|
|
.postRequest(url, payload)
|
|
.then((res) => {
|
|
this.issueSections = res.data;
|
|
// save res to local storage.
|
|
const sections = useStorage("sections_" + 2, []);
|
|
sections.value = JSON.stringify(res.data);
|
|
// setLsItem("sections_" + 2, JSON.stringify(res.data));
|
|
})
|
|
.catch((err) => {})
|
|
.finally(() => {});
|
|
},
|
|
|
|
async getIssue(entityId) {
|
|
let url = "repo/jahat/get/" + entityId;
|
|
return await this.httpService.getRequest(url).then((res) => {
|
|
this.issue = res._source;
|
|
});
|
|
},
|
|
closeIssueProperties() {
|
|
this.showIssueProperties = false;
|
|
},
|
|
goToJahat() {
|
|
this.SET_USER_PERMISSIONS();
|
|
this.SET_AUTHORIZED_PAGES();
|
|
|
|
if (this.listGetter.type == 2) {
|
|
this.$router
|
|
.push({
|
|
name: "issuesShow",
|
|
params: {
|
|
id: this.listGetter?.reference_id ?? null,
|
|
},
|
|
})
|
|
.then(() => {});
|
|
} else if (this.listGetter.type == 3) {
|
|
this.$router
|
|
.push({
|
|
name: "answersShow",
|
|
params: {
|
|
answerId: this.listGetter?.reference_id,
|
|
entityId: this.listGetter?.parent_reference,
|
|
},
|
|
})
|
|
.then(() => {});
|
|
}
|
|
|
|
// :href="'/jahat/' + buttonName + '/' + listGetter?.reference_id"
|
|
},
|
|
},
|
|
};
|