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

test

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