Integrated location field in the backend section.

This commit is contained in:
alext 2019-06-08 16:43:21 +02:00
parent 6f39a99734
commit 84afca8b26
30 changed files with 70 additions and 11 deletions

View File

@ -479,15 +479,37 @@ class Appointments extends CI_Controller {
$customer['id'] = $this->customers_model->find_record_id($customer);
}
$provider = $this->providers_model->get_row($appointment['id_users_provider']);
$service = $this->services_model->get_row($appointment['id_services']);
if (empty($appointment['location'])) {
$location = [];
if (!empty($provider['address'])) {
$location[] = $provider['address'];
}
if (!empty($provider['city'])) {
$location[] = $provider['city'];
}
if (!empty($provider['state'])) {
$location[] = $provider['state'];
}
if (!empty($provider['zip_code'])) {
$location[] = $provider['zip_code'];
}
$appointment['location'] = implode(', ', $location);
}
$customer_id = $this->customers_model->add($customer);
$appointment['id_users_customer'] = $customer_id;
$appointment['is_unavailable'] = (int)$appointment['is_unavailable']; // needs to be type casted
$appointment['id'] = $this->appointments_model->add($appointment);
$appointment['hash'] = $this->appointments_model->get_value('hash', $appointment['id']);
$provider = $this->providers_model->get_row($appointment['id_users_provider']);
$service = $this->services_model->get_row($appointment['id_services']);
$company_settings = [
'company_name' => $this->settings_model->get_setting('company_name'),
'company_link' => $this->settings_model->get_setting('company_link'),

View File

@ -190,7 +190,8 @@ class Google extends CI_Controller {
$event_start = strtotime($google_event->getStart()->getDateTime());
$event_end = strtotime($google_event->getEnd()->getDateTime());
if ($appt_start != $event_start || $appt_end != $event_end)
if ($appt_start != $event_start || $appt_end != $event_end
|| $appointment['notes'] !== $google_event->getDescription())
{
$is_different = TRUE;
}
@ -199,6 +200,7 @@ class Google extends CI_Controller {
{
$appointment['start_datetime'] = date('Y-m-d H:i:s', $event_start);
$appointment['end_datetime'] = date('Y-m-d H:i:s', $event_end);
$appointment['notes'] = $google_event->getDescription();
$this->appointments_model->add($appointment);
}
@ -226,6 +228,7 @@ class Google extends CI_Controller {
'start_datetime' => date('Y-m-d H:i:s', strtotime($event->start->getDateTime())),
'end_datetime' => date('Y-m-d H:i:s', strtotime($event->end->getDateTime())),
'is_unavailable' => TRUE,
'location' => $event->getLocation(),
'notes' => $event->getSummary() . ' ' . $event->getDescription(),
'id_users_provider' => $provider_id,
'id_google_calendar' => $event->getId(),

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'J\'ai lu, compris et accepte la {$l
$lang['delete_personal_information_hint'] = 'Effacer toutes vos données personnelles du système.';
$lang['delete_personal_information'] = 'Effacer toutes mes données personnelles';
$lang['delete_personal_information_prompt'] = 'Etes-vous sûr(e) de vouloir effacer toutes vos données personnelles ? Cette action est irréversible.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'Ich habe die {$link}Datenschutzerkl
$lang['delete_personal_information_hint'] = 'Alle persönlichen Informationen aus dem System löschen.';
$lang['delete_personal_information'] = 'Persönlichen Informationen löschen';
$lang['delete_personal_information_prompt'] = 'Sind Sie sicher, dass Sie Ihre persönlichen Daten löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.';
$lang['location'] = 'Ort';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'Διάβασα και αποδέχ
$lang['delete_personal_information_hint'] = 'Διαγραφή όλων των προσωπικών πληροφοριών από το σύστημα.';
$lang['delete_personal_information'] = 'Διαγραφή Προσωπικών Πληροφοριών';
$lang['delete_personal_information_prompt'] = 'Είστε σίγουρος ότι θέλετε να διαγράψετε τις προσωπικές σας πληροφορίες; Αυτή η ενέργεια δεν μπορεί να αναιρεθεί.';
$lang['location'] = 'Τοποθεσία';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -297,3 +297,4 @@ $lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link
$lang['delete_personal_information_hint'] = 'Delete all personal information from the system.';
$lang['delete_personal_information'] = 'Delete Personal Information';
$lang['delete_personal_information_prompt'] = 'Are you sure that you want to delete your personal information? This action cannot be undone.';
$lang['location'] = 'Location';

View File

@ -142,7 +142,8 @@ class Google_Sync {
$event = new Google_Event();
$event->setSummary(($service != NULL) ? $service['name'] : 'Unavailable');
$event->setLocation($company_settings['company_name']);
$event->setDescription($appointment['notes']);
$event->setLocation($appointment['location']);
$start = new Google_EventDateTime();
$start->setDateTime(date3339(strtotime($appointment['start_datetime'])));
@ -199,7 +200,8 @@ class Google_Sync {
$appointment['id_google_calendar']);
$event->setSummary($service['name']);
$event->setLocation($company_settings['company_name']);
$event->setDescription($appointment['notes']);
$event->setLocation($appointment['location']);
$start = new Google_EventDateTime();
$start->setDateTime(date3339(strtotime($appointment['start_datetime'])));

View File

@ -173,6 +173,11 @@
<label for="select-provider" class="control-label"><?= lang('provider') ?> *</label>
<select id="select-provider" class="required form-control"></select>
</div>
<div class="form-group">
<label for="appointment-location" class="control-label"><?= lang('location') ?></label>
<input id="appointment-location" class="form-control">
</div>
</div>
<div class="col-xs-12 col-sm-6">
@ -185,14 +190,10 @@
<label for="end-datetime" class="control-label"><?= lang('end_date_time') ?></label>
<input id="end-datetime" class="required form-control">
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6">
<div class="form-group">
<label for="appointment-notes" class="control-label"><?= lang('notes') ?></label>
<textarea id="appointment-notes" class="form-control" rows="2"></textarea>
<textarea id="appointment-notes" class="form-control" rows="1"></textarea>
</div>
</div>
</div>

View File

@ -424,6 +424,11 @@ body legend {
font-size: 12px;
}
#appointment-notes,
#customer-notes {
height: 37px; /* Align with location field */
}
body .form-horizontal .control-label {
width: 135px;
}

View File

@ -57,6 +57,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
id_users_provider: $dialog.find('#select-provider').val(),
start_datetime: startDatetime,
end_datetime: endDatetime,
location: $dialog.find('#appointment-location').val(),
notes: $dialog.find('#appointment-notes').val(),
is_unavailable: false
};

View File

@ -90,6 +90,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
$dialog.find('#address').val(customer.address);
$dialog.find('#city').val(customer.city);
$dialog.find('#zip-code').val(customer.zip_code);
$dialog.find('#appointment-location').val(appointment.location);
$dialog.find('#appointment-notes').val(appointment.notes);
$dialog.find('#customer-notes').val(customer.notes);
} else {
@ -1281,6 +1282,7 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
$dialog.find('#address').val(customer.address);
$dialog.find('#city').val(customer.city);
$dialog.find('#zip-code').val(customer.zip_code);
$dialog.find('#appointment-location').val(appointment.location);
$dialog.find('#appointment-notes').val(appointment.notes);
$dialog.find('#customer-notes').val(customer.notes);