I am trying to add new Send SMS
button on map marker as you can check below.
I am unable to add on click method, I have tried below code but its not working
import { MapRenderer } from "@web_map/map_view/map_renderer";
export class SmsMapRenderer extends MapRenderer {
setup() {
super.setup();
}
createMarkerPopup(markerInfo, latLongOffset = 0) {
const popup = super.createMarkerPopup(...arguments);
debugger;
// const popup = super.createMarkerPopup(markerInfo, latLongOffset);
const popupFields = popup.getMarkerPopupFields(markerInfo);
const partner = markerInfo.record.partner;
const popupHtml1 = renderToString("renewell.sendsmsPopup", {
fields: popupFields,
hasFormView: this.props.model.metaData.hasFormView,
});
const opensmsBtn = popup
.getElement()
.querySelector("button.o-map-renderer--popup-buttons-send_sms");
const offset = markerInfo.pinInSamePlace * 0.000050;
if (opensmsBtn) {
opensmsBtn.onclick = () => {
const popup = L.popup({ offset: [0, -30] })
.setLatLng([
partner.partner_latitude + latLongOffset,
partner.partner_longitude - latLongOffset,
])
.setContent(popupHtml1)
.openOn(this.leafletMap);
};
}
return popup;
}
}
Please give me some suggestion or any example.
I have found solution and its working for me. I was just needed to add patch in my code.