This commit is contained in:
2019-03-04 19:03:04 +00:00
parent 168e51dacc
commit 175a442a3e
5 changed files with 60 additions and 89 deletions

View File

@@ -14,9 +14,7 @@ TODO CLIENT STUFF
TODO NEXT
DATETIME - Ok, fuck a combined date and time, no one else seems to support it but me so split it into separate components:
DATETIME
- DONE Wrap the date picker to work with our dates without losing time.
- Wrap a time picker to work with our dates without losing the date.
- Once this is done then combine them into a single component that:

View File

@@ -181,8 +181,7 @@ export default {
var errorMessage =
"API error: GET route =" + route + ", message =" + error.message;
store.commit("logItem", errorMessage);
alert("Error: " + errorMessage);
reject(error);
if (error.message && error.message.includes("401")) {
store.commit(
"logItem",
@@ -190,6 +189,9 @@ export default {
);
auth.logout();
router.push("/login");
} else {
alert("Error: " + errorMessage);
reject(error);
}
});
});

View File

@@ -0,0 +1,44 @@
<script>
//////////////////////////////////////////
// GZTimePicker
// This component was created to wrap the
// vuetify time picker to allow using string date
// and time in iso format and not lose the date
// portion when picking a new time
//2019-02-12T10:12:39.594206
/* eslint-disable */
export default {
props: {
value: {
type: String,
default: ""
}
},
render() {
var that = this;
return this.$createElement("v-time-picker", {
props: {
...this.$attrs,
value: this.value ? this.value.substr(11,8) : null
},
on: {
...this.$listeners,
input: function(time) {
// debugger;
//Put back the time portion from before
var combined = that.value.substr(0, 9) + time;
that.$emit("input", new Date(combined).toISOString());
},
"click:minute": function(time) {
// debugger;
//Put back the time portion from before
var combined = that.value.substr(0, 9) + time;
that.$emit("input", new Date(combined).toISOString());
}
}
});
}
};
</script>

View File

@@ -12,6 +12,7 @@ import NProgress from "nprogress";
import "nprogress/nprogress.css";
import dayjs from "dayjs";
import gzdatepicker from "./components/gzdatepicker.vue";
import gztimepicker from "./components/gztimepicker.vue";
/////////////////////////////////////////////////////////////////
// FORM VALIDATION
@@ -102,51 +103,11 @@ Vue.filter("boolastext", function(value) {
return value ? "Yes" : "Nope";
});
//COMPONENT DATE TEST
/////////////////////////////////////////////////////////////
//GZ COMPONENTS
//
Vue.component("gz-date-picker", gzdatepicker);
// Vue.component("GzDatePicker", {
// props: {
// value: Date
// },
// render() {
// return this.$createElement("v-date-picker", {
// props: {
// ...this.$attrs,
// value: this.value ? this.value.toISOString().substr(0, 10) : null
// },
// on: {
// ...this.$listeners,
// input: date => this.$emit("input", new Date(date))
// }
// });
// }
// });
// Vue.component("AltGzDatePicker", {
// props: {
// value: String
// },
// data: function() {
// return {
// ogdate: ""
// };
// },
// render() {
// return this.$createElement("v-date-picker", {
// props: {
// ...this.$attrs,
// value: this.value ? this.value.substr(0, 10) : null
// },
// on: {
// ...this.$listeners,
// input: date => this.$emit("input", new Date(date).toISOString())
// }
// });
// }
// });
Vue.component("gz-time-picker", gztimepicker);
/////////////////////////////////////////////////////////////////
// INSTANTIATE

View File

@@ -54,42 +54,11 @@
<gz-date-picker label="TESTStartDate" v-model="obj.startDate"></gz-date-picker>
</v-flex>
<!-- <v-flex xs12 sm6 lg4 xl3 px-2>
<v-menu
v-model="menu2"
:close-on-content-click="false"
:nudge-right="40"
lazy
transition="scale-transition"
offset-y
full-width
min-width="290px"
>
<v-text-field
slot="activator"
:value="dateFormatted"
:label="lc.get('WidgetStartDate')"
readonly
></v-text-field>
<v-date-picker v-model="pickStartDate" @input="menu2 = false"></v-date-picker>
</v-menu>
</v-flex>-->
<!--
<v-flex xs12 sm6 lg4 xl3 px-2>
<v-text-field slot="activator" v-model="obj.startDate" label="MyPicker" readonly></v-text-field>
<v-date-picker v-model="obj.startDate" @input="menu2 = false"></v-date-picker>
</v-flex>-->
<!-- <v-flex xs12 sm6 lg4 xl3 px-2>
<v-date-picker
v-model="obj.startDate"
:label="lc.get('WidgetStartDate')"
v-validate="'required'"
:error-messages="errors.collect('startDate')"
data-vv-name="startDate"
landscape="true"
reactive="true"
></v-date-picker>
</v-flex>-->
<div>{{obj.startDate}}</div>
<gz-time-picker label="TESTStartTime" v-model="obj.startDate"></gz-time-picker>
</v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2>
<v-checkbox
v-model="obj.active"
@@ -113,9 +82,8 @@
<v-btn @click="submit">submit</v-btn>
</v-flex>
</v-layout>
</form>
</form>
</v-flex>
</v-layout>
</template>
@@ -172,10 +140,8 @@ export default {
//return this.obj.startDate ? moment(this.date).format("dddd, MMMM Do YYYY") : "";
},
pickStartDate() {
return this.obj.startDate
? dayjs(this.obj.startDate).toDate()
: null;
// var copiedDate = new Date(date.getTime());
return this.obj.startDate ? dayjs(this.obj.startDate).toDate() : null;
// var copiedDate = new Date(date.getTime());
//obj.startDate.toISOString().substr(0, 10);
}
},