Edit MedicalCenter

This commit is contained in:
saeid_01
2019-04-21 01:13:16 +04:30
parent 5831a29686
commit fde21eeaa0
14 changed files with 2278 additions and 1617 deletions
+63 -61
View File
@@ -1,16 +1,9 @@
<template>
<v-container fluid>
<material-card class=""
color="black"
title="Medical Centers List"
text=""
>
<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-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">
@@ -25,49 +18,39 @@
<v-icon class="black--text mr-2 caption">fas fa-plus</v-icon>
<span class="black--text">Add</span>
</v-btn>
</router-link>
</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 }"
>
<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 }"
>
<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="title font-weight-light">{{ item.created_at }}</td>
<td class="title font-weight-light">{{ item.users_count }} Operator</td>
<td class="text-xs-right">
<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 to="/operator-list">
<router-link :to="`/medical-center/${item.id}/edit`">
<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>
<router-link :to="`/operator-list/${item.id}`">
<v-btn color="orange darken-1" class="mr-2 WM-ActionButton">
<v-icon class="white--text mr-2 caption">fas fa-user</v-icon>
<span>Operator</span>
</v-btn>
</router-link>
<v-btn color="pink" class=" WM-ActionButton">
<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>
@@ -77,6 +60,9 @@
</v-flex>
</v-layout>
<v-divider></v-divider>
<div class="text-xs-center">
<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">
@@ -90,52 +76,68 @@
</template>
<script>
import { ApiService } from "@/services";
import { log } from "util";
export default {
data: () => ({
headers: [
{
sortable: false,
text: 'Hospital Name',
value: 'name'
text: "Hospital Name",
value: "name"
},
{
sortable: false,
text: 'Date',
value: 'date'
text: "Date",
value: "date"
},
{
sortable: false,
text: 'Operator',
value: 'operator'
text: "Operator",
value: "operator"
},
{
sortable: false,
text: 'Action',
value: 'action',
align: 'right'
text: "Action",
value: "action",
align: "right"
}
],
items: [
{
name: 'Shahid Beheshti',
date: '12/05/1397',
operator: '3 Operator',
action: ''
},
{
name: 'Emam Reza',
date: '12/05/1397',
operator: '5 Operator',
action: ''
},
]
})
}
items: [],
currentPage: 1,
lastPage: 1
}),
created() {
this.getData();
},
methods: {
async getData(page = 1) {
const result = await ApiService.get("MedicalCenters?page=" + page);
this.items = result.data.MedicalCenters.data;
this.currentPage = result.data.MedicalCenters.current_page;
this.lastPage = result.data.MedicalCenters.last_page;
},
async remove(id) {
const result = await ApiService.delete("MedicalCenters/" + 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;
padding: 8px 22px;
}
</style>