change label show

This commit is contained in:
Fayyazi
2019-11-16 14:01:55 +03:30
parent ac9eae8b5c
commit b81ec9326f
37 changed files with 3602 additions and 239 deletions
+2 -19
View File
@@ -1,35 +1,18 @@
<template>
<v-app>
<!-- <core-filter /> -->
<!-- <core-modal />
<core-toolbar v-if="accessToken" />
<core-drawer v-if="accessToken" /> -->
<core-view />
</v-app>
</template>
<script>
// import { TokenService } from '@/services';
// import { mapState } from 'vuex';
export default {
data() {
return {
};
},
// computed: mapState('auth', ['accessToken']),
}
export default {}
</script>
<style lang="scss">
@import '@/styles/index.scss';
@import '@/styles/css/Assets/Main.scss';
@import '@/styles/css/Assets/WM-ModernTheme.scss';
// @import '@/fontello/fontello-embedded.css';
/* Remove in 1.2 */
.v-datatable thead th.column.sortable i {
vertical-align: unset;
+16
View File
@@ -0,0 +1,16 @@
import Vue from 'vue'
import upperFirst from 'lodash/upperFirst'
import camelCase from 'lodash/camelCase'
const requireComponent = require.context(
'@show/components', true, /\.vue$/
)
requireComponent.keys().forEach(fileName => {
const componentConfig = requireComponent(fileName)
const componentName = upperFirst(
camelCase(fileName.replace(/^\.\//, '').replace(/\.\w+$/, ''))
)
Vue.component(componentName, componentConfig.default || componentConfig)
})
+7 -2
View File
@@ -1,8 +1,13 @@
const urls = {
showPackage: function(id) {
return `/Packages/${id}`;
return `/ShowPackage/${id}`;
},
showCycle: function(id) {
return `/ShowCycle/${id}`;
},
Barcode: function(code) {
return `/BarCode/${code}`;
},
};
export { urls };
+1 -35
View File
@@ -3,49 +3,15 @@ import Vue from 'vue'
// Components
import '@/components'
// Plugins
// import './plugins'
import '@/plugins/vuetify'
// Material FontIcon
import 'material-design-icons-iconfont/dist/material-design-icons.css'
import '@/fontello/fontello-embedded.css'
// Fortawesome
import '@fortawesome/fontawesome-free/css/all.css'
// Sync router with store
// import { sync } from 'vuex-router-sync'
// Application imports
import App from './App.vue'
// import i18n from '@/i18n'
import router from './router'
// import store from '@/store'
// import { ApiService, TokenService } from '@/services'
// Sync store with router
// sync(store, router)
// Vue.config.productionTip = false
// ApiService.setHeader();
// Set the base URL of the API
// ApiService.init(process.env.MIX_APP_ROOT_API)
// require('./services/global/errorHandler.service');
// If token exists set Authorizion header
// if (TokenService.getToken()) {
// ApiService.setAuthHeader();
//
// // If info exists set info in Store
// if(TokenService.getInfo()) {
// let info = TokenService.getInfo();
// store.commit('setInfo', info);
// } else {
// store.dispatch('info');
// }
// }
// import hasRole from '@/services/mixin/hasRole'
// Vue.mixin(hasRole)
/* eslint-disable no-new */
new Vue({
// i18n,
router,
+12 -51
View File
@@ -8,10 +8,8 @@
// Lib imports
import Vue from 'vue'
// import VueAnalytics from 'vue-analytics'
import Router from 'vue-router'
// import Meta from 'vue-meta'
// import { TokenService } from '@/services'
import Meta from 'vue-meta'
// Routes
import paths from './paths'
@@ -32,65 +30,28 @@ function route (options) {
}
Vue.use(Router)
console.log(paths);
// Create a new router
const router = new Router({
mode: 'history',
routes: paths.map(path => route(path)).concat([
{ path: '*', redirect: '/' }
]),
// scrollBehavior (to, from, savedPosition) {
// if (savedPosition) {
// return savedPosition
// }
// if (to.hash) {
// return { selector: to.hash }
// }
// return { x: 0, y: 0 }
// }
})
// Vue.use(Meta)
Vue.use(Meta)
// import {$hasRole} from '@/services/acl/role';
// router.beforeEach((to, from, next) => {
// const isPublic = to.matched.some(record => record.meta.public);
// const onlyWhenLoggedOut = to.matched.some(record => record.meta.onlyWhenLoggedOut);
// const loggedIn = !!TokenService.getToken();
// const roles = (to.meta && to.meta.roles) ? to.meta.roles : null;
//
// if (!isPublic && !loggedIn) {
// return next({
// path:'/login',
// query: {redirect: to.fullPath} // Store the full path to redirect the user to after login
// });
// }
//
// // Do not allow user to visit login page or register page if they are logged in
// if (loggedIn && onlyWhenLoggedOut && policy) {
// return next('/')
// }
//
// // Do not allow user to visit Pages then not access roles
// if (roles && !$hasRole(roles)) {
// return next('/')
// }
//
// next();
// });
router.beforeEach((to, from, next) => {
const isPublic = to.matched.some(record => record.meta.public);
const onlyWhenLoggedOut = to.matched.some(record => record.meta.onlyWhenLoggedOut);
const roles = (to.meta && to.meta.roles) ? to.meta.roles : null;
// Do not allow user to visit Pages then not access roles
next();
});
// Bootstrap Analytics
// Set in .env
// https://github.com/MatteoGabriele/vue-analytics
// if (process.env.GOOGLE_ANALYTICS) {
// Vue.use(VueAnalytics, {
// id: process.env.GOOGLE_ANALYTICS,
// router,
// autoTracking: {
// page: process.env.NODE_ENV !== 'development'
// }
// })
// }
export default router
+5
View File
@@ -15,4 +15,9 @@ export default [
name: 'ShowPackage',
view: 'Package/ShowPackage'
},
{
path: '/Show/Cycle/:cycle',
name: 'ShowCycle',
view: 'Cycle/ShowCycle'
},
]
+191
View File
@@ -0,0 +1,191 @@
<template>
<v-container grid-list-xs>
<material-card id="printMe" color="black" title="Show Cycle">
<v-layout align-left justify-left wrap class="px-5 my-3">
<h3 class="ml-3">Info</h3>
<v-flex xs12>
<hr class="v-divider theme--light">
</v-flex>
<v-layout row wrap class="ml-4">
<v-flex xs12 md6 sm6>
<div class="WM-d-flex">
<v-icon class="WMi-sort-numeric-up"></v-icon>
<span class="headline ml-1" style="letter-spacing:0 !important">{{ data.id }}</span>
</div>
</v-flex>
<v-flex xs12 md6 sm6>
<div>
<span class="title">Sterilizer ID :</span>
<span class="headline ml-1" style="letter-spacing:0 !important">{{ data.sterilizer_id }}</span>
</div>
</v-flex>
<v-flex xs12 md6 sm6>
<div class="WM-d-flex">
<v-icon class="WMi-user"></v-icon>
<span class="headline ml-2" style="letter-spacing:0 !important">{{ (typeof data.user != 'undefined') ? data.user.name : '' }}</span>
</div>
</v-flex>
<v-flex xs12 md6 sm6>
<div class="WM-d-flex">
<v-icon class="WMi-pencil"></v-icon>
<span class="headline ml-1" style="letter-spacing:0 !important">{{ data.note }}</span>
</div>
</v-flex>
<v-flex xs12 md6 sm6>
<div class="WM-d-flex">
<v-icon class="WMi-Industry"></v-icon>
<span class="headline ml-2" style="letter-spacing:0 !important">{{ data.date }}</span>
</div>
</v-flex>
</v-layout>
<v-layout align-left justify-left wrap class="px-5 my-3">
<h3 class="ml-3">Barcode And QRCode Image</h3>
<v-flex xs12>
<hr class="v-divider theme--light">
</v-flex>
<v-layout row wrap class="ml-4">
<v-flex xs12 md6 sm6 v-if="barcodeimg">
<img :src="barcodeimg"><br />
<span>{{data.unique_id}}</span>
</v-flex>
</v-layout>
<v-layout row wrap class="ml-4">
<v-flex xs12 md6 sm6 v-if="QRCodeimg">
<img :src="QRCodeimg">
</v-flex>
</v-layout>
</v-layout>
</v-layout>
<v-layout align-left justify-left wrap class="px-5 my-3">
<h3 class="ml-3">Labels</h3>
<v-flex xs12>
<hr class="v-divider theme--light">
</v-flex>
<v-layout row wrap style="margin-left: 20px !important;">
<template>
<v-expansion-panel class="WM-Panel" v-for="(label, key) in data.labels" :key="key">
<v-expansion-panel-content>
<template v-slot:header>
<div>{{ label.id }} ({{ label.pivot.count }})</div>
</template>
<v-card>
<v-card-text> Package :
<v-expansion-panel class="WM-Panel">
<v-expansion-panel-content>
<template v-slot:header>
<div>{{ label.package.name }} </div>
</template>
<v-card>
<v-card-text>note : {{ label.package.note }}</v-card-text>
<v-card-text>
Items :
<v-expansion-panel class="WM-Panel" v-for="item in label.package.items" :key="item.key">
<v-expansion-panel-content>
<template v-slot:header>
<div>{{ item.name }} ({{ item.pivot.count }})</div>
</template>
<v-card>
<v-card-text>note : {{ item.note }}</v-card-text>
</v-card>
</v-expansion-panel-content>
</v-expansion-panel>
</v-card-text>
</v-card>
</v-expansion-panel-content>
</v-expansion-panel>
</v-card-text>
</v-card>
</v-expansion-panel-content>
</v-expansion-panel>
</template>
</v-layout>
</v-layout>
<v-layout row wrap align-center justify-center>
<v-flex class xs12 md2 sm2 @click="print" >
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px">
<v-icon class="white--text mr-2 caption">fas fa-print</v-icon>
<span class="white--text">Print</span>
</v-btn>
</v-flex>
</v-layout>
</material-card>
</v-container>
</template>
<script>
import axios from "axios";
import { urls } from "@show/config/urls";
export default {
data: () => ({
data : {},
barcodeimg : '',
QRCodeimg : ''
}),
methods: {
async load(id) {
const result = await axios.get(urls.showCycle(id));
if (result.status == 200) {
this.data = result.data.data;
this.generateBarcode(this.data.unique_id);
}
},
async generateBarcode(packageId) {
const result = await axios.post(urls.Barcode(packageId));
if (result && result.status == 200) {
this.QRCodeimg = result.data.data.QRCode ? result.data.data.QRCode : null;
this.barcodeimg = result.data.data.Barcode ? result.data.data.Barcode : null;
}
},
print() {
const prtHtml = document.getElementById("printMe").innerHTML;
// Get all stylesheets HTML
let stylesHtml = "";
for (const node of [
...document.querySelectorAll('link[rel="stylesheet"], style')
]) {
stylesHtml += node.outerHTML;
}
// Open the print window
const WinPrint = window.open(
"",
"",
"left=0,top=0,width=800,height=900,toolbar=0,scrollbars=0,status=0"
);
WinPrint.document.write(`<!DOCTYPE html>
<html>
<head>
${stylesHtml}
</head>
<body>
${prtHtml}
</body>
</html>`);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
}
},
created() {
if (this.$route.params.cycle) {
this.load(this.$route.params.cycle);
}
},
};
</script>
@@ -97,9 +97,8 @@
</template>
<script>
import { mapGetters, mapMutations } from "vuex";
import { ApiService } from "@/services";
import { urls } from "./config/urls";
import axios from "axios";
import { urls } from "@show/config/urls";
export default {
data: () => ({
data : {},
@@ -108,21 +107,16 @@ export default {
}),
methods: {
async load(id) {
const result = await ApiService.get(urls.showPackage(id));
const result = await axios.get(urls.showPackage(id));
console.log(result.data);
if (result.status == 200) {
this.data = result.data.data;
this.generateBarcode(this.data.unique_id);
}
},
async verify(id) {
const result = await ApiService.post(urls.verifyPackage(id));
if (result && result.status == 200) {
this.setResultModal(result.data.data);
this.closeModal();
}
},
async generateBarcode(packageId) {
const result = await ApiService.post(urls.Barcode(packageId));
const result = await axios.post(urls.Barcode(packageId));
if (result && result.status == 200) {
this.QRCodeimg = result.data.data.QRCode ? result.data.data.QRCode : null;
this.barcodeimg = result.data.data.Barcode ? result.data.data.Barcode : null;
@@ -168,8 +162,5 @@ export default {
}
},
computed: {
...mapGetters("modal", ["getModalProperties"])
}
};
</script>