- vs-input-class.ts

- german datetime format for date attributes in coverage class
This commit is contained in:
Arno Kaimbacher 2019-10-23 19:04:54 +02:00
parent 265cfbcd30
commit e3ea9847a3
7 changed files with 66 additions and 20 deletions

View File

@ -8,6 +8,8 @@ class Coverage extends Model
{ {
protected $table = 'coverage'; protected $table = 'coverage';
public $timestamps = true; public $timestamps = true;
protected $dateFormat = 'Y-m-d H:i:s';
// protected $dateFormat = 'd.m.Y H:i:s';
protected $fillable = [ protected $fillable = [
'elevation_min', 'elevation_min',
@ -22,6 +24,35 @@ class Coverage extends Model
'x_min', 'x_max', 'y_min', 'y_max' 'x_min', 'x_max', 'y_min', 'y_max'
]; ];
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = [
'time_min',
'time_max',
'time_absolut',
];
public function setTimeAbsolutAttribute($value)
{
$this->attributes['time_absolut'] = \Illuminate\Support\Carbon::createFromFormat('d.m.Y H:i:s', $value);
}
public function setTimeMinAttribute($value)
{
$this->attributes['time_min'] = \Illuminate\Support\Carbon::createFromFormat('d.m.Y H:i:s', $value);
}
public function setTimeMaxAttribute($value)
{
$this->attributes['time_max'] = \Illuminate\Support\Carbon::createFromFormat('d.m.Y H:i:s', $value);
}
/**
* relationship to dataset
*
*
*/
public function dataset() public function dataset()
{ {
return $this->belongsTo(Dataset::class, 'dataset_id', 'id'); return $this->belongsTo(Dataset::class, 'dataset_id', 'id');

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -383,18 +383,18 @@ const app = new Vue({
// this.loading = false; // this.loading = false;
this.uploadError = error.response; this.uploadError = error.response;
console.log('FAILURE!!'); console.log('FAILURE!!');
let errorObject = JSON.parse(JSON.stringify(error)); // let errorObject = JSON.parse(JSON.stringify(error));
// console.log(errorObject); // console.log(errorObject);
if (errorObject.response.data.errors) { if (error.response && error.response.data.errors) {
var errorsArray = errorObject.response.data.errors; var errorsArray = error.response.data.errors;
for (var index in errorsArray) { for (var index in errorsArray) {
console.log(errorsArray[index]); console.log(errorsArray[index]);
_this.serrors.push(errorsArray[index]); _this.serrors.push(errorsArray[index]);
} }
} }
//fill with server error //fill with server error
if (errorObject.response.data.error) { if (error.response && error.response.data.error) {
var error = errorObject.response.data.error; var error = error.response.data.error;
_this.serrors.push(error.message); _this.serrors.push(error.message);
} }
//raundtrip to server was not possible //raundtrip to server was not possible
@ -403,6 +403,9 @@ const app = new Vue({
var error = 'The file you tried to upload is too large.'; var error = 'The file you tried to upload is too large.';
_this.serrors.push(error); _this.serrors.push(error);
} }
if (error.message && error.message) {
_this.serrors.push( error.message);
}
_this.currentStatus = STATUS_FAILED; _this.currentStatus = STATUS_FAILED;
}); });
}, },

View File

@ -0,0 +1,12 @@
import Vue from "vue";
import { Component, Provide } from "vue-property-decorator";
@Component({})
export default class VsInput extends Vue {
term = "";
search() {
this.$emit("search", this.term);
}
}

View File

@ -31,17 +31,17 @@
</template> </template>
<script lange="ts"> <script lang="ts">
import Vue from "vue"; // import Vue from "vue";
import { Component, Provide } from "vue-property-decorator"; // import { Component, Provide } from "vue-property-decorator";
@Component({}) // @Component({})
export default class VsInput extends Vue { // export default class VsInput extends Vue {
term = ""; // term = "";
bar = "bar"; // search() {
search() { // this.$emit("search", this.term);
//console.log(this.term); // }
this.$emit("search", this.term); // }
} import VsInput from "./vs-input-class";
} export default VsInput;
</script> </script>

View File

@ -1,7 +1,7 @@
// Fonts // Fonts
// @import url("https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,300,700,800"); // @import url("https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,300,700,800");
// npm install npm-font-open-sans --save-dev // npm install npm-font-open-sans --save-dev
@import '../../../node_modules/npm-font-open-sans/open-sans'; @import '../../node_modules/npm-font-open-sans/open-sans';
// Variables // Variables
// @import "variables"; // @import "variables";