//Lefleat
var ZoomIn, ZoomOut, DrawPoligon, DrawCircle, CancelDrawing, Cancel, FinishDrawing, Finish, DelLasPoiDraw, DelLasPoint, ClickDrawCircle, Radius, ClickStartDrawingShape, ClickContinueDrawingShape, ClickFirstPoint, ReleaseMouFinDrawing;
//MapCompare
var Indice, Fecha, Dia, Nubes, Ene, Feb, Mar, Abr, May, Jun, Jul, Ago, Sep, Oct, Nov, Dic, GIS_ERROR_NOT_DATE;
//Globals
var listGlobals;
/* #region CONST PRIVATE */
const COLOR_LOTE_SELECCIONADO = "#e99413";
const FILLCOLOR_LOTE_SELECCIONADO = "#e99413";
const FILLOPACITY_LOTE_SELECCIONADO = 0.2;
const WEIGTH_LOTE_SELECCIONADO = 2;
const COLOR_LOTE_ACTIVO = "white";
const FILLCOLOR_LOTE_ACTIVO = "#84877c";
const FILLOPACITY_LOTE_ACTIVO = 0.2;
const WEIGTH_LOTE_ACTIVO = 2;
const COLOR_LOTE_BORRADOR = "#B21111";
const FILLCOLOR_LOTE_BORRADOR = "#BD9393";
const FILLOPACITY_LOTE_BORRADOR = 0.4;
const WEIGTH_LOTE_BORRADOR = 2;
const NDVI = "NDVI";
const GNDVI = "GNDVI";
const NDRE = "NDRE"
const EC = "EC";
const EV = "EV";
const ZBM = "ZBM";
const ANOMALIES = "ANOMALIES";
const COLOR_ANS = 'blue';
const OPACITY_ANS = 1;
const FILL_OPACITY_ANS = 0;
const COLOR_ANP = 'black';
const OPACITY_ANP = 1;
const FILL_OPACITY_ANP = 0;
const COLOR_DELETE_ANP = 'red';
const OPACITY_DELETE_ANP = 0.6;
const COLOR_DI_ANP = 'yellow'; //Data Intelligence
const OPACITY_DI_ANP = 0.6; //Data Intelligence
const POLYGON = "POLYGON";
const CIRCLE = "CIRCLE";
const POINT = 'POINT';
const MAP0 = "map0";
const MAP1 = "map1";
const MAP = "Map";
const MAP_COMPARE = "MapCompare";
const MAP_COMPARE_MOVIL = "MapCompareMovil";
const DESKTOP = "desktop";
const MOBILE = "Mobile";
const SITE = 'ACAMICAMPO';
const ACAMICAMPO = "ACAMICAMPO";
const AGROBIT = "AGROBIT";
//VIEWS
const ADMCAMPOS = "ADMCAMPOS";
const CAMPOS = "CAMPOS"
const LANDING = "HOME";
const LOTE = "LOTE";
const LOTESESTABLE = "LOTES";
const MBSIMULAR = "MARGENBRUTOSIMULAR";
const MARGENBRUTO = "MARGENBRUTO";
const MBDETAILS = "MBDETAILS";
const ASIGNARCULTIVOS = "ASIGNARCULTIVOS";
const CLIMA = "CLIMA";
const MERCADO = "FINANZAS";
const TAREAS = "TAREAS";
const ABMTAREA = "ABMTAREA";
const ALERTAS = "ALERTAS";
const LOTESIMPORTAR = "LOTESIMPORTAR";
const CAMBIOACTIVIDAD = "CAMBIOACTIVIDAD";
const PERFILUSUARIO = "PERFILUSUARIO";
const CIERREGESTION = "CIERREGESTION";
/* #endregion */
getGlobals();
/*function getGlobals() {
$.ajax({
type: "POST",
url: "../MiCampo/GetGlobals",
contentType: "application/json; charset=utf-8",
async: false,
dataType: "json",
success: function (response) {
if (response.Status == "OK") {
listGlobals = JSON.parse(response.List);
setLeafletGlobals();
}
else {
OpenModalError(response.Error);
}
},
error: function (msg) {
var error = msg.responseText.split("
")[1].split("")[0];
console.log(error);
}
});
};*/
async function getGlobals() {
let globals = localStorage.getItem('globals');
if (globals != undefined && globals != "undefined"){
listGlobals = JSON.parse(globals);
setLeafletGlobals();
return false;
}
try
{
let response = await fetch('../MiCampo/GetGlobals', {
method: "POST"
});
let body = await response.json();
if (body.Status == "OK") {
listGlobals = JSON.parse(body.List);
localStorage.setItem('globals', body.List);
setLeafletGlobals();
}
else {
//OpenModalError(response.Error);
}
}
catch(error){
//OpenModalError(error);
console.log(error);
}
};
function setLeafletGlobals(){
//Lefleat
ZoomIn = listGlobals.find(x => x.Key == 'Zoom_In').Value;
ZoomOut = listGlobals.find(x => x.Key == 'Zoom_Out').Value;
DrawPoligon = listGlobals.find(x => x.Key == 'Draw_Polygon').Value;
DrawCircle = listGlobals.find(x => x.Key == 'Draw_Circle').Value;
CancelDrawing = listGlobals.find(x => x.Key == 'Cancelar_Dibujo').Value;
Cancel = listGlobals.find(x => x.Key == 'CANCEL').Value;
FinishDrawing = listGlobals.find(x => x.Key == 'Finish_Drawing').Value;
Finish = listGlobals.find(x => x.Key == 'Finish').Value;
DelLasPoiDraw = listGlobals.find(x => x.Key == 'Delete_Last_Point_Drawn').Value;
DelLasPoint = ''; //listGlobals.find(x => x.Key == 'Delete_Last_Point').Value;
ClickDrawCircle = listGlobals.find(x => x.Key == 'Click_And_Drag_To_Draw_Circle').Value;
Radius = listGlobals.find(x => x.Key == 'RADIO').Value
ClickStartDrawingShape = listGlobals.find(x => x.Key == 'Click_To_Start_Drawing').Value;
ClickContinueDrawingShape = listGlobals.find(x => x.Key == 'Click_To_Continue_Drawing').Value;
ClickFirstPoint = listGlobals.find(x => x.Key == 'Click_First_Point').Value;
ReleaseMouFinDrawing = listGlobals.find(x => x.Key == 'Release_Mouse_To_Finish_Drawing').Value;
//MapCompare
Indice = listGlobals.find(x => x.Key == 'Indice').Value;
Fecha = listGlobals.find(x => x.Key == 'DATE').Value;
Dia = listGlobals.find(x => x.Key == 'Dia').Value;
Nubes = listGlobals.find(x => x.Key == 'Nubes').Value;
Ene = listGlobals.find(x => x.Key == 'ENE').Value;
Feb = listGlobals.find(x => x.Key == 'FEB').Value;
Mar = listGlobals.find(x => x.Key == 'MAR').Value;
Abr = listGlobals.find(x => x.Key == 'ABR').Value;
May = listGlobals.find(x => x.Key == 'MAY').Value;
Jun = listGlobals.find(x => x.Key == 'JUN').Value;
Jul = listGlobals.find(x => x.Key == 'JUL').Value;
Ago = listGlobals.find(x => x.Key == 'AGO').Value;
Sep = listGlobals.find(x => x.Key == 'SEP').Value;
Oct = listGlobals.find(x => x.Key == 'OCT').Value;
Nov = listGlobals.find(x => x.Key == 'NOV').Value;
Dic = listGlobals.find(x => x.Key == 'DIC').Value;
GIS_ERROR_NOT_DATE = listGlobals.find(x => x.Key == 'GIS_ERROR_NOT_DATE').Value;
//FIN MapCompare
};