Skip to content

Commit

Permalink
price styling minor fixes on previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasperrone committed Feb 12, 2021
1 parent 7d330cf commit 69a0589
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@
<input type="checkbox" v-model="showEndingDateValue" /> endingDateValue:
<input type="text" v-model="endingDate" /><br />
<input type="checkbox" v-model="showPeriodDates" /> showPeriodDates<br />
<input type="checkbox" v-model="showPrice" /> showPrice<br />
<input type="checkbox" v-model="showPrice" /> showPrice
<span v-if="showPrice">- priceSymbol: <input type="text" v-model="priceSymbol" style="width: 3em" /></span>
<br />
<input type="checkbox" v-model="showMinNights" :true-value="minNights" :false-value="false" /> minNights
<input v-if="showMinNights !== false" type="number" v-model="minNights" min="0" /><br />
<input type="checkbox" v-model="showContentSlot" /> showContentSlot<br />
Expand All @@ -88,6 +90,7 @@
:showSingleMonth="showSingleMonth"
:showYear="showYear"
:showPrice="showPrice"
:priceSymbol="priceSymbol"
:yearBeforeMonth="yearBeforeMonth"
:positionRight="positionRight"
:singleDaySelection="singleDaySelection"
Expand Down
3 changes: 3 additions & 0 deletions src/DatePicker/HotelDatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
:nextDisabledDate="nextDisabledDate"
:nextPeriodDisableDates="nextPeriodDisableDates"
:options="dayOptions"
:priceSymbol="priceSymbol"
:screenSize="screenSize"
:showCustomTooltip="showCustomTooltip"
:showPrice="showPrice"
Expand Down Expand Up @@ -182,6 +183,7 @@
:nextDisabledDate="nextDisabledDate"
:nextPeriodDisableDates="nextPeriodDisableDates"
:options="dayOptions"
:priceSymbol="priceSymbol"
:screenSize="screenSize"
:showCustomTooltip="false"
:showPrice="showPrice"
Expand Down Expand Up @@ -486,6 +488,7 @@ export default {
// eslint-disable-next-line no-nested-ternary
return v1 < v2 ? -1 : v1 > v2 ? 1 : 0
}
periodDates = [...this.periodDates].sort(sortFunction)
}
Expand Down
17 changes: 10 additions & 7 deletions src/DatePicker/components/Day.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
>
<div class="vhd__datepicker__month-day-wrapper">
<span class="day">{{ dayNumber }}</span>
<Price :show="showPrice" :price="dayPrice.price" :symbol="dayPrice.symbol" />
<Price :show="showPrice" :price="dayPrice" :symbol="priceSymbol" />
</div>
</div>
<BookingBullet
Expand Down Expand Up @@ -115,6 +115,10 @@ export default {
options: {
type: Object,
},
priceSymbol: {
type: String,
required: true,
},
screenSize: {
type: String,
default: '',
Expand Down Expand Up @@ -172,16 +176,15 @@ export default {
return fecha.format(this.date, 'D')
},
dayPrice() {
let result = { price: '', symbol: '' }
const currentDate = this.sortedPeriodDates
.revert()
let result = ''
const currentDate = [...this.sortedPeriodDates]
.reverse()
.find((d) => this.validateDateBetweenTwoDates(d.startAt, d.endAt, this.formatDate))
if (currentDate) {
if (currentDate && currentDate.price) {
const nightly = currentDate.periodType === 'nightly'
result.price = (currentDate.price / (nightly ? 1 : 7)).toFixed(2)
result.symbol = currentDate.symbol || ''
result = (currentDate.price / (nightly ? 1 : 7)).toFixed(2)
}
return result
Expand Down
4 changes: 4 additions & 0 deletions src/DatePicker/components/Month.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ export default {
options: {
type: Object,
},
priceSymbol: {
type: String,
default: '',
},
screenSize: {
type: String,
default: '',
Expand Down

0 comments on commit 69a0589

Please sign in to comment.