deBug Tst Result & TEstType & Text DashBoard

This commit is contained in:
saeid
2019-07-21 15:12:10 +04:30
parent 5ed01f4013
commit 616bf5b54a
7 changed files with 421 additions and 439 deletions
+1 -5
View File
@@ -43,11 +43,7 @@
/******/
/******/ // script path function
/******/ function jsonpScriptSrc(chunkId) {
<<<<<<< HEAD
/******/ return __webpack_require__.p + "js/vue/chunks/" + ({}[chunkId]||chunkId) + "." + {"0":"cee19c932dbc149a1cc9","1":"1a2ec2568db9e0d01036","2":"567342defd47adb4346e","3":"edff967a6e6d462943a1","4":"e565c025f6fe488409e8","5":"96bde56e75e96f96d773","6":"5a5158e2d37fea70c0ad","7":"15e4bb6bc5da718a7edf","8":"c2a5317cf55cf4b30aae","9":"ec5534ce76a1d05e578f","10":"1a0d4926180438b7d7dd","11":"579917874d9306dc3854","12":"2fbc698c12dd792658de","13":"2a534d941dedd3e2828b","14":"21ee580c8e59c779a80a","15":"b930000cc9d8f16779ae","16":"adb713fe3707674161a5","17":"0cd7d9cfdd466475ba79","18":"17734129a0e2e4afdd89","19":"cfb8b7752ecb0c044cf9","20":"75f4f9028bacfd88dbae","21":"4756b5a7dd1daa6f2bb9","22":"fb95807ca2e8a3eee080","23":"0bd0fd4380524b2abc6e","24":"c24930cf7b1ec90bcb23","25":"ec97a6414b7a7daf18e2","26":"e816ed8939bdeb632640","27":"54547f942de04358714d"}[chunkId] + ".js"
=======
/******/ return __webpack_require__.p + "js/vue/chunks/" + ({}[chunkId]||chunkId) + "." + {"0":"cee19c932dbc149a1cc9","1":"5281a63adedfa1ab604f","2":"743b89b9bb2dabfa3ffe","3":"a050b1a548ee0857d2f7","4":"7c6e05813e662d286d09","5":"8d7463d42653e02550f1","6":"68a5b0bbe6eb4c67723e","7":"7b4c284293f5dd57a85d","8":"320bd23018e7d45c2399","9":"8ee8007e77852469f798","10":"9603d5be0ae5c93d2b34","11":"cf996f3dc28b604a3d3a","12":"febbfeb844354a0cdbff","13":"7441ce1b806f3f78bcbb","14":"8da587ed5e5037bb178c","15":"dc3f54190c64738d2bee","16":"b032a406fa78aefbf408","17":"aeda8d2fe82355b16c66","18":"4c39b4598f53fc5610c2","19":"44988f4163efeba55699","20":"08150bc9a6df0102406e","21":"bc068c1d2ec99a9965de","22":"9aa5bdc2ef1c37f1d6f4","23":"99044b1527f8753dde51","24":"8e2e76e3b7f37492e02f","25":"b7fe930c0eda2e6e82a5","26":"174e16952c4ab044e8bf","27":"bfdd4afc7d67ccd7ea27"}[chunkId] + ".js"
>>>>>>> eb83d7e2533274a2884a2efa593bfd66d8748f14
/******/ return __webpack_require__.p + "js/vue/chunks/" + ({}[chunkId]||chunkId) + "." + {"0":"cee19c932dbc149a1cc9","1":"1a2ec2568db9e0d01036","2":"567342defd47adb4346e","3":"edff967a6e6d462943a1","4":"e565c025f6fe488409e8","5":"96bde56e75e96f96d773","6":"5a5158e2d37fea70c0ad","7":"b9cc1f0bbb86abca8821","8":"973b0649ccc38b9bdade","9":"1b12af34e8e809cd2cc5","10":"1a0d4926180438b7d7dd","11":"6a1dd0825a7b78dd66b2","12":"2fbc698c12dd792658de","13":"2a534d941dedd3e2828b","14":"21ee580c8e59c779a80a","15":"b930000cc9d8f16779ae","16":"642ab7c8fa65b0639c84","17":"0cd7d9cfdd466475ba79","18":"17734129a0e2e4afdd89","19":"cfb8b7752ecb0c044cf9","20":"75f4f9028bacfd88dbae","21":"4756b5a7dd1daa6f2bb9","22":"fb95807ca2e8a3eee080","23":"0bd0fd4380524b2abc6e","24":"c24930cf7b1ec90bcb23","25":"be75aab13d8369be063b","26":"e816ed8939bdeb632640","27":"54547f942de04358714d"}[chunkId] + ".js"
/******/ }
/******/
/******/ // The require function
+6 -6
View File
@@ -84,18 +84,18 @@ export default {
data() {
return {
AdminCards :[
{title:'Manage Users', text:'You can edit the medical center information',icon:'/img/Static/Dashboard/ipad.png',color:'WM-YellowPinkGradient-BG',route:{name: 'ManageUsers'},aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12', role: 'Admin|Supervisor'},
{title:'Manage Medical Center', text:'Managing users very fast by ...',icon:'/img/Static/Dashboard/Macbook.png',color:'WM-MuskGradient-BG',route:{name: 'ManageMedicalCenter'},aligntext:'text-md-left',alignimg:'text-md-right',column:'xs12 md7 sm7', role: 'Admin'},
{title:'List Test Type', text:'You can simply add your own test type',icon:'/img/Static/Dashboard/Book-and-Pen.png',color:'WM-GreyGradient-BG',route:{name: 'ListTestType'},aligntext:'text-md-left',alignimg:'text-md-right',column:'xs12 md5 sm5', role: 'Admin'}
{title:'Manage Users', text:'You can Manage the users information',icon:'/img/Static/Dashboard/ipad.png',color:'WM-YellowPinkGradient-BG',route:{name: 'ManageUsers'},aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12', role: 'Admin|Supervisor'},
{title:'Manage Medical Center', text:'You can edit the medical center information',icon:'/img/Static/Dashboard/Macbook.png',color:'WM-MuskGradient-BG',route:{name: 'ManageMedicalCenter'},aligntext:'text-md-left',alignimg:'text-md-right',column:'xs12 md7 sm7', role: 'Admin'},
{title:'List Test Type', text:'You can simply add your test type',icon:'/img/Static/Dashboard/Book-and-Pen.png',color:'WM-GreyGradient-BG',route:{name: 'ListTestType'},aligntext:'text-md-left',alignimg:'text-md-right',column:'xs12 md5 sm5', role: 'Admin'}
],
SupervisorCards :[
{title:'Manage Users', text:'You can edit the medical center information',icon:'/img/Static/Dashboard/ipad.png',color:'WM-YellowPinkGradient-BG',route:{name: 'ManageUsers'},aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12', role: 'Admin|Supervisor'},
{title:'Test to Verify', text:'You can simply add your own test type in this section of website',icon:'/img/Static/Dashboard/notepad-colorful.png',color:'WM-PinkGradient-BG',route:{name: 'NotVerifyTestResult'},aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12', role: 'Admin|Supervisor'},
{title:'Manage Users', text:'You can Manage the users information',icon:'/img/Static/Dashboard/ipad.png',color:'WM-YellowPinkGradient-BG',route:{name: 'ManageUsers'},aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12', role: 'Admin|Supervisor'},
{title:'Test to Verify', text:'You can simply verify your own medical center test result in this section of website',icon:'/img/Static/Dashboard/notepad-colorful.png',color:'WM-PinkGradient-BG',route:{name: 'NotVerifyTestResult'},aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12', role: 'Admin|Supervisor'},
],
UsersCards :[
{title:'My Info', text:'You can easily edit your registration information',icon:'/img/Static/Dashboard/darkmug.png',color:'WM-OrangeGradient-BG',route:{name: 'MyInfo'},aligntext:'text-md-left',alignimg:'text-md-right', column:'xs12 md6 sm6'},
{title:'All Test Result', text:'You can see all user tests and own tests',icon:'/img/Static/Dashboard/pad.png',color:'WM-GreenGradient-BG',route:{name: 'AllResultTest'},aligntext:'text-md-left',alignimg:'text-md-right',column:'xs12 md6 sm6'},
{title:'Add a Test Result', text:'You can edit the medical center information',icon:'/img/Static/Dashboard/ipad.png',color:'WM-YellowPinkGradient-BG',route:{name: 'SubmitTestResult'},aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12'},
{title:'Add a Test Result', text:'You can add the test result',icon:'/img/Static/Dashboard/ipad.png',color:'WM-YellowPinkGradient-BG',route:{name: 'SubmitTestResult'},aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12'},
],
}
}
+409 -409
View File
@@ -1,420 +1,420 @@
<template>
<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-if="!$route.params.testResult"
>
<v-flex xs12 sm4 md4>
<v-autocomplete
:search-input.sync="searchInput"
:items="testTypeNames"
v-model="filter.name"
label="Choose Test Type"
color="black"
class="pa-2"
></v-autocomplete>
</v-flex>
<v-flex xs12 sm3 md3>
<v-text-field
name="testcode"
v-model="filter.unique_code"
label="Or Enter Test Unique Code"
color="black"
class="pa-2"
></v-text-field>
</v-flex>
<v-flex xs12 md2 sm2 class="text-xs-center text-sm-center text-md-center">
<v-btn
class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black"
@click="selectTestType"
style="padding:10px 60px;"
>
<v-icon class="black--text mr-2 caption">fas fa-chevron-right</v-icon>
<span class="black--text">GO</span>
</v-btn>
</v-flex>
</v-layout>
<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">
<v-flex xs12 sm4 md4>
<v-text-field
name="autoclave"
v-model="formData.device_id"
:label="formData.device_label"
color="black"
class="pa-2"
></v-text-field>
</v-flex>
<v-flex xs12 sm4 md4>
<v-text-field
v-model="formData.cycle_number"
label="Cycle Number"
color="black"
class="pa-2"
></v-text-field>
</v-flex>
<v-flex xs12 sm4 md4>
<v-switch v-model="result" :label="'Result: ' + formData.result"></v-switch>
</v-flex>
<v-flex xs12 sm12 md12>
<div>
<input type="file" class="inputfile" @change="onFileChange" multiple />
<label for="file">
<v-icon
class="v-icon greylighten-3--text mr-2 caption IconHover"
>fas fa-chevron-right</v-icon>Choose a file
</label>
</div>
<v-layout>
<v-flex v-for="(img, key) in images" :key="key" xs12 sm6 md3>
<img :src="img" style="width:100%;" />
<v-btn class="black" @click.native.stop="removeImage(key)">Remove image</v-btn>
</v-flex>
</v-layout>
</v-flex>
<v-flex :class="['pa-2', item.size]" v-for="(item, key) in form" :key="key">
<v-text-field
v-if="item.type == 'Text'"
v-model="formData[item.name+'_'+item.id]"
:label="item.name"
color="black"
></v-text-field>
<v-select
multiple
v-if="item.type == 'Select'"
:items="item.options"
v-model="formData[item.name+'_'+item.id]"
:label="item.name"
color="black"
item-text="title"
item-value="id"
></v-select>
<v-container fluid v-if="item.type == 'Checkbox'">
<p>{{ item.name }}</p>
<v-checkbox
v-for="(optionValue, keyOption) in item.options"
:key="keyOption"
:label="optionValue.title"
v-model="formData[item.name+'_'+item.id]"
:value="optionValue.id"
></v-checkbox>
</v-container>
<v-container fluid v-if="item.type == 'Radiobutton'">
<p>{{ item.name }}</p>
<v-radio-group v-model="formData[item.name+'_'+item.id]">
<v-radio
v-for="(optionValue, keyOption) in item.options"
:key="keyOption"
:label="optionValue.title"
:value="optionValue.id"
></v-radio>
</v-radio-group>
</v-container>
<v-container fluid v-if="item.type == 'Switch'">
<v-switch
v-model="formData[item.name+'_'+item.id]"
:label="item.name + ': ' + formData[item.name+'_'+item.id].toString()"
></v-switch>
</v-container>
<v-container fluid v-if="item.type == 'Range'">
<p>{{ item.name }}</p>
<v-flex xs12>
<v-slider
v-model="formData[item.name+'_'+item.id]"
:min="item.options[0].title"
:max="item.options[1].title"
thumb-label="always"
></v-slider>
</v-flex>
</v-container>
<v-container fluid v-if="item.type == 'Time'">
<v-flex xs12>
<v-time-picker v-model="formData[item.name+'_'+item.id]"></v-time-picker>
</v-flex>
</v-container>
<template v-if="item.type == 'Form'">
<v-container row md-12 sm-12 xs-12>
<v-layout row wrap>
<h3>{{ item.name }}</h3>
</v-layout>
<v-layout row wrap>
<v-flex
:class="['pa-2', children.size]"
v-for="(children, keyChildren) in item.children"
:key="keyChildren"
>
<v-text-field
v-if="children.type == 'Text'"
v-model="formData[children.name+'_'+children.id]"
:label="children.name"
color="black"
></v-text-field>
<v-select
multiple
v-if="children.type == 'Select'"
:items="children.options"
v-model="formData[children.name+'_'+children.id]"
:label="children.name"
color="black"
item-text="title"
item-value="id"
></v-select>
<v-container fluid v-if="children.type == 'Checkbox'">
<p>{{ children.name }}</p>
<v-checkbox
v-for="(optionValue, keyOption) in children.options"
:key="keyOption"
:label="optionValue.title"
v-model="formData[children.name+'_'+children.id]"
:value="optionValue.id"
></v-checkbox>
</v-container>
<v-container fluid v-if="children.type == 'Radiobutton'">
<p>{{ children.name }}</p>
<v-radio-group
v-model="formData[children.name+'_'+children.id]"
>
<v-radio
v-for="(optionValue, keyOption) in children.options"
:key="keyOption"
:label="optionValue.title"
:value="optionValue.id"
></v-radio>
</v-radio-group>
</v-container>
<v-container fluid v-if="children.type == 'Switch'">
<v-switch
v-model="formData[children.name+'_'+children.id]"
:label="children.name + ': ' + formData[children.name+'_'+children.id].toString()"
></v-switch>
</v-container>
<v-container fluid v-if="children.type == 'Range'">
<p>{{ item.name }}</p>
<v-flex xs12>
<v-slider
v-model="formData[children.name+'_'+children.id]"
:min="children.options[0].title"
:max="children.options[1].title"
thumb-label="always"
></v-slider>
</v-flex>
</v-container>
<v-container fluid v-if="children.type == 'Time'">
<v-flex xs12>
<v-time-picker
v-model="formData[children.name+'_'+children.id]"
></v-time-picker>
</v-flex>
</v-container>
</v-flex>
</v-layout>
</v-container>
</template>
</v-flex>
</v-layout>
<v-layout row wrap class="px-5 my-3">
<v-divider></v-divider>
</v-layout>
<v-layout align-center justify-center wrap class="px-5 mt-2">
<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>
<span class="white--text">SAVE</span>
</v-btn>
<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>
</v-btn>
</router-link>
</v-layout>
</material-card>
</v-container>
</v-form>
<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-if="!$route.params.testResult">
<v-flex xs12 sm4 md4>
<v-autocomplete
:search-input.sync="searchInput"
:items="testTypeNames"
v-model="filter.name"
label="Choose Test Type"
color="black"
class="pa-2"
></v-autocomplete>
</v-flex>
<v-flex xs12 sm3 md3>
<v-text-field
name="testcode"
v-model="filter.unique_code"
label="Or Enter Test Unique Code"
color="black"
class="pa-2"
></v-text-field>
</v-flex>
<v-flex xs12 md2 sm2 class="text-xs-center text-sm-center text-md-center">
<v-btn
class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black"
@click="selectTestType"
style="padding:10px 60px;"
>
<v-icon class="black--text mr-2 caption">fas fa-chevron-right</v-icon>
<span class="black--text">Select Test Result</span>
</v-btn>
</v-flex>
</v-layout>
<v-layout row wrap class="px-5 my-3" v-if="!$route.params.testResult && form.length" >
<v-divider></v-divider>
</v-layout>
<v-layout align-center justify-center wrap class="px-5 my-3" v-if="form.length">
<v-flex xs12 sm4 md4>
<v-text-field
name="autoclave"
v-model="formData.device_id"
:label="formData.device_label"
color="black"
class="pa-2"
></v-text-field>
</v-flex>
<v-flex xs12 sm4 md4>
<v-text-field v-model="formData.cycle_number" label="Cycle Number" color="black" class="pa-2"></v-text-field>
</v-flex>
<v-flex xs12 sm4 md4>
<v-switch v-model="result" :label="'Result: ' + formData.result"></v-switch>
</v-flex>
<v-flex xs12 sm12 md12>
<div>
<input type="file" class="inputfile" @change="onFileChange" multiple />
<label for="file">
<v-icon class="v-icon greylighten-3--text mr-2 caption IconHover">fas fa-chevron-right</v-icon>Choose a file
</label>
</div>
<v-layout>
<v-flex v-for="(img, key) in images" :key="key" xs12 sm6 md3>
<img :src="img" style="width:100%;" />
<v-btn class="black" @click.native.stop="removeImage(key)">Remove image</v-btn>
</v-flex>
</v-layout>
</v-flex>
<v-flex :class="['pa-2', item.size]" v-for="(item, key) in form" :key="key">
<v-text-field
v-if="item.type == 'Text'"
v-model="formData[item.name+'_'+item.id]"
:label="item.name"
color="black"
></v-text-field>
<v-text-field
v-if="item.type == 'Temperature'"
type="number"
v-model="formData[item.name+'_'+item.id]"
:label="item.name"
min="0"
max="200"
color="black"
></v-text-field>
<v-select
multiple
v-if="item.type == 'Select'"
:items="item.options"
v-model="formData[item.name+'_'+item.id]"
:label="item.name"
color="black"
item-text="title"
item-value="id"
></v-select>
<v-container fluid v-if="item.type == 'Checkbox'">
<p>{{ item.name }}</p>
<v-checkbox
v-for="(optionValue, keyOption) in item.options"
:key="keyOption"
:label="optionValue.title"
v-model="formData[item.name+'_'+item.id]"
:value="optionValue.id"
></v-checkbox>
</v-container>
<v-container fluid v-if="item.type == 'Radiobutton'">
<p>{{ item.name }}</p>
<v-radio-group v-model="formData[item.name+'_'+item.id]">
<v-radio
v-for="(optionValue, keyOption) in item.options"
:key="keyOption"
:label="optionValue.title"
:value="optionValue.id"
></v-radio>
</v-radio-group>
</v-container>
<v-container fluid v-if="item.type == 'Switch'">
<v-switch
v-model="formData[item.name+'_'+item.id]"
:label="item.name + ': ' + formData[item.name+'_'+item.id].toString()"
></v-switch>
</v-container>
<v-container fluid v-if="item.type == 'Range'">
<p>{{ item.name }}</p>
<v-flex xs12>
<v-slider
v-model="formData[item.name+'_'+item.id]"
:min="item.options[0].title"
:max="item.options[1].title"
thumb-label="always"
></v-slider>
</v-flex>
</v-container>
<v-container fluid v-if="item.type == 'Time'">
<v-flex xs12>
<v-time-picker v-model="formData[item.name+'_'+item.id]"></v-time-picker>
</v-flex>
</v-container>
<template v-if="item.type == 'Form'">
<v-container row md-12 sm-12 xs-12>
<v-layout row wrap>
<h3>{{ item.name }}</h3>
</v-layout>
<v-layout row wrap>
<v-flex
:class="['pa-2', children.size]"
v-for="(children, keyChildren) in item.children"
:key="keyChildren"
>
<v-text-field
v-if="children.type == 'Text'"
v-model="formData[children.name+'_'+children.id]"
:label="children.name"
color="black"
></v-text-field>
<v-text-field
v-if="children.type == 'Temperature'"
v-model="formData[children.name+'_'+children.id]"
:label="children.name"
type="number"
min="0"
max="200"
color="black"
></v-text-field>
<v-select
multiple
v-if="children.type == 'Select'"
:items="children.options"
v-model="formData[children.name+'_'+children.id]"
:label="children.name"
color="black"
item-text="title"
item-value="id"
></v-select>
<v-container fluid v-if="children.type == 'Checkbox'">
<p>{{ children.name }}</p>
<v-checkbox
v-for="(optionValue, keyOption) in children.options"
:key="keyOption"
:label="optionValue.title"
v-model="formData[children.name+'_'+children.id]"
:value="optionValue.id"
></v-checkbox>
</v-container>
<v-container fluid v-if="children.type == 'Radiobutton'">
<p>{{ children.name }}</p>
<v-radio-group v-model="formData[children.name+'_'+children.id]">
<v-radio
v-for="(optionValue, keyOption) in children.options"
:key="keyOption"
:label="optionValue.title"
:value="optionValue.id"
></v-radio>
</v-radio-group>
</v-container>
<v-container fluid v-if="children.type == 'Switch'">
<v-switch
v-model="formData[children.name+'_'+children.id]"
:label="children.name + ': ' + formData[children.name+'_'+children.id].toString()"
></v-switch>
</v-container>
<v-container fluid v-if="children.type == 'Range'">
<p>{{ item.name }}</p>
<v-flex xs12>
<v-slider
v-model="formData[children.name+'_'+children.id]"
:min="children.options[0].title"
:max="children.options[1].title"
thumb-label="always"
></v-slider>
</v-flex>
</v-container>
<v-container fluid v-if="children.type == 'Time'">
<v-flex xs12>
<v-time-picker v-model="formData[children.name+'_'+children.id]"></v-time-picker>
</v-flex>
</v-container>
</v-flex>
</v-layout>
</v-container>
</template>
</v-flex>
</v-layout>
<v-layout row wrap class="px-5 my-3">
<v-divider></v-divider>
</v-layout>
<v-layout align-center justify-center wrap class="px-5 mt-2">
<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>
<span class="white--text">SAVE</span>
</v-btn>
<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>
</v-btn>
</router-link>
</v-layout>
</material-card>
</v-container>
</v-form>
</template>
<script>
import { ApiService } from "@/services";
import { urls } from "@/config/urls";
export default {
data: () => ({
testTypeNames: [],
searchInput: "",
form: [],
filter: {
test_result_id: "",
name: "",
unique_code: ""
},
result: false,
formData: {
device_id: 0,
device_label: "AutoClaveID or WasherID",
result: "Reject",
cycle_number: "",
img: null,
test_type_id: ""
},
images: []
}),
created() {
if (this.$route.params.testResult) {
this.filter.test_result_id = this.$route.params.testResult;
this.selectTestType();
}
this.load();
},
methods: {
async load() {
const result = await ApiService.get(urls.listTestTypeName);
this.testTypeNames = result.data.data;
},
async selectTestType() {
const result = await ApiService.post(urls.getInputs, this.filter);
if (result && result.status == 200) {
this.form = result.data.data.inputs;
this.formData.test_type_id = result.data.data.testType.id;
this.formData.device_label = result.data.data.testType.device_label;
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)
) {
if (
result.data.data.inputs[key].children[
keyForm
].type == "Checkbox" ||
result.data.data.inputs[key].children[
keyForm
].type == "Select"
) {
this.formData[
result.data.data.inputs[key]
.children[keyForm].name +
"_" +
result.data.data.inputs[key]
.children[keyForm].id
] = [];
} else {
this.formData[
result.data.data.inputs[key]
.children[keyForm].name +
"_" +
result.data.data.inputs[key]
.children[keyForm].id
] = "";
}
}
}
} else if (
result.data.data.inputs[key].type == "Checkbox" ||
result.data.data.inputs[key].type == "Select"
) {
this.formData[
result.data.data.inputs[key].name +
"_" +
result.data.data.inputs[key].id
] = [];
} else {
this.formData[
result.data.data.inputs[key].name +
"_" +
result.data.data.inputs[key].id
] = "";
}
}
}
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;
for (const key in result.data.data.imagesPath) {
if (result.data.data.imagesPath.hasOwnProperty(key)) {
result.data.data.imagesPath[key] = '/' + result.data.data.imagesPath[key];
}
}
this.images = result.data.data.imagesPath;
}
}
}
},
async submitForm() {
let result;
if (this.$route.params.testResult) {
result = await ApiService.put(
urls.updateTestResult(this.$route.params.testResult),
this.formData
);
} else {
result = await ApiService.post(
urls.storeTestResult,
this.formData
);
}
data: () => ({
testTypeNames: [],
searchInput: "",
form: [],
filter: {
test_result_id: "",
name: "",
unique_code: ""
},
result: false,
formData: {
device_id: "",
device_label: "AutoClaveID or WasherID",
result: "Reject",
cycle_number: "",
img: null,
test_type_id: ""
},
images: []
}),
created() {
if (this.$route.params.testResult) {
this.filter.test_result_id = this.$route.params.testResult;
this.selectTestType();
}
this.load();
},
methods: {
async load() {
const result = await ApiService.get(urls.listTestTypeName);
this.testTypeNames = result.data.data;
},
async selectTestType() {
const result = await ApiService.post(urls.getInputs, this.filter);
if (result && result.status == 200) {
this.form = result.data.data.inputs;
this.formData.test_type_id = result.data.data.testType.id;
this.formData.device_label =
result.data.data.testType.device_label;
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)
) {
if (
result.data.data.inputs[key].children[
keyForm
].type == "Checkbox" ||
result.data.data.inputs[key].children[
keyForm
].type == "Select"
) {
this.formData[
result.data.data.inputs[key]
.children[keyForm].name +
"_" +
result.data.data.inputs[key]
.children[keyForm].id
] = [];
} else {
this.formData[
result.data.data.inputs[key]
.children[keyForm].name +
"_" +
result.data.data.inputs[key]
.children[keyForm].id
] = "";
}
}
}
} else if (
result.data.data.inputs[key].type == "Checkbox" ||
result.data.data.inputs[key].type == "Select"
) {
this.formData[
result.data.data.inputs[key].name +
"_" +
result.data.data.inputs[key].id
] = [];
} else {
this.formData[
result.data.data.inputs[key].name +
"_" +
result.data.data.inputs[key].id
] = "";
}
}
}
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;
for (const key in result.data.data.imagesPath) {
if (
result.data.data.imagesPath.hasOwnProperty(key)
) {
result.data.data.imagesPath[key] =
"/" + result.data.data.imagesPath[key];
}
}
this.images = result.data.data.imagesPath;
}
}
}
},
async submitForm() {
let result;
if (this.$route.params.testResult) {
result = await ApiService.put(
urls.updateTestResult(this.$route.params.testResult),
this.formData
);
} else {
result = await ApiService.post(
urls.storeTestResult,
this.formData
);
}
if (result && result.status == 200) {
this.$router.push({ name: "Dashboard" });
}
},
onFileChange(e) {
var files = e.target.files || e.dataTransfer.files;
if (!files.length) return;
for (const key in files) {
if (files.hasOwnProperty(key)) {
this.createImage(files[key], key);
}
}
},
createImage(file, index) {
var image = new Image();
var reader = new FileReader();
var vm = this;
if (result && result.status == 200) {
this.$router.push({ name: "Dashboard" });
}
},
onFileChange(e) {
var files = e.target.files || e.dataTransfer.files;
if (!files.length) return;
for (const key in files) {
if (files.hasOwnProperty(key)) {
this.createImage(files[key], key);
}
}
},
createImage(file, index) {
var image = new Image();
var reader = new FileReader();
var vm = this;
reader.onload = e => {
vm.images.push(e.target.result);
};
reader.onload = e => {
vm.images.push(e.target.result);
};
reader.readAsDataURL(file);
},
removeImage(index) {
this.images.splice(index, 1);
}
},
watch: {
images(img) {
this.formData.imgs = img;
},
result(value) {
if (value) {
this.formData.result = "Accept";
} else {
this.formData.result = "Reject";
}
},
formData(value) {
if (value.result == "Accept") {
this.result = true;
} else {
this.result = false;
}
}
}
reader.readAsDataURL(file);
},
removeImage(index) {
this.images.splice(index, 1);
}
},
watch: {
images(img) {
this.formData.imgs = img;
},
result(value) {
if (value) {
this.formData.result = "Accept";
} else {
this.formData.result = "Reject";
}
},
formData(value) {
if (value.result == "Accept") {
this.result = true;
} else {
this.result = false;
}
}
}
};
</script>
+1 -1
View File
@@ -301,7 +301,7 @@ export default {
}
},
async generateBarcode(id) {
const result = await ApiService.post(urls.Barcode(`110${id}64`));
const result = await ApiService.post(urls.Barcode(`CSSD-${id}`));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-barcode-barcode",
+2 -1
View File
@@ -386,7 +386,8 @@ export default {
{ state: "Switch", abbr: "Switch" },
{ state: "Range", abbr: "Range" },
{ state: "Time", abbr: "Time" },
{ state: "Form", abbr: "Form" }
{ state: "Temperature", abbr: "Temperature" },
{ state: "Form", abbr: "Form" },
],
size: [
{ state: "not Selected", abbr: "" },
+1 -16
View File
@@ -44,7 +44,7 @@
<v-text-field
required
slot="activator"
label="FromDate"
label="UpToDate"
v-model="filter.upToPicker"
></v-text-field>
<v-date-picker
@@ -102,10 +102,6 @@
<span>Edit</span>
</v-btn>
</router-link>
<v-btn color="orange darken-1" @click="generateBarcode(item.unique_code)">
<v-icon class="white--text mr-1 caption">fas fa-barcode</v-icon>
<span>Generate Barcode</span>
</v-btn>
<v-btn color="black" class="mr-2" @click="remove(item.id)">
<v-icon class="white--text mr-1 caption">fas fa-folder</v-icon>
<span>Archive</span>
@@ -134,7 +130,6 @@
<script>
import { ApiService } from "@/services";
import { urls } from "@/config/urls";
import { mapMutations } from "vuex";
export default {
data: () => ({
headers: [
@@ -182,7 +177,6 @@ export default {
this.load();
},
methods: {
...mapMutations("modal", ["changeCurrentModal"]),
async load(page = 1) {
let filter = "?";
for (const key in this.filter) {
@@ -211,15 +205,6 @@ export default {
}
}
},
async generateBarcode(code) {
const result = await ApiService.post(urls.Barcode(code));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-barcode-barcode",
properties: { result }
});
}
}
},
watch: {
currentPage(page) {
+1 -1
View File
@@ -74,7 +74,7 @@
<v-text-field
required
slot="activator"
label="FromDate"
label="UpToDate"
v-model="filter.upToPicker"
></v-text-field>
<v-date-picker