update item & package & label & cycle

This commit is contained in:
Fayyazi
2019-10-30 14:19:47 +03:30
parent dbd0ddc1d4
commit da3dd22ec5
19 changed files with 292 additions and 109 deletions
@@ -47,44 +47,53 @@
</v-layout>
</v-layout>
<v-layout align-left justify-left wrap class="px-5 my-3">
<h3 class="ml-3">Packs</h3>
<h3 class="ml-3">Labels</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-for="(pack, key) in data.packs" :key="key">
<span class="headline ml-2" style="letter-spacing:0 !important">{{ key+1 + ": " + pack.name }}</span>
</div>
<template>
<v-expansion-panel v-for="(label, key) in data.labels" :key="key">
<v-expansion-panel-content>
<template v-slot:header>
<div>{{ label.name }}</div>
</template>
<v-card>
<v-card-text>count : {{ label.pivot.count }}</v-card-text>
<v-card-text>note : {{ label.note }}</v-card-text>
<v-card-text> Package :
<v-expansion-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 v-for="item in label.package.items" :key="item.key">
<v-expansion-panel-content>
<template v-slot:header>
<div>{{ 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>
<!-- <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">
</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>
</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>
</material-card>
@@ -59,16 +59,39 @@
</v-layout>
</v-layout>
<v-layout align-left justify-left wrap class="px-5 my-3">
<h3 class="ml-3">Items</h3>
<h3 class="ml-3">Package</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="data.packages">
<div class v-for="(item, key) in data.packages" :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>
<template v-slot:header>
<div>{{ data.package.name }}</div>
</template>
<v-card>
<v-card-text>note : {{ data.package.note }}</v-card-text>
<v-card-text> Items :
<v-expansion-panel v-for="item in data.package.items" :key="item.key">
<v-expansion-panel-content>
<template v-slot:header>
<div>{{ 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>
</v-card-text>
</v-card>
</v-expansion-panel-content>
</v-expansion-panel>
</template>
</v-layout>
</v-layout>
</material-card>
+46 -13
View File
@@ -34,7 +34,7 @@
class="py-3 pr-3"
></v-text-field>
</v-flex>
<v-flex xs12 sm6 md1 class="WM-FlexCenter">
<v-flex xs12 sm6 md4 class="WM-FlexCenter">
<v-icon class="far fa-calendar-alt mr-2"></v-icon>
<v-menu
lazy
@@ -59,17 +59,37 @@
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs12 sm6 md8 class="WM-FlexCenter pl-3">
<v-flex xs12 sm6 md4 class="WM-FlexCenter pl-3" style="position: relative" v-for="(label, key) in formData.labels" :key="key">
<v-icon class="fa fa-check mr-2 WM-Margin-B-8"></v-icon>
<v-autocomplete
multiple
color="black"
:items="packs"
:items="labels"
item-text="name"
item-value="id"
v-model="formData.packs"
label="Select Labels For Cycle"
v-model="label.id"
label="Select Label For Cycle"
></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 v-if="key > 0"
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-spacer></v-spacer>
<v-flex xs12 sm12 md12 class="WM-FlexCenter">
@@ -117,9 +137,13 @@ export default {
formData: {
name: "",
note: "",
packs: []
labels: [
{
name:''
}
]
},
packs: [],
labels: [],
rules: {
required: value => !!value || "Required.",
counter: value =>
@@ -134,7 +158,7 @@ export default {
if (this.$route.params.cycle) {
this.load(this.$route.params.cycle);
}
this.loadPacks();
this.loadLabels();
},
methods: {
async load(id) {
@@ -143,10 +167,10 @@ export default {
this.formData = result.data.data;
}
},
async loadPacks() {
const result = await ApiService.get(urls.listAllPack());
async loadLabels() {
const result = await ApiService.get(urls.listAllLabel());
if (result.status == 200) {
this.packs = result.data.data;
this.labels = result.data.data;
}
},
async submitForm() {
@@ -166,7 +190,16 @@ export default {
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>
+14 -1
View File
@@ -94,6 +94,10 @@
<v-icon class="white--text mr-2 caption">fas fa-times</v-icon>
<span>Remove</span>
</v-btn>
<v-btn color="orange darken-1" @click="generateBarcode(item.id)">
<v-icon class="white--text mr-1 caption">fas fa-barcode</v-icon>
<span>Generate Barcode</span>
</v-btn>
</td>
</template>
</v-data-table>
@@ -220,7 +224,16 @@ export default {
}
}
}
}
},
async generateBarcode(code) {
const result = await ApiService.post(urls.Barcode(code));
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-barcode-barcode",
properties: { result }
});
}
}
},
computed: {
...mapGetters("modal", ["getModalResult"])
+1 -1
View File
@@ -38,7 +38,7 @@
>
<v-icon class="white--text mr-2 caption">fas fa-plus</v-icon>ADD
</v-btn>
<v-btn
<v-btn v-if="key > 0"
absolute
small
left