|
@@ -330,6 +330,37 @@
|
|
initChangeListener($(this));
|
|
initChangeListener($(this));
|
|
});
|
|
});
|
|
*/
|
|
*/
|
|
|
|
+
|
|
|
|
+ // relevance
|
|
|
|
+ $(document).off('change', '.visit-segment[data-segment-template-name] .chk-relevance');
|
|
|
|
+ $(document).on('change', '.visit-segment[data-segment-template-name] .chk-relevance', function () {
|
|
|
|
+ let segment = $(this).closest('.visit-segment');
|
|
|
|
+ if(this.checked) {
|
|
|
|
+ $.post('/api/visitPoint/markPointRelevantToNote', {
|
|
|
|
+ noteUid: '{{$note->uid}}',
|
|
|
|
+ pointUid: $(this).attr('data-point-uid')
|
|
|
|
+ }, _data => {
|
|
|
|
+ if(!hasResponseError(_data)) {
|
|
|
|
+ segment.find('.refresh-segment').trigger('click');
|
|
|
|
+ }
|
|
|
|
+ }, 'json');
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ if($(this).attr('data-rel-uid')) {
|
|
|
|
+ $.post('/api/visitPoint/undoMarkPointRelevantToNote', {
|
|
|
|
+ uid: $(this).attr('data-rel-uid')
|
|
|
|
+ }, _data => {
|
|
|
|
+ if(!hasResponseError(_data)) {
|
|
|
|
+ segment.find('.refresh-segment').trigger('click');
|
|
|
|
+ }
|
|
|
|
+ }, 'json');
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ console.log('Error - missing rel uid');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
addMCInitializer('note-segments-list', init, '#note-segments-list');
|
|
addMCInitializer('note-segments-list', init, '#note-segments-list');
|