|
@@ -238,7 +238,7 @@
|
|
|
<a native target="_blank"
|
|
|
:href="'/prescription-download-as-pdf/' + currentPrescription.uid">Download</a>
|
|
|
<span class="mx-2 text-secondary">|</span>
|
|
|
- <a href="#" v-on:click.prevent="showSendFaxPopup()">Send Fax</a>
|
|
|
+ <a href="#" v-on:click.prevent="sendFax(currentPrescription)">Send Fax</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -254,6 +254,7 @@
|
|
|
@include('app.patient.prescriptions.sign-as-hcp-form')
|
|
|
@include('app.patient.prescriptions.pro-status-form')
|
|
|
@include('app.patient.prescriptions.client-status-form')
|
|
|
+ @include('app.patient.prescriptions.send-fax-form')
|
|
|
</div>
|
|
|
<script>
|
|
|
(function() {
|
|
@@ -398,6 +399,11 @@
|
|
|
status: '',
|
|
|
memo: '',
|
|
|
},
|
|
|
+ currentPrescriptionFax: {
|
|
|
+ uid: '',
|
|
|
+ faxNumber: '',
|
|
|
+ },
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
|
|
@@ -653,7 +659,89 @@
|
|
|
_s = _s.toLowerCase().replaceAll('_', ' ');
|
|
|
_s = _s[0].toUpperCase() + _s.substr(1);
|
|
|
return _s;
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
+ // send fax
|
|
|
+ sendFax: function(_prescription) {
|
|
|
+ this.currentPrescriptionFax = {
|
|
|
+ uid: _prescription.uid,
|
|
|
+ faxNumber: _prescription.logistics_detail_json && _prescription.logistics_detail_json.facilityFax ?
|
|
|
+ _prescription.logistics_detail_json.facilityFax : '',
|
|
|
+ };
|
|
|
+ Vue.nextTick(() => {
|
|
|
+ showStagPopup('send-fax-popup');
|
|
|
+ this.sendFaxModalPDFPreview();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ sendFaxModalPDFPreview: function() {
|
|
|
+
|
|
|
+ let _loadedPDF = null, _numPages = 1, _page = 1;
|
|
|
+
|
|
|
+ function _load(_url) {
|
|
|
+
|
|
|
+ _loadedPDF = null;
|
|
|
+ _numPages = 1;
|
|
|
+ _page = 1;
|
|
|
+
|
|
|
+ $('#send-fax-pdf-preview>canvas').remove();
|
|
|
+
|
|
|
+ let url = _url;
|
|
|
+ let pdfjsLib = window['pdfjs-dist/build/pdf'];
|
|
|
+ pdfjsLib.GlobalWorkerOptions.workerSrc = '//mozilla.github.io/pdf.js/build/pdf.worker.js';
|
|
|
+ let loadingTask = pdfjsLib.getDocument(url);
|
|
|
+ loadingTask.promise.then(function (pdf) {
|
|
|
+ _numPages = pdf.numPages;
|
|
|
+ _loadedPDF = pdf;
|
|
|
+ _page = 1;
|
|
|
+ _render();
|
|
|
+ }, function (reason) {
|
|
|
+ // reason.message;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function _render() {
|
|
|
+
|
|
|
+ _loadedPDF.getPage(_page).then(function (page) {
|
|
|
+
|
|
|
+ // create canvas
|
|
|
+ let canvasElement = $('<canvas/>')
|
|
|
+ .addClass('pdf-viewer-page pdf-preview-page')
|
|
|
+ .appendTo('#send-fax-pdf-preview');
|
|
|
+
|
|
|
+ let canvas = canvasElement[0];
|
|
|
+ let viewport = page.getViewport({scale: 0.75});
|
|
|
+ let context = canvas.getContext('2d');
|
|
|
+ canvas.height = viewport.height;
|
|
|
+ canvas.width = viewport.width;
|
|
|
+ const $canvas = $(canvas);
|
|
|
+ let renderContext = {
|
|
|
+ canvasContext: context,
|
|
|
+ viewport: viewport
|
|
|
+ };
|
|
|
+ let renderTask = page.render(renderContext);
|
|
|
+ renderTask.promise.then(function () {
|
|
|
+ if(_page < _numPages) {
|
|
|
+ _page++;
|
|
|
+ _render();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ _load('/prescription-download-as-pdf/' + this.currentPrescriptionFax.uid);
|
|
|
+ },
|
|
|
+ doSendFax: function (_item) {
|
|
|
+ /*$.post('/api/ticketFax/create', {
|
|
|
+ faxNumber: this.faxNumber,
|
|
|
+ ticketUid: this[this.currentCategory + 'PopupItem'].uid
|
|
|
+ },
|
|
|
+ (_data) => {
|
|
|
+ this.reloadPopupItem(this.currentCategory);
|
|
|
+ closeStagPopup();
|
|
|
+ },
|
|
|
+ 'json');*/
|
|
|
+ alert(1);
|
|
|
+ closeStagPopup();
|
|
|
+ },
|
|
|
|
|
|
// cancel, etc.
|
|
|
|