Edit Test Result

This commit is contained in:
saeid
2019-04-29 12:08:53 +04:30
parent f9600be080
commit c6f352c711
7 changed files with 267 additions and 165 deletions
+90 -42
View File
@@ -154,9 +154,6 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
// //
// //
// //
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({ /* harmony default export */ __webpack_exports__["default"] = ({
@@ -165,14 +162,14 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
result: ["Accept", "Reject"], result: ["Accept", "Reject"],
testTypeNames: [], testTypeNames: [],
searchInput: "", searchInput: "",
form: { form: [],
autoclave_id: "",
result: "",
data: []
},
filter: { filter: {
name: "", name: "",
unique_code: "" unique_code: ""
},
formData: {
autoclave_id: "",
result: ""
} }
}; };
}, },
@@ -214,7 +211,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
var _selectTestType = _asyncToGenerator( var _selectTestType = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() { _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2() {
var result; var result, key, keyForm;
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) {
while (1) { while (1) {
switch (_context2.prev = _context2.next) { switch (_context2.prev = _context2.next) {
@@ -226,7 +223,21 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
result = _context2.sent; result = _context2.sent;
if (result && result.status == 200) { if (result && result.status == 200) {
this.form.data = result.data.data; this.form = result.data.data;
for (key in result.data.data) {
if (result.data.data.hasOwnProperty(key)) {
if (result.data.data[key].type !== 'Form') {
this.formData[result.data.data[key].name] = '';
} else {
for (keyForm in result.data.data[key].children) {
if (result.data.data[key].children.hasOwnProperty(keyForm)) {
this.formData[result.data.data[key].children[keyForm].name] = '';
}
}
}
}
}
} }
case 4: case 4:
@@ -242,6 +253,41 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
} }
return selectTestType; return selectTestType;
}(),
submitForm: function () {
var _submitForm = _asyncToGenerator(
/*#__PURE__*/
_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3() {
var result;
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return _services__WEBPACK_IMPORTED_MODULE_1__["ApiService"].post(_config_urls__WEBPACK_IMPORTED_MODULE_2__["urls"].storeTestResult, this.formData);
case 2:
result = _context3.sent;
if (result && result.status == 200) {
this.$router.push({
name: 'Dashboard'
});
}
case 4:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
function submitForm() {
return _submitForm.apply(this, arguments);
}
return submitForm;
}() }()
} }
}); });
@@ -399,11 +445,11 @@ var render = function() {
color: "black" color: "black"
}, },
model: { model: {
value: _vm.form.autoclave_id, value: _vm.formData.autoclave_id,
callback: function($$v) { callback: function($$v) {
_vm.$set(_vm.form, "autoclave_id", $$v) _vm.$set(_vm.formData, "autoclave_id", $$v)
}, },
expression: "form.autoclave_id" expression: "formData.autoclave_id"
} }
}) })
], ],
@@ -422,39 +468,37 @@ var render = function() {
color: "black" color: "black"
}, },
model: { model: {
value: _vm.form.result, value: _vm.formData.result,
callback: function($$v) { callback: function($$v) {
_vm.$set(_vm.form, "result", $$v) _vm.$set(_vm.formData, "result", $$v)
}, },
expression: "form.result" expression: "formData.result"
} }
}) })
], ],
1 1
), ),
_vm._v(" "), _vm._v(" "),
_vm._l(_vm.form.data, function(item, key) { _vm._l(_vm.form, function(item, key) {
return _c( return _c(
"v-flex", "v-flex",
{ key: key }, { key: key, class: ["pa-2", item.size] },
[ [
item.type == "Text" item.type == "Text"
? _c("v-text-field", { ? _c("v-text-field", {
staticClass: "pa-2",
attrs: { label: item.name, color: "black" }, attrs: { label: item.name, color: "black" },
model: { model: {
value: item[item.name], value: _vm.formData[item.name],
callback: function($$v) { callback: function($$v) {
_vm.$set(item, item.name, $$v) _vm.$set(_vm.formData, item.name, $$v)
}, },
expression: "item[item.name]" expression: "formData[item.name]"
} }
}) })
: _vm._e(), : _vm._e(),
_vm._v(" "), _vm._v(" "),
item.type == "Select" item.type == "Select"
? _c("v-select", { ? _c("v-select", {
staticClass: "pa-2",
attrs: { attrs: {
items: item.options, items: item.options,
label: item.name, label: item.name,
@@ -462,11 +506,11 @@ var render = function() {
"item-text": "title" "item-text": "title"
}, },
model: { model: {
value: item[item.name], value: _vm.formData[item.name],
callback: function($$v) { callback: function($$v) {
_vm.$set(item, item.name, $$v) _vm.$set(_vm.formData, item.name, $$v)
}, },
expression: "item[item.name]" expression: "formData[item.name]"
} }
}) })
: _vm._e(), : _vm._e(),
@@ -489,11 +533,11 @@ var render = function() {
value: optionValue.title value: optionValue.title
}, },
model: { model: {
value: item[item.name], value: _vm.formData[item.name],
callback: function($$v) { callback: function($$v) {
_vm.$set(item, item.name, $$v) _vm.$set(_vm.formData, item.name, $$v)
}, },
expression: "item[item.name]" expression: "formData[item.name]"
} }
}) })
}) })
@@ -516,33 +560,35 @@ var render = function() {
) { ) {
return _c( return _c(
"v-flex", "v-flex",
{ key: keyChildren }, {
key: keyChildren,
class: ["pa-2", children.size]
},
[ [
children.type == "Text" children.type == "Text"
? _c("v-text-field", { ? _c("v-text-field", {
staticClass: "pa-2",
attrs: { attrs: {
label: children.name, label: children.name,
color: "black" color: "black"
}, },
model: { model: {
value: children[children.name], value:
_vm.formData[children.name],
callback: function($$v) { callback: function($$v) {
_vm.$set( _vm.$set(
children, _vm.formData,
children.name, children.name,
$$v $$v
) )
}, },
expression: expression:
"children[children.name]" "formData[children.name]"
} }
}) })
: _vm._e(), : _vm._e(),
_vm._v(" "), _vm._v(" "),
children.type == "Select" children.type == "Select"
? _c("v-select", { ? _c("v-select", {
staticClass: "pa-2",
attrs: { attrs: {
items: children.options, items: children.options,
label: children.name, label: children.name,
@@ -550,16 +596,17 @@ var render = function() {
"item-text": "title" "item-text": "title"
}, },
model: { model: {
value: children[children.name], value:
_vm.formData[children.name],
callback: function($$v) { callback: function($$v) {
_vm.$set( _vm.$set(
children, _vm.formData,
children.name, children.name,
$$v $$v
) )
}, },
expression: expression:
"children[children.name]" "formData[children.name]"
} }
}) })
: _vm._e(), : _vm._e(),
@@ -588,20 +635,20 @@ var render = function() {
}, },
model: { model: {
value: value:
children[ _vm.formData[
children.name children.name
], ],
callback: function( callback: function(
$$v $$v
) { ) {
_vm.$set( _vm.$set(
children, _vm.formData,
children.name, children.name,
$$v $$v
) )
}, },
expression: expression:
"children[children.name]" "formData[children.name]"
} }
}) })
} }
@@ -645,7 +692,8 @@ var render = function() {
"v-btn", "v-btn",
{ {
staticClass: "WM-CyanBlueGradient-BG", staticClass: "WM-CyanBlueGradient-BG",
staticStyle: { padding: "10px 60px" } staticStyle: { padding: "10px 60px" },
on: { click: _vm.submitForm }
}, },
[ [
_c( _c(
Vendored
+121 -90
View File
@@ -292,6 +292,10 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
// //
// //
// //
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({ /* harmony default export */ __webpack_exports__["default"] = ({
@@ -325,22 +329,25 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
abbr: "" abbr: ""
}, { }, {
state: "2 as 12", state: "2 as 12",
abbr: "col-md-2" abbr: "md2 xs12"
}, { }, {
state: "3 as 12", state: "3 as 12",
abbr: "col-md-3" abbr: "md3 xs12"
}, { }, {
state: "4 as 12", state: "4 as 12",
abbr: "col-md-4" abbr: "md4 xs12"
}, { }, {
state: "6 as 12", state: "6 as 12",
abbr: "col-md-6" abbr: "md6 xs12"
}, { }, {
state: "8 as 12", state: "8 as 12",
abbr: "col-md-8" abbr: "md8 xs12"
}, { }, {
state: "10 as 12", state: "10 as 12",
abbr: "col-md-10" abbr: "md10 xs12"
}, {
state: "10 as 12",
abbr: "md12 xs12"
}], }],
rules: { rules: {
required: function required(value) { required: function required(value) {
@@ -715,29 +722,39 @@ var render = function() {
"v-flex", "v-flex",
{ attrs: { xs12: "", md3: "", sm3: "" } }, { attrs: { xs12: "", md3: "", sm3: "" } },
[ [
_c("v-select", { _c(
staticClass: "pa-2", "v-select",
attrs: { _vm._b(
items: _vm.type, {
"item-text": "state", staticClass: "pa-2",
"item-value": "abbr", attrs: {
label: "Type", items: _vm.type,
"single-line": "", "item-text": "state",
color: "black" "item-value": "abbr",
}, label: "Type",
on: { "single-line": "",
change: function($event) { color: "black"
return _vm.changeType(keyForm, info.type) },
} on: {
}, change: function($event) {
model: { return _vm.changeType(keyForm, info.type)
value: info.type, }
callback: function($$v) { },
_vm.$set(info, "type", $$v) model: {
value: info.type,
callback: function($$v) {
_vm.$set(info, "type", $$v)
},
expression: "info.type"
}
}, },
expression: "info.type" "v-select",
} info.id !== 0
}) ? { disabled: true }
: { disabled: false },
false
)
)
], ],
1 1
), ),
@@ -746,24 +763,26 @@ var render = function() {
"v-flex", "v-flex",
{ attrs: { xs12: "", md3: "", sm3: "" } }, { attrs: { xs12: "", md3: "", sm3: "" } },
[ [
_c("v-select", { info.type !== "Form"
staticClass: "pa-2", ? _c("v-select", {
attrs: { staticClass: "pa-2",
items: _vm.size, attrs: {
"item-text": "state", items: _vm.size,
"item-value": "abbr", "item-text": "state",
label: "Type", "item-value": "abbr",
"single-line": "", label: "Size",
color: "black" "single-line": "",
}, color: "black"
model: { },
value: info.size, model: {
callback: function($$v) { value: info.size,
_vm.$set(info, "size", $$v) callback: function($$v) {
}, _vm.$set(info, "size", $$v)
expression: "info.size" },
} expression: "info.size"
}) }
})
: _vm._e()
], ],
1 1
) )
@@ -944,33 +963,43 @@ var render = function() {
"v-flex", "v-flex",
{ attrs: { xs12: "", md3: "", sm3: "" } }, { attrs: { xs12: "", md3: "", sm3: "" } },
[ [
_c("v-select", { _c(
staticClass: "pa-2", "v-select",
attrs: { _vm._b(
items: _vm.type, {
"item-text": "state", staticClass: "pa-2",
"item-value": "abbr", attrs: {
label: "Type", items: _vm.type,
"single-line": "", "item-text": "state",
color: "black" "item-value": "abbr",
}, label: "Type",
on: { "single-line": "",
change: function($event) { color: "black"
return _vm.changeTypeForm( },
keyForm, on: {
children.type, change: function($event) {
keychildren return _vm.changeTypeForm(
) keyForm,
} children.type,
}, keychildren
model: { )
value: children.type, }
callback: function($$v) { },
_vm.$set(children, "type", $$v) model: {
value: children.type,
callback: function($$v) {
_vm.$set(children, "type", $$v)
},
expression: "children.type"
}
}, },
expression: "children.type" "v-select",
} children.id !== 0
}) ? { disabled: true }
: { disabled: false },
false
)
)
], ],
1 1
), ),
@@ -979,24 +1008,26 @@ var render = function() {
"v-flex", "v-flex",
{ attrs: { xs12: "", md3: "", sm3: "" } }, { attrs: { xs12: "", md3: "", sm3: "" } },
[ [
_c("v-select", { children.type !== "Form"
staticClass: "pa-2", ? _c("v-select", {
attrs: { staticClass: "pa-2",
items: _vm.size, attrs: {
"item-text": "state", items: _vm.size,
"item-value": "abbr", "item-text": "state",
label: "Type", "item-value": "abbr",
"single-line": "", label: "Size",
color: "black" "single-line": "",
}, color: "black"
model: { },
value: children.size, model: {
callback: function($$v) { value: children.size,
_vm.$set(children, "size", $$v) callback: function($$v) {
}, _vm.$set(children, "size", $$v)
expression: "children.size" },
} expression: "children.size"
}) }
})
: _vm._e()
], ],
1 1
), ),
+1 -1
View File
@@ -1,3 +1,3 @@
{ {
"/vue/js/app.js": "/vue/js/app.js?id=6aabbd513155cd4020b5" "/vue/js/app.js": "/vue/js/app.js?id=705b759be318dc6a6352"
} }
+1
View File
@@ -61843,6 +61843,7 @@ var urls = {
login: "/login", login: "/login",
logout: "/logout", logout: "/logout",
storeMedicalCenter: "/MedicalCenters", storeMedicalCenter: "/MedicalCenters",
storeTestResult: "/TestResults",
listTestTypeName: "/TestTypes/ListNames", listTestTypeName: "/TestTypes/ListNames",
getInputs: "/GetInputs", getInputs: "/GetInputs",
listOpertor: "/Users", listOpertor: "/Users",
+1
View File
@@ -5,6 +5,7 @@ const urls = {
login : "/login", login : "/login",
logout : "/logout", logout : "/logout",
storeMedicalCenter : "/MedicalCenters", storeMedicalCenter : "/MedicalCenters",
storeTestResult : "/TestResults",
listTestTypeName : "/TestTypes/ListNames", listTestTypeName : "/TestTypes/ListNames",
getInputs : `/GetInputs`, getInputs : `/GetInputs`,
listOpertor : "/Users", listOpertor : "/Users",
+39 -23
View File
@@ -40,7 +40,7 @@
<v-flex xs12 sm4 md3> <v-flex xs12 sm4 md3>
<v-text-field <v-text-field
name="autoclave" name="autoclave"
v-model="form.autoclave_id" v-model="formData.autoclave_id"
label="ID AutoClave" label="ID AutoClave"
color="black" color="black"
class="pa-2" class="pa-2"
@@ -49,57 +49,54 @@
<v-flex xs12 sm4 md3> <v-flex xs12 sm4 md3>
<v-select <v-select
:items="result" :items="result"
v-model="form.result" v-model="formData.result"
label="Resualt" label="Resualt"
color="black" color="black"
class="pa-2" class="pa-2"
></v-select> ></v-select>
</v-flex> </v-flex>
<v-flex v-for="(item, key) in form.data" :key="key"> <v-flex :class="['pa-2', item.size]" v-for="(item, key) in form" :key="key">
<v-text-field <v-text-field
v-if="item.type == 'Text'" v-if="item.type == 'Text'"
v-model="item[item.name]" v-model="formData[item.name]"
:label="item.name" :label="item.name"
color="black" color="black"
class="pa-2"
></v-text-field> ></v-text-field>
<v-select <v-select
v-if="item.type == 'Select'" v-if="item.type == 'Select'"
:items="item.options" :items="item.options"
v-model="item[item.name]" v-model="formData[item.name]"
:label="item.name" :label="item.name"
color="black" color="black"
class="pa-2"
item-text="title" item-text="title"
></v-select> ></v-select>
<v-container fluid v-if="item.type == 'Checkbox'"> <v-container fluid v-if="item.type == 'Checkbox'" >
<p>{{ item.name }}</p> <p>{{ item.name }}</p>
<v-checkbox <v-checkbox
v-for="(optionValue, keyOption) in item.options" v-for="(optionValue, keyOption) in item.options"
:key="keyOption" :key="keyOption"
:label="optionValue.title" :label="optionValue.title"
v-model="item[item.name]" v-model="formData[item.name]"
:value="optionValue.title" :value="optionValue.title"
></v-checkbox> ></v-checkbox>
</v-container> </v-container>
<template v-if="item.type == 'Form'"> <template v-if="item.type == 'Form'">
<v-layout row wrap> <v-layout row wrap>
<h3>{{ item.name }}</h3> <h3>{{ item.name }}</h3>
<v-flex v-for="(children, keyChildren) in item.children" :key="keyChildren"> <v-flex :class="['pa-2', children.size]" v-for="(children, keyChildren) in item.children" :key="keyChildren">
<v-text-field <v-text-field
v-if="children.type == 'Text'" v-if="children.type == 'Text'"
v-model="children[children.name]" v-model="formData[children.name]"
:label="children.name" :label="children.name"
color="black" color="black"
class="pa-2"
></v-text-field> ></v-text-field>
<v-select <v-select
v-if="children.type == 'Select'" v-if="children.type == 'Select'"
:items="children.options" :items="children.options"
v-model="children[children.name]" v-model="formData[children.name]"
:label="children.name" :label="children.name"
color="black" color="black"
class="pa-2"
item-text="title" item-text="title"
></v-select> ></v-select>
<v-container fluid v-if="children.type == 'Checkbox'"> <v-container fluid v-if="children.type == 'Checkbox'">
@@ -108,7 +105,7 @@
v-for="(optionValue, keyOption) in children.options" v-for="(optionValue, keyOption) in children.options"
:key="keyOption" :key="keyOption"
:label="optionValue.title" :label="optionValue.title"
v-model="children[children.name]" v-model="formData[children.name]"
:value="optionValue.title" :value="optionValue.title"
></v-checkbox> ></v-checkbox>
</v-container> </v-container>
@@ -121,7 +118,7 @@
<v-divider></v-divider> <v-divider></v-divider>
</v-layout> </v-layout>
<v-layout align-center justify-center wrap class="px-5 mt-2"> <v-layout align-center justify-center wrap class="px-5 mt-2">
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px"> <v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px" @click="submitForm">
<v-icon class="white--text mr-2 caption">fas fa-check</v-icon> <v-icon class="white--text mr-2 caption">fas fa-check</v-icon>
<span class="white--text">SAVE</span> <span class="white--text">SAVE</span>
</v-btn> </v-btn>
@@ -144,14 +141,14 @@ export default {
result: ["Accept", "Reject"], result: ["Accept", "Reject"],
testTypeNames: [], testTypeNames: [],
searchInput: "", searchInput: "",
form: { form: [],
autoclave_id: "",
result: "",
data: []
},
filter: { filter: {
name: "", name: "",
unique_code: "" unique_code: ""
},
formData : {
autoclave_id: "",
result: "",
} }
}), }),
created() { created() {
@@ -165,9 +162,28 @@ export default {
async selectTestType() { async selectTestType() {
const result = await ApiService.post(urls.getInputs, this.filter); const result = await ApiService.post(urls.getInputs, this.filter);
if (result && result.status == 200) { if (result && result.status == 200) {
this.form.data = result.data.data; this.form = result.data.data;
for (const key in result.data.data) {
if (result.data.data.hasOwnProperty(key)) {
if(result.data.data[key].type !== 'Form') {
this.formData[result.data.data[key].name] = '';
} else {
for (const keyForm in result.data.data[key].children) {
if (result.data.data[key].children.hasOwnProperty(keyForm)) {
this.formData[result.data.data[key].children[keyForm].name] = '';
}
}
}
}
}
} }
} },
async submitForm() {
const result = await ApiService.post(urls.storeTestResult, this.formData);
if (result && result.status == 200) {
this.$router.push({name: 'Dashboard'})
}
},
} }
}; };
</script> </script>
+14 -9
View File
@@ -48,6 +48,7 @@
item-text="state" item-text="state"
item-value="abbr" item-value="abbr"
label="Type" label="Type"
v-bind="info.id !== 0 ? {disabled: true} : {disabled: false}"
v-model="info.type" v-model="info.type"
single-line single-line
color="black" color="black"
@@ -61,8 +62,9 @@
:items="size" :items="size"
item-text="state" item-text="state"
item-value="abbr" item-value="abbr"
label="Type" label="Size"
v-model="info.size" v-model="info.size"
v-if="info.type !== 'Form'"
single-line single-line
color="black" color="black"
class="pa-2" class="pa-2"
@@ -150,6 +152,7 @@
item-value="abbr" item-value="abbr"
label="Type" label="Type"
v-model="children.type" v-model="children.type"
v-bind="children.id !== 0 ? {disabled: true} : {disabled: false}"
single-line single-line
color="black" color="black"
class="pa-2" class="pa-2"
@@ -161,7 +164,8 @@
:items="size" :items="size"
item-text="state" item-text="state"
item-value="abbr" item-value="abbr"
label="Type" label="Size"
v-if="children.type !== 'Form'"
v-model="children.size" v-model="children.size"
single-line single-line
color="black" color="black"
@@ -297,16 +301,17 @@ export default {
], ],
size: [ size: [
{ state: "not Selected", abbr: "" }, { state: "not Selected", abbr: "" },
{ state: "2 as 12", abbr: "col-md-2" }, { state: "2 as 12", abbr: "md2 xs12" },
{ state: "3 as 12", abbr: "col-md-3" }, { state: "3 as 12", abbr: "md3 xs12" },
{ state: "4 as 12", abbr: "col-md-4" }, { state: "4 as 12", abbr: "md4 xs12" },
{ state: "6 as 12", abbr: "col-md-6" }, { state: "6 as 12", abbr: "md6 xs12" },
{ state: "8 as 12", abbr: "col-md-8" }, { state: "8 as 12", abbr: "md8 xs12" },
{ state: "10 as 12", abbr: "col-md-10" } { state: "10 as 12", abbr: "md10 xs12" },
{ state: "10 as 12", abbr: "md12 xs12" },
], ],
rules: { rules: {
required: value => !!value || "Required." required: value => !!value || "Required."
} },
}; };
}, },
created() { created() {