Skip to content

Commit

Permalink
fix(Sample Collection): hide/show sample details section based on chi…
Browse files Browse the repository at this point in the history
…ldtable length
  • Loading branch information
aibelshajan authored and akashkrishna619 committed Mar 19, 2024
1 parent 87af4a4 commit 2b641dd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ frappe.ui.form.on('Sample Collection', {
})
},
refresh: function(frm) {
var sample_table = frm.doc.observation_sample_collection;
let value = sample_table && sample_table.length > 0;
frm.set_df_property("sample_details_section", "hidden", value);

frm.fields_dict.observation_sample_collection.grid.add_custom_button(__("Mark Collected"), () => {
selected_child = frm.fields_dict.observation_sample_collection.grid.get_selected_children()
if (selected_child.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"inpatient_record",
"collection_point",
"invoiced",
"section_break_6",
"sample_details_section",
"sample",
"sample_uom",
"sample_qty",
Expand All @@ -37,7 +37,8 @@
"section_break_put4",
"service_request",
"reference_doc",
"reference_name"
"reference_name",
"amended_from"
],
"fields": [
{
Expand Down Expand Up @@ -123,14 +124,6 @@
"options": "Company",
"read_only_depends_on": "eval:[\"Partly Collected\", \"Collected\"].includes(doc.status);"
},
{
"depends_on": "!doc.observation_sample_collection",
"fieldname": "section_break_6",
"fieldtype": "Section Break",
"hide_days": 1,
"hide_seconds": 1,
"label": "Sample Details"
},
{
"fieldname": "sample",
"fieldtype": "Link",
Expand Down Expand Up @@ -286,6 +279,22 @@
"label": "Referring Practitioner",
"options": "Healthcare Practitioner",
"read_only_depends_on": "referring_practitioner"
},
{
"fieldname": "sample_details_section",
"fieldtype": "Section Break",
"hide_days": 1,
"hide_seconds": 1,
"label": "Sample Details"
},
{
"fieldname": "amended_from",
"fieldtype": "Link",
"label": "Amended From",
"no_copy": 1,
"options": "Sample Collection",
"print_hide": 1,
"read_only": 1
}
],
"is_submittable": 1,
Expand All @@ -295,7 +304,7 @@
"link_fieldname": "sample_collection"
}
],
"modified": "2023-10-13 06:57:29.989715",
"modified": "2024-03-19 15:33:50.056780",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Sample Collection",
Expand Down

0 comments on commit 2b641dd

Please sign in to comment.