@@ -246,9 +246,10 @@ class="duration-500 transform -translate-x-6 min-w-4 group-hover:translate-x-0"
246246 <div class =" relative z-50 flex h-full gap-8 max-sm:w-full"
247247 role =" article" aria-labelledby =" profile-name" >
248248 <img
249- class =" object-cover w-32 h-32"
250- src =" {{ $ambassador -> avatar_path ?? asset (' images/default.png' ) } }"
249+ class =" object-cover w-32 h-32 bg-[#E8EDF6] "
250+ src =" {{ $ambassador -> communityAvatarUrl ( asset (' images/default.png' ) ) } }"
251251 alt =" {{ $ambassador -> fullName () } }"
252+ onerror =" this.onerror=null;this.src='{{ asset (' images/default.png' ) } } ';"
252253 >
253254 <div class =" flex flex-col justify-between flex-1" >
254255 <div class =" flex flex-col gap-1 mt-1" >
@@ -571,6 +572,7 @@ class="text-[#1C4DA1] text-2xl md:text-4xl leading-[44px] font-medium font-['Mon
571572 var markers = {};
572573 var selectedMarker = null ;
573574 var allTeachers = [];
575+ var defaultAvatar = @json ($default_avatar ?? asset (' images/default.png' ) );
574576
575577 // Function to populate teacher information in the right sidebar
576578 function populateTeacherInfo (teachers , city = null ) {
@@ -642,9 +644,10 @@ function populateTeacherInfo(teachers, city = null) {
642644 </a>
643645 </div>
644646 </div>
645- ${ teacher .avatar_path
646- ? ` <img src="${ teacher .avatar_path } " alt="Avatar" class="flex-shrink-0 object-cover w-[88px] h-[88px] border-2 border-[#DBECF0] border-solid rounded-full">`
647- : ' ' }
647+ <img src="${ teacher .avatar_path || defaultAvatar} "
648+ alt=""
649+ class="flex-shrink-0 object-cover w-[88px] h-[88px] border-2 border-[#DBECF0] border-solid rounded-full bg-[#E8EDF6]"
650+ onerror="this.onerror=null;this.src=defaultAvatar;">
648651 </li>
649652 ` ;
650653 });
@@ -709,21 +712,21 @@ function populateTeacherInfo(teachers, city = null) {
709712 mymap .setView ([centerInfo .latitude , centerInfo .longitude ], centerInfo .zoom );
710713 });
711714
712- // Populate the global teachers array from PHP data
715+ // Populate the global teachers array from PHP data (already filtered by country)
713716 @foreach ($teachers -> groupBy (' city_id' ) as $cityId => $teachersInCity )
714717 @foreach ($teachersInCity as $teacher )
715718 allTeachers .push ({
716- firstname: " {{ $teacher -> firstname } } " ,
717- lastname: " {{ $teacher -> lastname } } " ,
718- email: " {{ $teacher -> email } } " ,
719- country_iso: " {{ $teacher -> country_iso } } " ,
720- twitter: " {{ $teacher -> twitter } } " ,
721- website: " {{ $teacher -> website } } " ,
719+ firstname: @json ( $teacher -> firstname ) ,
720+ lastname: @json ( $teacher -> lastname ) ,
721+ email: @json ( $teacher -> email ) ,
722+ country_iso: @json ( $teacher -> country_iso ) ,
723+ twitter: @json ( $teacher -> twitter ) ,
724+ website: @json ( $teacher -> website ) ,
722725 bio: @json ($teacher -> bio ),
723- avatar_path: " {{ $teacher -> avatar_path } } " ,
724- city: " {{ $teacher -> city -> city ?? ' N/A' } } " ,
725- latitude: " {{ $teacher -> city -> latitude ?? ' ' } } " ,
726- longitude: " {{ $teacher -> city -> longitude ?? ' ' } } " ,
726+ avatar_path: @json ( $teacher -> communityAvatarUrl ( $default_avatar ) ) ,
727+ city: @json ( $teacher -> city -> city ?? ' N/A' ) ,
728+ latitude: @json ( $teacher -> city -> latitude ?? ' ' ) ,
729+ longitude: @json ( $teacher -> city -> longitude ?? ' ' ) ,
727730 expertises: @json ($teacher -> expertises -> pluck (' name' )-> toArray () )
728731 });
729732 @endforeach
@@ -758,15 +761,15 @@ function populateTeacherInfo(teachers, city = null) {
758761 var teacherList = [
759762 @foreach ($teachersInCity as $teacher )
760763 {
761- firstname: " {{ $teacher -> firstname } } " ,
762- lastname: " {{ $teacher -> lastname } } " ,
763- email: " {{ $teacher -> email } } " ,
764- country_iso: " {{ $teacher -> country_iso } } " ,
765- twitter: " {{ $teacher -> twitter } } " ,
766- website: " {{ $teacher -> website } } " ,
764+ firstname: @json ( $teacher -> firstname ) ,
765+ lastname: @json ( $teacher -> lastname ) ,
766+ email: @json ( $teacher -> email ) ,
767+ country_iso: @json ( $teacher -> country_iso ) ,
768+ twitter: @json ( $teacher -> twitter ) ,
769+ website: @json ( $teacher -> website ) ,
767770 bio: @json ($teacher -> bio ),
768- avatar_path: " {{ $teacher -> avatar_path } } " ,
769- city: " {{ $teacher -> city -> city ?? ' N/A' } } " ,
771+ avatar_path: @json ( $teacher -> communityAvatarUrl ( $default_avatar ) ) ,
772+ city: @json ( $teacher -> city -> city ?? ' N/A' ) ,
770773 expertises: @json ($teacher -> expertises -> pluck (' name' )-> toArray () )
771774 },
772775 @endforeach
0 commit comments