Commit 49309ac6 authored by Tomas Pettersson's avatar Tomas Pettersson 🏸
Browse files

test

parent e4dd73d7
...@@ -152,9 +152,6 @@ var STWkit; ...@@ -152,9 +152,6 @@ var STWkit;
self.polygonButton.disabled = false; self.polygonButton.disabled = false;
self.hasPosition = false; self.hasPosition = false;
function validate() { function validate() {
var date = moment.utc(self.obsDateInput.value + ' ' + self.obsTimeInput.value, self.datetimeFormat);
if (!date.isValid())
return;
if (!self.hasPosition) if (!self.hasPosition)
return; return;
self.status = true; self.status = true;
...@@ -316,8 +313,6 @@ var STWkit; ...@@ -316,8 +313,6 @@ var STWkit;
(self.oncallback && self.oncallback(true)); (self.oncallback && self.oncallback(true));
}; };
UIkit.ready(function () { UIkit.ready(function () {
var startDatePicker = UIkit.datepicker(self.obsDateInput, { format: self.dateFormat });
var startTimePicker = UIkit.timepicker(self.obsTimeInput, {});
self.defaults(); self.defaults();
}); });
return _this; return _this;
...@@ -332,18 +327,10 @@ var STWkit; ...@@ -332,18 +327,10 @@ var STWkit;
var self = this; var self = this;
if (document.body.contains(self.pointButton)) if (document.body.contains(self.pointButton))
self.pointButton.click(); self.pointButton.click();
var initDate = moment.utc();
self.obsDateInput.value = initDate.format(self.dateFormat);
self.obsTimeInput.value = initDate.startOf('hour').format(self.timeFormat);
}; };
LocationCard.prototype.populateCard = function (geojson) { LocationCard.prototype.populateCard = function (geojson) {
var self = this; var self = this;
var simulation = geojson.features[0].properties.simulation; var simulation = geojson.features[0].properties.simulation;
var observation = geojson.features[0].properties.observation[0];
var date = moment.utc(observation.date).format(self.dateFormat);
self.obsDateInput.value = date;
var time = moment.utc(observation.date).format(self.timeFormat);
self.obsTimeInput.value = time;
var type = geojson.features[0].geometry.type.toLowerCase(); var type = geojson.features[0].geometry.type.toLowerCase();
switch (type) { switch (type) {
case "point": case "point":
...@@ -368,17 +355,6 @@ var STWkit; ...@@ -368,17 +355,6 @@ var STWkit;
json.features[i]["properties"] = {}; json.features[i]["properties"] = {};
geojson.features.push(json.features[i]); geojson.features.push(json.features[i]);
} }
var observation = {
"id": null,
"provider": "USER",
"providerDataRef": null,
"providerImgRef": null,
"providerType": null,
"type": "MANUAL",
"date": moment.utc(self.obsDateInput.value + ' ' + self.obsTimeInput.value, self.datetimeFormat).valueOf()
};
geojson.features[0].properties["observation"] = [];
geojson.features[0].properties["observation"].push(observation);
geojson.features[0].properties["simulation"] = {}; geojson.features[0].properties["simulation"] = {};
}; };
LocationCard.prototype.clear = function () { LocationCard.prototype.clear = function () {
...@@ -394,9 +370,6 @@ var STWkit; ...@@ -394,9 +370,6 @@ var STWkit;
} }
if (self.forcingBoundary) if (self.forcingBoundary)
self.forcingBoundary.hide(); self.forcingBoundary.hide();
var initDate = moment.utc();
self.obsDateInput.value = initDate.format(self.dateFormat);
self.obsTimeInput.value = initDate.startOf('hour').format(self.timeFormat);
self.control.clear(); self.control.clear();
self.control.hideTable(); self.control.hideTable();
if (self.nextButton) if (self.nextButton)
......
This diff is collapsed.
...@@ -99,8 +99,6 @@ module STWkit { ...@@ -99,8 +99,6 @@ module STWkit {
public pointButton: HTMLButtonElement; public pointButton: HTMLButtonElement;
public lineButton: HTMLButtonElement; public lineButton: HTMLButtonElement;
public exitControl: L.Control; public exitControl: L.Control;
public obsDateInput: HTMLInputElement;
public obsTimeInput: HTMLInputElement;
public dateFormat: string; public dateFormat: string;
public timeFormat: string; public timeFormat: string;
public datetimeFormat: string; public datetimeFormat: string;
...@@ -185,8 +183,6 @@ module STWkit { ...@@ -185,8 +183,6 @@ module STWkit {
self.hasPosition = false; self.hasPosition = false;
function validate() { function validate() {
var date = moment.utc(self.obsDateInput.value + ' ' + self.obsTimeInput.value, self.datetimeFormat);
if (!date.isValid()) return;
if (!self.hasPosition) return; if (!self.hasPosition) return;
self.status = true; self.status = true;
AccordionCard.enableNext(self.nextButton, true); AccordionCard.enableNext(self.nextButton, true);
...@@ -350,10 +346,7 @@ module STWkit { ...@@ -350,10 +346,7 @@ module STWkit {
if (self.forcingBoundary) self.forcingBoundary.hide(); if (self.forcingBoundary) self.forcingBoundary.hide();
(self.oncallback && self.oncallback(true)); (self.oncallback && self.oncallback(true));
}; };
UIkit.ready(function () { UIkit.ready(function () {
var startDatePicker = UIkit.datepicker(<any>self.obsDateInput, { format: self.dateFormat });
var startTimePicker = UIkit.timepicker(<any>self.obsTimeInput, {});
self.defaults(); self.defaults();
}); });
...@@ -371,19 +364,11 @@ module STWkit { ...@@ -371,19 +364,11 @@ module STWkit {
public defaults() { public defaults() {
var self = this; var self = this;
if (document.body.contains(self.pointButton)) self.pointButton.click(); if (document.body.contains(self.pointButton)) self.pointButton.click();
var initDate = moment.utc();
self.obsDateInput.value = initDate.format(self.dateFormat);
self.obsTimeInput.value = initDate.startOf('hour').format(self.timeFormat);
} }
public populateCard(geojson) { public populateCard(geojson) {
var self = this; var self = this;
var simulation = geojson.features[0].properties.simulation; var simulation = geojson.features[0].properties.simulation;
var observation = geojson.features[0].properties.observation[0];
var date = moment.utc(observation.date).format(self.dateFormat);
self.obsDateInput.value = date;
var time = moment.utc(observation.date).format(self.timeFormat);
self.obsTimeInput.value = time;
var type = geojson.features[0].geometry.type.toLowerCase(); var type = geojson.features[0].geometry.type.toLowerCase();
switch (type) { switch (type) {
case "point": case "point":
...@@ -410,18 +395,6 @@ module STWkit { ...@@ -410,18 +395,6 @@ module STWkit {
geojson.features.push(json.features[i]); geojson.features.push(json.features[i]);
} }
var observation = {
"id": null,
"provider": "USER",
"providerDataRef": null,
"providerImgRef": null,
"providerType": null,
"type": "MANUAL",
"date": moment.utc(self.obsDateInput.value + ' ' + self.obsTimeInput.value, self.datetimeFormat).valueOf()
};
geojson.features[0].properties["observation"] = [];
geojson.features[0].properties["observation"].push(observation);
geojson.features[0].properties["simulation"] = {}; geojson.features[0].properties["simulation"] = {};
} }
...@@ -438,9 +411,6 @@ module STWkit { ...@@ -438,9 +411,6 @@ module STWkit {
} }
} }
if (self.forcingBoundary) self.forcingBoundary.hide(); if (self.forcingBoundary) self.forcingBoundary.hide();
var initDate = moment.utc();
self.obsDateInput.value = initDate.format(self.dateFormat);
self.obsTimeInput.value = initDate.startOf('hour').format(self.timeFormat);
self.control.clear(); self.control.clear();
self.control.hideTable(); self.control.hideTable();
if (self.nextButton) AccordionCard.enableNext(self.nextButton, false); if (self.nextButton) AccordionCard.enableNext(self.nextButton, false);
......
Supports Markdown
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