2017-11-13 21:06:00 +01:00
|
|
|
import {BASE_URL} from '../../../common/config'
|
|
|
|
|
|
2017-04-11 10:43:05 +02:00
|
|
|
export const formatPrice = p => {
|
|
|
|
|
if (isNaN(p)) {
|
|
|
|
|
return 'Po dogovoru'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return p.toLocaleString('bs') + ' KM'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const formatFilterNumber = num => {
|
|
|
|
|
if (isNaN(num) || num == null) {
|
|
|
|
|
return ''
|
|
|
|
|
}
|
|
|
|
|
return num
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const galleryImageUrl = img =>
|
|
|
|
|
img && img.replace('upload/', 'upload/w_500/')
|
|
|
|
|
|
|
|
|
|
export const listingImageUrl = img =>
|
|
|
|
|
img && img.replace('upload/', 'upload/w_205/')
|
2017-04-12 13:08:06 +02:00
|
|
|
|
|
|
|
|
export const defaultContactMessage = (url) => {
|
|
|
|
|
return `Pozdrav,
|
|
|
|
|
|
|
|
|
|
Našao/Našla sam vaš oglas na portalu Kivi za sljedeću nekretninu:
|
|
|
|
|
|
|
|
|
|
${url}
|
|
|
|
|
|
|
|
|
|
Želim da me kontaktirate kako bih dobio/dobila više informacija.
|
|
|
|
|
|
|
|
|
|
S poštovanjem
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const listingUrl = (id) => {
|
2017-11-13 21:06:00 +01:00
|
|
|
return `http://${BASE_URL}/?listingId=${id}`
|
2017-04-12 13:08:06 +02:00
|
|
|
}
|
2017-04-15 01:30:38 +02:00
|
|
|
|
|
|
|
|
export const isMobile = () => window.matchMedia("(max-width: 768px)").matches
|
2017-04-17 15:46:27 +02:00
|
|
|
|
|
|
|
|
export const formatRooms = (rooms) => {
|
|
|
|
|
const val = parseInt(rooms)
|
|
|
|
|
|
|
|
|
|
if (isNaN(val)) {
|
|
|
|
|
return '--'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (val === 0) {
|
|
|
|
|
return "Garsonjera"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ([2, 3, 4].includes(val)) {
|
|
|
|
|
return `${val} sobe`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return `${val} soba`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const formatFloor = (floor) => {
|
|
|
|
|
|
|
|
|
|
const val = parseInt(floor)
|
|
|
|
|
if (isNaN(val)) {
|
|
|
|
|
return '--'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return `${val}. sprat`
|
|
|
|
|
}
|