Skip to content

Commit

Permalink
Merge branch 'ermish/searchdata' of https://github.com/ourjapanlife/f…
Browse files Browse the repository at this point in the history
…indadoc-web into ermish/searchdata
  • Loading branch information
ermish committed Dec 6, 2023
2 parents 20667f4 + 18b20a5 commit eb9ff76
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 28 deletions.
38 changes: 19 additions & 19 deletions components/MapContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,49 @@
>
<GMarker
@click="searchResultsStore.setActiveSearchResult(location.professional.id)"
:options="{position: { lat: location.facilities[0].mapLatitude, lon: location.facilities[0].mapLatitude }, icon: markerIcon}"
:options="{position: { lat: location.facilities[0].mapLatitude, lng: location.facilities[0].mapLongitude }, icon: markerIcon}"
:key="index"
v-for="(location, index) in searchResultsStore.searchResultsList"
/>
</GoogleMap>
</template>

<script lang="ts">
import { defineComponent, ref, computed } from "vue"
import { GoogleMap, Marker as GMarker } from "vue3-google-map"
import { useRuntimeConfig } from "#imports"
import customIcon from "../assets/images/blue-map-pin.svg"
import { useSearchResultsStore } from "../stores/searchResultsStore"
import { defineComponent, ref, computed } from "vue";
import { GoogleMap, Marker as GMarker } from "vue3-google-map";
import { useRuntimeConfig } from "#imports";
import customIcon from "../assets/images/blue-map-pin.svg";
import { useSearchResultsStore } from "../stores/searchResultsStore";
export default defineComponent({
components: { GoogleMap, GMarker },
setup() {
//tokyo is the default location
const defaultLocation = { lat: 35.6804, lng: 139.769 };
const center = computed(
() => {
const lon = useSearchResultsStore().activeResult?.facilities[0].mapLongitude
const lat = useSearchResultsStore().activeResult?.facilities[0].mapLatitude
const locationExists = lon && lat
const center = computed(() => {
const lng = useSearchResultsStore().activeResult?.facilities[0]
.mapLongitude;
const lat = useSearchResultsStore().activeResult?.facilities[0]
.mapLatitude;
const locationExists = lng && lat;
return locationExists ? { lat, lon } : defaultLocation
}
)
return locationExists ? { lat, lng } : defaultLocation;
});
const markerIcon = {
url: customIcon,
scaledSize: {
width: 45,
height: 73
}
}
};
const searchResultsStore = useSearchResultsStore()
const mapRef = ref(null)
const runtimeConfig = useRuntimeConfig()
const searchResultsStore = useSearchResultsStore();
const mapRef = ref(null);
const runtimeConfig = useRuntimeConfig();
return { center, mapRef, markerIcon, runtimeConfig, searchResultsStore }
return { center, mapRef, markerIcon, runtimeConfig, searchResultsStore };
}
});
</script>
22 changes: 13 additions & 9 deletions components/SearchResultDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,24 @@ const facilityName = computed(() => {
return localeStore.locale.code === Locale.EnUs ? englishName : japaneseName;
});
const spokenLanguages = computed(
() => {
const languagesDisplayText = resultsStore.$state.activeResult?.professional.spokenLanguages?.map(s => {
const languageDisplayText = localeStore.localeDisplayOptions.find(l => l.code === s)?.simpleText
return languageDisplayText
})
return languagesDisplayText
const spokenLanguages = computed(() => {
const languagesDisplayText = resultsStore.$state.activeResult?.professional.spokenLanguages?.map(
s => {
const languageDisplayText = localeStore.localeDisplayOptions.find(
l => l.code === s
)?.simpleText;
return languageDisplayText;
}
)
);
return languagesDisplayText;
});
const address = computed(() => {
const addressObj =
resultsStore.$state.activeResult?.facilities[0].contact.address;
console.log("addressObj", addressObj);
const englishAddress = `${addressObj?.addressLine1En} ${addressObj?.addressLine2En}, ${addressObj?.cityEn}, ${addressObj?.prefectureEn} ${addressObj?.postalCode}`;
const japaneseAddress = `${addressObj?.postalCode} ${addressObj?.prefectureJa}${addressObj?.cityJa}${addressObj?.addressLine1Ja}${addressObj?.addressLine2Ja}`;
return localeStore.locale.code === Locale.EnUs
Expand Down
3 changes: 3 additions & 0 deletions stores/searchResultsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ const searchFacilitiesQuery = gql`query QueryFacilities($filters: FacilitySearch
addressLine1Ja
cityJa
cityEn
prefectureJa
prefectureEn
postalCode
}
email
googleMapsUrl
Expand Down

0 comments on commit eb9ff76

Please sign in to comment.