2019-04-08 16:31:40 +00:00
|
|
|
// releaseDataset.js
|
|
|
|
import Vue from 'vue';
|
|
|
|
import VeeValidate from 'vee-validate';
|
|
|
|
Vue.use(VeeValidate);
|
|
|
|
|
|
|
|
|
|
|
|
const app = new Vue({
|
|
|
|
el: '#app1',
|
|
|
|
data() {
|
|
|
|
return {
|
2019-05-22 12:02:16 +00:00
|
|
|
// dataset: {
|
|
|
|
// firstName: '',
|
|
|
|
// preferred_reviewer: null,
|
|
|
|
// preferred_reviewer_email: null
|
|
|
|
// },
|
|
|
|
dataset: window.Laravel.dataset,
|
2019-05-21 16:28:18 +00:00
|
|
|
submitted: false,
|
2019-05-22 12:02:16 +00:00
|
|
|
preferation: "yes_preferation",
|
2019-04-08 16:31:40 +00:00
|
|
|
}
|
|
|
|
},
|
2019-05-21 16:28:18 +00:00
|
|
|
computed: {
|
|
|
|
isPreferationRequired() {
|
|
|
|
return this.preferation === "yes_preferation";
|
|
|
|
},
|
|
|
|
},
|
2019-05-22 12:02:16 +00:00
|
|
|
watch: {
|
|
|
|
preferation(val) {
|
|
|
|
if (val === "no_preferation") {
|
|
|
|
this.dataset.preferred_reviewer = "";
|
|
|
|
this.dataset.preferred_reviewer_email = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-04-08 16:31:40 +00:00
|
|
|
methods: {
|
|
|
|
checkForm(e) {
|
|
|
|
// Log entire model to console
|
|
|
|
// console.log(this.dataset);
|
|
|
|
this.submitted = true;
|
|
|
|
this.$validator.validate().then(result => {
|
|
|
|
if (result) {
|
2019-05-22 12:02:16 +00:00
|
|
|
if (this.preferation === "no_preferation") {
|
|
|
|
this.dataset.preferred_reviewer = "";
|
|
|
|
this.dataset.preferred_reviewer_email = "";
|
|
|
|
}
|
|
|
|
// console.log('From Submitted!');
|
2019-04-08 16:31:40 +00:00
|
|
|
document.getElementById("releaseForm").submit();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|