change pack to label

This commit is contained in:
Fayyazi
2019-10-28 14:16:18 +03:30
parent 7c94a30254
commit dbd0ddc1d4
16 changed files with 254 additions and 112 deletions
@@ -56,6 +56,34 @@
<div class v-for="(pack, key) in data.packs" :key="key">
<span class="headline ml-2" style="letter-spacing:0 !important">{{ key+1 + ": " + pack.name }}</span>
</div>
<!-- <v-row justify="center mt-5">
<v-expansion-panels accordion class="WM-Relative WM-Panel">
<v-expansion-panel class="WM-PanelCategories"
v-for="(pack, key) in data.packs"
:key="key"
>
<v-expansion-panel-header>
<span class="headline ml-2">{{key+1}}</span>
<h2 style="margin-right:20px">{{ pack.name }}</h2>
<div class="ml-3" align="left">
</div>
</v-expansion-panel-header>
<v-expansion-panel-content>
<v-card-text style="padding:5px 30px">
<producer-category-item v-if="pack.children" :items="pack.children" @clicked="onClickChild"/>
</v-card-text>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
</v-row> -->
</v-flex>
</v-layout>
</v-layout>
@@ -1,7 +1,7 @@
<template>
<v-container grid-list-xs>
<material-card color="black" title="Show Package">
<material-card color="black" title="Show Label">
<v-layout align-left justify-left wrap class="px-5 my-3">
<h3 class="ml-3">Info</h3>
<v-flex xs12>
@@ -1,7 +1,7 @@
<template>
<v-container grid-list-xs>
<material-card color="black" id="printMe" title="Show Label">
<material-card color="black" id="printMe" title="Show Package">
<v-layout align-left justify-left wrap class="px-5 my-3">
<h3 class="ml-3">Info</h3>
<v-flex xs12>
@@ -46,13 +46,25 @@
<hr class="v-divider theme--light">
</v-flex>
<v-layout row wrap class="ml-4">
<v-flex xs12 md6 sm6>
<div class v-for="(item, key) in data.items" :key="key">
<span class="headline ml-2" style="letter-spacing:0 !important">{{ key+1 + ": " + item.name }}</span>
</div>
</v-flex>
<template>
<v-expansion-panel>
<v-expansion-panel-content
v-for="(item, key) in data.items" :key="key"
>
<template v-slot:header>
<div>{{ key+1 + ": " + item.name }}</div>
</template>
<v-card>
<v-card-text>count : {{ item.pivot.count }}</v-card-text>
<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 id="printMe" align-left justify-left wrap class="px-5 my-3">
<h3 class="ml-3">Barcode And QRCode Image</h3>
<v-flex xs12>
+13 -13
View File
@@ -9,7 +9,7 @@ const urls = {
statistics: `/TestResults/chart`,
storeTestType: "/TestTypes",
storePackage: "/Packages",
storePack: "/Packs",
storeLabel: "/Labels",
storeCycle: "/Cycles",
storeItem: "/Items",
listTestTypeName: "/TestTypes/ListNames",
@@ -111,20 +111,20 @@ const urls = {
verifyPackage: function(id) {
return `/Package/Verify/${id}`;
},
listPack: function(filter) {
return "/Packs" + filter;
listLabel: function(filter) {
return "/Labels" + filter;
},
showPack: function(id) {
return `/Packs/${id}`;
showLabel: function(id) {
return `/Labels/${id}`;
},
editPack: function(id) {
return `/Packs/${id}/edit`;
editLabel: function(id) {
return `/Labels/${id}/edit`;
},
updatePack: function(id) {
return `/Packs/${id}`;
updateLabel: function(id) {
return `/Labels/${id}`;
},
removePack: function(id) {
return `Packs/${id}`;
removeLabel: function(id) {
return `Labels/${id}`;
},
listCycle: function(filter) {
return "/Cycles" + filter;
@@ -153,8 +153,8 @@ const urls = {
listAllPackage: function() {
return "/GetPackages";
},
listAllPack: function() {
return "/GetPacks";
listAllLabel: function() {
return "/GetLabels";
},
showItem: function(id) {
return `/Items/${id}`;
+7 -7
View File
@@ -160,19 +160,19 @@ export default [
view: 'Package/AddEdit'
},
{
path: '/add-pack',
name: 'AddPack',
view: 'Pack/AddEdit'
path: '/add-label',
name: 'AddLabel',
view: 'Label/AddEdit'
},
{
path: '/labels',
name: 'AllLabels',
view: 'Pack/List'
view: 'Label/List'
},
{
path: '/pack/:pack/edit',
name: 'EditPack',
view: 'Pack/AddEdit'
path: '/label/:label/edit',
name: 'EditLabel',
view: 'Label/AddEdit'
},
{
path: '/add-cycle',
@@ -48,13 +48,12 @@
<v-flex xs12 sm6 md3 class="WM-FlexCenter">
<v-icon class="fas fa-check mr-2 WM-Margin-B-8"></v-icon>
<v-autocomplete
multiple
color="black"
:items="items"
item-text="name"
v-model="formData.packages"
v-model="formData.package_id"
item-value="id"
label="Select Package For Pack"
label="Select Package For Label"
class="py-3 pr-3"
></v-autocomplete>
</v-flex>
@@ -162,7 +161,7 @@ export default {
name: "",
result: "",
note: "",
packages: []
package_id: ""
},
items: [],
rules: {
@@ -176,14 +175,14 @@ export default {
};
},
created() {
if (this.$route.params.pack) {
this.load(this.$route.params.pack);
if (this.$route.params.label) {
this.load(this.$route.params.label);
}
this.loadItems();
},
methods: {
async load(id) {
const result = await ApiService.get(urls.editPack(id));
const result = await ApiService.get(urls.editLabel(id));
if (result.status == 200) {
this.formData = result.data.data;
}
@@ -196,14 +195,14 @@ export default {
},
async submitForm() {
let result;
if (this.$route.params.pack) {
if (this.$route.params.label) {
result = await ApiService.put(
urls.updatePack(this.$route.params.pack),
urls.updateLabel(this.$route.params.label),
this.formData
);
} else {
result = await ApiService.post(
urls.storePack,
urls.storeLabel,
this.formData
);
}
@@ -48,7 +48,7 @@
</v-flex>
<v-spacer></v-spacer>
<v-flex xs12 md2 sm2 class="text-xs-right">
<router-link :to="{name: 'AddPack'}">
<router-link :to="{name: 'AddLabel'}">
<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>
@@ -78,7 +78,7 @@
</v-btn>
<router-link
v-if="$hasRole('Admin') || item.user_id == $store.state.user.id"
:to="{name: 'EditPack', params: {pack: item.id}}"
:to="{name: 'EditLabel', params: {label: item.id}}"
>
<v-btn color="orange" class="mr-2">
<v-icon class="white--text mr-1 caption">fas fa-pen</v-icon>
@@ -175,7 +175,7 @@ export default {
}
}
filter += page ? `page=${page}` : `page=1`;
const result = await ApiService.get(urls.listPack(filter));
const result = await ApiService.get(urls.listLabel(filter));
if (result && result.status == 200) {
this.items = result.data.data.data;
this.currentPage = result.data.data.current_page;
@@ -198,17 +198,17 @@ export default {
}
},
async show(testResultId) {
const result = await ApiService.get(urls.showPack(testResultId));
const result = await ApiService.get(urls.showLabel(testResultId));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-pack-show",
modal: "modal-label-show",
properties: { result }
});
}
},
async remove(testResultId) {
const result = await ApiService.delete(
urls.removePack(testResultId)
urls.removeLabel(testResultId)
);
if (result && result.status == 200) {
for (const key in this.items) {
+48 -9
View File
@@ -14,19 +14,44 @@
class="py-3 pr-3"
></v-text-field>
</v-flex>
<v-flex xs12 md3 sm3 class="WM-FlexCenter pl-3">
<v-icon class="fas fa-check mr-2 WM-Margin-B-8"></v-icon>
<v-autocomplete
multiple
<!-- <v-row style="position: relative" v-for="(item, key) in formData.items" :key="key"> -->
<v-flex xs12 md3 sm3 class="WM-FlexCenter pl-3" style="position: relative" v-for="(item, key) in formData.items" :key="key">
<v-icon class="fas fa-check mr-2 WM-Margin-B-8"></v-icon>
<v-autocomplete
class="py-3 pr-3"
:items="items"
item-text="name"
v-model="formData.items"
v-model="item.id"
item-value="id"
label="Select Items For Package"
color="black"
></v-autocomplete>
</v-flex>
></v-autocomplete>
<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
absolute
small
left
bottom
color="red"
@click="removeForm(key)"
>
<v-icon class="white--text mr-2 caption">fas fa-remove</v-icon>REMOVE
</v-btn>
</v-flex>
<!-- </v-row> -->
</v-layout>
<v-layout align-center justify-center wrap class="px-5 mb-3">
<v-flex xs12 sm12 md12>
@@ -69,7 +94,11 @@ export default {
name: "",
result: "",
note: "",
items: []
items: [
{
name:''
}
]
},
items: [],
result: ["Pass", "Fail"],
@@ -119,7 +148,17 @@ export default {
if (result && result.status == 200) {
this.$router.push({ name: "AllPackage" });
}
}
},
duplicateForm(infoIndex) {
this.formData.items.push({
name: "",
});
},
removeForm(infoIndex) {
this.formData.items.splice(infoIndex, 1);
},
}
};
</script>