204 lines
5.3 KiB
Vue
204 lines
5.3 KiB
Vue
<template>
|
|
<v-layout v-if="this.formReady">
|
|
<v-flex>
|
|
<form ref="form">
|
|
<v-layout align-center justify-left row wrap>
|
|
<v-flex xs12 sm6 lg4 xl3 px-2>
|
|
<v-text-field
|
|
v-model="obj.name"
|
|
:counter="255"
|
|
:label="this.$gzlocale.get('WidgetName')"
|
|
:rules="[this.$gzv.Max255('WidgetName',obj.name)]"
|
|
ref="name"
|
|
></v-text-field>
|
|
</v-flex>
|
|
<v-flex xs12 sm6 lg4 xl3 px-2>
|
|
<v-text-field
|
|
v-model="obj.serial"
|
|
:counter="10"
|
|
:label="this.$gzlocale.get('WidgetSerial')"
|
|
:rules="[this.$gzv.MaxLength('WidgetSerial',obj.serial,10)]"
|
|
ref="serial"
|
|
></v-text-field>
|
|
</v-flex>
|
|
<v-flex xs12 sm6 lg4 xl3 px-2>
|
|
<v-text-field
|
|
v-model="obj.count"
|
|
:counter="10"
|
|
:label="this.$gzlocale.get('WidgetCount')"
|
|
ref="count"
|
|
name="count"
|
|
:rules="[this.$gzv.Required(this,'count')]"
|
|
required
|
|
></v-text-field>
|
|
</v-flex>
|
|
|
|
<v-flex xs12 sm6 lg4 xl3 px-2>
|
|
<v-text-field
|
|
v-model="obj.dollarAmount"
|
|
:prefix="this.$gzlocale.formats.currencySymbol"
|
|
:label="this.$gzlocale.get('WidgetDollarAmount')"
|
|
ref="dollarAmount"
|
|
required
|
|
></v-text-field>
|
|
</v-flex>
|
|
|
|
<v-flex xs12 sm6 lg4 xl3 px-2>
|
|
<gz-date-time-picker
|
|
:label="this.$gzlocale.get('WidgetStartDate')"
|
|
v-model="obj.startDate"
|
|
name="startDate"
|
|
></gz-date-time-picker>
|
|
</v-flex>
|
|
|
|
<v-flex xs12 sm6 lg4 xl3 px-2>
|
|
<gz-date-time-picker
|
|
:label="this.$gzlocale.get('WidgetEndDate')"
|
|
:rules="[this.$gzv.After(obj.startDate,obj.endDate)]"
|
|
v-model="obj.endDate"
|
|
name="endDate"
|
|
></gz-date-time-picker>
|
|
</v-flex>
|
|
<v-flex xs12 sm6 lg4 xl3 px-2>
|
|
<v-checkbox
|
|
v-model="obj.active"
|
|
:label="this.$gzlocale.get('Active')"
|
|
name="checkbox"
|
|
required
|
|
></v-checkbox>
|
|
</v-flex>
|
|
</v-layout>
|
|
|
|
<v-layout align-center justify-space-around row wrap mt-5>
|
|
<v-flex xs1>
|
|
<v-btn>one</v-btn>
|
|
</v-flex>
|
|
<v-flex xs1>
|
|
<v-btn>two</v-btn>
|
|
</v-flex>
|
|
<v-flex xs1>
|
|
<v-btn @click="submit">submit</v-btn>
|
|
</v-flex>
|
|
</v-layout>
|
|
</form>
|
|
</v-flex>
|
|
</v-layout>
|
|
</template>
|
|
|
|
<script>
|
|
/* eslint-disable */
|
|
|
|
export default {
|
|
beforeCreate() {
|
|
//Cache all required lt keys
|
|
var ltKeysRequired = [
|
|
"Widget",
|
|
"WidgetName",
|
|
"WidgetSerial",
|
|
"WidgetDollarAmount",
|
|
"WidgetCount",
|
|
"WidgetRoles",
|
|
"WidgetStartDate",
|
|
"WidgetEndDate",
|
|
"WidgetNotes",
|
|
"WidgetCustom1",
|
|
"WidgetCustom2",
|
|
"WidgetCustom3",
|
|
"WidgetCustom4",
|
|
"WidgetCustom5",
|
|
"WidgetCustom6",
|
|
"WidgetCustom7",
|
|
"WidgetCustom8",
|
|
"WidgetCustom9",
|
|
"WidgetCustom10",
|
|
"WidgetCustom11",
|
|
"WidgetCustom12",
|
|
"WidgetCustom13",
|
|
"WidgetCustom14",
|
|
"WidgetCustom15",
|
|
"WidgetCustom16"
|
|
];
|
|
this.$gzlocale
|
|
.fetch(ltKeysRequired)
|
|
.then(() => (this.formReady = true))
|
|
.catch(err => {
|
|
this.formReady = true;
|
|
this.$gzerror(err);
|
|
});
|
|
},
|
|
created() {
|
|
this.getDataFromApi();
|
|
},
|
|
components: {},
|
|
data() {
|
|
return {
|
|
obj: {},
|
|
formReady: false
|
|
};
|
|
},
|
|
methods: {
|
|
getDataFromApi() {
|
|
var url = "Widget/" + this.$route.params.id;
|
|
this.$gzapi.get(url).then(res => {
|
|
this.obj = res.data;
|
|
});
|
|
},
|
|
submit() {
|
|
// debugger;
|
|
//this.$validator.validateAll();
|
|
this.$refs.form.validate();
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style>
|
|
</style>
|
|
|
|
/*
|
|
Sample widget record api v8
|
|
{
|
|
"data": {
|
|
"id": 100,
|
|
"concurrencyToken": 2675248,
|
|
"ownerId": 1,
|
|
"name": "Fantastic Wooden Chips 122",
|
|
"serial": 100,
|
|
"dollarAmount": 584.83,
|
|
"active": true,
|
|
"roles": 8212,
|
|
"startDate": "2019-02-12T10:12:39.594206",
|
|
"endDate": "2019-02-12T13:40:59.986405",
|
|
"notes": "Eum optio incidunt blanditiis laboriosam. Sed ipsam occaecati minus corrupti repudiandae delectus. Culpa nostrum est ullam assumenda animi ut. Velit sunt ex ipsum. Temporibus cum quaerat at omnis at quas. Commodi dolor molestiae beatae.",
|
|
"count": 0,
|
|
"customFields": null,
|
|
"tags": [
|
|
"brown",
|
|
"red"
|
|
]
|
|
}
|
|
}
|
|
|
|
IN JS FORMAT
|
|
{
|
|
data: {
|
|
id: 100,
|
|
concurrencyToken: 2675248,
|
|
ownerId: 1,
|
|
name: 'Fantastic Wooden Chips 122',
|
|
serial: 100,
|
|
dollarAmount: 584.83,
|
|
active: true,
|
|
roles: 8212,
|
|
startDate: '2019-02-12T10:12:39.594206',
|
|
endDate: '2019-02-12T13:40:59.986405',
|
|
notes: 'Eum optio incidunt blanditiis laboriosam. Sed ipsam occaecati minus corrupti repudiandae delectus. Culpa nostrum est ullam assumenda animi ut. Velit sunt ex ipsum. Temporibus cum quaerat at omnis at quas. Commodi dolor molestiae beatae.',
|
|
count: 0,
|
|
customFields: null,
|
|
tags: [
|
|
'brown',
|
|
'red'
|
|
]
|
|
}
|
|
}
|
|
*/ |