Skip to content
Snippets Groups Projects
Commit 13e3941a authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Adding "Unknown" to all lists

parent ffe1a226
Branches
No related tags found
No related merge requests found
......@@ -496,38 +496,31 @@
lstPests.push({"pestId": '', "pestName": this.$i18n.t("observation.selectpest")});
}
if (lstPestIds.length === 0) {
lstPests.push({"pestId": -10, "pestName": this.$i18n.t("observation.unregisteredpest")});
}
else {
let lstPestList = JSON.parse(localStorage.getItem(CommonUtil.CONST_STORAGE_PEST_LIST));
$.each(lstPestIds, function (index, pestId) {
let jsonDetailPest = lstPestList.find(({organismId}) => organismId === pestId);
let jsonPest = {};
if (jsonDetailPest) {
let pestName = jsonDetailPest.latinName;
let organismLocaleSet = jsonDetailPest.organismLocaleSet;
if (organismLocaleSet) {
let strLocale = This.getSystemLocale();
organismLocaleSet.forEach(localObj => {
if (localObj.organismLocalePK.locale === strLocale) {
if (localObj.localName) {
pestName = localObj.localName;
}
return false;
let lstPestList = JSON.parse(localStorage.getItem(CommonUtil.CONST_STORAGE_PEST_LIST));
$.each(lstPestIds, function (index, pestId) {
let jsonDetailPest = lstPestList.find(({organismId}) => organismId === pestId);
let jsonPest = {};
if (jsonDetailPest) {
let pestName = jsonDetailPest.latinName;
let organismLocaleSet = jsonDetailPest.organismLocaleSet;
if (organismLocaleSet) {
let strLocale = This.getSystemLocale();
organismLocaleSet.forEach(localObj => {
if (localObj.organismLocalePK.locale === strLocale) {
if (localObj.localName) {
pestName = localObj.localName;
}
});
}
jsonPest = {"pestId": jsonDetailPest.organismId, "pestName": pestName};
lstPests.push(jsonPest);
return false;
}
});
}
});
}
jsonPest = {"pestId": jsonDetailPest.organismId, "pestName": pestName};
lstPests.push(jsonPest);
}
});
lstPests.push({"pestId": -10, "pestName": this.$i18n.t("observation.unregisteredpest")});
this.pests = lstPests;
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment