stash
This commit is contained in:
parent
4799a7cd5d
commit
69ce11c331
4 changed files with 50 additions and 26 deletions
|
@ -3,7 +3,9 @@
|
|||
<h3>Shipping Codes</h3>
|
||||
<ul>
|
||||
<li v-for="code in shippingCodes" :key="code.code">
|
||||
{{ code.type }} - {{ code.code }}
|
||||
<span v-if="code.issue_thread == null">{{ code.type }} - {{ code.code }}</span>
|
||||
<span v-else><s>{{ code.type }} - {{ code.code }}</s> <a
|
||||
:href="'/'+ getEventSlug + '/ticket/' + code.issue_thread">Issue</a></span>
|
||||
</li>
|
||||
</ul>
|
||||
<!--Table
|
||||
|
@ -25,15 +27,16 @@
|
|||
</template>
|
||||
</Table-->
|
||||
<div class="mt-3">
|
||||
<textarea class="form-control mb-3" rows="5" placeholder="Shipping Code List" v-model="bulk_codes" v-if="bulk"></textarea>
|
||||
<textarea class="form-control mb-3" rows="5" placeholder="Shipping Code List" v-model="bulk_codes"
|
||||
v-if="bulk"></textarea>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" placeholder="Shipping Code" v-model="code" v-if="!bulk">
|
||||
<select class="form-control" v-model="type">
|
||||
<option value="2kg-eu">2kg DE</option>
|
||||
<option value="2kg-uk">2kg EU</option>
|
||||
<option value="2kg-us">5kg DE</option>
|
||||
<option value="2kg-us">5kg EU</option>
|
||||
<option value="2kg-us">10kg DE</option>
|
||||
<option value="2kg-de">2kg DE</option>
|
||||
<option value="2kg-eu">2kg EU</option>
|
||||
<option value="5kg-de">5kg DE</option>
|
||||
<option value="5kg-eu">5kg EU</option>
|
||||
<option value="10kg-de">10kg DE</option>
|
||||
</select>
|
||||
<div class="input-group-prepend">
|
||||
<div class="input-group-text">
|
||||
|
@ -51,7 +54,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {mapActions, mapState} from 'vuex';
|
||||
import {mapActions, mapGetters, mapState} from 'vuex';
|
||||
import Table from '@/components/Table';
|
||||
|
||||
export default {
|
||||
|
@ -65,18 +68,24 @@ export default {
|
|||
bulk: false,
|
||||
};
|
||||
},
|
||||
computed: mapState(['shippingCodes']),
|
||||
computed: {
|
||||
...mapState(['shippingCodes']),
|
||||
...mapGetters(['getEventSlug']),
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['fetchShippingCodes', 'createShippingCode']),
|
||||
createSingleOrBulkShippingCode() {
|
||||
if (this.bulk) {
|
||||
this.bulk_codes.split('\n').forEach(code => {
|
||||
this.createShippingCode({code: code.trim(), type: this.type});
|
||||
const jobs = this.bulk_codes.split('\n').map(code => {
|
||||
return this.createShippingCode({code: code.trim(), type: this.type});
|
||||
});
|
||||
Promise.all(jobs).then(() => {
|
||||
this.bulk_codes = '';
|
||||
});
|
||||
this.bulk_codes = '';
|
||||
} else {
|
||||
this.createShippingCode({code: this.code, type: this.type});
|
||||
this.code = '';
|
||||
this.createShippingCode({code: this.code, type: this.type}).then(() => {
|
||||
this.code = '';
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue