|
@@ -259,19 +259,78 @@
|
|
|
)
|
|
|
|
|
|
$('#sign-and-submit').off('click.sign').on('click.sign', function() {
|
|
|
- $.post('/api/client/updateMcpOnboardingVisitInfo', {
|
|
|
- uid: '{{$patient->uid}}',
|
|
|
- hasMcpDoneOnboardingVisit: 'YES',
|
|
|
- mcpOnboardingVisitDate: '{{date('Y-m-d')}}',
|
|
|
+
|
|
|
+ // showMask();
|
|
|
+
|
|
|
+ // prepare note content
|
|
|
+ var content = $('<div/>');
|
|
|
+ content.append($('.intake.primary-form').clone(true));
|
|
|
+ content.find('button').remove();
|
|
|
+
|
|
|
+ // change checkboxes to tick/empty
|
|
|
+ content.find('input[type="checkbox"]').each(function() {
|
|
|
+ var checked = $(this).prop('checked');
|
|
|
+ $(this).replaceWith(
|
|
|
+ $('<b/>')
|
|
|
+ .css({
|
|
|
+ display: 'inline-block',
|
|
|
+ minWidth: '18px',
|
|
|
+ marginRight: '13px',
|
|
|
+ })
|
|
|
+ .text(checked ? '✔' : '-')
|
|
|
+ );
|
|
|
+ });
|
|
|
+
|
|
|
+ // change other inputs to text
|
|
|
+ content.find('input').each(function() {
|
|
|
+ $(this).replaceWith(
|
|
|
+ $('<b/>')
|
|
|
+ .css({
|
|
|
+ display: 'inline-block',
|
|
|
+ paddingLeft: '6px',
|
|
|
+ paddingRight: '6px',
|
|
|
+ })
|
|
|
+ .text(this.value)
|
|
|
+ );
|
|
|
+ });
|
|
|
+
|
|
|
+ content.addClass('intake');
|
|
|
+
|
|
|
+ // create note
|
|
|
+ $.post('/api/note/createUsingFreeTextHtml', {
|
|
|
+ clientUid: '{{ $patient->uid }}',
|
|
|
+ hcpProUid: '{{ $pro->uid }}',
|
|
|
+ effectiveDateEST: '{{ date('Y-m-d') }}',
|
|
|
+ title: 'Visit Note',
|
|
|
+ freeTextHtml: content[0].outerHTML
|
|
|
}, function(_data) {
|
|
|
if (!_data.success) {
|
|
|
toastr.error(_data.message);
|
|
|
}
|
|
|
else {
|
|
|
- fastLoad('/patients/view/{{$patient->uid}}', true, false);
|
|
|
+ var noteUid = _data.data;
|
|
|
+
|
|
|
+ // update visit info
|
|
|
+ $.post('/api/client/updateMcpOnboardingVisitInfo', {
|
|
|
+ uid: '{{$patient->uid}}',
|
|
|
+ hasMcpDoneOnboardingVisit: 'YES',
|
|
|
+ mcpOnboardingVisitDate: '{{date('Y-m-d')}}',
|
|
|
+ mcpOnboardingVisitNoteUid: noteUid,
|
|
|
+ }, function(_data) {
|
|
|
+ if (!_data.success) {
|
|
|
+ toastr.error(_data.message);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ toastr.success('Patient onboarding complete');
|
|
|
+ hideMask();
|
|
|
+ fastLoad('/patients/view/{{$patient->uid}}', true, false);
|
|
|
+ }
|
|
|
+ }, 'json');
|
|
|
+ return false;
|
|
|
+
|
|
|
}
|
|
|
}, 'json');
|
|
|
- return false;
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
</script>
|