mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-13 14:51:06 +03:30
change pack to label
This commit is contained in:
@@ -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) {
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user