Structor CSSD

This commit is contained in:
saeid
2019-04-25 20:14:09 +04:30
parent fc162db99b
commit 14a91bdef7
72 changed files with 6957 additions and 4636 deletions
+7 -7
View File
@@ -87,32 +87,32 @@ export default {
logo: './img/vuetifylogo.png',
links: [
{
to: '/dashboard',
to: {name: 'Dashboard'},
icon: 'mdi-view-dashboard',
text: 'Dashboard'
},
{
to: '/my-info',
to: {name: 'MyInfo'},
icon: 'mdi-account',
text: 'My Info'
},
{
to: '/all-resualttest',
to: {name: 'AllResultTest'},
icon: 'description',
text: 'All Test Result'
},
{
to: '/manage-users',
to: {name: 'ManageUsers'},
icon: 'far fa-address-book',
text: 'Manage Users'
},
{
to: '/test-creator',
to: {name: 'ListTestType'},
icon: 'fas fa-vial',
text: 'Add a Test Type'
text: 'List Test Type'
},
{
to: '/submit-test-result',
to: {name: 'SubmitTestResult'},
icon: 'done',
text: 'Submit Test Result'
},
@@ -30,6 +30,7 @@
import { mapGetters, mapMutations } from "vuex";
import { ApiService } from "@/services";
import { roles } from "@/config/utils";
import { urls } from "@/config/urls";
export default {
data: () => ({
items: roles,
@@ -39,11 +40,11 @@ export default {
...mapMutations("modal", ["closeModal", "setResultModal"]),
async changeRole() {
const result = await ApiService.post(
`Users/ChangeRole/${this.getModalProperties.user.id}`,
urls.changeRoleUser(this.getModalProperties.user.id),
this.data
);
if (result && result.status == 200) {
this.setResultModal(result.data);
this.setResultModal(result.data.data);
this.closeModal();
}
}
+38
View File
@@ -1,7 +1,45 @@
const urls = {
storeTestType : "/TestTypes",
updateInfo : "/UpdateInfo",
getInfo : "/GetInfo",
login : "/login",
logout : "/logout",
storeMedicalCenter : "/MedicalCenters",
listOpertor : "/Users",
listMedicalCenter : function(page) {
return "/MedicalCenters?page=" + page;
},
listTestType : function(page) {
return "/TestTypes?page=" + page;
},
deleteTestType : function(id) {
return `/TestTypes/${id}`;
},
editTestType : function(id) {
return `/TestTypes/${id}/edit`;
},
updateTestType : function(id) {
return `/TestTypes/${id}`;
},
updateMedicalCenter : function(id) {
return `/MedicalCenters/${id}`;
},
deleteMedicalCenter : function(id) {
return `/MedicalCenters/${id}`;
},
listOpertorMedicalCenter: function(id) {
return `/Users/MedicalCenter/${id}`;
},
changeStatusUser: function(userId) {
return `Users/ChangeStatus/${userId}`;
},
changeRoleUser: function(userId) {
return `Users/ChangeRole/${userId}`;
},
deleteUser: function(userId) {
return `Users/${userId}`;
},
};
export {urls};
+53 -46
View File
@@ -12,40 +12,57 @@ export default [
{
path: '/my-info',
name: 'MyInfo',
view: 'MyInfo'
},
{
path: '/all-resualttest',
name: 'AllResultTest',
view: 'AllResultTest'
view: 'User/MyInfo'
},
{
path: '/manage-users',
name: 'ManageUsers',
view: 'ManageUsers',
meta: {
roles : 'Admin'
}
view: 'User/List',
},
{
path: '/test-creator',
name: 'AddNewTest',
view: 'TestCreator'
path: '/test-type/create',
name: 'AddTestType',
view: 'TestType/AddEdit'
},
{
path: '/manage-medical-center',
path: '/test-type/:testType/edit',
name: 'EditTestType',
view: 'TestType/AddEdit'
},
{
path: '/test-types',
name: 'ListTestType',
view: 'TestType/List'
},
{
path: '/medical-center',
name: 'ManageMedicalCenter',
view: 'ManageMedicalCenter'
view: 'MedicalCenter/List'
},
{
path: '/medical-center/:id/edit',
path: '/medical-center/create',
name: 'AddMedicalCenter',
view: 'MedicalCenter/AddEdit'
},
{
path: '/medical-center/:medicalCenter/edit',
name: 'EditMedicalCenter',
view: 'AddMedicalCenter'
view: 'MedicalCenter/AddEdit'
},
{
path: '/add-operator/:medicalCenter',
name: 'AddOperator',
view: 'Auth/Register'
},
{
path: '/operator-list/:medicalCenter',
name: 'OperatorList',
view: 'MedicalCenter/OperatorList'
},
{
path: '/login',
name: 'Login',
view: 'Login',
view: 'Auth/Login',
meta: {
public: true, // Allow access to even if not logged in
onlyWhenLoggedOut: true
@@ -54,31 +71,36 @@ export default [
{
path: '/register',
name: 'Register',
view: 'Register',
view: 'Auth/Register',
meta: {
public: true, // Allow access to even if not logged in
onlyWhenLoggedOut: true
}
},
{
path: '/Adminregister',
name: 'AdminRegister',
view: 'AdminRegister'
path: '/forgot-password',
name: 'ForgotPassword',
view: 'Auth/ForgotPassword',
meta: {
public: true, // Allow access to even if not logged in
onlyWhenLoggedOut: true
},
},
{
path: '/all-resualttest',
name: 'AllResultTest',
view: 'AllResultTest'
},
{
path: '/submit-test-result',
name: 'SubmitTestResult',
view: 'SubmitTestResult'
},
{
path: '/forgot-password',
name: 'ForgotPassword',
view: 'ForgotPassword',
meta: {
public: true, // Allow access to even if not logged in
onlyWhenLoggedOut: true
},
},
{
path: '/test-creator',
name: 'TestCreator',
@@ -89,19 +111,4 @@ export default [
name: 'Test',
view: 'Test'
},
{
path: '/add-medical-center',
name: 'AddMedicalCenter',
view: 'AddMedicalCenter'
},
{
path: '/add-operator/:medicalCenter',
name: 'AddOperator',
view: 'Register'
},
{
path: '/operator-list/:medicalCenter',
name: 'OperatorList',
view: 'OperatorList'
},
]
+7 -18
View File
@@ -1,5 +1,6 @@
import { ApiService } from "../global/api.service";
import { TokenService } from "./storage.service";
import { urls } from "@/config/urls";
class AuthenticationError extends Error {
constructor(errorCode, message) {
@@ -20,7 +21,7 @@ const UserService = {
login: async function(cell_number, password) {
const requestData = {
method: "post",
url: "/login",
url: urls.login,
data: {
cell_number,
password,
@@ -120,7 +121,7 @@ const UserService = {
const requestData = {
method: "post",
url: "login",
url: urls.login,
data: {
grant_type: "refresh_token",
refresh_token: refreshToken
@@ -154,13 +155,8 @@ const UserService = {
* Will also remove `Authorization Bearer <token>` header from future requests.
**/
logout: async function() {
const requestData = {
method: "post",
url: "logout"
};
try {
const response = await ApiService.customRequest(requestData);
const response = await ApiService.post(urls.logout);
// Remove the token and remove Authorization header from Api Service as well
TokenService.removeToken();
TokenService.removeRefreshToken();
@@ -184,16 +180,9 @@ const UserService = {
* Will also Register in Store;
**/
getInfo: async function() {
const requestData = {
method: "get",
url: "getInfo"
};
const response = await ApiService.customRequest(requestData);
TokenService.saveInfo(response.data);
return response.data;
const response = await ApiService.get(urls.getInfo);
TokenService.saveInfo(response.data.data);
return response.data.data;
}
};
+4 -2
View File
@@ -30,11 +30,13 @@ const ApiService = {
},
put(resource, data) {
return axios.put(resource, data)
data['_method'] = 'put';
return axios.post(resource, data)
},
delete(resource) {
return axios.delete(resource)
let data = {'_method': 'delete'};
return axios.post(resource, data)
},
/**
+2 -2
View File
@@ -30,9 +30,9 @@ function errorResponseHandler(error) {
}
}
function successHandler(response) {
if(response.data == 200) {
if(response.status == 200) {
if(typeof response.data.message !== 'undefined') {
toast.success(response.data.message);
toast.success(response.data.message, response.data.title);
}
}
return response;
+7 -7
View File
@@ -28,13 +28,13 @@ export default {
data() {
return {
Cards :[
{title:'My Info', text:'You can easily edit your registration information',icon:'/img/Static/Dashboard/darkmug.png',color:'WM-OrangeGradient-BG',route:'/my-info',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:'/all-resualttest',aligntext:'text-md-left',alignimg:'text-md-right',column:'xs12 md6 sm6'},
{title:'Manage Users', text:'You can edit the medical center information',icon:'/img/Static/Dashboard/ipad.png',color:'WM-YellowPinkGradient-BG',route:'/manage-users',aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12'},
{title:'Manage Medical Center', text:'Managing users very fast by ...',icon:'/img/Static/Dashboard/Macbook.png',color:'WM-MuskGradient-BG',route:'/manage-medical-center',aligntext:'text-md-left',alignimg:'text-md-right',column:'xs12 md7 sm7'},
{title:'Add a Test Type', text:'You can simply add your own test type',icon:'/img/Static/Dashboard/Book-and-Pen.png',color:'WM-GreyGradient-BG',route:'/test-creator',aligntext:'text-md-left',alignimg:'text-md-right',column:'xs12 md5 sm5'},
{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:'/submit-test-result',aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12'},
{title:'Add a Test Result', text:'You can edit the medical center information',icon:'/img/Static/Dashboard/ipad.png',color:'WM-YellowPinkGradient-BG',route:'/manage-medical-center',aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12'},
{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:'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'},
{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'},
{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'},
{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: 'SubmitTestResult'},aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12'},
{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: 'ManageMedicalCenter'},aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12'},
]
}
}
-147
View File
@@ -1,147 +0,0 @@
<template>
<v-container grid-list-xs>
<material-card
color="black"
title="Member List">
<v-layout align-center justify-center wrap class="px-5 mb-3">
<v-flex xs12 md3 sm3>
<v-text-field
class="pa-2"
color="black"
name="name"
label="Name"
id="id1"
></v-text-field>
</v-flex>
<v-flex xs12 md3 sm3>
<v-text-field
class="pa-2"
color="black"
name="date"
label="Date"
id="id2"
></v-text-field>
</v-flex>
<v-flex xs12 md3 sm3>
<v-text-field
class="pa-2"
color="black"
name="hospital"
label="Hospital"
id="id3"
></v-text-field>
</v-flex>
<v-flex xs12 md3 sm3>
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px">
<v-icon class="white--text mr-2 caption">fas fa-search</v-icon>
<span class="white--text">Filter</span>
</v-btn>
</v-flex>
</v-layout>
<v-layout class="px-4 my-3">
<v-divider></v-divider>
</v-layout>
<v-layout align-center justify-center wrap class="px-5 my-2">
<v-flex xs12 md12 sm12>
<v-data-table
:headers="headers"
:items="items"
hide-actions
>
<template
slot="headerCell"
slot-scope="{ header }">
<span
class="subheading font-weight-light text-white text--darken-3"
v-text="header.text"
/>
</template>
<template
slot="items"
slot-scope="{ item }">
<td class="headline font-weight-light">{{item.name}}</td>
<td class="title font-weight-light">{{item.date}}</td>
<td class="title font-weight-light">{{item.operator}}</td>
<td class="text-xs-right">
<v-btn color="purple" class="mr-2 WM-ActionButton">
<v-icon class="white--text mr-1 caption">fas fa-envelope</v-icon>
<span>SMS</span>
</v-btn>
<v-btn color="cyan" class="mr-2 WM-ActionButton">
<v-icon class="white--text mr-1 caption">fas fa-pen</v-icon>
<span>Edit</span>
</v-btn>
<v-btn color="orange darken-1" class="mr-2 WM-ActionButton">
<v-icon class="white--text mr-1 caption">fas fa-user</v-icon>
<span>Operator</span>
</v-btn>
<v-btn color="pink" class=" WM-ActionButton">
<v-icon class="white--text mr-1 caption">fas fa-times</v-icon>
<span>Remove</span>
</v-btn>
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
<v-layout class="px-4 my-3">
<v-divider></v-divider>
</v-layout>
<v-layout row wrap align-center justify-center class="mt-3">
<router-link to="/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>
</template>
<script>
export default {
data: () => ({
headers : [
{
sortable : true,
text: 'Operator',
value: 'operator'
},
{
sortable : true,
text: 'Date',
value: 'date'
},
{
sortable : true,
text: 'Hospital',
value: 'hospital'
},
{
sortable : true,
text: 'Action',
value: 'action',
align: 'right'
},
],
items: [
{
name: 'Fatemeh Shokouhi',
date: '12/05/1397',
operator: 'Shahid Beheshti',
action: ''
},
{
name: 'Fatemeh Fayyazi',
date: '12/05/1397',
operator: 'Emam Reza',
action: ''
},
]
})
}
</script>
<style lang="css" scoped>
</style>
@@ -15,7 +15,7 @@
</v-layout>
<v-layout row wrap align-center justify-center class="mt-3">
<v-btn class="WM-CyanBlueGradient-BG" @click="AddMedicalCenter" style="padding:10px 60px">
<template v-if="$route.params.id">
<template v-if="$route.params.medicalCenter">
<v-icon class="white--text mr-2 caption">fas fa-edit</v-icon>
<span class="white--text">Edit</span>
</template>
@@ -24,7 +24,7 @@
<span class="white--text">Add</span>
</template>
</v-btn>
<router-link to="/manage-medical-center">
<router-link :to="{name:'ManageMedicalCenter'}">
<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>
@@ -37,7 +37,7 @@
</template>
<script>
import { ApiService } from "@/services";
import { log } from "util";
import { urls } from "@/config/urls";
export default {
data() {
return {
@@ -51,8 +51,8 @@ export default {
};
},
created() {
if (this.$route.params.id) {
this.load(this.$route.params.id);
if (this.$route.params.medicalCenter) {
this.load(this.$route.params.medicalCenter);
}
},
methods: {
@@ -62,12 +62,10 @@ export default {
},
async AddMedicalCenter() {
if (this.$refs.form.validate()) {
if (this.$route.params.id) {
let url = `MedicalCenters/${this.$route.params.id}`;
var result = await ApiService.put(url, this.medicalCenter);
if (this.$route.params.medicalCenter) {
var result = await ApiService.put(urls.updateMedicalCenter(this.$route.params.medicalCenter), this.medicalCenter);
} else {
let url = "MedicalCenters";
var result = await ApiService.post(url, this.medicalCenter);
var result = await ApiService.post(urls.storeMedicalCenter, this.medicalCenter);
}
if (result && result.status == 200) {
this.$router.push({name : "ManageMedicalCenter"});
@@ -38,7 +38,7 @@
<td class="title font-weight-light">{{ item.created_at }}</td>
<td class="title font-weight-light">{{ item.users_count }} Operator</td>
<td class="text-xs-right">
<router-link :to="{name : 'EditMedicalCenter', params : {id : item.id}}">
<router-link :to="{name : 'EditMedicalCenter', params : {medicalCenter : item.id}}">
<v-btn color="cyan" class="mr-2 WM-ActionButton">
<v-icon class="white--text mr-2 caption">fas fa-pen</v-icon>
<span>Edit</span>
@@ -113,12 +113,12 @@ export default {
methods: {
async getData(page = 1) {
const result = await ApiService.get(urls.listMedicalCenter(page));
this.items = result.data.MedicalCenters.data;
this.currentPage = result.data.MedicalCenters.current_page;
this.lastPage = result.data.MedicalCenters.last_page;
this.items = result.data.data.data;
this.currentPage = result.data.data.current_page;
this.lastPage = result.data.data.last_page;
},
async remove(id) {
const result = await ApiService.delete("MedicalCenters/" + id);
const result = await ApiService.delete(urls.deleteMedicalCenter(id));
if (result.status == 200) {
for (const key in this.items) {
if (this.items.hasOwnProperty(key) && this.items[key].id == id) {
@@ -87,7 +87,7 @@
<script>
import { ApiService } from "@/services";
import { mapMutations, mapGetters } from "vuex";
import { log } from "util";
import { urls } from "@/config/urls";
export default {
data: () => ({
headers: [
@@ -129,21 +129,21 @@ export default {
methods: {
async load(medicalCenterId) {
const result = await ApiService.get(
`Users/${medicalCenterId}/MedicalCenter`
urls.listOpertorMedicalCenter(medicalCenterId)
);
if (result && result.status == 200) {
this.items = result.data.users;
this.name = result.data.name;
this.items = result.data.data.users;
this.name = result.data.data.name;
} else {
this.$router.push({name:`Dashboard`});
}
},
async changeStatus(userId) {
const result = await ApiService.post(`Users/ChangeStatus/${userId}`);
const result = await ApiService.post(urls.changeStatusUser(userId));
if (result && result.status == 200) {
for (let user of this.items) {
if (user.id == userId) {
user.status = result.data.status;
user.status = result.data.data.status;
}
}
} else {
@@ -158,10 +158,10 @@ export default {
});
},
async remove(userId) {
const result = await ApiService.delete(`Users/${userId}`);
const result = await ApiService.delete(urls.deleteUser(userId));
if (result && result.status == 200) {
for (const key in this.items) {
if (this.items.hasOwnProperty(key) && this.items[key].id == id) {
if (this.items.hasOwnProperty(key) && this.items[key].id == userId) {
this.items.splice(key, 1);
}
}
@@ -273,6 +273,7 @@
</template>
<script>
import { ApiService } from "@/services";
import { urls } from "@/config/urls";
export default {
data() {
return {
@@ -308,10 +309,15 @@ export default {
}
};
},
created() {
if (this.$route.params.testType) {
this.load(this.$route.params.testType);
}
},
methods: {
changeType(infoIndex, selectedboxType) {
if (selectedboxType == "Select" || selectedboxType == "Checkbox") {
this.form.info[infoIndex]["options"] = [{ title: "" }];
this.form.info[infoIndex]["options"] = [{ id: 0, title: "" }];
} else {
this.form.info[infoIndex]["options"] = [];
}
@@ -330,7 +336,7 @@ export default {
addSelectbox(infoIndex) {
let form = this.form;
this.form = [];
form.info[infoIndex]["options"].push({ title: "" });
form.info[infoIndex]["options"].push({ id: 0, title: "" });
this.form = form;
},
addInput() {
@@ -341,7 +347,7 @@ export default {
let form = this.form;
this.form = "";
form.info[infoIndex]["children"][formLevel]["options"] = [
{ title: "" }
{ id: 0, title: "" }
];
this.form = form;
} else {
@@ -364,6 +370,7 @@ export default {
let form = this.form;
this.form = [];
form.info[infoIndex]["children"][formLevel]["options"].push({
id: 0,
title: ""
});
this.form = form;
@@ -393,12 +400,23 @@ export default {
},
async registerForm() {
if (this.$refs.form.validate()) {
const result = await ApiService.post("TestTypes", this.form);
let result = null;
if (this.$route.params.testType) {
result = await ApiService.put(urls.updateTestType(this.$route.params.testType), this.form);
} else {
result = await ApiService.post(urls.storeTestType, this.form);
}
if (result && result.status == 200) {
this.$router.push({ name: `Dashboard` });
}
}
}
},
async load(id) {
const result = await ApiService.get(urls.editTestType(id));
if (result.status == 200) {
this.form = result.data.data;
}
},
}
};
</script>
+143
View File
@@ -0,0 +1,143 @@
<template>
<v-container fluid>
<material-card class color="black" title="Medical Centers List" text>
<v-layout wrap class="px-5 mb-3">
<v-flex xs12 md3 sm3>
<v-text-field label="Name" color="black"></v-text-field>
</v-flex>
<v-flex xs12 md2 sm2 class="text-xs-right">
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px">
<v-icon class="white--text mr-2 caption">fas fa-search</v-icon>
<span class="white--text">Filter</span>
</v-btn>
</v-flex>
<v-spacer></v-spacer>
<v-flex xs12 md2 sm2 class="text-xs-right">
<router-link :to="{name: 'AddTestType'}">
<v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black">
<v-icon class="black--text mr-2 caption">fas fa-plus</v-icon>
<span class="black--text">Add</span>
</v-btn>
</router-link>
</v-flex>
</v-layout>
<v-layout class="px-4 my-3">
<v-divider></v-divider>
</v-layout>
<v-layout align-center justify-center wrap class="px-5 mt-3">
<v-flex md12>
<v-data-table :headers="headers" :items="items" hide-actions>
<template slot="headerCell" slot-scope="{ header }">
<span
class="subheading font-weight-light text-white text--darken-3"
v-text="header.text"
/>
</template>
<template slot="items" slot-scope="{ item }">
<td class="headline font-weight-light">{{ item.name }}</td>
<td class="title font-weight-light">{{ item.unique_code }} </td>
<td class="title font-weight-light">{{ item.user.name }}</td>
<td class="title font-weight-light">{{ item.created_at }}</td>
<td class="text-xs-right">
<router-link :to="{name : 'EditTestType', params : {testType : item.id}}">
<v-btn color="cyan" class="mr-2 WM-ActionButton">
<v-icon class="white--text mr-2 caption">fas fa-pen</v-icon>
<span>Edit</span>
</v-btn>
</router-link>
<v-btn color="pink" @click="remove(item.id)" class="WM-ActionButton">
<v-icon class="white--text mr-2 caption">fas fa-times</v-icon>
<span>Remove</span>
</v-btn>
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
<v-divider></v-divider>
<div class="text-xs-center" v-if="lastPage > 1">
<v-pagination v-model="currentPage" :length="lastPage" :total-visible="6"></v-pagination>
</div>
<v-layout row wrap align-center justify-center class="mt-3">
<router-link to="/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>
</template>
<script>
import { ApiService } from "@/services";
import { urls } from "@/config/urls";
export default {
data: () => ({
headers: [
{
sortable: false,
text: "TestType Name",
value: "name"
},
{
sortable: false,
text: "TestType UniqueId",
value: "uniqueId"
},
{
sortable: false,
text: "Register TestType",
value: "users"
},
{
sortable: false,
text: "Date",
value: "date"
},
{
sortable: false,
text: "Action",
value: "action",
align: "right"
}
],
items: [],
currentPage: 1,
lastPage: 1
}),
created() {
this.getData();
},
methods: {
async getData(page = 1) {
const result = await ApiService.get(urls.listTestType(page));
this.items = result.data.data.data;
this.currentPage = result.data.data.current_page;
this.lastPage = result.data.data.last_page;
},
async remove(id) {
const result = await ApiService.delete(urls.deleteTestType(id));
if (result.status == 200) {
for (const key in this.items) {
if (this.items.hasOwnProperty(key) && this.items[key].id == id) {
this.items.splice(key, 1);
}
}
}
}
},
watch: {
currentPage(page) {
this.getData(page);
}
}
};
</script>
<style lang="css" scoped>
.WM-ActionButton {
padding: 8px 22px;
}
</style>
+203
View File
@@ -0,0 +1,203 @@
<template>
<v-container grid-list-xs>
<material-card
color="black"
title="Member List">
<v-layout align-center justify-center wrap class="px-5 mb-3">
<v-flex xs12 md3 sm3>
<v-text-field
class="pa-2"
color="black"
name="name"
label="Name"
></v-text-field>
</v-flex>
<v-flex xs12 md3 sm3>
<v-text-field
class="pa-2"
color="black"
name="date"
label="Date"
></v-text-field>
</v-flex>
<v-flex xs12 md3 sm3>
<v-text-field
class="pa-2"
color="black"
name="hospital"
label="Hospital"
></v-text-field>
</v-flex>
<v-flex xs12 md3 sm3>
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px">
<v-icon class="white--text mr-2 caption">fas fa-search</v-icon>
<span class="white--text">Filter</span>
</v-btn>
</v-flex>
</v-layout>
<v-layout class="px-4 my-3">
<v-divider></v-divider>
</v-layout>
<v-layout align-center justify-center wrap class="px-5 my-2">
<v-flex xs12 md12 sm12>
<v-data-table
:headers="headers"
:items="items"
hide-actions
>
<template
slot="headerCell"
slot-scope="{ header }">
<span
class="subheading font-weight-light text-white text--darken-3"
v-text="header.text"
/>
</template>
<template
slot="items"
slot-scope="{ item }">
<td class="headline font-weight-light">{{item.name}}</td>
<td class="title font-weight-light">{{item.created_at}}</td>
<td class="title font-weight-light">
<span v-for="(role, key) in item.roles" :key="key">{{ role.name }}</span>
</td>
<td class="title font-weight-light">{{item.medical_center.name}}</td>
<td class="text-xs-right">
<v-btn
:color="item.status == 'Active' ? 'red' : 'green'"
@click="changeStatus(item.id)"
class="mr-2 WM-ActionButton"
>
<template v-if="item.status == 'Active'">
<v-icon class="white--text mr-2 caption">fas fa-user-tag</v-icon>
<span v-if="item.status == 'Active'">Susspended</span>
</template>
<template v-else>
<v-icon class="white--text mr-2 caption">fas fa-user-tag</v-icon>
<span>Active</span>
</template>
</v-btn>
<v-btn
color="orange darken-1"
@click="changeRoleModal(item)"
class="mr-2 WM-ActionButton"
>
<v-icon class="white--text mr-2 caption">fas fa-user-tag</v-icon>
<span>Role</span>
</v-btn>
<v-btn color="pink" class="WM-ActionButton" @click="remove(item.id)">
<v-icon class="white--text mr-2 caption">fas fa-times</v-icon>
<span>Remove</span>
</v-btn>
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
<v-layout class="px-4 my-3">
<v-divider></v-divider>
</v-layout>
<v-layout row wrap align-center justify-center class="mt-3">
<router-link to="/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>
</template>
<script>
import { urls } from '@/config/urls'
import { ApiService } from '@/services'
import { mapMutations, mapGetters } from "vuex";
export default {
data: () => ({
headers : [
{
sortable : true,
text: 'Operator',
value: 'name'
},
{
sortable : false,
text: 'Date',
value: 'date'
},
{
sortable : false,
text: 'Role',
value: 'role'
},
{
sortable : true,
text: 'Hospital',
value: 'hospital'
},
{
sortable : false,
text: 'Action',
value: 'action',
align: 'right'
},
],
items: []
}),
created() {
this.load();
},
methods: {
async load() {
const result = await ApiService.get(urls.listOpertor );
if (result && result.status == 200) {
this.items = result.data.data.data;
} else {
this.$router.push({name:`Dashboard`});
}
},
async changeStatus(userId) {
const result = await ApiService.post(urls.changeStatusUser(userId));
if (result && result.status == 200) {
for (let user of this.items) {
if (user.id == userId) {
user.status = result.data.data.status;
}
}
} else {
this.$router.push({name:`Dashboard`});
}
},
...mapMutations("modal", ["changeCurrentModal"]),
changeRoleModal(user) {
this.changeCurrentModal({
modal: "modal-user-role",
properties: { user }
});
},
async remove(userId) {
const result = await ApiService.delete(urls.deleteUser(userId));
if (result && result.status == 200) {
for (const key in this.items) {
if (this.items.hasOwnProperty(key) && this.items[key].id == userId) {
this.items.splice(key, 1);
}
}
}
}
},
computed: {
...mapGetters("modal", ["getModalResult"])
},
watch: {
getModalResult(user) {
for (const userList of this.items) {
if (userList.id == user.id) {
userList.roles = user.roles;
}
}
}
}
}
</script>
@@ -86,6 +86,7 @@
<script>
import { ApiService } from "@/services";
import { urls } from "@/config/urls";
export default {
data() {
return {
@@ -116,9 +117,10 @@ export default {
methods: {
async saveInfo() {
if (this.$refs.form.validate()) {
const result = await ApiService.post("updateInfo", this.user);
const result = await ApiService.post(urls.updateInfo, this.user);
if (result && result.status == 200) {
this.$store.dispatch("info", {}, { root: true });
this.$router.push({ name: `Dashboard` });
}
}
}