| @@ -4,14 +4,12 @@ | ||
| 4 | 4 | |
| 5 | 5 | use FluentBooking\App\Models\Availability; |
| 6 | 6 | use FluentBooking\App\Models\Calendar; |
| 7 | 7 | use FluentBooking\App\Models\CalendarSlot; |
| 8 | -use FluentBooking\App\Services\Helper; | |
| 9 | 8 | use FluentBooking\Framework\Http\Request\Request; |
| 10 | 9 | use FluentBooking\App\Services\PermissionManager; |
| 11 | 10 | use FluentBooking\App\Services\SanitizeService; |
| 12 | 11 | use FluentBooking\App\Services\AvailabilityService; |
| 13 | -use FluentBooking\App\Services\DateTimeHelper; | |
| 14 | 12 | use FluentBooking\Framework\Support\Arr; |
| 15 | 13 | |
| 16 | 14 | class AvailabilityController extends Controller |
| 17 | 15 | { |
| @@ -28,9 +26,9 @@ | ||
| 28 | 26 | } else if ($host !== 'all') { |
| 29 | 27 | $host = (int)$host; |
| 30 | 28 | } |
| 31 | 29 | |
| 32 | - if (!PermissionManager::userCan(['read_and_use_other_availabilities','manage_other_availabilities'])) { | |
| 30 | + if (!PermissionManager::userCan(['manage_all_data', 'read_and_use_other_availabilities', 'manage_other_availabilities'])) { | |
| 33 | 31 | $host = get_current_user_id(); |
| 34 | 32 | } |
| 35 | 33 | |
| 36 | 34 | if ($host && $host !== 'all') { |
| @@ -112,9 +110,9 @@ | ||
| 112 | 110 | $isTitleExist = AvailabilityService::isTitleAlreadyExist($data['title'], $userId); |
| 113 | 111 | |
| 114 | 112 | if ($isTitleExist) { |
| 115 | 113 | /* translators: %s is the existing availability title */ |
| 116 | - $message = sprintf(__('%s is already exist', 'fluent-booking'), $data['title']); | |
| 114 | + $message = sprintf(__('%s already exists', 'fluent-booking'), $data['title']); | |
| 117 | 115 | return $this->sendError([ |
| 118 | 116 | 'message' => $message, |
| 119 | 117 | ], 422); |
| 120 | 118 | } |
| @@ -183,10 +181,10 @@ | ||
| 183 | 181 | |
| 184 | 182 | $scheduleData = [ |
| 185 | 183 | 'default' => Arr::isTrue($schedule, 'value.default'), |
| 186 | 184 | 'timezone' => $timezone, |
| 187 | - 'date_overrides' => SanitizeService::slotDateOverrides(Arr::get($data, 'schedule.settings.date_overrides', []), $timezone, 'UTC'), | |
| 188 | - 'weekly_schedules' => SanitizeService::weeklySchedules(Arr::get($data, 'schedule.settings.weekly_schedules', []), $timezone, 'UTC'), | |
| 185 | + 'date_overrides' => SanitizeService::slotDateOverrides(Arr::get($data, 'schedule.settings.date_overrides', []), $timezone, 'UTC', null, true), | |
| 186 | + 'weekly_schedules' => SanitizeService::weeklySchedules(Arr::get($data, 'schedule.settings.weekly_schedules', []), $timezone, 'UTC', true), | |
| 189 | 187 | ]; |
| 190 | 188 | |
| 191 | 189 | $schedule->value = $scheduleData; |
| 192 | 190 | $schedule->save(); |
| @@ -208,9 +206,9 @@ | ||
| 208 | 206 | $isTitleExist = AvailabilityService::isTitleAlreadyExist($title, $schedule->object_id, $schedule->key); |
| 209 | 207 | |
| 210 | 208 | if ($isTitleExist) { |
| 211 | 209 | /* translators: %s is the existing availability title */ |
| 212 | - $message = sprintf(__('%s is already exist', 'fluent-booking'), $title); | |
| 210 | + $message = sprintf(__('%s already exists', 'fluent-booking'), $title); | |
| 213 | 211 | return $this->sendError([ |
| 214 | 212 | 'message' => $message, |
| 215 | 213 | ], 422); |
| 216 | 214 | } |
| @@ -258,9 +256,9 @@ | ||
| 258 | 256 | if ($isDefault) { |
| 259 | 257 | $calendar = Calendar::where('user_id', $schedule->object_id)->first(); |
| 260 | 258 | if ($calendar) { |
| 261 | 259 | return $this->sendError([ |
| 262 | - 'message' => __('Default Schedule can not be deleted', 'fluent-booking') | |
| 260 | + 'message' => __('Default Schedule cannot be deleted', 'fluent-booking') | |
| 263 | 261 | ], 422); |
| 264 | 262 | } |
| 265 | 263 | } |
| 266 | 264 | |