Commit 9cb02a0c authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

adjustments to obsdate when setting period startdate

parent 420e3a80
......@@ -54,6 +54,8 @@ var OSLocation = (function (_super) {
self.depthInput.onchange = function () {
self.validate();
};
self.obsDateInput.onchange = function () { self.fireChangeFn(self); };
self.obsTimeInput.onchange = function () { self.fireChangeFn(self); };
UIkit.ready(function () {
var startDatePicker = UIkit.datepicker(self.obsDateInput, { format: self.dateFormat });
var startTimePicker = UIkit.timepicker(self.obsTimeInput, {});
......@@ -71,9 +73,11 @@ var OSLocation = (function (_super) {
_super.prototype.defaults.call(this);
var self = this;
if (document.body.contains(self.obsDateInput)) {
var initDate = moment.utc();
self.obsDateInput.value = initDate.format(self.dateFormat);
self.obsTimeInput.value = initDate.startOf('hour').format(self.timeFormat);
if (self.obsDateInput.value == '') {
var initDate = moment.utc();
self.obsDateInput.value = initDate.format(self.dateFormat);
self.obsTimeInput.value = initDate.startOf('hour').format(self.timeFormat);
}
}
};
OSLocation.prototype.populateCard = function (geojson) {
......@@ -86,6 +90,7 @@ var OSLocation = (function (_super) {
var time = moment.utc(observation.date).format(self.timeFormat);
self.obsTimeInput.value = time;
self.depthInput.value = simulation.depth;
self.fireChangeFn(this);
};
OSLocation.prototype.populateData = function (geojson) {
_super.prototype.populateData.call(this, geojson);
......@@ -318,6 +323,7 @@ var L;
this.cardMap[periodid].addChangeFnListener(this.cardMap[oiltypeid]);
var amountid = self.initials + 'amountCard';
self.cardMap[amountid] = new OSAmount(amountid, this.accordionDiv, self.lang, map, self.type, self.initials);
this.cardMap[locationid].addChangeFnListener(this.cardMap[periodid]);
_super.prototype.setup.call(this, map);
var chain = [];
chain[locationid] = periodid;
......
......@@ -54,6 +54,8 @@ var OSLocation = (function (_super) {
self.depthInput.onchange = function () {
self.validate();
};
self.obsDateInput.onchange = function () { self.fireChangeFn(self); };
self.obsTimeInput.onchange = function () { self.fireChangeFn(self); };
UIkit.ready(function () {
var startDatePicker = UIkit.datepicker(self.obsDateInput, { format: self.dateFormat });
var startTimePicker = UIkit.timepicker(self.obsTimeInput, {});
......@@ -71,9 +73,11 @@ var OSLocation = (function (_super) {
_super.prototype.defaults.call(this);
var self = this;
if (document.body.contains(self.obsDateInput)) {
var initDate = moment.utc();
self.obsDateInput.value = initDate.format(self.dateFormat);
self.obsTimeInput.value = initDate.startOf('hour').format(self.timeFormat);
if (self.obsDateInput.value == '') {
var initDate = moment.utc();
self.obsDateInput.value = initDate.format(self.dateFormat);
self.obsTimeInput.value = initDate.startOf('hour').format(self.timeFormat);
}
}
};
OSLocation.prototype.populateCard = function (geojson) {
......@@ -86,6 +90,7 @@ var OSLocation = (function (_super) {
var time = moment.utc(observation.date).format(self.timeFormat);
self.obsTimeInput.value = time;
self.depthInput.value = simulation.depth;
self.fireChangeFn(this);
};
OSLocation.prototype.populateData = function (geojson) {
_super.prototype.populateData.call(this, geojson);
......
This diff is collapsed.
......@@ -58,6 +58,9 @@ class OSLocation extends STWkit.LocationCard {
};
self.obsDateInput.onchange = function () {self.fireChangeFn(self);};
self.obsTimeInput.onchange = function () {self.fireChangeFn(self);};
UIkit.ready(function () {
var startDatePicker = UIkit.datepicker(<any>self.obsDateInput, { format: self.dateFormat });
......@@ -78,12 +81,15 @@ class OSLocation extends STWkit.LocationCard {
super.defaults();
var self = this;
if (document.body.contains(self.obsDateInput)) {
var initDate = moment.utc();
self.obsDateInput.value = initDate.format(self.dateFormat);
self.obsTimeInput.value = initDate.startOf('hour').format(self.timeFormat);
if (self.obsDateInput.value == '') {
var initDate = moment.utc();
self.obsDateInput.value = initDate.format(self.dateFormat);
self.obsTimeInput.value = initDate.startOf('hour').format(self.timeFormat);
}
}
}
public populateCard(geojson) {
super.populateCard(geojson);
var self = this;
......@@ -94,6 +100,7 @@ class OSLocation extends STWkit.LocationCard {
var time = moment.utc(observation.date).format(self.timeFormat);
self.obsTimeInput.value = time;
self.depthInput.value = simulation.depth;
self.fireChangeFn(this);
}
public populateData(geojson) {
......
......@@ -52,6 +52,7 @@ var L;
this.cardMap[periodid].addChangeFnListener(this.cardMap[oiltypeid]);
var amountid = self.initials + 'amountCard';
self.cardMap[amountid] = new OSAmount(amountid, this.accordionDiv, self.lang, map, self.type, self.initials);
this.cardMap[locationid].addChangeFnListener(this.cardMap[periodid]);
_super.prototype.setup.call(this, map);
var chain = [];
chain[locationid] = periodid;
......
{"version":3,"file":"leaflet-oilspill-control.js","sourceRoot":"","sources":["leaflet-oilspill-control.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,yCAAyC;AACzC,yCAAyC;AACzC,wCAAwC;AACxC,wCAAwC;AACxC,yCAAyC;AACzC,kDAAkD;;;;;;;;;;;AAElD,IAAO,CAAC,CAkFP;AAlFD,WAAO,CAAC;IAAC,IAAA,OAAO,CAkFf;IAlFQ,WAAA,OAAO;QACZ;YAA8B,4BAAkB;YAe5C,kBAAY,OAAO;gBAAnB,YACI,kBAAM,OAAO,CAAC,SAKjB;gBAJG,KAAI,CAAC,IAAI,GAAG,KAAK,CAAC;gBAClB,KAAI,CAAC,OAAO,GAAG,aAAa,CAAC;gBAC7B,KAAI,CAAC,IAAI,GAAG,UAAU,CAAC;gBACvB,KAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;;YACzB,CAAC;YAEO,wBAAK,GAAb,UAAc,GAAG;gBAAjB,iBA0CC;gBAzCG,IAAI,IAAI,GAAG,IAAI,CAAC;gBAChB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,GAAC,UAAU,CAAC,CAAC;gBAC/D,IAAI,CAAC,YAAY,GAAmB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;gBAC5F,IAAI,UAAU,GAAG,IAAI,CAAC,QAAQ,GAAC,cAAc,CAAC;gBAC9C,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,UAAU,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AQ,aAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;gBAC9C,CAAC,CAAC;gBACF,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,UAAU,GAAG,UAAC,MAAM;oBACvC,iBAAM,QAAQ,aAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;gBAC5C,CAAC,CAAC;gBACF,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,UAAU,GAAG,UAAC,MAAM;oBACxC,iBAAM,QAAQ,aAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;gBAC7C,CAAC,CAAC;gBACF,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,UAAU,GAAG,UAAC,MAAM;oBACvC,iBAAM,QAAQ,aAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;gBAC5C,CAAC,CAAC;YAEN,CAAC;YAEM,wBAAK,GAAZ,UAAa,IAAI;gBACb,iBAAM,KAAK,YAAC,IAAI,CAAC,CAAC;YACtB,CAAC;YAEO,wBAAK,GAAb;gBACI,iBAAM,KAAK,WAAE,CAAC;YAClB,CAAC;YACO,uBAAI,GAAZ;YACA,CAAC;YACO,uBAAI,GAAZ;gBACI,IAAI,CAAC,KAAK,EAAE,CAAC;YACjB,CAAC;YAEL,eAAC;QAAD,CAAC,AAjFD,CAA8B,MAAM,CAAC,WAAW,GAiF/C;QAjFY,gBAAQ,WAiFpB,CAAA;IACL,CAAC,EAnFQ,OAAO,GAAP,SAAO,KAAP,SAAO,QAmFf;AAAD,CAAC,EAnFM,CAAC,KAAD,CAAC,QAmFP"}
\ No newline at end of file
......@@ -52,6 +52,7 @@ module L.Control {
this.cardMap[periodid].addChangeFnListener(this.cardMap[oiltypeid]);
var amountid = self.initials+'amountCard';
self.cardMap[amountid] = new OSAmount(amountid, this.accordionDiv, self.lang, map, self.type, self.initials);
this.cardMap[locationid].addChangeFnListener(this.cardMap[periodid]);
super.setup(map);
var chain = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment