Doctor-profile

This commit is contained in:
Sayan Das 2026-03-31 18:51:28 +05:30
parent ecee841fbc
commit 3f7b30565d
3 changed files with 202 additions and 0 deletions

View File

@ -0,0 +1,46 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class DoctorModel extends Model
{
protected $table = 'doctors';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['user_id','specialization','experience','fees','available_from','available_to'];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = false;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
}

View File

@ -0,0 +1,77 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Doctor Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="<?= base_url('css/app.css') ?>">
</head>
<body class="app-body app-page--doctor">
<div class="container py-5">
<h2 class="text-center mb-4 app-heading">Doctor dashboard</h2>
<p class="text-center mb-4">
<a href="<?= base_url('doctor/profile') ?>" class="btn btn-outline-primary btn-sm rounded-pill px-3">Edit profile</a>
</p>
<?php if (session()->getFlashdata('success')): ?>
<div class="alert alert-success app-alert text-center"><?= esc(session()->getFlashdata('success')) ?></div>
<?php endif; ?>
<?php if (session()->getFlashdata('error')): ?>
<div class="alert alert-danger app-alert text-center"><?= esc(session()->getFlashdata('error')) ?></div>
<?php endif; ?>
<div class="row">
<?php foreach ($appointments as $a): ?>
<div class="col-md-6 mb-4">
<div class="card app-card-dashboard p-4">
<h5 class="mb-2">👤 <?= esc($a->patient_name) ?></h5>
<p class="mb-1 small text-muted">📅 <?= esc($a->appointment_date) ?></p>
<p class="mb-3 small text-muted"> <?= esc($a->appointment_time) ?></p>
<p class="mb-3">
<span class="badge
<?= $a->status == 'pending' ? 'bg-warning text-dark' : '' ?>
<?= $a->status == 'approved' ? 'bg-success' : '' ?>
<?= $a->status == 'rejected' ? 'bg-danger' : '' ?>">
<?= esc(ucfirst((string) $a->status)) ?>
</span>
</p>
<div class="d-flex gap-2 flex-wrap">
<form method="post" action="<?= base_url('doctor/appointment/' . $a->id . '/accept') ?>" class="d-inline">
<?= csrf_field() ?>
<button type="submit" class="btn btn-success btn-sm rounded-pill px-3">Accept</button>
</form>
<form method="post" action="<?= base_url('doctor/appointment/' . $a->id . '/reject') ?>" class="d-inline">
<?= csrf_field() ?>
<button type="submit" class="btn btn-outline-danger btn-sm rounded-pill px-3">Reject</button>
</form>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php if (empty($appointments)): ?>
<p class="text-center text-muted">No appointments yet.</p>
<?php endif; ?>
<div class="text-center mt-4">
<a href="<?= base_url('logout') ?>" class="btn btn-outline-danger btn-sm rounded-pill px-4">Logout</a>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,79 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Doctor profile</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="<?= base_url('css/app.css') ?>">
</head>
<body class="app-body app-page--doctor">
<?php $validationErrors = validation_errors(); ?>
<div class="container py-5" style="max-width: 560px;">
<h2 class="text-center mb-4 app-heading">Your profile</h2>
<?php if (session()->getFlashdata('success')): ?>
<div class="alert alert-success app-alert text-center"><?= esc(session()->getFlashdata('success')) ?></div>
<?php endif; ?>
<?php if (session()->getFlashdata('error')): ?>
<div class="alert alert-danger app-alert text-center"><?= esc(session()->getFlashdata('error')) ?></div>
<?php endif; ?>
<form method="post" action="<?= base_url('doctor/profile') ?>" class="app-form card app-card-dashboard p-4">
<?= csrf_field() ?>
<div class="mb-3">
<label class="form-label" for="specialization">Specialization</label>
<input type="text" name="specialization" id="specialization"
value="<?= esc(old('specialization', $doctor['specialization'] ?? '')) ?>"
class="form-control <?= isset($validationErrors['specialization']) ? 'is-invalid' : '' ?>"placeholder="e.g. Cardiology">
<?= validation_show_error('specialization') ?>
</div>
<div class="mb-3">
<label class="form-label" for="experience">Experience</label>
<input type="text" name="experience" id="experience"
value="<?= esc(old('experience', $doctor['experience'] ?? '')) ?>"
class="form-control <?= isset($validationErrors['experience']) ? 'is-invalid' : '' ?>"placeholder="e.g. 10 years">
<?= validation_show_error('experience') ?>
</div>
<div class="mb-3">
<label class="form-label" for="fees">Consultation fee</label>
<input type="text" name="fees" id="fees"
value="<?= esc(old('fees', $doctor['fees'] ?? '')) ?>"
class="form-control <?= isset($validationErrors['fees']) ? 'is-invalid' : '' ?>"
placeholder="e.g. 500.00">
<?= validation_show_error('fees') ?>
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label" for="available_from">Available from</label>
<input type="time" name="available_from" id="available_from"
value="<?= esc(old('available_from', $doctor['available_from'] ?? '')) ?>"
class="form-control <?= isset($validationErrors['available_from']) ? 'is-invalid' : '' ?>">
<?= validation_show_error('available_from') ?>
</div>
<div class="col-md-6 mb-3">
<label class="form-label" for="available_to">Available to</label>
<input type="time" name="available_to" id="available_to"
value="<?= esc(old('available_to', $doctor['available_to'] ?? '')) ?>"
class="form-control <?= isset($validationErrors['available_to']) ? 'is-invalid' : '' ?>">
<?= validation_show_error('available_to') ?>
</div>
</div>
<div class="d-flex flex-wrap gap-2 justify-content-between mt-4">
<a href="<?= base_url('doctor/dashboard') ?>" class="btn btn-outline-secondary rounded-pill px-4">Back</a>
<button type="submit" class="btn btn-app-primary px-4">Save changes</button>
</div>
</form>
</div>
</body>
</html>