update label show

This commit is contained in:
Fayyazi
2019-11-09 14:13:52 +03:30
parent 2306aca310
commit ac9eae8b5c
27 changed files with 867 additions and 141 deletions
+37
View File
@@ -0,0 +1,37 @@
<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']),
}
</script>
<style lang="scss">
@import '@/styles/index.scss';
@import '@/styles/css/Assets/Main.scss';
@import '@/styles/css/Assets/WM-ModernTheme.scss';
/* Remove in 1.2 */
.v-datatable thead th.column.sortable i {
vertical-align: unset;
}
</style>
+8
View File
@@ -0,0 +1,8 @@
const urls = {
showPackage: function(id) {
return `/Packages/${id}`;
},
};
export { urls };
+6
View File
@@ -0,0 +1,6 @@
const roles = [
'Admin',
'User',
'Supervisor',
];
export { roles };
+55
View File
@@ -0,0 +1,55 @@
import 'font-awesome/css/font-awesome.min.css'
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'
// 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,
// store,
render: h => h(App),
iconfont: 'fa4'
}).$mount('#app');
+96
View File
@@ -0,0 +1,96 @@
/**
* Vue Router
*
* @library
*
* https://router.vuejs.org/en/
*/
// 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'
// Routes
import paths from './paths'
function route (options) {
let path = options.path;
let view = options.view;
let name = options.name;
let meta = (options.meta) ? options.meta : '';
return {
name: name || view,
path,
meta,
component: (resovle) => import(
`@show/views/${view}.vue`
).then(resovle)
}
}
Vue.use(Router)
// 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)
// 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();
// });
// 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
+18
View File
@@ -0,0 +1,18 @@
/**
* Define all of your application routes here
* for more information on routes, see the
* official documentation https://router.vuejs.org/en/
*/
export default [
{
path: '/',
name: 'home',
view: 'Package/ShowPackage'
},
{
path: '/Show/Package/:package',
name: 'ShowPackage',
view: 'Package/ShowPackage'
},
]
@@ -0,0 +1,175 @@
<template>
<v-container grid-list-xs>
<material-card color="black" title="Show Package">
<v-layout id="printMe" 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>
<v-flex xs12 md6 sm6 v-if="QRCodeimg">
<img :src="QRCodeimg">
</v-flex>
</div>
</v-flex> -->
<v-flex xs12 md6 sm6>
<div class>
<span class="title">Name :</span>
<span class="headline ml-1" style="letter-spacing:0 !important">{{ data.name }}</span>
</div>
</v-flex>
<v-flex xs12 md6 sm6>
<div class>
<span class="title">Description :</span>
<span class="headline ml-1" style="letter-spacing:0 !important">{{ data.note }}</span>
</div>
</v-flex>
<v-flex xs12 md6 sm6>
<div class>
<span class="title">Register User :</span>
<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>
<span class="title">Date :</span>
<span class="headline ml-2" style="letter-spacing:0 !important">{{ data.created_at }}</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">Items</h3>
<v-flex xs12>
<hr class="v-divider theme--light">
</v-flex>
<v-layout row wrap class="ml-4">
<template>
<v-expansion-panel class="WM-Panel">
<v-expansion-panel-content
v-for="(item, key) in data.items" :key="key"
>
<template v-slot:header>
<div>{{ key+1 + ": " + 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>
</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 { mapGetters, mapMutations } from "vuex";
import { ApiService } from "@/services";
import { urls } from "./config/urls";
export default {
data: () => ({
data : {},
barcodeimg : '',
QRCodeimg : ''
}),
methods: {
async load(id) {
const result = await ApiService.get(urls.showPackage(id));
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));
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.package) {
this.load(this.$route.params.package);
}
},
computed: {
...mapGetters("modal", ["getModalProperties"])
}
};
</script>