Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions doctor/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
from doctor.models import Doctor
from user.models import User

# Note:
# - Utilize Manager Object for doctor creation
# - Mixins for forms
# - Create a process for existing doctors, invite link or direct invite


class BaseDoctorForm(forms.ModelForm):
GENDER_TYPES = [
Expand All @@ -23,8 +18,18 @@ class BaseDoctorForm(forms.ModelForm):
registration_number = forms.CharField(label="PRC License No.", max_length=55)
specialization = forms.CharField(max_length=55)

def __init__(self, *args, **kwargs):
instance = kwargs.get("instance")
if instance:
self.base_fields["email"].required = False

super().__init__(*args, **kwargs)

def clean_mobile(self):
mobile = str(self.cleaned_data.get("mobile")).strip()
if self.instance.pk:
return mobile

pattern = r"^((\+?63)|0|9)(9\d{9})$"
if not re.match(pattern, mobile):
self.add_error(field="mobile", error="Use a Philippine Mobile Number ex. (09123456789 or +639123456789)")
Expand All @@ -34,10 +39,10 @@ def clean_mobile(self):
def save(self, commit=True):
user: User = super().save()
doctor = Doctor.objects.get_or_create(user=user)[0]
doctor.gender = self.cleaned_data["gender"]
doctor.registration_number = self.cleaned_data["registration_number"]
doctor.experience_years = self.cleaned_data["experience_years"]
doctor.specialization = self.cleaned_data["specialization"]
doctor.gender = self.cleaned_data.get("gender")
doctor.registration_number = self.cleaned_data.get("registration_number")
doctor.experience_years = self.cleaned_data.get("experience_years")
doctor.specialization = self.cleaned_data.get("specialization")
doctor.save()

return doctor
Expand Down
3 changes: 3 additions & 0 deletions doctor/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ def generate_doctor_code():

user = models.OneToOneField("user.user", related_name="doctor", on_delete=models.CASCADE)

def __str__(self):
return f"Doctor [{self.user.get_full_name()}]"

class Meta:
ordering = ["-pk"]
verbose_name = "Doctor"
13 changes: 13 additions & 0 deletions doctor/templates/doctor/components/base/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div id="kt_app_header" class="app-header" data-kt-sticky="true" data-kt-sticky-activate-="true" data-kt-sticky-name="app-header-sticky" data-kt-sticky-offset="{default: '50px', lg: '150px'}">
<div class="app-container container-xxl d-flex align-items-stretch justify-content-between" id="kt_app_header_container">
<div class="app-header-wrapper d-flex flex-grow-1 align-items-stretch justify-content-between" id="kt_app_header_wrapper">
<div class="app-header-logo d-flex flex-shrink-0 align-items-center justify-content-between justify-content-lg-center">
<button class="btn btn-icon btn-color-gray-600 btn-active-color-primary ms-n3 me-2 d-flex d-lg-none" id="kt_app_sidebar_toggle">
<i class="bi bi-list fs-2"></i>
</button>
<span class="fs-1 fw-bold">Apollo</span>
</div>
{% include 'patient/components/base/navbar.html'%}
</div>
</div>
</div>
35 changes: 35 additions & 0 deletions doctor/templates/doctor/components/base/navbar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<div class="app-navbar flex-shrink-0">
<div class="app-navbar-item ms-3 ms-lg-5" id="kt_header_user_menu_toggle">
<div class="cursor-pointer" data-kt-menu-trigger="{default: 'click', lg: 'hover'}" data-kt-menu-attach="parent"
data-kt-menu-placement="bottom-end">
<span class="d-flex align-items-center">
<span class="d-none d-lg-block fw-bold">
Welcome, {{ user.first_name }}!
</span>
<i class="bi bi-person-circle ms-2 fs-1"></i>
</span>
</div>
<div
class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-gray-800 menu-state-bg menu-state-color fw-semibold py-4 fs-6 w-275px"
data-kt-menu="true" style>
<div class="menu-item px-3">
<div class="menu-content d-flex align-items-center px-3">
<div class="d-flex flex-column">
<div class="fw-bold d-flex align-items-center fs-5"> {{ user.get_full_name }} </div>
<a href="#" class="fw-semibold text-muted text-hover-primary fs-7">{{ user.email }}</a>
</div>
</div>
</div>
<div class="separator my-2"></div>
<div class="menu-item px-5 my-1">
<a href="#" class="menu-link px-5">Account Settings</a>
</div>
<div class="menu-item px-5">
<a href="{% url 'user:selection' %}" class="menu-link px-5">Switch Account</a>
</div>
<div class="menu-item px-5">
<a href="{% url 'account_logout' %}" class="menu-link px-5">Sign Out</a>
</div>
</div>
</div>
</div>
47 changes: 47 additions & 0 deletions doctor/templates/doctor/components/base/sidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<aside id="default-sidebar" class="fixed top-0 left-0 z-40 w-64 h-screen shadow-xl" aria-label="Sidebar">
<div class="h-full px-3 py-4 overflow-y-auto bg-gray-50 dark:bg-gray-800">
<div class="mb-5">
<span class="font-bold">Profile Completion</span>
<div class="w-full bg-primary rounded mt-2">
<div class="bg-info rounded">
<div class="flex align-center justify-center">
<span class="text-white ml-3">100%</span>
</div>
</div>
</div>
</div>
<ul class="space-y-2 font-medium">
<li>
<a href="#" class="flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700 group text-xl">
<i class="bi bi-arrow-left-right"></i>
<span class="ms-3">Referral Tracker</span>
</a>
</li>
<li>
<a href="#" class="flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700 group text-xl">
<i class="bi bi-heart-pulse"></i>
<span class="ms-3">Your Patients</span>
</a>
</li>
<li>
<a href="#" class="flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700 group text-xl">
<i class="bi bi-person-heart"></i>
<span class="ms-3">Your Facilities</span>
</a>
</li>
<hr>
<li>
<a href="{% url 'user:selection' %}" class="flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700 group text-xl">
<i class="bi bi-shuffle"></i>
<span class="ms-3">Switch Account</span>
</a>
</li>
<li>
<a href="{% url 'account_logout' %}" class="flex items-center p-2 text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700 group text-xl">
<i class="bi bi-box-arrow-right"></i>
<span class="ms-3">Log Out</span>
</a>
</li>
</ul>
</div>
</aside>
40 changes: 6 additions & 34 deletions doctor/templates/doctor/index.html
Original file line number Diff line number Diff line change
@@ -1,36 +1,8 @@
{% extends 'layout/master.html' %}
{% extends 'theme/base.html' %}

{% block layout %}
<!--begin::Root-->
<div class="d-flex flex-column flex-root" id="kt_app_root">
<!--begin::Page-->
<div class="app-page flex-column flex-column-fluid" id="kt_app_page">
{% include 'doctor/partials/header.html' %}
<!--begin::Wrapper-->
<div class="app-wrapper flex-column flex-row-fluid" id="kt_app_wrapper">
{% include 'doctor/partials/sidebar.html' %}
<!--begin::Main-->
<div class="app-main flex-column flex-row-fluid" id="kt_app_main">
<!--begin::Content wrapper-->
<div class="d-flex flex-column flex-column-fluid">
<!--begin::Content-->
<div id="kt_app_content" class="app-content flex-column-fluid">
<!--begin::Content container-->
<div id="kt_app_content_container" class="app-container container-fluid">
{% block content %} {% endblock content %}
</div>
<!--end::Content container-->
</div>
<!--end::Content-->
</div>
<!--end::Content wrapper-->
</div>
<!--end:::Main-->
</div>
<!--end::Wrapper-->
</div>
<!--end::Page-->
{% block content %}
<div class="p-4 sm:ml-64">
{% include 'doctor/components/base/sidebar.html' %}
{% block main %} {% endblock %}
</div>
<!--end::Root-->

{% endblock layout %}
{% endblock %}
43 changes: 14 additions & 29 deletions doctor/templates/doctor/pages/dashboard.html
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@
{% extends 'doctor/index.html' %}
{% extends "doctor/index.html" %}

{% block content %}
<div id="kt_app_toolbar" class="app-toolbar py-3 py-lg-6">
<div id="kt_app_toolbar_container" class="app-container container-fluid d-flex flex-stack">
<div class="page-title d-flex flex-column justify-content-center flex-wrap me-3">
<h1 class="page-heading d-flex text-dark fw-bold fs-3 flex-column justify-content-center my-0">Doctor Dashboard</h1>
<ul class="breadcrumb breadcrumb-separatorless fw-semibold fs-7 my-0 pt-1">
<li class="breadcrumb-item text-muted">
<a href="#" class="text-muted text-hover-primary">Medsync</a>
</li>
<li class="breadcrumb-item">
<span class="bullet bg-gray-400 w-5px h-2px"></span>
</li>
<li class="breadcrumb-item text-muted">Doctor's Dashboard</li>
</ul>
</div>
</div>
</div>
<div id="kt_app_content" class="app-content flex-column-fluid">
<div id="kt_app_content_container" class="app-container container-fluid">
<div class="row mt-10">
<div class="col-12">
<p class="lead">
Welcome <strong> {{ user.get_full_name }}</strong> and you're currently signed in
under the email <strong>{{ user.email }}</strong>. <br>
Navigate through the Apollo system using the bar on the left-hand side of the browser.
</p>
</div>
</div>
{% load static %}

{% block main %}
<div class="px-10 pt-10 pb-6">
<div class="flex items-center justify-between mb-8">
<h1 class="flex-row">
<div class="fw-light">Welcome back, <b>{{ user.first_name }}</b></div>
<div class=" font-extralight">Medsync Doctor Account</div>
</h1>
<a href="#" class="btn btn-primary">
<i class="bi-send-fill mr-2"></i>
Send a referral
</a>
</div>
</div>
{% endblock %}
22 changes: 0 additions & 22 deletions doctor/templates/doctor/pages/facilities.html

This file was deleted.

22 changes: 0 additions & 22 deletions doctor/templates/doctor/pages/patients.html

This file was deleted.

22 changes: 0 additions & 22 deletions doctor/templates/doctor/pages/referrals.html

This file was deleted.

21 changes: 0 additions & 21 deletions doctor/templates/doctor/partials/header.html

This file was deleted.

Loading