Skip to content

Commit

Permalink
Merge pull request #137 from hraza01/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
NagariaHussain authored Nov 8, 2023
2 parents 3899606 + e640ef1 commit 3d8a6d6
Show file tree
Hide file tree
Showing 22 changed files with 892 additions and 2 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2023, [email protected] and contributors
// For license information, please see license.txt

// frappe.ui.form.on("Care Centre", {
// refresh(frm) {

// },
// });
172 changes: 172 additions & 0 deletions changemakers/frappe_changemakers/doctype/care_centre/care_centre.json
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
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2023, [email protected] 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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2023, [email protected] and Contributors
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase


class TestCareCentre(FrappeTestCase):
pass
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2023, [email protected] and contributors
// For license information, please see license.txt

// frappe.ui.form.on("Care Centre Admission", {
// refresh(frm) {

// },
// });
Loading

0 comments on commit 3d8a6d6

Please sign in to comment.