activity_model.php
1 year ago
agent_meta_model.php
1 year ago
agent_model.php
1 year ago
booking_meta_model.php
1 year ago
booking_model.php
1 year ago
bundle_meta_model.php
1 year ago
bundle_model.php
1 year ago
cart_item_model.php
1 year ago
cart_meta_model.php
1 year ago
cart_model.php
1 year ago
connector_model.php
1 year ago
customer_meta_model.php
1 year ago
customer_model.php
9 months ago
invoice_model.php
1 year ago
join_bundles_services_model.php
1 year ago
location_category_model.php
9 months ago
location_model.php
1 year ago
meta_model.php
1 year ago
model.php
9 months ago
off_period_model.php
1 year ago
order_intent_meta_model.php
1 year ago
order_intent_model.php
9 months ago
order_item_model.php
1 year ago
order_meta_model.php
1 year ago
order_model.php
1 year ago
otp_model.php
9 months ago
payment_request_model.php
1 year ago
process_job_model.php
1 year ago
process_model.php
1 year ago
recurrence_model.php
1 year ago
service_category_model.php
9 months ago
service_meta_model.php
1 year ago
service_model.php
9 months ago
session_model.php
1 year ago
settings_model.php
1 year ago
step_settings_model.php
1 year ago
transaction_intent_model.php
1 year ago
transaction_model.php
1 year ago
transaction_refund_model.php
1 year ago
work_period_model.php
1 year ago
work_period_model.php
76 lines
| 1 | <?php |
| 2 | |
| 3 | class OsWorkPeriodModel extends OsModel{ |
| 4 | public $id, |
| 5 | $service_id, |
| 6 | $agent_id, |
| 7 | $location_id, |
| 8 | $start_time, |
| 9 | $end_time, |
| 10 | $week_day, |
| 11 | $custom_date = null, |
| 12 | $chain_id, |
| 13 | $services_agents_table_name, |
| 14 | $updated_at, |
| 15 | $created_at; |
| 16 | |
| 17 | function __construct($id = false){ |
| 18 | parent::__construct(); |
| 19 | $this->table_name = LATEPOINT_TABLE_WORK_PERIODS; |
| 20 | $this->services_agents_table_name = LATEPOINT_TABLE_AGENTS_SERVICES; |
| 21 | $this->nice_names = array( |
| 22 | 'start_time' => __('Start Time', 'latepoint'), |
| 23 | 'end_time' => __('End Time', 'latepoint')); |
| 24 | |
| 25 | if($id){ |
| 26 | $this->load_by_id($id); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | protected function get_is_active(){ |
| 31 | return ($this->start_time != $this->end_time); |
| 32 | } |
| 33 | |
| 34 | protected function get_nice_start_time(){ |
| 35 | return OsTimeHelper::minutes_to_hours_and_minutes($this->start_time); |
| 36 | } |
| 37 | |
| 38 | protected function get_nice_end_time(){ |
| 39 | return OsTimeHelper::minutes_to_hours_and_minutes($this->end_time); |
| 40 | } |
| 41 | |
| 42 | protected function allowed_params($role = 'admin'){ |
| 43 | $allowed_params = array('id', |
| 44 | 'service_id', |
| 45 | 'agent_id', |
| 46 | 'location_id', |
| 47 | 'start_time', |
| 48 | 'end_time', |
| 49 | 'chain_id', |
| 50 | 'custom_date', |
| 51 | 'week_day'); |
| 52 | return $allowed_params; |
| 53 | } |
| 54 | |
| 55 | protected function params_to_save($role = 'admin'){ |
| 56 | $params_to_save = array('id', |
| 57 | 'service_id', |
| 58 | 'agent_id', |
| 59 | 'location_id', |
| 60 | 'start_time', |
| 61 | 'end_time', |
| 62 | 'chain_id', |
| 63 | 'custom_date', |
| 64 | 'week_day'); |
| 65 | return $params_to_save; |
| 66 | } |
| 67 | |
| 68 | |
| 69 | |
| 70 | protected function properties_to_validate(){ |
| 71 | $validations = array( |
| 72 | 'week_day' => array('presence'), |
| 73 | ); |
| 74 | return $validations; |
| 75 | } |
| 76 | } |