fix: duplicate filters added on patient change

This commit is contained in:
Rucha Mahabal 2021-01-22 08:52:17 +05:30
parent 004e51ed9f
commit ded08245cc
2 changed files with 6 additions and 1 deletions

View File

@ -10,7 +10,7 @@
<div id="chart" class="col-sm-12 patient_vital_charts"> <div id="chart" class="col-sm-12 patient_vital_charts">
</div> </div>
</div> </div>
<div class="col-sm-12 d-flex border-bottom py-3"></div> <div class="header-separator col-sm-12 d-flex border-bottom py-3" style="display:none"></div>
<div class="row"> <div class="row">
<div class="col-sm-12 d-flex"> <div class="col-sm-12 d-flex">
<div class="patient-history-filter doctype-filter"></div> <div class="patient-history-filter doctype-filter"></div>

View File

@ -10,6 +10,7 @@ frappe.pages['patient_history'].on_page_load = function(wrapper) {
frappe.breadcrumbs.add('Healthcare'); frappe.breadcrumbs.add('Healthcare');
let pid = ''; let pid = '';
page.main.html(frappe.render_template('patient_history', {})); page.main.html(frappe.render_template('patient_history', {}));
page.main.find('.header-separator').hide();
let patient = frappe.ui.form.make_control({ let patient = frappe.ui.form.make_control({
parent: page.main.find('.patient'), parent: page.main.find('.patient'),
@ -96,6 +97,7 @@ frappe.pages['patient_history'].on_page_load = function(wrapper) {
}; };
let setup_filters = function(patient, me) { let setup_filters = function(patient, me) {
$('.doctype-filter').empty();
frappe.xcall( frappe.xcall(
'erpnext.healthcare.page.patient_history.patient_history.get_patient_history_doctypes' 'erpnext.healthcare.page.patient_history.patient_history.get_patient_history_doctypes'
).then(document_types => { ).then(document_types => {
@ -123,6 +125,7 @@ let setup_filters = function(patient, me) {
}); });
doctype_filter.refresh(); doctype_filter.refresh();
$('.date-filter').empty();
let date_range_field = frappe.ui.form.make_control({ let date_range_field = frappe.ui.form.make_control({
df: { df: {
fieldtype: 'DateRange', fieldtype: 'DateRange',
@ -389,9 +392,11 @@ let show_patient_vital_charts = function(patient, me, btn_show_id, pts, title) {
formatTooltipY: d => d + ' ' + pts, formatTooltipY: d => d + ' ' + pts,
} }
}); });
me.page.main.find('.header-separator').show();
} else { } else {
me.page.main.find('.patient_vital_charts').html(''); me.page.main.find('.patient_vital_charts').html('');
me.page.main.find('.show_chart_btns').html(''); me.page.main.find('.show_chart_btns').html('');
me.page.main.find('.header-separator').hide();
} }
} }
}); });