-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from hraza01/develop
- Loading branch information
Showing
22 changed files
with
892 additions
and
2 deletions.
There are no files selected for viewing
Empty file.
8 changes: 8 additions & 0 deletions
8
changemakers/frappe_changemakers/doctype/care_centre/care_centre.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright (c) 2023, hussain@frappe.io and contributors | ||
// For license information, please see license.txt | ||
|
||
// frappe.ui.form.on("Care Centre", { | ||
// refresh(frm) { | ||
|
||
// }, | ||
// }); |
172 changes: 172 additions & 0 deletions
172
changemakers/frappe_changemakers/doctype/care_centre/care_centre.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
{ | ||
"actions": [], | ||
"allow_rename": 1, | ||
"autoname": "field:facility_name", | ||
"creation": "2023-10-25 10:50:17.900084", | ||
"default_view": "List", | ||
"doctype": "DocType", | ||
"editable_grid": 1, | ||
"engine": "InnoDB", | ||
"field_order": [ | ||
"facility_name", | ||
"capacity", | ||
"location", | ||
"column_break_zkks", | ||
"organisation", | ||
"vacant_beds" | ||
], | ||
"fields": [ | ||
{ | ||
"fieldname": "facility_name", | ||
"fieldtype": "Data", | ||
"in_list_view": 1, | ||
"label": "Facility Name", | ||
"reqd": 1, | ||
"unique": 1 | ||
}, | ||
{ | ||
"fieldname": "capacity", | ||
"fieldtype": "Int", | ||
"in_list_view": 1, | ||
"label": "Capacity", | ||
"non_negative": 1, | ||
"reqd": 1 | ||
}, | ||
{ | ||
"fieldname": "location", | ||
"fieldtype": "Small Text", | ||
"label": "Location" | ||
}, | ||
{ | ||
"fieldname": "organisation", | ||
"fieldtype": "Link", | ||
"label": "Organisation", | ||
"options": "Organisation" | ||
}, | ||
{ | ||
"fieldname": "vacant_beds", | ||
"fieldtype": "Data", | ||
"is_virtual": 1, | ||
"label": "Vacant Beds" | ||
}, | ||
{ | ||
"fieldname": "column_break_zkks", | ||
"fieldtype": "Column Break" | ||
} | ||
], | ||
"index_web_pages_for_search": 1, | ||
"links": [ | ||
{ | ||
"link_doctype": "Care Centre Admission", | ||
"link_fieldname": "facility_name" | ||
} | ||
], | ||
"modified": "2023-10-27 17:41:48.472208", | ||
"modified_by": "Administrator", | ||
"module": "Frappe Changemakers", | ||
"name": "Care Centre", | ||
"naming_rule": "By fieldname", | ||
"owner": "Administrator", | ||
"permissions": [ | ||
{ | ||
"create": 1, | ||
"delete": 1, | ||
"email": 1, | ||
"export": 1, | ||
"print": 1, | ||
"read": 1, | ||
"report": 1, | ||
"role": "System Manager", | ||
"share": 1, | ||
"write": 1 | ||
}, | ||
{ | ||
"create": 1, | ||
"delete": 1, | ||
"email": 1, | ||
"export": 1, | ||
"print": 1, | ||
"read": 1, | ||
"report": 1, | ||
"role": "Admin (Partner)", | ||
"share": 1, | ||
"write": 1 | ||
}, | ||
{ | ||
"create": 1, | ||
"delete": 1, | ||
"email": 1, | ||
"export": 1, | ||
"print": 1, | ||
"read": 1, | ||
"report": 1, | ||
"role": "Partner SMT", | ||
"share": 1, | ||
"write": 1 | ||
}, | ||
{ | ||
"create": 1, | ||
"delete": 1, | ||
"email": 1, | ||
"export": 1, | ||
"print": 1, | ||
"read": 1, | ||
"report": 1, | ||
"role": "Social Worker", | ||
"share": 1, | ||
"write": 1 | ||
}, | ||
{ | ||
"create": 1, | ||
"delete": 1, | ||
"email": 1, | ||
"export": 1, | ||
"print": 1, | ||
"read": 1, | ||
"report": 1, | ||
"role": "Program Manager", | ||
"share": 1, | ||
"write": 1 | ||
}, | ||
{ | ||
"create": 1, | ||
"delete": 1, | ||
"email": 1, | ||
"export": 1, | ||
"print": 1, | ||
"read": 1, | ||
"report": 1, | ||
"role": "Healthcare Team Member", | ||
"share": 1, | ||
"write": 1 | ||
}, | ||
{ | ||
"create": 1, | ||
"delete": 1, | ||
"email": 1, | ||
"export": 1, | ||
"print": 1, | ||
"read": 1, | ||
"report": 1, | ||
"role": "SMT(NGO)-Field Co-ordinator", | ||
"share": 1, | ||
"write": 1 | ||
}, | ||
{ | ||
"create": 1, | ||
"delete": 1, | ||
"email": 1, | ||
"export": 1, | ||
"print": 1, | ||
"read": 1, | ||
"report": 1, | ||
"role": "Medical Co-ordinator", | ||
"share": 1, | ||
"write": 1 | ||
} | ||
], | ||
"sort_field": "modified", | ||
"sort_order": "DESC", | ||
"states": [], | ||
"track_changes": 1 | ||
} |
25 changes: 25 additions & 0 deletions
25
changemakers/frappe_changemakers/doctype/care_centre/care_centre.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright (c) 2023, hussain@frappe.io and contributors | ||
# For license information, please see license.txt | ||
|
||
import frappe | ||
from frappe.model.document import Document | ||
|
||
|
||
class CareCentre(Document): | ||
@property | ||
def vacant_beds(self): | ||
""" | ||
Calculating vacant beds in a care centre facility. | ||
:return: int or str if count is 0 | ||
""" | ||
filters = { | ||
"facility_name": self.facility_name, | ||
"status": ("in", ("Admitted", "Hospitalised")), | ||
"docstatus": 0, | ||
} | ||
occupants = frappe.get_all( | ||
"Care Centre Admission", filters=filters, fields=["name"], pluck="name" | ||
) | ||
|
||
vacant_beds = self.capacity - len(occupants) | ||
return vacant_beds if vacant_beds > 0 else str(0) |
9 changes: 9 additions & 0 deletions
9
changemakers/frappe_changemakers/doctype/care_centre/test_care_centre.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright (c) 2023, hussain@frappe.io and Contributors | ||
# See license.txt | ||
|
||
# import frappe | ||
from frappe.tests.utils import FrappeTestCase | ||
|
||
|
||
class TestCareCentre(FrappeTestCase): | ||
pass |
Empty file.
8 changes: 8 additions & 0 deletions
8
changemakers/frappe_changemakers/doctype/care_centre_admission/care_centre_admission.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright (c) 2023, hussain@frappe.io and contributors | ||
// For license information, please see license.txt | ||
|
||
// frappe.ui.form.on("Care Centre Admission", { | ||
// refresh(frm) { | ||
|
||
// }, | ||
// }); |
Oops, something went wrong.