mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-13 00:31:07 +03:30
167 lines
6.2 KiB
Vue
167 lines
6.2 KiB
Vue
|
|
<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 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.showPackage(id));
|
|
console.log(result.data);
|
|
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.package) {
|
|
this.load(this.$route.params.package);
|
|
}
|
|
|
|
},
|
|
};
|
|
</script>
|