修改显示logo
This commit is contained in:
parent
7f3816e2f9
commit
0a4d281e69
|
@ -0,0 +1,54 @@
|
||||||
|
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
|
class AppointmentSearch extends EA_Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* AppointmentSearch constructor.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
$this->load->model('users_model');
|
||||||
|
$this->load->model('appointments_model');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search appointments by phone number.
|
||||||
|
*/
|
||||||
|
public function search_by_phone(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$phone_number = request('phone_number', '');
|
||||||
|
|
||||||
|
if (empty($phone_number)) {
|
||||||
|
json_response([
|
||||||
|
'success' => false,
|
||||||
|
'message' => 'Phone number is required.'
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询ea_users表中id_roles为3的用户ID
|
||||||
|
$user = $this->users_model->get_user_by_phone($phone_number, 3);
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
json_response([
|
||||||
|
'success' => false,
|
||||||
|
'message' => 'No user found with this phone number.'
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用用户ID查询ea_appointments表中的记录
|
||||||
|
$appointments = $this->appointments_model->get_appointments_by_user_id($user->id);
|
||||||
|
|
||||||
|
json_response([
|
||||||
|
'success' => true,
|
||||||
|
'appointments' => $appointments
|
||||||
|
]);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
json_exception($e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -628,4 +628,12 @@ class Appointments_model extends EA_Model
|
||||||
|
|
||||||
$appointment = $decoded_request;
|
$appointment = $decoded_request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function get_appointments_by_user_id($user_id)
|
||||||
|
{
|
||||||
|
return $this->db->where('id_users_customer', $user_id)
|
||||||
|
->get('ea_appointments')
|
||||||
|
->result();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -430,4 +430,12 @@ class Users_model extends EA_Model
|
||||||
|
|
||||||
return $this->db->get_where('user_settings', ['username' => $username])->num_rows() === 0;
|
return $this->db->get_where('user_settings', ['username' => $username])->num_rows() === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function get_user_by_phone($phone_number, $role_id)
|
||||||
|
{
|
||||||
|
return $this->db->where('phone', $phone_number)
|
||||||
|
->where('id_roles', $role_id)
|
||||||
|
->get('ea_users')
|
||||||
|
->row();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,10 @@
|
||||||
|
|
||||||
<div id="frame-footer">
|
<div id="frame-footer">
|
||||||
<small>
|
<small>
|
||||||
|
|
||||||
<span class="footer-powered-by small">
|
<span class="footer-powered-by small">
|
||||||
|
<img style="height: 16px; margin: 3px;" src="<?= base_url('assets/img/logo-16x16.png') ?>" alt="TFE Group Logo">
|
||||||
|
|
||||||
Powered By
|
Powered By
|
||||||
<a href="https://www.tfe.com.hk/" target="_blank">TFE Group</a>
|
<a href="https://www.tfe.com.hk/" target="_blank">TFE Group</a>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
<div class="d-flex justify-content-center justify-content-md-start">
|
<div class="d-flex justify-content-center justify-content-md-start">
|
||||||
<span class="display-selected-service me-1 pe-1">
|
<span class="display-selected-service me-1 pe-1">
|
||||||
香港現代中醫中藥協會
|
內科 | 婦科 | 兒科 | 中藥 | 針灸 | 跌打
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
<div class="d-flex justify-content-center justify-content-md-start">
|
<div class="d-flex justify-content-center justify-content-md-start">
|
||||||
<span class="display-selected-service me-1 pe-1">
|
<span class="display-selected-service me-1 pe-1">
|
||||||
香港現代中醫中藥協會
|
內科 | 婦科 | 兒科 | 中藥 | 針灸 | 跌打
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
<div class="d-flex justify-content-center justify-content-md-start">
|
<div class="d-flex justify-content-center justify-content-md-start">
|
||||||
<span class="display-selected-service me-1 pe-1">
|
<span class="display-selected-service me-1 pe-1">
|
||||||
香港現代中醫中藥協會
|
內科 | 婦科 | 兒科 | 中藥 | 針灸 | 跌打
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
<div class="d-flex justify-content-center justify-content-md-start">
|
<div class="d-flex justify-content-center justify-content-md-start">
|
||||||
<span class="display-selected-service me-1 pe-1">
|
<span class="display-selected-service me-1 pe-1">
|
||||||
香港現代中醫中藥協會
|
內科 | 婦科 | 兒科 | 中藥 | 針灸 | 跌打
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -148,18 +148,18 @@
|
||||||
<script>
|
<script>
|
||||||
document.getElementById('searchButton').addEventListener('click', function() {
|
document.getElementById('searchButton').addEventListener('click', function() {
|
||||||
var phoneNumber = document.getElementById('phoneNumber').value;
|
var phoneNumber = document.getElementById('phoneNumber').value;
|
||||||
|
|
||||||
if (phoneNumber.trim() === '') {
|
if (phoneNumber.trim() === '') {
|
||||||
alert('<?= lang('enter_valid_phone_number') ?>');
|
alert('<?= lang('enter_valid_phone_number') ?>');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch('/index.php/customers/search', {
|
fetch('/index.php/appointmentsearch/search_by_phone', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ keyword: phoneNumber })
|
body: JSON.stringify({ phone_number: phoneNumber })
|
||||||
})
|
})
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
@ -178,11 +178,12 @@
|
||||||
function displayAppointments(appointments) {
|
function displayAppointments(appointments) {
|
||||||
var appointmentsContainer = document.getElementById('appointmentsContainer');
|
var appointmentsContainer = document.getElementById('appointmentsContainer');
|
||||||
var appointmentsList = document.getElementById('appointmentsList');
|
var appointmentsList = document.getElementById('appointmentsList');
|
||||||
|
|
||||||
appointmentsList.innerHTML = '';
|
appointmentsList.innerHTML = '';
|
||||||
appointments.forEach(function(appointment) {
|
appointments.forEach(function(appointment) {
|
||||||
var listItem = document.createElement('li');
|
var listItem = document.createElement('li');
|
||||||
listItem.textContent = appointment.details; // 根据实际字段修改
|
// 根据实际返回的预约信息字段进行调整
|
||||||
|
listItem.textContent = `Appointment on ${appointment.start_datetime} with provider ID ${appointment.id_users_provider}`;
|
||||||
appointmentsList.appendChild(listItem);
|
appointmentsList.appendChild(listItem);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 129 KiB |
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
Loading…
Reference in New Issue