Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.

Commit

Permalink
Fix some issues with editing Shipping
Browse files Browse the repository at this point in the history
  • Loading branch information
alecritson committed Apr 10, 2019
1 parent 6fb7a66 commit 4e0b32e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@
</div>
<div class="form-group">
<label for="type">Type</label>
<select class="selectpicker form-control" v-model="method.type">
<select class="selectpicker" v-model="method.type">
<option value="standard">Standard</option>
<option value="dhl" disabled>DHL</option>
<option value="regional">Regional</option>
<!-- <option value="dhl" disabled>DHL</option> -->
</select>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Prices</th>
<th>Zones</th>
<th>Customer Groups</th>
Expand All @@ -84,6 +85,7 @@
<td>
{{ method|attribute('name') }}
</td>
<td>{{ method.type }}</td>
<td>
<template v-if="method.prices.data.length">
<template v-for="(price, index) in method.prices.data">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
return price.currency_id == item.id;
})
},
localisedPrice(price, field) {
var currency = price.currency.data;
// price.currency.data.format
return currency.format.replace('{price}', price[field].money(2, currency.thousand_point, currency.decimal_point));
},
savePrice(price) {
if (this.current.id) {
this.update();
Expand Down Expand Up @@ -84,6 +89,8 @@
},
edit(price) {
this.current = JSON.parse(JSON.stringify(price));
this.current.rate = this.current.rate ? this.current.rate / 100 : 0;
this.current.min_basket = this.current.min_basket ? this.current.min_basket / 100 : 0;
this.current.currency_id = this.current.currency.data.id;
},
add() {
Expand Down Expand Up @@ -165,15 +172,11 @@
</thead>
<tbody>
<tr v-for="price in prices">
<td>
{{ currency(price.rate) }}{{ price.rate }}
</td>
<td v-html="localisedPrice(price, 'rate')"></td>
<td>
{{ price.currency.data.name }}
</td>
<td>
{{ price.min_basket }}
</td>
<td v-html="localisedPrice(price, 'min_basket')"></td>
<td>
{{ price.min_weight }}{{ price.weight_unit }}
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
_.each(zone.countries.data, country => {
if (!regions.includes(country.region)) {
if (!country.name.en) {
country.name.en = 'Rest of world';
if (!country.name) {
country.name = 'Rest of world';
}
regions.push(country.region);
}
Expand Down Expand Up @@ -81,7 +81,7 @@
</template>
<template v-else>
<span v-for="(country, index) in row.countries.data">
{{ country.name.en }}<span v-if="index < row.countries.data.length - 1">, </span>
{{ country.name }}<span v-if="index < row.countries.data.length - 1">, </span>
</span>
</template>
</td>
Expand Down

0 comments on commit 4e0b32e

Please sign in to comment.