Provider and secretary users can only add unavailabilities for their authorized users (#1214)
This commit is contained in:
parent
cc697fc09e
commit
617222ae2a
2 changed files with 11 additions and 3 deletions
|
@ -85,12 +85,22 @@ class Backend extends EA_Controller {
|
||||||
{
|
{
|
||||||
$secretary = $this->secretaries_model->get_row($this->session->userdata('user_id'));
|
$secretary = $this->secretaries_model->get_row($this->session->userdata('user_id'));
|
||||||
$view['secretary_providers'] = $secretary['providers'];
|
$view['secretary_providers'] = $secretary['providers'];
|
||||||
|
$view['available_providers'] = array_values(array_filter($view['available_providers'], function ($available_provider) use ($secretary) {
|
||||||
|
return in_array($available_provider['id'], $secretary['providers']);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$view['secretary_providers'] = [];
|
$view['secretary_providers'] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->session->userdata('role_slug') === DB_SLUG_PROVIDER)
|
||||||
|
{
|
||||||
|
$view['available_providers'] = array_values(array_filter($view['available_providers'], function ($available_provider) use ($user_id) {
|
||||||
|
return $available_provider['id'] === $user_id;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
$results = $this->appointments_model->get_batch(['hash' => $appointment_hash]);
|
$results = $this->appointments_model->get_batch(['hash' => $appointment_hash]);
|
||||||
|
|
||||||
if ($appointment_hash !== '' && count($results) > 0)
|
if ($appointment_hash !== '' && count($results) > 0)
|
||||||
|
|
|
@ -110,9 +110,7 @@ window.BackendCalendarUnavailabilityEventsModal = window.BackendCalendarUnavaila
|
||||||
|
|
||||||
if ($('.calendar-view').length === 0) {
|
if ($('.calendar-view').length === 0) {
|
||||||
$dialog.find('#unavailable-provider')
|
$dialog.find('#unavailable-provider')
|
||||||
.val($('#select-filter-item').val())
|
.val($('#select-filter-item').val());
|
||||||
.closest('.form-group')
|
|
||||||
.hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$dialog.find('#unavailable-start').val(GeneralFunctions.formatDate(start, GlobalVariables.dateFormat, true));
|
$dialog.find('#unavailable-start').val(GeneralFunctions.formatDate(start, GlobalVariables.dateFormat, true));
|
||||||
|
|
Loading…
Reference in a new issue