diff --git a/client/src/js/components/bhFindDocument.js b/client/src/js/components/bhFindDocument.js index fe5083beb9..0813472768 100644 --- a/client/src/js/components/bhFindDocument.js +++ b/client/src/js/components/bhFindDocument.js @@ -8,6 +8,7 @@ angular.module('bhima.components') enableOptionBar : '<', // bind boolean (true|false) : Enable option for add, display list or display thumbnail in a bar enableSearch : '<', // bind boolean (true|false) : Enable search bar option display : '@', // bind (list|thumbnail) : Display either in list or thumbnail mode + height : '@', // bind the height of list of contents patientUuid : '<' // Required patient uuid } }); @@ -31,12 +32,12 @@ function FindDocumentComponent(Patient, Modal, Document, Notify, User, $translat enableOptionBar : Boolean(this.enableOptionBar), enableSearch : Boolean(this.enableSearch), display : this.display, + height : this.height, showAction : false }; /** expose to the view */ vm.switchDisplay = switchDisplay; - vm.toggleAction = toggleAction; vm.addDocument = addDocument; vm.deleteDocument = deleteDocument; vm.mimeIcon = mimeIcon; @@ -49,12 +50,6 @@ function FindDocumentComponent(Patient, Modal, Document, Notify, User, $translat vm.session.display = mode; } - /** toggle document actions */ - function toggleAction(index) { - vm.selectedIndex = index; - vm.session.showAction = vm.session.showAction === true ? false : true; - } - /** function add documents modal */ function addDocument() { Modal.openUploadDocument({ patient_uuid: vm.session.patientUuid }) @@ -90,6 +85,12 @@ function FindDocumentComponent(Patient, Modal, Document, Notify, User, $translat Document.read(vm.session.patientUuid) .then(function (documents) { vm.session.patientDocuments = documents; + + vm.session.patientDocuments.forEach(function (doc) { + doc.downloadLink = doc.label + mimeIcon(doc.mimetype).ext; + doc.icon = mimeIcon(doc.mimetype).icon; + doc.type = mimeIcon(doc.mimetype).label; + }); }) .catch(Notify.handleError); } @@ -99,17 +100,22 @@ function FindDocumentComponent(Patient, Modal, Document, Notify, User, $translat var result = {}; if (mimetype.indexOf('image') > -1) { - result = { icon : 'fa-file-image-o', label : 'Image' }; + var ext = + (mimetype.indexOf('jpg') > -1 || mimetype.indexOf('jpeg') > -1) ? '.jpg' : + (mimetype.indexOf('png') > -1) ? '.png' : + (mimetype.indexOf('gif') > -1) ? '.gif' : ''; + + result = { icon : 'fa-file-image-o', label : 'Image', ext: ext }; } else if (mimetype.indexOf('pdf') > -1) { - result = { icon : 'fa-file-pdf-o', label : 'PDF' }; + result = { icon : 'fa-file-pdf-o', label : 'PDF', ext: '.pdf' }; } else if (mimetype.indexOf('word') > -1) { - result = { icon : 'fa-file-word-o', label : 'MS WORD' }; + result = { icon : 'fa-file-word-o', label : 'MS WORD', ext: '.doc' }; } else if (mimetype.indexOf('sheet') > -1) { - result = { icon : 'fa-file-excel-o', label : 'MS EXCEL' }; + result = { icon : 'fa-file-excel-o', label : 'MS EXCEL', ext: '.xls' }; } else if (mimetype.indexOf('presentation') > -1) { - result = { icon : 'fa-file-powerpoint-o', label : 'MS Power Point' }; + result = { icon : 'fa-file-powerpoint-o', label : 'MS Power Point', ext: '.ppt' }; } else { - result = { icon : 'fa-file-o', label : 'Fichier' }; + result = { icon : 'fa-file-o', label : 'Fichier', ext: '' }; } return result; diff --git a/client/src/partials/patients/documents/documents.css b/client/src/partials/patients/documents/documents.css index fb25a2bf3f..7f441852a6 100644 --- a/client/src/partials/patients/documents/documents.css +++ b/client/src/partials/patients/documents/documents.css @@ -1,27 +1,44 @@ +/* ============================ Generic Style ============================= */ +.document-section { + display: block; + margin: 7px auto; +} +.panel .panel-heading > .right { + position: relative; + float: right; + top: -5px; +} +/* =========================== End Generic Style ========================== */ + + +/* ============================ Document style ============================= */ .document { - border: 1px solid #ddd; - padding: 5px; - margin-bottom: 15px; cursor: pointer; + padding: 5px; + margin: 3px auto; + border: 1px solid #ddd; } .document:hover { background-color: #eee; } -.document h4 { - margin: 2px; -} -.document-actions { - text-align: center; - width: 100%; - margin: auto; - margin-top: 5px; +/* ========================== End Document style ========================== */ + + +/* ==================== Document thumbnails style ========================= */ +.document-thumbnail { + display: inline-block; } -.document .crop { +.document-thumbnail > .crop { width: 100%; height: 150px; overflow: hidden; } -.document .crop img.document-thumbnail { +.document-thumbnail > .crop > .image { + text-align: center; + font-size: 10rem; + color: #337ab7; +} +.document-thumbnail > .crop > .image > img { display: block; width: 100%; margin: auto; @@ -32,55 +49,38 @@ -webkit-transition: margin-top 1s; transition: margin-top 1s; } -.document:hover .crop img.document-thumbnail { +.document-thumbnail:hover > .crop > .image > img { -webkit-filter: grayscale(0%); filter: grayscale(0%); -webkit-filter: grayscale(0%); filter: grayscale(0%); margin-top: -25px; } -.document .crop .document-icon { +/* ==================== End Document thumbnails style ====================== */ + + +/* ========================== Avatar thumbnail ============================= */ +.avatar-thumbnail { text-align: center; - font-size: 10rem; - color: #337ab7; -} -.patient-document .pd-patient { - padding: 7px; - margin-bottom: 5px; - border: 1px solid green; - color: green; - background-color: #e4f9ec; -} -.patient-document .pd-search { - margin-bottom: 5px; + border : 1px solid #ccc; } - -/* patient document heading */ -.patient-document .pd-documents .heading { - display: flex; - justify-content: space-between; - background-color: #337ab7; - color: #fff; - padding: 5px; - margin-bottom: 5px; +.avatar-thumbnail > .crop > img { + width: 100%; + height: 200px; + overflow: hidden; } -.patient-document .pd-documents .heading > .left { - margin: 5px 10px; +.avatar-thumbnail > .crop > .glyphicon { + font-size : 3em; + color : #ccc; + padding-top: 70px; } +/* ========================== End Avatar thumbnail ========================== */ -/* patient list thumbanil */ -.patient-document .display-thumbnail { - display: flex; - align-items: flex-start; - align-content: flex-start; - justify-content: flex-start; - flex-wrap: wrap; -} -.patient-document .display-thumbnail > .document { - width: 50%; -} -/* document upload thumbnail */ -.document-upload-thumbnail { +/* ============================= Upload thumbnail =========================== */ +.upload-thumbnail { width: 100%; + height: 300px; + overflow: hidden; } +/* ========================== End Upload thumbnail ========================== */ diff --git a/client/src/partials/patients/documents/modals/documents.modal.html b/client/src/partials/patients/documents/modals/documents.modal.html index 4bc24ea57f..ead74fcef1 100644 --- a/client/src/partials/patients/documents/modals/documents.modal.html +++ b/client/src/partials/patients/documents/modals/documents.modal.html @@ -18,7 +18,10 @@ - +
diff --git a/client/src/partials/patients/record/patient_record.html b/client/src/partials/patients/record/patient_record.html index ce3b698d41..f894c2552f 100644 --- a/client/src/partials/patients/record/patient_record.html +++ b/client/src/partials/patients/record/patient_record.html @@ -63,17 +63,17 @@
-
-
- +
+
+
-
- +
+
@@ -100,24 +100,16 @@
-
-
- Patient Documents -
-
- - - - - - -
-
+ + + +
diff --git a/client/src/partials/templates/bhFindDocument.tmpl.html b/client/src/partials/templates/bhFindDocument.tmpl.html index 2b6f042f93..7fa9f12bb9 100644 --- a/client/src/partials/templates/bhFindDocument.tmpl.html +++ b/client/src/partials/templates/bhFindDocument.tmpl.html @@ -1,156 +1,130 @@ -
+ +
+ {{ $ctrl.session.patient.reference }} / + {{ $ctrl.session.patient.first_name + ' ' + $ctrl.session.patient.last_name + ' ' + $ctrl.session.patient.middle_name }} +
+ + +
+
+ + + + +
+
- -
- {{ $ctrl.session.patient.reference }} / - {{ $ctrl.session.patient.first_name + ' ' + $ctrl.session.patient.last_name + ' ' + $ctrl.session.patient.middle_name }} + +
+ + +
+
+ + + + +
- - - -
- - -
-
- {{ $ctrl.session.patient.reference }} / - {{ $ctrl.session.patient.first_name + ' ' + $ctrl.session.patient.last_name + ' ' + $ctrl.session.patient.middle_name }} - ({{ $ctrl.session.patientDocuments.length }}) -
- -
- - - - - -
-
+ +
- - - -
-
    -
  • - - - -
    - - - - - -

    {{ doc.label }}

    - -
    - - {{ $ctrl.mimeIcon(doc.mimetype).label }} (~{{ doc.size | bytes }}) -
    - - - {{ doc.timestamp | date }}, {{ 'FORM.LABELS.BY' | translate }} - {{ doc.first + ' ' + doc.last }} - -
    - - - - - - - -
    -
    -
  • -
-
- - -
-
+ + +
+
+
-
-
- - + + + +
+ + +
+ + + + +
-
-
- - - - +

{{ doc.label }}

-
- - {{ $ctrl.mimeIcon(doc.mimetype).label }} (~{{ doc.size | bytes }}) -
+ + + {{ doc.type }} (~{{ doc.size | bytes }}) | + {{ doc.timestamp | date }}, {{ 'FORM.LABELS.BY' | translate }} {{ doc.first + ' ' + doc.last }}
-
- +
+
+
+ + + + + +
+

+ {{ 'PATIENT_DOCUMENT.NO_DOCUMENT' | translate }} +

+
+ +
+