This commit is contained in:
sajjad
2023-10-18 01:22:06 -07:00
parent b16da8ab41
commit 98aa208766
157 changed files with 28673 additions and 13308 deletions
+227
View File
@@ -0,0 +1,227 @@
<template>
<v-form ref="form">
<v-container grid-list-xs fluid>
<material-card color="black" title="Add Cycle">
<v-layout wrap class="px-5 my-3">
<v-flex xs12 sm6 md4 class="WM-FlexCenter pl-3">
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"></v-icon>
<v-text-field
name="sterilizer_id"
label="Sterilizer ID"
color="black"
v-model="formData.sterilizer_id"
class="py-3 pr-3"
></v-text-field>
</v-flex>
<v-flex xs12 sm6 md4 class="WM-FlexCenter pl-3">
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"></v-icon>
<v-text-field
name="cycle_number"
label="Cycle Number"
color="black"
v-model="formData.cycle_number"
class="py-3 pr-3"
></v-text-field>
</v-flex>
<v-flex xs12 sm6 md4 class="WM-FlexCenter">
<v-icon class="far fa-calendar-alt mr-2"></v-icon>
<v-menu
lazy
:close-on-content-click="true"
transition="v-scale-transition"
offset-y
v-model="fromMenuDate"
>
<v-text-field
required
slot="activator"
label="Date"
color="black"
class="pr-3"
v-model="formData.date">
</v-text-field>
<v-date-picker
color="pink"
no-title
v-model="formData.date"
:date-format="date => new Date(date).toDateString()"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs12></v-flex>
<v-flex xs12 sm6 md4 class="WM-FlexCenter WM-DuplicateInput" style="position: relative" v-for="(label, key) in formData.labels" :key="key">
<div class="Inner">
<v-icon class="fa fa-check mr-2 WM-Margin-B-8"></v-icon>
<v-autocomplete
color="black"
:items="labels"
item-text="id"
item-value="id"
v-model="label.id"
label="Select Label For Cycle"
></v-autocomplete>
<!-- <v-text-field
name="labels"
label="Label ID"
color="black"
v-model="label.id"
class="py-3 pr-3"
></v-text-field> -->
<v-btn
absolute
small
right
bottom
color="cyan"
@click="duplicateForm(key)"
>
<v-icon class="white--text mr-2 caption">fas fa-plus</v-icon>ADD
</v-btn>
<v-btn v-if="key > 0"
absolute
small
right
top
color="pink"
@click="removeForm(key)"
>
<v-icon class="white--text mr-2 caption">fas fa-remove</v-icon>REMOVE
</v-btn>
</div>
</v-flex>
<v-spacer></v-spacer>
<v-flex xs12>
<hr class="v-divider theme--light" style="margin:30px 0 0 0 !important">
</v-flex>
<v-flex xs12 sm12 md12 class="WM-FlexCenter">
<!-- <v-icon class="fa fa-sort-amount-desc mr-2"></v-icon> -->
<v-textarea color="black" v-model="formData.note" class="py-3 pr-3" name="address">
<template v-slot:label>
<div>Description</div>
</template>
</v-textarea>
</v-flex>
</v-layout>
<v-layout row wrap justify-center align-center>
<v-flex xs12 md2 sm2 class="text-md-center text-xs-center">
<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>
</v-flex>
<v-flex xs12 md2 sm2 class="text-md-center text-sm-center text-xs-center">
<router-link :to="{name: 'AllCycle'}">
<v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black">
<v-icon class="black--text">keyboard_arrow_left</v-icon>
<span class="black--text">Back</span>
</v-btn>
</router-link>
</v-flex>
</v-layout>
</material-card>
</v-container>
</v-form>
</template>
<script>
import { ApiService } from "@/services";
import { urls } from "@/config/urls";
import { mapMutations } from "vuex";
export default {
data() {
return {
fromMenuDate: false,
formData: {
note: "",
labels: [
{
name:''
}
]
},
labels: [],
rules: {
required: value => !!value || "Required.",
counter: value =>
!value ||
value.length == 0 ||
value.length >= 5 ||
"Min 5 characters"
}
};
},
created() {
if (this.$route.params.cycle) {
this.load(this.$route.params.cycle);
}
this.loadLabels();
},
methods: {
async load(id) {
const result = await ApiService.get(urls.editCycle(id));
if (result.status == 200) {
this.formData = result.data.data;
}
},
async loadLabels() {
const result = await ApiService.get(urls.listAllLabel());
if (result.status == 200) {
this.labels = result.data.data;
}
},
async submitForm() {
let result;
if (this.$route.params.cycle) {
result = await ApiService.put(
urls.updateCycle(this.$route.params.cycle),
this.formData
);
} else {
result = await ApiService.post(
urls.storeCycle,
this.formData
);
}
if (result && result.status == 200) {
this.$router.push({ name: "AllCycle" });
}
},
duplicateForm(infoIndex) {
this.formData.labels.push({
name: "",
});
},
removeForm(infoIndex) {
this.formData.labels.splice(infoIndex, 1);
},
}
};
</script>
<style>
.v-btn--floating {
padding: 0!important;
}
.theme--light.v-btn.v-btn--flat {
color: rgba(0,0,0,.87)!important;
}
.v-btn--floating, .v-btn--icon:before {
border-radius: 50%!important;
}
.WM-DuplicateInput {
margin: 15px 0;
}
.WM-DuplicateInput .Inner {
padding: 15px 20px !important;
margin: 0 10px 0 0;
width: 100%;
border: 1px solid rgba(0,0,0,.2);
}
</style>
+312
View File
@@ -0,0 +1,312 @@
<template>
<div class>
<v-container fluid>
<material-card class color="black" title="All Cycles" text>
<v-layout align-center wrap class="px-5 my-3">
<v-flex xs12 md2 sm3 class="WM-FlexCenter">
<v-icon class="fa fa-align-left mr-2 WM-Margin-B-8"></v-icon>
<v-text-field
class="py-3 pr-3"
v-model="filter.cycle_id"
label="Cycle ID"
color="black"
></v-text-field>
</v-flex>
<v-flex xs12 md2 sm3 class="WM-FlexCenter pl-3">
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"></v-icon>
<v-text-field
class="py-3 pr-3"
v-model="filter.sterilizer_id"
label="Sterilizer ID"
color="black"
></v-text-field>
</v-flex>
<v-flex xs12 md2 sm3 class="WM-FlexCenter pl-3">
<v-icon class="fas fa-sort-numeric-up mr-2 WM-Margin-B-8"></v-icon>
<v-text-field
class="py-3 pr-3"
v-model="filter.cycle_number"
label="Cycle Number"
color="black"
></v-text-field>
</v-flex>
<v-flex xs12 md3 sm3 class="WM-FlexCenter pl-3" v-if="$hasRole('Admin')">
<v-icon class="fa fa-hospital-o mr-2 WM-Margin-B-8"></v-icon>
<v-autocomplete
class="py-3 pr-3"
v-model="filter.medical_center_id"
item-text="name"
item-value="id"
label="Hospital"
color="black"
:items="medicalCenters"
:clearable="true"
></v-autocomplete>
</v-flex>
<v-flex xs12 sm2 md2 class="WM-FlexCenter pl-3">
<v-icon class="far fa-calendar-alt mr-2 WM-Margin-B-8"></v-icon>
<v-menu
lazy
:close-on-content-click="true"
transition="v-scale-transition"
offset-y
v-model="Menu"
>
<v-text-field style="padding-top:0 !important"
required
slot="activator"
label="Date"
color="black"
class=""
v-model="filter.date">
</v-text-field>
<v-date-picker
color="pink"
no-title
v-model="filter.date"
:date-format="date => new Date(date).toDateString()"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex class xs12 md2 sm3>
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px" @click="load()">
<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: 'AddCycle'}">
<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 wrap class="px-5 my-3">
<v-flex md12>
<v-data-table :headers="headers" :items="packages" 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.id }}</td>
<td
class="title font-weight-light"
>{{ (item.user && item.user.medical_center) ? item.user.medical_center.name : '' }}</td>
<td class="title font-weight-light">{{ item.sterilizer_id }}</td>
<td class="title font-weight-light">{{ item.cycle_number }}</td>
<td class="title font-weight-light">{{ item.date }}</td>
<td class="text-xs-right FlexBtn Height-MD-60">
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn v-bind="attrs" v-on="on" color="cyan" class="mr-2" @click="show(item.id)">
<v-icon class="white--text mr-1 caption">fas fa-eye</v-icon>
<span>Show</span>
</v-btn>
</template>
<span>Show</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<router-link
class="LinkBtn"
v-if="$hasRole('Admin') || item.user_id == $store.state.user.id"
:to="{name: 'EditCycle', params: {cycle: item.id}}"
>
<v-btn v-bind="attrs" v-on="on" color="orange" class="mr-2">
<v-icon class="white--text mr-1 caption">fas fa-pen</v-icon>
<span>Edit</span>
</v-btn>
</router-link>
</template>
<span>Edit</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn
v-bind="attrs" v-on="on"
color="pink"
class="WM-ActionButton mr-2"
@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>
</v-btn>
</template>
<span>Remove</span>
</v-tooltip>
<v-tooltip bottom open-on-hover>
<template v-slot:activator="{ on, attrs }">
<v-btn
v-bind="attrs" v-on="on"
color="orange darken-1"
@click="generateBarcode(item.id, 'Cycle')">
<v-icon class="white--text mr-1 caption">fas fa-barcode</v-icon>
<span>Generate Barcode</span>
</v-btn>
</template>
<span>Generate Barcode</span>
</v-tooltip>
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
<v-divider></v-divider>
<div class="text-xs-center mt-2" v-if="lastPage > 1">
<v-pagination color="black" 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>
</div>
</template>
<script>
import { ApiService } from "@/services";
import { urls } from "@/config/urls";
import { mapMutations, mapGetters } from "vuex";
export default {
data: () => ({
headers: [
{
sortable: true,
text: "Cycle ID",
value: "Cycle ID"
},
{
sortable: true,
text: "Hospital",
value: "Hospital"
},
{
sortable: true,
text: "Sterilizer ID",
value: "Sterilizer ID"
},
{
sortable: false,
text: "Cycle Number",
value: "Cycle Number"
},
{
sortable: false,
text: "Date",
value: "date"
},
{
sortable: false,
text: "Action",
value: "action",
align: "left"
}
],
filter: {},
Menu: false,
packages: [],
currentPage: 1,
lastPage: 1,
medicalCenters: []
}),
created() {
this.load();
},
methods: {
...mapMutations("modal", ["changeCurrentModal"]),
async load(page = 1) {
let filter = '?';
for (const key in this.filter) {
if (this.filter.hasOwnProperty(key)) {
filter += `${key}=${this.filter[key]}&`;
}
}
filter += (page) ? `page=${page}` : `page=1`;
const result = await ApiService.get(
urls.listCycle(filter)
);
if (result && result.status == 200) {
this.packages = result.data.data.data;
this.currentPage = result.data.data.current_page;
this.lastPage = result.data.data.last_page;
}
this.loadMedicalCenters();
},
async show(testResultId) {
const result = await ApiService.get(
urls.showCycle(testResultId)
);
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-cycle-show",
properties: { result }
});
}
},
async generateBarcode(code, type) {
const result = await ApiService.post(urls.Barcode(code, type));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-barcode-barcode",
properties: { result }
});
}
},
async remove(testResultId) {
const result = await ApiService.delete(
urls.removeCycle(testResultId)
);
if (result && result.status == 200) {
for (const key in this.packages) {
if (
this.packages.hasOwnProperty(key) &&
this.packages[key].id == testResultId
) {
this.packages.splice(key, 1);
}
}
}
},
async loadMedicalCenters() {
const result = await ApiService.get(urls.listFilterItemsTestResult);
if (result && result.status == 200) {
this.medicalCenters = result.data.data.MedicalCenters;
}
},
},
computed: {
...mapGetters("modal", ["getModalResult"])
},
watch: {
currentPage(page) {
this.load(page);
}
}
};
</script>
<style>
.v-btn--floating {
padding: 0!important;
}
.theme--light.v-btn.v-btn--flat {
color: rgba(0,0,0,.87)!important;
}
.v-btn--floating, .v-btn--icon:before {
border-radius: 50%!important;
}
</style>