modified assests

This commit is contained in:
2026-06-15 11:25:16 +07:00
parent 3f115866d9
commit e96d58dcb4
1218 changed files with 1162 additions and 339502 deletions

View File

@@ -1,4 +0,0 @@
*
!private/
!public/
!.gitignore

View File

@@ -1,2 +0,0 @@
*
!.gitignore

View File

@@ -1,2 +0,0 @@
*
!.gitignore

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,475 +0,0 @@
.form-group {
margin-bottom: 0rem !important;
}
.form-group label {
line-height: 0.4rem !important;
}
.mb-1 {
margin-bottom: 1rem !important;
}
.sidebar {
border-radius: 0px !important;
margin-left: 0px !important;
margin-bottom: 0px !important;
/*width: 246px;*/
width: 320px;
}
.sidebar .nav:not(.sub-menu) {
margin-left: 0px !important;
margin-right: 0px !important;
}
@media (min-width: 992px) {
.sidebar-icon-only .sidebar {
width: 80px;
}
.sidebar-icon-only .sidebar .nav .nav-item.hover-open .nav-link .menu-title {
left: calc(80px - 2px);
}
.sidebar-icon-only .sidebar .nav .nav-item.hover-open .collapse, .sidebar-icon-only .sidebar .nav .nav-item.hover-open .collapsing {
left: calc(80px - 2px);
}
.sidebar-icon-only .sidebar .nav.sub-menu {
padding: 0 0 0 2rem;
}
}
/*
.sidebar{
width: 285px;
}
.navbar .navbar-brand-wrapper {
width: calc(285px + 0.5rem);
}
.navbar .navbar-menu-wrapper{
width: calc(100% - 285px - 0.5rem);
}
*/
.btn-md, .btn-group-md > .btn, .ajax-upload-dragdrop .btn-group-md > .ajax-file-upload {
padding: 0.33rem 0.81rem;
font-size: 0.875rem;
line-height: 1.5;
border-radius: 0.1875rem;
}
.form-control-xs {
height: 2.1rem;
padding: 0.5rem 0.81rem;
font-size: 0.875rem;
line-height: 1.5;
border-radius: 0.2rem;
}
.form-control-xxs {
height: 1.9rem;
padding: 0.5rem 0.81rem;
font-size: 0.875rem;
line-height: 1.5;
border-radius: 0.2rem;
}
.modal-header .close{
margin-right: -22px !important;
}
.modal-body {
padding: 1.5rem !important;
}
.modal-content {
border-radius: 0px !important;
border: 0;
border-top: 10px solid #3b86d1;
}
.modal-content::before {
content: "";
position: absolute;
left: 0px;
top: 0px;
display: block;
width: 27px;
height: 27px;
background-image: linear-gradient(315deg, transparent 30px, #3b86d1 30px);
z-index: 1;
}
.navbar{
border-bottom: 1px solid #ccc !important;
}
.content-wrapper .card{
border-top: 10px solid #ffffff;
}
.content-wrapper .card::before {
content: "";
position: absolute;
left: 0px;
top: 0px;
display: block;
width: 27px;
height: 27px;
background-image: linear-gradient(315deg, transparent 30px, #ffffff 30px);
z-index: 1;
}
.modal-header h6{font-weight: 600;}
.card{
border: 0px;
border-radius: 0px;
}
#loadingDiv{
z-index: 9999999!important;
position: absolute;
/*padding: 80px;*
top: calc(50% - (200px / 2));
right: calc(50% - (200px / 2));
*/
background: #ffffff08;
top: calc(50% - (58px /2));
right: calc(50% - (58px /2));
}
.spinner-border {
width: 3rem;
height: 3rem;
border: 0.4em solid #3b86d1;
border-right-color: #cef5cd7a;
animation: spinner-border .75s linear infinite;
}
.min-vh-70{
min-height: 700px;
}
.modal-semi-xxl {
max-width: 1500px !important;
}
.modal-xxl {
max-width: 1800px !important;
}
.custom-error-alert{
position: fixed;
top: 20px;
width: 400px;
right: 32px;
border-radius: 0;
font-size: 13px;
box-shadow: 0px 0px 5px #78777775;
z-index: 9999;
}
.table thead th {
font-size: 0.9rem !important;
}
.footer {
padding: 0px !important; /* 0 1.812rem 2.062rem 1.812rem;*/
}
.table .btn-sm {
width: 25px;
height: 25px;
padding: 0px;
border-radius: 0px;
}
.bullet-line-list li:before{
top: 23% !important;
left: -19px !important;
}
.group-test-box{
max-height: 610px;
min-height: 610px;
overflow: auto;
}
.bullet-line-list:after {
border: 1px solid #f8f9fa;
/*top: 35px;*/ /* 45px;*/
}
.bullet-line-list:after {
top: -10px;
bottom: -15px;
left: 17px;
}
.first-lv::before{
content: "--";
position: absolute;
left: -20px;
color: #f3f3f3;
}
.grandchildren-lv::before{
content: "|---";
position: absolute;
left: -25px;
color: #f3f3f3;
}
.modal-header span{font-size: 15px !important;}
.footer_fixed{
position: fixed;
bottom: -5px;
height: 85px;
background: #fff;
z-index: 10000;
width: 100%;
left: -5px;
right: -5px;
padding-top: 15px;
border-top: 2px solid #eee;
}
.font-14{
font-size: 14px !important;
}
.font-13{
font-size: 13px !important;
}
.table thead tr:first-child{
height: 40px !important;
}
.table thead tr:first-child th{
vertical-align: middle;
}
.border-light{
border-color: #999898 !important;
}
.result-item{
height: 42px !important;
}
.badge{
border-radius: 0px !important;
}
body::-webkit-scrollbar{
display: none;
}
.modal::-webkit-scrollbar{
display: none;
}
.border-1{
border: 1px !important;
}
.border-2{
border: 2px !important;
}
.border-3{
border: 3px !important;
}
.border-4{
border: 4px !important;
}
.border-5{
border: 5px !important;
}
.border-solid{
border-style: solid !important;
}
.border-gray{
border-color: #f7f7f7 !important;
}
.bg-gradient-light {
background: linear-gradient(to right, #dbebf5 5%, #ffffff 80%) !important;
/*background: linear-gradient(to right, #cfd9df 5%, #ffffff 70%) !important;*/
}
.sample-type-wrapper .list-unstyled{
margin-top: 5px;
margin-bottom: 5px;
margin-left: 1em;
}
.sample-type-wrapper ul{
margin-left: 1em;
position: relative;
}
.sample-type-wrapper ul:before {
content: "";
display: block;
width: 0;
position: absolute;
top: 0;
bottom: 0;
left: 0;
border-left: 1px solid #dbdbdb;
}
.sample-type-wrapper li {
margin: 0;
padding: 0 1.2em;
line-height: 2em;
color: #369;
font-weight: 700;
position: relative;
}
.sample-type-wrapper ul li:before {
content: "";
display: block;
width: 15px;
height: 0;
border-top: 1px solid #dbdbdb;
margin-top: -1px;
position: absolute;
top: 1em;
left: 0;
}
.sample-type-wrapper ul li:last-child:before {
background: #fff;
height: auto;
top: 1em;
bottom: 0;
}
.sample-type-wrapper ul li ul{
margin-left: 0.2em !important;
position: relative;
}
.indicator {
margin-right: 0.5em;
margin-left: -1.65em;
cursor: pointer;
background: white;
position: absolute;
top: 7px;
display: inline-block;
line-height: 1;
}
.sample-type-wrapper ul ul li {
padding-right: 0em !important;
}
.sample-type-wrapper .form-check .form-check-label input[type="checkbox"] + .input-helper:before {
border-radius: 0 !important;
border: solid #727272 !important;
border-width: 1px !important;
}
.sample-type-wrapper .form-check .form-check-label input[type="checkbox"]:checked + .input-helper:before {
background: #fff !important;
}
.sample-type-wrapper .form-check .form-check-label input[type="checkbox"] + .input-helper:after {
color: #000 !important;
}
ul li ul{
display: none;
}
.navbar .navbar-brand-wrapper .navbar-brand-inner-wrapper .navbar-brand img {
height: 74px !important;
}
.navbar .navbar-brand-wrapper {
background: #ffffff !important;
}
.navbar .navbar-menu-wrapper {
background: #3b86d1 !important;
}
.sidebar .nav .nav-item.active > .nav-link {
background: #e7e7e7 !important;
}
.navbar .navbar-menu-wrapper .navbar-nav.navbar-nav-right .nav-item .nav-link {
border: 1px solid #569fe9 !important;
border-radius: 5px !important;
}
/*
Lab & User Profile
*/
.center {
height:100%;
display:flex;
align-items:center;
justify-content:center;
}
.form-input {
width:250px;
padding:20px;
}
.form-input img {
width:100%;
/*display:{{$info->logo==''?'none':'block'}};*/
margin-bottom:10px;
}
.form-input input {
display:none;
}
.form-input label {
height:25px;
background:#cdcdcd26;
color:#c9c9c9;
cursor:pointer;
width: 75px;
margin: 0 auto;
}
/* For test result */
.out-of-range{
background:#ffb400 !important;
}
.main-panel input, .main-panel select{
border:1px solid #d3d5d7 !important;
}
.main-panel .select2-container .select2-selection--single, .main-panel .select2-selection--multiple {
border-color: #d3d5d7 !important;
}
.nav .menu-icon{
color: #3b86d1 !important;
}
.sidebar .nav.sub-menu .nav-item::before {
color: #3b86d1 !important;
}
.table-hover tbody tr:hover {
background-color: #E3F2FD !important;/* #eaeaf1;*/
}

View File

@@ -1,82 +0,0 @@
.select2-selection__rendered {
line-height: 18px !important;
}
.select2-container .select2-selection--single{
box-shadow: none;
outline: none;
}
.select2-container .select2-selection--single, .select2-selection--multiple {
min-height: 46px !important;
border-radius: 0;
border-color: #f3f3f3 !important;
}
.select2-search__field{
outline: none;
}
.select2-selection__arrow {
height: 46px !important;
}
.select2-selection__choice{
font-size: 13px !important;
}
.form-group label {line-height: 1.4rem !important;}
/** custommiz **/
.select2-results__option {
padding-right: 20px;
vertical-align: middle;
}
.select2-results__option:before {
content: "";
display: inline-block;
position: relative;
height: 20px;
width: 20px;
border: 1px solid #e9e9e9;
border-radius: 0px;
background-color: #fff;
margin-right: 20px;
vertical-align: middle;
}
.select2-results__option[aria-selected=true]:before {
font-family:fontAwesome;
content: "\f00c";
color: #000;
background-color: #cbcbcb;
border: 0;
display: inline-block;
padding-left: 3px;
}
.select2-container--default .select2-results__option[aria-selected=true] {
background-color: #fff;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color: #eaeaeb;
color: #272727;
}
.select2-container--default .select2-selection--multiple {
margin-bottom: 10px;
}
.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
border-radius: 0px;
}
.select2-container--default.select2-container--focus .select2-selection--multiple {
border-color: #ffffff;
border-width: 1px;
}
.select2-container--default .select2-selection--multiple {
border-width: 1px;
}
.select2-container--open .select2-dropdown--below {
border-radius: 0px;
/*box-shadow: 0 0 10px rgba(0,0,0,0.5);*/
background: #fafafa;
}
.select2-selection .select2-selection--multiple:after {
content: 'hhghgh';
}

View File

@@ -1,427 +0,0 @@
#style-1::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
background-color: #F5F5F5;
}
#style-1::-webkit-scrollbar
{
width: 12px;
background-color: #F5F5F5;
}
#style-1::-webkit-scrollbar-thumb
{
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
background-color: #555;
}
/*
* STYLE 2
*/
#style-2::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
background-color: #F5F5F5;
}
#style-2::-webkit-scrollbar
{
width: 12px;
background-color: #F5F5F5;
}
#style-2::-webkit-scrollbar-thumb
{
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
background-color: #D62929;
}
/*
* STYLE 3
*/
#style-3::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
}
#style-3::-webkit-scrollbar
{
width: 6px;
background-color: #F5F5F5;
}
#style-3::-webkit-scrollbar-thumb
{
background-color: #000000;
}
/*
* STYLE 4
*/
#style-4::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
}
#style-4::-webkit-scrollbar
{
width: 10px;
background-color: #F5F5F5;
}
#style-4::-webkit-scrollbar-thumb
{
background-color: #000000;
border: 2px solid #555555;
}
/*
* STYLE 5
*/
#style-5::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
}
#style-5::-webkit-scrollbar
{
width: 10px;
background-color: #F5F5F5;
}
#style-5::-webkit-scrollbar-thumb
{
background-color: #0ae;
background-image: -webkit-gradient(linear, 0 0, 0 100%,
color-stop(.5, rgba(255, 255, 255, .2)),
color-stop(.5, transparent), to(transparent));
}
/*
* STYLE 6
*/
#style-6::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
}
#style-6::-webkit-scrollbar
{
width: 10px;
background-color: #F5F5F5;
}
#style-6::-webkit-scrollbar-thumb
{
background-color: #F90;
background-image: -webkit-linear-gradient(45deg,
rgba(255, 255, 255, .2) 25%,
transparent 25%,
transparent 50%,
rgba(255, 255, 255, .2) 50%,
rgba(255, 255, 255, .2) 75%,
transparent 75%,
transparent)
}
/*
* STYLE 7
*/
#style-7::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
border-radius: 10px;
}
#style-7::-webkit-scrollbar
{
width: 10px;
background-color: #F5F5F5;
}
#style-7::-webkit-scrollbar-thumb
{
border-radius: 10px;
background-image: -webkit-gradient(linear,
left bottom,
left top,
color-stop(0.44, rgb(122,153,217)),
color-stop(0.72, rgb(73,125,189)),
color-stop(0.86, rgb(28,58,148)));
}
/*
* STYLE 8
*/
#style-8::-webkit-scrollbar-track
{
border: 1px solid black;
background-color: #F5F5F5;
}
#style-8::-webkit-scrollbar
{
width: 10px;
background-color: #F5F5F5;
}
#style-8::-webkit-scrollbar-thumb
{
background-color: #000000;
}
/*
* STYLE 9
*/
#style-9::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
}
#style-9::-webkit-scrollbar
{
width: 10px;
background-color: #F5F5F5;
}
#style-9::-webkit-scrollbar-thumb
{
background-color: #F90;
background-image: -webkit-linear-gradient(90deg,
rgba(255, 255, 255, .2) 25%,
transparent 25%,
transparent 50%,
rgba(255, 255, 255, .2) 50%,
rgba(255, 255, 255, .2) 75%,
transparent 75%,
transparent)
}
/*
* STYLE 10
*/
#style-10::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
border-radius: 10px;
}
#style-10::-webkit-scrollbar
{
width: 10px;
background-color: #F5F5F5;
}
#style-10::-webkit-scrollbar-thumb
{
background-color: #AAA;
border-radius: 10px;
background-image: -webkit-linear-gradient(90deg,
rgba(0, 0, 0, .2) 25%,
transparent 25%,
transparent 50%,
rgba(0, 0, 0, .2) 50%,
rgba(0, 0, 0, .2) 75%,
transparent 75%,
transparent)
}
/*
* STYLE 11
*/
#style-11::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
border-radius: 10px;
}
#style-11::-webkit-scrollbar
{
width: 10px;
background-color: #F5F5F5;
}
#style-11::-webkit-scrollbar-thumb
{
background-color: #3366FF;
border-radius: 10px;
background-image: -webkit-linear-gradient(0deg,
rgba(255, 255, 255, 0.5) 25%,
transparent 25%,
transparent 50%,
rgba(255, 255, 255, 0.5) 50%,
rgba(255, 255, 255, 0.5) 75%,
transparent 75%,
transparent)
}
/*
* STYLE 12
*/
#style-12::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.9);
border-radius: 10px;
background-color: #444444;
}
#style-12::-webkit-scrollbar
{
width: 12px;
background-color: #F5F5F5;
}
#style-12::-webkit-scrollbar-thumb
{
border-radius: 10px;
background-color: #D62929;
background-image: -webkit-linear-gradient(90deg,
transparent,
rgba(0, 0, 0, 0.4) 50%,
transparent,
transparent)
}
/*
* STYLE 13
*/
#style-13::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.9);
border-radius: 10px;
background-color: #CCCCCC;
}
#style-13::-webkit-scrollbar
{
width: 12px;
background-color: #F5F5F5;
}
#style-13::-webkit-scrollbar-thumb
{
border-radius: 10px;
background-color: #D62929;
background-image: -webkit-linear-gradient(90deg,
transparent,
rgba(0, 0, 0, 0.4) 50%,
transparent,
transparent)
}
/*
* STYLE 14
*/
#style-14::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.6);
background-color: #CCCCCC;
}
#style-14::-webkit-scrollbar
{
width: 10px;
background-color: #F5F5F5;
}
#style-14::-webkit-scrollbar-thumb
{
background-color: #FFF;
background-image: -webkit-linear-gradient(90deg,
rgba(0, 0, 0, 1) 0%,
rgba(0, 0, 0, 1) 25%,
transparent 100%,
rgba(0, 0, 0, 1) 75%,
transparent)
}
/*
* STYLE 15
*/
#style-15::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.1);
background-color: #F5F5F5;
border-radius: 10px;
}
#style-15::-webkit-scrollbar
{
width: 10px;
background-color: #F5F5F5;
}
#style-15::-webkit-scrollbar-thumb
{
border-radius: 10px;
background-color: #FFF;
background-image: -webkit-gradient(linear,
40% 0%,
75% 84%,
from(#4D9C41),
to(#19911D),
color-stop(.6,#54DE5D))
}
/*
* STYLE 16
*/
#style-16::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.1);
background-color: #F5F5F5;
border-radius: 10px;
}
#style-16::-webkit-scrollbar
{
width: 10px;
background-color: #F5F5F5;
}
#style-16::-webkit-scrollbar-thumb
{
border-radius: 10px;
background-color: #FFF;
background-image: -webkit-linear-gradient(top,
#e4f5fc 0%,
#bfe8f9 50%,
#9fd8ef 51%,
#2ab0ed 100%);
}

View File

@@ -1,35 +0,0 @@
.autocomplete {
position: relative;
display: inline-block;
}
.autocomplete-items {
position: absolute;
border: 1px solid #d4d4d4;
border-bottom: none;
border-top: none;
z-index: 9999999 !important;
/*position the autocomplete items to be the same width as the container:*/
top: 100%;
left: 0;
right: 0;
}
.autocomplete-items div {
padding: 10px 5px;
cursor: pointer;
font-size: 13px;
background-color: #fff;
border-bottom: 1px solid #d4d4d4;
}
/*when hovering an item:*/
.autocomplete-items div:hover {
background-color: #e9e9e9;
}
/*when navigating through the items using the arrow keys:*/
.autocomplete-active {
background-color: DodgerBlue !important;
color: #ffffff;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,236 +0,0 @@
'use strict'
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
var del = require('del');
var replace = require('gulp-replace');
var injectPartials = require('gulp-inject-partials');
var inject = require('gulp-inject');
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var merge = require('merge-stream');
gulp.task('sass', function () {
return gulp.src('./scss/**/style.scss')
.pipe(sourcemaps.init())
.pipe(sass({outputStyle: 'expanded'}).on('error', sass.logError))
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest('./css'))
.pipe(browserSync.stream());
});
// Static Server + watching scss/html files
gulp.task('serve', gulp.series('sass', function() {
browserSync.init({
port: 3001,
server: "./",
ghostMode: false,
notify: false
});
gulp.watch('scss/**/*.scss', gulp.series('sass'));
gulp.watch('**/*.html').on('change', browserSync.reload);
gulp.watch('js/**/*.js').on('change', browserSync.reload);
}));
// Static Server without watching scss files
gulp.task('serve:lite', function() {
browserSync.init({
server: "./",
ghostMode: false,
notify: false
});
gulp.watch('**/*.css').on('change', browserSync.reload);
gulp.watch('**/*.html').on('change', browserSync.reload);
gulp.watch('js/**/*.js').on('change', browserSync.reload);
});
/* inject partials like sidebar and navbar */
gulp.task('injectPartial', function () {
return gulp.src("./**/*.html", { base: "./" })
.pipe(injectPartials())
.pipe(gulp.dest("."));
});
/* inject Js and CCS assets into HTML */
gulp.task('injectCommonAssets', function () {
return gulp.src('./**/*.html')
.pipe(inject(gulp.src([
'./vendors/typicons/typicons.css',
'./vendors/css/vendor.bundle.base.css',
'./vendors/js/vendor.bundle.base.js',
], {read: false}), {name: 'base', relative: true}))
.pipe(inject(gulp.src([
'./css/*.css',
'./js/off-canvas.js',
'./js/hoverable-collapse.js',
'./js/template.js',
'./js/settings.js',
'./js/todolist.js'
], {read: false}), {relative: true}))
.pipe(gulp.dest('.'));
});
/* inject Js and CCS assets into HTML */
gulp.task('injectLayoutStyles', function () {
var verticalLightStream = gulp.src(['./**/vertical-default-light/**/*.html',
'./**/vertical-boxed/**/*.html',
'./**/vertical-compact/**/*.html',
'./**/vertical-dark-sidebar/**/*.html',
'./**/vertical-fixed/**/*.html',
'./**/vertical-hidden-toggle/**/*.html',
'./**/vertical-icon-menu/**/*.html',
'./**/vertical-toggle-overlay/**/*.html',
'./index.html'])
.pipe(inject(gulp.src([
'./css/vertical-layout-light/style.css',
], {read: false}), {relative: true}))
.pipe(gulp.dest('.'));
var horizontalLightStream = gulp.src('./**/horizontal-default-light/**/*.html')
.pipe(inject(gulp.src([
'./css/horizontal-layout-light/style.css',
], {read: false}), {relative: true}))
.pipe(gulp.dest('.'));
var horizontalDarkStream = gulp.src('./**/horizontal-default-dark/**/*.html')
.pipe(inject(gulp.src([
'./css/horizontal-layout-dark/style.css',
], {read: false}), {relative: true}))
.pipe(gulp.dest('.'));
var verticalDarkStream = gulp.src('./**/vertical-default-dark/**/*.html')
.pipe(inject(gulp.src([
'./css/vertical-layout-dark/style.css',
], {read: false}), {relative: true}))
.pipe(gulp.dest('.'));
return merge(verticalLightStream, horizontalLightStream, horizontalDarkStream, verticalDarkStream);
});
/*replace image path and linking after injection*/
gulp.task('replacePath', function(){
var replacePath1 = gulp.src(['./pages/*/*.html'], { base: "./" })
.pipe(replace('="images/', '="../../images/'))
.pipe(replace('href="pages/', 'href="../../pages/'))
.pipe(replace('href="index.html"', 'href="../../index.html"'))
.pipe(gulp.dest('.'));
var replacePath2 = gulp.src(['./pages/*.html'], { base: "./" })
.pipe(replace('="images/', '="../../../images/'))
.pipe(replace('"pages/', '"../pages/'))
.pipe(replace('href="index.html"', 'href="../index.html"'))
.pipe(gulp.dest('.'));
var replacePath3 = gulp.src(['./*/index.html'], { base: "./" })
.pipe(replace('="images/', '="../../images/'))
.pipe(gulp.dest('.'));
return merge(replacePath1, replacePath2, replacePath3);
});
/*sequence for injecting partials and replacing paths*/
gulp.task('inject', gulp.series('injectPartial' , 'injectCommonAssets' , 'injectLayoutStyles', 'replacePath'));
gulp.task('clean:vendors', function () {
return del([
'vendors/**/*'
]);
});
/*Building vendor scripts needed for basic template rendering*/
gulp.task('buildBaseVendorScripts', function() {
return gulp.src([
'./node_modules/jquery/dist/jquery.min.js',
'./node_modules/popper.js/dist/umd/popper.min.js',
'./node_modules/bootstrap/dist/js/bootstrap.min.js',
'./node_modules/perfect-scrollbar/dist/perfect-scrollbar.min.js'
])
.pipe(concat('vendor.bundle.base.js'))
.pipe(gulp.dest('./vendors/js'));
});
/*Building vendor styles needed for basic template rendering*/
gulp.task('buildBaseVendorStyles', function() {
return gulp.src(['./node_modules/perfect-scrollbar/css/perfect-scrollbar.css'])
.pipe(concat('vendor.bundle.base.css'))
.pipe(gulp.dest('./vendors/css'));
});
/*Scripts for addons*/
gulp.task('copyAddonsScripts', function() {
var aScript1 = gulp.src(['node_modules/chart.js/dist/Chart.min.js'])
.pipe(gulp.dest('./vendors/chart.js'));
var aScript2 = gulp.src(['node_modules/moment/moment.js'])
.pipe(gulp.dest('./vendors/moment'));
var aScript3 = gulp.src(['node_modules/jquery-file-upload/js/jquery.uploadfile.min.js'])
.pipe(gulp.dest('./vendors/jquery-file-upload'));
var aScript4 = gulp.src(['node_modules/moment/min/moment.min.js'])
.pipe(gulp.dest('./vendors/moment'));
var aScript5 = gulp.src(['node_modules/codemirror/lib/codemirror.js'])
.pipe(gulp.dest('./vendors/codemirror'));
var aScript6 = gulp.src(['node_modules/codemirror/mode/javascript/javascript.js'])
.pipe(gulp.dest('./vendors/codemirror'));
var aScript7 = gulp.src(['node_modules/codemirror/mode/shell/shell.js'])
.pipe(gulp.dest('./vendors/codemirror'));
var aScript8 = gulp.src(['node_modules/twbs-pagination/jquery.twbsPagination.min.js'])
.pipe(gulp.dest('./vendors/twbs-pagination'));
var aScript9 = gulp.src(['node_modules/jquery.avgrund/jquery.avgrund.min.js'])
.pipe(gulp.dest('./vendors/jquery.avgrund'));
var aScript10 = gulp.src(['node_modules/pwstabs/assets/jquery.pwstabs.min.js'])
.pipe(gulp.dest('./vendors/pwstabs'));
var aScript11 = gulp.src(['./node_modules/summernote/dist/**/*'])
.pipe(gulp.dest('./vendors/summernote/dist'));
var aScript12 = gulp.src(['./node_modules/tinymce/**/*'])
.pipe(gulp.dest('./vendors/tinymce'));
var aScript13 = gulp.src(['./node_modules/ace-builds/src-min/**/*'])
.pipe(gulp.dest('./vendors/ace-builds/src-min'));
var aScript14 = gulp.src(['node_modules/select2/dist/js/select2.min.js'])
.pipe(gulp.dest('./vendors/select2'));
var aScript15 = gulp.src(['node_modules/typeahead.js/dist/typeahead.bundle.min.js'])
.pipe(gulp.dest('./vendors/typeahead.js'));
return merge(aScript1, aScript2, aScript3, aScript4, aScript5, aScript6, aScript7, aScript8, aScript9, aScript10, aScript11, aScript12, aScript13, aScript14, aScript15);
});
/*Styles for addons*/
gulp.task('copyAddonsStyles', function() {
var aStyle1 = gulp.src(['./node_modules/@mdi/font/css/materialdesignicons.min.css'])
.pipe(gulp.dest('./vendors/mdi/css'));
var aStyle2 = gulp.src(['./node_modules/@mdi/font/fonts/*'])
.pipe(gulp.dest('./vendors/mdi/fonts'));
var aStyle3 = gulp.src(['./node_modules/font-awesome/css/font-awesome.min.css'])
.pipe(gulp.dest('./vendors/font-awesome/css'));
var aStyle4 = gulp.src(['./node_modules/font-awesome/fonts/*'])
.pipe(gulp.dest('./vendors/font-awesome/fonts'));
var aStyle5 = gulp.src(['node_modules/jquery-file-upload/css/uploadfile.css'])
.pipe(gulp.dest('./vendors/jquery-file-upload'));
var aStyle6 = gulp.src(['node_modules/select2/dist/css/select2.min.css'])
.pipe(gulp.dest('./vendors/select2'));
var aStyle7 = gulp.src(['node_modules/codemirror/lib/codemirror.css'])
.pipe(gulp.dest('./vendors/codemirror'));
var aStyle8 = gulp.src(['node_modules/codemirror/theme/ambiance.css'])
.pipe(gulp.dest('./vendors/codemirror'));
var aStyle9 = gulp.src(['node_modules/quill/dist/quill.snow.css'])
.pipe(gulp.dest('./vendors/quill'));
var aStyle10 = gulp.src(['node_modules/simplemde/dist/simplemde.min.css'])
.pipe(gulp.dest('./vendors/simplemde'));
var aStyle11 = gulp.src(['node_modules/jsgrid/dist/jsgrid-theme.min.css'])
.pipe(gulp.dest('./vendors/jsgrid'));
var aStyle12 = gulp.src(['node_modules/pwstabs/assets/jquery.pwstabs.min.css'])
.pipe(gulp.dest('./vendors/pwstabs'));
var aStyle13 = gulp.src(['node_modules/typicons.font/src/font/*'])
.pipe(gulp.dest('./vendors/typicons'));
return merge(aStyle1, aStyle2, aStyle3, aStyle4, aStyle5, aStyle6, aStyle7, aStyle8, aStyle9, aStyle10, aStyle11, aStyle12, aStyle13);
});
/*sequence for building vendor scripts and styles*/
gulp.task('bundleVendors', gulp.series('clean:vendors', 'buildBaseVendorStyles','buildBaseVendorScripts', 'copyAddonsStyles', 'copyAddonsScripts'));
gulp.task('default', gulp.series('serve'));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="117px" height="34px" viewBox="0 0 117 34" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 53 (72520) - https://sketchapp.com -->
<title>Logo_dark</title>
<desc>Created with Sketch.</desc>
<g id="Dashboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Logo_dark" fill-rule="nonzero">
<path d="M39.4,27 L39.4,13.2 C40.6400062,13.0799994 42.3866554,13.02 44.64,13.02 C46.573343,13.02 47.8966631,13.3333302 48.61,13.96 C49.3233369,14.5866698 49.68,15.7733246 49.68,17.52 C49.68,19.2666754 49.3433367,20.4566635 48.67,21.09 C47.9966633,21.7233365 46.7866754,22.04 45.04,22.04 C44.1599956,22.04 43.2933376,21.9866672 42.44,21.88 L42.44,27 L39.4,27 Z M42.44,19.7 L44.58,19.7 C45.3666706,19.6866666 45.9033319,19.5333348 46.19,19.24 C46.4766681,18.9466652 46.62,18.3733376 46.62,17.52 C46.62,16.6666624 46.4766681,16.0933348 46.19,15.8 C45.9033319,15.5066652 45.3666706,15.36 44.58,15.36 L42.44,15.38 L42.44,19.7 Z M56.08,16.86 C57.9200092,16.86 59.2233295,17.2566627 59.99,18.05 C60.7566705,18.8433373 61.14,20.1866572 61.14,22.08 C61.14,23.9733428 60.7566705,25.3099961 59.99,26.09 C59.2233295,26.8700039 57.9200092,27.26 56.08,27.26 C54.2266574,27.26 52.9166705,26.8700039 52.15,26.09 C51.3833295,25.3099961 51,23.9733428 51,22.08 C51,20.1733238 51.3833295,18.8266706 52.15,18.04 C52.9166705,17.2533294 54.2266574,16.86 56.08,16.86 Z M56.08,19.08 C55.2933294,19.08 54.766668,19.279998 54.5,19.68 C54.233332,20.080002 54.1,20.879994 54.1,22.08 C54.1,23.2533392 54.233332,24.039998 54.5,24.44 C54.766668,24.840002 55.2933294,25.04 56.08,25.04 C56.8400038,25.04 57.3566653,24.840002 57.63,24.44 C57.9033347,24.039998 58.04,23.2533392 58.04,22.08 C58.04,20.8933274 57.906668,20.0966687 57.64,19.69 C57.373332,19.2833313 56.8533372,19.08 56.08,19.08 Z M66.12,13 L66.12,23.78 C66.12,24.44667 66.4933296,24.78 67.24,24.78 L68.04,24.78 L68.38,26.84 C67.8733308,27.106668 67.086672,27.24 66.02,27.24 C65.1399956,27.24 64.4466692,27.0033357 63.94,26.53 C63.4333308,26.0566643 63.18,25.386671 63.18,24.52 L63.18,13 L66.12,13 Z M72.66,13 L72.66,23.78 C72.66,24.44667 73.0333296,24.78 73.78,24.78 L74.58,24.78 L74.92,26.84 C74.4133308,27.106668 73.626672,27.24 72.56,27.24 C71.6799956,27.24 70.9866692,27.0033357 70.48,26.53 C69.9733308,26.0566643 69.72,25.386671 69.72,24.52 L69.72,13 L72.66,13 Z M85.6,17.14 L85.6,27 L83.26,27 L83.04,25.64 C81.6799932,26.7200054 80.3200068,27.26 78.96,27.26 C77.1066574,27.26 76.18,26.3466758 76.18,24.52 L76.18,17.14 L79.14,17.14 L79.14,23.62 C79.1266666,24.0466688 79.1999992,24.3466658 79.36,24.52 C79.5200008,24.6933342 79.799998,24.78 80.2,24.78 C80.7733362,24.78 81.593328,24.5066694 82.66,23.96 L82.66,17.14 L85.6,17.14 Z M92.52,22.86 L92.4,22.86 L90.06,27 L87.02,27 L90.06,21.94 L87.24,17.14 L90.26,17.14 L92.36,20.94 L92.56,20.94 L94.66,17.14 L97.68,17.14 L94.86,21.94 L97.9,27 L94.86,27 L92.52,22.86 Z M110.44,13.2 L110.44,21.5 C110.44,23.6066772 110.036671,25.093329 109.23,25.96 C108.423329,26.826671 107.033343,27.26 105.06,27.26 C102.97999,27.26 101.516671,26.826671 100.67,25.96 C99.8233291,25.093329 99.4,23.6066772 99.4,21.5 L99.4,13.2 L102.44,13.2 L102.44,21.5 C102.44,22.766673 102.616665,23.633331 102.97,24.1 C103.323335,24.566669 103.973329,24.8 104.92,24.8 C105.853338,24.8 106.496665,24.566669 106.85,24.1 C107.203335,23.633331 107.38,22.766673 107.38,21.5 L107.38,13.2 L110.44,13.2 Z M116.16,27 L113.12,27 L113.12,13.2 L116.16,13.2 L116.16,27 Z" id="PolluxUI-Copy" fill="#844FC1"></path>
<g id="Polluxui-Copy">
<path d="M7.49397732,2.99977945 C6.74302902,3.01402476 5.9817655,2.33635499 6.00033291,1.49995176 C6.01890031,0.606567292 6.70176813,-0.0100511473 7.51048168,0.000124074453 C8.36664526,0.0102992962 8.99793696,0.6574434 9,1.49384663 C9,2.32414473 8.3872757,2.96721874 7.49397732,2.99977945 Z" id="Path" fill="#FFFFFF"></path>
<path d="M28.8532446,17.7327629 C28.754386,17.1677441 28.6102173,16.6068049 28.4598699,16.051985 C28.2003662,15.0973685 27.8317062,14.1815077 27.2900437,13.3492779 C26.9852299,12.8801288 26.6557013,12.4150592 26.2664458,12.019342 C25.9039644,11.650142 25.4693987,11.3400956 25.0286543,11.0606459 C24.3098703,10.6057752 23.5025254,10.3813995 22.6498704,10.340604 C22.3409374,10.3263255 22.0320045,10.3202062 21.725131,10.3426437 C21.3605901,10.3712006 20.9960492,10.4262747 20.6335679,10.4854283 C20.0857267,10.5751785 19.5420047,10.709804 18.9900444,10.764878 C18.5781338,10.8056736 18.1538658,10.764878 17.7378361,10.7322415 C17.1879354,10.6894062 16.6792258,10.4956272 16.2117072,10.2120979 C15.7174144,9.91225038 15.313742,9.51449349 14.9594989,9.05962278 C14.6279108,8.63738854 14.2695485,8.23555209 13.9235436,7.82555652 C13.4972161,7.31969134 13.0132211,6.88317864 12.4241889,6.56497313 C11.3964719,6.01219303 10.2925514,5.9183632 9.16185666,6.05706817 C8.38746467,6.15293778 7.64808508,6.40587037 6.94371789,6.74039412 C6.11577751,7.13203167 5.37021926,7.65625486 4.69056671,8.26002943 C4.06446255,8.81688909 3.48366855,9.42678299 2.98525668,10.1019498 C2.10170837,11.3054194 1.41175806,12.6108779 0.919524847,14.0162856 C0.579698572,14.9851806 0.309897106,15.9703939 0.198681235,16.9923231 C0.116299108,17.7511209 0.04009564,18.5119584 0.00508323598,19.2748358 C-0.0155122958,19.7378656 0.0297978741,20.204975 0.0812867035,20.6680048 C0.155430618,21.3186943 0.241931851,21.9714235 0.359326382,22.6159937 C0.569400806,23.766429 0.940120378,24.874029 1.45912778,25.9224754 C1.81337093,26.636398 2.21292424,27.3360422 2.66808549,27.9887714 C3.11912764,28.6353814 3.63813504,29.2432355 4.18597619,29.8143736 C4.63289922,30.281483 5.15190663,30.6853592 5.66061626,31.0892354 C6.76659632,31.9704199 8.01056643,32.6272288 9.33485913,33.1147359 C10.9104173,33.6940332 12.5498216,33.981642 14.2407148,34 C14.866819,33.9469657 15.4949827,33.9122895 16.1169677,33.8347779 C16.6606898,33.7654254 17.2064714,33.6777149 17.7378361,33.5451293 C18.8870668,33.2595602 19.9889277,32.837326 21.0372403,32.2804663 C22.1143866,31.7093282 23.1070912,31.0219227 24.0009373,30.2039714 C24.5261234,29.7225835 25.0059993,29.1881615 25.4858751,28.6598587 C26.0852051,28.0010101 26.5856765,27.272809 27.0346591,26.5058521 C27.5619047,25.6042698 28.0047087,24.6720909 28.3218799,23.6766787 C28.6740635,22.5711185 28.8964952,21.4390412 28.9726987,20.2845263 C29.0303662,19.4359783 28.9994729,18.5772314 28.8532446,17.7327629 Z M20.0115828,18.1142015 L20.0115828,20.9535738 L16.2673151,20.9535738 L16.2673151,18.1142015 L12.7331219,18.1142015 L12.7331219,21.3594898 L16.2693747,21.3594898 L16.2693747,25.0086544 L12.7331219,25.0086544 L12.7331219,28.2539427 L8.98885419,28.2539427 L8.98885419,14.465037 L12.7331219,14.465037 L20.0115828,14.465037 L20.0115828,18.1142015 Z" id="Shape" fill="#844FC1"></path>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="29px" height="34px" viewBox="0 0 29 34" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 53 (72520) - https://sketchapp.com -->
<title>Polluxui</title>
<desc>Created with Sketch.</desc>
<g id="Dashboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="PolluxUI_dashboard" transform="translate(-31.000000, -17.000000)" fill="#FFFFFF" fill-rule="nonzero">
<g id="Group">
<g id="Group-2">
<g id="Logo" transform="translate(31.000000, 17.000000)">
<g id="Polluxui">
<path d="M7.49397732,2.99977945 C6.74302902,3.01402476 5.9817655,2.33635499 6.00033291,1.49995176 C6.01890031,0.606567292 6.70176813,-0.0100511473 7.51048168,0.000124074453 C8.36664526,0.0102992962 8.99793696,0.6574434 9,1.49384663 C9,2.32414473 8.3872757,2.96721874 7.49397732,2.99977945 Z" id="Path"></path>
<path d="M28.8532446,17.7327629 C28.754386,17.1677441 28.6102173,16.6068049 28.4598699,16.051985 C28.2003662,15.0973685 27.8317062,14.1815077 27.2900437,13.3492779 C26.9852299,12.8801288 26.6557013,12.4150592 26.2664458,12.019342 C25.9039644,11.650142 25.4693987,11.3400956 25.0286543,11.0606459 C24.3098703,10.6057752 23.5025254,10.3813995 22.6498704,10.340604 C22.3409374,10.3263255 22.0320045,10.3202062 21.725131,10.3426437 C21.3605901,10.3712006 20.9960492,10.4262747 20.6335679,10.4854283 C20.0857267,10.5751785 19.5420047,10.709804 18.9900444,10.764878 C18.5781338,10.8056736 18.1538658,10.764878 17.7378361,10.7322415 C17.1879354,10.6894062 16.6792258,10.4956272 16.2117072,10.2120979 C15.7174144,9.91225038 15.313742,9.51449349 14.9594989,9.05962278 C14.6279108,8.63738854 14.2695485,8.23555209 13.9235436,7.82555652 C13.4972161,7.31969134 13.0132211,6.88317864 12.4241889,6.56497313 C11.3964719,6.01219303 10.2925514,5.9183632 9.16185666,6.05706817 C8.38746467,6.15293778 7.64808508,6.40587037 6.94371789,6.74039412 C6.11577751,7.13203167 5.37021926,7.65625486 4.69056671,8.26002943 C4.06446255,8.81688909 3.48366855,9.42678299 2.98525668,10.1019498 C2.10170837,11.3054194 1.41175806,12.6108779 0.919524847,14.0162856 C0.579698572,14.9851806 0.309897106,15.9703939 0.198681235,16.9923231 C0.116299108,17.7511209 0.04009564,18.5119584 0.00508323598,19.2748358 C-0.0155122958,19.7378656 0.0297978741,20.204975 0.0812867035,20.6680048 C0.155430618,21.3186943 0.241931851,21.9714235 0.359326382,22.6159937 C0.569400806,23.766429 0.940120378,24.874029 1.45912778,25.9224754 C1.81337093,26.636398 2.21292424,27.3360422 2.66808549,27.9887714 C3.11912764,28.6353814 3.63813504,29.2432355 4.18597619,29.8143736 C4.63289922,30.281483 5.15190663,30.6853592 5.66061626,31.0892354 C6.76659632,31.9704199 8.01056643,32.6272288 9.33485913,33.1147359 C10.9104173,33.6940332 12.5498216,33.981642 14.2407148,34 C14.866819,33.9469657 15.4949827,33.9122895 16.1169677,33.8347779 C16.6606898,33.7654254 17.2064714,33.6777149 17.7378361,33.5451293 C18.8870668,33.2595602 19.9889277,32.837326 21.0372403,32.2804663 C22.1143866,31.7093282 23.1070912,31.0219227 24.0009373,30.2039714 C24.5261234,29.7225835 25.0059993,29.1881615 25.4858751,28.6598587 C26.0852051,28.0010101 26.5856765,27.272809 27.0346591,26.5058521 C27.5619047,25.6042698 28.0047087,24.6720909 28.3218799,23.6766787 C28.6740635,22.5711185 28.8964952,21.4390412 28.9726987,20.2845263 C29.0303662,19.4359783 28.9994729,18.5772314 28.8532446,17.7327629 Z M20.0115828,18.1142015 L20.0115828,20.9535738 L16.2673151,20.9535738 L16.2673151,18.1142015 L12.7331219,18.1142015 L12.7331219,21.3594898 L16.2693747,21.3594898 L16.2693747,25.0086544 L12.7331219,25.0086544 L12.7331219,28.2539427 L8.98885419,28.2539427 L8.98885419,14.465037 L12.7331219,14.465037 L20.0115828,14.465037 L20.0115828,18.1142015 Z" id="Shape"></path>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="117px" height="34px" viewBox="0 0 117 34" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 53 (72520) - https://sketchapp.com -->
<title>Logo</title>
<desc>Created with Sketch.</desc>
<g id="Dashboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Logo" fill="#FFFFFF" fill-rule="nonzero">
<path d="M39.4,27 L39.4,13.2 C40.6400062,13.0799994 42.3866554,13.02 44.64,13.02 C46.573343,13.02 47.8966631,13.3333302 48.61,13.96 C49.3233369,14.5866698 49.68,15.7733246 49.68,17.52 C49.68,19.2666754 49.3433367,20.4566635 48.67,21.09 C47.9966633,21.7233365 46.7866754,22.04 45.04,22.04 C44.1599956,22.04 43.2933376,21.9866672 42.44,21.88 L42.44,27 L39.4,27 Z M42.44,19.7 L44.58,19.7 C45.3666706,19.6866666 45.9033319,19.5333348 46.19,19.24 C46.4766681,18.9466652 46.62,18.3733376 46.62,17.52 C46.62,16.6666624 46.4766681,16.0933348 46.19,15.8 C45.9033319,15.5066652 45.3666706,15.36 44.58,15.36 L42.44,15.38 L42.44,19.7 Z M56.08,16.86 C57.9200092,16.86 59.2233295,17.2566627 59.99,18.05 C60.7566705,18.8433373 61.14,20.1866572 61.14,22.08 C61.14,23.9733428 60.7566705,25.3099961 59.99,26.09 C59.2233295,26.8700039 57.9200092,27.26 56.08,27.26 C54.2266574,27.26 52.9166705,26.8700039 52.15,26.09 C51.3833295,25.3099961 51,23.9733428 51,22.08 C51,20.1733238 51.3833295,18.8266706 52.15,18.04 C52.9166705,17.2533294 54.2266574,16.86 56.08,16.86 Z M56.08,19.08 C55.2933294,19.08 54.766668,19.279998 54.5,19.68 C54.233332,20.080002 54.1,20.879994 54.1,22.08 C54.1,23.2533392 54.233332,24.039998 54.5,24.44 C54.766668,24.840002 55.2933294,25.04 56.08,25.04 C56.8400038,25.04 57.3566653,24.840002 57.63,24.44 C57.9033347,24.039998 58.04,23.2533392 58.04,22.08 C58.04,20.8933274 57.906668,20.0966687 57.64,19.69 C57.373332,19.2833313 56.8533372,19.08 56.08,19.08 Z M66.12,13 L66.12,23.78 C66.12,24.44667 66.4933296,24.78 67.24,24.78 L68.04,24.78 L68.38,26.84 C67.8733308,27.106668 67.086672,27.24 66.02,27.24 C65.1399956,27.24 64.4466692,27.0033357 63.94,26.53 C63.4333308,26.0566643 63.18,25.386671 63.18,24.52 L63.18,13 L66.12,13 Z M72.66,13 L72.66,23.78 C72.66,24.44667 73.0333296,24.78 73.78,24.78 L74.58,24.78 L74.92,26.84 C74.4133308,27.106668 73.626672,27.24 72.56,27.24 C71.6799956,27.24 70.9866692,27.0033357 70.48,26.53 C69.9733308,26.0566643 69.72,25.386671 69.72,24.52 L69.72,13 L72.66,13 Z M85.6,17.14 L85.6,27 L83.26,27 L83.04,25.64 C81.6799932,26.7200054 80.3200068,27.26 78.96,27.26 C77.1066574,27.26 76.18,26.3466758 76.18,24.52 L76.18,17.14 L79.14,17.14 L79.14,23.62 C79.1266666,24.0466688 79.1999992,24.3466658 79.36,24.52 C79.5200008,24.6933342 79.799998,24.78 80.2,24.78 C80.7733362,24.78 81.593328,24.5066694 82.66,23.96 L82.66,17.14 L85.6,17.14 Z M92.52,22.86 L92.4,22.86 L90.06,27 L87.02,27 L90.06,21.94 L87.24,17.14 L90.26,17.14 L92.36,20.94 L92.56,20.94 L94.66,17.14 L97.68,17.14 L94.86,21.94 L97.9,27 L94.86,27 L92.52,22.86 Z M110.44,13.2 L110.44,21.5 C110.44,23.6066772 110.036671,25.093329 109.23,25.96 C108.423329,26.826671 107.033343,27.26 105.06,27.26 C102.97999,27.26 101.516671,26.826671 100.67,25.96 C99.8233291,25.093329 99.4,23.6066772 99.4,21.5 L99.4,13.2 L102.44,13.2 L102.44,21.5 C102.44,22.766673 102.616665,23.633331 102.97,24.1 C103.323335,24.566669 103.973329,24.8 104.92,24.8 C105.853338,24.8 106.496665,24.566669 106.85,24.1 C107.203335,23.633331 107.38,22.766673 107.38,21.5 L107.38,13.2 L110.44,13.2 Z M116.16,27 L113.12,27 L113.12,13.2 L116.16,13.2 L116.16,27 Z" id="PolluxUI"></path>
<g id="Polluxui">
<path d="M7.49397732,2.99977945 C6.74302902,3.01402476 5.9817655,2.33635499 6.00033291,1.49995176 C6.01890031,0.606567292 6.70176813,-0.0100511473 7.51048168,0.000124074453 C8.36664526,0.0102992962 8.99793696,0.6574434 9,1.49384663 C9,2.32414473 8.3872757,2.96721874 7.49397732,2.99977945 Z" id="Path"></path>
<path d="M28.8532446,17.7327629 C28.754386,17.1677441 28.6102173,16.6068049 28.4598699,16.051985 C28.2003662,15.0973685 27.8317062,14.1815077 27.2900437,13.3492779 C26.9852299,12.8801288 26.6557013,12.4150592 26.2664458,12.019342 C25.9039644,11.650142 25.4693987,11.3400956 25.0286543,11.0606459 C24.3098703,10.6057752 23.5025254,10.3813995 22.6498704,10.340604 C22.3409374,10.3263255 22.0320045,10.3202062 21.725131,10.3426437 C21.3605901,10.3712006 20.9960492,10.4262747 20.6335679,10.4854283 C20.0857267,10.5751785 19.5420047,10.709804 18.9900444,10.764878 C18.5781338,10.8056736 18.1538658,10.764878 17.7378361,10.7322415 C17.1879354,10.6894062 16.6792258,10.4956272 16.2117072,10.2120979 C15.7174144,9.91225038 15.313742,9.51449349 14.9594989,9.05962278 C14.6279108,8.63738854 14.2695485,8.23555209 13.9235436,7.82555652 C13.4972161,7.31969134 13.0132211,6.88317864 12.4241889,6.56497313 C11.3964719,6.01219303 10.2925514,5.9183632 9.16185666,6.05706817 C8.38746467,6.15293778 7.64808508,6.40587037 6.94371789,6.74039412 C6.11577751,7.13203167 5.37021926,7.65625486 4.69056671,8.26002943 C4.06446255,8.81688909 3.48366855,9.42678299 2.98525668,10.1019498 C2.10170837,11.3054194 1.41175806,12.6108779 0.919524847,14.0162856 C0.579698572,14.9851806 0.309897106,15.9703939 0.198681235,16.9923231 C0.116299108,17.7511209 0.04009564,18.5119584 0.00508323598,19.2748358 C-0.0155122958,19.7378656 0.0297978741,20.204975 0.0812867035,20.6680048 C0.155430618,21.3186943 0.241931851,21.9714235 0.359326382,22.6159937 C0.569400806,23.766429 0.940120378,24.874029 1.45912778,25.9224754 C1.81337093,26.636398 2.21292424,27.3360422 2.66808549,27.9887714 C3.11912764,28.6353814 3.63813504,29.2432355 4.18597619,29.8143736 C4.63289922,30.281483 5.15190663,30.6853592 5.66061626,31.0892354 C6.76659632,31.9704199 8.01056643,32.6272288 9.33485913,33.1147359 C10.9104173,33.6940332 12.5498216,33.981642 14.2407148,34 C14.866819,33.9469657 15.4949827,33.9122895 16.1169677,33.8347779 C16.6606898,33.7654254 17.2064714,33.6777149 17.7378361,33.5451293 C18.8870668,33.2595602 19.9889277,32.837326 21.0372403,32.2804663 C22.1143866,31.7093282 23.1070912,31.0219227 24.0009373,30.2039714 C24.5261234,29.7225835 25.0059993,29.1881615 25.4858751,28.6598587 C26.0852051,28.0010101 26.5856765,27.272809 27.0346591,26.5058521 C27.5619047,25.6042698 28.0047087,24.6720909 28.3218799,23.6766787 C28.6740635,22.5711185 28.8964952,21.4390412 28.9726987,20.2845263 C29.0303662,19.4359783 28.9994729,18.5772314 28.8532446,17.7327629 Z M20.0115828,18.1142015 L20.0115828,20.9535738 L16.2673151,20.9535738 L16.2673151,18.1142015 L12.7331219,18.1142015 L12.7331219,21.3594898 L16.2693747,21.3594898 L16.2693747,25.0086544 L12.7331219,25.0086544 L12.7331219,28.2539427 L8.98885419,28.2539427 L8.98885419,14.465037 L12.7331219,14.465037 L20.0115828,14.465037 L20.0115828,18.1142015 Z" id="Shape"></path>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -1,7 +0,0 @@
(function($) {
'use strict';
var editor = ace.edit("aceExample");
editor.setTheme("ace/theme/chaos");
editor.getSession().setMode("ace/mode/javascript");
document.getElementById('aceExample').style.fontSize = '1rem';
})(jQuery);

View File

@@ -1,107 +0,0 @@
$("#btnSave").on('click',function(e){
e.preventDefault();
data_id = $('#data-id').val();
let url = parseInt(data_id) === 0 ? save_url : update_url;
$.ajax({
url: url,
type:"POST",
data :{
"_token": csrf_token,
uid : data_id,
name_en: $('#name-en').val(),
weight: $('#weight').val()
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
},
});
});
function delete_data(uid){
Swal.fire({
text: confirm_delete_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_delete,
cancelButtonText: confirm_cancel
}).then((result) => {
if (result.value) {
$.ajax({
url: delete_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
function restore_data(uid){
Swal.fire({
text: confirm_restore_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_restore,
cancelButtonText: confirm_cancel_restore,
}).then((result) => {
if (result.value) {
$.ajax({
url: restore_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res) {
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
$('#modal-antibiotic').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
var modal = $(this);
if(action === "new"){
// Clear inputs
//modal.find('.modal-body select[name="lab_ids"]').attr('multiple', true)
modal.find('.modal-body input[name="uid"]').val(0);
modal.find('.modal-title').html(modal_add_title);
}else if(action === "edit"){
uid = button.data('uid');
//modal.find('.modal-body select[name="lab_ids"]').attr('multiple', false)
modal.find('.modal-body input[name="uid"]').val(uid);
modal.find('.modal-title').html(modal_edit_title);
$.ajax({
url: get_url,
type:"POST",
data:{
"_token": csrf_token,
uid: uid,
},
success:function(res){
let data = res.data;
modal.find('.modal-body input[name="name_en"]').val(data.name_en);
modal.find('.modal-body input[name="weight"]').val(data.weight);
//modal.find('.modal-body select[name="lab_ids"]').val(data.lab_id).trigger('change');
if(!res.success) handleMessage(res.success, res.message)
}
});
}
})

View File

@@ -1,486 +0,0 @@
// Load test items and settings
$('#modal-assign-test').on('show.bs.modal', function (event) {
$.ajax({
url: get_refs_base_url + '/test-items',
type:"GET",
dataType:"json",
success:function(response){
$('#test-item-list').html('')
if(response.success){
testSamples = []
response.data.map(item=> {
if (item.samples.length > 0) {
var container = document.createElement('DIV')
container.classList.add("p-0","col-lg-3","col-sm-12","px-2","my-2","bg-white","department-test")
container.setAttribute('data-id', item.department_id)
var departmentDev = document.createElement('DIV');
departmentDev.classList.add("group-test-box","p-0","border","bg-white")
item.samples.map(sampleType => {
sampleType.testSamples.map(suggestionItem =>{
let name = (suggestionItem.code!='' && suggestionItem.code!=null ? (suggestionItem.code + ' - ') : '') + suggestionItem.test_name
let suggestionPayload = {id: suggestionItem.id, name: name, code: (suggestionItem.code==null ? '' : suggestionItem.code) }
testSamples.push(suggestionPayload)
})
var sampleTypeGroup = document.createElement('DIV');
sampleTypeGroup.classList.add('sample-type-wrapper')
sampleTypeGroup.setAttribute('data-sample-type-id', sampleType.id)
sampleTypeGroup.setAttribute('id', 'dsample-'+sampleType.id)
var sampleTypeHeader = document.createElement('DIV')
sampleTypeHeader.classList.add('px-3','font-13','py-2')
sampleTypeHeader.style.backgroundColor=sampleType.bg_color
sampleTypeHeader.style.color=sampleType.color
sampleTypeHeader.innerHTML = '<i class="mdi mdi-hand-pointing-right mr-1"></i><b>'+sampleType.name_en+'</b>'
var sampleTypeHeaderDec = document.createElement('DIV')
sampleTypeHeaderDec.classList.add('px-3','bg-light','font-13','py-2')
var descriptionSelection = document.createElement('SELECT');
descriptionSelection.setAttribute('name','sample-desc')
descriptionSelection.setAttribute('id','sample-desc-'+sampleType.id)
descriptionSelection.style.height='25px';
descriptionSelection.classList.add('form-control','form-control-xxs','rounded-0','sample-desc','p-0')
if(sampleType.descriptions!=null){
var blankOption = document.createElement('OPTION');
descriptionSelection.append(blankOption)
sampleType.descriptions.map(function (descItem) {
var descriptionsItem = document.createElement('OPTION');
descriptionsItem.setAttribute('value',descItem.toString());
descriptionsItem.text = descItem;
descriptionSelection.append(descriptionsItem)
})
} else{
var descriptionsItem = document.createElement('OPTION');
descriptionsItem.setAttribute('value','');
descriptionsItem.text = 'Sample Description';
descriptionSelection.append(descriptionsItem)
}
/* //sample-type-color
var lb = document.createElement('LABEL')
lb.classList.add('p-0','col-sm-12','font-13')
lb.innerText = 'Sample Description'
sampleTypeHeader.append(lb)
*/
sampleTypeHeaderDec.append(descriptionSelection)
sampleTypeGroup.append(sampleTypeHeader)
sampleTypeGroup.append(sampleTypeHeaderDec)
let listUnstyle1 = document.createElement('ul');
listUnstyle1.classList.add('list-unstyled')
let sampleTest = list_to_tree(sampleType.testSamples)
sampleTest.map(testOption => {
let testLevel1 = document.createElement('LI');
let textLevel1CheckBox = document.createElement('DIV');
textLevel1CheckBox.classList.add('form-check','d-inline')
textLevel1CheckBox.innerHTML = '<label '+(testOption.children.length ? 'onclick="checkAll(\'st-'+testOption.id+'\',\'check-item-'+testOption.id+'\')"' : '')+' class="form-check-label d-inline font-13 st-'+testOption.id+'"><input name="sample_tests[]" data-price="'+testOption.price+'" data-group-result="'+testOption.group_result+'" type="checkbox" id="st-'+testOption.id+'" value="' + testOption.id + '" class="form-check-input sample-test check-item-'+testOption.id+'"> ' + testOption.test_name + ' <i class="input-helper"></i></label> '+(testOption.children.length ? '': '<span class="float-right '+(testOption.group_result!='' && parseFloat(testOption.price)>0 ? '':'d-none')+'" style="top: 0; right: 0;">$ ' + toFixedNumber(testOption.price, 2) + '</span>');
// Child First Level
if(testOption.children.length){
testLevel1.classList.add('heading')
let indicator1 = document.createElement('i')
indicator1.classList.add('indicator','mdi','mdi-plus-circle')
indicator1.addEventListener('click', function () {
$('li .ul-'+testOption.id).slideToggle();
if(indicator1.classList.contains('mdi-plus-circle')){
indicator1.classList.remove('mdi-plus-circle')
indicator1.classList.add('mdi-minus-circle')
}else{
indicator1.classList.remove('mdi-minus-circle')
indicator1.classList.add('mdi-plus-circle')
}
})
testLevel1.append(indicator1)
testLevel1.append(textLevel1CheckBox)
let children = testOption.children
let listUnstyle2 = document.createElement('ul');
listUnstyle2.classList.add('list-unstyled','ul-'+testOption.id)
children.map(function (child){
let testLevel2 = document.createElement('LI');
let textLevel2CheckBox = document.createElement('DIV');
textLevel2CheckBox.classList.add('form-check','d-inline')
textLevel2CheckBox.innerHTML = '<label '+(child.children.length ? 'onclick="checkAll(\'st-'+child.id+'\',\'sub-check-item-'+child.id+'\')"' : '')+' class="form-check-label d-inline font-13 st-'+child.id+'"><input name="sample_tests[]" data-group-result="'+child.group_result+'" type="checkbox" data-price="'+child.price+'" id="st-'+child.id+'" value="' + child.id + '" class="form-check-input sample-test check-item-'+testOption.id+'"> ' + child.test_name + ' <i class="input-helper"> </i><i class="input-helper"> </i></label> '+(child.children.length ? '' : '<span class="float-right '+(child.group_result!='' && parseFloat(child.price)>0 ? '':'d-none')+'" style="top: 0; right: 0;">$ ' + toFixedNumber(child.price, 2) + '</span>');
// Child Second Level
if(child.children.length){
testLevel2.classList.add('heading')
let indicator2 = document.createElement('i')
indicator2.classList.add('indicator','mdi','mdi-plus-circle')
indicator2.addEventListener('click', function () {
$('li .li-ul-'+testOption.id).slideToggle();
if(indicator2.classList.contains('mdi-plus-circle')){
indicator2.classList.remove('mdi-plus-circle')
indicator2.classList.add('mdi-minus-circle')
}else{
indicator2.classList.remove('mdi-minus-circle')
indicator2.classList.add('mdi-plus-circle')
}
})
testLevel2.append(indicator2)
testLevel2.append(textLevel2CheckBox)
if(child.children.length){
let grandchildren = child.children
let listUnstyle3 = document.createElement('ul');
listUnstyle3.classList.add('list-unstyled','li-ul-'+testOption.id)
grandchildren.map(function (grandchild){
let testLevel3 = document.createElement('LI');
testLevel3.classList.add('font-weight-normal')
let textLevel3CheckBox = document.createElement('DIV');
textLevel3CheckBox.classList.add('form-check','d-inline')
textLevel3CheckBox.innerHTML = '<label class="form-check-label d-inline font-13 st-'+grandchild.id+'"><input name="sample_tests[]" data-group-result="'+grandchild.group_result+'" type="checkbox" data-price="'+grandchild.price+'" id="st-'+grandchild.id+'" value="' + grandchild.id + '" class="form-check-input sub-check-item-'+child.id+' sample-test check-item-'+testOption.id+'"> ' + grandchild.test_name + ' <i class="input-helper"></i></label><span class="float-right '+(grandchild.group_result!='' && parseFloat(grandchild.price)>0 ? '':'d-none')+'" style="top: 0; right: 0;">$ ' + toFixedNumber(grandchild.price, 2) + '</span>';
testLevel3.append(textLevel3CheckBox)
listUnstyle3.append(testLevel3)
testLevel2.append(listUnstyle3)
})
}
}
else{
testLevel2.classList.add('font-weight-normal')
testLevel2.append(textLevel2CheckBox)
}
listUnstyle2.append(testLevel2)
})
testLevel1.append(listUnstyle2)
}
else{
testLevel1.classList.add('font-weight-normal')
testLevel1.append(textLevel1CheckBox)
}
listUnstyle1.append(testLevel1)
})
sampleTypeGroup.append(listUnstyle1)
departmentDev.append(sampleTypeGroup)
container.append(departmentDev)
})
$('#test-item-list').append(container);
}
})
if(sample_id!=0){
getSampleTestItem()
}
// console.log(testSamples)
autocomplete(document.getElementById("mySearchTest"), testSamples);
}
}
});
});
$('#modal-assign-test').find(".btnAssignTest").on("click", function (evt) {
evt.preventDefault();
let isAddResult = ($(this).attr('value')=='save_test_and_add_result') ? true : false
var sample_tests = [];
var sample_details = [];
var test_payments = {};
var sample_id = $('#modal-assign-test').find("input[name=sample_id]").val();
var data_source = $('#modal-assign-test').find("input[name=sample_id]").attr('data-source')
$('#modal-assign-test').find(".modal-body .department-test").each(function () {
var $department_samples = $(this).find("div.sample-type-wrapper");
if ($department_samples.length > 0) {
$department_samples.each(function () {
var sample_type_id = Number($(this).data('sample-type-id'));
var $selected_tests = $(this).find(":checkbox.sample-test:checked");
var $sample_desc = $(this).find("select.sample-desc");
//var first_weight = $(this).find("input[name=first_weight]").val();
//var second_weight = $(this).find("input[name=second_weight]").val();
$(this).find(":checkbox.sample-test").each(function () {
var checkbox = $(this).get(0);
var id = $(this).val();
if (checkbox && checkbox.indeterminate && id > 0) {
sample_tests.push(id);
}
});
if ($selected_tests.length > 0) {
if (!isNaN(sample_type_id) && sample_type_id > 0 && $sample_desc.length > 0) {
sample_details.push({
'sample_id' : sample_id,
'sample_type_id' : sample_type_id,
'sample_description' : $sample_desc.val(),
//'first_weight' : first_weight === undefined ? null : first_weight,
//'second_weight' : second_weight === undefined ? null : second_weight,
});
}
//Selected test
$selected_tests.each(function () {
var val = Number($(this).val());
if (!isNaN(val) && val > 0) sample_tests.push(val);
var group_result = $(this).data("group-result");
var price = $(this).data("test-price") || 0;
if (group_result && price > 0) {
/**Added: 13-11-2022 remove all characters exept number and alphabet */
var group_result_ind = group_result.replace(/[^A-Za-z0-9]/g,"");
group_result_ind = group_result_ind.replace(" ", "");
//End
test_payments[group_result_ind] = {
group_result: group_result,
price: parseFloat(price)
};
}
});
}
});
}
});
if (sample_tests.length === 0 || sample_id=='') {
var res = {success: false, message: "Couldn't save assign tests! Please contact system administrator."}
customErrorAlert(res)
return false;
}
$.ajax({
url: sample_base_url.toString()+'/assign-test',
type:"POST",
dataType:"JSON",
data :{
"_token": csrf_token,
sample_id: sample_id,
sample_tests : sample_tests,
sample_details : sample_details,
},
success:function(res){
if(res.success){
if(isAddResult){
if(data_source == 'new_sample'){
window.location = sample_base_url + '/edit/'+sample_id+'?add-result'
}
$('#modal-assign-test .close').click();
$('#sample-forms #btnAddTestResult').click()
}
else alertify.success("Test already assigned.")
}else{
customErrorAlert(res)
}
},
error:function(error){
customErrorAlert(error)
}
});
});
/** LOAD test and set default check state or value */
var $modal_test = $("#modal-assign-test");
var $sample_forms = $("#sample-forms");
//$sample_forms.on("click", ".btnShowTestModal", function (evt) {
// evt.preventDefault();
//$modal_test.find("input[type=text]").val('');
//$modal_test.find(".total-test-payment").val(0);
//$modal_test.find("select").val(-1);
//$modal_test.find(".tree-filter").trigger("keyup");
//$modal_test.find('.tree-list input[type=checkbox].sample-test').iCheck('uncheck');
/*
var form = $(this).parents("form.frm-sample-entry");
var sampleForm = new SampleForm(form);
var data = sampleForm.get_data();
*/
//});
function getSampleTestItem() {
$.ajax({
url : sample_base_url +'/' + sample_id + '/tests',
type : 'get',
data : {},
dataType : 'json',
success : function (resource) {
if(resource.success) {
let totalPrice = 0
let totalTest = 0
res = resource.data
$('#modal-assign-test .modal-header .sample-number').html(res.sample_number)
$('#modal-assign-test .modal-header .patient-code').html(res.patient.uuid)
$('#modal-assign-test .modal-header .patient-name').html(res.patient.name)
$('#modal-assign-test .modal-header .sample-source').html(res.sample_source.name)
$('#modal-assign-test #sample-id').val(res.id)
if (res.sample_tests && Array.isArray(res.sample_tests) && res.sample_tests.length > 0) {
for (var i in res.sample_tests) {
$modal_test.find("input#st-" + res.sample_tests[i].test_sample_id).iCheck('check');
//totalPrice+= parseFloat(res.sample_tests[i].usd_price)
//totalTest+=1
}
}
//$('#total-test-payment').text('$ '+parseFloat(totalPrice).toFixed(2))
//$('#total-test').text(parseInt(totalTest))
if (res.sample_details && Array.isArray(res.sample_details) && res.sample_details.length > 0) {
for (var i in res.sample_details) {
var $department_sample = $modal_test.find("#dsample-" + res.sample_details[i].sample_type_id);
if ($department_sample != undefined) {
// var $sample_desc = $department_sample.find("select[name=sample_desc]");
var $sample_desc = $department_sample.find("#sample-desc-"+res.sample_details[i].sample_type_id);
//var $first_weight = $department_sample.find("input[name=first_weight]");
//var $second_weight = $department_sample.find("input[name=second_weight]");
if ($sample_desc != undefined) {
$sample_desc.val(res.sample_details[i].sample_descr.toString());
}
// if ($first_weight != undefined) $first_weight.val(res.sample_details[i].sample_volume1);
// if ($second_weight != undefined) $second_weight.val(res.sample_details[i].sample_volume2);
}
}
}
calculateTestPrice()
}
},
error : function () {
}
});
}
function checkAll(parentId, targetClass) {
var checkedState = $('#'+parentId).is(':checked');
var checkboxes = document.getElementsByClassName(targetClass);
for (var i = 0; i < checkboxes.length; i++) {
checkboxes[i].checked = checkedState;
}
}
function saveTestGroup() {
var checkboxes = document.getElementsByClassName('sample-test');
var test_sample_ids = []
for (var i = 0; i < checkboxes.length; i++) {
if(checkboxes[i].checked){
test_sample_ids.push(checkboxes[i].getAttribute('value'))
}
}
if(test_sample_ids.length){
Swal.fire({
html:"<p style='float: left;'>Name</p>",
input: "text",
showCancelButton: !0,
position: "center",
confirmButtonText: "<i class='fa fa-save mr-2'></i>Save",
cancelButtonText: "Cancel",
showLoaderOnConfirm: !1,
confirmButtonColor: "#4fb51a",
preConfirm: function (n) {
return new Promise(function (t) {
$.ajax({
url: get_refs_base_url + '/test-group/save',
method:'post',
dataType:'json',
data:{
"_token": csrf_token,
name_en: n,
test_sample_ids: test_sample_ids
},
success:function(r)
{
if(!r.success){
Swal.showValidationMessage('Failed while saving test group. ' + r.errors)
Swal.enableButtons()
}
else {
t(r.data)
}
}
})
})
},
allowOutsideClick:!1,
}).then(function (t) {
if(!t.dismiss){
t.value.map(item =>{
$('#test-group-slot').append('<div class="btn-group mr-2" id="tsg-'+item.id+'" role="group">' +
'<button onclick="useTemplate('+item.id+')" class="btn btn-md btn-info rounded-0" type="button"><i class="mdi mdi-checkbox-marked-outline"></i>&nbsp;'+item.group_name+'</button>' +
'<button onclick="deleteGroupTemplate('+item.id+')" type="button" class="btn btn-sm btn-inverse-danger"><i class="mdi mdi-close-circle"></i></button>' +
'</div>')
alertify.success("Reject comment successfully added.")
})
}
})
}
}
function useTemplate(group_id){
$.ajax({
url: get_refs_base_url + '/test-group/get/'+group_id,
method:'get',
dataType:'json',
success:function(r)
{
if(r.success){
$(".sample-type-wrapper input:checkbox").prop('checked', false);
const templateItems = r.data
var checkboxes = document.getElementsByClassName('sample-test');
for (var i = 0; i < checkboxes.length; i++) {
//if(templateItems.includes(parseInt(checkboxes[i].getAttribute('value')))){
if(templateItems.includes(checkboxes[i].getAttribute('value'))){
let sugg_id = checkboxes[i].getAttribute('value');
$('.st-'+sugg_id).click();
}
}
}
}
})
}
function deleteGroupTemplate(group_id){
Swal.fire({
text: confirm_delete_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_delete,
cancelButtonText: confirm_cancel
}).then((result) => {
if (result.value) {
$.ajax({
url: get_refs_base_url + '/test-group/delete/'+group_id,
method:'POST',
dataType:"JSON",
data:{
"_token": csrf_token,
'id' : group_id
},
success:function(response){
$('#tsg-'+group_id).hide();
handleMessage(response.success, response.message)
}
})
}
});
}
function calculateTestPrice() {
let totalPrice = 0, totalTest=0;
var checkboxes = document.getElementsByClassName('sample-test');
for (var i = 0; i < checkboxes.length; i++) {
if(checkboxes[i].checked == true && (checkboxes[i].getAttribute('data-group-result') !="" && checkboxes[i].getAttribute('data-group-result')!="null") && parseFloat(checkboxes[i].getAttribute('data-price')) >0){
//totalPrice+= parseFloat(checkboxes[i].attr('data-price'))
totalPrice+= parseFloat(checkboxes[i].getAttribute('data-price'))
totalTest+=1
}
//checkboxes[i].checked = checkedState;
}
$('#total-test-payment').text('$ '+parseFloat(totalPrice).toFixed(2))
$('#total-test').text(parseInt(totalTest))
}
$('#form-assign-test').on('change', ':checkbox', function () {
calculateTestPrice()
})

View File

@@ -1,30 +0,0 @@
const CAMLIS_VARIABLE_FORMAT = {
TEST: /^T{1}\d*$/g
};
function calculateTestValue(formula) {
CAMLIS_VARIABLE_FORMAT.TEST.lastIndex = 0;
if (formula) {
var parser = new exprEval.Parser();
var expr = parser.parse(formula);
var variables = expr.variables();
var map_values = {};
for(var i in variables) {
if (CAMLIS_VARIABLE_FORMAT.TEST.test(variables[i])) {
var sample_test_id = variables[i].replace('T', 'result-');
var value = $("#" + sample_test_id).val() || '';
if (value.length > 0) map_values[variables[i]] = parseFloat(value || 0);
}
CAMLIS_VARIABLE_FORMAT.TEST.lastIndex = 0;
}
if (variables.length > _.values(map_values).length) return null;
return expr.evaluate(map_values);
}
return 0;
}

View File

@@ -1,254 +0,0 @@
var months = ['មករា', 'កុម្ភៈ', 'មីនា', 'មេសា', 'ឧសភា', 'មិថុនា', 'កក្កដា', 'សីហា', 'កញ្ញា', 'តុលា', 'វិច្ឆិកា', 'ធ្នូ'];
/* DataTable Option */
var dataTableOption = {
"language": {
"lengthMenu" : "បង្ហាញ&nbsp _MENU_ &nbsp;ជួរក្នុងមួយទំព័រ",
"zeroRecords" : "គ្មានទិន្នន័យ",
"info" : "បង្ហាញទំព័រទី _PAGE_ ក្នុងចំណោម _PAGES_ ទំព័រ",
"search" : "ស្វែងរក",
"infoEmpty" : "គ្មានទិន្នន័យ",
"infoFiltered" : "(ស្វែងរកក្នុងចំណោម _MAX_)",
"paginate" : {
"previous" : "ថយក្រោយ",
"next" : "ទៅមុខ"
}
}
};
//Custom Function
/**
* Fixed Top Menu on scroll
*/
function init_scrollEvent(target) {
$(target).off("scroll").on("scroll", function (evt) {
var sTop = $(this).scrollTop();
var top_menu = $("nav#main-menu");
if (sTop >= 150 && !top_menu.hasClass("fixed-top")) {
top_menu.addClass("fixed-top");
top_menu.animate({
"marginTop": "0"
});
} else if (top_menu.hasClass("fixed-top") && sTop < 100) {
top_menu.removeAttr("style");
top_menu.removeClass("fixed-top");
}
});
}
/**
* Check if Input is number
* @param {Object} evt Event Object
*/
//Allow Double in input
function allowDouble(evt, self) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
var val = $(self).val();
if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode != 46 || val.length == 0 || val.indexOf('.') > -1)) {
return false;
}
return true;
}
/**
* Calculate Age from dob
* @param dob
* @param current_date
*/
function getAgeYear(dateString) {
// current
var c_y = new Date().getFullYear();
var c_m = new Date().getMonth();
var c_d = new Date().getDate();
var bdays = dateString.getDate();
var bmonths = dateString.getMonth();
var byear = dateString.getFullYear();
//alert(bdays);
var sdays = c_d;
var smonths = c_m;
var syear = c_y;
if(sdays < bdays)
{
sdays = parseInt(sdays) + 30;
smonths = parseInt(smonths) - 1;
var fdays = (sdays - bdays)+1;
}
else{
var fdays = (sdays - bdays)+1;
}
if(smonths < bmonths)
{
smonths = parseInt(smonths) + 12;
syear = syear - 1;
var fmonths = smonths - bmonths;
}
else
{
var fmonths = smonths - bmonths;
}
var fyear = syear - byear;
/*$('#patient_age').val(fyear);
$('#patient_agem').val(fmonths);
$('#patient_aged').val(fdays);*/
return {"days":fdays,"months":fmonths,"years":fyear};
}
function CustomDialog() {
/**
* Show Message Dialog
* @param {String} state Show or Hide Model {'show', 'hidden'}
* @param {Array} options Array of Object
*/
this.showDialog = function (state, options) {
var css = {
background : 'inherit',
border : 'inherit',
borderRadius: '50%',
height : '35px',
left : '-15px',
lineHeight : '35px',
position : 'absolute',
textAlign : 'center',
top : '-15px',
width : '35px'
};
var icon = {
success : 'fa fa-check',
warning : 'fa fa-exclamation-triangle'
}
$dialog = $("<div class='modal fade'> \
<div class='modal-dialog'> \
<div class='alert alert-dismissible' role='alert'> \
<i id='status-icon' class='fa fa-check'></i> \
<button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>&times;</span></button> \
<span id='dlg_status'></span> <span id='dlg_msg'></span> \
</div> \
</div> \
</div>");
if (options.style == 'success')
$dialog.find('.alert').css('background', '#008d4c');
else if (options.style == 'warning')
$dialog.find('.alert').css('background', '#e08e0b');
else
$dialog.find('.alert').css('background', '#d73925');
$dialog.css({
color : 'white',
fontWeight : '600',
textShadow : '0 0 5px -2px'
});
$dialog.find('#dlg_status').css('font-weight', '700');
$dialog.find('#dlg_msg').html(options.text);
$dialog.find('#dlg_status').html(options.status);
$dialog.find("#status-icon").css(css);
if (icon[options.style] != undefined)
$dialog.find("#status-icon").attr('class', icon[options.style]);
if (options.icon != undefined)
$dialog.find("#status-icon").attr('class', options.icon);
$dialog.modal(state);
$dialog.off('hidden.bs.modal').on('hidden.bs.modal', function (evt) {
$("body, .modal").css("overflow", "auto");
if (options.onHidden != undefined) {
var func = options.onHidden;
func();
}
});
//Auto Hide Dialog
if (options.autClose == undefined || options.autoClose == true) {
setTimeout(function () {
$dialog.modal('hide');
}, 2000);
}
}
/**
* Show Progress Dialog
* @param {String} state Show or Hide Model {'show', 'hide'}
* @param {Array} options Array of Object
*/
this.showProgress = function (state, options) {
//Size range [1x, 2x, 3x]
var fontSize = { '1x':'12pt', '2x':'18px', '3x':'22px' };
var more_css = {};
var position = 'absolute';
var options = $.extend({
text : 'Loading...',
appendTo : 'viewport',
size : '2x'
}, options);
if (options.appendTo === 'viewport') {
options.appendTo = $("body");
position = 'fixed';
}
if (options.display == 'inline') {
more_css = { marginTop : '40px' };
position = 'relative';
}
$dialog = $("<div class='text-center' id='progress_box'> \
<div style='position:relative; top:40%'> \
<div class='la-ball-clip-rotate la-dark la-" + options.size + "' style='margin:0 auto;'> \
<div></div> \
</div> <br> \
<h4 id='progress_text'></h4> \
</div> \
</div>");
$dialog.css($.extend(more_css, {
background : 'rgba(255, 255, 255, 0.7)',
width : '100%',
height : '100%',
position : position,
zIndex : '2000',
top : '0',
left : '0'
}));
if (state == 'show') {
$('#progress_box').remove();
options.appendTo.css("overflow", "hidden");
$dialog.find('#progress_text').html("<b>" + options.text + "</b>").css("font-size", fontSize[options.size]);
options.appendTo.append($dialog);
}
else if (state == 'hide') {
$('#progress_box').fadeOut(200, function () {
$('#progress_box').remove();
if (options != undefined && options.onHidden != undefined) {
var func = options.onHidden;
func();
}
});
$("body").css('overflow', 'auto');
}
}
}
// added 23 Jan 2021
function isInteger(x) { return typeof x === "number" && isFinite(x) && Math.floor(x) === x; }
function isFloat(x) { return !!(x % 1); }

File diff suppressed because one or more lines are too long

View File

@@ -1,139 +0,0 @@
$("#btnSave").on('click',function(e){
e.preventDefault();
data_id = $('#data-id').val();
let url = base_comment_url.toString() + (data_id < 1 ? '.save' : '.update').toString();
$.ajax({
url: url,
type:"POST",
data :{
"_token": csrf_token,
uid : data_id,
comment_desc: $('#comment-desc').val(),
sample_type_id: $('#sample-type-id').val()
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
});
});
function delete_data(uid){
Swal.fire({
text: confirm_delete_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_delete,
cancelButtonText: confirm_cancel
}).then((result) => {
if (result.value) {
$.ajax({
url: base_comment_url.toString() + '.delete',
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
function restore_data(uid){
Swal.fire({
text: confirm_restore_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_restore,
cancelButtonText: confirm_cancel_restore,
}).then((result) => {
if (result.value) {
$.ajax({
url: base_comment_url.toString() + '.restore',
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
$('#modal-comment').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
var modal = $(this);
$('#comment-desc').val("");
if(action === "new"){
// Clear inputs
modal.find('.modal-body input[name="uid"]').val(0);
modal.find('.modal-body input').val("");
modal.find('.modal-title').html(modal_add_title);
modal.find('.modal-body select[name="sample_type_id"]').attr('multiple', true)
}else if(action === "edit"){
uid = button.data('uid');
modal.find('.modal-body input[name="uid"]').val(uid);
modal.find('.modal-title').html(modal_edit_title);
modal.find('.modal-body select[name="sample_type_id"]').attr('multiple', false)
$.ajax({
url: base_comment_url.toString() + '.get',
type:"POST",
data:{
"_token": csrf_token,
uid: uid,
},
success:function(res){
let data = res.data;
modal.find('.modal-body select[name="department_id"]').val(data.sample_type.department_id).trigger('change');
getSampleTypeByDepartmentId(data.sample_type.department_id, data.sample_type_id)
//modal.find('.modal-body input[name="comment_desc"]').val(data.comment_desc);
$('#comment-desc').val(data.comment_desc)
if(!res.success) handleMessage(res.success, res.message)
}
});
}
})
$('#department-id').change(function () {
var departmentId = $(this).val()
getSampleTypeByDepartmentId(departmentId);
})
function getSampleTypeByDepartmentId(departmentId, selected_sample_type_id = 0) {
$.ajax({
url: get_refs_base_url+'/sample-type/department/'+departmentId,
type:"GET",
dataType:"JSON",
success:function(response){
$('#sample-type-id').html('');
$('#sample-type-id').append('<option></option>');
response.data.map(item =>{
var patientOption = document.createElement('OPTION');
patientOption.setAttribute('value',item.id);
if(selected_sample_type_id == item.id){
patientOption.setAttribute('selected','selected');
}
patientOption.text = item.name_en;
$('#sample-type-id').append(patientOption);
})
if(!response.success) handleMessage(res.success, res.message)
},
error: function(response) {
},
});
}

View File

@@ -1,115 +0,0 @@
$("#btnSave").on('click',function(e){
e.preventDefault();
data_id = $('#data-id').val();
let url = parseInt(data_id) === 0 ? save_url : update_url;
$.ajax({
url: url,
type:"POST",
data :{
"_token": csrf_token,
uid : data_id,
name_en: $('#name-en').val(),
name_kh: '',
category: '',
weight: $('#weight').val(),
lab_ids: $('#lab-ids').val()
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
});
});
function delete_lab(uid){
Swal.fire({
text: confirm_delete_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_delete,
cancelButtonText: confirm_cancel
}).then((result) => {
if (result.value) {
$.ajax({
url: delete_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
function restore_lab(uid){
Swal.fire({
text: confirm_restore_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_restore,
cancelButtonText: confirm_cancel_restore,
}).then((result) => {
if (result.value) {
$.ajax({
url: restore_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
$('#modal-department').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
var modal = $(this);
if(action === "new"){
// Clear inputs
modal.find('.modal-body select[name="lab_ids"]').attr('multiple', true)
modal.find('.modal-body input').val("");
modal.find('.modal-body input[name="uid"]').val(0);
modal.find('.modal-title').html(modal_add_title);
}else if(action === "edit"){
uid = button.data('uid');
modal.find('.modal-body input[name="uid"]').val(uid);
modal.find('.modal-body select[name="lab_ids"]').attr('multiple', false)
modal.find('.modal-title').html(modal_edit_title);
$.ajax({
url: get_url,
type:"POST",
data:{
"_token": csrf_token,
uid: uid,
},
success:function(res){
let data = res.data;
modal.find('.modal-body input[name="weight"]').val(data.weight);
modal.find('.modal-body select[name="lab_ids"]').val(data.lab_id).trigger('change');
$("#name-en").trigger('change')
$("#name-en").empty().trigger("change");
$('#name-en').select2({tags:true, data: [{id: data.name_en, text:data.name_en, selected: true}]})
if(!res.success) handleMessage(res.success, res.message)
}
});
}
})

View File

@@ -1,598 +0,0 @@
// Load test items and settings
let last_org_id = null;
let anti_payload = [];
$('#modal-add-test-result').on('show.bs.modal', function (event) {
$.ajax({
url: get_refs_base_url + '/test-items/'+sample_id,
type:"GET",
dataType:"json",
success:function(response){
if(response.success){
$('#modal-add-test-result .modal-header .sample-number').html(response.data.sample.sample_number)
$('#modal-add-test-result .modal-header .patient-code').html(response.data.sample.patient_uuid)
$('#modal-add-test-result .modal-header .patient-name').html(response.data.sample.patient_name)
$('#modal-add-test-result .modal-header .sample-source').html(response.data.sample.sample_source)
$('#modal-add-test-result #sample-id').val(response.data.sample.sample_id)
$('#test-item-result').empty()
let res = response.data
// anti_payload data seeding
anti_payload = [];
res.antibiotic_results.map(item=>{
var payload_item = {'id' : item.test_organism_id, 'anti_id' : item.antibiotic_id}
anti_payload.push(payload_item)
})
for (var i in res.sample_tests){
var department_name = '<b class="text-info pl-1"> <i class="mdi mdi-hand-pointing-right text-info font-14"></i> ' + res.sample_tests[i].department_name + '</b>';
var samples_list = res.sample_tests[i].samples;
for(var j in samples_list){
var sampleType = '<b class="pl-4 text-info"><i class="mdi mdi-link-variant text-info font-14"></i> '+ samples_list[j].sample_type_name + '</b>' + '<span class="pl-5"> Sample Entry By: <span id="smp-entry">'+res.sample_users.creator+'</span></span> <span class="pl-5">Modified By: <span id="smp-modify">'+res.sample_users.modifier+'</span></span>'
renderTestItemDepartmentRow(samples_list[j].sample_type_id, department_name + ' ' + sampleType ,'',' None', 'test-item-result')
var tests = samples_list[j].tests
var sampleTest = list_to_tree(tests)
sampleTest.map(parent => {
renderTestItemRow(parent.id, parent.field_type,'<sapn class="pl-3 '+((parent.children.length) ? 'font-weight-medium':'')+'">'+parent.test_name+'</sapn>', parent.unit_sign ,parent.ref_range, parent.min_ref_val, parent.max_ref_val,parent.test_result,parent.is_show, res.performers, parent.performed_by,'test-item-result','3', parent.org_results, parent.formula, parent.order, parent.test_date, parent.test_id, samples_list[j].comments, parent.str_comment, samples_list[j].sample_type_id, parent.org_suggested_results)
if(parent.field_type!=0){
autoSuggest(document.getElementById('comment-'+parent.id), samples_list[j].comments);
}
if(parent.children.length){
var children = parent.children
children.map(function (child) {
renderTestItemRow(child.id, child.field_type ,'<span class="pl-4 ml-3">'+child.test_name+'</span>', child.unit_sign ,child.ref_range, child.min_ref_val, child.max_ref_val, child.test_result, child.is_show, res.performers, child.performed_by,'test-item-result','4', child.org_results, child.formula, child.order, child.test_date, child.test_id, samples_list[j].comments, child.str_comment, samples_list[j].sample_type_id, child.org_suggested_results)
if(child.field_type!=0){
autoSuggest(document.getElementById('comment-'+child.id), samples_list[j].comments);
}
if(child.children.length){
var grandchildren = child.children
grandchildren.map(function (grandchild) {
renderTestItemRow(grandchild.id, grandchild.field_type ,'<span class="pl-5 ml-3">'+grandchild.test_name+'</span>', grandchild.unit_sign ,grandchild.ref_range, grandchild.min_ref_val,grandchild.max_ref_val, grandchild.test_result, grandchild.is_show, res.performers, grandchild.performed_by,'test-item-result','5', grandchild.org_results, grandchild.formula, grandchild.order, grandchild.test_date, grandchild.test_id, samples_list[j].comments, grandchild.str_comment, samples_list[j].sample_type_id, grandchild.org_suggested_results)
if(grandchild.field_type!=0){
autoSuggest(document.getElementById('comment-'+grandchild.id), samples_list[j].comments);
}
})
}
});
}
})
}
}
evaluateTestItem()
}
}
});
});
function evaluateTestItem() {
var $test_list = $('#modal-add-test-result').find("table tbody");
$test_list.find("tr[data-field-type='4']").each(function() {
// var $tr = $(this);
var formula = $(this).data("formula");
//var sample_test_id = $(this).data("test-sample-id");
var sample_test_id = $(this).data("test-id");
if (formula) {
//TODO bind event
var parser = new exprEval.Parser();
var expr = parser.parse(formula);
var variables = expr.variables();
for(var i in variables) {
if (CAMLIS_VARIABLE_FORMAT.TEST.test(variables[i])) {
var id = "#" + variables[i].replace('T', 'result-');
$test_list.find("input" + id).on("blur", function() {
var result = calculateTestValue(formula);
if(isFloat(result)) result = Number(result).toFixed(1); // added 23 Jan 2021
$test_list.find("input#result-" + sample_test_id).val(result);
// $tr.find("input.test_date").data("DateTimePicker").setDate(lastTestDate);
// $tr.find("select.performer").val(lastPerformer).trigger("change");
});
}
CAMLIS_VARIABLE_FORMAT.TEST.lastIndex = 0;
}
}
});
}
function renderTestItemDepartmentRow(dp_id, department, entryBy, modifyBy, wrapperId)
{
var tr = document.createElement('TR');
tr.setAttribute('id', 'dp-st-id'+dp_id);
tr.classList.add('text-center','result-item')
tr.insertCell(0).innerHTML = department;
tr.cells[0].colSpan=7
tr.insertCell(1).innerHTML = '<input onclick="checkAll(\'stdp'+dp_id+'\',\'item-visible-'+dp_id+'\')" id="stdp'+dp_id+'" class="item-visible-'+dp_id+' form-check m-auto border border-light" type="checkbox">';
tr.cells[0].setAttribute('class','text-left');
tr.cells[0].classList.add('p-2');
tr.classList.add('bg-gradient-light','p-2')
$('#'+wrapperId).append(tr);
}
function renderTestItemRow(test_sample_id, fieldType, test_name, unit_sign, ref, minVal, maxVal, resultVal, isHide, performers,selected_performer, wrapperId, level, org_results, formula, order, test_date, test_id, comments, selected_comment, sample_type_id, org_suggested_results)
{
let org_result = [];
let org_resultTxt = [];
let orderTest = $('#'+wrapperId+' TR.hasInput').length +1
let resultControl = '';
let unitSignLabel = '';
let refRangeLabel = '';
let performedControl = '';
let commentControl = '';
if(fieldType==1){
resultControl='<input type="hidden" name="ref_test_sample_id[]" value="'+test_sample_id+'"> <input style="width: 300px !important;" name="ref_test_sample_id_value[]" value="'+resultVal+'" data-formula="'+formula+'" id="result-'+test_id+'" order="'+orderTest+'" onblur="computeRefRangeResult(\'result-'+test_id+'\', $(this).val(),'+ minVal+','+ maxVal+')" class="form-control result rounded-0 border border-light form-control-xs T'+test_id+'" type="text">';
refRangeLabel = ref
}
else if(fieldType==2 || fieldType==3){
org_results.map(item=>{
org_result.push({
test_sample_id : test_sample_id,
test_organism_id : item.test_organism_id,
organism_id : item.organism_id,
quantity_id : item.quantity_id,
contaminant : item.contaminant
});
org_resultTxt.push(item.organism_name.trim());
})
if(org_results.length<1 && org_suggested_results.length>0){
var i = 0;// (fieldType==2) ? org_suggested_results.length-2 : 0;
for (; i < org_suggested_results.length; i++) {
if (org_suggested_results[i].is_default == 1) {
org_result.push({
test_sample_id: test_sample_id,
test_organism_id: org_suggested_results[i].test_organism_id,
organism_id: org_suggested_results[i].organism_id,
quantity_id: 0,
contaminant: 0
});
org_resultTxt.push(org_suggested_results[i].organism_name.trim());
}
}
}
resultControl='<input type="hidden" name="ref_test_sample_id___[]" value="'+test_sample_id+'"> <input type="text" order="'+orderTest+'" class="result" style="width: 0px; border: none; position: absolute; z-index: -10 !important;" onfocus="$(\'#test-sample-id-'+test_sample_id+'\').click()"> <button type="button" style="background:white; cursor:pointer;" id="test-sample-id-'+test_sample_id+'" onclick="showOrganismResult('+test_sample_id+', '+fieldType+')" data-toggle="modal" data-formula="'+formula+'" data-target="#modal-organism-result" data-test-sample-id="'+test_sample_id+'" data-test-id="'+test_id+'" data-backdrop="static" class="form-control ref-sample-organism rounded-0 form-control-xs border border-light text-left"></button>'
}
// field type calculation
else if(fieldType == 4){
resultControl='<input type="hidden" name="ref_test_sample_id[]" value="'+test_sample_id+'"> <input style="width: 300px !important;" name="ref_test_sample_id_value[]" order="'+orderTest+'" value="'+resultVal+'" data-formula="'+formula+'" id="result-'+test_id+'" onchange="computeRefRangeResult(\'result-'+test_id+'\', $(this).val(),'+ minVal+','+ maxVal+')" class="form-control result rounded-0 border border-light form-control-xs T'+test_id+'" type="text">';
refRangeLabel = ref
}
let tr = document.createElement('TR');
if(fieldType != 0) {
tr.setAttribute('class', 'hasInput');
unitSignLabel = unit_sign
performedControl = '<select id="performer-'+orderTest+'" name="ref_test_sample_performer[]" class="form-control performed_by rounded-0 form-control-xs border border-light"><option></option></select>'
if(fieldType==2 || fieldType==3){
commentControl = commentBox('ref_test_sample_comment___',test_sample_id, selected_comment, orderTest)
}
else{
commentControl = commentBox('ref_test_sample_comment', test_sample_id, selected_comment, orderTest)
}
}
tr.setAttribute('id', 'test_'+test_sample_id);
tr.setAttribute('data-test-sample-id', test_sample_id);
tr.setAttribute('data-test-id', test_id);
if(fieldType == 4){
tr.setAttribute('data-field-type', '4');
tr.setAttribute('data-formula', formula);
}
tr.classList.add('result-item')
tr.insertCell(0).innerHTML = test_name;
tr.insertCell(1).innerHTML = resultControl;
tr.insertCell(2).innerHTML = unitSignLabel;
tr.insertCell(3).innerHTML = refRangeLabel;
tr.insertCell(4).innerHTML = (fieldType != 0) ? '<input type="date" name="ref_test_sample_test_date[]" id="test-date-'+orderTest+'" value="'+test_date+'" class="form-control test-date form-control-sm" />':'';
tr.insertCell(5).innerHTML = performedControl;
tr.insertCell(6).innerHTML = commentControl;
tr.insertCell(7).innerHTML = '<input name="test_samples_to_hide[]" '+(isHide==0 ? 'checked':'')+' value="'+test_sample_id+'" class="item-visible-'+sample_type_id+' form-check m-auto border border-light" type="checkbox">';
tr.cells[0].classList.add('pl-'+level, 'p-2')
tr.cells[1].classList.add('p-1','px-2');
tr.cells[0].style.width='300px !important';
tr.cells[2].classList.add('p-1','text-left','pl-3');
tr.cells[3].classList.add('p-1','text-left','pl-3');
tr.cells[4].classList.add('p-1','px-2');
tr.cells[5].classList.add('p-1','px-2');
tr.cells[6].classList.add('p-1','text-left');
tr.cells[6].style.verticalAlign="top"
$('#'+wrapperId).append(tr);
performerBox('performer-'+orderTest, performers, selected_performer)
if((fieldType==2 || fieldType==3) && org_result.length>0){
$("#modal-add-test-result #test-sample-id-"+test_sample_id).text(org_resultTxt.join(', '))
$("#modal-add-test-result #test-sample-id-"+test_sample_id).data("possible_result", org_result);
}
evaluateTestItem()
computeRefRangeResult('result-'+test_id, resultVal,minVal,maxVal);
$(".select2-tags").select2({
placeholder: choose_option,
tags: true,
tokenSeparators: [',']
});
}
function computeRefRangeResult(controlId, val, min, max) {
if(min=='null' || max=='null' || val=='') $('#'+controlId).removeClass('out-of-range')
else if(parseFloat(val)>=parseFloat(min) && parseFloat(val)<=parseFloat(max)) $('#'+controlId).removeClass('out-of-range')
else $('#'+controlId).addClass('out-of-range','text-white')
}
function performerBox(controlId,data, selected) {
$('#'+controlId).html('<option></option>');
data.map(function (item) {
var performerOption = document.createElement('OPTION');
performerOption.setAttribute('value',item.id);
if(selected==item.id) performerOption.setAttribute('selected','selected');
performerOption.text = item.name;
$('#'+controlId).append(performerOption);
})
}
function commentBox(controlName, controlId, comment ='', orderTest) {
let searchEle = '<div class="autocomplete position-absolute d-block mt-1">'+
//'<input multiple type="text" name="ref_test_sample_comment[]" order="'+orderTest+'" value="'+comment+'" id="comment-'+controlId+'" style="width: 250px !important;" placeholder="search test" class="form-control comment-box rounded-0 form-control-sm">'+
'<textarea name="'+controlName+'[]" order="'+orderTest+'" id="comment-'+controlId+'" style="width: 250px !important; height: 34px !important; margin-top: 2px;" placeholder="search test" class="form-control comment-box rounded-0 form-control-sm">'+comment+'</textarea>'+
'</div>'
return searchEle
}
function getSampleTestItem_() {
$.ajax({
url : sample_base_url +'/' + sample_id + '/tests',
type : 'get',
data : {},
dataType : 'json',
success : function (resource) {
if(resource.success) {
res = resource.data
$('#modal-add-test-result .modal-header .sample-number').html(res.sample_number)
$('#modal-add-test-result .modal-header .patient-code').html(res.patient.uuid)
$('#modal-add-test-result .modal-header .patient-name').html(res.patient.name)
$('#modal-add-test-result .modal-header .sample-source').html(res.sample_source.name)
$('#modal-add-test-result #sample-id').val(res.id)
}
},
error : function () {
}
});
}
$('#modal-add-test-result').find(".btnAddTestResult").on("click", function (evt) {
$('.btnAddTestResult').prop('disabled', true)
var formData = $('#form-add-test-result').serializeArray()
//formData.push({name: "organism_antibiotics", value: JSON.stringify(anti_payload)});
let possible_result = []
let anti_result = []
let isPreViewResult = ($(this).attr('value')=='save-result-preview') ? true : false
let previousId = $('#previous_sample').val();
$('#form-add-test-result #test-item-result').find("tr").each(function () {
if($(this).find("td button.ref-sample-organism").length){
let organism_data = $(this).find("td button.ref-sample-organism").data("possible_result");
if(organism_data) possible_result.push(organism_data)
let antibiotic_data = $(this).find("td button.ref-sample-organism").data("anti_result");
if(antibiotic_data) anti_result.push(antibiotic_data)
}
});
formData.push({name: "possible_result", value: JSON.stringify(possible_result)});
formData.push({name: "anti_result", value: JSON.stringify(anti_result)});
$.ajax({
url: sample_base_url + '/add-test-result',
type: "POST",
data: formData,
dataType: "json",
success: function (response) {
if(response.success){
if(isPreViewResult){
let previousSampleUrl = (previousId>0) ? '&previous_sample='+ previousId: '';
window.location = sample_base_url + '/edit/'+sample_id+'?print-result' + previousSampleUrl
//$('#modal-assign-test .close').click();
//$('#sample-forms #btnAddTestResult').click()
}
else alertify.success('Sample result save successfully.')
} else{
customErrorAlert(response.error)
}
}
});
})
function showOrganismResult(test_sample_id, field_type){
$("#modal-organism-result").attr('data-test-sample-id', test_sample_id)
$("#modal-organism-result").attr('data-field-type', field_type);
$.ajax({
url: get_refs_base_url + '/test-sample-organism/get/' + test_sample_id+'/'+sample_id,
type: "GET",
dataType: "json",
success: function (response) {
if (response.success) {
$('#modal-organism-result-organism #orgn-result-area').empty();
$('.possible-result-test-name').text(response.test.test.name_en)
response.data.map(item =>{
renderOrganismResultItemRow(item.test_sample_id, field_type, item, response.qualities);
})
}
}
});
}
function renderOrganismResultItemRow(test_sample_id, fieldType, data, qualities, selectedOrgByClicked = [])
{
let possible_results = [];
possible_results = $("#modal-add-test-result #test-sample-id-"+test_sample_id).data("possible_result") ?? []
let checked = false
if((possible_results.some(possible_result => possible_result.test_organism_id == data.id)) || data.is_default==1){ checked = true }
let quantity_id = 0;
let contaminant = false;
possible_results.map(item=>{
if(item.test_organism_id == data.id){
quantity_id = item.quantity_id
contaminant = (item.contaminant==1) ? true : false
return true
}
})
selectedOrgByClicked.map(items=>{
if(items.test_organism_id == data.id){
quantity_id = items.quantity_id
return true
}
})
if(data.selected==1){
checked = true
}
//let resultControl = '<div class="form-check"><label onclick="getOrganismAntibiotics(\'org-'+data.id+'\','+data.id+','+data.organism.id+','+test_sample_id+')" class="form-check-label d-inline font-13"><input name="org-anti" '+(checked ? 'checked':'')+' data-name="'+data.organism.name_en+'" data-id="'+data.organism.id+'" data-test-sample-id="'+test_sample_id+'" type="'+(fieldType==2?'radio':'checkbox')+'" id="org-'+data.id+'" value="' + data.id + '" class="form-check-input test_organism"><i class="input-helper"></i></label></div>';
let tr = document.createElement('TR');
tr.setAttribute('id', 'organ_'+data.id);
tr.setAttribute('data-name', data.organism.name_en);
tr.setAttribute('class', 'organ_parent organ_anti_'+data.id);
tr.insertCell(0).innerHTML = '<i onclick="$(\'#child_organ_'+data.id+'\').toggle()" role="button" class="text-info pointer-event font-weight-bold mdi mdi-plus-circle"></i>';
tr.insertCell(1).innerHTML = '<input name="org-anti" '+(checked ? 'checked':'')+' data-name="'+data.organism.name_en+'" data-id="'+data.organism.id+'" data-test-sample-id="'+test_sample_id+'" type="'+(fieldType==2?'radio':'checkbox')+'" id="org-'+data.id+'" value="' + data.id + '" class="test_organism">';
tr.insertCell(2).innerHTML = data.organism.name_en;
tr.insertCell(3).innerHTML = '<select id="org-quanity-'+data.id+'" class="form-control form-control-xxs organism_qty rounded-0 test_organism_qty" data-id="'+data.organism.id+'" data-test-sample-id="'+test_sample_id+'"></select>';
tr.insertCell(4).innerHTML = '<input type="checkbox" '+(contaminant ? 'checked':'')+' class="org-contaminant" />';
tr.cells[0].classList.add('py-1', 'text-center')
tr.cells[1].classList.add('py-1', 'text-center');
tr.cells[2].classList.add('py-1');
tr.cells[3].classList.add('py-1');
tr.cells[4].classList.add('py-1','text-center');
$('#modal-organism-result-organism #orgn-result-area').append(tr);
if(data.antibiotics.length){
let chTr = document.createElement('TR');
chTr.setAttribute('data-name', data.organism.name_en);
chTr.setAttribute('id', 'child_organ_'+data.id);
chTr.setAttribute('class', 'organ_child organ_anti_'+data.id);
chTr.style.display="none";
chTr.insertCell(0).innerHTML="<div class=\"table-responsive\">\n" +
" <table class=\"table table-bordered\"><tr class='bg-light'>\n" +
" <td class=\"py-1\">Antibiotic</td>\n" +
" <td width='110px' class=\"py-1\">Disk diffusion</td>\n" +
" <td width='110px' class=\"py-1\">MIC</td>\n" +
" <td width='160px' class=\"py-1\">Sensitive</td>\n" +
" <td width='60px' class=\"py-1\">Invisible</td></tr>\n" +
" <tbody id=\"anti-result-area"+data.id+"\">\n" +
"\n" +
" </tbody>\n" +
" </table>\n" +
" </div>"
chTr.cells[0].setAttribute('id', 'antibiotics_org_'+data.id)
chTr.cells[0].colSpan=5
chTr.cells[0].classList.add('p-2', 'pl-5')
$('#modal-organism-result-organism #orgn-result-area').append(chTr);
data.antibiotics.map(item=>{
let antiTr = document.createElement('TR');
let sensitive = (item.antibiotic_result!=null ? item.antibiotic_result.sensitive : '')
antiTr.setAttribute('id', 'organ_'+data.id);
antiTr.insertCell(0).innerHTML = item.antibiotic_item.name_en;
antiTr.insertCell(1).innerHTML = '<input type="hidden" class="antibiotic_id" value="'+item.id+'"> <input type="text" class="form-control disk_diffusion form-control-xxs" value="'+(item.antibiotic_result!=null ? item.antibiotic_result.disk_diffusion : '')+'">';
antiTr.insertCell(2).innerHTML = '<input type="text" class="form-control mic form-control-xxs" value="'+(item.antibiotic_result!=null ? item.antibiotic_result.mic : '')+'">';
antiTr.insertCell(3).innerHTML = '<select class="form-control form-control-xxs sensitive rounded-0"><option '+(sensitive=='' ? 'selected':'')+' value=""></option><option '+(sensitive=='S' ? 'selected':'')+' value="S">Sensitive</option><option '+(sensitive=='R' ? 'selected':'')+' value="R">Resistant</option> <option '+(sensitive=='I' ? 'selected':'')+' value="I"> Intermediate</option></select>';
antiTr.insertCell(4).innerHTML = '<input class="is_hide" type="checkbox" '+(item.antibiotic_result!=null && item.antibiotic_result.is_hide==1 ? 'checked' : '')+' >';
antiTr.cells[0].classList.add('py-1')
antiTr.cells[1].classList.add('py-1');
antiTr.cells[2].classList.add('py-1');
antiTr.cells[3].classList.add('py-1');
antiTr.cells[4].classList.add('py-1','text-center');
$('#modal-organism-result-organism #orgn-result-area #anti-result-area'+data.id).append(antiTr);
})
}
performerBox('org-quanity-'+data.id,qualities, quantity_id)
}
$('#btnAddOrganism').click(function () {
let $organism_list = $('#modal-organism-result').find("#orgn-result-area");
let org_results = [];
let anti_results = [];
let org_resultTxt = [];
$organism_list.find("tr").each(function () {
if ($(this).find("td input.test_organism").is(":checked")) {
var val = $(this).find("td input.test_organism:checked").val();
var id = $(this).find("td input.test_organism:checked").attr('data-id');
var test_sample_id = $(this).find("td input.test_organism:checked").attr('data-test-sample-id');
var txt = $(this).find("td input.test_organism:checked").attr('data-name');
var resQty = $(this).find("td select.organism_qty").val();
var contaminant = $(this).find("td .org-contaminant").is(":checked") ? 1 : 0 ;
org_results.push({
test_sample_id : test_sample_id,
test_organism_id : val,
organism_id : id,
quantity_id : resQty,
contaminant : contaminant
});
org_resultTxt.push(txt.trim());
$('#'+'child_'+$(this).attr('id')+' .table').find("tr").each(function (item, obj) {
if($(obj).find("td input.antibiotic_id").val()!==undefined){
let disk_diffusion = $(obj).find("td input.disk_diffusion").val()
let antibiotic_id = $(obj).find("td input.antibiotic_id").val()
let mic = $(obj).find("td input.mic").val()
let sensitive = $(obj).find("td select.sensitive").val()
let is_hide = $(obj).find("td input.is_hide").is(":checked") ? 1 : 0
anti_results.push({
test_organism_id : val,
antibiotic_id : antibiotic_id,
disk_diffusion : disk_diffusion,
mic : mic,
sensitive : sensitive,
is_hide : is_hide,
});
}
});
}
});
let test_sample_id = $("#modal-organism-result").attr('data-test-sample-id');
$("#modal-add-test-result #test-sample-id-"+test_sample_id).text(org_resultTxt.join(', '))
$("#modal-add-test-result #test-sample-id-"+test_sample_id).data("possible_result", org_results);
$("#modal-add-test-result #test-sample-id-"+test_sample_id).data("anti_result", anti_results);
$('#close-modal-organism-result').click()
})
function renderOrganismAntibioticsResultItemRow(test_sample_organism_id, data)
{
let resultControl = '<div class="form-check"><label onclick="checkOrgAntibiotics(\'anti-check-'+data.id+'\','+data.id+')" class="form-check-label d-inline font-13"><input name="organism_result[]" type="checkbox" id="anti-check-'+data.id+'" value="' + data.id + '" class="form-check-input sample-test"> ' + data.antibiotic_item.name_en + ' <i class="input-helper"></i></label></div>';
let tr = document.createElement('TR');
tr.setAttribute('id', 'ainti_'+test_sample_organism_id);
tr.insertCell(0).innerHTML = resultControl;
tr.insertCell(1).innerHTML = '';
tr.insertCell(2).innerHTML = '';
tr.insertCell(3).innerHTML = '';
tr.insertCell(4).innerHTML = '';
tr.cells[0].classList.add('py-0')
tr.cells[1].classList.add('py-0');
tr.cells[2].classList.add('py-0');
tr.cells[4].classList.add('py-0');
tr.cells[4].classList.add('py-0');
$('#modal-organism-result-antibiotic #anti-result-area').append(tr);
}
function checkOrgAntibiotics(controlId, antibiotic_id) {
var checkedState = $('#'+controlId).is(':checked');
var id = antibiotic_id
if(last_org_id == null){return false;}
if(checkedState){
var payload_item = {'id' : last_org_id, 'anti_id' : id}
anti_payload.push(payload_item)
}
else{
anti_payload = $.grep(anti_payload, function(value) {
return value.anti_id != id;
});
}
}
$('#edit-test').click(function () {
window.location = sample_base_url + '/edit/'+sample_id+'?edit-test'
})
$('#modal-add-test-result').on("keyup", "input.result", function (evt) {
if (evt.which === 13 || evt.which === 38 || evt.which === 40) {
var order = parseInt($(this).attr("order"));
order = evt.which === 13 || evt.which === 40 ? order + 1 : order - 1;
if (order > 0) {
$('#modal-add-test-result').find("input.result[order="+ order +"]").focus();
$('#modal-add-test-result .performed_by').each(function(index, item){
if(item.value){
$('#modal-add-test-result #performer-'+order).val(item.value)
return true;
}
});
$('#modal-add-test-result .test-date').each(function(index, item){
if(item.value){
$('#modal-add-test-result #test-date-'+order).val(item.value)
return true;
}
});
}
}
});
$('#modal-add-test-result').on("keyup", "input.comment-box", function (evt) {
if (evt.which === 13 || evt.which === 38 || evt.which === 40) {
var order = parseInt($(this).attr("order"));
order = evt.which === 13 || evt.which === 40 ? order + 1 : order - 1;
if (order > 0) {
$('#modal-add-test-result').find("input.comment-box[order="+ order +"]").focus();
}
}
});
$('#modal-organism-result').on("click", ".test_organism", function () {
if($(this).is(':checked')){
var test_sample_id = parseInt($(this).attr("data-test-sample-id"));
var organism_id = parseInt($(this).attr("data-id"));
$.ajax({
url: sample_base_url + '/add-org-result/' + sample_id +'/'+test_sample_id+'/'+organism_id,
type: "GET",
dataType: "json",
success: function (response) {
if (response.success) {
console.log(response)
}
}
});
}
});
$('#modal-organism-result').on("change", ".test_organism_qty", function () {
var test_sample_id = parseInt($(this).attr("data-test-sample-id"));
var organism_id = parseInt($(this).attr("data-id"));
$.ajax({
url: sample_base_url + '/save-org-result-qty/' + sample_id +'/'+test_sample_id+'/'+organism_id+'/'+$(this).val(),
type: "GET",
dataType: "json",
success: function (response) {
if (response.success) {
console.log(response)
}
}
});
});

View File

@@ -1,161 +0,0 @@
// Load test items and settings
$('#modal-add-test-result').on('show.bs.modal', function (event) {
$.ajax({
url: get_refs_base_url + '/test-items/'+sample_id,
type:"GET",
dataType:"json",
success:function(response){
if(response.success){
$('#test-item-result').empty()
let res = response.data
// anti_payload data seeding
anti_payload = [];
res.antibiotic_results.map(item=>{
var payload_item = {'id' : item.test_organism_id, 'anti_id' : item.antibiotic_id}
anti_payload.push(payload_item)
})
for (var i in res.sample_tests){
var department_name = '<b class="text-info pl-1"> <i class="mdi mdi-hand-pointing-right text-info font-14"></i> ' + res.sample_tests[i].department_name + '</b>';
var samples_list = res.sample_tests[i].samples;
for(var j in samples_list){
var sampleType = '<b class="pl-4 text-info"><i class="mdi mdi-link-variant text-info font-14"></i> '+ samples_list[j].sample_type_name + '</b>' + '<span class="pl-5"> Sample Entry By: <span id="smp-entry">'+res.sample_users.creator+'</span></span> <span class="pl-5">Modified By: <span id="smp-modify">'+res.sample_users.modifier+'</span></span>'
renderTestItemDepartmentRowBioLab('st-id'+samples_list[j].sample_type_id, department_name + ' ' + sampleType ,'',' None', 'test-item-result-bio-lab')
var tests = samples_list[j].tests
var sampleTest = list_to_tree(tests)
sampleTest.map(parent => {
renderTestItemRowBioLab(parent.id, parent.field_type,'<sapn class="pl-3 '+((parent.children.length) ? 'font-weight-medium':'')+'">'+parent.test_name+'</sapn>',parent.is_show,'test-item-result-bio-lab','3', parent.order, parent.test_id, samples_list[j].comments, parent.str_comment)
if(parent.field_type!=0){
autoSuggest(document.getElementById('comment-'+parent.id), samples_list[j].comments);
}
if(parent.children.length){
var children = parent.children
children.map(function (child) {
renderTestItemRowBioLab(child.id, child.field_type ,'<span class="pl-4 ml-3">'+child.test_name+'</span>', child.is_show,'test-item-result-bio-lab','4', child.order, child.test_id, samples_list[j].comments, child.str_comment)
if(child.field_type!=0){
autoSuggest(document.getElementById('comment-'+child.id), samples_list[j].comments);
}
if(child.children.length){
var grandchildren = child.children
grandchildren.map(function (grandchild) {
renderTestItemRowBioLab(grandchild.id, grandchild.field_type ,'<span class="pl-5 ml-3">'+grandchild.test_name+'</span>', grandchild.is_show,'test-item-result-bio-lab','5', grandchild.order, grandchild.test_id, samples_list[j].comments, grandchild.str_comment)
//renderTestItemRowBioLab(test_sample_id, fieldType, test_name, isHide, wrapperId, level, order, test_id, comments, selected_comment)
if(grandchild.field_type!=0){
autoSuggest(document.getElementById('comment-'+grandchild.id), samples_list[j].comments);
}
})
}
});
}
})
}
}
getSampleTestItemBioLab()
}
}
});
});
function renderTestItemDepartmentRowBioLab(dp_id, department, entryBy, modifyBy, wrapperId)
{
var tr = document.createElement('TR');
tr.setAttribute('id', 'dp-'+dp_id);
tr.classList.add('text-center','result-item')
tr.insertCell(0).innerHTML = department;
tr.cells[0].colSpan=3
tr.cells[0].setAttribute('class','text-left');
tr.cells[0].classList.add('p-2');
tr.classList.add('bg-gradient-light','p-2')
$('#'+wrapperId).append(tr);
}
function renderTestItemRowBioLab(test_sample_id, fieldType, test_name, isHide, wrapperId, level, order, test_id, comments, selected_comment)
{
let resultControl ='<input type="hidden" name="ref_test_sample_id[]" value="'+test_sample_id+'"> <input style="width: 300px !important;" name="ref_test_sample_id_value[]" value="-1" data-formula="" id="result-'+test_id+'" class="form-control rounded-0 border border-light form-control-xs" type="hidden">';
let tr = document.createElement('TR');
let commentControl = resultBoxBioLab(test_sample_id, selected_comment,'')
tr.setAttribute('id', 'bio_test_'+test_sample_id);
tr.setAttribute('data-test-sample-id', test_sample_id);
tr.setAttribute('data-test-id', test_id);
tr.classList.add('result-item')
tr.insertCell(0).innerHTML = test_name + resultControl;
tr.insertCell(1).innerHTML = commentControl;
tr.insertCell(2).innerHTML = '<input name="test_samples_to_hide[]" '+(isHide==0 ? 'checked':'')+' value="'+test_sample_id+'" class="form-check m-auto border border-light" type="checkbox">';
tr.cells[0].classList.add('pl-'+level, 'p-2')
tr.cells[1].classList.add('p-1','px-2');
tr.cells[0].style.width='300px !important';
tr.cells[2].classList.add('p-1','text-left');
tr.cells[2].style.verticalAlign="top"
$('#'+wrapperId).append(tr);
}
function resultBoxBioLab(controlId, comment ='', orderTest) {
let searchEle = '<div class="autocomplete col-sm-12 mt-0">'+
'<textarea name="ref_test_sample_comment[]" maxlength="1000" order="'+orderTest+'" id="comment-'+controlId+'" style="!important; height:80px !important; margin-top: 2px;" placeholder="" class="form-control comment-box rounded-0 form-control-sm">'+comment+'</textarea>'+
'</div>'
return searchEle
}
function getSampleTestItemBioLab() {
$.ajax({
url : sample_base_url +'/' + sample_id + '/tests',
type : 'get',
data : {},
dataType : 'json',
success : function (resource) {
if(resource.success) {
res = resource.data
$('#modal-add-test-result .modal-header .sample-number').html(res.sample_number)
$('#modal-add-test-result .modal-header .patient-code').html(res.patient.uuid)
$('#modal-add-test-result .modal-header .patient-name').html(res.patient.name)
$('#modal-add-test-result .modal-header .sample-source').html(res.sample_source.name)
$('#modal-add-test-result #sample-id').val(res.id)
}
},
error : function () {
}
});
}
$('#modal-add-test-result').find(".btnAddTestResult").on("click", function (evt) {
$('.btnAddTestResult').prop('disabled', true)
var formData = $('#form-add-test-result-bio-lab').serializeArray()
let possible_result = []
let anti_result = []
let isPreViewResult = ($(this).attr('value')=='save-result-preview') ? true : false
formData.push({name: "possible_result", value: JSON.stringify(possible_result)});
formData.push({name: "anti_result", value: JSON.stringify(anti_result)});
$.ajax({
url: sample_base_url + '/add-test-result',
type: "POST",
data: formData,
dataType: "json",
success: function (response) {
if(response.success){
if(isPreViewResult){
window.location = sample_base_url + '/edit/'+sample_id+'?print-result'
}
else alertify.success('Sample result save successfully.')
} else{
customErrorAlert(response.error)
}
}
});
})

View File

@@ -1,313 +0,0 @@
let messageDuration = 2000;
function getProvinces(targetSelectorId, selected_province_id = 0) {
fetchRefsData(get_refs_base_url + '/provinces/json', targetSelectorId, selected_province_id);
}
function getDistrictsByProvinceId(targetSelectorId, province_id, selected_district_id = 0) {
fetchRefsData(get_refs_base_url + '/districts/json/'+province_id, targetSelectorId, selected_district_id);
}
function getCommunesByDistrictId(targetSelectorId, district_id, selected_commune_id = 0){
fetchRefsData(get_refs_base_url + '/communes/json/'+district_id, targetSelectorId, selected_commune_id);
}
function getVillagesByCommuneId(targetSelectorId, commune_id, selected_village_id = 0) {
fetchRefsData(get_refs_base_url + '/villages/json/'+commune_id, targetSelectorId, selected_village_id);
}
function fetchRefsData(url, targetSelectorId, selectedId ) {
$.ajax({
url: url,
type:"GET",
dataType:"json",
success:function(response){
$('#'+targetSelectorId).html('');
$('#'+targetSelectorId).append('<option selected></option>');
response.map(item =>{
var patientOption = document.createElement('OPTION');
patientOption.setAttribute('value',item.id);
if(selectedId == item.id){
patientOption.setAttribute('selected','selected');
}
patientOption.text = item.name_en;
$('#'+targetSelectorId).append(patientOption);
})
}
});
}
function generate_uuid (classPrefix, targetDisplayElementId) {
$.ajax({
url: get_refs_base_url+"/uuid.generate/json",
type:"GET",
dataType:"json",
success:function(response){
if(response.success) $(''+targetDisplayElementId).val(classPrefix+'-'+response.data.uuid);
else alertify.error("Can't generate uuid.")
}
});
}
function deleteEntityRecord(uid, url){
var success = false
Swal.fire({
text: confirm_delete_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_delete,
cancelButtonText: confirm_cancel
}).then((result) => {
if (result.value) {
$.ajax({
url: url,
method:'POST',
dataType:"JSON",
data:{
"_token": csrf_token,
uid : uid,
},
success:function(response){
handleMessage(response.success, response.message)
setTimeout(function () {location.reload()}, messageDuration)
success = true
}
})
}
});
return success
}
function restoreEntityRecord(uid, url){
Swal.fire({
text: confirm_restore_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_restore,
cancelButtonText: confirm_cancel_restore,
}).then((result) => {
if (result.value) {
$.ajax({
url: url,
method:'POST',
dataType:"JSON",
data:{
"_token": csrf_token,
uid : uid,
},
success:function(response){
handleMessage(response.success, response.message)
setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
function isNumber(evt) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
return true;
}
function addRejectComment(targetSelectorId){
Swal.fire({
html:"<p style='float: left;'>Reject Comment</p>",
input: "text",
showCancelButton: !0,
position: "center-right",
confirmButtonText: "<i class='fa fa-save mr-2'></i>Save",
cancelButtonText: "Cancel",
showLoaderOnConfirm: !1,
confirmButtonColor: "#4fb51a",
preConfirm: function (n) {
return new Promise(function (t) {
$.ajax({
url: get_refs_base_url + '/reject-comment/save',
method:'post',
dataType:'json',
data:{
"_token": csrf_token,
name_en: n
},
success:function(r)
{
if(!r.success){
Swal.showValidationMessage('Failed while saving reject comment. ' + r.errors)
Swal.enableButtons()
}
else {
t(r.data)
}
}
})
})
},
allowOutsideClick:!1,
}).then(function (t) {
if(!t.dismiss){
t.value.map(item =>{
var patientOption = document.createElement('OPTION');
patientOption.setAttribute('value',item.id);
patientOption.setAttribute('selected','selected');
patientOption.text = item.reject_comment;
$('#'+targetSelectorId).append(patientOption);
alertify.success("Reject comment successfully added.")
})
}
})
}
function customErrorAlert(error) {
$('.custom-error-alert').remove()
var alertComponent = document.createElement('DIV')
alertComponent.classList.add('alert', 'alert-danger', 'custom-error-alert','col-sm-12','col-lg-6')
alertComponent.innerHTML= _getResponseErrorMessage(error)
document.body.append(alertComponent)
setTimeout(function () {
$('.custom-error-alert').remove()
}, 10000)
}
function _getResponseErrorMessage (error) {
if (error.message) return error.message
if (error.errors) return 'Internal server error. please contact system administrator.'
if (error.responseJSON) return _getCustomResponseErrorMessage(error.statusText, error.responseJSON.errors)
return error.message === 'Network Error' ? 'Oops! Network Error. Try again later' : error.message
}
function _getCustomResponseErrorMessage (message, errObject) {
arr = []
var errors = [];
for(var i in errObject) {
errors.push(errObject[i]);
}
errors.forEach(item=> {
if(Array.isArray(item)){
item.forEach(v=> {
arr.concat(v)
})
}
else{
arr.concat(item)
}
return arr
})
return errors.join('<br/>')
}
function list_to_tree(list) {
var map = {}, node, roots = [], i;
for (i = 0; i < list.length; i += 1) {
map[list[i].id] = i; // initialize the map
list[i].children = []; // initialize the children
}
for (i = 0; i < list.length; i += 1) {
node = list[i];
if (node.closed_parent_id !== "0") {
// if you have dangling branches check that map[node.parentId] exists
//console.log('node ', list[map[node.closed_parent_id]])
if(typeof map[node.closed_parent_id] !== 'undefined') {
list[map[node.closed_parent_id]].children.push(node);
}
} else {
roots.push(node);
}
}
return roots;
}
function list_to_tree_v2(flatArray, parent = null) {
const tree = [];
for (const item of obj.values(flatArray)) {
if (item.closed_parent_id === parent) {
const children = arrayToTree(flatArray, item.id);
if (children.length) {
item.children = children;
}
tree.push(item);
}
}
return tree;
}
function getSampleTypeByDepartmentId(departmentId, sampleTypeControlId, selected_sample_type_id = 0) {
$.ajax({
url: get_refs_base_url+'/sample-type/department/'+(departmentId>0 ? departmentId : 'null'),
type:"GET",
dataType:"JSON",
success:function(response){
$('#'+sampleTypeControlId).html('');
$('#'+sampleTypeControlId).append('<option></option>');
response.data.map(item =>{
var patientOption = document.createElement('OPTION');
patientOption.setAttribute('value',item.id);
if(selected_sample_type_id == item.id){
patientOption.setAttribute('selected','selected');
}
patientOption.text = item.name_en;
$('#'+sampleTypeControlId).append(patientOption);
})
},
error: function(response) {
},
});
}
function removeUserSignature() {
$.ajax({
url: get_refs_base_url + '/reject-comment/save',
method:'post',
dataType:'json',
data:{
"_token": csrf_token
},
success:function(r)
{
if(!r.success){
Swal.showValidationMessage('Failed while saving reject comment. ' + r.errors)
Swal.enableButtons()
}
else {
t(r.data)
}
}
})
}
function toFixedNumber(num, fixed) {
fixed = fixed || 0;
fixed = Math.pow(10, fixed);
return Math.floor(num * fixed) / fixed;
}
function handleMessage(actionStatus = true, message) {
if(actionStatus) alertify.success(message)
else alertify.error(message)
}
function getDate(date) {
if(date) {
var d = new Date(date),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear();
if (month.length < 2)
month = '0' + month;
if (day.length < 2)
day = '0' + day;
return [year, month, day].join('-');
} else return '';
}

View File

@@ -1,163 +0,0 @@
function deleteData(id) {
var url = base_url + '/delete'
deleteEntityRecord(id, url)
}
function restoreData(id) {
var url = base_url + '/restore'
restoreEntityRecord(id, url)
}
$('#inv-sample-id').change(function () {
sample_id = $(this).val()
})
function generate_invoice () {
total_amt = 0
if(invoice_id == 0) { /*generate_uuid ('INV', '#invoice-number');*/}
$.ajax({
url: get_refs_base_url + '/test-items/' + sample_id,
type: "GET",
dataType: "json",
success: function (response) {
if(response.success){
let res = response.data;
$('#invoice-item').empty();
for (var i in res.sample_tests){
//let heading = {"sample": res.sample, "department": res.sample_tests[i].department_name}
let samples_list = res.sample_tests[i].samples;
for(var j in samples_list){
// renderPrintTestItemDepartmentRow(samples_list[j], heading,'sample-result-print')
var tests = samples_list[j].tests
var sampleTest = list_to_tree(tests)
sampleTest.map(parent => {
renderInvoiceTestItemRow(parent, 'invoice-item')
var children = parent.children
children.map(function (child) {
renderInvoiceTestItemRow(child, 'invoice-item')
if (child.children.length) {
var grandchildren = child.children
grandchildren.map(function (grandchild) {
if(grandchild.group_result !="") {
renderInvoiceTestItemRow(grandchild, 'invoice-item')
}
})
}
});
})
}
}
}
}
});
}
let total_amt = 0.00
let discount_amt = 0.00
let total_net_amt = 0.00
function renderInvoiceTestItemRow(sample_tests, closet_parent_id)
{
if(sample_tests.group_result!=="" && sample_tests.usd_price>0){
let net_amount = calculateInvoicePrice(sample_tests);
let tr = document.createElement('TR');
tr.insertCell(0).innerHTML = sample_tests.group_result + manipulateControlInputFields(sample_tests);
tr.insertCell(1).innerHTML = sample_tests.commission_rate;
tr.insertCell(2).innerHTML = (currency==1?'៛ ' + Math.ceil((sample_tests.usd_price * exchange_rate)/100) * 100:'$ ' + sample_tests.usd_price/* toFixedNumber(net_amount,2)*/);
tr.cells[0].classList.add('py-2','px-3')
tr.cells[1].classList.add('py-2','text-right')
tr.cells[2].classList.add('py-2','text-right')
$('#'+closet_parent_id).append(tr);
total_amt += (currency==1 ? Math.ceil((parseFloat(sample_tests.usd_price) * exchange_rate)/100) * 100 : parseFloat(sample_tests.usd_price) /*toFixedNumber(net_amount,2)*/)
console.log('total_amt', total_amt)
total_net_amt += (currency==1 ? Math.ceil((parseFloat(net_amount) * exchange_rate)/100) * 100 : parseFloat(net_amount))
discount_amt = total_amt - total_net_amt
$('#total-amount').val(toFixedNumber(total_amt,2))
$('#net-amount').val(toFixedNumber(total_net_amt ,2))
//console.log('total_net_amt',toFixedNumber(total_net_amt,2));
$('#discount-amount').val(toFixedNumber(discount_amt,2))
/*if( $('#discount-amount').val()<=0.00){
$('#net-amount').val(toFixedNumber(total_net_amt,2))
$('#owe-amount').val(toFixedNumber(total_net_amt,2))
} else{
$('#net-amount').val(toFixedNumber(total_net_amt,2))
}*/
}
}
function calculateInvoicePrice(sample_tests){
let net_amount = 0
if(sample_tests.commission_type == 2){
net_amount = (parseFloat(sample_tests.usd_price)) - parseFloat(sample_tests.commission_rate)
}
else{
if(parseInt(sample_tests.commission_rate)>0){
// if commission_type is % sample_tests.commission_rate is decimal number Ex: 10% = 0.1, 1 = 100%
net_amount = parseFloat(sample_tests.usd_price) * (1 - parseFloat(parseInt(sample_tests.commission_rate)/100))
}
else{
net_amount = parseFloat(sample_tests.usd_price)
}
}
return net_amount
}
function manipulateControlInputFields(sample_tests){
let net_amount = calculateInvoicePrice(sample_tests);
let inputs = '<input name="test_sample_id[]" type="hidden" value="'+sample_tests.id+'" />';
inputs += '<input name="test_name[]" type="hidden" value="'+sample_tests.group_result+'" />';
inputs += '<input name="item_discount_type[]" type="hidden" value="'+sample_tests.commission_type+'" />';
inputs += '<input name="item_discount[]" type="hidden" value="'+sample_tests.commission_rate+'" />';
inputs += '<input name="unit_price[]" type="hidden" value="'+(currency==1 ? Math.ceil((sample_tests.usd_price * exchange_rate)/100) * 100 : toFixedNumber(sample_tests.usd_price,2))+'" />';
return inputs;
}
$('#discount-amount').change(function () {
let net_amount = 0;
if($('#discount_type').val()==1){
//net_amount = parseFloat($('#total-amount').val()) - parseFloat($('#discount-amount').val())
net_amount = parseFloat($('#total-amount').val()) * (1 - (parseFloat($('#discount-amount').val())/100))
}
else{
net_amount = parseFloat($('#total-amount').val()) - parseFloat($('#discount-amount').val())
}
//let net_amount = parseFloat($('#total-amount').val()) - parseFloat($('#discount-amount').val())
//console.log(Math.ceil((net_amount/100))*100)
let finalAmount = currency==1 ? Math.ceil((net_amount)/100) * 100 : toFixedNumber(net_amount,2)
$('#net-amount').val(finalAmount)
$('#owe-amount').val(finalAmount)
})
$('#paid-amount').change(function () {
let own_amount = parseFloat($('#net-amount').val()) - parseFloat( $('#paid-amount').val())
$('#owe-amount').val(toFixedNumber(own_amount,2))
})
if(invoice_id > 0){
//generate_invoice()
// $('#invoice-number').val(invoice.invoice_code)
// $('#invoice_date').val(invoice.invoice_date)
// $('#total-amount').val(invoice.total)
// $('#discount-amount').val(invoice.discount)
// $('#net-amount').val(invoice.gross_total)
// $('#paid-amount').val(invoice.deposit)
// $('#paid-date').val(invoice.first_paid_date)
// $('#owe-amount').val(invoice.balance)
}
$('.inv-report-filter').click(function(){
let report_type = $(this).attr('data-report-type')
let rpt_type = (report_type == 'daily' ? report_type_daily : (report_type == 'monthly' ? report_type_monthly: report_type_yearly))
$('#modal-invoice-report-filter #invoice-name').html(report_type_tittle+ ': '+ rpt_type)
if(report_type == 'daily'){ $('#daily-val').removeClass('d-none'); $('#monthly-val, #yearly-val').addClass('d-none')}
else if(report_type == 'monthly') { $('#monthly-val').removeClass('d-none'); $('#daily-val, #yearly-val').addClass('d-none')}
else { $('#yearly-val').removeClass('d-none'); $('#daily-val, #monthly-val').addClass('d-none')}
});
$('#modal-invoice-report-filter').on('show.bs.modal', function (event) {
});

View File

@@ -1,134 +0,0 @@
$("#btnSave").on('click',function(e){
e.preventDefault();
labid = $('#lab-id').val();
url = parseInt(labid) === 0 ? save_lab_url : update_lab_url;
$.ajax({
url: url,
type:"POST",
data:{
"_token": csrf_token,
lab_id : labid,
lab_name_en: $('#lab-name-en').val(),
lab_name_kh: $('#lab-name-kh').val(),
lab_code: $('#lab-code').val(),
address_en: $('#address-en').val(),
address_kh: $('#address-kh').val(),
sample_number: $('input[name="sample_number"]:checked').attr('data-id'),
patient_code: $('input[name="patient_number"]:checked').attr('data-id'),
is_auto_make_invoice: $('input[name="is_auto_make_invoice"]:checked').attr('data-id'),
start_date : $('#start-date').val(),
end_date : $('#end-date').val(),
phone_number: $('#phone-number').val(),
email: $('#email').val(),
shareable_lab_result: $('input[name="shareable_lab_result"]:checked').attr('data-id'),
lab_category_id : $('#lab-category-id').val()
},
success:function(res){
handleMessage(res.success, res.message)
setTimeout(function () {location.reload()}, messageDuration)
}
});
});
function delete_lab(labid){
Swal.fire({
text: confirm_delete_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_delete,
cancelButtonText: confirm_cancel
}).then((result) => {
if (result.value) {
$.ajax({
url: delete_lab_url,
method:'POST',
data:{
"_token": csrf_token,
lab_id : labid,
},
success:function(res){
handleMessage(res.success, res.message)
setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
function restore_lab(labid){
Swal.fire({
text: confirm_restore_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_restore,
cancelButtonText: confirm_cancel_restore,
}).then((result) => {
if (result.value) {
$.ajax({
url: restore_lab_url,
method:'POST',
data:{
"_token": csrf_token,
lab_id : labid,
},
success:function(res){
handleMessage(res.success, res.message)
setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
$('#modal-laboratory').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
$('#shareable_lab_result').prop("checked", false)
var modal = $(this);
if(action === "new"){
// Clear inputs
modal.find('.modal-body input').val("");
modal.find('.modal-body input[name="lab_id"]').val(0);
modal.find('.modal-title').html(modal_add_title);
}else if(action === "edit"){
lab_id = button.data('labid');
modal.find('.modal-body input[name="lab_id"]').val(lab_id);
modal.find('.modal-title').html(modal_edit_title);
//e.preventDefault();
$.ajax({
url: get_lab_url,
type:"POST",
data:{
"_token": csrf_token,
lab_id: lab_id,
},
success:function(res){
if(res.success) {
let data = res.data;
modal.find('.modal-body input[name="lab_name_en"]').val(data.name_en);
modal.find('.modal-body input[name="lab_name_kh"]').val(data.name_kh);
modal.find('.modal-body input[name="lab_code"]').val(data.short_name);
modal.find('.modal-body select[name="lab_category_id"]').val(data.lab_category_id);
modal.find('.modal-body input:radio[name="sample_number"]').filter("[data-id=" + data.sample_number + "]").prop('checked', true);
modal.find('.modal-body input:radio[name="is_auto_make_invoice"]').filter("[data-id=" + data.is_auto_make_invoice + "]").prop('checked', true);
modal.find('.modal-body input[name="address_en"]').val(data.address_en);
modal.find('.modal-body input[name="address_kh"]').val(data.address_kh);
modal.find('.modal-body input[name="start_date"]').val(getDate(data.start_date));
modal.find('.modal-body input[name="end_date"]').val(getDate(data.end_date));
modal.find('.modal-body input:radio[name="patient_number"]').filter("[data-id=" + data.patient_code + "]").prop('checked', true);
modal.find('.modal-body input:checkbox[name="shareable_lab_result"]').filter("[data-id=" + data.shareable_lab_result + "]").prop('checked', true);
modal.find('.modal-body input[name="email"]').val(data.email);
modal.find('.modal-body input[name="phone_number"]').val(data.phone_number);
} else{
handleMessage(res.success, res.message)
}
},
});
}
})

View File

@@ -1,175 +0,0 @@
$("#btnSaveMedication").on('click',function(e){
var formData = $('#form-save-medication').serializeArray()
let data_id = $('#data-id').val();
let url = (data_id < 1 ? save_url : update_url);
$.ajax({
url: url,
type: "POST",
data: formData,
dataType: "json",
success: function (res) {
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
});
});
function delete_medication(uid){
Swal.fire({
text: confirm_delete_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_delete,
cancelButtonText: confirm_cancel
}).then((result) => {
if (result.value) {
$.ajax({
url: delete_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
$('#modal-medication').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
var modal = $(this);
$('#purchase_detail_body').empty();
if(action === "new"){
// Clear inputs
modal.find('.modal-body input[name="uid"]').val(0);
modal.find('.modal-body .clearable').val("");
modal.find('.modal-title').html(modal_add_title);
modal.find('.modal-body select[name="supplier_id"]').val("").trigger("change");
}else if(action === "edit"){
uid = button.data('uid');
modal.find('.modal-body input[name="uid"]').val(uid);
modal.find('.modal-title').html(modal_edit_title);
$.ajax({
url: get_url,
type:"POST",
data:{
"_token": csrf_token,
uid: uid,
},
success:function(res){
let data = res.data;
modal.find('.modal-body input[name="grn_number"]').val(data.grn_number);
modal.find('.modal-body input[name="po_number"]').val(data.po_number);
modal.find('.modal-body input[name="received_date"]').val(data.received_date);
modal.find('.modal-body #note').val(data.description);
modal.find('.modal-body select[name="supplier"]').val(data.supplier_id).trigger('change');
data.purchase_detail.map(item=>{
addPurchasedMedicalItem(item)
})
if(!res.success)handleMessage(res.success, res.message)
}
});
}
})
function addMedicationItem(purchaseDetail = null) {
var table = document.getElementById("purchase_detail_body");
var table_len = table.rows.length;
var id = table_len + 1
var opt = "<?php foreach($medicineGroups as $item){ ?>";
opt += "<option value='<?php echo $item->id ?>'><?php echo $item->name_en ?></option>";
opt += "<?php } ?>";
var medicalItemUnitOpt = "<?php foreach($medicineUnits as $item){ ?>";
medicalItemUnitOpt += "<option value='<?php echo $item->id ?>'><?php echo $item->name_en ?></option>";
medicalItemUnitOpt += "<?php } ?>";
var row_ = "<tr id='row_" + id + "'>" +
'<td class="p-2">' +
'<select class="form-control form-control-sm clearable rounded-0" id="cate_' + id + '" name="category_id[]" onchange=getMedicalItemByGroupId(this.value,' + id + ') required>' +
'<option value="">Chose</option>' + opt +
'</select>' +
'</td>' +
'<td class="p-2">' +
'<select name="drug_name[]" id="medicine_name' + id + '" class="form-control clearable form-control-sm rounded-0" required></select>' +
'</td>' +
'<td class="p-2">' +
' <input type="date" class="form-control-sm clearable rounded-0 form-control" id="exp_' + id + '" data-date-format="dd-mm-yyyy" data-language="en" placeholder="dd-mm-yyyy" autocomplete="off" name="expiry_date[]" required>' +
'</td>' +
'<td class="p-2">' +
'<select class="form-control form-control-sm clearable rounded-0" id="unit_' + id + '" name="medicine_unit_id[]" required>' +
'<option value="">Chose</option>' + medicalItemUnitOpt +
'</select>' +
'</td>' +
'<td style="margin-top:20px;" class="p-2">' +
' <button type="button" onclick="removePurchasedMedicalItem(' + id + ')" class="btn rounded-0 btn-md btn-danger"><i class="mdi mdi-trash-can text-white"></i></button>' +
'</td>' +
'</tr>';
table.insertRow(table_len).outerHTML = row_;
if (purchaseDetail != null) {
$('#cate_' + id).val(purchaseDetail.medicine_group_id);
$('#exp_' + id).val(purchaseDetail.expiry_date)
$('#unit_' + id).val(purchaseDetail.medicine_unit_id)
$('#qty_' + id).val(purchaseDetail.quantity)
$('#pur_price_' + id).val(purchaseDetail.unit_price)
$('#subtotal_' + id).val(purchaseDetail.unit_price * purchaseDetail.quantity)
$('#medicine_name' + id).empty().append('<option selected value = "'+purchaseDetail.medicine_item_id+'">'+purchaseDetail.medicine_item.medicine.name+'</option>');
}
//$("#medicine_name"+id).select2();
}
function removePurchasedMedicalItem(id)
{
$("#row_"+id).remove();
calculatePurchasedPrice();
}
function calculatePurchasedPrice()
{
var total=0;
var price=[];
var qty=[];
var sum=0;
$(".unit-price").each(function () {
var pr=$(this).val();
if(pr=="NaN" || pr==null || pr==""){
pr=parseFloat("0");
}
price.push(pr);
});
$(".qty").each(function () {
var q=$(this).val();
if(q=="NaN" || q==null || q==""){
q=parseFloat("0");
}
qty.push(q);
});
for(var i=0; i<price.length; i++)
{
var sum=(price[i]*qty[i]);
total+=sum;
$("input[name='amount[]']:eq("+i+")").val(sum.toFixed(2));
}
var amount= total
//console.log('Riel', new Intl.NumberFormat('en-IN', { maximumSignificantDigits: 3 }).format(total))
$("#total_").html("$ "+amount.toFixed(2));
}

View File

@@ -1,218 +0,0 @@
$("#btnSave").on('click',function(e){
e.preventDefault();
data_id = $('#data-id').val();
let url = (data_id < 1 ? save_url : update_url);
$.ajax({
url: url,
type:"POST",
data :{
"_token": csrf_token,
uid : data_id,
code: $('#medicine-code').val(),
medicine_id: $('#medicine-id').val(),
medicine_group_id: $('#medicine-group-id').val(),
unit_price: $('#unit-price').val(),
sale_price: $('#sale-price').val(),
dosage: $('#dosage').val(),
is_vaccination: $("input[name='is_vaccination']:checked").attr('data-id'),
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
});
});
function delete_data(uid){
Swal.fire({
text: confirm_delete_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_delete,
cancelButtonText: confirm_cancel
}).then((result) => {
if (result.value) {
$.ajax({
url: delete_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
function restore_data(uid){
Swal.fire({
text: confirm_restore_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_restore,
cancelButtonText: confirm_cancel_restore,
}).then((result) => {
if (result.value) {
$.ajax({
url: restore_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
$('#modal-medicine-item').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
var modal = $(this);
if(action === "new"){
// Clear inputs
modal.find('.modal-body input[name="uid"]').val(0);
modal.find('.modal-body input').val("");
modal.find('.modal-title').html(modal_add_title);
modal.find('.modal-body select[name="medicine_id"]').val("").trigger("change");
modal.find('.modal-body select[name="medicine_group_id"]').val("").trigger("change");
$('#is-vaccination').prop("checked", false)
}else if(action === "edit"){
uid = button.data('uid');
modal.find('.modal-body input[name="uid"]').val(uid);
modal.find('.modal-title').html(modal_edit_title);
$.ajax({
url: get_url,
type:"POST",
data:{
"_token": csrf_token,
uid: uid,
},
success:function(res){
let data = res.data;
modal.find('.modal-body input[name="unit_price"]').val(data.unit_price);
modal.find('.modal-body input[name="dosage"]').val(data.dosage);
modal.find('.modal-body input[name="sale_price"]').val(data.sale_price);
modal.find('.modal-body input[name="medicine_code"]').val(data.code);
modal.find('.modal-body select[name="medicine_id"]').val(data.medicine_id).trigger('change');
modal.find('.modal-body select[name="medicine_group_id"]').val(data.medicine_group_id).trigger('change');
if(data.is_vaccination == 1){
$('#is-vaccination').prop("checked", true)
} else{
$('#is-vaccination').prop("checked", false)
}
if(!res.success) handleMessage(res.success, res.message)
}
});
}
})
function addNewMedicine(patientElementId){
Swal.fire({
html:"<p style='float: left;'>Medicine Name</p>",
input: "text",
showCancelButton: !0,
confirmButtonText: "<i class='fa fa-save mr-2'></i>Save",
cancelButtonText: "Cancel",
showLoaderOnConfirm: !1,
confirmButtonColor: "#844fc1",
cancelButtonColor: "#cbcbcb",
preConfirm: function (n) {
return new Promise(function (t) {
$.ajax({
url: medicine_base_url + '/save',
method:'post',
dataType:'json',
data:{
"_token": csrf_token,
name_en: n
},
success:function(r)
{
if(r.success !== true){
Swal.showValidationMessage('Failed while saving medicine name. ' + r.errors)
Swal.enableButtons()
}
else t(r.data)
}
})
})
},
allowOutsideClick:!1,
}).then(function (t) {
if(!t.dismiss){
t.value.map(item =>{
var patientOption = document.createElement('OPTION');
patientOption.setAttribute('value',item.id);
patientOption.setAttribute('selected','selected');
patientOption.text = item.name;
$('#'+patientElementId).append(patientOption);
})
}
})
}
function editMedicineName(testId,oldName, patientElementId){
Swal.fire({
html:"<p style='float: left;'>Medicine Name</p>",
input: "text",
inputValue: oldName,
showCancelButton: !0,
confirmButtonText: "<i class='fa fa-save mr-2'></i>Save",
cancelButtonText: "Cancel",
showLoaderOnConfirm: !1,
confirmButtonColor: "#844fc1",
cancelButtonColor: "#cbcbcb",
preConfirm: function (n) {
return new Promise(function (t) {
$.ajax({
url: medicine_base_url + '/update',
method:'post',
dataType:'json',
data:{
"_token": csrf_token,
uid: testId,
name_en: n
},
success:function(r)
{
if(r.success !== true){
Swal.showValidationMessage('Failed while saving medicine name. ' + r.errors)
Swal.enableButtons()
}
else t(r.data)
}
})
})
},
allowOutsideClick:!1,
}).then(function (t) {
if(!t.dismiss){
t.value.map(item =>{
var patientOption = document.createElement('OPTION');
patientOption.setAttribute('value',item.id);
patientOption.setAttribute('selected','selected');
patientOption.text = item.name;
$('#'+patientElementId).append(patientOption);
})
}
})
}

View File

@@ -1,113 +0,0 @@
$("#btnSave").on('click',function(e){
e.preventDefault();
data_id = $('#data-id').val();
let url = (data_id < 1 ? save_url : update_url);
$.ajax({
url: url,
type:"POST",
data :{
"_token": csrf_token,
uid : data_id,
name_en: $('#name-en').val(),
description: $('#description').val(),
is_gvaccination: $("input[name='is_vaccination']:checked").attr('data-id'),
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
});
});
function delete_data(uid){
Swal.fire({
text: confirm_delete_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_delete,
cancelButtonText: confirm_cancel
}).then((result) => {
if (result.value) {
$.ajax({
url: delete_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
function restore_data(uid){
Swal.fire({
text: confirm_restore_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_restore,
cancelButtonText: confirm_cancel_restore,
}).then((result) => {
if (result.value) {
$.ajax({
url: restore_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
$('#modal-medicine-group').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
var modal = $(this);
if(action === "new"){
// Clear inputs
modal.find('.modal-body input[name="uid"]').val(0);
modal.find('.modal-body input').val("");
modal.find('.modal-title').html(modal_add_title);
$('#description').val("");
$('#is-vaccination').prop("checked", false)
}else if(action === "edit"){
uid = button.data('uid');
modal.find('.modal-body input[name="uid"]').val(uid);
modal.find('.modal-title').html(modal_edit_title);
$.ajax({
url: get_url,
type:"POST",
data:{
"_token": csrf_token,
uid: uid,
},
success:function(res){
let data = res.data;
modal.find('.modal-body input[name="name_en"]').val(data.name_en);
$('#description').val(data.description);
if(data.is_gvaccination == 1){
$('#is-vaccination').prop("checked", true)
} else{
$('#is-vaccination').prop("checked", false)
}
if(!res.success) handleMessage(res.success, res.message)
}
});
}
})

View File

@@ -1,176 +0,0 @@
$("#btnSave").on('click',function(e){
var formData = $('#form-stock-in').serializeArray()
let data_id = $('#data-id').val();
let url = (data_id < 1 ? save_url : update_url);
$.ajax({
url: url,
type: "POST",
data: formData,
dataType: "json",
success: function (res) {
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
});
});
function delete_data(uid){
Swal.fire({
text: confirm_delete_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_delete,
cancelButtonText: confirm_cancel
}).then((result) => {
if (result.value) {
$.ajax({
url: delete_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
$('#modal-medicine-purchase').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
var modal = $(this);
$('#purchase_detail_body').empty();
if(action === "new"){
// Clear inputs
modal.find('.modal-body input[name="uid"]').val(0);
modal.find('.modal-body .clearable').val("");
modal.find('.modal-title').html(modal_add_title);
modal.find('.modal-body select[name="supplier_id"]').val("").trigger("change");
}else if(action === "edit"){
uid = button.data('uid');
modal.find('.modal-body input[name="uid"]').val(uid);
modal.find('.modal-title').html(modal_edit_title);
$.ajax({
url: get_url,
type:"POST",
data:{
"_token": csrf_token,
uid: uid,
},
success:function(res){
let data = res.data;
modal.find('.modal-body input[name="grn_number"]').val(data.grn_number);
modal.find('.modal-body input[name="po_number"]').val(data.po_number);
modal.find('.modal-body input[name="received_date"]').val(data.received_date);
modal.find('.modal-body #note').val(data.description);
modal.find('.modal-body select[name="supplier"]').val(data.supplier_id).trigger('change');
data.purchase_detail.map(item=>{
addPurchasedMedicalItem(item)
})
if(!res.success)handleMessage(res.success, res.message)
}
});
}
})
//
// function addNewMedicine(patientElementId){
// Swal.fire({
// html:"<p style='float: left;'>Medicine Name</p>",
// input: "text",
// showCancelButton: !0,
// confirmButtonText: "<i class='fa fa-save mr-2'></i>Save",
// cancelButtonText: "Cancel",
// showLoaderOnConfirm: !1,
// confirmButtonColor: "#844fc1",
// cancelButtonColor: "#cbcbcb",
// preConfirm: function (n) {
// return new Promise(function (t) {
// $.ajax({
// url: medicine_base_url + '/save',
// method:'post',
// dataType:'json',
// data:{
// "_token": csrf_token,
// name_en: n
// },
// success:function(r)
// {
// if(r.success !== true){
// Swal.showValidationMessage('Failed while saving medicine name. ' + r.errors)
// Swal.enableButtons()
// }
// else t(r.data)
// }
// })
// })
// },
// allowOutsideClick:!1,
// }).then(function (t) {
// if(!t.dismiss){
// t.value.map(item =>{
// var patientOption = document.createElement('OPTION');
// patientOption.setAttribute('value',item.id);
// patientOption.setAttribute('selected','selected');
// patientOption.text = item.name;
// $('#'+patientElementId).append(patientOption);
// })
// }
// })
// }
//
// function editMedicineName(testId,oldName, patientElementId){
// Swal.fire({
// html:"<p style='float: left;'>Medicine Name</p>",
// input: "text",
// inputValue: oldName,
// showCancelButton: !0,
// confirmButtonText: "<i class='fa fa-save mr-2'></i>Save",
// cancelButtonText: "Cancel",
// showLoaderOnConfirm: !1,
// confirmButtonColor: "#844fc1",
// cancelButtonColor: "#cbcbcb",
// preConfirm: function (n) {
// return new Promise(function (t) {
// $.ajax({
// url: medicine_base_url + '/update',
// method:'post',
// dataType:'json',
// data:{
// "_token": csrf_token,
// uid: testId,
// name_en: n
// },
// success:function(r)
// {
// if(r.success !== true){
// Swal.showValidationMessage('Failed while saving medicine name. ' + r.errors)
// Swal.enableButtons()
// }
// else t(r.data)
// }
// })
// })
// },
// allowOutsideClick:!1,
// }).then(function (t) {
// if(!t.dismiss){
// t.value.map(item =>{
// var patientOption = document.createElement('OPTION');
// patientOption.setAttribute('value',item.id);
// patientOption.setAttribute('selected','selected');
// patientOption.text = item.name;
// $('#'+patientElementId).append(patientOption);
// })
// }
// })
// }

View File

@@ -1,81 +0,0 @@
$("#btnSave").on('click',function(e){
var formData = $('#form-stock-out').serializeArray()
let data_id = $('#data-id').val();
let url = (data_id < 1 ? save_url : update_url);
$.ajax({
url: url,
type: "POST",
data: formData,
dataType: "json",
success: function (res) {
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
});
});
function delete_data(uid){
Swal.fire({
text: confirm_delete_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_delete,
cancelButtonText: confirm_cancel
}).then((result) => {
if (result.value) {
$.ajax({
url: delete_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
$('#modal-medicine-release').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
var modal = $(this);
$('#release_detail_body').empty();
if(action === "new"){
// Clear inputs
modal.find('.modal-body input[name="uid"]').val(0);
modal.find('.modal-body .clearable').val("");
modal.find('.modal-title').html(modal_add_title);
modal.find('.modal-body select[name="supplier_id"]').val("").trigger("change");
}else if(action === "edit"){
uid = button.data('uid');
modal.find('.modal-body input[name="uid"]').val(uid);
modal.find('.modal-title').html(modal_edit_title);
$.ajax({
url: get_url,
type:"POST",
data:{
"_token": csrf_token,
uid: uid,
},
success:function(res){
let data = res.data;
modal.find('.modal-body input[name="gin_number"]').val(data.gin_number);
modal.find('.modal-body input[name="issue_date"]').val(data.issue_date);
modal.find('.modal-body #note').val(data.description);
data.release_detail.map(item=>{
addReleaseMedicalItem(item)
})
if(!res.success)handleMessage(res.success, res.message)
}
});
}
})

View File

@@ -1,107 +0,0 @@
$("#btnSave").on('click',function(e){
e.preventDefault();
$("#btnSave").prop('disabled', true)
data_id = $('#data-id').val();
let url = (data_id < 1 ? save_url : update_url);
$.ajax({
url: url,
type:"POST",
data :{
"_token": csrf_token,
uid : data_id,
name_en: $('#name-en').val(),
unit_packing: $('#unit-packing').val()
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
});
});
function delete_data(uid){
Swal.fire({
text: confirm_delete_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_delete,
cancelButtonText: confirm_cancel
}).then((result) => {
if (result.value) {
$.ajax({
url: delete_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
function restore_data(uid){
Swal.fire({
text: confirm_restore_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_restore,
cancelButtonText: confirm_cancel_restore,
}).then((result) => {
if (result.value) {
$.ajax({
url: restore_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
$('#modal-medicine-unit').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
$("#btnSave").prop('disabled', false)
var modal = $(this);
if(action === "new"){
// Clear inputs
modal.find('.modal-body input[name="uid"]').val(0);
modal.find('.modal-body input').val("");
modal.find('.modal-title').html(modal_add_title);
}else if(action === "edit"){
uid = button.data('uid');
modal.find('.modal-body input[name="uid"]').val(uid);
modal.find('.modal-title').html(modal_edit_title);
$.ajax({
url: get_url,
type:"POST",
data:{
"_token": csrf_token,
uid: uid,
},
success:function(res){
let data = res.data;
modal.find('.modal-body input[name="name_en"]').val(data.name_en);
modal.find('.modal-body input[name="unit_packing"]').val(data.unit_packing);
if(!res.success) handleMessage(res.success, res.message)
}
});
}
})

View File

@@ -1,113 +0,0 @@
$('#patient-id').change(function () {
var patient_id = $(this).val()
if(patient_id>0) $('.sample-creation-form').fadeIn()
else $('.sample-creation-form').fadeOut()
})
function searchPatientToForm(patientElementId){
Swal.fire({
html:"<p style='text-align: left;'>Search the patient with their name, phone, Khmer ID, or patient ID</p>",
input: "text",
showCancelButton: !0,
confirmButtonText: "<i class='fa fa-search mr-2'></i>Search",
cancelButtonText: "Close",
position: 'top',
showLoaderOnConfirm: !1,
confirmButtonColor: "#4fb51a",
preConfirm: function (n) {
return new Promise(function (t) {
$.ajax({
url: patient_base_url + "/async",
method:'get',
dataType:'json',
data:{kword: n},
success:function(response)
{
if(response.data.length<1 || !response.success){
Swal.showValidationMessage('No patient found!')
Swal.enableButtons()
}
else {
t(response.data)
}
}
})
})
},
allowOutsideClick:!1,
}).then(function (t) {
if(!t.dismiss){
$('#'+patientElementId).html('');
t.value.map(item =>{
var patientOption = document.createElement('OPTION');
patientOption.setAttribute('value',item.id);
patientOption.text = item.patient_uuid + ' - ' + item.name_en;
$('#'+patientElementId).append(patientOption);
})
}
})
}
$("#searchPatientAddForm").click(function () {
searchPatientToForm('patient-id')
});
$('#province-id').change(function () {
getDistrictsByProvinceId('district-id', $(this).val())
})
$('#district-id').change(function () {
getCommunesByDistrictId('commune-id', $(this).val())
})
$('#commune-id').change(function () {
getVillagesByCommuneId('village-id', $(this).val())
})
$("#savePatient").on('click',function(e){
e.preventDefault();
$.ajax({
url: patient_base_url.toString()+'.save',
type:"POST",
dataType:"JSON",
data :{
"_token": csrf_token,
name_en: $('#patient-name').val(),
patient_uuid: $('#patient-code').val(),
dob: $('#dob').val(),
gender: $("input[name='gender']:checked").attr('data-id'),
marital_status: $("input[name='marital_status']:checked").attr('data-id'),
phone_number: $('#phone-number').val(),
province_id: $('#province-id').val(),
district_id : $('#district-id').val(),
commune_id: $('#commune-id').val(),
village_id: $('#village-id').val(),
khid_number: $('#khid-number').val(),
house_number: $('#house-number').val(),
street_number: $('#street-number').val()
},
success:function(res){
if(res.success){
var patient = res.data
var patientOption = document.createElement('OPTION');
patientOption.setAttribute('value',patient.id);
patientOption.setAttribute('selected','selected');
patientOption.text = patient.patient_uuid + ' - ' + patient.name_en;
$('#patient-id').append(patientOption);
$('#modal-patient .close').click();
$('#patient-id').trigger('change')
}else{
alertify.error("Can't create patient.")
}
}
});
});
$("#saveSample").on('click',function(e){
$('#form-start-opd-visit').submit();
});

View File

@@ -1,113 +0,0 @@
$("#btnSave").on('click',function(e){
e.preventDefault();
data_id = $('#data-id').val();
let url = parseInt(data_id) === 0 ? save_url : update_url;
$.ajax({
url: url,
type:"POST",
data :{
"_token": csrf_token,
uid : data_id,
name_en: $('#name-en').val(),
weight: $('#weight').val(),
is_bold: $('#is-bold').is(":checked") ? 1 : 0
//,lab_ids: $('#lab-ids').val()
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
});
});
function delete_data(uid){
Swal.fire({
text: confirm_delete_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_delete,
cancelButtonText: confirm_cancel
}).then((result) => {
if (result.value) {
$.ajax({
url: delete_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
function restore_data(uid){
Swal.fire({
text: confirm_restore_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_restore,
cancelButtonText: confirm_cancel_restore,
}).then((result) => {
if (result.value) {
$.ajax({
url: restore_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res) {
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
$('#modal-organism').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
var modal = $(this);
if(action === "new"){
// Clear inputs
//modal.find('.modal-body select[name="lab_ids"]').attr('multiple', true)
modal.find('.modal-body input[name="uid"]').val(0);
modal.find('.modal-title').html(modal_add_title);
$('#is-bold').prop('checked', false)
}else if(action === "edit"){
uid = button.data('uid');
//modal.find('.modal-body select[name="lab_ids"]').attr('multiple', false)
modal.find('.modal-body input[name="uid"]').val(uid);
modal.find('.modal-title').html(modal_edit_title);
$.ajax({
url: get_url,
type:"POST",
data:{
"_token": csrf_token,
uid: uid,
},
success:function(res){
let data = res.data;
modal.find('.modal-body input[name="name_en"]').val(data.name_en);
modal.find('.modal-body input[name="weight"]').val(data.weight);
//modal.find('.modal-body select[name="lab_ids"]').val(data.lab_id).trigger('change');
if(data.is_bold==0) $('#is-bold').prop('checked', false)
else $('#is-bold').prop('checked', true)
if(!res.success) handleMessage(res.success, res.message)
}
});
}
})

View File

@@ -1,106 +0,0 @@
$(".datepicker").datepicker({
format:'dd-mm-yyyy'
});
$("#btnSave").on('click',function(e){
// console.log($('#dob').val().replaceAll('-','/'))
var dob_ = $('#dob').val().split("-");
var _dob = dob_[0]+'-'+dob_[1]+'-'+dob_[2];
e.preventDefault();
data_id = $('#data-id').val();
let url = patient_base_url.toString() + (parseInt(data_id) === 0 ? '.save' : '.update').toString();
$.ajax({
url: url,
type:"POST",
data :{
"_token": csrf_token,
uid : data_id,
name_en: $('#patient-name').val(),
patient_uuid: $('#patient-code').val(),
dob: _dob,
gender: $("input[name='gender']:checked").attr('data-id'),
marital_status: $("input[name='marital_status']:checked").attr('data-id'),
phone_number: $('#phone-number').val(),
province_id: $('#province-id').val(),
district_id : $('#district-id').val(),
commune_id: $('#commune-id').val(),
village_id: $('#village-id').val(),
khid_number: $('#khid-number').val(),
house_number: $('#house-number').val(),
street_number: $('#street-number').val()
},
success:function(res){
handleMessage(res.success, res.message)
setTimeout(function () {location.reload()}, messageDuration)
}
});
});
function delete_data(uid){
deleteEntityRecord(uid, patient_base_url.toString() + '.delete')
}
function restore_data(uid){
restoreEntityRecord(uid,patient_base_url.toString() + '.restore')
}
$('#modal-patient').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
var modal = $(this);
if(action === "new"){
// Clear inputs
modal.find('.modal-body input').val("");
modal.find('.modal-body input[name="uid"]').val(0);
modal.find('.modal-title').html(modal_add_title);
modal.find('.modal-body select[name="province_id"]').val(0).trigger('change');
}else if(action === "edit"){
uid = button.data('uid');
modal.find('.modal-body input[name="uid"]').val(uid);
modal.find('.modal-title').html(modal_edit_title);
$.get(patient_base_url+'.get?uid='+uid, function(res, status){
if(res.success) {
let data = res.data;
let dob = new Date(data.dob)
var dob_split = dob.toLocaleDateString().split("/")
modal.find('.modal-body input[name="patient_code"]').val(data.patient_uuid);
modal.find('.modal-body input[name="patient_name"]').val(data.name_en);
//modal.find('.modal-body input[name="dob"]').val(data.dob);
$("#dob").val(dob_split[1].padStart(2,"0")+'-'+dob_split[0].padStart(2,"0")+'-'+dob_split[2]);
$("#dob").change();
//$('#age-unit').change();
modal.find('.modal-body input:radio[name="gender"]').filter("[data-id=" + data.gender + "]").prop('checked', true);
modal.find('.modal-body input:radio[name="marital_status"]').filter("[data-id=" + data.marital_status + "]").prop('checked', true);
modal.find('.modal-body input[name="phone_number"]').val(data.phone_number);
modal.find('.modal-body input[name="khid_number"]').val(data.khid_number);
modal.find('.modal-body input[name="house_number"]').val(data.house_number);
modal.find('.modal-body input[name="street_number"]').val(data.street_number);
getProvinces('province-id', data.province_id)
getDistrictsByProvinceId('district-id', data.province_id, data.district_id)
getCommunesByDistrictId('commune-id', data.district_id, data.commune_id)
getVillagesByCommuneId('village-id', data.commune_id, data.village_id)
}
else {
handleMessage(res.success, res.message)
}
});
}
})
$('#province-id').change(function () {
getDistrictsByProvinceId('district-id', $(this).val())
})
$('#district-id').change(function () {
getCommunesByDistrictId('commune-id', $(this).val())
})
$('#commune-id').change(function () {
getVillagesByCommuneId('village-id', $(this).val())
})

View File

@@ -1,127 +0,0 @@
$("#btnSave").on('click',function(e){
e.preventDefault();
console.log($("input:radio[name=gender]:checked").val())
data_id = $('#data-id').val();
let url = parseInt(data_id) === 0 ? save_url : update_url;
$.ajax({
url: url,
type:"POST",
data :{
"_token": csrf_token,
uid : data_id,
name_en: $('#name-en').val(),
gender: $("input[name='gender']:checked").attr('data-id'),
age_from: $('#age-from').val(),
age_from_unit: $('#age-from-unit').val(),
age_from_sign: $('#age-from-sign').val(),
age_to: $('#age-to').val(),
age_to_unit: $('#age-to-unit').val(),
age_to_sign: $('#age-to-sign').val()
//,lab_ids: $('#lab-ids').val()
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
},
});
});
function delete_data(uid){
Swal.fire({
text: confirm_delete_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_delete,
cancelButtonText: confirm_cancel
}).then((result) => {
if (result.value) {
$.ajax({
url: delete_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
function restore_data(uid){
Swal.fire({
text: confirm_restore_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_restore,
cancelButtonText: confirm_cancel_restore,
}).then((result) => {
if (result.value) {
$.ajax({
url: restore_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res){
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
$('#modal-patient-type').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
var modal = $(this);
if(action === "new"){
// Clear inputs
modal.find('.modal-body input').val("");
//modal.find('.modal-body select[name="lab_ids"]').attr('multiple', true)
modal.find('.modal-body input[name="uid"]').val(0);
modal.find('.modal-title').html(modal_add_title);
}else if(action === "edit"){
uid = button.data('uid');
modal.find('.modal-body select[name="lab_ids"]').attr('multiple', false)
modal.find('.modal-body input[name="uid"]').val(uid);
modal.find('.modal-title').html(modal_edit_title);
$.ajax({
url: get_url,
type:"POST",
data:{
"_token": csrf_token,
uid: uid,
},
success:function(res){
let data = res.data;
$("#name-en").trigger('change')
$("#name-en").empty().trigger("change");
$('#name-en').select2({tags:true,data: [{id: data.name_en, text:data.name_en, selected: true}]})
modal.find('.modal-body input[name="age_from"]').val(data.range_start);
modal.find('.modal-body select[name="age_from_unit"]').val(data.range_start_unit);
modal.find('.modal-body select[name="age_from_sign"]').val(data.range_start_sign);
modal.find('.modal-body input[name="age_to"]').val(data.range_end);
modal.find('.modal-body select[name="age_to_unit"]').val(data.range_end_unit);
modal.find('.modal-body select[name="age_to_sign"]').val(data.range_end_sign);
//modal.find('.modal-body select[name="lab_ids"]').val(data.lab_id).trigger('change');
modal.find('.modal-body input:radio[name="gender"]').filter("[data-id="+data.gender+"]").prop('checked', true);
if(!res.success) handleMessage(res.success, res.message)
},
error: function(response) {
},
});
}
})

View File

@@ -1,67 +0,0 @@
function restore_data(uid){
Swal.fire({
text: confirm_restore_record,
icon: 'question',
showCancelButton: true,
cancelButtonClass:'danger',
confirmButtonText: confirm_ok_restore,
cancelButtonText: confirm_cancel_restore,
}).then((result) => {
if (result.value) {
$.ajax({
url: restore_url,
method:'POST',
data:{
"_token": csrf_token,
uid : uid,
},
success:function(res) {
handleMessage(res.success, res.message)
if(res.success) setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
$('#modal-physician').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
var modal = $(this);
if(action === "new"){
// Clear inputs
$('#form-physician').attr('action', save_url)
modal.find('.modal-body select[name="lab_ids"]').attr('multiple', true)
modal.find('.modal-body input[name="name_en"]').val("");
modal.find('.modal-body input[name="uid"]').val(0);
modal.find('.modal-title').html(modal_add_title);
}else if(action === "edit"){
$('#form-physician').attr('action', update_url)
uid = button.data('uid');
modal.find('.modal-body select[name="lab_ids"]').attr('multiple', false)
modal.find('.modal-body input[name="uid"]').val(uid);
modal.find('.modal-title').html(modal_edit_title);
$.ajax({
url: get_url,
type:"POST",
data:{
"_token": csrf_token,
uid: uid,
},
success:function(res){
let data = res.data;
modal.find('.modal-body input[name="name_en"]').val(data.name_en);
modal.find('.modal-body input[name="name_kh"]').val(data.name_kh);
modal.find('.modal-body select[name="lab_ids"]').val(data.lab_id).trigger('change');
document.getElementById("file-ip-1-preview").src = physician_logo_path+'/'+data.logo
if(data.is_default==0) $('#default-select').prop('checked', false)
else $('#default-select').prop('checked', true)
if(!res.success) handleMessage(res.success, res.message)
}
});
}
})

View File

@@ -1,193 +0,0 @@
let antibiotic_results = []
$('#print_preview_modal').on('show.bs.modal', function (event) {
$.ajax({
url: get_refs_base_url + '/test-items/' + sample_id,
type: "GET",
dataType: "json",
success: function (response) {
if(response.success){
$('#sample-result-print').empty()
let res = response.data
antibiotic_results = res.antibiotic_results
for (var i in res.sample_tests){
let heading = {"sample": res.sample, "department": res.sample_tests[i].department_name}
let samples_list = res.sample_tests[i].samples;
for(var j in samples_list){
renderPrintTestItemDepartmentRow(samples_list[j], heading,'sample-result-print')
var tests = samples_list[j].tests
var sampleTest = list_to_tree(tests)
sampleTest.map(parent => {
renderPrintTestItemRow(parent, '0' ,'test-dep-'+samples_list[j].sample_type_id,' sample-result-print')
if(parent.children.length){
var children = parent.children
children.map(function (child) {
renderPrintTestItemRow(child, '1' ,'test-dep-'+samples_list[j].sample_type_id,' sample-result-print')
if(child.children.length){
var grandchildren = child.children
grandchildren.map(function (grandchild) {
renderPrintTestItemRow(grandchild, '1' ,'test-dep-'+samples_list[j].sample_type_id,' sample-result-print')
})
}
});
}
})
}
}
} else{
antibiotic_results = []
}
}
});
})
function manipulateTableHeading(department, sample_type, sample_number, requester, collected_date, received_date, sample_tests) {
let tableData = '<table width="100%" border="0" class="_department-sample-info"><thead>\n' +
' <tr style="background: #eee;">' +
' <td colspan="5" style="text-align: center; font-weight: bold; color: #0000ff !important;">'+sample_type+'</td>' +
' </tr>\n' +
'<tr>\n' +
' <th class="sourceserifpro-bold" style="width: 52% !important; color: #0000ff;"><div style="width:380px !important; float:left; height:10px; ">&nbsp;</div></th>\n' +
' <th class="sourceserifpro-bold" style="width: 15%; color: #0000ff;">&nbsp;&nbsp;&nbsp;&nbsp;Result</th>\n' +
' <th class="sourceserifpro-bold" style="width: 5%; color: #0000ff;"></th>\n' +
' <th class="sourceserifpro-bold" style="width: 10%; color: #0000ff;">Units</th>\n' +
' <th class="sourceserifpro-bold" style="width: 18%; color: #0000ff; text-align: center">Reference Range</th>\n' +
' </tr></thead>\n' +
' <tbody id="test-dep-'+sample_tests.sample_type_id+'"></tbody>'+
' </thead>' +
' </table>'
return tableData;
}
function manipulateSubHeading(setSelectorId) {
let subTableHeading = '<table width="100%" border="0" class="_test-result">\n' +
' <thead><tr>\n' +
' <th class="sourceserifpro-bold" style="/*width: 361px !important;*/ color: #0000ff;"></th>\n' +
' <th class="sourceserifpro-bold" style="width: 2cm; color: #0000ff;">Result</th>\n' +
' <th class="sourceserifpro-bold" style="width: 0.5cm; color: #0000ff;"></th>\n' +
' <th class="sourceserifpro-bold" style="width: 1.5cm; color: #0000ff;">Units</th>\n' +
' <th class="sourceserifpro-bold" style="width: 3.5cm; color: #0000ff; text-align: center">Reference Range</th>\n' +
' </tr>\n' +
' <tbody id='+setSelectorId+'></tbody>'+
' </thead>' +
'</table>'
return subTableHeading
}
function renderPrintTestItemDepartmentRow(sample_tests, department_heading, wrapperId)
{
let tableData = manipulateTableHeading(department_heading.department, sample_tests.sample_type_name, department_heading.sample.sample_number, department_heading.sample.requested_by.name_en, department_heading.sample.collected_date, department_heading.sample.received_date, sample_tests)
var tr = document.createElement('TR');
tr.setAttribute('class', 'sample-type');
tr.insertCell(0).innerHTML = tableData;
$('#'+wrapperId).append(tr);
//var subtr = document.createElement('TR');
//subtr.insertCell(0).innerHTML = manipulateSubHeading('test-dep-'+sample_tests.sample_type_id);
//$('#'+wrapperId).append(subtr);
}
function renderPrintTestItemRow(sample_tests, level, closet_parent_id)
{
if(sample_tests.is_show == 1) {
let IsAbnormal = computeRefRange(sample_tests);
let tr = document.createElement('TR');
tr.setAttribute('valign', 'top')
tr.insertCell(0).innerHTML = '' + (sample_tests.field_type == 0 ? '<b class="sourceserifpro-bold">' + sample_tests.test_name + '</b>' : '<p class="value-pair"><span style="font-size:13pt !important;" class="name">' + sample_tests.test_name + '</span></p>') + ''; // + (sample_tests.description!="" ? '<p class="pl-4 pt-2">'+sample_tests.description+'</p>' : '');
//tr.cells[0].classList.add('tname')
if(["2","3"].includes(sample_tests.field_type)){
tr.insertCell(1).innerHTML = (sample_tests.field_type == 0 ? '' : '<span style="margin-right:10px;">:</span> ') + manipulatePrintOrganismResult(sample_tests) // (sample_tests.field_type!=0 ? (sample_tests.test_result.length<1 ? 'Pending' : sample_tests.test_result) : '');
tr.cells[1].colSpan=4
}else{
tr.insertCell(1).innerHTML = '<span class="name" style="font-family: \'Times New Roman\', Times, serif;">'+ (sample_tests.field_type == 0 ? '' : '<span style="margin-right:10px;">:</span> ') + manipulatePrintOrganismResult(sample_tests) +'</span>'; // (sample_tests.field_type!=0 ? (sample_tests.test_result.length<1 ? 'Pending' : sample_tests.test_result) : '');
tr.insertCell(2).innerHTML = (IsAbnormal !="" ? '<span class="abnormal" style="margin-right: 20px">'+IsAbnormal+'</span>' : '');
tr.insertCell(3).innerHTML = sample_tests.unit_sign;
tr.insertCell(4).innerHTML = '<span class="name" style="font-family: \'Times New Roman\', Times, serif;">'+ sample_tests.ref_range +'</span>';
tr.cells[4].style.textAlign = 'center'
}
tr.cells[0].style.paddingLeft = (5 * level * 2.5) + 'px'
tr.cells[0].style.width="380px";
if(IsAbnormal!=''){
tr.cells[1].classList.add('abnormal')
}
if (sample_tests.field_type == 0) {
tr.cells[0].classList.add('pl-' + (level * 2))
}
$('#' + closet_parent_id).append(tr);
if(sample_tests.description!=""){
renderPrintTestItemDescriptionRow(sample_tests, level, closet_parent_id);
}
if(sample_tests.comment!=""){
renderPrintTestItemCommentRow(sample_tests, level, closet_parent_id);
}
}
}
function renderPrintTestItemDescriptionRow(sample_tests, level, closet_parent_id)
{
if(sample_tests.is_show == 1) {
let tr = document.createElement('TR');
tr.setAttribute('valign', 'top');
tr.insertCell(0).innerHTML = (sample_tests.description!=="" ? '<p class="pl-4 pt-2">'+sample_tests.description+'</p>' : '');
tr.cells[0].style.paddingLeft = (5 * level * 5) + 'px'
tr.cells[0].colSpan=5
if (sample_tests.field_type == 0) {
tr.cells[0].classList.add('pl-' + (level * 2))
}
$('#' + closet_parent_id).append(tr);
}
}
function renderPrintTestItemCommentRow(sample_tests, level, closet_parent_id)
{
if(sample_tests.is_show == 1) {
let tr = document.createElement('TR');
tr.setAttribute('valign', 'top');
tr.insertCell(0).innerHTML = (sample_tests.comment!=="" ? '<div style="padding-left: 15px; float:left; font-weight:bold;">Comment: </div><div style="padding-left:85px; margin-top: 0px; margin-left:10px;">'+sample_tests.comment+'</div>' : '');
tr.cells[0].style.paddingLeft = (5 * 0) + 'px'
tr.cells[0].colSpan=5
if (sample_tests.field_type == 0) {
tr.cells[0].classList.add('pl-' + (0 * 2))
}
$('#' + closet_parent_id).append(tr);
}
}
function computeRefRange(sample_tests) {
if(sample_tests.min_ref_val=='' || sample_tests.max_ref_val=='' || sample_tests.test_result=='' || sample_tests.ref_range == '') return ''
else if([">",">=","<","<=","-","Neg <", "Neg<"].includes(sample_tests.sign)){
if(parseFloat(sample_tests.test_result) > parseFloat(sample_tests.max_ref_val)) return 'H';
if(parseFloat(sample_tests.test_result) < parseFloat(sample_tests.min_ref_val)) return 'L';
else return ''
} else return ''
}
function manipulatePrintOrganismResult(sample_tests) {
if(sample_tests.field_type == 0){
return ''
} else if(["2","3"].includes(sample_tests.field_type)){
return (sample_tests.org_results.length<1 ? 'Pending' : sample_tests.org_results.map(function (value) {
let anti_text =''
antibiotic_results.map(function (anti) {
if(anti.organism_id == value.organism_id && anti.test_organism_id == value.test_organism_id){
anti_text+= '<p class="value-pair" style="width: 90% !important; position: relative;"><span class="name" style="padding-left: 10px; '+(anti.sensitive=='S' ? 'font-weight:bold':'')+'"> - '+anti.name_en+'</span> <span class="name" style="float: right; '+(anti.sensitive=='S' ? 'font-weight:bold':'')+'">'+anti.sensitive+'</span></p>';
}
});
return ((value.is_bold==1) ? '<span class="abnormal">'+ value.organism_name+'</span>' : value.organism_name) +' '+ (value.quantity_name !=null ? value.quantity_name : '') + anti_text;
}).join(' '))
} else if(sample_tests.field_type == 1){
return (sample_tests.test_result.length<1 ? 'Pending' : sample_tests.test_result)
}
else{
return (sample_tests.test_result.length<1 ? 'Pending' : sample_tests.test_result)
}
}

View File

@@ -1,206 +0,0 @@
let antibiotic_results = []
$('#print_preview_modal').on('show.bs.modal', function (event) {
$.ajax({
url: get_refs_base_url + '/test-items/' + sample_id,
type: "GET",
dataType: "json",
success: function (response) {
if(response.success){
$('#sample-result-print').empty()
let res = response.data
antibiotic_results = res.antibiotic_results
for (var i in res.sample_tests){
let heading = {"sample": res.sample, "department": res.sample_tests[i].department_name}
let samples_list = res.sample_tests[i].samples;
for(var j in samples_list){
renderPrintTestItemDepartmentRow(samples_list[j], heading,'sample-result-print')
var tests = samples_list[j].tests
var sampleTest = list_to_tree(tests)
sampleTest.map(parent => {
renderPrintTestItemRow(parent, '0' ,'test-dep-'+samples_list[j].sample_type_id,' sample-result-print')
if(parent.children.length){
var children = parent.children
children.map(function (child) {
renderPrintTestItemRow(child, '1' ,'test-dep-'+samples_list[j].sample_type_id,' sample-result-print')
if(child.children.length){
var grandchildren = child.children
grandchildren.map(function (grandchild) {
renderPrintTestItemRow(grandchild, '1' ,'test-dep-'+samples_list[j].sample_type_id,' sample-result-print')
})
}
});
}
})
}
}
} else{
antibiotic_results = []
}
}
});
})
function manipulateTableHeading(department, sample_type, sample_number, requester, collected_date, received_date, sample_tests) {
let tableData = '<table width="100%" border="0" class="_department-sample-info"><thead>\n' +
' <tr style="background: #eee;">' +
' <td class="sourceserifpro-bold result-page-color" colspan="5" style="text-align: center;">'+sample_type+'</td>' +
' </tr>\n' +
'<tr>\n' +
' <th class="sourceserifpro-bold result-font-size result-page-color" style="width: 50% !important;"><div style="width:370px !important; float:left; height:10px; ">&nbsp;</div></th>\n' +
' <th class="sourceserifpro-bold result-font-size result-page-color" style="width: 15%;">Result</th>\n' +
' <th class="sourceserifpro-bold result-font-size result-page-color" style="width: 5%;"></th>\n' +
' <th class="sourceserifpro-bold result-font-size result-page-color" style="width: 10%;">Units</th>\n' +
' <th class="sourceserifpro-bold result-font-size result-page-color" style="width: 20%; text-align: center">Normal Range</th>\n' +
' </tr></thead>\n' +
' <tbody id="test-dep-'+sample_tests.sample_type_id+'"></tbody>'+
' </thead>' +
' </table>'
return tableData;
}
function renderPrintTestItemDepartmentRow(sample_tests, department_heading, wrapperId)
{
let tableData = manipulateTableHeading(department_heading.department, sample_tests.sample_type_name, department_heading.sample.sample_number, department_heading.sample.requested_by.name_en, department_heading.sample.collected_date, department_heading.sample.received_date, sample_tests)
var tr = document.createElement('TR');
tr.setAttribute('class', 'sample-type');
tr.insertCell(0).innerHTML = tableData;
$('#'+wrapperId).append(tr);
}
function renderPrintTestItemRow(sample_tests, level, closet_parent_id)
{
if(sample_tests.is_show == 1) {
let IsAbnormal = computeRefRange(sample_tests);
let tr = document.createElement('TR');
tr.setAttribute('valign', 'top')
tr.insertCell(0).innerHTML = '' + (sample_tests.field_type == 0 ? '<b class="sourceserifpro-bold">' + sample_tests.test_name + '</b>' : '<p class="value-pair"><span style="'+(sample_tests.is_bold==1 ? ' font-weight:bold;' :'' )+'" class="name result-font-size">' + sample_tests.test_name + '</span> </p>') + '';
if(["2","3"].includes(sample_tests.field_type)){
tr.insertCell(1).innerHTML = (sample_tests.field_type == 0 ? '' : '') + manipulatePrintOrganismResult(sample_tests)
tr.cells[1].colSpan=4
}else{
if(sample_tests.unit_sign.trim()!='' || (["0.0","0.00","0"].includes(sample_tests.sign))){
tr.insertCell(1).innerHTML = ''+ (sample_tests.field_type == 0 ? '' : '') + manipulatePrintOrganismResult(sample_tests) +'</span>';
tr.insertCell(2).innerHTML = (IsAbnormal !="" ? '<span class="abnormal" style="margin-right: 20px">'+IsAbnormal+'</span>' : '');
tr.insertCell(3).innerHTML = sample_tests.unit_sign;
tr.insertCell(4).innerHTML = '<span class="name result-font">'+ sample_tests.ref_range +'</span>';
tr.cells[4].style.textAlign = 'center'
}
else{
tr.insertCell(1).innerHTML = ''+ (sample_tests.field_type == 0 ? '' : '') + manipulatePrintOrganismResult(sample_tests) +'</span>';
tr.cells[1].colSpan=4
}
}
tr.cells[0].style.paddingLeft = (5 * level * 2.5) + 'px'
tr.cells[0].style.width="380px";
if(IsAbnormal!=''){
tr.cells[1].classList.add('abnormal')
}
if (sample_tests.field_type == 0) {
tr.cells[0].classList.add('pl-' + (level * 2))
}
$('#' + closet_parent_id).append(tr);
if(sample_tests.description!=""){
renderPrintTestItemDescriptionRow(sample_tests, level, closet_parent_id);
}
if(sample_tests.comment!=""){
renderPrintTestItemCommentRow(sample_tests, level, closet_parent_id);
}
}
}
function renderPrintTestItemDescriptionRow(sample_tests, level, closet_parent_id)
{
if(sample_tests.is_show == 1) {
let tr = document.createElement('TR');
tr.setAttribute('valign', 'top');
tr.insertCell(0).innerHTML = (sample_tests.description!=="" ? '<p class="pl-4 pt-2">'+sample_tests.description+'</p>' : '');
tr.cells[0].style.paddingLeft = (5 * level * 5) + 'px'
tr.cells[0].colSpan=5
if (sample_tests.field_type == 0) {
tr.cells[0].classList.add('pl-' + (level * 2))
}
$('#' + closet_parent_id).append(tr);
}
}
function renderPrintTestItemCommentRow(sample_tests, level, closet_parent_id)
{
if(sample_tests.is_show == 1) {
let tr = document.createElement('TR');
tr.setAttribute('valign', 'top');
tr.insertCell(0).innerHTML = (sample_tests.comment!=="" ? '<div style="padding-left: 15px; float:left; font-weight:bold;">Comment: </div><div style="padding-left:85px; margin-top: 0px; margin-left:10px;">'+sample_tests.comment+'</div>' : '');
tr.cells[0].style.paddingLeft = (5 * 0) + 'px'
tr.cells[0].colSpan=5
if (sample_tests.field_type == 0) {
tr.cells[0].classList.add('pl-' + (0 * 2))
}
$('#' + closet_parent_id).append(tr);
}
}
function computeRefRange(sample_tests) {
if(sample_tests.min_ref_val=='' || sample_tests.max_ref_val=='' || sample_tests.test_result=='' || sample_tests.ref_range == '') return ''
/*else if([">",">=","<","<=","-","Neg <", "Neg<","≤","≥"].includes(sample_tests.sign)){
if(parseFloat(sample_tests.test_result) > parseFloat(sample_tests.max_ref_val)) return 'H';
if(parseFloat(sample_tests.test_result) < parseFloat(sample_tests.min_ref_val)) return 'L';
else return ''*/
else if([/*">",">=","<","<=",*/"-"].includes(sample_tests.sign)){
if(parseFloat(sample_tests.test_result) > parseFloat(sample_tests.max_ref_val)) return 'H';
if(parseFloat(sample_tests.test_result) < parseFloat(sample_tests.min_ref_val)) return 'L';
else return ''
}else if(["<=","Neg <", "Neg<","≤","<"].includes(sample_tests.sign)){
if(parseFloat(sample_tests.test_result) > parseFloat(sample_tests.max_ref_val)) return 'H';
else return ''
}else if([">",">=","≥"].includes(sample_tests.sign)){
//console.log(parseFloat(sample_tests.test_result), " : "+ parseFloat(sample_tests.max_ref_val))
if(parseFloat(sample_tests.test_result) < parseFloat(sample_tests.max_ref_val)){ return 'L'; }
else { console.log('h',sample_tests); return ''; }
}
else if(["0.0"].includes(sample_tests.sign)){
if(parseFloat(sample_tests.test_result) > parseFloat(sample_tests.max_ref_val)) return 'H';
if(parseFloat(sample_tests.test_result) < parseFloat(sample_tests.min_ref_val)) return 'L';
else return ''
}
else return ''
}
function manipulatePrintOrganismResult(sample_tests) {
if(sample_tests.field_type == 0){
return ''
} else if(["2","3"].includes(sample_tests.field_type)){
let orgCount = 0;
return (sample_tests.org_results.length<1 ? ': Pending' : sample_tests.org_results.map(function (value) {
let anti_text =''
orgCount+=1;
antibiotic_results.map(function (anti) {
if(anti.organism_id == value.organism_id && anti.test_organism_id == value.test_organism_id && anti.sensitive!=''){
anti_text+= '<p class="value-pair" style="width: 90% !important; position: relative;"><span class="name" style="padding-left: 10px; '+(anti.sensitive=='R' ? 'font-weight:bold':'')+'"> - '+anti.name_en+'</span> <span class="name" style="float: right; '+(anti.sensitive=='R' ? 'font-weight:bold':'')+'">'+anti.sensitive+'</span></p>';
}
});
if(anti_text!=''){
return '<p class="value-pair" style="width: 90% !important; position: relative; margin-top:2px !important;"> <span class="name result-font">'+(orgCount==1?': ':'&nbsp;&nbsp;') +'</span>'+ ((value.is_bold==1) ? '<span class="abnormal name">' + value.organism_name +'</span>' : '<span class="name">' + value.organism_name + '</span>') +' <span class="name" style="float: right;"> '+ (value.quantity_name !=null ? value.quantity_name : '')+'</span> </p>' + anti_text;
}
else{
return ': ' +((value.is_bold==1) ? '<span class="abnormal">'+ value.organism_name+'</span>' : value.organism_name) +' '+ (value.quantity_name !=null ? value.quantity_name : '') +'</br>'
}
}).join(' '))
} else if(sample_tests.field_type == 1){
return '<span class="name result-font">: ' + (sample_tests.test_result.length<1 ? 'Pending' : sample_tests.test_result) + '</span>'
}
else{
return '<span class="name result-font">: ' + (sample_tests.test_result.length<1 ? 'Pending' : sample_tests.test_result) + '</span>'
}
}

Some files were not shown because too many files have changed in this diff Show More