mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-11 20:31:06 +03:30
Product
This commit is contained in:
Vendored
+3
@@ -25,6 +25,9 @@ const urls = {
|
||||
updateTestType : function(id) {
|
||||
return `/TestTypes/${id}`;
|
||||
},
|
||||
editTestResult : function(id) {
|
||||
return `/TestResults/${id}/edit`;
|
||||
},
|
||||
updateMedicalCenter : function(id) {
|
||||
return `/MedicalCenters/${id}`;
|
||||
},
|
||||
|
||||
Vendored
+3
-13
@@ -96,19 +96,9 @@ export default [
|
||||
name: 'SubmitTestResult',
|
||||
view: 'TestResult/AddEdit'
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
path: '/test-creator',
|
||||
name: 'TestCreator',
|
||||
view: 'TestCreator'
|
||||
},
|
||||
{
|
||||
path: '/test',
|
||||
name: 'Test',
|
||||
view: 'Test'
|
||||
path: '/test-result/:testResult/edit',
|
||||
name: 'EditTestResult',
|
||||
view: 'TestResult/AddEdit'
|
||||
},
|
||||
]
|
||||
|
||||
@@ -119,7 +119,7 @@ export default {
|
||||
},
|
||||
async remove(id) {
|
||||
const result = await ApiService.delete(urls.deleteMedicalCenter(id));
|
||||
if (result.status == 200) {
|
||||
if (result && result.status == 200) {
|
||||
for (const key in this.items) {
|
||||
if (this.items.hasOwnProperty(key) && this.items[key].id == id) {
|
||||
this.items.splice(key, 1);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<v-form ref="form">
|
||||
<v-container grid-list-xs>
|
||||
<material-card color="black" title="Submit Test Result">
|
||||
<v-layout align-center justify-center wrap class="px-5 my-3">
|
||||
<v-layout align-center justify-center wrap class="px-5 my-3" v-if="!$route.params.testResult">
|
||||
<v-flex xs12 sm4 md4>
|
||||
<v-autocomplete
|
||||
:search-input.sync="searchInput"
|
||||
@@ -33,7 +33,7 @@
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row wrap class="px-5 my-3">
|
||||
<v-layout row wrap class="px-5 my-3" v-if="!$route.params.testResult">
|
||||
<v-divider></v-divider>
|
||||
</v-layout>
|
||||
<v-layout align-center justify-center wrap class="px-5 my-3">
|
||||
@@ -143,16 +143,23 @@ export default {
|
||||
searchInput: "",
|
||||
form: [],
|
||||
filter: {
|
||||
test_result_id: "",
|
||||
name: "",
|
||||
unique_code: ""
|
||||
},
|
||||
formData : {
|
||||
autoclave_id: "",
|
||||
result: "",
|
||||
test_type_id: "",
|
||||
}
|
||||
}),
|
||||
created() {
|
||||
if (this.$route.params.testResult) {
|
||||
this.filter.test_result_id = this.$route.params.testResult;
|
||||
this.selectTestType();
|
||||
}
|
||||
this.load();
|
||||
|
||||
},
|
||||
methods: {
|
||||
async load() {
|
||||
@@ -162,20 +169,29 @@ export default {
|
||||
async selectTestType() {
|
||||
const result = await ApiService.post(urls.getInputs, this.filter);
|
||||
if (result && result.status == 200) {
|
||||
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] = '';
|
||||
this.form = result.data.data.inputs;
|
||||
this.formData.test_type_id = result.data.data.testType.id;
|
||||
for (const key in result.data.data.inputs) {
|
||||
if (result.data.data.inputs.hasOwnProperty(key)) {
|
||||
if(result.data.data.inputs[key].type == 'Form') {
|
||||
for (const keyForm in result.data.data.inputs[key].children) {
|
||||
if (result.data.data.inputs[key].children.hasOwnProperty(keyForm)) {
|
||||
this.formData[result.data.data.inputs[key].children[keyForm].name] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(result.data.data.inputs[key].type == 'Checkbox') {
|
||||
this.formData[result.data.data.inputs[key].name] = [];
|
||||
} else {
|
||||
this.formData[result.data.data.inputs[key].name] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.$route.params.testResult) {
|
||||
const result = await ApiService.get(urls.editTestResult(this.$route.params.testResult));
|
||||
if (result && result.status == 200) {
|
||||
this.formData = result.data.data;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
async submitForm() {
|
||||
|
||||
@@ -59,9 +59,15 @@
|
||||
<v-icon class="white--text mr-1 caption">fas fa-folder</v-icon>
|
||||
<span>Archive</span>
|
||||
</v-btn>
|
||||
<v-btn color="cyan" class="mr-2">
|
||||
<v-icon class="white--text mr-1 caption">fas fa-pen</v-icon>
|
||||
<span>Edit</span>
|
||||
<router-link :to="{name: 'EditTestResult', params: {testResult: item.id}}">
|
||||
<v-btn color="cyan" class="mr-2">
|
||||
<v-icon class="white--text mr-1 caption">fas fa-pen</v-icon>
|
||||
<span>Edit</span>
|
||||
</v-btn>
|
||||
</router-link>
|
||||
<v-btn color="pink" class="mr-2" @click="remove(item.id)" >
|
||||
<v-icon class="white--text mr-1 caption">fas fa-times</v-icon>
|
||||
<span>Remove</span>
|
||||
</v-btn>
|
||||
</td>
|
||||
</template>
|
||||
@@ -141,9 +147,24 @@ export default {
|
||||
this.lastPage = result.data.data.last_page;
|
||||
}
|
||||
},
|
||||
async load() {
|
||||
const result = await ApiService.get(urls.listTestResult);
|
||||
if (result && result.status == 200) {
|
||||
this.items = result.data.data.data;
|
||||
this.currentPage = result.data.data.current_page;
|
||||
this.lastPage = result.data.data.last_page;
|
||||
}
|
||||
},
|
||||
async remove(testResultId) {
|
||||
const result = await ApiService.get(urls.removeTestResult(testResultId));
|
||||
if (result && result.status == 200) {
|
||||
for (const key in this.items) {
|
||||
if (this.items.hasOwnProperty(key) && this.items[key].id == testResultId) {
|
||||
this.items.splice(key, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="css" scoped>
|
||||
</style>
|
||||
</script>
|
||||
@@ -98,7 +98,7 @@
|
||||
<v-divider></v-divider>
|
||||
</v-layout>
|
||||
<v-layout row wrap align-center justify-center class="mt-3">
|
||||
<router-link to="/dashboard">
|
||||
<router-link :to="{name: 'Dashboard'}">
|
||||
<v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black ml-5">
|
||||
<v-icon class="black--text mr-2 caption">fas fa-chevron-left</v-icon>
|
||||
<span class="black--text">Back</span>
|
||||
|
||||
Reference in New Issue
Block a user