2024-02-26 13:28:32 +05:30
|
|
|
{% extends 'base_structure/layout/base_template.html' %}
|
|
|
|
|
{% load static %}
|
|
|
|
|
{% block stylesheet %}
|
|
|
|
|
<!-- include required css cdn link through html here -->
|
|
|
|
|
|
|
|
|
|
{% include "cdn_through_html/datatable_cdn_css.html" %}
|
|
|
|
|
{% include "cdn_through_html/animate_cdn_css.html" %}
|
|
|
|
|
{% include "cdn_through_html/modal_cdn_css.html" %}
|
|
|
|
|
{% include "cdn_through_html/tabs_cdn_css.html" %}
|
|
|
|
|
{% include "cdn_through_html/switches_cdn_css.html" %}
|
|
|
|
|
{% include "cdn_through_html/sweetalert2_cdn_css.html" %}
|
|
|
|
|
|
2024-03-11 14:48:48 +05:30
|
|
|
<style>
|
|
|
|
|
.food-column {
|
|
|
|
|
background-color: #e0eff9;
|
|
|
|
|
height: 100%;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
2024-02-26 13:28:32 +05:30
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
|
|
|
|
|
|
<div class="row layout-top-spacing">
|
|
|
|
|
<div class="col-lg-12">
|
|
|
|
|
<div class="row mb-2">
|
|
|
|
|
<div class="col">
|
|
|
|
|
<h3>User Details</h3>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col text-end">
|
|
|
|
|
{% comment %} <button class="btn btn-dark mb-2 me-4" onclick="history.back()">
|
|
|
|
|
<i class="fa fa-arrow-left"></i>
|
|
|
|
|
Back
|
|
|
|
|
</button> {% endcomment %}
|
|
|
|
|
{% comment %} <a class="btn btn-success mb-2 me-4" href="{% url 'manage_cms:faq_category_add' %}">Add Category</a> {% endcomment %}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div id="tabsSimple" class="col-xl-12 col-12 layout-spacing">
|
|
|
|
|
<div class="statbox widget box box-shadow">
|
|
|
|
|
<div class="widget-content widget-content-area p-3">
|
|
|
|
|
<div class="simple-pill">
|
|
|
|
|
<ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">
|
|
|
|
|
<li class="nav-item" role="presentation">
|
|
|
|
|
<button class="nav-link active" id="pills-tab1-tab" data-bs-toggle="pill" data-bs-target="#pills-tab1" type="button" role="tab" aria-controls="pills-tab1" aria-selected="false">User</button>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="nav-item" role="presentation">
|
|
|
|
|
<button class="nav-link" id="pills-tab2-tab" data-bs-toggle="pill" data-bs-target="#pills-tab2" type="button" role="tab" aria-controls="pills-tab2" aria-selected="true">Activity</button>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="nav-item" role="presentation">
|
|
|
|
|
<button class="nav-link" id="pills-tab3-tab" data-bs-toggle="pill" data-bs-target="#pills-tab3" type="button" role="tab" aria-controls="pills-tab3" aria-selected="true">Report</button>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<div class="tab-content" id="pills-tabContent">
|
|
|
|
|
<div class="tab-pane fade active show" id="pills-tab1" role="tabpanel" aria-labelledby="pills-tab1-tab" tabindex="0">
|
|
|
|
|
<div class="row mt-5">
|
|
|
|
|
<div class="col-md-6">
|
|
|
|
|
<table class="w-100">
|
|
|
|
|
<tbody class="d-flex">
|
|
|
|
|
<tr class="w-25 d-flex flex-column">
|
|
|
|
|
<td><p>Name :</p></td>
|
|
|
|
|
<td><p>Email ID :</p></td>
|
|
|
|
|
<td><p>Gender :</p></td>
|
|
|
|
|
<td><p>DOB :</p></td>
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
|
<tr class=" d-flex flex-column">
|
|
|
|
|
<td><p>{{obj.first_name}}</p></td>
|
|
|
|
|
<td><p>{{obj.email}}</p></td>
|
|
|
|
|
<td><p>{{obj.gender}}</p></td>
|
|
|
|
|
<td><p>{{obj.date_of_birth}}</p></td>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-md-6 mb-10">
|
|
|
|
|
<table class="w-100">
|
|
|
|
|
<tbody class="d-flex">
|
|
|
|
|
<tr class="w-25 d-flex flex-column">
|
|
|
|
|
|
|
|
|
|
<td><p>Weigth:</p></td>
|
|
|
|
|
<td><p>Ethnicity:</p></td>
|
|
|
|
|
<td><p>Height:</p></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr class=" d-flex flex-column">
|
|
|
|
|
<td><p>{{obj.health_data_principal.weight}} kg</p></td>
|
|
|
|
|
<td><p>{{obj.health_data_principal.ethenicity}}</p></td>
|
|
|
|
|
<td><p>{{obj.health_data_principal.height}} cm</p></td>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<hr class="bdr-line">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-md-6 mb-3">
|
|
|
|
|
<p>How frequently do you eat in a day? </p>
|
|
|
|
|
<span>{{obj.health_data_principal.eat_frequency}}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-md-6 mb-3">
|
|
|
|
|
<p>How do you rate your overall gastrointestinal functions?</p>
|
|
|
|
|
<span>{{obj.health_data_principal.gastrointestinal_health}}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-md-6 mb-3">
|
|
|
|
|
<p>How much sleep do you take daily?</p>
|
|
|
|
|
<span>{{obj.health_data_principal.sleep_duration}}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-md-6 mb-3">
|
|
|
|
|
<p>How frequently do you engage in physical activities?</p>
|
|
|
|
|
<span>{{obj.health_data_principal.exercise_frequency}}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<hr class="bdr-line">
|
|
|
|
|
<div class="row d-flex justify-content-between">
|
|
|
|
|
<div class="card col-md-5 m-3 p-3 position-relative">
|
|
|
|
|
<div class="col-md-12 mb-3">
|
|
|
|
|
<p>User Intolerances?</p>
|
|
|
|
|
<span>{{ obj.intolerance_data.0.name }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-md-12 mb-3">
|
|
|
|
|
<p>For how long have you been experiencing this intolerance?</p>
|
|
|
|
|
<span>{{ obj.intolerance_data.0.duration }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<a class="view-more-link position-absolute top-0 end-0 m-2" href="{% url 'module_activity:intolerance' principal_id=obj.id %}">View more</a>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="card col-md-5 m-3 p-3 position-relative">
|
|
|
|
|
<div class="col-md-12 mb-3">
|
|
|
|
|
<p>User Symptoms?</p>
|
|
|
|
|
<span>{{ obj.symptoms_data.0.name }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-md-12 mb-3">
|
|
|
|
|
<p>For how long have you been experiencing these symptoms?</p>
|
|
|
|
|
<span>{{ obj.symptoms_data.0.duration }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<a class="view-more-link position-absolute top-0 end-0 m-2" href="{% url 'module_activity:symptoms' principal_id=obj.id %}">View more</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<hr class="bdr-line">
|
|
|
|
|
<div class="row d-flex justify-content-between">
|
|
|
|
|
<div class="card col-md-5 m-3 p-3 position-relative">
|
|
|
|
|
<div class="col-md-12 mb-3">
|
|
|
|
|
<p>User Past Treatment Name?</p>
|
|
|
|
|
<span>{{ obj.pasttreatment_data.0.name }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-md-12 mb-3">
|
|
|
|
|
<p>When did you undergo this treatment?</p>
|
|
|
|
|
<span>{{ obj.pasttreatment_data.0.duration }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<a class="view-more-link position-absolute top-0 end-0 m-2" href="{% url 'module_activity:past_treatment' principal_id=obj.id %}">View more</a>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="card col-md-5 m-3 p-3 position-relative">
|
|
|
|
|
<div class="col-md-12 mb-3">
|
|
|
|
|
<p>User Chronic conditions/diseases Name?</p>
|
|
|
|
|
<span>{{ obj.chronic_data.0 }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-md-12 mb-3">
|
|
|
|
|
<p>For how long have you been experiencing this diseases?</p>
|
|
|
|
|
<span>{{ obj.chronic_data.0 }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<a class="view-more-link position-absolute top-0 end-0 m-2" href="{% url 'module_activity:chronic_condition' principal_id=obj.id %}">View more</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="d-flex mb-5">
|
|
|
|
|
<a class="download-btn-custom mt-3" href="manage-users.php">
|
|
|
|
|
<span>Download user profile</span>
|
|
|
|
|
<img src="../src/assets/img/download.svg" />
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tab-pane fade" id="pills-tab2" role="tabpanel" aria-labelledby="pills-tab2-tab" tabindex="1">
|
|
|
|
|
<div class="row layout-spacing">
|
|
|
|
|
<div class="col-lg-12">
|
|
|
|
|
<div class="statbox widget box box-shadow">
|
|
|
|
|
<div class="widget-content widget-content-area">
|
|
|
|
|
<div id="table_wrapper" class="dataTables_wrapper container-fluid dt-bootstrap4 no-footer">
|
|
|
|
|
|
|
|
|
|
<div class="table-responsive">
|
|
|
|
|
<table id="table" class="table style-3 dt-table-hover dataTable" role="grid"
|
|
|
|
|
aria-describedby="style-3_info">
|
|
|
|
|
|
|
|
|
|
<thead>
|
|
|
|
|
<tr role="row">
|
|
|
|
|
<th class="sorting_asc text-center" tabindex="0"
|
|
|
|
|
aria-controls="style-3" aria-sort="ascending"
|
|
|
|
|
style="width: 50.2656px;">#</th>
|
|
|
|
|
<th class="sorting text-center" tabindex="1" aria-controls="style-3"
|
|
|
|
|
colspan="1"
|
|
|
|
|
style="width: 44.2344px;">Time</th>
|
|
|
|
|
<th class="sorting text-center" tabindex="2" aria-controls="style-3"
|
|
|
|
|
colspan="1"
|
|
|
|
|
style="width: 44.2344px;">Meal</th>
|
|
|
|
|
<th class="sorting text-center" tabindex="3" aria-controls="style-3"
|
|
|
|
|
style="width: 79.7969px;">Medication</th>
|
|
|
|
|
<th class="sorting text-center" tabindex="4" aria-controls="style-3"
|
|
|
|
|
style="width: 79.7969px;">Bowel Movement</th>
|
|
|
|
|
<th class="sorting text-center" tabindex="5" aria-controls="style-3"
|
|
|
|
|
style="width: 79.7969px;">Symptoms</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tab-pane fade" id="pills-tab3" role="tabpanel" aria-labelledby="pills-tab3-tab" tabindex="2">
|
2024-03-11 14:48:48 +05:30
|
|
|
<div class="d-flex justify-content-sm-end justify-content-center mb-3">
|
|
|
|
|
<div class="dropdown">
|
|
|
|
|
<a class="dropdown-toggle btn btn-primary" href="#" role="button" id="dropdownMenuLink" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
|
|
|
Filter
|
|
|
|
|
</a>
|
|
|
|
|
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink" style="">
|
|
|
|
|
<a class="dropdown-item" href="javascript:void(0)" onclick="getReportData(7)">Last 7 days</a>
|
|
|
|
|
<a class="dropdown-item" href="javascript:void(0)" onclick="getReportData(20)">Last 20 days</a>
|
|
|
|
|
<a class="dropdown-item" href="javascript:void(0)" onclick="getReportData(40)">Last 40 days</a>
|
|
|
|
|
<a class="dropdown-item" href="javascript:void(0)" onclick="getReportData(60)">Last 60 days</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tab-content" id="pills-tab3Content">
|
|
|
|
|
</div>
|
2024-02-26 13:28:32 +05:30
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{% endblock content %}
|
|
|
|
|
|
|
|
|
|
{% block javascript %}
|
|
|
|
|
|
|
|
|
|
<!-- include required css cdn link through html here -->
|
|
|
|
|
|
|
|
|
|
{% include "cdn_through_html/datatable_cdn_js.html" %}
|
|
|
|
|
{% include "cdn_through_html/datatable_button_cdn_js.html" %}
|
|
|
|
|
{% include "cdn_through_html/sweetalert2_cdn_js.html" %}
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
// Define DataTable instance
|
|
|
|
|
var dataTableInstance
|
|
|
|
|
var mainUrl = "{% url 'module_activity:activity_list' principal_id=obj.id %}?date=2024-02-14";
|
|
|
|
|
var mealUrl = "{% url 'module_activity:meal_detail' pk=0 %}"
|
|
|
|
|
var medicationUrl = "{% url 'module_activity:medication_detail' pk=0 %}"
|
|
|
|
|
var bowelUrl = "{% url 'module_activity:bowel_detail' pk=0 %}"
|
|
|
|
|
var symptomUrl = "{% url 'module_activity:meal_symptom_detail' pk=0 %}"
|
2024-03-11 14:48:48 +05:30
|
|
|
var reportUrl = "{% url 'module_activity:report_data' principal_id=obj.id %}?date_range=7"
|
|
|
|
|
|
2024-02-26 13:28:32 +05:30
|
|
|
// Entry point
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
|
|
|
|
|
dataTableInstance = initializeDataTable(dataTableInstance, mainUrl);
|
2024-03-11 14:48:48 +05:30
|
|
|
getReportData();
|
2024-02-26 13:28:32 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Function to initialize DataTable
|
|
|
|
|
function initializeDataTable(dataTableInstance, mainUrl) {
|
|
|
|
|
return $('#table').DataTable({
|
|
|
|
|
processing: true,
|
|
|
|
|
serverSide: true,
|
|
|
|
|
ajax: {
|
|
|
|
|
url: mainUrl,
|
|
|
|
|
type: "GET",
|
|
|
|
|
},
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
|
|
|
|
data: null,
|
|
|
|
|
className: "text-center",
|
|
|
|
|
render: function(data, type, row, meta) {
|
|
|
|
|
// Calculate sequence number based on page, page length, and index
|
|
|
|
|
var sequenceNumber = meta.row + meta.settings._iDisplayStart + 1;
|
|
|
|
|
return sequenceNumber;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{ data: "time", className: "text-center" },
|
|
|
|
|
{
|
|
|
|
|
data: "type",
|
|
|
|
|
className: "text-center",
|
|
|
|
|
render: function(data, type, row){
|
|
|
|
|
if (data ==="Meal"){
|
|
|
|
|
return '<a href="' + mealUrl.replace('0', row.id) +'" class="view-more">View More</a>';
|
|
|
|
|
}else{
|
|
|
|
|
return "--"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
data: "type",
|
|
|
|
|
className: "text-center",
|
|
|
|
|
render: function(data, type, row){
|
|
|
|
|
if (data ==="Medication"){
|
|
|
|
|
return '<a href="' + medicationUrl.replace('0', row.id) +'" class="view-more">View More</a>';
|
|
|
|
|
}else{
|
|
|
|
|
return "--"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
data: "type",
|
|
|
|
|
className: "text-center",
|
|
|
|
|
render: function(data, type, row){
|
|
|
|
|
if (data ==="Bowel"){
|
|
|
|
|
return '<a href="' + bowelUrl.replace('0', row.id) + '" class="view-more">View More</a>';
|
|
|
|
|
}else{
|
|
|
|
|
return "--"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
data: "type",
|
|
|
|
|
className: "text-center",
|
|
|
|
|
render: function(data, type, row){
|
|
|
|
|
if (data ==="Symptom"){
|
|
|
|
|
return '<a href="' + symptomUrl.replace('0', row.id) + '" class="view-more">View More</a>';
|
|
|
|
|
}else{
|
|
|
|
|
return "--"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
dom: "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'B>>>" +
|
|
|
|
|
"<'table-responsive'tr>" +
|
|
|
|
|
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
|
|
|
|
|
buttons: [
|
|
|
|
|
{ text: 'View Archive List', className: "btn btn-dark " }
|
|
|
|
|
],
|
|
|
|
|
oLanguage: {
|
|
|
|
|
oPaginate: { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
|
|
|
|
|
sInfo: "Showing page _PAGE_ of _PAGES_",
|
|
|
|
|
sSearch: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
|
|
|
|
|
sSearchPlaceholder: "Search...",
|
|
|
|
|
sLengthMenu: " _MENU_",
|
|
|
|
|
},
|
|
|
|
|
stripeClasses: [],
|
|
|
|
|
lengthMenu: [5, 10, 20, 50],
|
|
|
|
|
pageLength: 10,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Function to reload the DataTable
|
|
|
|
|
function reloadDataTable() {
|
|
|
|
|
dataTableInstance.Datatable().ajax.reload();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-03-11 14:48:48 +05:30
|
|
|
function getReportData(timeRange){
|
|
|
|
|
var url = timeRange ? reportUrl.replace("7", timeRange) : reportUrl
|
|
|
|
|
$('#pills-tab3Content').empty()
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: url,
|
|
|
|
|
type: 'GET',
|
|
|
|
|
success: function(response) {
|
|
|
|
|
console.log("reposne is ", response);
|
|
|
|
|
if (response.status == 200){
|
|
|
|
|
setReportContent(response.data)
|
|
|
|
|
}
|
|
|
|
|
if (response.status == 204){
|
|
|
|
|
console.log(response.message)
|
|
|
|
|
const errorCard = $('<div class="card card-danger text-center mt-3 p-4 tab-pane-content"></div>');
|
|
|
|
|
const title = $('<h5 class="mb-3"></h5>').text('Error');
|
|
|
|
|
const message = $('<p></p>').text(response.message);
|
|
|
|
|
|
|
|
|
|
errorCard.append(title);
|
|
|
|
|
errorCard.append(message);
|
|
|
|
|
|
|
|
|
|
$('#pills-tab3Content').append(errorCard);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
error: function(response) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setReportContent(data) {
|
|
|
|
|
// Clear previous content
|
|
|
|
|
$('#pills-tab3Content').empty();
|
|
|
|
|
|
|
|
|
|
// Foods to Avoid and Bowel Report
|
|
|
|
|
if (data.food_avoid || data.highest_stool) {
|
|
|
|
|
const section = $('<div class="row tab-pane-content d-flex justify-content-center gap-5 mb-5"></div>');
|
|
|
|
|
|
|
|
|
|
if (data.food_avoid) {
|
|
|
|
|
createFoodToAvoid(section, data.food_avoid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.highest_stool) {
|
|
|
|
|
createBowelReport(section, data.highest_stool);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#pills-tab3Content').append(section);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const tableSection = $('<div class="row tab-pane-content"></div>');
|
|
|
|
|
// Same Foods to Avoid
|
|
|
|
|
if (data.same_food_avoid) {
|
|
|
|
|
createTable('Same Foods to Avoid', tableSection, data.same_food_avoid.food);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Meal Symptoms Recorded
|
|
|
|
|
if (data.symptoms_frequency) {
|
|
|
|
|
createTable('Meal Symptoms Recorded', tableSection, data.symptoms_frequency);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Recorded Stool Type
|
|
|
|
|
if (data.stool_type) {
|
|
|
|
|
createTable('Recorded Stool Type', tableSection, data.stool_type);
|
|
|
|
|
}
|
|
|
|
|
$('#pills-tab3Content').append(tableSection);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function createFoodToAvoid(parent, content) {
|
|
|
|
|
const col = $('<div class="col-md-3 tab-pane-content food-column text-center card d-flex flex-column justify-content-center align-items-center gap-4 py-4"><div class="h-100"></div></div>');
|
|
|
|
|
const title = $('<h5></h5>').text('Foods to Avoid');
|
|
|
|
|
const img = $('<img height="100" width="100">').attr('src', "{% static 'img/foods.png' %}");
|
|
|
|
|
const h4 = $('<h3></h4>').text(content);
|
|
|
|
|
const h6 = $('<h6></h6>').html(
|
|
|
|
|
'Based on the Symptoms added within the last 7 days, <b>' + content + '</b> should be avoided.'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
col.append(title);
|
|
|
|
|
col.append(img);
|
|
|
|
|
col.append(h4);
|
|
|
|
|
col.append(h6);
|
|
|
|
|
|
|
|
|
|
parent.append(col);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function createBowelReport(parent, content) {
|
|
|
|
|
const col = $('<div class="col-md-3 tab-pane-content food-column text-center card d-flex flex-column justify-content-center align-items-center gap-4 py-4"><div class="h-100"></div></div>');
|
|
|
|
|
const title = $('<h5></h5>').text('Bowel Report');
|
|
|
|
|
const img = $('<img height="100" width="100">').attr('src', "{% static 'img/bowel.png' %}");
|
|
|
|
|
const h4 = $('<h3></h4>').text(content);
|
|
|
|
|
const h6 = $('<h6></h6>').text('Your most recorded stool type is ' + content);
|
|
|
|
|
|
|
|
|
|
col.append(title);
|
|
|
|
|
col.append(img);
|
|
|
|
|
col.append(h4);
|
|
|
|
|
col.append(h6);
|
|
|
|
|
|
|
|
|
|
parent.append(col);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function createTable(title, parent, data) {
|
|
|
|
|
const col = $('<div class="col-md-4 tab-pane-content"></div>');
|
|
|
|
|
const table = $('<table class="table table-sm tab-pane-content mb-3"></table>');
|
|
|
|
|
const thead = $('<thead></thead>');
|
|
|
|
|
const tbody = $('<tbody></tbody>');
|
|
|
|
|
const headerRow = $('<tr></tr>');
|
|
|
|
|
const titleTh = $('<th colspan="2"></th>').text(title);
|
|
|
|
|
|
|
|
|
|
headerRow.append(titleTh);
|
|
|
|
|
thead.append(headerRow);
|
|
|
|
|
|
|
|
|
|
for (const [key, value] of Object.entries(data)) {
|
|
|
|
|
const row = $('<tr></tr>');
|
|
|
|
|
const keyTd = $('<td></td>').text(key);
|
|
|
|
|
const valueTd = $('<td></td>').text(value);
|
|
|
|
|
|
|
|
|
|
row.append(keyTd);
|
|
|
|
|
row.append(valueTd);
|
|
|
|
|
|
|
|
|
|
tbody.append(row);
|
|
|
|
|
}
|
|
|
|
|
col.append(table)
|
|
|
|
|
table.append(thead);
|
|
|
|
|
table.append(tbody);
|
|
|
|
|
|
|
|
|
|
parent.append(col)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-02-26 13:28:32 +05:30
|
|
|
</script>
|
|
|
|
|
{% endblock %}
|