Publish Role

This commit is contained in:
saeid_01
2019-05-13 06:41:02 +04:30
parent fc9dfeaf00
commit 76e18cca1d
77 changed files with 705 additions and 131638 deletions
+8 -4
View File
@@ -42,8 +42,9 @@
color="purple"
/>
</v-list-tile>
<template v-for="(link, i) in links" >
<v-list-tile
v-for="(link, i) in links"
v-if="!link.role || $hasRole(link.role)"
:key="i"
:to="link.to"
:active-class="color"
@@ -57,6 +58,7 @@
v-text="link.text"
/>
</v-list-tile>
</template>
<!-- <v-list-tile
disabled
active-class="primary"
@@ -104,12 +106,14 @@ export default {
{
to: {name: 'ManageUsers'},
icon: 'far fa-address-book',
text: 'Manage Users'
text: 'Manage Users',
role: 'Admin|Supervisor',
},
{
to: {name: 'ListTestType'},
icon: 'fas fa-vial',
text: 'List Test Type'
text: 'List Test Type',
role: 'Admin'
},
{
to: {name: 'SubmitTestResult'},
@@ -119,7 +123,7 @@ export default {
{
to: {name: 'Statistics'},
icon: 'fas fa-chart-bar',
text: 'Statistics'
text: 'Statistics',
},
],
responsive: false
@@ -111,7 +111,7 @@
</v-flex>
</v-layout>
</v-layout>
<v-layout row wrap align-center justify-center>
<v-layout row wrap align-center justify-center v-if="$hasRole('Admin|Supervisor')">
<v-flex
class
xs12
+33 -8
View File
@@ -18,6 +18,9 @@ export default [
path: '/manage-users',
name: 'ManageUsers',
view: 'User/List',
meta: {
roles: 'Admin|Supervisor'
}
},
{
path: '/test-type/create',
@@ -27,37 +30,58 @@ export default [
{
path: '/test-type/:testType/edit',
name: 'EditTestType',
view: 'TestType/AddEdit'
view: 'TestType/AddEdit',
meta: {
roles: 'Admin'
}
},
{
path: '/test-types',
name: 'ListTestType',
view: 'TestType/List'
view: 'TestType/List',
meta: {
roles: 'Admin'
}
},
{
path: '/medical-center',
name: 'ManageMedicalCenter',
view: 'MedicalCenter/List'
view: 'MedicalCenter/List',
meta: {
roles: 'Admin'
}
},
{
path: '/medical-center/create',
name: 'AddMedicalCenter',
view: 'MedicalCenter/AddEdit'
view: 'MedicalCenter/AddEdit',
meta: {
roles: 'Admin'
}
},
{
path: '/medical-center/:medicalCenter/edit',
name: 'EditMedicalCenter',
view: 'MedicalCenter/AddEdit'
view: 'MedicalCenter/AddEdit',
meta: {
roles: 'Admin'
}
},
{
path: '/add-operator/:medicalCenter',
name: 'AddOperator',
view: 'Auth/Register'
view: 'Auth/Register',
meta: {
roles: 'Admin'
}
},
{
path: '/operator-list/:medicalCenter',
name: 'OperatorList',
view: 'MedicalCenter/OperatorList'
view: 'MedicalCenter/OperatorList',
meta: {
roles: 'Admin'
}
},
{
path: '/login',
@@ -74,7 +98,8 @@ export default [
view: 'Auth/Register',
meta: {
public: true, // Allow access to even if not logged in
onlyWhenLoggedOut: true
onlyWhenLoggedOut: true,
roles: 'Admin'
}
},
{
+8 -5
View File
@@ -6,7 +6,8 @@
text=""
>
<v-layout row wrap >
<v-flex v-for="(Card, Key ) in Cards" :class="[Card.column , 'pa-2']" :key="Key">
<template v-for="(Card, Key ) in Cards">
<v-flex v-if="!Card.role || $hasRole(Card.role)" :class="[Card.column , 'pa-2']" :key="Key">
<router-link :to="Card.route">
<material-cards
:title="Card.title"
@@ -18,6 +19,8 @@
/>
</router-link>
</v-flex>
</template>
</v-layout>
</material-card>
</v-container>
@@ -30,10 +33,10 @@ export default {
Cards :[
{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: 'NotVerifyTestResult'},aligntext:'text-md-center',alignimg:'text-md-left',column:'xs12 md12 sm12'},
{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:'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:'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'},
]
}
+3 -2
View File
@@ -40,7 +40,7 @@
</template>
<template slot="items" slot-scope="{ item }">
<td class="headline font-weight-light">{{ item.autoclave_id }}</td>
<td class="title font-weight-light">{{ item.test_type.name }}</td>
<td class="title font-weight-light">{{ item.test_type ? item.test_type.name : 'Archived Test' }}</td>
<td class="title font-weight-light" >{{ item.user.medical_center.name }}</td>
<td class="title font-weight-light">{{ item.user.name }}</td>
<td class="title font-weight-light">{{ item.result }}</td>
@@ -51,7 +51,7 @@
<v-icon class="white--text mr-1 caption">fas fa-eye</v-icon>
<span>Show</span>
</v-btn>
<router-link
<router-link v-if="$hasRole('Admin') || item.user_id == $store.state.user.id"
:to="{name: 'EditTestResult', params: {testResult: item.id}}"
>
<v-btn color="orange" class="mr-2">
@@ -63,6 +63,7 @@
color="pink"
class="WM-ActionButton"
@click="remove(item.id)"
v-if="$hasRole('Admin') || item.user_id == $store.state.user.id"
>
<v-icon class="white--text mr-2 caption">fas fa-times</v-icon>
<span>Remove</span>
+5 -2
View File
@@ -56,7 +56,8 @@
<template
slot="items"
slot-scope="{ item }">
<td class="headline font-weight-light">{{item.name}}</td>
<td class="headline font-weight-light">{{item.name}}<br />
<span class="WM-Font-14" >{{item.cell_number}}</span></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>
@@ -67,6 +68,7 @@
:color="item.status == 'Active' ? 'red' : 'green'"
@click="changeStatus(item.id)"
class="mr-2 WM-ActionButton"
v-if="$hasRole('Admin|Supervisor')"
>
<template v-if="item.status == 'Active'">
<v-icon class="white--text mr-2 caption">fas fa-user-tag</v-icon>
@@ -81,11 +83,12 @@
color="orange darken-1"
@click="changeRoleModal(item)"
class="mr-2 WM-ActionButton"
v-if="$hasRole('Admin')"
>
<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-btn color="pink" v-if="$hasRole('Admin')" 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>