|
@@ -12,6 +12,26 @@
|
|
<div class="p-0 mcp-theme-1" id="fdb-pg">
|
|
<div class="p-0 mcp-theme-1" id="fdb-pg">
|
|
<div class="px-3 py-2 bg-light border-bottom d-flex align-items-center font-weight-bold font-size-14">FDB Playground</div>
|
|
<div class="px-3 py-2 bg-light border-bottom d-flex align-items-center font-weight-bold font-size-14">FDB Playground</div>
|
|
<div class="p-3">
|
|
<div class="p-3">
|
|
|
|
+ <div class="d-flex align-items-baseline mb-2">
|
|
|
|
+ <span class="font-size-14 font-weight-bold">Allergies</span>
|
|
|
|
+ <a href="#" v-on:click.prevent="addAllergy()" class="ml-3">+ Add</a>
|
|
|
|
+ </div>
|
|
|
|
+ <table class="table table-sm table-striped table-bordered m-0" style="table-layout: fixed">
|
|
|
|
+ <thead>
|
|
|
|
+ <tr>
|
|
|
|
+ <th class="border-bottom-0 text-secondary">Allergy</th>
|
|
|
|
+ </tr>
|
|
|
|
+ </thead>
|
|
|
|
+ <tbody>
|
|
|
|
+ <tr v-for="(item, index) in allergies">
|
|
|
|
+ <td class="p-0 position-relative">
|
|
|
|
+ <input type="text" class="rounded-0 border-0 form-control form-control-sm min-width-unset"
|
|
|
|
+ fdb-allergy-suggest-search :fdb-suggest-group="index">
|
|
|
|
+ </td>
|
|
|
|
+ </tr>
|
|
|
|
+ </tbody>
|
|
|
|
+ </table>
|
|
|
|
+ <hr class="m-neg-4 my-4">
|
|
<div class="d-flex align-items-baseline mb-2">
|
|
<div class="d-flex align-items-baseline mb-2">
|
|
<span class="font-size-14 font-weight-bold">Current Problems</span>
|
|
<span class="font-size-14 font-weight-bold">Current Problems</span>
|
|
<a href="#" v-on:click.prevent="addDx()" class="ml-3">+ Add</a>
|
|
<a href="#" v-on:click.prevent="addDx()" class="ml-3">+ Add</a>
|
|
@@ -24,8 +44,8 @@
|
|
</thead>
|
|
</thead>
|
|
<tbody>
|
|
<tbody>
|
|
<tr v-for="(item, index) in dx">
|
|
<tr v-for="(item, index) in dx">
|
|
- <td class="p-0 position-relative" style="z-index: 2">
|
|
|
|
- <input type="text" class="rounded-0 border-0 form-control form-control-sm min-width-unset" style="z-index: 1"
|
|
|
|
|
|
+ <td class="p-0 position-relative">
|
|
|
|
+ <input type="text" class="rounded-0 border-0 form-control form-control-sm min-width-unset"
|
|
fdb-dx-suggest-search :fdb-suggest-group="index">
|
|
fdb-dx-suggest-search :fdb-suggest-group="index">
|
|
</td>
|
|
</td>
|
|
</tr>
|
|
</tr>
|
|
@@ -51,8 +71,8 @@
|
|
</thead>
|
|
</thead>
|
|
<tbody>
|
|
<tbody>
|
|
<tr v-for="(item, index) in rx">
|
|
<tr v-for="(item, index) in rx">
|
|
- <td class="p-0 position-relative" style="z-index: 1">
|
|
|
|
- <input type="text" class="rounded-0 border-0 form-control form-control-sm min-width-unset" style="z-index: 1"
|
|
|
|
|
|
+ <td class="p-0 position-relative">
|
|
|
|
+ <input type="text" class="rounded-0 border-0 form-control form-control-sm min-width-unset"
|
|
fdb-med-suggest-search :fdb-suggest-group="index">
|
|
fdb-med-suggest-search :fdb-suggest-group="index">
|
|
</td>
|
|
</td>
|
|
<td class="p-0 position-relative">
|
|
<td class="p-0 position-relative">
|
|
@@ -120,6 +140,9 @@
|
|
else if($(elem).is('[fdb-dx-suggest-search]')) {
|
|
else if($(elem).is('[fdb-dx-suggest-search]')) {
|
|
ep = '/fdb-dx-suggest';
|
|
ep = '/fdb-dx-suggest';
|
|
}
|
|
}
|
|
|
|
+ else if($(elem).is('[fdb-allergy-suggest-search]')) {
|
|
|
|
+ ep = '/fdb-allergy-suggest';
|
|
|
|
+ }
|
|
$.get(ep + '?term=' + $.trim(term), function (_data) {
|
|
$.get(ep + '?term=' + $.trim(term), function (_data) {
|
|
suggestionsOuter.html(_data).removeClass('d-none');
|
|
suggestionsOuter.html(_data).removeClass('d-none');
|
|
});
|
|
});
|
|
@@ -226,6 +249,9 @@
|
|
el: '#fdb-pg',
|
|
el: '#fdb-pg',
|
|
delimiters: ['@{{', '}}'],
|
|
delimiters: ['@{{', '}}'],
|
|
data: {
|
|
data: {
|
|
|
|
+ allergies: [{
|
|
|
|
+
|
|
|
|
+ }],
|
|
dx: [{
|
|
dx: [{
|
|
|
|
|
|
}],
|
|
}],
|
|
@@ -248,6 +274,13 @@
|
|
$('[fdb-dx-suggest-search]').last().focus();
|
|
$('[fdb-dx-suggest-search]').last().focus();
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ addAllergy: function() {
|
|
|
|
+ this.allergies.push({});
|
|
|
|
+ Vue.nextTick(() => {
|
|
|
|
+ this.initFDBAllergySuggest();
|
|
|
|
+ $('[fdb-allergy-suggest-search]').last().focus();
|
|
|
|
+ });
|
|
|
|
+ },
|
|
initFDBRxSuggest: function() {
|
|
initFDBRxSuggest: function() {
|
|
$('[fdb-med-suggest-search]:not([fdb-suggest-initialized])').each(function() {
|
|
$('[fdb-med-suggest-search]:not([fdb-suggest-initialized])').each(function() {
|
|
let elem = $(this);
|
|
let elem = $(this);
|
|
@@ -291,13 +324,36 @@
|
|
return handleKeypress($(this), e);
|
|
return handleKeypress($(this), e);
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ $(this).attr('fdb-suggest-initialized', 1);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ initFDBAllergySuggest: function() {
|
|
|
|
+ $('[fdb-allergy-suggest-search]:not([fdb-suggest-initialized])').each(function() {
|
|
|
|
+ let elem = $(this);
|
|
|
|
+ elem.next('.fdb-suggestions-container').remove();
|
|
|
|
+ $('<div class="fdb-suggestions-container position-relative" fdb-suggest-group="' + elem.attr('fdb-suggest-group') + '">' +
|
|
|
|
+ '<div class="suggestions-outer fdb-suggestions position-absolute d-none"></div>' +
|
|
|
|
+ '</div>').insertAfter(elem);
|
|
|
|
+
|
|
|
|
+ elem
|
|
|
|
+ .off('keydown.fdb-suggest')
|
|
|
|
+ .on('keydown.fdb-suggest', function (e) {
|
|
|
|
+ suggestionsOuter = $(this).next('.fdb-suggestions-container').find('>.suggestions-outer');
|
|
|
|
+ return handleKeydown($(this), e);
|
|
|
|
+ })
|
|
|
|
+ .off('keypress.fdb-suggest')
|
|
|
|
+ .on('keypress.fdb-suggest', function (e) {
|
|
|
|
+ suggestionsOuter = $(this).next('.fdb-suggestions-container').find('>.suggestions-outer');
|
|
|
|
+ return handleKeypress($(this), e);
|
|
|
|
+ });
|
|
|
|
+
|
|
$(this).attr('fdb-suggest-initialized', 1);
|
|
$(this).attr('fdb-suggest-initialized', 1);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted: function() {
|
|
mounted: function() {
|
|
|
|
|
|
- // on auto-suggest selection
|
|
|
|
|
|
+ // on auto-suggest med selection
|
|
$(document).off('click', '.suggest-item.fdb-suggest[data-med-name-id]');
|
|
$(document).off('click', '.suggest-item.fdb-suggest[data-med-name-id]');
|
|
$(document).on('click', '.suggest-item.fdb-suggest[data-med-name-id]', function () {
|
|
$(document).on('click', '.suggest-item.fdb-suggest[data-med-name-id]', function () {
|
|
|
|
|
|
@@ -319,7 +375,7 @@
|
|
return false;
|
|
return false;
|
|
});
|
|
});
|
|
|
|
|
|
- // on auto-suggest selection
|
|
|
|
|
|
+ // on auto-suggest dx selection
|
|
$(document).off('click', '.suggest-item.fdb-suggest[data-dx-id]');
|
|
$(document).off('click', '.suggest-item.fdb-suggest[data-dx-id]');
|
|
$(document).on('click', '.suggest-item.fdb-suggest[data-dx-id]', function () {
|
|
$(document).on('click', '.suggest-item.fdb-suggest[data-dx-id]', function () {
|
|
|
|
|
|
@@ -341,6 +397,30 @@
|
|
return false;
|
|
return false;
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ // on auto-suggest allergy selection
|
|
|
|
+ $(document).off('click', '.suggest-item.fdb-suggest[data-dam-concept-id]');
|
|
|
|
+ $(document).on('click', '.suggest-item.fdb-suggest[data-dam-concept-id]', function () {
|
|
|
|
+
|
|
|
|
+ $('.suggestions-outer.fdb-suggestions').addClass('d-none');
|
|
|
|
+
|
|
|
|
+ let damConceptID = $(this).attr('data-dam-concept-id'),
|
|
|
|
+ damConceptIDTyp = $(this).attr('data-dam-concept-id-typ'),
|
|
|
|
+ label = $.trim($(this).text()),
|
|
|
|
+ group = $(this).closest('.fdb-suggestions-container').attr('fdb-suggest-group');
|
|
|
|
+
|
|
|
|
+ // set value
|
|
|
|
+ let input = $(this).closest('.position-relative').prev('[fdb-allergy-suggest-search]');
|
|
|
|
+ input.val(label);
|
|
|
|
+ input.attr('data-dam-concept-id', damConceptID);
|
|
|
|
+ input.attr('data-dam-concept-id-type', damConceptIDTyp);
|
|
|
|
+ input.trigger('input');
|
|
|
|
+ input.trigger('change');
|
|
|
|
+
|
|
|
|
+ $(document).trigger('fdb-allergy-changed', [group]);
|
|
|
|
+
|
|
|
|
+ return false;
|
|
|
|
+ });
|
|
|
|
+
|
|
// med changed, update routes
|
|
// med changed, update routes
|
|
$(document).off('fdb-med-changed');
|
|
$(document).off('fdb-med-changed');
|
|
$(document).on('fdb-med-changed', function(e, group) {
|
|
$(document).on('fdb-med-changed', function(e, group) {
|
|
@@ -416,9 +496,10 @@
|
|
});
|
|
});
|
|
|
|
|
|
Vue.nextTick(() => {
|
|
Vue.nextTick(() => {
|
|
|
|
+ this.initFDBAllergySuggest();
|
|
this.initFDBDxSuggest();
|
|
this.initFDBDxSuggest();
|
|
this.initFDBRxSuggest();
|
|
this.initFDBRxSuggest();
|
|
- $('[fdb-dx-suggest-search]').first().focus();
|
|
|
|
|
|
+ $('[fdb-allergy-suggest-search]').first().focus();
|
|
});
|
|
});
|
|
|
|
|
|
}
|
|
}
|