WordPress Online Booking and Scheduling Plugin – Bookly - Version 21.0

Version Description

Download this release

Release Info

Developer Ladela
Plugin Icon 128x128 WordPress Online Booking and Scheduling Plugin – Bookly
Version 21.0
Comparing to
See all releases

Code changes from version 20.9 to 21.0

Files changed (106) hide show
  1. backend/Backend.php +7 -9
  2. backend/components/cloud/recharge/templates/_amounts.php +2 -2
  3. backend/components/controls/templates/container.php +3 -3
  4. backend/components/dashboard/appointments/Ajax.php +1 -1
  5. backend/components/dashboard/appointments/Widget.php +1 -1
  6. backend/components/dialogs/appointment/edit/Ajax.php +5 -4
  7. backend/components/dialogs/appointment/edit/proxy/Extras.php +17 -0
  8. backend/components/dialogs/appointment/edit/resources/js/appointment.js +1 -1
  9. backend/components/dialogs/customer/delete/Dialog.php +0 -1
  10. backend/components/dialogs/customer/delete/templates/dialog.php +1 -1
  11. backend/components/dialogs/notifications/templates/_codes.php +2 -2
  12. backend/components/dialogs/notifications/templates/_editor.php +1 -1
  13. backend/components/dialogs/payment/Dialog.php +1 -1
  14. backend/components/dialogs/service/categories/resources/js/service-categories-dialog.js +82 -23
  15. backend/components/dialogs/service/categories/templates/dialog.php +42 -9
  16. backend/components/dialogs/service/edit/templates/dialog.php +1 -1
  17. backend/components/dialogs/service/order/templates/dialog.php +1 -1
  18. backend/components/dialogs/sms/resources/js/notification-dialog.js +7 -7
  19. backend/components/dialogs/staff/edit/resources/js/staff-details.js +8 -9
  20. backend/components/dialogs/staff/edit/templates/details.php +2 -2
  21. backend/components/dialogs/staff/order/templates/dialog.php +1 -1
  22. backend/components/notices/nps/templates/nps.php +1 -1
  23. backend/components/settings/Image.php +4 -4
  24. backend/components/settings/Inputs.php +51 -0
  25. backend/modules/appearance/Ajax.php +3 -1
  26. backend/modules/appearance/Codes.php +29 -9
  27. backend/modules/appearance/resources/js/appearance.js +37 -29
  28. backend/modules/appearance/templates/_1_service.php +3 -1
  29. backend/modules/appearance/templates/_6_details.php +5 -5
  30. backend/modules/appearance/templates/_8_complete.php +2 -2
  31. backend/modules/appearance/templates/index.php +7 -4
  32. backend/modules/appointments/Ajax.php +2 -1
  33. backend/modules/appointments/Page.php +1 -1
  34. backend/modules/appointments/resources/js/appointments.js +118 -111
  35. backend/modules/calendar/Page.php +2 -0
  36. backend/modules/cloud_billing/resources/js/cloud-billing.js +30 -29
  37. backend/modules/cloud_billing/templates/index.php +0 -1
  38. backend/modules/cloud_products/templates/_action_btn.php +2 -2
  39. backend/modules/cloud_sms/resources/js/notifications-list.js +103 -101
  40. backend/modules/cloud_sms/resources/js/sms.js +105 -100
  41. backend/modules/customers/resources/js/customers.js +69 -66
  42. backend/modules/debug/Ajax.php +0 -950
  43. backend/modules/debug/Page.php +0 -187
  44. backend/modules/debug/lib/QueryBuilder.php +0 -679
  45. backend/modules/debug/lib/tests/Base.php +0 -66
  46. backend/modules/debug/lib/tests/Session.php +0 -57
  47. backend/modules/debug/lib/tests/Slug.php +0 -37
  48. backend/modules/debug/lib/tests/Socket.php +0 -48
  49. backend/modules/debug/lib/tools/Base.php +0 -109
  50. backend/modules/debug/lib/tools/Cloud.php +0 -70
  51. backend/modules/debug/lib/tools/FormsData.php +0 -66
  52. backend/modules/debug/lib/tools/Phpinfo.php +0 -34
  53. backend/modules/debug/lib/tools/Plugins.php +0 -149
  54. backend/modules/debug/lib/tools/ShortCodes.php +0 -73
  55. backend/modules/debug/resources/js/schema.js +0 -469
  56. backend/modules/debug/resources/js/tools.js +0 -177
  57. backend/modules/debug/templates/index.php +0 -354
  58. backend/modules/diagnostics/Ajax.php +222 -0
  59. backend/modules/diagnostics/Page.php +73 -0
  60. backend/modules/diagnostics/QueryBuilder.php +685 -0
  61. backend/modules/{debug/lib → diagnostics}/Schema.php +24 -15
  62. backend/modules/{debug → diagnostics}/resources/css/style.css +0 -0
  63. backend/modules/diagnostics/resources/js/database.js +236 -0
  64. backend/modules/diagnostics/resources/js/diagnostics.js +202 -0
  65. backend/modules/diagnostics/templates/index.php +71 -0
  66. backend/modules/diagnostics/tests/Connections.php +68 -0
  67. backend/modules/diagnostics/tests/IncompatiblePlugins.php +50 -0
  68. backend/modules/diagnostics/tests/LogErrors.php +38 -0
  69. backend/modules/diagnostics/tests/PluginUpdates.php +43 -0
  70. backend/modules/diagnostics/tests/PluginsDirectories.php +53 -0
  71. backend/modules/diagnostics/tests/SSL.php +33 -0
  72. backend/modules/diagnostics/tests/Sessions.php +56 -0
  73. backend/modules/diagnostics/tests/Test.php +108 -0
  74. backend/modules/diagnostics/tests/TimeZone.php +37 -0
  75. backend/modules/diagnostics/tools/DataManagement.php +24 -0
  76. backend/modules/diagnostics/tools/Database.php +367 -0
  77. backend/modules/diagnostics/tools/ExternalPlugins.php +120 -0
  78. backend/modules/diagnostics/tools/FormsData.php +46 -0
  79. backend/modules/diagnostics/tools/Info.php +111 -0
  80. backend/modules/diagnostics/tools/ShortCodes.php +58 -0
  81. backend/modules/diagnostics/tools/Tool.php +70 -0
  82. backend/modules/diagnostics/tools/templates/_data_management.php +23 -0
  83. backend/modules/diagnostics/tools/templates/_database.php +127 -0
  84. backend/modules/diagnostics/tools/templates/_external_plugins.php +20 -0
  85. backend/modules/diagnostics/tools/templates/_forms_data.php +23 -0
  86. backend/modules/diagnostics/tools/templates/_info.php +5 -0
  87. backend/modules/diagnostics/tools/templates/_short_codes.php +13 -0
  88. backend/modules/news/templates/index.php +1 -1
  89. backend/modules/notifications/lib/Codes.php +4 -1
  90. backend/modules/payments/Page.php +1 -0
  91. backend/modules/payments/resources/js/payments.js +59 -57
  92. backend/modules/services/Ajax.php +12 -7
  93. backend/modules/services/Page.php +17 -14
  94. backend/modules/services/resources/js/services-list.js +53 -49
  95. backend/modules/settings/Codes.php +54 -41
  96. backend/modules/settings/Page.php +1 -0
  97. backend/modules/settings/resources/js/settings.js +30 -67
  98. backend/modules/settings/templates/_appointmentsForm.php +2 -2
  99. backend/modules/settings/templates/_cloud_stripe_settings.php +3 -3
  100. backend/modules/settings/templates/_generalForm.php +1 -0
  101. backend/modules/settings/templates/_logsForm.php +2 -2
  102. backend/modules/settings/templates/_payment_local.php +3 -3
  103. backend/modules/settings/templates/_paymentsForm.php +2 -1
  104. backend/modules/shop/Ajax.php +2 -2
  105. backend/modules/staff/proxy/Shared.php +1 -1
  106. backend/modules/staff/resources/js/staff-list.js +42 -39
backend/Backend.php CHANGED
@@ -111,9 +111,8 @@ abstract class Backend
111
  add_submenu_page( 'bookly-menu', $setup, $setup, $required_capability, Modules\Setup\Page::pageSlug(), function () { Modules\Setup\Page::render(); } );
112
  } elseif ( Lib\Proxy\Pro::graceExpired() ) {
113
  Lib\Proxy\Pro::addLicenseBooklyMenuItem();
114
- if ( isset ( $_GET['page'] ) && $_GET['page'] == 'bookly-debug' ) {
115
- add_submenu_page( 'bookly-menu', 'Debug', 'Debug', $required_capability,
116
- Modules\Debug\Page::pageSlug(), function () { Modules\Debug\Page::render(); } );
117
  }
118
  } else {
119
  // Translated submenu pages.
@@ -170,15 +169,14 @@ abstract class Backend
170
  Modules\Appearance\Page::pageSlug(), function () { Modules\Appearance\Page::render(); } );
171
  Lib\Proxy\Coupons::addBooklyMenuItem();
172
  Lib\Proxy\CustomFields::addBooklyMenuItem();
173
- add_submenu_page( 'bookly-menu', $settings, $settings, $required_capability,
174
- Modules\Settings\Page::pageSlug(), function () { Modules\Settings\Page::render(); } );
 
 
 
175
  Modules\News\Page::addBooklyMenuItem();
176
  Modules\Shop\Page::addBooklyMenuItem();
177
 
178
- if ( isset ( $_GET['page'] ) && $_GET['page'] == 'bookly-debug' ) {
179
- add_submenu_page( 'bookly-menu', 'Debug', 'Debug', $required_capability,
180
- Modules\Debug\Page::pageSlug(), function () { Modules\Debug\Page::render(); } );
181
- }
182
  if ( ! Lib\Config::proActive() ) {
183
  $submenu['bookly-menu'][] = array( esc_attr__( 'Get Bookly Pro', 'bookly' ) . ' <i class="fas fa-fw fa-certificate" style="color: #f4662f"></i>', 'read', Lib\Utils\Common::prepareUrlReferrers( 'https://codecanyon.net/item/bookly/7226091?ref=ladela', 'admin_menu' ), );
184
  }
111
  add_submenu_page( 'bookly-menu', $setup, $setup, $required_capability, Modules\Setup\Page::pageSlug(), function () { Modules\Setup\Page::render(); } );
112
  } elseif ( Lib\Proxy\Pro::graceExpired() ) {
113
  Lib\Proxy\Pro::addLicenseBooklyMenuItem();
114
+ if ( isset ( $_GET['page'] ) && $_GET['page'] == 'bookly-diagnostics' ) {
115
+ Modules\Diagnostics\Page::addBooklyMenuItem();
 
116
  }
117
  } else {
118
  // Translated submenu pages.
169
  Modules\Appearance\Page::pageSlug(), function () { Modules\Appearance\Page::render(); } );
170
  Lib\Proxy\Coupons::addBooklyMenuItem();
171
  Lib\Proxy\CustomFields::addBooklyMenuItem();
172
+ add_submenu_page(
173
+ 'bookly-menu', $settings, $settings, $required_capability,
174
+ Modules\Settings\Page::pageSlug(), function () { Modules\Settings\Page::render(); }
175
+ );
176
+ Modules\Diagnostics\Page::addBooklyMenuItem();
177
  Modules\News\Page::addBooklyMenuItem();
178
  Modules\Shop\Page::addBooklyMenuItem();
179
 
 
 
 
 
180
  if ( ! Lib\Config::proActive() ) {
181
  $submenu['bookly-menu'][] = array( esc_attr__( 'Get Bookly Pro', 'bookly' ) . ' <i class="fas fa-fw fa-certificate" style="color: #f4662f"></i>', 'read', Lib\Utils\Common::prepareUrlReferrers( 'https://codecanyon.net/item/bookly/7226091?ref=ladela', 'admin_menu' ), );
182
  }
backend/components/cloud/recharge/templates/_amounts.php CHANGED
@@ -16,11 +16,11 @@ $amounts = Amounts::getInstance();
16
  <?php endif ?>
17
  <div class="mb-3 mt-4">
18
  <div class="text-center">
19
- <a class="text-muted" style="text-decoration:underline dotted" data-toggle="collapse" href="#how-auto-recharge-works">
20
  <?php esc_html_e( 'How it works', 'bookly' ) ?> <i class="fas fa-question-circle"></i>
21
  </a>
22
  </div>
23
- <div class="collapse alert alert-info text-justify mx-5" id="how-auto-recharge-works">
24
  <?php printf( __( 'Your account will be topped up with the selected amount <b>now</b> if your balance is less than %1$s, and <b>automatically later</b> when the balance falls below %1$s.', 'bookly' ), '$10' ) ?>
25
  </div>
26
  </div>
16
  <?php endif ?>
17
  <div class="mb-3 mt-4">
18
  <div class="text-center">
19
+ <a class="text-muted" style="text-decoration:underline dotted" data-toggle="bookly-collapse" href="#how-auto-recharge-works">
20
  <?php esc_html_e( 'How it works', 'bookly' ) ?> <i class="fas fa-question-circle"></i>
21
  </a>
22
  </div>
23
+ <div class="bookly-collapse alert alert-info text-justify mx-5" id="how-auto-recharge-works">
24
  <?php printf( __( 'Your account will be topped up with the selected amount <b>now</b> if your balance is less than %1$s, and <b>automatically later</b> when the balance falls below %1$s.', 'bookly' ), '$10' ) ?>
25
  </div>
26
  </div>
backend/components/controls/templates/container.php CHANGED
@@ -1,4 +1,4 @@
1
  <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2
- <div class="bookly-collapse">
3
- <a class="h5<?php if ( $opened ) : ?> collapsed<?php endif ?>" href="#<?php echo esc_attr( $id ) ?>" data-toggle="collapse" role="button" aria-expanded="<?php echo esc_attr( $opened?'true':'false' ) ?>"><?php echo esc_html( $title ) ?></a>
4
- <div id="<?php echo esc_attr( $id ) ?>" class="collapse<?php if ( $opened ) : ?> show<?php endif ?>">
1
  <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2
+ <div class="bookly-collapse-with-arrow">
3
+ <a class="h5<?php if ( $opened ) : ?> bookly-collapsed<?php endif ?>" href="#<?php echo esc_attr( $id ) ?>" data-toggle="bookly-collapse" role="button" aria-expanded="<?php echo esc_attr( $opened?'true':'false' ) ?>"><?php echo esc_html( $title ) ?></a>
4
+ <div id="<?php echo esc_attr( $id ) ?>" class="bookly-collapse<?php if ( $opened ) : ?> bookly-show<?php endif ?>">
backend/components/dashboard/appointments/Ajax.php CHANGED
@@ -29,7 +29,7 @@ class Ajax extends Lib\Base\Ajax
29
  'filters' => array(
30
  'approved' => sprintf( '%s#created-date=%s-%s&appointment-date=any&status=%s', Lib\Utils\Common::escAdminUrl( Modules\Appointments\Page::pageSlug() ), $start->format( 'Y-m-d' ), $end->format( 'Y-m-d' ), 'approved' ),
31
  'pending' => sprintf( '%s#created-date=%s-%s&appointment-date=any&status=%s', Lib\Utils\Common::escAdminUrl( Modules\Appointments\Page::pageSlug() ), $start->format( 'Y-m-d' ), $end->format( 'Y-m-d' ), 'pending' ),
32
- 'total' => sprintf( '%s#created-date=%s-%s&appointment-date=any', Lib\Utils\Common::escAdminUrl( Modules\Appointments\Page::pageSlug() ), $start->format( 'Y-m-d' ), $end->format( 'Y-m-d' ) ),
33
  'revenue' => sprintf( '%s#created-date=%s-%s', Lib\Utils\Common::escAdminUrl( Modules\Payments\Page::pageSlug() ), $start->format( 'Y-m-d' ), $end->format( 'Y-m-d' ) ),
34
  ),
35
  'days' => array(),
29
  'filters' => array(
30
  'approved' => sprintf( '%s#created-date=%s-%s&appointment-date=any&status=%s', Lib\Utils\Common::escAdminUrl( Modules\Appointments\Page::pageSlug() ), $start->format( 'Y-m-d' ), $end->format( 'Y-m-d' ), 'approved' ),
31
  'pending' => sprintf( '%s#created-date=%s-%s&appointment-date=any&status=%s', Lib\Utils\Common::escAdminUrl( Modules\Appointments\Page::pageSlug() ), $start->format( 'Y-m-d' ), $end->format( 'Y-m-d' ), 'pending' ),
32
+ 'total' => sprintf( '%s#created-date=%s-%s&appointment-date=any&status=any', Lib\Utils\Common::escAdminUrl( Modules\Appointments\Page::pageSlug() ), $start->format( 'Y-m-d' ), $end->format( 'Y-m-d' ) ),
33
  'revenue' => sprintf( '%s#created-date=%s-%s', Lib\Utils\Common::escAdminUrl( Modules\Payments\Page::pageSlug() ), $start->format( 'Y-m-d' ), $end->format( 'Y-m-d' ) ),
34
  ),
35
  'days' => array(),
backend/components/dashboard/appointments/Widget.php CHANGED
@@ -62,7 +62,7 @@ class Widget extends Lib\Base\Component
62
  'csrfToken' => Lib\Utils\Common::getCsrfToken(),
63
  'appointments' => __( 'Appointments', 'bookly' ),
64
  'revenue' => __( 'Revenue', 'bookly' ),
65
- 'currency' => $currencies[ get_option( 'bookly_pmt_currency' ) ]['symbol'],
66
  ) );
67
  }
68
  }
62
  'csrfToken' => Lib\Utils\Common::getCsrfToken(),
63
  'appointments' => __( 'Appointments', 'bookly' ),
64
  'revenue' => __( 'Revenue', 'bookly' ),
65
+ 'currency' => $currencies[ Lib\Config::getCurrency() ]['symbol'],
66
  ) );
67
  }
68
  }
backend/components/dialogs/appointment/edit/Ajax.php CHANGED
@@ -43,7 +43,6 @@ class Ajax extends Lib\Base\Ajax
43
  'end_time' => array(),
44
  'week_days' => array(),
45
  'time_interval' => Lib\Config::getTimeSlotLength(),
46
- 'extras_multiply_nop' => (int) get_option( 'bookly_service_extras_multiply_nop', 1 ),
47
  'customer_gr_def_app_status' => Lib\Proxy\CustomerGroups::prepareDefaultAppointmentStatuses( array( 0 => Lib\Config::getDefaultAppointmentStatus() ) ),
48
  );
49
 
@@ -956,6 +955,9 @@ class Ajax extends Lib\Base\Ajax
956
  $location_id = self::parameter( 'location_id' );
957
  $nop = max( 1, self::parameter( 'nop', 1 ) );
958
 
 
 
 
959
  $chain_item = new Lib\ChainItem();
960
  $chain_item
961
  ->setStaffIds( $staff_ids )
@@ -965,7 +967,7 @@ class Ajax extends Lib\Base\Ajax
965
  ->setQuantity( 1 )
966
  ->setLocationId( $location_id )
967
  ->setUnits( 1 )
968
- ->setExtras( array() );
969
 
970
  $chain = new Lib\Chain();
971
  $chain->add( $chain_item );
@@ -1023,7 +1025,6 @@ class Ajax extends Lib\Base\Ajax
1023
  * Get appointment for Event Calendar
1024
  *
1025
  * @param int $appointment_id
1026
- * @param int $staff_id
1027
  * @param string $display_tz
1028
  * @return array
1029
  */
@@ -1038,7 +1039,7 @@ class Ajax extends Lib\Base\Ajax
1038
  }
1039
 
1040
  /**
1041
- * Check whether interval is intersect with another appointments.
1042
  *
1043
  * @param $start_date
1044
  * @param $end_date
43
  'end_time' => array(),
44
  'week_days' => array(),
45
  'time_interval' => Lib\Config::getTimeSlotLength(),
 
46
  'customer_gr_def_app_status' => Lib\Proxy\CustomerGroups::prepareDefaultAppointmentStatuses( array( 0 => Lib\Config::getDefaultAppointmentStatus() ) ),
47
  );
48
 
955
  $location_id = self::parameter( 'location_id' );
956
  $nop = max( 1, self::parameter( 'nop', 1 ) );
957
 
958
+ // Get array of extras with max duration
959
+ $extras = Proxy\Extras::getMaxDurationExtras( self::parameter( 'extras', array() ) );
960
+
961
  $chain_item = new Lib\ChainItem();
962
  $chain_item
963
  ->setStaffIds( $staff_ids )
967
  ->setQuantity( 1 )
968
  ->setLocationId( $location_id )
969
  ->setUnits( 1 )
970
+ ->setExtras( $extras );
971
 
972
  $chain = new Lib\Chain();
973
  $chain->add( $chain_item );
1025
  * Get appointment for Event Calendar
1026
  *
1027
  * @param int $appointment_id
 
1028
  * @param string $display_tz
1029
  * @return array
1030
  */
1039
  }
1040
 
1041
  /**
1042
+ * Check whether interval is intersected with another appointments.
1043
  *
1044
  * @param $start_date
1045
  * @param $end_date
backend/components/dialogs/appointment/edit/proxy/Extras.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Components\Dialogs\Appointment\Edit\Proxy;
4
+
5
+ use Bookly\Lib;
6
+
7
+ /**
8
+ * Class Extras
9
+ *
10
+ * @package Bookly\Backend\Components\Dialogs\Appointment\Edit\Proxy
11
+ *
12
+ * @method static array getMaxDurationExtras( array $extras ) Prepare extras list for day schedule.
13
+ */
14
+ abstract class Extras extends Lib\Base\Proxy
15
+ {
16
+
17
+ }
backend/components/dialogs/appointment/edit/resources/js/appointment.js CHANGED
@@ -1 +1 @@
1
- var BooklyAppointmentDialog=function(t,n,e,r,o){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var u=i(n),a=i(e),c=i(r),f=i(o),l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t){var n={exports:{}};return t(n,n.exports),n.exports}var d,p=function(t){return t&&t.Math==Math&&t},v=p("object"==typeof globalThis&&globalThis)||p("object"==typeof window&&window)||p("object"==typeof self&&self)||p("object"==typeof l&&l)||function(){return this}()||Function("return this")(),m=function(t){try{return!!t()}catch(t){return!0}},h=!m((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),y={}.propertyIsEnumerable,g=Object.getOwnPropertyDescriptor,_={f:g&&!y.call({1:2},1)?function(t){var n=g(this,t);return!!n&&n.enumerable}:y},$=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}},b={}.toString,w=function(t){return b.call(t).slice(8,-1)},x="".split,k=m((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==w(t)?x.call(t,""):Object(t)}:Object,O=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},S=function(t){return k(O(t))},E=function(t){return"object"==typeof t?null!==t:"function"==typeof t},A=function(t,n){if(!E(t))return t;var e,r;if(n&&"function"==typeof(e=t.toString)&&!E(r=e.call(t)))return r;if("function"==typeof(e=t.valueOf)&&!E(r=e.call(t)))return r;if(!n&&"function"==typeof(e=t.toString)&&!E(r=e.call(t)))return r;throw TypeError("Can't convert object to primitive value")},j={}.hasOwnProperty,T=function(t,n){return j.call(t,n)},P=v.document,R=E(P)&&E(P.createElement),B=function(t){return R?P.createElement(t):{}},D=!h&&!m((function(){return 7!=Object.defineProperty(B("div"),"a",{get:function(){return 7}}).a})),I=Object.getOwnPropertyDescriptor,M={f:h?I:function(t,n){if(t=S(t),n=A(n,!0),D)try{return I(t,n)}catch(t){}if(T(t,n))return $(!_.f.call(t,n),t[n])}},C=/#|\.prototype\./,N=function(t,n){var e=F[L(t)];return e==q||e!=z&&("function"==typeof n?m(n):!!n)},L=N.normalize=function(t){return String(t).replace(C,".").toLowerCase()},F=N.data={},z=N.NATIVE="N",q=N.POLYFILL="P",Y=N,H={},U=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t},G=function(t,n,e){if(U(t),void 0===n)return t;switch(e){case 0:return function(){return t.call(n)};case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,o){return t.call(n,e,r,o)}}return function(){return t.apply(n,arguments)}},W=function(t){if(!E(t))throw TypeError(String(t)+" is not an object");return t},J=Object.defineProperty,V={f:h?J:function(t,n,e){if(W(t),n=A(n,!0),W(e),D)try{return J(t,n,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported");return"value"in e&&(t[n]=e.value),t}},Q=h?function(t,n,e){return V.f(t,n,$(1,e))}:function(t,n,e){return t[n]=e,t},K=M.f,X=function(t){var n=function(n,e,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,e)}return new t(n,e,r)}return t.apply(this,arguments)};return n.prototype=t.prototype,n},Z=function(t,n){var e,r,o,i,u,a,c,f,l=t.target,s=t.global,d=t.stat,p=t.proto,m=s?v:d?v[l]:(v[l]||{}).prototype,h=s?H:H[l]||(H[l]={}),y=h.prototype;for(o in n)e=!Y(s?o:l+(d?".":"#")+o,t.forced)&&m&&T(m,o),u=h[o],e&&(a=t.noTargetGet?(f=K(m,o))&&f.value:m[o]),i=e&&a?a:n[o],e&&typeof u==typeof i||(c=t.bind&&e?G(i,v):t.wrap&&e?X(i):p&&"function"==typeof i?G(Function.call,i):i,(t.sham||i&&i.sham||u&&u.sham)&&Q(c,"sham",!0),h[o]=c,p&&(T(H,r=l+"Prototype")||Q(H,r,{}),H[r][o]=i,t.real&&y&&!y[o]&&Q(y,o,i)))},tt=function(t){return"function"==typeof t?t:void 0},nt=function(t,n){return arguments.length<2?tt(H[t])||tt(v[t]):H[t]&&H[t][n]||v[t]&&v[t][n]},et=Math.ceil,rt=Math.floor,ot=function(t){return isNaN(t=+t)?0:(t>0?rt:et)(t)},it=Math.min,ut=function(t){return t>0?it(ot(t),9007199254740991):0},at=Math.max,ct=Math.min,ft=function(t,n){var e=ot(t);return e<0?at(e+n,0):ct(e,n)},lt=function(t){return function(n,e,r){var o,i=S(n),u=ut(i.length),a=ft(r,u);if(t&&e!=e){for(;u>a;)if((o=i[a++])!=o)return!0}else for(;u>a;a++)if((t||a in i)&&i[a]===e)return t||a||0;return!t&&-1}},st={includes:lt(!0),indexOf:lt(!1)},dt={},pt=st.indexOf,vt=function(t,n){var e,r=S(t),o=0,i=[];for(e in r)!T(dt,e)&&T(r,e)&&i.push(e);for(;n.length>o;)T(r,e=n[o++])&&(~pt(i,e)||i.push(e));return i},mt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ht=Object.keys||function(t){return vt(t,mt)},yt=h?Object.defineProperties:function(t,n){W(t);for(var e,r=ht(n),o=r.length,i=0;o>i;)V.f(t,e=r[i++],n[e]);return t},gt=nt("document","documentElement"),_t=!0,$t="__core-js_shared__",bt=v[$t]||function(t,n){try{Q(v,t,n)}catch(e){v[t]=n}return n}($t,{}),wt=s((function(t){(t.exports=function(t,n){return bt[t]||(bt[t]=void 0!==n?n:{})})("versions",[]).push({version:"3.8.3",mode:"pure",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),xt=0,kt=Math.random(),Ot=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++xt+kt).toString(36)},St=wt("keys"),Et=function(t){return St[t]||(St[t]=Ot(t))},At=Et("IE_PROTO"),jt=function(){},Tt=function(t){return"<script>"+t+"</"+"script>"},Pt=function(){try{d=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,n;Pt=d?function(t){t.write(Tt("")),t.close();var n=t.parentWindow.Object;return t=null,n}(d):((n=B("iframe")).style.display="none",gt.appendChild(n),n.src=String("javascript:"),(t=n.contentWindow.document).open(),t.write(Tt("document.F=Object")),t.close(),t.F);for(var e=mt.length;e--;)delete Pt.prototype[mt[e]];return Pt()};dt[At]=!0;var Rt=Object.create||function(t,n){var e;return null!==t?(jt.prototype=W(t),e=new jt,jt.prototype=null,e[At]=t):e=Pt(),void 0===n?e:yt(e,n)},Bt=[].slice,Dt={},It=function(t,n,e){if(!(n in Dt)){for(var r=[],o=0;o<n;o++)r[o]="a["+o+"]";Dt[n]=Function("C,a","return new C("+r.join(",")+")")}return Dt[n](t,e)},Mt=Function.bind||function(t){var n=U(this),e=Bt.call(arguments,1),r=function(){var o=e.concat(Bt.call(arguments));return this instanceof r?It(n,o.length,o):n.apply(t,o)};return E(n.prototype)&&(r.prototype=n.prototype),r},Ct=nt("Reflect","construct"),Nt=m((function(){function t(){}return!(Ct((function(){}),[],t)instanceof t)})),Lt=!m((function(){Ct((function(){}))})),Ft=Nt||Lt;Z({target:"Reflect",stat:!0,forced:Ft,sham:Ft},{construct:function(t,n){U(t),W(n);var e=arguments.length<3?t:U(arguments[2]);if(Lt&&!Nt)return Ct(t,n,e);if(t==e){switch(n.length){case 0:return new t;case 1:return new t(n[0]);case 2:return new t(n[0],n[1]);case 3:return new t(n[0],n[1],n[2]);case 4:return new t(n[0],n[1],n[2],n[3])}var r=[null];return r.push.apply(r,n),new(Mt.apply(t,r))}var o=e.prototype,i=Rt(E(o)?o:Object.prototype),u=Function.apply.call(t,i,n);return E(u)?u:i}});var zt=H.Reflect.construct;function qt(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}Z({target:"Object",stat:!0,forced:!h,sham:!h},{defineProperty:V.f});var Yt=s((function(t){var n=H.Object,e=t.exports=function(t,e,r){return n.defineProperty(t,e,r)};n.defineProperty.sham&&(e.sham=!0)})),Ht=Yt;function Ut(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Ht(t,r.key,r)}}function Gt(t,n,e){return n&&Ut(t.prototype,n),e&&Ut(t,e),t}function Wt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}Z({target:"Object",stat:!0,sham:!h},{create:Rt});var Jt=H.Object,Vt=function(t,n){return Jt.create(t,n)},Qt=Vt,Kt=Object.setPrototypeOf||("__proto__"in{}?function(){var t,n=!1,e={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(e,[]),n=e instanceof Array}catch(t){}return function(e,r){return W(e),function(t){if(!E(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype")}(r),n?t.call(e,r):e.__proto__=r,e}}():void 0);Z({target:"Object",stat:!0},{setPrototypeOf:Kt});var Xt=H.Object.setPrototypeOf,Zt=Xt;function tn(t,n){return(tn=Zt||function(t,n){return t.__proto__=n,t})(t,n)}function nn(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Qt(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&tn(t,n)}var en,rn,on=Array.isArray||function(t){return"Array"==w(t)},un=function(t){return Object(O(t))},an=function(t,n,e){var r=A(n);r in t?V.f(t,r,$(0,e)):t[r]=e},cn=!!Object.getOwnPropertySymbols&&!m((function(){return!String(Symbol())})),fn=cn&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ln=wt("wks"),sn=v.Symbol,dn=fn?sn:sn&&sn.withoutSetter||Ot,pn=function(t){return T(ln,t)||(cn&&T(sn,t)?ln[t]=sn[t]:ln[t]=dn("Symbol."+t)),ln[t]},vn=pn("species"),mn=function(t,n){var e;return on(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!on(e.prototype)?E(e)&&null===(e=e[vn])&&(e=void 0):e=void 0),new(void 0===e?Array:e)(0===n?0:n)},hn=nt("navigator","userAgent")||"",yn=v.process,gn=yn&&yn.versions,_n=gn&&gn.v8;_n?rn=(en=_n.split("."))[0]+en[1]:hn&&(!(en=hn.match(/Edge\/(\d+)/))||en[1]>=74)&&(en=hn.match(/Chrome\/(\d+)/))&&(rn=en[1]);var $n=rn&&+rn,bn=pn("species"),wn=function(t){return $n>=51||!m((function(){var n=[];return(n.constructor={})[bn]=function(){return{foo:1}},1!==n[t](Boolean).foo}))},xn=pn("isConcatSpreadable"),kn=9007199254740991,On="Maximum allowed index exceeded",Sn=$n>=51||!m((function(){var t=[];return t[xn]=!1,t.concat()[0]!==t})),En=wn("concat"),An=function(t){if(!E(t))return!1;var n=t[xn];return void 0!==n?!!n:on(t)};Z({target:"Array",proto:!0,forced:!Sn||!En},{concat:function(t){var n,e,r,o,i,u=un(this),a=mn(u,0),c=0;for(n=-1,r=arguments.length;n<r;n++)if(An(i=-1===n?u:arguments[n])){if(c+(o=ut(i.length))>kn)throw TypeError(On);for(e=0;e<o;e++,c++)e in i&&an(a,c,i[e])}else{if(c>=kn)throw TypeError(On);an(a,c++,i)}return a.length=c,a}});var jn=mt.concat("length","prototype"),Tn={f:Object.getOwnPropertyNames||function(t){return vt(t,jn)}},Pn=Tn.f,Rn={}.toString,Bn="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Dn={f:function(t){return Bn&&"[object Window]"==Rn.call(t)?function(t){try{return Pn(t)}catch(t){return Bn.slice()}}(t):Pn(S(t))}},In={f:Object.getOwnPropertySymbols},Mn=function(t,n,e,r){r&&r.enumerable?t[n]=e:Q(t,n,e)},Cn={f:pn},Nn=V.f,Ln=function(t){var n=H.Symbol||(H.Symbol={});T(n,t)||Nn(n,t,{value:Cn.f(t)})},Fn={};Fn[pn("toStringTag")]="z";var zn="[object z]"===String(Fn),qn=pn("toStringTag"),Yn="Arguments"==w(function(){return arguments}()),Hn=zn?w:function(t){var n,e,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=function(t,n){try{return t[n]}catch(t){}}(n=Object(t),qn))?e:Yn?w(n):"Object"==(r=w(n))&&"function"==typeof n.callee?"Arguments":r},Un=zn?{}.toString:function(){return"[object "+Hn(this)+"]"},Gn=V.f,Wn=pn("toStringTag"),Jn=function(t,n,e,r){if(t){var o=e?t:t.prototype;T(o,Wn)||Gn(o,Wn,{configurable:!0,value:n}),r&&!zn&&Q(o,"toString",Un)}},Vn=Function.toString;"function"!=typeof bt.inspectSource&&(bt.inspectSource=function(t){return Vn.call(t)});var Qn,Kn,Xn,Zn=bt.inspectSource,te=v.WeakMap,ne="function"==typeof te&&/native code/.test(Zn(te)),ee=v.WeakMap;if(ne){var re=bt.state||(bt.state=new ee),oe=re.get,ie=re.has,ue=re.set;Qn=function(t,n){return n.facade=t,ue.call(re,t,n),n},Kn=function(t){return oe.call(re,t)||{}},Xn=function(t){return ie.call(re,t)}}else{var ae=Et("state");dt[ae]=!0,Qn=function(t,n){return n.facade=t,Q(t,ae,n),n},Kn=function(t){return T(t,ae)?t[ae]:{}},Xn=function(t){return T(t,ae)}}var ce={set:Qn,get:Kn,has:Xn,enforce:function(t){return Xn(t)?Kn(t):Qn(t,{})},getterFor:function(t){return function(n){var e;if(!E(n)||(e=Kn(n)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return e}}},fe=[].push,le=function(t){var n=1==t,e=2==t,r=3==t,o=4==t,i=6==t,u=7==t,a=5==t||i;return function(c,f,l,s){for(var d,p,v=un(c),m=k(v),h=G(f,l,3),y=ut(m.length),g=0,_=s||mn,$=n?_(c,y):e||u?_(c,0):void 0;y>g;g++)if((a||g in m)&&(p=h(d=m[g],g,v),t))if(n)$[g]=p;else if(p)switch(t){case 3:return!0;case 5:return d;case 6:return g;case 2:fe.call($,d)}else switch(t){case 4:return!1;case 7:fe.call($,d)}return i?-1:r||o?o:$}},se={forEach:le(0),map:le(1),filter:le(2),some:le(3),every:le(4),find:le(5),findIndex:le(6),filterOut:le(7)},de=se.forEach,pe=Et("hidden"),ve="Symbol",me=pn("toPrimitive"),he=ce.set,ye=ce.getterFor(ve),ge=Object.prototype,_e=v.Symbol,$e=nt("JSON","stringify"),be=M.f,we=V.f,xe=Dn.f,ke=_.f,Oe=wt("symbols"),Se=wt("op-symbols"),Ee=wt("string-to-symbol-registry"),Ae=wt("symbol-to-string-registry"),je=wt("wks"),Te=v.QObject,Pe=!Te||!Te.prototype||!Te.prototype.findChild,Re=h&&m((function(){return 7!=Rt(we({},"a",{get:function(){return we(this,"a",{value:7}).a}})).a}))?function(t,n,e){var r=be(ge,n);r&&delete ge[n],we(t,n,e),r&&t!==ge&&we(ge,n,r)}:we,Be=function(t,n){var e=Oe[t]=Rt(_e.prototype);return he(e,{type:ve,tag:t,description:n}),h||(e.description=n),e},De=fn?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof _e},Ie=function(t,n,e){t===ge&&Ie(Se,n,e),W(t);var r=A(n,!0);return W(e),T(Oe,r)?(e.enumerable?(T(t,pe)&&t[pe][r]&&(t[pe][r]=!1),e=Rt(e,{enumerable:$(0,!1)})):(T(t,pe)||we(t,pe,$(1,{})),t[pe][r]=!0),Re(t,r,e)):we(t,r,e)},Me=function(t,n){W(t);var e=S(n),r=ht(e).concat(Fe(e));return de(r,(function(n){h&&!Ce.call(e,n)||Ie(t,n,e[n])})),t},Ce=function(t){var n=A(t,!0),e=ke.call(this,n);return!(this===ge&&T(Oe,n)&&!T(Se,n))&&(!(e||!T(this,n)||!T(Oe,n)||T(this,pe)&&this[pe][n])||e)},Ne=function(t,n){var e=S(t),r=A(n,!0);if(e!==ge||!T(Oe,r)||T(Se,r)){var o=be(e,r);return!o||!T(Oe,r)||T(e,pe)&&e[pe][r]||(o.enumerable=!0),o}},Le=function(t){var n=xe(S(t)),e=[];return de(n,(function(t){T(Oe,t)||T(dt,t)||e.push(t)})),e},Fe=function(t){var n=t===ge,e=xe(n?Se:S(t)),r=[];return de(e,(function(t){!T(Oe,t)||n&&!T(ge,t)||r.push(Oe[t])})),r};if(cn||(Mn((_e=function(){if(this instanceof _e)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,n=Ot(t),e=function(t){this===ge&&e.call(Se,t),T(this,pe)&&T(this[pe],n)&&(this[pe][n]=!1),Re(this,n,$(1,t))};return h&&Pe&&Re(ge,n,{configurable:!0,set:e}),Be(n,t)}).prototype,"toString",(function(){return ye(this).tag})),Mn(_e,"withoutSetter",(function(t){return Be(Ot(t),t)})),_.f=Ce,V.f=Ie,M.f=Ne,Tn.f=Dn.f=Le,In.f=Fe,Cn.f=function(t){return Be(pn(t),t)},h&&we(_e.prototype,"description",{configurable:!0,get:function(){return ye(this).description}})),Z({global:!0,wrap:!0,forced:!cn,sham:!cn},{Symbol:_e}),de(ht(je),(function(t){Ln(t)})),Z({target:ve,stat:!0,forced:!cn},{for:function(t){var n=String(t);if(T(Ee,n))return Ee[n];var e=_e(n);return Ee[n]=e,Ae[e]=n,e},keyFor:function(t){if(!De(t))throw TypeError(t+" is not a symbol");if(T(Ae,t))return Ae[t]},useSetter:function(){Pe=!0},useSimple:function(){Pe=!1}}),Z({target:"Object",stat:!0,forced:!cn,sham:!h},{create:function(t,n){return void 0===n?Rt(t):Me(Rt(t),n)},defineProperty:Ie,defineProperties:Me,getOwnPropertyDescriptor:Ne}),Z({target:"Object",stat:!0,forced:!cn},{getOwnPropertyNames:Le,getOwnPropertySymbols:Fe}),Z({target:"Object",stat:!0,forced:m((function(){In.f(1)}))},{getOwnPropertySymbols:function(t){return In.f(un(t))}}),$e){var ze=!cn||m((function(){var t=_e();return"[null]"!=$e([t])||"{}"!=$e({a:t})||"{}"!=$e(Object(t))}));Z({target:"JSON",stat:!0,forced:ze},{stringify:function(t,n,e){for(var r,o=[t],i=1;arguments.length>i;)o.push(arguments[i++]);if(r=n,(E(n)||void 0!==t)&&!De(t))return on(n)||(n=function(t,n){if("function"==typeof r&&(n=r.call(this,t,n)),!De(n))return n}),o[1]=n,$e.apply(null,o)}})}_e.prototype[me]||Q(_e.prototype,me,_e.prototype.valueOf),Jn(_e,ve),dt[pe]=!0,Ln("asyncIterator"),Ln("hasInstance"),Ln("isConcatSpreadable"),Ln("iterator"),Ln("match"),Ln("matchAll"),Ln("replace"),Ln("search"),Ln("species"),Ln("split"),Ln("toPrimitive"),Ln("toStringTag"),Ln("unscopables"),Jn(v.JSON,"JSON",!0);var qe=H.Symbol;Ln("asyncDispose"),Ln("dispose"),Ln("observable"),Ln("patternMatch"),Ln("replaceAll");var Ye,He,Ue,Ge=qe,We=function(t){return function(n,e){var r,o,i=String(O(n)),u=ot(e),a=i.length;return u<0||u>=a?t?"":void 0:(r=i.charCodeAt(u))<55296||r>56319||u+1===a||(o=i.charCodeAt(u+1))<56320||o>57343?t?i.charAt(u):r:t?i.slice(u,u+2):o-56320+(r-55296<<10)+65536}},Je={codeAt:We(!1),charAt:We(!0)},Ve=!m((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Qe=Et("IE_PROTO"),Ke=Object.prototype,Xe=Ve?Object.getPrototypeOf:function(t){return t=un(t),T(t,Qe)?t[Qe]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Ke:null},Ze=pn("iterator"),tr=!1;[].keys&&("next"in(Ue=[].keys())?(He=Xe(Xe(Ue)))!==Object.prototype&&(Ye=He):tr=!0);var nr=null==Ye||m((function(){var t={};return Ye[Ze].call(t)!==t}));nr&&(Ye={}),nr&&!T(Ye,Ze)&&Q(Ye,Ze,(function(){return this}));var er={IteratorPrototype:Ye,BUGGY_SAFARI_ITERATORS:tr},rr={},or=er.IteratorPrototype,ir=function(){return this},ur=er.IteratorPrototype,ar=er.BUGGY_SAFARI_ITERATORS,cr=pn("iterator"),fr="keys",lr="values",sr="entries",dr=function(){return this},pr=function(t,n,e,r,o,i,u){!function(t,n,e){var r=n+" Iterator";t.prototype=Rt(or,{next:$(1,e)}),Jn(t,r,!1,!0),rr[r]=ir}(e,n,r);var a,c,f,l=function(t){if(t===o&&m)return m;if(!ar&&t in p)return p[t];switch(t){case fr:case lr:case sr:return function(){return new e(this,t)}}return function(){return new e(this)}},s=n+" Iterator",d=!1,p=t.prototype,v=p[cr]||p["@@iterator"]||o&&p[o],m=!ar&&v||l(o),h="Array"==n&&p.entries||v;if(h&&(a=Xe(h.call(new t)),ur!==Object.prototype&&a.next&&(Jn(a,s,!0,!0),rr[s]=dr)),o==lr&&v&&v.name!==lr&&(d=!0,m=function(){return v.call(this)}),u&&p[cr]!==m&&Q(p,cr,m),rr[n]=m,o)if(c={values:l(lr),keys:i?m:l(fr),entries:l(sr)},u)for(f in c)(ar||d||!(f in p))&&Mn(p,f,c[f]);else Z({target:n,proto:!0,forced:ar||d},c);return c},vr=Je.charAt,mr="String Iterator",hr=ce.set,yr=ce.getterFor(mr);pr(String,"String",(function(t){hr(this,{type:mr,string:String(t),index:0})}),(function(){var t,n=yr(this),e=n.string,r=n.index;return r>=e.length?{value:void 0,done:!0}:(t=vr(e,r),n.index+=t.length,{value:t,done:!1})}));var gr="Array Iterator",_r=ce.set,$r=ce.getterFor(gr);pr(Array,"Array",(function(t,n){_r(this,{type:gr,target:S(t),index:0,kind:n})}),(function(){var t=$r(this),n=t.target,e=t.kind,r=t.index++;return!n||r>=n.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==e?{value:r,done:!1}:"values"==e?{value:n[r],done:!1}:{value:[r,n[r]],done:!1}}),"values"),rr.Arguments=rr.Array;var br=pn("toStringTag");for(var wr in{CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}){var xr=v[wr],kr=xr&&xr.prototype;kr&&Hn(kr)!==br&&Q(kr,br,wr),rr[wr]=rr.Array}var Or=Cn.f("iterator");function Sr(t){return(Sr="function"==typeof Ge&&"symbol"==typeof Or?function(t){return typeof t}:function(t){return t&&"function"==typeof Ge&&t.constructor===Ge&&t!==Ge.prototype?"symbol":typeof t})(t)}function Er(t,n){return!n||"object"!==Sr(n)&&"function"!=typeof n?Wt(t):n}var Ar=m((function(){Xe(1)}));Z({target:"Object",stat:!0,forced:Ar,sham:!Ve},{getPrototypeOf:function(t){return Xe(un(t))}});var jr=H.Object.getPrototypeOf,Tr=jr;function Pr(t){return(Pr=Zt?Tr:function(t){return t.__proto__||Tr(t)})(t)}var Rr=pn("iterator"),Br=Array.prototype,Dr=function(t){return void 0!==t&&(rr.Array===t||Br[Rr]===t)},Ir=pn("iterator"),Mr=function(t){if(null!=t)return t[Ir]||t["@@iterator"]||rr[Hn(t)]},Cr=function(t){var n=t.return;if(void 0!==n)return W(n.call(t)).value},Nr=function(t,n){this.stopped=t,this.result=n},Lr=function(t,n,e){var r,o,i,u,a,c,f,l=e&&e.that,s=!(!e||!e.AS_ENTRIES),d=!(!e||!e.IS_ITERATOR),p=!(!e||!e.INTERRUPTED),v=G(n,l,1+s+p),m=function(t){return r&&Cr(r),new Nr(!0,t)},h=function(t){return s?(W(t),p?v(t[0],t[1],m):v(t[0],t[1])):p?v(t,m):v(t)};if(d)r=t;else{if("function"!=typeof(o=Mr(t)))throw TypeError("Target is not iterable");if(Dr(o)){for(i=0,u=ut(t.length);u>i;i++)if((a=h(t[i]))&&a instanceof Nr)return a;return new Nr(!1)}r=o.call(t)}for(c=r.next;!(f=c.call(r)).done;){try{a=h(f.value)}catch(t){throw Cr(r),t}if("object"==typeof a&&a&&a instanceof Nr)return a}return new Nr(!1)},Fr=function(t,n){var e=this;if(!(e instanceof Fr))return new Fr(t,n);Kt&&(e=Kt(new Error(void 0),Xe(e))),void 0!==n&&Q(e,"message",String(n));var r=[];return Lr(t,r.push,{that:r}),Q(e,"errors",r),e};Fr.prototype=Rt(Error.prototype,{constructor:$(5,Fr),message:$(5,""),name:$(5,"AggregateError")}),Z({global:!0},{AggregateError:Fr});var zr=v.Promise,qr=function(t,n,e){for(var r in n)e&&e.unsafe&&t[r]?t[r]=n[r]:Mn(t,r,n[r],e);return t},Yr=pn("species"),Hr=function(t){var n=nt(t),e=V.f;h&&n&&!n[Yr]&&e(n,Yr,{configurable:!0,get:function(){return this}})},Ur=function(t,n,e){if(!(t instanceof n))throw TypeError("Incorrect "+(e?e+" ":"")+"invocation");return t},Gr=pn("iterator"),Wr=!1;try{var Jr=0,Vr={next:function(){return{done:!!Jr++}},return:function(){Wr=!0}};Vr[Gr]=function(){return this},Array.from(Vr,(function(){throw 2}))}catch(t){}var Qr,Kr,Xr,Zr=function(t,n){if(!n&&!Wr)return!1;var e=!1;try{var r={};r[Gr]=function(){return{next:function(){return{done:e=!0}}}},t(r)}catch(t){}return e},to=pn("species"),no=function(t,n){var e,r=W(t).constructor;return void 0===r||null==(e=W(r)[to])?n:U(e)},eo=/(iphone|ipod|ipad).*applewebkit/i.test(hn),ro="process"==w(v.process),oo=v.location,io=v.setImmediate,uo=v.clearImmediate,ao=v.process,co=v.MessageChannel,fo=v.Dispatch,lo=0,so={},po="onreadystatechange",vo=function(t){if(so.hasOwnProperty(t)){var n=so[t];delete so[t],n()}},mo=function(t){return function(){vo(t)}},ho=function(t){vo(t.data)},yo=function(t){v.postMessage(t+"",oo.protocol+"//"+oo.host)};io&&uo||(io=function(t){for(var n=[],e=1;arguments.length>e;)n.push(arguments[e++]);return so[++lo]=function(){("function"==typeof t?t:Function(t)).apply(void 0,n)},Qr(lo),lo},uo=function(t){delete so[t]},ro?Qr=function(t){ao.nextTick(mo(t))}:fo&&fo.now?Qr=function(t){fo.now(mo(t))}:co&&!eo?(Xr=(Kr=new co).port2,Kr.port1.onmessage=ho,Qr=G(Xr.postMessage,Xr,1)):v.addEventListener&&"function"==typeof postMessage&&!v.importScripts&&oo&&"file:"!==oo.protocol&&!m(yo)?(Qr=yo,v.addEventListener("message",ho,!1)):Qr=po in B("script")?function(t){gt.appendChild(B("script")).onreadystatechange=function(){gt.removeChild(this),vo(t)}}:function(t){setTimeout(mo(t),0)});var go,_o,$o,bo,wo,xo,ko,Oo,So={set:io,clear:uo},Eo=/web0s(?!.*chrome)/i.test(hn),Ao=M.f,jo=So.set,To=v.MutationObserver||v.WebKitMutationObserver,Po=v.document,Ro=v.process,Bo=v.Promise,Do=Ao(v,"queueMicrotask"),Io=Do&&Do.value;Io||(go=function(){var t,n;for(ro&&(t=Ro.domain)&&t.exit();_o;){n=_o.fn,_o=_o.next;try{n()}catch(t){throw _o?bo():$o=void 0,t}}$o=void 0,t&&t.enter()},eo||ro||Eo||!To||!Po?Bo&&Bo.resolve?(ko=Bo.resolve(void 0),Oo=ko.then,bo=function(){Oo.call(ko,go)}):bo=ro?function(){Ro.nextTick(go)}:function(){jo.call(v,go)}:(wo=!0,xo=Po.createTextNode(""),new To(go).observe(xo,{characterData:!0}),bo=function(){xo.data=wo=!wo}));var Mo=Io||function(t){var n={fn:t,next:void 0};$o&&($o.next=n),_o||(_o=n,bo()),$o=n},Co=function(t){var n,e;this.promise=new t((function(t,r){if(void 0!==n||void 0!==e)throw TypeError("Bad Promise constructor");n=t,e=r})),this.resolve=U(n),this.reject=U(e)},No={f:function(t){return new Co(t)}},Lo=function(t,n){if(W(t),E(n)&&n.constructor===t)return n;var e=No.f(t);return(0,e.resolve)(n),e.promise},Fo=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},zo=So.set,qo=pn("species"),Yo="Promise",Ho=ce.get,Uo=ce.set,Go=ce.getterFor(Yo),Wo=zr,Jo=v.TypeError,Vo=v.document,Qo=v.process;nt("fetch");var Ko,Xo,Zo,ti=No.f,ni=ti,ei=!!(Vo&&Vo.createEvent&&v.dispatchEvent),ri="function"==typeof PromiseRejectionEvent,oi="unhandledrejection",ii=Y(Yo,(function(){if(!(Zn(Wo)!==String(Wo))){if(66===$n)return!0;if(!ro&&!ri)return!0}if(!Wo.prototype.finally)return!0;if($n>=51&&/native code/.test(Wo))return!1;var t=Wo.resolve(1),n=function(t){t((function(){}),(function(){}))};return(t.constructor={})[qo]=n,!(t.then((function(){}))instanceof n)})),ui=ii||!Zr((function(t){Wo.all(t).catch((function(){}))})),ai=function(t){var n;return!(!E(t)||"function"!=typeof(n=t.then))&&n},ci=function(t,n){if(!t.notified){t.notified=!0;var e=t.reactions;Mo((function(){for(var r=t.value,o=1==t.state,i=0;e.length>i;){var u,a,c,f=e[i++],l=o?f.ok:f.fail,s=f.resolve,d=f.reject,p=f.domain;try{l?(o||(2===t.rejection&&di(t),t.rejection=1),!0===l?u=r:(p&&p.enter(),u=l(r),p&&(p.exit(),c=!0)),u===f.promise?d(Jo("Promise-chain cycle")):(a=ai(u))?a.call(u,s,d):s(u)):d(r)}catch(t){p&&!c&&p.exit(),d(t)}}t.reactions=[],t.notified=!1,n&&!t.rejection&&li(t)}))}},fi=function(t,n,e){var r,o;ei?((r=Vo.createEvent("Event")).promise=n,r.reason=e,r.initEvent(t,!1,!0),v.dispatchEvent(r)):r={promise:n,reason:e},!ri&&(o=v["on"+t])?o(r):t===oi&&function(t,n){var e=v.console;e&&e.error&&(1===arguments.length?e.error(t):e.error(t,n))}("Unhandled promise rejection",e)},li=function(t){zo.call(v,(function(){var n,e=t.facade,r=t.value;if(si(t)&&(n=Fo((function(){ro?Qo.emit("unhandledRejection",r,e):fi(oi,e,r)})),t.rejection=ro||si(t)?2:1,n.error))throw n.value}))},si=function(t){return 1!==t.rejection&&!t.parent},di=function(t){zo.call(v,(function(){var n=t.facade;ro?Qo.emit("rejectionHandled",n):fi("rejectionhandled",n,t.value)}))},pi=function(t,n,e){return function(r){t(n,r,e)}},vi=function(t,n,e){t.done||(t.done=!0,e&&(t=e),t.value=n,t.state=2,ci(t,!0))},mi=function(t,n,e){if(!t.done){t.done=!0,e&&(t=e);try{if(t.facade===n)throw Jo("Promise can't be resolved itself");var r=ai(n);r?Mo((function(){var e={done:!1};try{r.call(n,pi(mi,e,t),pi(vi,e,t))}catch(n){vi(e,n,t)}})):(t.value=n,t.state=1,ci(t,!1))}catch(n){vi({done:!1},n,t)}}};ii&&(Wo=function(t){Ur(this,Wo,Yo),U(t),Ko.call(this);var n=Ho(this);try{t(pi(mi,n),pi(vi,n))}catch(t){vi(n,t)}},(Ko=function(t){Uo(this,{type:Yo,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=qr(Wo.prototype,{then:function(t,n){var e=Go(this),r=ti(no(this,Wo));return r.ok="function"!=typeof t||t,r.fail="function"==typeof n&&n,r.domain=ro?Qo.domain:void 0,e.parent=!0,e.reactions.push(r),0!=e.state&&ci(e,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),Xo=function(){var t=new Ko,n=Ho(t);this.promise=t,this.resolve=pi(mi,n),this.reject=pi(vi,n)},No.f=ti=function(t){return t===Wo||t===Zo?new Xo(t):ni(t)}),Z({global:!0,wrap:!0,forced:ii},{Promise:Wo}),Jn(Wo,Yo,!1,!0),Hr(Yo),Zo=nt(Yo),Z({target:Yo,stat:!0,forced:ii},{reject:function(t){var n=ti(this);return n.reject.call(void 0,t),n.promise}}),Z({target:Yo,stat:!0,forced:_t},{resolve:function(t){return Lo(this===Zo?Wo:this,t)}}),Z({target:Yo,stat:!0,forced:ui},{all:function(t){var n=this,e=ti(n),r=e.resolve,o=e.reject,i=Fo((function(){var e=U(n.resolve),i=[],u=0,a=1;Lr(t,(function(t){var c=u++,f=!1;i.push(void 0),a++,e.call(n,t).then((function(t){f||(f=!0,i[c]=t,--a||r(i))}),o)})),--a||r(i)}));return i.error&&o(i.value),e.promise},race:function(t){var n=this,e=ti(n),r=e.reject,o=Fo((function(){var o=U(n.resolve);Lr(t,(function(t){o.call(n,t).then(e.resolve,r)}))}));return o.error&&r(o.value),e.promise}}),Z({target:"Promise",stat:!0},{allSettled:function(t){var n=this,e=No.f(n),r=e.resolve,o=e.reject,i=Fo((function(){var e=U(n.resolve),o=[],i=0,u=1;Lr(t,(function(t){var a=i++,c=!1;o.push(void 0),u++,e.call(n,t).then((function(t){c||(c=!0,o[a]={status:"fulfilled",value:t},--u||r(o))}),(function(t){c||(c=!0,o[a]={status:"rejected",reason:t},--u||r(o))}))})),--u||r(o)}));return i.error&&o(i.value),e.promise}});var hi="No one promise resolved";Z({target:"Promise",stat:!0},{any:function(t){var n=this,e=No.f(n),r=e.resolve,o=e.reject,i=Fo((function(){var e=U(n.resolve),i=[],u=0,a=1,c=!1;Lr(t,(function(t){var f=u++,l=!1;i.push(void 0),a++,e.call(n,t).then((function(t){l||c||(c=!0,r(t))}),(function(t){l||c||(l=!0,i[f]=t,--a||o(new(nt("AggregateError"))(i,hi)))}))})),--a||o(new(nt("AggregateError"))(i,hi))}));return i.error&&o(i.value),e.promise}});var yi=!!zr&&m((function(){zr.prototype.finally.call({then:function(){}},(function(){}))}));Z({target:"Promise",proto:!0,real:!0,forced:yi},{finally:function(t){var n=no(this,nt("Promise")),e="function"==typeof t;return this.then(e?function(e){return Lo(n,t()).then((function(){return e}))}:t,e?function(e){return Lo(n,t()).then((function(){throw e}))}:t)}});var gi=H.Promise;Z({target:"Promise",stat:!0},{try:function(t){var n=No.f(this),e=Fo(t);return(e.error?n.reject:n.resolve)(e.value),n.promise}});var _i=gi;function $i(t,n,e,r,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void e(t)}a.done?n(c):_i.resolve(c).then(r,o)}Z({target:"Array",stat:!0},{isArray:on});var bi=H.Array.isArray,wi=bi;var xi=pn("iterator"),ki=function(t){var n=Object(t);return void 0!==n[xi]||"@@iterator"in n||rr.hasOwnProperty(Hn(n))},Oi=function(t){var n=Mr(t);if("function"!=typeof n)throw TypeError(String(t)+" is not iterable");return W(n.call(t))},Si=Oi;var Ei=Object.defineProperty,Ai={},ji=function(t){throw t},Ti=function(t,n){if(T(Ai,t))return Ai[t];n||(n={});var e=[][t],r=!!T(n,"ACCESSORS")&&n.ACCESSORS,o=T(n,0)?n[0]:ji,i=T(n,1)?n[1]:void 0;return Ai[t]=!!e&&!m((function(){if(r&&!h)return!0;var t={length:-1};r?Ei(t,1,{enumerable:!0,get:ji}):t[1]=1,e.call(t,o,i)}))},Pi=wn("slice"),Ri=Ti("slice",{ACCESSORS:!0,0:0,1:2}),Bi=pn("species"),Di=[].slice,Ii=Math.max;Z({target:"Array",proto:!0,forced:!Pi||!Ri},{slice:function(t,n){var e,r,o,i=S(this),u=ut(i.length),a=ft(t,u),c=ft(void 0===n?u:n,u);if(on(i)&&("function"!=typeof(e=i.constructor)||e!==Array&&!on(e.prototype)?E(e)&&null===(e=e[Bi])&&(e=void 0):e=void 0,e===Array||void 0===e))return Di.call(i,a,c);for(r=new(void 0===e?Array:e)(Ii(c-a,0)),o=0;a<c;a++,o++)a in i&&an(r,o,i[a]);return r.length=o,r}});var Mi=function(t){return H[t+"Prototype"]},Ci=Mi("Array").slice,Ni=Array.prototype,Li=function(t){var n=t.slice;return t===Ni||t instanceof Array&&n===Ni.slice?Ci:n},Fi=Li,zi=function(t,n,e,r){try{return r?n(W(e)[0],e[1]):n(e)}catch(n){throw Cr(t),n}},qi=!Zr((function(t){Array.from(t)}));Z({target:"Array",stat:!0,forced:qi},{from:function(t){var n,e,r,o,i,u,a=un(t),c="function"==typeof this?this:Array,f=arguments.length,l=f>1?arguments[1]:void 0,s=void 0!==l,d=Mr(a),p=0;if(s&&(l=G(l,f>2?arguments[2]:void 0,2)),null==d||c==Array&&Dr(d))for(e=new c(n=ut(a.length));n>p;p++)u=s?l(a[p],p):a[p],an(e,p,u);else for(i=(o=d.call(a)).next,e=new c;!(r=i.call(o)).done;p++)u=s?zi(o,l,[r.value,p],!0):r.value,an(e,p,u);return e.length=p,e}});var Yi=H.Array.from,Hi=Yi;function Ui(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}function Gi(t,n){var e;if(t){if("string"==typeof t)return Ui(t,n);var r=Fi(e=Object.prototype.toString.call(t)).call(e,8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Hi(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ui(t,n):void 0}}function Wi(t,n){return function(t){if(wi(t))return t}(t)||function(t,n){if(void 0!==Ge&&ki(Object(t))){var e=[],r=!0,o=!1,i=void 0;try{for(var u,a=Si(t);!(r=(u=a.next()).done)&&(e.push(u.value),!n||e.length!==n);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return e}}(t,n)||Gi(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Ji=qe,Vi=Yt,Qi=Vt,Ki=jr,Xi=function(t,n){var e=[][t];return!!e&&m((function(){e.call(null,n||function(){throw 1},1)}))},Zi=se.forEach,tu=Xi("forEach"),nu=Ti("forEach"),eu=tu&&nu?[].forEach:function(t){return Zi(this,t,arguments.length>1?arguments[1]:void 0)};Z({target:"Array",proto:!0,forced:[].forEach!=eu},{forEach:eu});var ru=Mi("Array").forEach,ou=Array.prototype,iu={DOMTokenList:!0,NodeList:!0},uu=function(t){var n=t.forEach;return t===ou||t instanceof Array&&n===ou.forEach||iu.hasOwnProperty(Hn(t))?ru:n},au=Xt,cu=gi,fu=[].reverse,lu=[1,2];Z({target:"Array",proto:!0,forced:String(lu)===String(lu.reverse())},{reverse:function(){return on(this)&&(this.length=this.length),fu.call(this)}});var su=Mi("Array").reverse,du=Array.prototype,pu=function(t){var n=t.reverse;return t===du||t instanceof Array&&n===du.reverse?su:n},vu=Li,mu=s((function(t){var n=function(t){var n,e=Object.prototype,r=e.hasOwnProperty,o="function"==typeof Ji?Ji:{},i=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function c(t,n,e){return Vi(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[n]}try{c({},"")}catch(t){c=function(t,n,e){return t[n]=e}}function f(t,n,e,r){var o=n&&n.prototype instanceof h?n:h,i=Qi(o.prototype),u=new E(r||[]);return i._invoke=function(t,n,e){var r=s;return function(o,i){if(r===p)throw new Error("Generator is already running");if(r===v){if("throw"===o)throw i;return j()}for(e.method=o,e.arg=i;;){var u=e.delegate;if(u){var a=k(u,e);if(a){if(a===m)continue;return a}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(r===s)throw r=v,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);r=p;var c=l(t,n,e);if("normal"===c.type){if(r=e.done?v:d,c.arg===m)continue;return{value:c.arg,done:e.done}}"throw"===c.type&&(r=v,e.method="throw",e.arg=c.arg)}}}(t,e,u),i}function l(t,n,e){try{return{type:"normal",arg:t.call(n,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var s="suspendedStart",d="suspendedYield",p="executing",v="completed",m={};function h(){}function y(){}function g(){}var _={};_[i]=function(){return this};var $=Ki&&Ki(Ki(A([])));$&&$!==e&&r.call($,i)&&(_=$);var b=g.prototype=h.prototype=Qi(_);function w(t){var n;uu(n=["next","throw","return"]).call(n,(function(n){c(t,n,(function(t){return this._invoke(n,t)}))}))}function x(t,n){function e(o,i,u,a){var c=l(t[o],t,i);if("throw"!==c.type){var f=c.arg,s=f.value;return s&&"object"===Sr(s)&&r.call(s,"__await")?n.resolve(s.__await).then((function(t){e("next",t,u,a)}),(function(t){e("throw",t,u,a)})):n.resolve(s).then((function(t){f.value=t,u(f)}),(function(t){return e("throw",t,u,a)}))}a(c.arg)}var o;this._invoke=function(t,r){function i(){return new n((function(n,o){e(t,r,n,o)}))}return o=o?o.then(i,i):i()}}function k(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,k(t,e),"throw"===e.method))return m;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var o=l(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,m;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,m):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function O(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function S(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function E(t){this.tryEntries=[{tryLoc:"root"}],uu(t).call(t,O,this),this.reset(!0)}function A(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,u=function e(){for(;++o<t.length;)if(r.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=n,e.done=!0,e};return u.next=u}}return{next:j}}function j(){return{value:n,done:!0}}return y.prototype=b.constructor=g,g.constructor=y,y.displayName=c(g,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var n="function"==typeof t&&t.constructor;return!!n&&(n===y||"GeneratorFunction"===(n.displayName||n.name))},t.mark=function(t){return au?au(t,g):(t.__proto__=g,c(t,a,"GeneratorFunction")),t.prototype=Qi(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),x.prototype[u]=function(){return this},t.AsyncIterator=x,t.async=function(n,e,r,o,i){void 0===i&&(i=cu);var u=new x(f(n,e,r,o),i);return t.isGeneratorFunction(e)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},w(b),c(b,a,"Generator"),b[i]=function(){return this},b.toString=function(){return"[object Generator]"},t.keys=function(t){var n=[];for(var e in t)n.push(e);return pu(n).call(n),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=A,E.prototype={constructor:E,reset:function(t){var e;if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,uu(e=this.tryEntries).call(e,S),!t)for(var o in this)"t"===o.charAt(0)&&r.call(this,o)&&!isNaN(+vu(o).call(o,1))&&(this[o]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(r,o){return a.type="throw",a.arg=t,e.next=r,o&&(e.method="next",e.arg=n),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=r.call(u,"catchLoc"),f=r.call(u,"finallyLoc");if(c&&f){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(t,n){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=n&&n<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=n,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(u)},complete:function(t,n){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&n&&(this.next=n),m},finish:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var e=this.tryEntries[n];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),S(e),m}},catch:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var e=this.tryEntries[n];if(e.tryLoc===t){var r=e.completion;if("throw"===r.type){var o=r.arg;S(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:A(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),m}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}})),hu=Mr,yu=bi;Z({target:"Reflect",stat:!0},{get:function t(n,e){var r,o,i=arguments.length<3?n:arguments[2];return W(n)===i?n[e]:(r=M.f(n,e))?T(r,"value")?r.value:void 0===r.get?void 0:r.get.call(i):E(o=Xe(n))?t(o,e,i):void 0}}),H.Reflect.get;var gu=M.f,_u=m((function(){gu(1)}));Z({target:"Object",stat:!0,forced:!h||_u,sham:!h},{getOwnPropertyDescriptor:function(t,n){return gu(S(t),n)}});var $u=s((function(t){var n=H.Object,e=t.exports=function(t,e){return n.getOwnPropertyDescriptor(t,e)};n.getOwnPropertyDescriptor.sham&&(e.sham=!0)})),bu=!m((function(){return Object.isExtensible(Object.preventExtensions({}))})),wu=s((function(t){var n=V.f,e=Ot("meta"),r=0,o=Object.isExtensible||function(){return!0},i=function(t){n(t,e,{value:{objectID:"O"+ ++r,weakData:{}}})},u=t.exports={REQUIRED:!1,fastKey:function(t,n){if(!E(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!T(t,e)){if(!o(t))return"F";if(!n)return"E";i(t)}return t[e].objectID},getWeakData:function(t,n){if(!T(t,e)){if(!o(t))return!0;if(!n)return!1;i(t)}return t[e].weakData},onFreeze:function(t){return bu&&u.REQUIRED&&o(t)&&!T(t,e)&&i(t),t}};dt[e]=!0})),xu=V.f,ku=se.forEach,Ou=ce.set,Su=ce.getterFor,Eu=function(t,n,e){var r,o=-1!==t.indexOf("Map"),i=-1!==t.indexOf("Weak"),u=o?"set":"add",a=v[t],c=a&&a.prototype,f={};if(h&&"function"==typeof a&&(i||c.forEach&&!m((function(){(new a).entries().next()})))){r=n((function(n,e){Ou(Ur(n,r,t),{type:t,collection:new a}),null!=e&&Lr(e,n[u],{that:n,AS_ENTRIES:o})}));var l=Su(t);ku(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(t){var n="add"==t||"set"==t;!(t in c)||i&&"clear"==t||Q(r.prototype,t,(function(e,r){var o=l(this).collection;if(!n&&i&&!E(e))return"get"==t&&void 0;var u=o[t](0===e?0:e,r);return n?this:u}))})),i||xu(r.prototype,"size",{configurable:!0,get:function(){return l(this).collection.size}})}else r=e.getConstructor(n,t,o,u),wu.REQUIRED=!0;return Jn(r,t,!1,!0),f[t]=r,Z({global:!0,forced:!0},f),i||e.setStrong(r,t,o),r},Au=V.f,ju=wu.fastKey,Tu=ce.set,Pu=ce.getterFor,Ru={getConstructor:function(t,n,e,r){var o=t((function(t,i){Ur(t,o,n),Tu(t,{type:n,index:Rt(null),first:void 0,last:void 0,size:0}),h||(t.size=0),null!=i&&Lr(i,t[r],{that:t,AS_ENTRIES:e})})),i=Pu(n),u=function(t,n,e){var r,o,u=i(t),c=a(t,n);return c?c.value=e:(u.last=c={index:o=ju(n,!0),key:n,value:e,previous:r=u.last,next:void 0,removed:!1},u.first||(u.first=c),r&&(r.next=c),h?u.size++:t.size++,"F"!==o&&(u.index[o]=c)),t},a=function(t,n){var e,r=i(t),o=ju(n);if("F"!==o)return r.index[o];for(e=r.first;e;e=e.next)if(e.key==n)return e};return qr(o.prototype,{clear:function(){for(var t=i(this),n=t.index,e=t.first;e;)e.removed=!0,e.previous&&(e.previous=e.previous.next=void 0),delete n[e.index],e=e.next;t.first=t.last=void 0,h?t.size=0:this.size=0},delete:function(t){var n=this,e=i(n),r=a(n,t);if(r){var o=r.next,u=r.previous;delete e.index[r.index],r.removed=!0,u&&(u.next=o),o&&(o.previous=u),e.first==r&&(e.first=o),e.last==r&&(e.last=u),h?e.size--:n.size--}return!!r},forEach:function(t){for(var n,e=i(this),r=G(t,arguments.length>1?arguments[1]:void 0,3);n=n?n.next:e.first;)for(r(n.value,n.key,this);n&&n.removed;)n=n.previous},has:function(t){return!!a(this,t)}}),qr(o.prototype,e?{get:function(t){var n=a(this,t);return n&&n.value},set:function(t,n){return u(this,0===t?0:t,n)}}:{add:function(t){return u(this,t=0===t?0:t,t)}}),h&&Au(o.prototype,"size",{get:function(){return i(this).size}}),o},setStrong:function(t,n,e){var r=n+" Iterator",o=Pu(n),i=Pu(r);pr(t,n,(function(t,n){Tu(this,{type:r,target:t,state:o(t),kind:n,last:void 0})}),(function(){for(var t=i(this),n=t.kind,e=t.last;e&&e.removed;)e=e.previous;return t.target&&(t.last=e=e?e.next:t.state.first)?"keys"==n?{value:e.key,done:!1}:"values"==n?{value:e.value,done:!1}:{value:[e.key,e.value],done:!1}:(t.target=void 0,{value:void 0,done:!0})}),e?"entries":"values",!e,!0),Hr(n)}};Eu("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),Ru);var Bu=H.Map;Z({target:"Map",stat:!0},{from:function(t){var n,e,r,o,i=arguments.length,u=i>1?arguments[1]:void 0;return U(this),(n=void 0!==u)&&U(u),null==t?new this:(e=[],n?(r=0,o=G(u,i>2?arguments[2]:void 0,2),Lr(t,(function(t){e.push(o(t,r++))}))):Lr(t,e.push,{that:e}),new this(e))}});Z({target:"Map",stat:!0},{of:function(){for(var t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return new this(n)}});var Du=function(){for(var t,n=W(this),e=U(n.delete),r=!0,o=0,i=arguments.length;o<i;o++)t=e.call(n,arguments[o]),r=r&&t;return!!r};Z({target:"Map",proto:!0,real:!0,forced:_t},{deleteAll:function(){return Du.apply(this,arguments)}});Z({target:"Map",proto:!0,real:!0,forced:_t},{emplace:function(t,n){var e=W(this),r=e.has(t)&&"update"in n?n.update(e.get(t),t,e):n.insert(t,e);return e.set(t,r),r}});var Iu=Oi;Z({target:"Map",proto:!0,real:!0,forced:_t},{every:function(t){var n=W(this),e=Iu(n),r=G(t,arguments.length>1?arguments[1]:void 0,3);return!Lr(e,(function(t,e,o){if(!r(e,t,n))return o()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{filter:function(t){var n=W(this),e=Iu(n),r=G(t,arguments.length>1?arguments[1]:void 0,3),o=new(no(n,nt("Map"))),i=U(o.set);return Lr(e,(function(t,e){r(e,t,n)&&i.call(o,t,e)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),o}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{find:function(t){var n=W(this),e=Iu(n),r=G(t,arguments.length>1?arguments[1]:void 0,3);return Lr(e,(function(t,e,o){if(r(e,t,n))return o(e)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{findKey:function(t){var n=W(this),e=Iu(n),r=G(t,arguments.length>1?arguments[1]:void 0,3);return Lr(e,(function(t,e,o){if(r(e,t,n))return o(t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),Z({target:"Map",stat:!0},{groupBy:function(t,n){var e=new this;U(n);var r=U(e.has),o=U(e.get),i=U(e.set);return Lr(t,(function(t){var u=n(t);r.call(e,u)?o.call(e,u).push(t):i.call(e,u,[t])})),e}});Z({target:"Map",proto:!0,real:!0,forced:_t},{includes:function(t){return Lr(Iu(W(this)),(function(n,e,r){if((o=e)===(i=t)||o!=o&&i!=i)return r();var o,i}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),Z({target:"Map",stat:!0},{keyBy:function(t,n){var e=new this;U(n);var r=U(e.set);return Lr(t,(function(t){r.call(e,n(t),t)})),e}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{keyOf:function(t){return Lr(Iu(W(this)),(function(n,e,r){if(e===t)return r(n)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{mapKeys:function(t){var n=W(this),e=Iu(n),r=G(t,arguments.length>1?arguments[1]:void 0,3),o=new(no(n,nt("Map"))),i=U(o.set);return Lr(e,(function(t,e){i.call(o,r(e,t,n),e)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),o}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{mapValues:function(t){var n=W(this),e=Iu(n),r=G(t,arguments.length>1?arguments[1]:void 0,3),o=new(no(n,nt("Map"))),i=U(o.set);return Lr(e,(function(t,e){i.call(o,t,r(e,t,n))}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),o}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{merge:function(t){for(var n=W(this),e=U(n.set),r=0;r<arguments.length;)Lr(arguments[r++],e,{that:n,AS_ENTRIES:!0});return n}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{reduce:function(t){var n=W(this),e=Iu(n),r=arguments.length<2,o=r?void 0:arguments[1];if(U(t),Lr(e,(function(e,i){r?(r=!1,o=i):o=t(o,i,e,n)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),r)throw TypeError("Reduce of empty map with no initial value");return o}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{some:function(t){var n=W(this),e=Iu(n),r=G(t,arguments.length>1?arguments[1]:void 0,3);return Lr(e,(function(t,e,o){if(r(e,t,n))return o()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{update:function(t,n){var e=W(this),r=arguments.length;U(n);var o=e.has(t);if(!o&&r<3)throw TypeError("Updating absent value");var i=o?e.get(t):U(r>2?arguments[2]:void 0)(t,e);return e.set(t,n(i,t,e)),e}});var Mu=function(t,n){var e,r=W(this),o=arguments.length>2?arguments[2]:void 0;if("function"!=typeof n&&"function"!=typeof o)throw TypeError("At least one callback required");return r.has(t)?(e=r.get(t),"function"==typeof n&&(e=n(e),r.set(t,e))):"function"==typeof o&&(e=o(),r.set(t,e)),e};Z({target:"Map",proto:!0,real:!0,forced:_t},{upsert:Mu}),Z({target:"Map",proto:!0,real:!0,forced:_t},{updateOrInsert:Mu});var Cu=st.indexOf,Nu=[].indexOf,Lu=!!Nu&&1/[1].indexOf(1,-0)<0,Fu=Xi("indexOf"),zu=Ti("indexOf",{ACCESSORS:!0,1:0});Z({target:"Array",proto:!0,forced:Lu||!Fu||!zu},{indexOf:function(t){return Lu?Nu.apply(this,arguments)||0:Cu(this,t,arguments.length>1?arguments[1]:void 0)}});var qu=Mi("Array").indexOf,Yu=Array.prototype,Hu=function(t){var n=t.indexOf;return t===Yu||t instanceof Array&&n===Yu.indexOf?qu:n},Uu=Hu;function Gu(t){return function(t){if(wi(t))return Ui(t)}(t)||function(t){if(void 0!==Ge&&ki(Object(t)))return Hi(t)}(t)||Gi(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}Z({target:"Function",proto:!0},{bind:Mt}),Mi("Function").bind;var Wu=m((function(){ht(1)}));Z({target:"Object",stat:!0,forced:Wu},{keys:function(t){return ht(un(t))}});var Ju=H.Object.keys,Vu=Ju;Eu("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),Ru);var Qu=H.Set,Ku=Mi("Array").concat,Xu=Array.prototype,Zu=function(t){var n=t.concat;return t===Xu||t instanceof Array&&n===Xu.concat?Ku:n};Z({target:"Date",stat:!0},{now:function(){return(new Date).getTime()}});var ta=H.Date.now,na=Hu,ea=nt("Reflect","ownKeys")||function(t){var n=Tn.f(W(t)),e=In.f;return e?n.concat(e(t)):n};Z({target:"Object",stat:!0,sham:!h},{getOwnPropertyDescriptors:function(t){for(var n,e,r=S(t),o=M.f,i=ea(r),u={},a=0;i.length>a;)void 0!==(e=o(r,n=i[a++]))&&an(u,n,e);return u}});var ra=H.Object.getOwnPropertyDescriptors,oa=Yi,ia=wn("splice"),ua=Ti("splice",{ACCESSORS:!0,0:0,1:2}),aa=Math.max,ca=Math.min,fa=9007199254740991,la="Maximum allowed length exceeded";Z({target:"Array",proto:!0,forced:!ia||!ua},{splice:function(t,n){var e,r,o,i,u,a,c=un(this),f=ut(c.length),l=ft(t,f),s=arguments.length;if(0===s?e=r=0:1===s?(e=0,r=f-l):(e=s-2,r=ca(aa(ot(n),0),f-l)),f+e-r>fa)throw TypeError(la);for(o=mn(c,r),i=0;i<r;i++)(u=l+i)in c&&an(o,i,c[u]);if(o.length=r,e<r){for(i=l;i<f-r;i++)a=i+e,(u=i+r)in c?c[a]=c[u]:delete c[a];for(i=f;i>f-r+e;i--)delete c[i-1]}else if(e>r)for(i=f-r;i>l;i--)a=i+e-1,(u=i+r-1)in c?c[a]=c[u]:delete c[a];for(i=0;i<e;i++)c[i+l]=arguments[i+2];return c.length=f-r+e,o}});var sa=Mi("Array").splice,da=Array.prototype,pa=function(t){var n=t.splice;return t===da||t instanceof Array&&n===da.splice?sa:n},va=se.map,ma=wn("map"),ha=Ti("map");Z({target:"Array",proto:!0,forced:!ma||!ha},{map:function(t){return va(this,t,arguments.length>1?arguments[1]:void 0)}});var ya=Mi("Array").map,ga=Array.prototype,_a=function(t){var n=t.map;return t===ga||t instanceof Array&&n===ga.map?ya:n},$a=se.filter,ba=wn("filter"),wa=Ti("filter");Z({target:"Array",proto:!0,forced:!ba||!wa},{filter:function(t){return $a(this,t,arguments.length>1?arguments[1]:void 0)}});var xa=Mi("Array").filter,ka=Array.prototype,Oa=function(t){var n=t.filter;return t===ka||t instanceof Array&&n===ka.filter?xa:n},Sa=Bu,Ea=Object.assign,Aa=Object.defineProperty,ja=!Ea||m((function(){if(h&&1!==Ea({b:1},Ea(Aa({},"a",{enumerable:!0,get:function(){Aa(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},n={},e=Symbol(),r="abcdefghijklmnopqrst";return t[e]=7,r.split("").forEach((function(t){n[t]=t})),7!=Ea({},t)[e]||ht(Ea({},n)).join("")!=r}))?function(t,n){for(var e=un(t),r=arguments.length,o=1,i=In.f,u=_.f;r>o;)for(var a,c=k(arguments[o++]),f=i?ht(c).concat(i(c)):ht(c),l=f.length,s=0;l>s;)a=f[s++],h&&!u.call(c,a)||(e[a]=c[a]);return e}:Ea;Z({target:"Object",stat:!0,forced:Object.assign!==ja},{assign:ja}),H.Object.assign;var Ta=nt("JSON","stringify"),Pa=/[\uD800-\uDFFF]/g,Ra=/^[\uD800-\uDBFF]$/,Ba=/^[\uDC00-\uDFFF]$/,Da=function(t,n,e){var r=e.charAt(n-1),o=e.charAt(n+1);return Ra.test(t)&&!Ba.test(o)||Ba.test(t)&&!Ra.test(r)?"\\u"+t.charCodeAt(0).toString(16):t},Ia=m((function(){return'"\\udf06\\ud834"'!==Ta("\udf06\ud834")||'"\\udead"'!==Ta("\udead")}));Ta&&Z({target:"JSON",stat:!0,forced:Ia},{stringify:function(t,n,e){var r=Ta.apply(null,arguments);return"string"==typeof r?r.replace(Pa,Da):r}}),H.JSON||(H.JSON={stringify:JSON.stringify});var Ma=function(t,n,e){return H.JSON.stringify.apply(null,arguments)};Z({target:"Array",proto:!0},{fill:function(t){for(var n=un(this),e=ut(n.length),r=arguments.length,o=ft(r>1?arguments[1]:void 0,e),i=r>2?arguments[2]:void 0,u=void 0===i?e:ft(i,e);u>o;)n[o++]=t;return n}});var Ca=Mi("Array").fill,Na=Array.prototype,La=function(t){var n=t.fill;return t===Na||t instanceof Array&&n===Na.fill?Ca:n};function Fa(){}var za=function(t){return t};function qa(t,n){for(var e in n)t[e]=n[e];return t}function Ya(t){return t()}function Ha(){return Qi(null)}function Ua(t){uu(t).call(t,Ya)}function Ga(t){return"function"==typeof t}function Wa(t,n){return t!=t?n==n:t!==n||t&&"object"===Sr(t)||"function"==typeof t}function Ja(t){if(null==t)return Fa;for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];var o=t.subscribe.apply(t,e);return o.unsubscribe?function(){return o.unsubscribe()}:o}function Va(t,n,e){t.$$.on_destroy.push(Ja(n,e))}function Qa(t,n,e,r){if(t){var o=Ka(t,n,e,r);return t[0](o)}}function Ka(t,n,e,r){var o;return t[1]&&r?qa(vu(o=e.ctx).call(o),t[1](r(n))):e.ctx}function Xa(t,n,e,r,o,i,u){var a=function(t,n,e,r){if(t[2]&&r){var o=t[2](r(e));if(void 0===n.dirty)return o;if("object"===Sr(o)){for(var i=[],u=Math.max(n.dirty.length,o.length),a=0;a<u;a+=1)i[a]=n.dirty[a]|o[a];return i}return n.dirty|o}return n.dirty}(n,r,o,i);if(a){var c=Ka(n,e,r,u);t.p(c,a)}}function Za(t,n){var e={};for(var r in n=new Qu(n),t)n.has(r)||"$"===r[0]||(e[r]=t[r]);return e}function tc(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n;return t.set(e),n}function nc(t){return t&&Ga(t.destroy)?t.destroy:Fa}var ec="undefined"!=typeof window,rc=ec?function(){return window.performance.now()}:function(){return ta()},oc=ec?function(t){return requestAnimationFrame(t)}:Fa,ic=new Qu;function uc(t){uu(ic).call(ic,(function(n){n.c(t)||(ic.delete(n),n.f())})),0!==ic.size&&oc(uc)}function ac(t,n){t.appendChild(n)}function cc(t,n,e){t.insertBefore(n,e||null)}function fc(t){t.parentNode.removeChild(t)}function lc(t,n){for(var e=0;e<t.length;e+=1)t[e]&&t[e].d(n)}function sc(t){return document.createElement(t)}function dc(t){return document.createTextNode(t)}function pc(){return dc(" ")}function vc(){return dc("")}function mc(t,n,e,r){return t.addEventListener(n,e,r),function(){return t.removeEventListener(n,e,r)}}function hc(t){return function(n){return n.preventDefault(),t.call(this,n)}}function yc(t,n,e){null==e?t.removeAttribute(n):t.getAttribute(n)!==e&&t.setAttribute(n,e)}function gc(t,n){var e=ra(t.__proto__);for(var r in n)null==n[r]?t.removeAttribute(r):"style"===r?t.style.cssText=n[r]:"__value"===r?t.value=t[r]=n[r]:e[r]&&e[r].set?t[r]=n[r]:yc(t,r,n[r])}function _c(t,n,e){for(var r=new Qu,o=0;o<t.length;o+=1)t[o].checked&&r.add(t[o].__value);return e||r.delete(n),oa(r)}function $c(t){return""===t?null:+t}function bc(t){return oa(t.childNodes)}function wc(t,n){n=""+n,t.wholeText!==n&&(t.data=n)}function xc(t,n){t.value=null==n?"":n}function kc(t,n,e,r){t.style.setProperty(n,e,r?"important":"")}function Oc(t,n){for(var e=0;e<t.options.length;e+=1){var r=t.options[e];if(r.__value===n)return void(r.selected=!0)}}function Sc(t){var n=t.querySelector(":checked")||t.options[0];return n&&n.__value}function Ec(t,n,e){t.classList[e?"add":"remove"](n)}function Ac(t,n){var e=document.createEvent("CustomEvent");return e.initCustomEvent(t,!1,!1,n),e}var jc,Tc=new Qu,Pc=0;function Rc(t){for(var n=5381,e=t.length;e--;)n=(n<<5)-n^t.charCodeAt(e);return n>>>0}function Bc(t,n){var e=(t.style.animation||"").split(", "),r=Oa(e).call(e,n?function(t){return na(t).call(t,n)<0}:function(t){return-1===na(t).call(t,"__svelte")}),o=e.length-r.length;o&&(t.style.animation=r.join(", "),(Pc-=o)||oc((function(){Pc||(uu(Tc).call(Tc,(function(t){for(var n=t.__svelte_stylesheet,e=n.cssRules.length;e--;)n.deleteRule(e);t.__svelte_rules={}})),Tc.clear())})))}function Dc(t){jc=t}function Ic(){if(!jc)throw new Error("Function called outside component initialization");return jc}function Mc(t){Ic().$$.on_mount.push(t)}var Cc=[],Nc=[],Lc=[],Fc=[],zc=cu.resolve(),qc=!1;function Yc(){qc||(qc=!0,zc.then(Qc))}function Hc(){return Yc(),zc}function Uc(t){Lc.push(t)}function Gc(t){Fc.push(t)}var Wc,Jc=!1,Vc=new Qu;function Qc(){if(!Jc){Jc=!0;do{for(var t=0;t<Cc.length;t+=1){var n=Cc[t];Dc(n),Kc(n.$$)}for(Dc(null),Cc.length=0;Nc.length;)Nc.pop()();for(var e=0;e<Lc.length;e+=1){var r=Lc[e];Vc.has(r)||(Vc.add(r),r())}Lc.length=0}while(Cc.length);for(;Fc.length;)Fc.pop()();qc=!1,Jc=!1,Vc.clear()}}function Kc(t){if(null!==t.fragment){var n;t.update(),Ua(t.before_update);var e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),uu(n=t.after_update).call(n,Uc)}}function Xc(t,n,e){var r;t.dispatchEvent(Ac(Zu(r="".concat(n?"intro":"outro")).call(r,e)))}var Zc,tf=new Qu;function nf(){Zc={r:0,c:[],p:Zc}}function ef(){Zc.r||Ua(Zc.c),Zc=Zc.p}function rf(t,n){t&&t.i&&(tf.delete(t),t.i(n))}function of(t,n,e,r){if(t&&t.o){if(tf.has(t))return;tf.add(t),Zc.c.push((function(){tf.delete(t),r&&(e&&t.d(1),r())})),t.o(n)}}var uf={duration:0};function af(t,n,e){var r,o,i=n(t,e),u=!1,a=0;function c(){r&&Bc(t,r)}function f(){var n=i||uf,e=n.delay,f=void 0===e?0:e,l=n.duration,s=void 0===l?300:l,d=n.easing,p=void 0===d?za:d,v=n.tick,m=void 0===v?Fa:v,h=n.css;h&&(r=function(t,n,e,r,o,i,u){for(var a,c,f,l,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,d=16.666/r,p="{\n",v=0;v<=1;v+=d){var m=n+(e-n)*i(v);p+=100*v+"%{".concat(u(m,1-m),"}\n")}var h=p+"100% {".concat(u(e,1-e),"}\n}"),y=Zu(a="__svelte_".concat(Rc(h),"_")).call(a,s),g=t.ownerDocument;Tc.add(g);var _,$=g.__svelte_stylesheet||(g.__svelte_stylesheet=g.head.appendChild(sc("style")).sheet),b=g.__svelte_rules||(g.__svelte_rules={});b[y]||(b[y]=!0,$.insertRule(Zu(_="@keyframes ".concat(y," ")).call(_,h),$.cssRules.length));var w=t.style.animation||"";return t.style.animation=Zu(c=Zu(f=Zu(l="".concat(w?"".concat(w,", "):"")).call(l,y," ")).call(f,r,"ms linear ")).call(c,o,"ms 1 both"),Pc+=1,y}(t,0,1,s,f,p,h,a++)),m(0,1);var y=rc()+f,g=y+s;o&&o.abort(),u=!0,Uc((function(){return Xc(t,!0,"start")})),o=function(t){var n;return 0===ic.size&&oc(uc),{promise:new cu((function(e){ic.add(n={c:t,f:e})})),abort:function(){ic.delete(n)}}}((function(n){if(u){if(n>=g)return m(1,0),Xc(t,!0,"end"),c(),u=!1;if(n>=y){var e=p((n-y)/s);m(e,1-e)}}return u}))}var l=!1;return{start:function(){l||(Bc(t),Ga(i)?(i=i(),(Wc||(Wc=cu.resolve()).then((function(){Wc=null})),Wc).then(f)):f())},invalidate:function(){l=!1},end:function(){u&&(c(),u=!1)}}}function cf(t,n,e){var r=t.$$.props[n];void 0!==r&&(t.$$.bound[r]=e,e(t.$$.ctx[r]))}function ff(t){t&&t.c()}function lf(t,n,e,r){var o=t.$$,i=o.fragment,u=o.on_mount,a=o.on_destroy,c=o.after_update;i&&i.m(n,e),r||Uc((function(){var n,e=Oa(n=_a(u).call(u,Ya)).call(n,Ga);a?a.push.apply(a,Gu(e)):Ua(e),t.$$.on_mount=[]})),uu(c).call(c,Uc)}function sf(t,n){var e=t.$$;null!==e.fragment&&(Ua(e.on_destroy),e.fragment&&e.fragment.d(n),e.on_destroy=e.fragment=null,e.ctx=[])}function df(t,n){var e;-1===t.$$.dirty[0]&&(Cc.push(t),Yc(),La(e=t.$$.dirty).call(e,0));t.$$.dirty[n/31|0]|=1<<n%31}function pf(t,n,e,r,o,i){var u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:[-1],a=jc;Dc(t);var c=t.$$={fragment:null,ctx:null,props:i,update:Fa,not_equal:o,bound:Ha(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Sa(a?a.$$.context:[]),callbacks:Ha(),dirty:u,skip_bound:!1},f=!1;if(c.ctx=e?e(t,n.props||{},(function(n,e){var r=!(arguments.length<=2)&&arguments.length-2?arguments.length<=2?void 0:arguments[2]:e;return c.ctx&&o(c.ctx[n],c.ctx[n]=r)&&(!c.skip_bound&&c.bound[n]&&c.bound[n](r),f&&df(t,n)),e})):[],c.update(),f=!0,Ua(c.before_update),c.fragment=!!r&&r(c.ctx),n.target){if(n.hydrate){var l=bc(n.target);c.fragment&&c.fragment.l(l),uu(l).call(l,fc)}else c.fragment&&c.fragment.c();n.intro&&rf(t.$$.fragment),lf(t,n.target,n.anchor,n.customElement),Qc()}Dc(a)}new Qu(["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]);var vf=function(){function t(){qt(this,t)}return Gt(t,[{key:"$destroy",value:function(){sf(this,1),this.$destroy=Fa}},{key:"$on",value:function(t,n){var e=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return e.push(n),function(){var t=na(e).call(e,n);-1!==t&&pa(e).call(e,t,1)}}},{key:"$set",value:function(t){this.$$set&&0!==Vu(t).length&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}]),t}(),mf=H.Object.getOwnPropertySymbols,hf=mf,yf=$u;Z({target:"Object",stat:!0,forced:!h,sham:!h},{defineProperties:yt});var gf=s((function(t){var n=H.Object,e=t.exports=function(t,e){return n.defineProperties(t,e)};n.defineProperties.sham&&(e.sham=!0)}));function _f(t,n,e){return n in t?Ht(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}var $f=[];function bf(t){var n,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fa,r=[];function o(e){if(Wa(t,e)&&(t=e,n)){for(var o=!$f.length,i=0;i<r.length;i+=1){var u=r[i];u[1](),$f.push(u,t)}if(o){for(var a=0;a<$f.length;a+=2)$f[a][0]($f[a+1]);$f.length=0}}}function i(n){o(n(t))}function u(i){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fa,a=[i,u];return r.push(a),1===r.length&&(n=e(o)||Fa),i(t),function(){var t=na(r).call(r,a);-1!==t&&pa(r).call(r,t,1),0===r.length&&(n(),n=null)}}return{set:o,update:i,subscribe:u}}function wf(t,n,e){var r=!yu(t),o=r?[t]:t,i=n.length<2;return{subscribe:bf(e,(function(t){var e=!1,u=[],a=0,c=Fa,f=function(){if(!a){c();var e=n(r?u[0]:u,t);i?t(e):c=Ga(e)?e:Fa}},l=_a(o).call(o,(function(t,n){return Ja(t,(function(t){u[n]=t,a&=~(1<<n),e&&f()}),(function(){a|=1<<n}))}));return e=!0,f(),function(){Ua(l),c()}})).subscribe}}function xf(t,n){var e=Vu(t);if(hf){var r=hf(t);n&&(r=Oa(r).call(r,(function(n){return yf(t,n).enumerable}))),e.push.apply(e,r)}return e}function kf(t){for(var n=1;n<arguments.length;n++){var e,r=null!=arguments[n]?arguments[n]:{};if(n%2)uu(e=xf(Object(r),!0)).call(e,(function(n){_f(t,n,r[n])}));else if(ra)gf(t,ra(r));else{var o;uu(o=xf(Object(r))).call(o,(function(n){Vi(t,n,yf(r,n))}))}}return t}function Of(t,n,e){var r=e,o=!1,i=n.length<2,u=wf(t,(function(t,e){return o=!0,i?(r=n(t,e),e(r)):n(t,(function(t){r=t,e(t)})),function(){o=!1}}),e);return kf(kf({},u),{},{get:function(){return o?r:function(t){var n;return Ja(t,(function(t){return n=t}))(),n}(u)}})}var Sf=mf,Ef=Ju;function Af(t,n){if(null==t)return{};var e,r,o=function(t,n){if(null==t)return{};var e,r,o={},i=Ef(t);for(r=0;r<i.length;r++)e=i[r],Uu(n).call(n,e)>=0||(o[e]=t[e]);return o}(t,n);if(Sf){var i=Sf(t);for(r=0;r<i.length;r++)e=i[r],Uu(n).call(n,e)>=0||Object.prototype.propertyIsEnumerable.call(t,e)&&(o[e]=t[e])}return o}function jf(t,n){var e=Vu(t);if(hf){var r=hf(t);n&&(r=Oa(r).call(r,(function(n){return yf(t,n).enumerable}))),e.push.apply(e,r)}return e}function Tf(t,n){var e=t,r=bf(t,n),o=r.set;return function(t){for(var n=1;n<arguments.length;n++){var e,r=null!=arguments[n]?arguments[n]:{};if(n%2)uu(e=jf(Object(r),!0)).call(e,(function(n){_f(t,n,r[n])}));else if(ra)gf(t,ra(r));else{var o;uu(o=jf(Object(r))).call(o,(function(n){Vi(t,n,yf(r,n))}))}}return t}({set:function(t){e=t,o(t)},get:function(){return e}},Af(r,["set"]))}var Pf=Tf({staff:[],start_time:[],end_time:[],time_interval:900,customers:[],customers_loaded:void 0,week_days:[],customer_gr_def_app_status:[],extras_multiply_nop:void 0}),Rf=[].slice,Bf=/MSIE .\./.test(hn),Df=function(t){return function(n,e){var r=arguments.length>2,o=r?Rf.call(arguments,2):void 0;return t(r?function(){("function"==typeof n?n:Function(n)).apply(this,o)}:n,e)}};Z({global:!0,bind:!0,forced:Bf},{setTimeout:Df(v.setTimeout),setInterval:Df(v.setInterval)});var If=H.setTimeout,Mf=se.every,Cf=Xi("every"),Nf=Ti("every");Z({target:"Array",proto:!0,forced:!Cf||!Nf},{every:function(t){return Mf(this,t,arguments.length>1?arguments[1]:void 0)}});var Lf=Mi("Array").every,Ff=Array.prototype,zf=function(t){var n=t.every;return t===Ff||t instanceof Array&&n===Ff.every?Lf:n},qf="\t\n\v\f\r                 \u2028\u2029\ufeff",Yf="["+qf+"]",Hf=RegExp("^"+Yf+Yf+"*"),Uf=RegExp(Yf+Yf+"*$"),Gf=function(t){return function(n){var e=String(O(n));return 1&t&&(e=e.replace(Hf,"")),2&t&&(e=e.replace(Uf,"")),e}},Wf={start:Gf(1),end:Gf(2),trim:Gf(3)},Jf=Wf.trim,Vf=v.parseInt,Qf=/^[+-]?0[Xx]/,Kf=8!==Vf(qf+"08")||22!==Vf(qf+"0x16")?function(t,n){var e=Jf(String(t));return Vf(e,n>>>0||(Qf.test(e)?16:10))}:Vf;Z({global:!0,forced:parseInt!=Kf},{parseInt:Kf});var Xf=H.parseInt,Zf=[],tl=Zf.sort,nl=m((function(){Zf.sort(void 0)})),el=m((function(){Zf.sort(null)})),rl=Xi("sort");Z({target:"Array",proto:!0,forced:nl||!el||!rl},{sort:function(t){return void 0===t?tl.call(un(this)):tl.call(un(this),U(t))}});var ol=Mi("Array").sort,il=Array.prototype,ul=function(t){var n=t.sort;return t===il||t instanceof Array&&n===il.sort?ol:n},al=se.find,cl="find",fl=!0,ll=Ti(cl);cl in[]&&Array(1).find((function(){fl=!1})),Z({target:"Array",proto:!0,forced:fl||!ll},{find:function(t){return al(this,t,arguments.length>1?arguments[1]:void 0)}});var sl=Mi("Array").find,dl=Array.prototype,pl=function(t){var n=t.find;return t===dl||t instanceof Array&&n===dl.find?sl:n},vl=st.includes,ml=Ti("indexOf",{ACCESSORS:!0,1:0});Z({target:"Array",proto:!0,forced:!ml},{includes:function(t){return vl(this,t,arguments.length>1?arguments[1]:void 0)}});var hl=Mi("Array").includes,yl=pn("match"),gl=function(t){if(function(t){var n;return E(t)&&(void 0!==(n=t[yl])?!!n:"RegExp"==w(t))}(t))throw TypeError("The method doesn't accept regular expressions");return t},_l=pn("match");Z({target:"String",proto:!0,forced:!function(t){var n=/./;try{"/./"[t](n)}catch(e){try{return n[_l]=!1,"/./"[t](n)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~String(O(this)).indexOf(gl(t),arguments.length>1?arguments[1]:void 0)}});var $l=Mi("String").includes,bl=Array.prototype,wl=String.prototype,xl=function(t){var n=t.includes;return t===bl||t instanceof Array&&n===bl.includes?hl:"string"==typeof t||t===wl||t instanceof String&&n===wl.includes?$l:n};function kl(t,n){return pl(n).call(n,(function(n){return n.id===t}))||null}function Ol(t){for(var n,e=arguments.length,r=new Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return u.default.extend.apply(u.default,Zu(n=[{},t]).call(n,r))}function Sl(t){for(var n,e=arguments.length,r=new Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return u.default.extend.apply(u.default,Zu(n=[!0,{},t]).call(n,r))}function El(t){var n;return xl(n=BooklyL10nGlobal.addons).call(n,t)}var Al=BooklyL10nGlobal.csrf_token;function jl(t,n){var e;if(void 0===Ji||null==hu(t)){if(yu(t)||(e=function(t,n){var e;if(!t)return;if("string"==typeof t)return Tl(t,n);var r=vu(e=Object.prototype.toString.call(t)).call(e,8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return oa(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Tl(t,n)}(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){e=Si(t)},n:function(){var t=e.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==e.return||e.return()}finally{if(a)throw i}}}}function Tl(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}var Pl=c.default;function Rl(t,n){var e,r={items:[],groups:[]},o=jl(t);try{var i=function(){var t=e.value;if(t[n]){var o,i=pl(o=r.groups).call(o,(function(e){return e.label===t[n]}));i||(i={label:t[n],items:[]},r.groups.push(i)),i.items.push(t)}else r.items.push(t)};for(o.s();!(e=o.n()).done;)i()}catch(t){o.e(t)}finally{o.f()}return r}function Bl(t,n){var e=Vu(t);if(hf){var r=hf(t);n&&(r=Oa(r).call(r,(function(n){return yf(t,n).enumerable}))),e.push.apply(e,r)}return e}function Dl(t){for(var n=1;n<arguments.length;n++){var e,r=null!=arguments[n]?arguments[n]:{};if(n%2)uu(e=Bl(Object(r),!0)).call(e,(function(n){_f(t,n,r[n])}));else if(ra)gf(t,ra(r));else{var o;uu(o=Bl(Object(r))).call(o,(function(n){Vi(t,n,yf(r,n))}))}}return t}function Il(t,n){var e=Sl({value:t}),r=Tf(t,n);return Dl(Dl({},r),{},{reset:function(){return r.set(Sl(e).value)}})}var Ml=Il(null),Cl=Il(null),Nl=Il(""),Ll=Il(0),Fl=Il({url:null,copied:!1}),zl=Il(null),ql=Il(!1),Yl=Il(null),Hl=Il(null),Ul=Il(null),Gl=Il(null),Wl=Il(null),Jl=Il(!1),Vl=Il(!1),Ql=Il(!1),Kl=Il(null),Xl=Il({until:null,type:"daily",monthly:{on:"day",day:null,weekday:null},daily:{every:1},weekly:{on:[]}}),Zl=Il([]),ts=Il(""),ns=Tf(null),es=Il({customers_appointments_limit:!1,date_interval_not_available:!1,date_interval_warning:!1,interval_not_in_service_schedule:!1,interval_not_in_staff_schedule:!1,overflow_capacity:!1,service_required:!1,provider_required:!1,staff_reaches_working_time_limit:!1,custom_service_name_required:!1,no_timeslots_available:!1}),rs=Il("main"),os=Tf(!1);function is(t,n){var e;if(void 0===Ji||null==hu(t)){if(yu(t)||(e=function(t,n){var e;if(!t)return;if("string"==typeof t)return us(t,n);var r=vu(e=Object.prototype.toString.call(t)).call(e,8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return oa(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return us(t,n)}(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){e=Si(t)},n:function(){var t=e.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==e.return||e.return()}finally{if(a)throw i}}}}function us(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}function as(t){var n=Pf.get();t.custom_fields=[],t.extras=[],t.extras_multiply_nop=n.extras_multiply_nop,t.number_of_persons=Cl.get()?Math.max(ks.get().min-fs(Zl.get()),1):1,t.notes=null,t.collaborative_token=null,t.collaborative_service=null,t.compound_token=null,t.compound_service=null,t.payment_action=null,t.payment_id=null,t.payment_type=null,t.payment_title=null,t.payment_price=null,t.payment_tax=null,t.payment_for=null,t.package_id=null,t.series_id=null,t.ca_id=null,t.status=n.customer_gr_def_app_status[t.group_id||0]}function cs(t){var n,e=0,r=is(t);try{for(r.s();!(n=r.n()).done;){e+=n.value.number_of_persons}}catch(t){r.e(t)}finally{r.f()}return e}function fs(t,n){var e,r=0,o=is(t);try{for(o.s();!(e=o.n()).done;){var i,u=e.value;n&&u.id===n.id||xl(i=Pl.freeStatuses).call(i,u.status)||(r+=u.number_of_persons)}}catch(t){o.e(t)}finally{o.f()}return r}function ls(t){var n,e=[];return uu(n=Zl.get()).call(n,(function(n){var r={id:n.id,ca_id:n.ca_id,custom_fields:n.custom_fields,extras:n.extras,extras_multiply_nop:n.extras_multiply_nop,number_of_persons:n.number_of_persons,timezone:n.timezone,status:n.status};t||(r.series_id=n.series_id,r.notes=n.notes,r.payment_id=n.payment_id,r.payment_action=n.payment_action||"",r.payment_price=n.payment_price,r.payment_tax=n.payment_tax,r.payment_for=n.payment_for),e.push(r)})),Ma(e)}function ss(t){var n=t.full_name;return""===t.email&&""===t.phone||(n+=" (",""!==t.email&&(n+=t.email,""!==t.phone&&(n+=", ")),""!==t.phone&&(n+=t.phone),n+=")"),n}function ds(){var t=Cl.get(),n=t?t.duration*t.units_min:Pf.get().time_interval;(n<86400||t&&t.units_max>1)&&(Gl.set(moment(Hl.get(),"HH:mm").add(n,"seconds").format("HH:mm")),Ss.get()&&Wl.set(As(Gl.get(),Ss.get())))}function ps(){return hs("start")}function vs(){return ps().format("YYYY-MM-DD HH:mm:00")}function ms(){return hs("end").format("YYYY-MM-DD HH:mm:00")}function hs(t){if(Yl.get()){var n=Yl.get().clone(),e=Cl.get(),r=Hl.get(),o=Gl.get(),i=[0,0];if("end"===t)if(e&&e.duration>=86400){var u;if(o){var a=r.split(":"),c=o.split(":"),f=Math.max(e.duration,60*(60*c[0]+Xf(c[1])-60*a[0]-Xf(a[1])));u=Xf(f/86400)}else u=e&&e.units_max>1?Xf(e.duration*e.units_min/86400):Xf(e.duration/86400);n.add(u,"days")}else i=o.split(":");else e&&e.duration<86400&&(i=r.split(":"));return n.hours(i[0]),n.minutes(i[1]),n}}var ys=Il(null),gs=Il({id:null,startDate:null,startTime:null,endTime:null}),_s=Tf((function(){}));function $s(t,n){var e;if(void 0===Ji||null==hu(t)){if(yu(t)||(e=function(t,n){var e;if(!t)return;if("string"==typeof t)return bs(t,n);var r=vu(e=Object.prototype.toString.call(t)).call(e,8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return oa(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return bs(t,n)}(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){e=Si(t)},n:function(){var t=e.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==e.return||e.return()}finally{if(a)throw i}}}}function bs(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}var ws=null,xs=null,ks=Of([Ml,Cl,zl],(function(t){var n=Wi(t,3),e=n[0],r=n[1],o=n[2],i={min:1,max:1};if(e&&r)if(null===r.id)i.max=r.locations[0].capacity_max;else{var u=o?[o.id,0]:[0],a=kl(r.id,e.services);if(a){var c,f=$s(u);try{for(f.s();!(c=f.n()).done;){var l=c.value;if(l in a.locations){i.min=a.locations[l].capacity_min,i.max=a.locations[l].capacity_max;break}}}catch(t){f.e(t)}finally{f.f()}}}return i})),Os=Of([Pf,gs,Cl,Ml,Zl,zl,Yl],(function(t,n){var e=Wi(t,7),r=e[0],o=e[1],i=e[2],a=e[3],c=e[4],f=e[5],l=e[6];if(!Pl.appropriate_slots||i&&null===i.id){var s,d;Jl.set(!1);var p=i&&i.hasOwnProperty("custom_time_slots")?vu(s=i.custom_time_slots.start_time).call(s):vu(d=r.start_time).call(d);o.startTime&&zf(p).call(p,(function(t){return t.value!==o.startTime.value}))&&(p.push(o.startTime),Es(p)),n(p)}else i&&l&&a?(null!==xs&&(clearTimeout(xs),xs=null),xs=If((function(){null!==ws&&(ws.abort(),ws=null),Jl.set(!0);var t={action:"bookly_get_day_schedule",csrf_token:Al,appointment_id:gs.get().id,staff_id:a.id,location_id:f?f.id:null,service_id:i.id,date:l.format("DD-MM-YYYY"),nop:Math.max(fs(c),ks.get().min)};ws=u.default.post(ajaxurl,t,(function(t){var e=es.get();t.data.start&&t.data.start.length>0?(e.no_timeslots_available=!1,Jl.set(!1),i.custom_time_slots=[],i.custom_time_slots.end_time=t.data.end,n(t.data.start)):e.no_timeslots_available=!0,es.set(e)}),"json")}),10)):(Jl.set(!0),n([]))})),Ss=Of([Pf,Hl,gs,Cl,Os],(function(t){var n=Wi(t,5),e=n[0],r=n[1],o=n[2],i=n[3],u=n[4],c=[];if(r&&u)if(i&&i.units_max>1)for(var f=a.default(r,"HH:mm"),l=i.units_min;l<=i.units_max;++l){var s,d=f.clone().add(l*i.duration,"seconds"),p=Math.floor(d.diff(a.default("00:00","HH:mm"))/3600/1e3),v=$s(e.end_time);try{for(v.s();!(s=v.n()).done;){var m=s.value;m.value===(p<10?"0"+p:p)+":"+d.format("mm")&&(m.title=m.title_time+" ("+l+")",c.push(m))}}catch(t){v.e(t)}finally{v.f()}}else{var h,y=r.split(":"),g=24+Xf(y[0])+":"+y[1],_=$s(i&&i.hasOwnProperty("custom_time_slots")?i.custom_time_slots.end_time:e.end_time);try{for(_.s();!(h=_.n()).done;){var $=h.value;if($.value>g)break;$.value>r&&($.title=$.title_time,c.push($))}}catch(t){_.e(t)}finally{_.f()}o.endTime&&o.endTime.value>r&&zf(c).call(c,(function(t){return t.value!==o.endTime.value}))&&(c.push(o.endTime),Es(c))}return c}));function Es(t){ul(t).call(t,(function(t,n){return t.value<n.value?-1:t.value>n.value?1:0}))}function As(t,n){if(!n)return null;var e=pl(n).call(n,(function(n){return e=n.value,r=t,o=e.split(":"),i=r.split(":"),Xf(60*o[0]+o[1])>=Xf(60*i[0]+i[1]);var e,r,o,i}));return e||n[n.length-1]}Os.subscribe((function(t){Hl.get()&&t.length&&(Ul.set(As(Hl.get(),t)),Hl.set(Ul.get().value))})),Ss.subscribe((function(t){if(Gl.get()&&t.length){var n=Cl.get();n&&1===n.units_max&&Pl.appropriate_slots&&ds(),Wl.set(As(Gl.get(),t)),Gl.set(Wl.get().value)}}));var js=Il([]),Ts=Il([]),Ps=Il(null),Rs=Il([]),Bs=Il("current"),Ds=Il({all:[],changed_status:[]}),Is=Il("changed_status"),Ms=Il([]);function Cs(t){var n=moment(t),e=n.format("d"),r=n.format("M"),o=n.format("DD");return Pl.datePicker.dayNamesShort[e]+", "+Pl.datePicker.monthNamesShort[r-1]+" "+o}function Ns(t,n){for(var e=0;e<n.length;++e)if(t===n[e].value)return n[e].title}function Ls(){var t,n=Rs.get();return n.items&&zf(t=n.items).call(t,(function(t){return t.deleted}))}var Fs=se.some,zs=Xi("some"),qs=Ti("some");Z({target:"Array",proto:!0,forced:!zs||!qs},{some:function(t){return Fs(this,t,arguments.length>1?arguments[1]:void 0)}});var Ys=Mi("Array").some,Hs=Array.prototype,Us=function(t){var n=t.some;return t===Hs||t instanceof Array&&n===Hs.some?Ys:n},Gs=["sun","mon","tue","wed","thu","fri","sat"];function Ws(t,n,e){var r,o=Js(t);switch(n.type){case"daily":var i;if(t.diff(e,"days")%zf(n.daily)==0)if(zf(n.daily)>6||Us(i=Pf.get().week_days).call(i,(function(t){return t===o})))return!0;break;case"weekly":case"biweekly":if(("weekly"===n.type||t.diff(e.clone().startOf("isoWeek"),"weeks")%2==0)&&Us(r=n.weekly.on).call(r,(function(t){return t===o})))return!0;break;case"monthly":switch(n.monthly.on){case"day":if(t.date()===n.monthly.day)return!0;break;case"last":if(o===n.monthly.weekday&&t.clone().endOf("month").diff(t,"days")<7)return!0;break;default:var u=t.diff(t.clone().startOf("month"),"days"),a=["first","second","third","fourth"],c=na(a).call(a,n.monthly.on);if(o===n.monthly.weekday&&u>=7*c&&u<7*(c+1))return!0}}return!1}function Js(t){return Gs[t.format("d")]}var Vs=!1;function Qs(){return Vs?u.default.Deferred((function(t){return t.resolve()})):u.default.get(ajaxurl,{action:"bookly_get_data_for_appointment_form",csrf_token:Al}).done((function(t){if(Vs=!0,Pl.service_main){var n,e=[];uu(n=t.staff).call(n,(function(t){var n;uu(n=t.services).call(n,(function(t){void 0===pl(e).call(e,(function(n){return n.id===t.id}))&&e.push(t)}))})),t.services=e}Pf.set(t)}))}function Ks(){Ml.reset(),ys.reset(),Cl.reset(),Nl.reset(),Ll.reset(),Fl.reset(),zl.reset(),ql.reset(),Yl.reset(),Hl.reset(),Ul.reset(),Gl.reset(),Wl.reset(),Zl.reset(),Bs.reset(),ts.reset(),gs.reset(),rs.reset(),Xs(),Vl.reset(),Kl.reset(),Xl.reset(),Ql.reset(),Ds.reset(),Is.reset(),Ms.reset(),js.reset(),Ts.reset(),Ps.reset(),Rs.reset(),Bs.reset()}function Xs(){es.reset()}var Zs=null,td=null;wf([Cl,Ml,zl,ql,Hl,Gl,Yl,Zl,Jl],(function(t,n){var e=Wi(t,9),r=e[0],o=e[1],i=e[2],a=e[3],c=e[4],f=e[5];e[6],e[7];var l=e[8];null!==td&&(clearTimeout(td),td=null),td=If((function(){if(null!==Zs&&(Zs.abort(),Zs=null),o&&r&&c&&f&&!l){var t={action:"bookly_check_appointment_errors",csrf_token:Al,appointment_id:gs.get().id,customers:ls(!0),staff_id:o.id,location_id:i?i.id:null};r.id?t.service_id=r.id:t.service_id="",a||(t.start_date=vs(),t.end_date=ms()),Zs=u.default.post(ajaxurl,t,n,"json")}else n(null)}),10)}),null).subscribe((function(t){null===t?Xs():es.update((function(n){var e;return uu(e=Vu(t)).call(e,(function(e){return n[e]=t[e]})),n}))}));function nd(t){var n,e=[];uu(n=Rs.get()).call(n,(function(n){t.slots===n.slots||n.deleted||e.push(n.slots)})),ed(t.date,e).done((function(n){if(n.data.length){if(js.set(n.data[0].options),n.data[0].options.length){var e,r,o=JSON.parse(t.slots)[0][2].split(" ").pop(),i=Oa(e=n.data[0].options).call(e,(function(t){var n;return xl(n=t.value).call(n,o)}));t.slots=i.length?i[0].value:n.data[0].options[0].value,t.options=Oa(r=js.get()).call(r,(function(n){return n.value===t.slots}))}}else js.set([])}))}function ed(t,n){var e={action:"bookly_recurring_appointments_get_schedule",csrf_token:Al,staff_id:Ml.get().id,service_id:Cl.get().id,location_id:zl.get()?zl.get().id:null,exclude:n,nop:cs(Zl.get())};if(t)e.repeat="daily",e.datetime=t,e.until=t,e.params={every:1},e.with_options=1;else{var r=Xl.get();e.repeat=r.type,e.datetime=vs(),e.until=r.until.format("YYYY-MM-DD"),e.params=r["biweekly"===r.type?"weekly":r.type],e.with_options=0}return jQuery.post(ajaxurl,e)}function rd(){for(var t=Ds.get(),n=Is.get(),e=Ms.get(),r=[],o=[],i=function(){var i,c=a[u];uu(i=t[c]).call(i,(function(t,i){n===c&&xl(e).call(e,i)&&r.push(t),t.attachments&&o.push.apply(o,Gu(t.attachments))}))},u=0,a=Vu(t);u<a.length;u++)i();return{selected:r,attachments:o}}function od(t,n){var e;if(void 0===Ji||null==hu(t)){if(yu(t)||(e=function(t,n){var e;if(!t)return;if("string"==typeof t)return id(t,n);var r=vu(e=Object.prototype.toString.call(t)).call(e,8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return oa(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return id(t,n)}(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){e=Si(t)},n:function(){var t=e.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==e.return||e.return()}finally{if(a)throw i}}}}function id(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}function ud(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}var ad=function(t){return{}},cd=function(t){return{}};function fd(t){var n,e,r,o,i,u,a,c,f,l,s,d,p,v,m=t[6].default,h=Qa(m,t,t[5],null),y=t[6].footer,g=Qa(y,t,t[5],cd);return{c:function(){n=sc("div"),e=sc("div"),r=sc("div"),o=sc("div"),i=sc("h5"),u=dc(t[1]),a=pc(),(c=sc("button")).innerHTML='<span aria-hidden="true">×</span>',f=pc(),l=sc("div"),h&&h.c(),s=pc(),d=sc("div"),g&&g.c(),yc(i,"class","modal-title"),yc(c,"type","button"),yc(c,"class","close"),yc(c,"data-dismiss","bookly-modal"),yc(c,"aria-label","Close"),yc(o,"class","modal-header"),yc(l,"class","modal-body"),yc(d,"class","modal-footer"),yc(r,"class","modal-content"),yc(e,"class",p="modal-dialog modal-"+t[0]),yc(n,"class","bookly-modal bookly-fade"),yc(n,"tabindex","-1"),yc(n,"role","dialog")},m:function(p,m){cc(p,n,m),ac(n,e),ac(e,r),ac(r,o),ac(o,i),ac(i,u),ac(o,a),ac(o,c),ac(r,f),ac(r,l),h&&h.m(l,null),ac(r,s),ac(r,d),g&&g.m(d,null),t[7](n),v=!0},p:function(t,n){var r=Wi(n,1)[0];(!v||2&r)&&wc(u,t[1]),h&&h.p&&32&r&&Xa(h,m,t,t[5],r,null,null),g&&g.p&&32&r&&Xa(g,y,t,t[5],r,ad,cd),(!v||1&r&&p!==(p="modal-dialog modal-"+t[0]))&&yc(e,"class",p)},i:function(t){v||(rf(h,t),rf(g,t),v=!0)},o:function(t){of(h,t),of(g,t),v=!1},d:function(e){e&&fc(n),h&&h.d(e),g&&g.d(e),t[7](null)}}}function ld(t,n,e){var r,o,i=n.$$slots,a=void 0===i?{}:i,c=n.$$scope,f=(r=Ic(),function(t,n){var e=r.$$.callbacks[t];if(e){var o,i=Ac(t,n);uu(o=vu(e).call(e)).call(o,(function(t){t.call(r,i)}))}}),l=n.size,s=void 0===l?"lg":l,d=n.title,p=void 0===d?"":d;return Mc((function(){return u.default(o).booklyModal().on("hidden.bs.modal",(function(){return f("hidden")}))})),t.$$set=function(t){"size"in t&&e(0,s=t.size),"title"in t&&e(1,p=t.title),"$$scope"in t&&e(5,c=t.$$scope)},[s,p,o,function(){u.default(o).booklyModal("show")},function(){u.default(o).booklyModal("hide")},c,a,function(t){Nc[t?"unshift":"push"]((function(){e(2,o=t)}))}]}var sd=function(t){nn(e,t);var n=ud(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,ld,fd,Wa,{size:0,title:1,show:3,hide:4}),r}return Gt(e,[{key:"show",get:function(){return this.$$.ctx[3]}},{key:"hide",get:function(){return this.$$.ctx[4]}}]),e}(vf),dd=Wf.trim,pd=v.parseFloat,vd=1/pd(qf+"-0")!=-1/0?function(t){var n=dd(String(t)),e=pd(n);return 0===e&&"-"==n.charAt(0)?-0:e}:pd;Z({global:!0,forced:parseFloat!=vd},{parseFloat:vd});var md=H.parseFloat;function hd(t){var n=t-1;return n*n*n+1}function yd(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=n.delay,r=void 0===e?0:e,o=n.duration,i=void 0===o?400:o,u=n.easing,a=void 0===u?hd:u,c=getComputedStyle(t),f=+c.opacity,l=md(c.height),s=md(c.paddingTop),d=md(c.paddingBottom),p=md(c.marginTop),v=md(c.marginBottom),m=md(c.borderTopWidth),h=md(c.borderBottomWidth);return{delay:r,duration:i,easing:a,css:function(t){return"overflow: hidden;"+"opacity: ".concat(Math.min(20*t,1)*f,";")+"height: ".concat(t*l,"px;")+"padding-top: ".concat(t*s,"px;")+"padding-bottom: ".concat(t*d,"px;")+"margin-top: ".concat(t*p,"px;")+"margin-bottom: ".concat(t*v,"px;")+"border-top-width: ".concat(t*m,"px;")+"border-bottom-width: ".concat(t*h,"px;")}}}function gd(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function _d(t){var n,e,r,o,i,u,a,c=t[4].default,f=Qa(c,t,t[3],null);return{c:function(){n=sc("div"),e=sc("i"),o=pc(),f&&f.c(),yc(e,"class",r="fas pl-1 "+("danger"===t[1]?"fa-times":"fa-exclamation-triangle")),yc(n,"class",i="alert alert-"+t[1]+" form-group "+t[2]+" p-1")},m:function(t,r){cc(t,n,r),ac(n,e),ac(n,o),f&&f.m(n,null),a=!0},p:function(t,o){(!a||2&o&&r!==(r="fas pl-1 "+("danger"===t[1]?"fa-times":"fa-exclamation-triangle")))&&yc(e,"class",r),f&&f.p&&8&o&&Xa(f,c,t,t[3],o,null,null),(!a||6&o&&i!==(i="alert alert-"+t[1]+" form-group "+t[2]+" p-1"))&&yc(n,"class",i)},i:function(t){a||(rf(f,t),u||Uc((function(){(u=af(n,yd,{})).start()})),a=!0)},o:function(t){of(f,t),a=!1},d:function(t){t&&fc(n),f&&f.d(t)}}}function $d(t){var n,e,r=t[0]&&_d(t);return{c:function(){r&&r.c(),n=vc()},m:function(t,o){r&&r.m(t,o),cc(t,n,o),e=!0},p:function(t,e){var o=Wi(e,1)[0];t[0]?r?(r.p(t,o),1&o&&rf(r,1)):((r=_d(t)).c(),rf(r,1),r.m(n.parentNode,n)):r&&(nf(),of(r,1,1,(function(){r=null})),ef())},i:function(t){e||(rf(r),e=!0)},o:function(t){of(r),e=!1},d:function(t){r&&r.d(t),t&&fc(n)}}}function bd(t,n,e){var r=n.$$slots,o=void 0===r?{}:r,i=n.$$scope,u=n.show,a=void 0===u||u,c=n.type,f=void 0===c?"warning":c,l=n.class,s=void 0===l?"":l;return t.$$set=function(t){"show"in t&&e(0,a=t.show),"type"in t&&e(1,f=t.type),"class"in t&&e(2,s=t.class),"$$scope"in t&&e(3,i=t.$$scope)},[a,f,s,i,o]}var wd=function(t){nn(e,t);var n=gd(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,bd,$d,Wa,{show:0,type:1,class:2}),r}return e}(vf);function xd(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function kd(t,n,e){var r=vu(t).call(t);return r[10]=n[e],r}function Od(t,n,e){var r=vu(t).call(t);return r[13]=n[e],r}function Sd(t,n,e){var r=vu(t).call(t);return r[13]=n[e],r}function Ed(t){var n;return{c:function(){(n=sc("option")).__value=null,n.value=n.__value},m:function(t,e){cc(t,n,e)},d:function(t){t&&fc(n)}}}function Ad(t){var n,e,r,o=t[4](t[13],t[2])+"";return{c:function(){n=sc("option"),e=dc(o),n.__value=r=t[13],n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,i){6&i&&o!==(o=t[4](t[13],t[2])+"")&&wc(e,o),2&i&&r!==(r=t[13])&&(n.__value=r,n.value=n.__value)},d:function(t){t&&fc(n)}}}function jd(t){var n,e,r,o=t[4](t[13],t[2])+"";return{c:function(){n=sc("option"),e=dc(o),n.__value=r=t[13],n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,i){6&i&&o!==(o=t[4](t[13],t[2])+"")&&wc(e,o),2&i&&r!==(r=t[13])&&(n.__value=r,n.value=n.__value)},d:function(t){t&&fc(n)}}}function Td(t){for(var n,e,r=t[10].items,o=[],i=0;i<r.length;i+=1)o[i]=jd(Od(t,r,i));return{c:function(){n=sc("optgroup");for(var r=0;r<o.length;r+=1)o[r].c();yc(n,"label",e=t[10].label)},m:function(t,e){cc(t,n,e);for(var r=0;r<o.length;r+=1)o[r].m(n,null)},p:function(t,i){if(22&i){var u;for(r=t[10].items,u=0;u<r.length;u+=1){var a=Od(t,r,u);o[u]?o[u].p(a,i):(o[u]=jd(a),o[u].c(),o[u].m(n,null))}for(;u<o.length;u+=1)o[u].d(1);o.length=r.length}2&i&&e!==(e=t[10].label)&&yc(n,"label",e)},d:function(t){t&&fc(n),lc(o,t)}}}function Pd(t){var n,e=Pl.l10n.notices.provider_required+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Rd(t){for(var n,e,r,o,i,u,a,c,f,l,s=null===t[0]&&Ed(),d=t[1].items,p=[],v=0;v<d.length;v+=1)p[v]=Ad(Sd(t,d,v));for(var m=t[1].groups,h=[],y=0;y<m.length;y+=1)h[y]=Td(kd(t,m,y));return a=new wd({props:{show:t[3].provider_required,type:"danger",class:"mt-2",$$slots:{default:[Pd]},$$scope:{ctx:t}}}),{c:function(){(n=sc("label")).textContent="".concat(Pl.l10n.provider),e=pc(),r=sc("select"),s&&s.c(),o=vc();for(var c=0;c<p.length;c+=1)p[c].c();i=vc();for(var f=0;f<h.length;f+=1)h[f].c();u=pc(),ff(a.$$.fragment),yc(n,"for","bookly-provider"),yc(r,"id","bookly-provider"),yc(r,"class","form-control custom-select"),void 0===t[0]&&Uc((function(){return t[9].call(r)}))},m:function(d,v){cc(d,n,v),cc(d,e,v),cc(d,r,v),s&&s.m(r,null),ac(r,o);for(var m=0;m<p.length;m+=1)p[m].m(r,null);ac(r,i);for(var y=0;y<h.length;y+=1)h[y].m(r,null);Oc(r,t[0]),cc(d,u,v),lf(a,d,v),c=!0,f||(l=[mc(r,"change",t[9]),mc(r,"change",t[5])],f=!0)},p:function(t,n){var e=Wi(n,1)[0];if(null===t[0]?s||((s=Ed()).c(),s.m(r,o)):s&&(s.d(1),s=null),22&e){var u;for(d=t[1].items,u=0;u<d.length;u+=1){var c=Sd(t,d,u);p[u]?p[u].p(c,e):(p[u]=Ad(c),p[u].c(),p[u].m(r,i))}for(;u<p.length;u+=1)p[u].d(1);p.length=d.length}if(22&e){var f;for(m=t[1].groups,f=0;f<m.length;f+=1){var l=kd(t,m,f);h[f]?h[f].p(l,e):(h[f]=Td(l),h[f].c(),h[f].m(r,null))}for(;f<h.length;f+=1)h[f].d(1);h.length=m.length}3&e&&Oc(r,t[0]);var v={};8&e&&(v.show=t[3].provider_required),262144&e&&(v.$$scope={dirty:e,ctx:t}),a.$set(v)},i:function(t){c||(rf(a.$$.fragment,t),c=!0)},o:function(t){of(a.$$.fragment,t),c=!1},d:function(t){t&&fc(n),t&&fc(e),t&&fc(r),s&&s.d(),lc(p,t),lc(h,t),t&&fc(u),sf(a,t),f=!1,Ua(l)}}}function Bd(t,n,e){var r,o,i,u,a,c,f;function l(){!function(){var t=Ml.get();1===t.locations.length&&zl.set(t.locations[0])}()}return Va(t,Pf,(function(t){return e(7,r=t)})),Va(t,Ml,(function(t){return e(0,o=t)})),Va(t,Cl,(function(t){return e(8,i=t)})),Va(t,ys,(function(t){return e(2,u=t)})),Va(t,es,(function(t){return e(3,a=t)})),t.$$.update=function(){if(449&t.$$.dirty)if(Pl.service_main)if(i){var n=function(t,n){return Oa(t).call(t,(function(t){var e;return pl(e=t.services).call(e,(function(t){return t.id===n}))}))}(r.staff,i.id);o&&!kl(o.id,n)&&tc(Ml,o=null,o),e(1,c=Rl(n,"category")),f!==i.id&&(null===o&&n.length<=2&&(tc(Ml,o=n[0],o),l()),e(6,f=i.id))}else e(1,c=Rl([],"category")),tc(Cl,i=null,i);else e(1,c=Rl(function(t,n){return Oa(t).call(t,(function(t){return!t.archived||t===n}))}(r.staff,o),"category"))},[o,c,u,a,function(t,n){return t.full_name+(t===n?" (".concat(Pl.l10n.staff_any,")"):"")},l,f,r,i,function(){o=Sc(this),Ml.set(o),e(1,c),e(7,r),e(0,o),e(8,i),e(6,f)}]}var Dd=function(t){nn(e,t);var n=xd(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Bd,Rd,Wa,{}),r}return e}(vf);function Id(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Md(t,n,e){var r=vu(t).call(t);return r[9]=n[e],r}function Cd(t,n,e){var r=vu(t).call(t);return r[12]=n[e],r}function Nd(t,n,e){var r=vu(t).call(t);return r[12]=n[e],r}function Ld(t){var n,e,r,o=t[12].name+"";return{c:function(){n=sc("option"),e=dc(o),n.__value=r=t[12],n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,i){2&i&&o!==(o=t[12].name+"")&&wc(e,o),2&i&&r!==(r=t[12])&&(n.__value=r,n.value=n.__value)},d:function(t){t&&fc(n)}}}function Fd(t){var n,e,r,o=t[12].name+"";return{c:function(){n=sc("option"),e=dc(o),n.__value=r=t[12],n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,i){2&i&&o!==(o=t[12].name+"")&&wc(e,o),2&i&&r!==(r=t[12])&&(n.__value=r,n.value=n.__value)},d:function(t){t&&fc(n)}}}function zd(t){for(var n,e,r=t[9].items,o=[],i=0;i<r.length;i+=1)o[i]=Fd(Cd(t,r,i));return{c:function(){n=sc("optgroup");for(var r=0;r<o.length;r+=1)o[r].c();yc(n,"label",e=t[9].label)},m:function(t,e){cc(t,n,e);for(var r=0;r<o.length;r+=1)o[r].m(n,null)},p:function(t,i){if(2&i){var u;for(r=t[9].items,u=0;u<r.length;u+=1){var a=Cd(t,r,u);o[u]?o[u].p(a,i):(o[u]=Fd(a),o[u].c(),o[u].m(n,null))}for(;u<o.length;u+=1)o[u].d(1);o.length=r.length}2&i&&e!==(e=t[9].label)&&yc(n,"label",e)},d:function(t){t&&fc(n),lc(o,t)}}}function qd(t){var n,e=Pl.l10n.notices.service_required+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Yd(t){for(var n,e,r,o,i,u,a,c,f,l,s=t[1].items,d=[],p=0;p<s.length;p+=1)d[p]=Ld(Nd(t,s,p));for(var v=t[1].groups,m=[],h=0;h<v.length;h+=1)m[h]=zd(Md(t,v,h));return a=new wd({props:{show:t[2].service_required,type:"danger",class:"mt-2",$$slots:{default:[qd]},$$scope:{ctx:t}}}),{c:function(){(n=sc("label")).textContent="".concat(Pl.l10n.service),e=pc(),r=sc("select"),(o=sc("option")).textContent="".concat(Pl.l10n.select_a_service);for(var c=0;c<d.length;c+=1)d[c].c();i=vc();for(var f=0;f<m.length;f+=1)m[f].c();u=pc(),ff(a.$$.fragment),yc(n,"for","bookly-service"),o.__value=null,o.value=o.__value,yc(r,"id","bookly-service"),yc(r,"class","form-control custom-select"),void 0===t[0]&&Uc((function(){return t[7].call(r)}))},m:function(s,p){cc(s,n,p),cc(s,e,p),cc(s,r,p),ac(r,o);for(var v=0;v<d.length;v+=1)d[v].m(r,null);ac(r,i);for(var h=0;h<m.length;h+=1)m[h].m(r,null);Oc(r,t[0]),cc(s,u,p),lf(a,s,p),c=!0,f||(l=[mc(r,"change",t[7]),mc(r,"change",t[3])],f=!0)},p:function(t,n){var e=Wi(n,1)[0];if(2&e){var o;for(s=t[1].items,o=0;o<s.length;o+=1){var u=Nd(t,s,o);d[o]?d[o].p(u,e):(d[o]=Ld(u),d[o].c(),d[o].m(r,i))}for(;o<d.length;o+=1)d[o].d(1);d.length=s.length}if(2&e){var c;for(v=t[1].groups,c=0;c<v.length;c+=1){var f=Md(t,v,c);m[c]?m[c].p(f,e):(m[c]=zd(f),m[c].c(),m[c].m(r,null))}for(;c<m.length;c+=1)m[c].d(1);m.length=v.length}3&e&&Oc(r,t[0]);var l={};4&e&&(l.show=t[2].service_required),131072&e&&(l.$$scope={dirty:e,ctx:t}),a.$set(l)},i:function(t){c||(rf(a.$$.fragment,t),c=!0)},o:function(t){of(a.$$.fragment,t),c=!1},d:function(t){t&&fc(n),t&&fc(e),t&&fc(r),lc(d,t),lc(m,t),t&&fc(u),sf(a,t),f=!1,Ua(l)}}}function Hd(t,n,e){var r,o,i,u,a,c,f;function l(){u&&ds()}return Va(t,Pf,(function(t){return e(5,r=t)})),Va(t,Cl,(function(t){return e(0,o=t)})),Va(t,Ml,(function(t){return e(6,i=t)})),Va(t,Hl,(function(t){return e(8,u=t)})),Va(t,es,(function(t){return e(2,a=t)})),t.$$.update=function(){113&t.$$.dirty&&(Pl.service_main?(e(1,c=Rl(r.services,"category")),o&&tc(Cl,o=kl(o.id,r.services),o)):i?(e(1,c=Rl(i.services,"category")),f!==i.id&&(o&&tc(Cl,o=kl(o.id,i.services),o),null===o&&i.services.length<=2&&(tc(Cl,o=i.services[i.services.length-1],o),l()),e(4,f=i.id))):(e(1,c=Rl([],"category")),tc(Cl,o=null,o)))},[o,c,a,l,f,r,i,function(){o=Sc(this),Cl.set(o),e(1,c),e(5,r),e(0,o),e(6,i),e(4,f)}]}var Ud=function(t){nn(e,t);var n=Id(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Hd,Yd,Wa,{}),r}return e}(vf);function Gd(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Wd(t){var n,e=Pl.l10n.notices.custom_service_name_required+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Jd(t){var n,e,r,o,i,u,a,c,f,l,s,d,p,v;return u=new wd({props:{show:t[1].custom_service_name_required,type:"danger",class:"mt-2",$$slots:{default:[Wd]},$$scope:{ctx:t}}}),{c:function(){n=sc("div"),(e=sc("label")).textContent="".concat(Pl.l10n.custom_service_name),r=pc(),o=sc("input"),i=pc(),ff(u.$$.fragment),a=pc(),c=sc("div"),(f=sc("label")).textContent="".concat(Pl.l10n.custom_service_price),l=pc(),s=sc("input"),yc(e,"for","bookly-custom-service-name"),yc(o,"id","bookly-custom-service-name"),yc(o,"class","form-control"),yc(o,"type","text"),yc(n,"class","form-group"),yc(f,"for","bookly-custom-service-price"),yc(s,"id","bookly-custom-service-price"),yc(s,"class","form-control"),yc(s,"type","number"),yc(s,"min","0"),yc(s,"step","1"),yc(c,"class","form-group")},m:function(m,h){cc(m,n,h),ac(n,e),ac(n,r),ac(n,o),xc(o,t[0]),ac(n,i),lf(u,n,null),cc(m,a,h),cc(m,c,h),ac(c,f),ac(c,l),ac(c,s),xc(s,t[2]),d=!0,p||(v=[mc(o,"input",t[3]),mc(s,"input",t[4])],p=!0)},p:function(t,n){var e=Wi(n,1)[0];1&e&&o.value!==t[0]&&xc(o,t[0]);var r={};2&e&&(r.show=t[1].custom_service_name_required),32&e&&(r.$$scope={dirty:e,ctx:t}),u.$set(r),4&e&&$c(s.value)!==t[2]&&xc(s,t[2])},i:function(t){d||(rf(u.$$.fragment,t),d=!0)},o:function(t){of(u.$$.fragment,t),d=!1},d:function(t){t&&fc(n),sf(u),t&&fc(a),t&&fc(c),p=!1,Ua(v)}}}function Vd(t,n,e){var r,o,i;return Va(t,Nl,(function(t){return e(0,r=t)})),Va(t,es,(function(t){return e(1,o=t)})),Va(t,Ll,(function(t){return e(2,i=t)})),[r,o,i,function(){r=this.value,Nl.set(r)},function(){i=$c(this.value),Ll.set(i)}]}var Qd=function(t){nn(e,t);var n=Gd(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Vd,Jd,Wa,{}),r}return e}(vf);function Kd(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Xd(t,n,e){var r=vu(t).call(t);return r[4]=n[e],r}function Zd(t){var n,e,r,o=t[4].name+"";return{c:function(){n=sc("option"),e=dc(o),n.__value=r=t[4],n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,i){1&i&&o!==(o=t[4].name+"")&&wc(e,o),1&i&&r!==(r=t[4])&&(n.__value=r,n.value=n.__value)},d:function(t){t&&fc(n)}}}function tp(t){for(var n,e,r,o,i,u,a=t[0],c=[],f=0;f<a.length;f+=1)c[f]=Zd(Xd(t,a,f));return{c:function(){(n=sc("label")).textContent="".concat(Pl.l10n.location),e=pc(),r=sc("select"),o=sc("option");for(var i=0;i<c.length;i+=1)c[i].c();yc(n,"for","bookly-location"),o.__value=null,o.value=o.__value,yc(r,"id","bookly-location"),yc(r,"class","form-control custom-select"),void 0===t[1]&&Uc((function(){return t[3].call(r)}))},m:function(a,f){cc(a,n,f),cc(a,e,f),cc(a,r,f),ac(r,o);for(var l=0;l<c.length;l+=1)c[l].m(r,null);Oc(r,t[1]),i||(u=mc(r,"change",t[3]),i=!0)},p:function(t,n){var e=Wi(n,1)[0];if(1&e){var o;for(a=t[0],o=0;o<a.length;o+=1){var i=Xd(t,a,o);c[o]?c[o].p(i,e):(c[o]=Zd(i),c[o].c(),c[o].m(r,null))}for(;o<c.length;o+=1)c[o].d(1);c.length=a.length}3&e&&Oc(r,t[1])},i:Fa,o:Fa,d:function(t){t&&fc(n),t&&fc(e),t&&fc(r),lc(c,t),i=!1,u()}}}function np(t,n,e){var r,o,i;return Va(t,Ml,(function(t){return e(2,r=t)})),Va(t,zl,(function(t){return e(1,o=t)})),t.$$.update=function(){4&t.$$.dirty&&e(0,i=r?r.locations:[]),1&t.$$.dirty&&(i&&0!==i.length||tc(zl,o=null,o)),3&t.$$.dirty&&i&&o&&tc(zl,o=kl(o.id,i),o)},[i,o,r,function(){o=Sc(this),zl.set(o),e(0,i),e(2,r)}]}var ep=function(t){nn(e,t);var n=Kd(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,np,tp,Wa,{}),r}return e}(vf);function rp(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function op(t){var n,e,r;return{c:function(){(n=sc("label")).textContent="".concat(Pl.l10n.date),e=pc(),r=sc("input"),yc(n,"for","bookly-date"),yc(r,"type","text"),yc(r,"id","bookly-date"),yc(r,"class","form-control"),yc(r,"autocomplete","off")},m:function(o,i){cc(o,n,i),cc(o,e,i),cc(o,r,i),t[3](r)},p:Fa,i:Fa,o:Fa,d:function(o){o&&fc(n),o&&fc(e),o&&fc(r),t[3](null)}}}function ip(t,n,e){var r,o,i;return Va(t,Yl,(function(t){return e(2,r=t)})),Mc((function(){return e(1,i=u.default(o).daterangepicker({parentEl:"#bookly-appointment-dialog > div",singleDatePicker:!0,showDropdowns:!0,locale:Pl.datePicker},(function(t){return tc(Yl,r=t,r)})).data("daterangepicker"))})),t.$$.update=function(){6&t.$$.dirty&&r&&i&&(i.setStartDate(r),i.setEndDate(r))},[o,i,r,function(t){Nc[t?"unshift":"push"]((function(){e(0,o=t)}))}]}var up=function(t){nn(e,t);var n=rp(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,ip,op,Wa,{}),r}return e}(vf);function ap(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function cp(t,n,e){var r=vu(t).call(t);return r[12]=n[e],r}function fp(t,n,e){var r=vu(t).call(t);return r[15]=n[e],r}function lp(t){for(var n,e=t[4],r=[],o=0;o<e.length;o+=1)r[o]=sp(fp(t,e,o));return{c:function(){for(var t=0;t<r.length;t+=1)r[t].c();n=vc()},m:function(t,e){for(var o=0;o<r.length;o+=1)r[o].m(t,e);cc(t,n,e)},p:function(t,o){if(16&o){var i;for(e=t[4],i=0;i<e.length;i+=1){var u=fp(t,e,i);r[i]?r[i].p(u,o):(r[i]=sp(u),r[i].c(),r[i].m(n.parentNode,n))}for(;i<r.length;i+=1)r[i].d(1);r.length=e.length}},d:function(t){lc(r,t),t&&fc(n)}}}function sp(t){var n,e,r,o,i=t[15].title+"";return{c:function(){n=sc("option"),e=dc(i),n.__value=r=t[15],n.value=n.__value,n.disabled=o=t[15].disabled},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,u){16&u&&i!==(i=t[15].title+"")&&wc(e,i),16&u&&r!==(r=t[15])&&(n.__value=r,n.value=n.__value),16&u&&o!==(o=t[15].disabled)&&(n.disabled=o)},d:function(t){t&&fc(n)}}}function dp(t){for(var n,e=t[5],r=[],o=0;o<e.length;o+=1)r[o]=pp(cp(t,e,o));return{c:function(){for(var t=0;t<r.length;t+=1)r[t].c();n=vc()},m:function(t,e){for(var o=0;o<r.length;o+=1)r[o].m(t,e);cc(t,n,e)},p:function(t,o){if(32&o){var i;for(e=t[5],i=0;i<e.length;i+=1){var u=cp(t,e,i);r[i]?r[i].p(u,o):(r[i]=pp(u),r[i].c(),r[i].m(n.parentNode,n))}for(;i<r.length;i+=1)r[i].d(1);r.length=e.length}},d:function(t){lc(r,t),t&&fc(n)}}}function pp(t){var n,e,r,o=t[12].title+"";return{c:function(){n=sc("option"),e=dc(o),n.__value=r=t[12],n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,i){32&i&&o!==(o=t[12].title+"")&&wc(e,o),32&i&&r!==(r=t[12])&&(n.__value=r,n.value=n.__value)},d:function(t){t&&fc(n)}}}function vp(t){var n,e,r,o,i,u,a,c,f,l,s,d,p,v=!!t[4]&&!t[3]&&lp(t),m=!!t[5]&&!t[3]&&dp(t);return{c:function(){(n=sc("label")).textContent="".concat(Pl.l10n.period),e=pc(),r=sc("div"),o=sc("div"),i=sc("select"),v&&v.c(),u=pc(),(a=sc("div")).textContent="".concat(Pl.l10n.to),c=pc(),f=sc("div"),l=sc("select"),m&&m.c(),yc(n,"for","bookly-period"),yc(i,"id","bookly-period"),yc(i,"class","form-control custom-select"),i.disabled=t[3],void 0===t[0]&&Uc((function(){return t[8].call(i)})),yc(o,"class","col"),yc(a,"class","col-auto"),yc(l,"class","form-control custom-select"),l.disabled=s=Pl.appropriate_slots&&t[1]&&t[1].id&&1===t[1].units_max,void 0===t[2]&&Uc((function(){return t[9].call(l)})),yc(f,"class","col"),yc(r,"class","form-row align-items-center")},m:function(s,h){cc(s,n,h),cc(s,e,h),cc(s,r,h),ac(r,o),ac(o,i),v&&v.m(i,null),Oc(i,t[0]),ac(r,u),ac(r,a),ac(r,c),ac(r,f),ac(f,l),m&&m.m(l,null),Oc(l,t[2]),d||(p=[mc(i,"change",t[8]),mc(i,"change",t[6]),mc(l,"change",t[9]),mc(l,"change",t[7])],d=!0)},p:function(t,n){var e=Wi(n,1)[0];t[4]&&!t[3]?v?v.p(t,e):((v=lp(t)).c(),v.m(i,null)):v&&(v.d(1),v=null),8&e&&(i.disabled=t[3]),17&e&&Oc(i,t[0]),t[5]&&!t[3]?m?m.p(t,e):((m=dp(t)).c(),m.m(l,null)):m&&(m.d(1),m=null),2&e&&s!==(s=Pl.appropriate_slots&&t[1]&&t[1].id&&1===t[1].units_max)&&(l.disabled=s),36&e&&Oc(l,t[2])},i:Fa,o:Fa,d:function(t){t&&fc(n),t&&fc(e),t&&fc(r),v&&v.d(),m&&m.d(),d=!1,Ua(p)}}}function mp(t,n,e){var r,o,i,u,a,c,f,l;return Va(t,Hl,(function(t){return e(10,r=t)})),Va(t,Ul,(function(t){return e(0,o=t)})),Va(t,Cl,(function(t){return e(1,i=t)})),Va(t,Gl,(function(t){return e(11,u=t)})),Va(t,Wl,(function(t){return e(2,a=t)})),Va(t,Jl,(function(t){return e(3,c=t)})),Va(t,Os,(function(t){return e(4,f=t)})),Va(t,Ss,(function(t){return e(5,l=t)})),[o,i,a,c,f,l,function(){tc(Hl,r=o.value,r),i&&ds()},function(){tc(Gl,u=a.value,u)},function(){o=Sc(this),Ul.set(o)},function(){a=Sc(this),Wl.set(a)}]}var hp=function(t){nn(e,t);var n=ap(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,mp,vp,Wa,{}),r}return e}(vf);function yp(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function gp(t){var n,e,r,o,i,u;return{c:function(){n=sc("div"),e=sc("input"),r=pc(),(o=sc("label")).textContent="".concat(Pl.l10n.recurring.repeat_this_appointment),yc(e,"type","checkbox"),yc(e,"id","bookly-repeat-enabled"),yc(e,"class","custom-control-input"),yc(o,"for","bookly-repeat-enabled"),yc(o,"class","custom-control-label"),yc(n,"class","custom-control custom-checkbox")},m:function(a,c){cc(a,n,c),ac(n,e),e.checked=t[0],ac(n,r),ac(n,o),i||(u=mc(e,"change",t[1]),i=!0)},p:function(t,n){1&Wi(n,1)[0]&&(e.checked=t[0])},i:Fa,o:Fa,d:function(t){t&&fc(n),i=!1,u()}}}function _p(t,n,e){var r;return Va(t,Vl,(function(t){return e(0,r=t)})),[r,function(){r=this.checked,Vl.set(r)}]}var $p=function(t){nn(e,t);var n=yp(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,_p,gp,Wa,{}),r}return e}(vf);Z({target:"String",proto:!0},{repeat:"".repeat||function(t){var n=String(O(this)),e="",r=ot(t);if(r<0||r==1/0)throw RangeError("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(n+=n))1&r&&(e+=n);return e}});var bp=Mi("String").repeat,wp=String.prototype,xp=function(t){var n=t.repeat;return"string"==typeof t||t===wp||t instanceof String&&n===wp.repeat?bp:n};function kp(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Op(t,n,e){var r=vu(t).call(t);return r[2]=n[e],r}function Sp(t){var n,e,r=t[2].title+"";return{c:function(){n=sc("option"),e=dc(r),n.__value=t[2].id,n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Ep(t){for(var n,e,r,o,i,u,a,c=Pl.recurring.types,f=[],l=0;l<c.length;l+=1)f[l]=Sp(Op(t,c,l));return{c:function(){n=sc("div"),(e=sc("div")).textContent="".concat(xp(Pl.l10n.recurring)),r=pc(),o=sc("div"),i=sc("select");for(var u=0;u<f.length;u+=1)f[u].c();yc(e,"class","col-sm-2 col-form-label"),yc(i,"id","bookly-recurring-type"),yc(i,"class","form-control custom-select"),void 0===t[0].type&&Uc((function(){return t[1].call(i)})),yc(o,"class","col-sm-4"),yc(n,"class","form-group form-row")},m:function(c,l){cc(c,n,l),ac(n,e),ac(n,r),ac(n,o),ac(o,i);for(var s=0;s<f.length;s+=1)f[s].m(i,null);Oc(i,t[0].type),u||(a=mc(i,"change",t[1]),u=!0)},p:function(t,n){var e=Wi(n,1)[0];if(0&e){var r;for(c=Pl.recurring.types,r=0;r<c.length;r+=1){var o=Op(t,c,r);f[r]?f[r].p(o,e):(f[r]=Sp(o),f[r].c(),f[r].m(i,null))}for(;r<f.length;r+=1)f[r].d(1);f.length=c.length}1&e&&Oc(i,t[0].type)},i:Fa,o:Fa,d:function(t){t&&fc(n),lc(f,t),u=!1,a()}}}function Ap(t,n,e){var r;return Va(t,Xl,(function(t){return e(0,r=t)})),[r,function(){r.type=Sc(this),Xl.set(r)}]}var jp=function(t){nn(e,t);var n=kp(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Ap,Ep,Wa,{}),r}return e}(vf);function Tp(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Pp(t){var n,e,r,o,i,u,a,c,f,l,s;return{c:function(){n=sc("div"),(e=sc("div")).textContent="".concat(zf(Pl.l10n.recurring)),r=pc(),o=sc("div"),i=sc("div"),u=sc("input"),a=pc(),c=sc("div"),(f=sc("span")).textContent="".concat(Pl.l10n.recurring.days),yc(e,"class","col-sm-2 col-form-label"),yc(u,"type","number"),yc(u,"step","1"),yc(u,"min","1"),yc(u,"class","form-control"),yc(f,"class","input-group-text"),yc(c,"class","input-group-append"),yc(i,"class","input-group"),yc(o,"class","col-sm-4"),yc(n,"class","form-group form-row")},m:function(d,p){cc(d,n,p),ac(n,e),ac(n,r),ac(n,o),ac(o,i),ac(i,u),xc(u,zf(t[0].daily)),ac(i,a),ac(i,c),ac(c,f),l||(s=mc(u,"input",t[1]),l=!0)},p:function(t,n){1&Wi(n,1)[0]&&$c(u.value)!==zf(t[0].daily)&&xc(u,zf(t[0].daily))},i:Fa,o:Fa,d:function(t){t&&fc(n),l=!1,s()}}}function Rp(t,n,e){var r;return Va(t,Xl,(function(t){return e(0,r=t)})),[r,function(){r.daily.every=$c(this.value),Xl.set(r)}]}var Bp=function(t){nn(e,t);var n=Tp(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Rp,Pp,Wa,{}),r}return e}(vf);function Dp(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Ip(t,n,e){var r=vu(t).call(t);return r[6]=n[e],r}function Mp(t){var n,e,r,o,i,u,a,c,f=t[6].title+"";return{c:function(){n=sc("div"),e=sc("input"),r=pc(),o=sc("label"),i=dc(f),u=pc(),yc(e,"type","checkbox"),yc(e,"id","bookly-week-"+t[6].id),e.__value=t[6].id,e.value=e.__value,yc(e,"class","custom-control-input"),t[3][0].push(e),yc(o,"for","bookly-week-"+t[6].id),yc(o,"class","custom-control-label"),yc(n,"class","custom-control custom-checkbox d-inline mr-3")},m:function(f,l){var s;cc(f,n,l),ac(n,e),e.checked=~na(s=t[0].weekly.on).call(s,e.__value),ac(n,r),ac(n,o),ac(o,i),ac(n,u),a||(c=mc(e,"change",t[2]),a=!0)},p:function(t,n){var r;1&n&&(e.checked=~na(r=t[0].weekly.on).call(r,e.__value))},d:function(r){var o,i;r&&fc(n),pa(o=t[3][0]).call(o,na(i=t[3][0]).call(i,e),1),a=!1,c()}}}function Cp(t){for(var n,e,r,o,i=Pl.recurring.days,u=[],a=0;a<i.length;a+=1)u[a]=Mp(Ip(t,i,a));return{c:function(){n=sc("div"),(e=sc("div")).textContent="".concat(Pl.l10n.recurring.on),r=pc(),o=sc("div");for(var i=0;i<u.length;i+=1)u[i].c();yc(e,"class","col-sm-2 col-form-label"),yc(o,"id","bookly-repeat-on"),yc(o,"class","col-sm-10 mt-1"),Ec(o,"text-danger",!t[0].weekly.on.length),yc(n,"class","form-group form-row")},m:function(t,i){cc(t,n,i),ac(n,e),ac(n,r),ac(n,o);for(var a=0;a<u.length;a+=1)u[a].m(o,null)},p:function(t,n){var e=Wi(n,1)[0];if(1&e){var r;for(i=Pl.recurring.days,r=0;r<i.length;r+=1){var a=Ip(t,i,r);u[r]?u[r].p(a,e):(u[r]=Mp(a),u[r].c(),u[r].m(o,null))}for(;r<u.length;r+=1)u[r].d(1);u.length=i.length}1&e&&Ec(o,"text-danger",!t[0].weekly.on.length)},i:Fa,o:Fa,d:function(t){t&&fc(n),lc(u,t)}}}function Np(t,n,e){var r,o;Va(t,Yl,(function(t){return e(1,r=t)})),Va(t,Xl,(function(t){return e(0,o=t)}));var i=!1;var u=[[]];return t.$$.update=function(){2&t.$$.dirty&&r&&0===o.weekly.on.length&&(i||(tc(Xl,o.weekly.on=[Js(r)],o),i=!0))},[o,r,function(){o.weekly.on=_c(u[0],this.__value,this.checked),Xl.set(o)},u]}var Lp=function(t){nn(e,t);var n=Dp(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Np,Cp,Wa,{}),r}return e}(vf);function Fp(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function zp(t,n,e){var r=vu(t).call(t);return r[6]=n[e],r}function qp(t,n,e){var r=vu(t).call(t);return r[4]=n[e],r[6]=e,r}function Yp(t,n,e){var r=vu(t).call(t);return r[9]=n[e],r}function Hp(t){var n,e,r=t[9].title+"";return{c:function(){n=sc("option"),e=dc(r),n.__value=t[9].id,n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Up(t){for(var n,e,r,o,i=Pl.recurring.days,u=[],a=0;a<i.length;a+=1)u[a]=Wp(zp(t,i,a));return{c:function(){n=sc("div"),e=sc("select");for(var r=0;r<u.length;r+=1)u[r].c();yc(e,"class","form-control custom-select"),void 0===t[0].monthly.weekday&&Uc((function(){return t[3].call(e)})),yc(n,"class","col-sm-2")},m:function(i,a){cc(i,n,a),ac(n,e);for(var c=0;c<u.length;c+=1)u[c].m(e,null);Oc(e,t[0].monthly.weekday),r||(o=mc(e,"change",t[3]),r=!0)},p:function(t,n){if(0&n){var r;for(i=Pl.recurring.days,r=0;r<i.length;r+=1){var o=zp(t,i,r);u[r]?u[r].p(o,n):(u[r]=Wp(o),u[r].c(),u[r].m(e,null))}for(;r<u.length;r+=1)u[r].d(1);u.length=i.length}1&n&&Oc(e,t[0].monthly.weekday)},d:function(t){t&&fc(n),lc(u,t),r=!1,o()}}}function Gp(t){for(var n,e,r,o,i=Array(31),u=[],a=0;a<i.length;a+=1)u[a]=Jp(qp(t,i,a));return{c:function(){n=sc("div"),e=sc("select");for(var r=0;r<u.length;r+=1)u[r].c();yc(e,"class","form-control custom-select"),void 0===t[0].monthly.day&&Uc((function(){return t[2].call(e)})),yc(n,"class","col-sm-2 mr-4")},m:function(i,a){cc(i,n,a),ac(n,e);for(var c=0;c<u.length;c+=1)u[c].m(e,null);Oc(e,t[0].monthly.day),r||(o=mc(e,"change",t[2]),r=!0)},p:function(t,n){1&n&&Oc(e,t[0].monthly.day)},d:function(t){t&&fc(n),lc(u,t),r=!1,o()}}}function Wp(t){var n,e,r=t[6].title+"";return{c:function(){n=sc("option"),e=dc(r),n.__value=t[6].id,n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Jp(t){var n,e,r=t[6]+1+"";return{c:function(){n=sc("option"),e=dc(r),n.__value=t[6]+1,n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Vp(t){for(var n,e,r,o,i,u,a,c,f=Pl.recurring.monthly_items,l=[],s=0;s<f.length;s+=1)l[s]=Hp(Yp(t,f,s));function d(t,n){return"day"===t[0].monthly.on?Gp:Up}var p=d(t),v=p(t);return{c:function(){n=sc("div"),(e=sc("div")).textContent="".concat(Pl.l10n.recurring.on),r=pc(),o=sc("div"),i=sc("select");for(var a=0;a<l.length;a+=1)l[a].c();u=pc(),v.c(),yc(e,"class","col-sm-2 col-form-label"),yc(i,"class","form-control custom-select"),void 0===t[0].monthly.on&&Uc((function(){return t[1].call(i)})),yc(o,"class","col-sm-4"),yc(n,"class","form-group form-row")},m:function(f,s){cc(f,n,s),ac(n,e),ac(n,r),ac(n,o),ac(o,i);for(var d=0;d<l.length;d+=1)l[d].m(i,null);Oc(i,t[0].monthly.on),ac(n,u),v.m(n,null),a||(c=mc(i,"change",t[1]),a=!0)},p:function(t,e){var r=Wi(e,1)[0];if(0&r){var o;for(f=Pl.recurring.monthly_items,o=0;o<f.length;o+=1){var u=Yp(t,f,o);l[o]?l[o].p(u,r):(l[o]=Hp(u),l[o].c(),l[o].m(i,null))}for(;o<l.length;o+=1)l[o].d(1);l.length=f.length}1&r&&Oc(i,t[0].monthly.on),p===(p=d(t))&&v?v.p(t,r):(v.d(1),(v=p(t))&&(v.c(),v.m(n,null)))},i:Fa,o:Fa,d:function(t){t&&fc(n),lc(l,t),v.d(),a=!1,c()}}}function Qp(t,n,e){var r;return Va(t,Xl,(function(t){return e(0,r=t)})),[r,function(){r.monthly.on=Sc(this),Xl.set(r)},function(){r.monthly.day=Sc(this),Xl.set(r)},function(){r.monthly.weekday=Sc(this),Xl.set(r)}]}var Kp=function(t){nn(e,t);var n=Fp(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Qp,Vp,Wa,{}),r}return e}(vf);function Xp(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Zp(t){var n,e,r,o,i,u,a,c,f,l,s,d,p,v;return{c:function(){n=sc("div"),(e=sc("div")).textContent="".concat(Pl.l10n.recurring.until),r=pc(),o=sc("div"),i=sc("input"),u=pc(),(a=sc("div")).textContent="".concat(Pl.l10n.recurring.or),c=pc(),f=sc("div"),l=sc("input"),s=pc(),(d=sc("div")).textContent="".concat(Pl.l10n.recurring.times),yc(e,"class","col-sm-2 col-form-label"),yc(i,"type","text"),yc(i,"class","form-control"),yc(i,"autocomplete","off"),yc(o,"class","col col-sm-4"),yc(a,"class","col-auto"),yc(l,"class","form-control"),yc(l,"type","number"),yc(l,"min","1"),yc(f,"class","col-3 col-sm-2"),yc(d,"class","col-auto"),yc(n,"class","form-group form-row align-items-center")},m:function(m,h){cc(m,n,h),ac(n,e),ac(n,r),ac(n,o),ac(o,i),t[6](i),ac(n,u),ac(n,a),ac(n,c),ac(n,f),ac(f,l),xc(l,t[1]),ac(n,s),ac(n,d),p||(v=[mc(l,"input",t[7]),mc(l,"input",t[2])],p=!0)},p:function(t,n){2&Wi(n,1)[0]&&$c(l.value)!==t[1]&&xc(l,t[1])},i:Fa,o:Fa,d:function(e){e&&fc(n),t[6](null),p=!1,Ua(v)}}}function tv(t,n,e){var r,o,i,a,c,f;return Va(t,Xl,(function(t){return e(5,r=t)})),Va(t,Yl,(function(t){return e(8,o=t)})),Va(t,Kl,(function(t){return e(1,i=t)})),Mc((function(){null===r.until&&tc(Xl,r.until=o?o.clone().add(1,"month"):moment().add(1,"month"),r),tc(Xl,r.monthly.day=o.date(),r),tc(Xl,r.monthly.weekday=Js(ps()),r),e(3,c=u.default(a).daterangepicker({parentEl:"#bookly-appointment-dialog > div",singleDatePicker:!0,showDropdowns:!0,locale:Pl.datePicker},(function(t){return tc(Xl,r.until=t,r)})).data("daterangepicker"))})),t.$$.update=function(){32&t.$$.dirty&&e(4,f=r.until),24&t.$$.dirty&&f&&c&&(c.setStartDate(f),c.setEndDate(f))},[a,i,function(){var t=0,n=o.clone().add(5,"years"),e=o.clone();do{Ws(e,r,o)&&t++,e.add(1,"days")}while(t<i&&e.isBefore(n));tc(Xl,r.until=e.subtract(1,"days"),r)},c,f,r,function(t){Nc[t?"unshift":"push"]((function(){e(0,a=t)}))},function(){i=$c(this.value),Kl.set(i)}]}var nv=function(t){nn(e,t);var n=Xp(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,tv,Zp,Wa,{}),r}return e}(vf);function ev(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function rv(t){var n,e,r,o,i,u,a,c,f,l,s;r=new jp({});var d=[uv,iv,ov],p=[];function v(t,n){return"daily"===t[0].type?0:"weekly"===t[0].type||"biweekly"===t[0].type?1:2}return i=v(t),u=p[i]=d[i](t),c=new nv({}),l=new wd({props:{type:"danger",show:t[1],class:"mt-n2",$$slots:{default:[av]},$$scope:{ctx:t}}}),{c:function(){n=sc("div"),e=sc("div"),ff(r.$$.fragment),o=pc(),u.c(),a=pc(),ff(c.$$.fragment),f=pc(),ff(l.$$.fragment),yc(e,"class","mt-3"),yc(n,"class","border-left ml-4 pl-3")},m:function(t,u){cc(t,n,u),ac(n,e),lf(r,e,null),ac(e,o),p[i].m(e,null),ac(e,a),lf(c,e,null),ac(e,f),lf(l,e,null),s=!0},p:function(t,n){var r=i;(i=v(t))!==r&&(nf(),of(p[r],1,1,(function(){p[r]=null})),ef(),(u=p[i])||(u=p[i]=d[i](t)).c(),rf(u,1),u.m(e,a));var o={};2&n&&(o.show=t[1]),32&n&&(o.$$scope={dirty:n,ctx:t}),l.$set(o)},i:function(t){s||(rf(r.$$.fragment,t),rf(u),rf(c.$$.fragment,t),rf(l.$$.fragment,t),s=!0)},o:function(t){of(r.$$.fragment,t),of(u),of(c.$$.fragment,t),of(l.$$.fragment,t),s=!1},d:function(t){t&&fc(n),sf(r),p[i].d(),sf(c),sf(l)}}}function ov(t){var n,e;return n=new Kp({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function iv(t){var n,e;return n=new Lp({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function uv(t){var n,e;return n=new Bp({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function av(t){var n,e=Pl.l10n.notices.until_cant_be_earlier+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function cv(t){var n,e,r,o;n=new $p({});var i=t[2]&&rv(t);return{c:function(){ff(n.$$.fragment),e=pc(),i&&i.c(),r=vc()},m:function(t,u){lf(n,t,u),cc(t,e,u),i&&i.m(t,u),cc(t,r,u),o=!0},p:function(t,n){var e=Wi(n,1)[0];t[2]?i?(i.p(t,e),4&e&&rf(i,1)):((i=rv(t)).c(),rf(i,1),i.m(r.parentNode,r)):i&&(nf(),of(i,1,1,(function(){i=null})),ef())},i:function(t){o||(rf(n.$$.fragment,t),rf(i),o=!0)},o:function(t){of(n.$$.fragment,t),of(i),o=!1},d:function(t){sf(n,t),t&&fc(e),i&&i.d(t),t&&fc(r)}}}function fv(t,n,e){var r,o,i,u,a;return Va(t,Xl,(function(t){return e(0,r=t)})),Va(t,Yl,(function(t){return e(3,o=t)})),Va(t,Kl,(function(t){return e(4,i=t)})),Va(t,Ql,(function(t){return e(1,u=t)})),Va(t,Vl,(function(t){return e(2,a=t)})),t.$$.update=function(){if(9&t.$$.dirty&&r.until&&o){var n=0,e=r.until.clone().add(1,"days"),a=o.clone();do{Ws(a,r,o)&&n++,a.add(1,"days")}while(a.isBefore(e));tc(Kl,i=n,i),tc(Ql,u=r.until.isBefore(o),u)}},[r,u,a,o]}var lv=function(t){nn(e,t);var n=ev(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,fv,cv,Wa,{}),r}return e}(vf);function sv(t){var n=kl(t,Pl.statuses);return n?n.title:t}function dv(t){var n=kl(t,Pl.statuses);return n?n.icon:"far fa-question-circle"}function pv(t,n){var e=n,r=u.default(t);return r.booklyPopover({trigger:"hover",container:r.closest(".bookly-js-popover-container"),content:function(){return e},html:!0,placement:"top",template:'<div class="bookly-popover"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'}),{update:function(t){e=t},destroy:function(){r.booklyPopover("dispose")}}}function vv(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function mv(t,n,e){var r=vu(t).call(t);return r[21]=n[e],r}function hv(t,n,e){var r=vu(t).call(t);return r[24]=n[e],r[25]=n,r[26]=e,r}function yv(t,n,e){var r=vu(t).call(t);return r[27]=n[e],r}function gv(t){var n,e,r,o,i,u,a=fs(t[2])+"",c=t[1].max+"";return{c:function(){n=sc("span"),e=dc("("),r=dc(a),o=dc("/"),i=dc(c),u=dc(")"),yc(n,"title",Pl.l10n.selected_maximum)},m:function(t,a){cc(t,n,a),ac(n,e),ac(n,r),ac(n,o),ac(n,i),ac(n,u)},p:function(t,n){4&n&&a!==(a=fs(t[2])+"")&&wc(r,a),2&n&&c!==(c=t[1].max+"")&&wc(i,c)},d:function(t){t&&fc(n)}}}function _v(t){var n,e,r,o;return{c:function(){n=sc("span"),yc(e=sc("i"),"class","fas fa-fw"),Ec(e,"fa-angle-down",!t[0]),Ec(e,"fa-angle-up",t[0]),yc(n,"role","button")},m:function(i,u){cc(i,n,u),ac(n,e),r||(o=mc(n,"click",t[13]),r=!0)},p:function(t,n){1&n&&Ec(e,"fa-angle-down",!t[0]),1&n&&Ec(e,"fa-angle-up",t[0])},d:function(t){t&&fc(n),r=!1,o()}}}function $v(t){var n,e;return n=new wd({props:{type:"success",$$slots:{default:[bv]},$$scope:{ctx:t}}}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},p:function(t,e){var r={};1073741826&e&&(r.$$scope={dirty:e,ctx:t}),n.$set(r)},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function bv(t){var n,e,r,o=Pl.l10n.minimum_capacity+"",i=t[1].min+"";return{c:function(){n=dc(o),e=dc(": "),r=dc(i)},m:function(t,o){cc(t,n,o),cc(t,e,o),cc(t,r,o)},p:function(t,n){2&n&&i!==(i=t[1].min+"")&&wc(r,i)},d:function(t){t&&fc(n),t&&fc(e),t&&fc(r)}}}function wv(t){var n,e,r,o;return{c:function(){(n=sc("button")).innerHTML='<i class="fas fa-fw fa-list"></i>',yc(n,"type","button"),yc(n,"class","btn btn-default px-2 py-1")},m:function(i,u){var a;(cc(i,n,u),r)||(o=[mc(n,"click",(function(){Ga(t[9](t[24]))&&t[9](t[24]).apply(this,arguments)})),nc(e=pv.call(null,n,Zu(a="".concat(Pl.l10n.part_of_collaborative_services,": ")).call(a,t[24].collaborative_service)))],r=!0)},p:function(n,r){var o;t=n,e&&Ga(e.update)&&4&r&&e.update.call(null,Zu(o="".concat(Pl.l10n.part_of_collaborative_services,": ")).call(o,t[24].collaborative_service))},d:function(t){t&&fc(n),r=!1,Ua(o)}}}function xv(t){var n,e,r,o;return{c:function(){(n=sc("button")).innerHTML='<i class="fas fa-fw fa-list"></i>',yc(n,"type","button"),yc(n,"class","btn btn-default px-2 py-1")},m:function(i,u){var a;(cc(i,n,u),r)||(o=[mc(n,"click",(function(){Ga(t[10](t[24]))&&t[10](t[24]).apply(this,arguments)})),nc(e=pv.call(null,n,Zu(a="".concat(Pl.l10n.part_of_compound_services,": ")).call(a,t[24].compound_service)))],r=!0)},p:function(n,r){var o;t=n,e&&Ga(e.update)&&4&r&&e.update.call(null,Zu(o="".concat(Pl.l10n.part_of_compound_services,": ")).call(o,t[24].compound_service))},d:function(t){t&&fc(n),r=!1,Ua(o)}}}function kv(t){var n,e,r,o,i,u,a=t[27].title+"";function c(){return t[14](t[24],t[27],t[25],t[26])}return{c:function(){n=sc("a"),e=sc("span"),r=dc(a),o=pc(),yc(e,"class","fa-fw mr-2 "+t[27].icon),yc(n,"href",""),yc(n,"class","dropdown-item pl-3")},m:function(t,a){cc(t,n,a),ac(n,e),ac(n,r),ac(n,o),i||(u=mc(n,"click",hc(c)),i=!0)},p:function(n,e){t=n},d:function(t){t&&fc(n),i=!1,u()}}}function Ov(t){var n,e,r,o,i;return{c:function(){n=sc("button"),yc(e=sc("span"),"class","fas fa-fw"),Ec(e,"fa-search-dollar",El("pro")&&!t[24].payment_type),Ec(e,"fa-dollar-sign","full"===t[24].payment_type),Ec(e,"fa-hand-holding-usd","partial"===t[24].payment_type),yc(n,"type","button"),yc(n,"class","btn btn-default px-2 py-1")},m:function(u,a){var c;(cc(u,n,a),ac(n,e),o)||(i=[mc(n,"click",(function(){Ga(t[7](t[24]))&&t[7](t[24]).apply(this,arguments)})),nc(r=pv.call(null,n,t[24].payment_type?Zu(c="".concat(Pl.l10n.payment,": ")).call(c,t[24].payment_title):Pl.l10n.attach_payment))],o=!0)},p:function(n,o){var i;t=n,4&o&&Ec(e,"fa-search-dollar",El("pro")&&!t[24].payment_type),4&o&&Ec(e,"fa-dollar-sign","full"===t[24].payment_type),4&o&&Ec(e,"fa-hand-holding-usd","partial"===t[24].payment_type),r&&Ga(r.update)&&4&o&&r.update.call(null,t[24].payment_type?Zu(i="".concat(Pl.l10n.payment,": ")).call(i,t[24].payment_title):Pl.l10n.attach_payment)},d:function(t){t&&fc(n),o=!1,Ua(i)}}}function Sv(t){var n,e,r;return{c:function(){(n=sc("button")).innerHTML='<span class="far fa-fw fa-calendar-alt"></span>',yc(n,"type","button"),yc(n,"class","btn btn-default px-2 py-1")},m:function(o,i){cc(o,n,i),e||(r=[mc(n,"click",(function(){Ga(t[8](t[24]))&&t[8](t[24]).apply(this,arguments)})),nc(pv.call(null,n,Pl.l10n.package_schedule))],e=!0)},p:function(n,e){t=n},d:function(t){t&&fc(n),e=!1,Ua(r)}}}function Ev(t){var n,e,r;return{c:function(){(n=sc("button")).innerHTML='<span class="fas fa-fw fa-link"></span>',yc(n,"type","button"),yc(n,"class","btn btn-default px-2 py-1")},m:function(o,i){cc(o,n,i),e||(r=[mc(n,"click",(function(){Ga(t[11](t[24]))&&t[11](t[24]).apply(this,arguments)})),nc(pv.call(null,n,Pl.l10n.view_series))],e=!0)},p:function(n,e){t=n},d:function(t){t&&fc(n),e=!1,Ua(r)}}}function Av(t){for(var n,e,r,o,i,u,a,c,f,l,s,d,p,v,m,h,y,g,_,$,b,w,x,k,O,S,E,A,j=t[24].name+"",T=El("collaborative-services")&&t[24].collaborative_token,P=El("compound-services")&&t[24].compound_token,R=t[24].payment_id||El("pro"),B=t[24].number_of_persons+"",D=El("packages")&&t[24].package_id,I=El("recurring-appointments")&&t[24].series_id,M=T&&wv(t),C=P&&xv(t),N=Pl.statuses,L=[],F=0;F<N.length;F+=1)L[F]=kv(yv(t,N,F));var z=R&&Ov(t),q=D&&Sv(t),Y=I&&Ev(t);return{c:function(){n=sc("li"),e=sc("div"),r=sc("a"),o=dc(j),i=pc(),u=sc("div"),M&&M.c(),a=pc(),C&&C.c(),c=pc(),f=sc("div"),l=sc("button"),s=sc("span"),v=pc(),m=sc("div");for(var p=0;p<L.length;p+=1)L[p].c();h=pc(),z&&z.c(),y=pc(),g=sc("button"),_=sc("i"),$=dc("×"),b=dc(B),w=pc(),q&&q.c(),x=pc(),Y&&Y.c(),k=pc(),O=sc("a"),S=pc(),yc(r,"title",Pl.l10n.edit_booking_details),yc(r,"href",""),yc(e,"class","col mt-1"),yc(s,"class",d="fa-fw "+dv(t[24].status)),yc(l,"type","button"),yc(l,"class","btn btn-default px-2 py-1 dropdown-toggle"),yc(l,"data-toggle","dropdown"),yc(m,"class","dropdown-menu"),yc(f,"class","dropdown d-inline-block"),yc(_,"class","far fa-fw fa-user"),yc(g,"class","btn btn-default px-2 py-1"),kc(g,"opacity","1"),yc(O,"href","#"),yc(O,"class","far fa-fw fa-trash-alt text-danger"),yc(u,"class","ml-auto"),yc(n,"class","row mb-1 bookly-js-popover-container"),Ec(n,"d-none",t[26]>4&&!t[0])},m:function(d,j){cc(d,n,j),ac(n,e),ac(e,r),ac(r,o),ac(n,i),ac(n,u),M&&M.m(u,null),ac(u,a),C&&C.m(u,null),ac(u,c),ac(u,f),ac(f,l),ac(l,s),ac(f,v),ac(f,m);for(var T=0;T<L.length;T+=1)L[T].m(m,null);var P;(ac(u,h),z&&z.m(u,null),ac(u,y),ac(u,g),ac(g,_),ac(g,$),ac(g,b),ac(u,w),q&&q.m(u,null),ac(u,x),Y&&Y.m(u,null),ac(u,k),ac(u,O),ac(n,S),E)||(A=[mc(r,"click",hc((function(){Ga(t[5](t[24]))&&t[5](t[24]).apply(this,arguments)}))),nc(p=pv.call(null,l,Zu(P="".concat(Pl.l10n.status,": ")).call(P,sv(t[24].status)))),mc(g,"click",(function(){Ga(t[6](t[24].id))&&t[6](t[24].id).apply(this,arguments)})),mc(O,"click",hc((function(){Ga(t[12](t[24]))&&t[12](t[24]).apply(this,arguments)}))),nc(pv.call(null,O,Pl.l10n.remove_customer))],E=!0)},p:function(e,r){var i;if(t=e,4&r&&j!==(j=t[24].name+"")&&wc(o,j),4&r&&(T=El("collaborative-services")&&t[24].collaborative_token),T?M?M.p(t,r):((M=wv(t)).c(),M.m(u,a)):M&&(M.d(1),M=null),4&r&&(P=El("compound-services")&&t[24].compound_token),P?C?C.p(t,r):((C=xv(t)).c(),C.m(u,c)):C&&(C.d(1),C=null),4&r&&d!==(d="fa-fw "+dv(t[24].status))&&yc(s,"class",d),p&&Ga(p.update)&&4&r&&p.update.call(null,Zu(i="".concat(Pl.l10n.status,": ")).call(i,sv(t[24].status))),4&r){var f;for(N=Pl.statuses,f=0;f<N.length;f+=1){var l=yv(t,N,f);L[f]?L[f].p(l,r):(L[f]=kv(l),L[f].c(),L[f].m(m,null))}for(;f<L.length;f+=1)L[f].d(1);L.length=N.length}4&r&&(R=t[24].payment_id||El("pro")),R?z?z.p(t,r):((z=Ov(t)).c(),z.m(u,y)):z&&(z.d(1),z=null),4&r&&B!==(B=t[24].number_of_persons+"")&&wc(b,B),4&r&&(D=El("packages")&&t[24].package_id),D?q?q.p(t,r):((q=Sv(t)).c(),q.m(u,x)):q&&(q.d(1),q=null),4&r&&(I=El("recurring-appointments")&&t[24].series_id),I?Y?Y.p(t,r):((Y=Ev(t)).c(),Y.m(u,k)):Y&&(Y.d(1),Y=null),1&r&&Ec(n,"d-none",t[26]>4&&!t[0])},d:function(t){t&&fc(n),M&&M.d(),C&&C.d(),lc(L,t),z&&z.d(),q&&q.d(),Y&&Y.d(),E=!1,Ua(A)}}}function jv(t){var n,e,r;return{c:function(){(n=sc("span")).textContent="...",yc(n,"class","btn btn-default"),kc(n,"width","100%"),kc(n,"line-height","0"),kc(n,"padding-top","0"),kc(n,"padding-bottom","8px"),kc(n,"margin-bottom","10px"),yc(n,"role","button")},m:function(o,i){cc(o,n,i),e||(r=mc(n,"click",t[15]),e=!0)},p:Fa,d:function(t){t&&fc(n),e=!1,r()}}}function Tv(t){var n,e=Pl.l10n.notices.overflow_capacity.replace("%d",t[4].overflow_capacity)+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:function(t,r){16&r&&e!==(e=Pl.l10n.notices.overflow_capacity.replace("%d",t[4].overflow_capacity)+"")&&wc(n,e)},d:function(t){t&&fc(n)}}}function Pv(t){for(var n,e,r=t[4].customers_appointments_limit,o=[],i=0;i<r.length;i+=1)o[i]=Bv(mv(t,r,i));var u=function(t){return of(o[t],1,1,(function(){o[t]=null}))};return{c:function(){for(var t=0;t<o.length;t+=1)o[t].c();n=vc()},m:function(t,r){for(var i=0;i<o.length;i+=1)o[i].m(t,r);cc(t,n,r),e=!0},p:function(t,e){if(16&e){var i;for(r=t[4].customers_appointments_limit,i=0;i<r.length;i+=1){var a=mv(t,r,i);o[i]?(o[i].p(a,e),rf(o[i],1)):(o[i]=Bv(a),o[i].c(),rf(o[i],1),o[i].m(n.parentNode,n))}for(nf(),i=r.length;i<o.length;i+=1)u(i);ef()}},i:function(t){if(!e){for(var n=0;n<r.length;n+=1)rf(o[n]);e=!0}},o:function(t){o=Oa(o).call(o,Boolean);for(var n=0;n<o.length;n+=1)of(o[n]);e=!1},d:function(t){lc(o,t),t&&fc(n)}}}function Rv(t){var n,e=t[21]+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:function(t,r){16&r&&e!==(e=t[21]+"")&&wc(n,e)},d:function(t){t&&fc(n)}}}function Bv(t){var n,e;return n=new wd({props:{$$slots:{default:[Rv]},$$scope:{ctx:t}}}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},p:function(t,e){var r={};1073741840&e&&(r.$$scope={dirty:e,ctx:t}),n.$set(r)},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Dv(t){for(var n,e,r,o,i,u,a,c,f,l,s,d,p,v=Pl.l10n.customers+"",m=t[1].min>1&&t[1].min>fs(t[2]),h=t[3]&&gv(t),y=t[2].length>5&&_v(t),g=m&&$v(t),_=t[2],$=[],b=0;b<_.length;b+=1)$[b]=Av(hv(t,_,b));var w=t[2].length>5&&!t[0]&&jv(t);l=new wd({props:{show:t[4].overflow_capacity>0,type:"danger",$$slots:{default:[Tv]},$$scope:{ctx:t}}});var x=t[4].customers_appointments_limit&&Pv(t);return{c:function(){n=sc("label"),e=dc(v),r=pc(),h&&h.c(),o=pc(),y&&y.c(),i=pc(),g&&g.c(),u=pc(),a=sc("ul");for(var p=0;p<$.length;p+=1)$[p].c();c=pc(),w&&w.c(),f=pc(),ff(l.$$.fragment),s=pc(),x&&x.c(),d=vc(),yc(a,"class","list-unstyled pl-0 bookly-hide-empty mr-3"),Ec(a,"my-0",!t[2].length)},m:function(t,v){cc(t,n,v),ac(n,e),ac(n,r),h&&h.m(n,null),cc(t,o,v),y&&y.m(t,v),cc(t,i,v),g&&g.m(t,v),cc(t,u,v),cc(t,a,v);for(var m=0;m<$.length;m+=1)$[m].m(a,null);cc(t,c,v),w&&w.m(t,v),cc(t,f,v),lf(l,t,v),cc(t,s,v),x&&x.m(t,v),cc(t,d,v),p=!0},p:function(t,e){var r=Wi(e,1)[0];if(t[3]?h?h.p(t,r):((h=gv(t)).c(),h.m(n,null)):h&&(h.d(1),h=null),t[2].length>5?y?y.p(t,r):((y=_v(t)).c(),y.m(i.parentNode,i)):y&&(y.d(1),y=null),6&r&&(m=t[1].min>1&&t[1].min>fs(t[2])),m?g?(g.p(t,r),6&r&&rf(g,1)):((g=$v(t)).c(),rf(g,1),g.m(u.parentNode,u)):g&&(nf(),of(g,1,1,(function(){g=null})),ef()),8165&r){var o;for(_=t[2],o=0;o<_.length;o+=1){var c=hv(t,_,o);$[o]?$[o].p(c,r):($[o]=Av(c),$[o].c(),$[o].m(a,null))}for(;o<$.length;o+=1)$[o].d(1);$.length=_.length}4&r&&Ec(a,"my-0",!t[2].length),t[2].length>5&&!t[0]?w?w.p(t,r):((w=jv(t)).c(),w.m(f.parentNode,f)):w&&(w.d(1),w=null);var s={};16&r&&(s.show=t[4].overflow_capacity>0),1073741840&r&&(s.$$scope={dirty:r,ctx:t}),l.$set(s),t[4].customers_appointments_limit?x?(x.p(t,r),16&r&&rf(x,1)):((x=Pv(t)).c(),rf(x,1),x.m(d.parentNode,d)):x&&(nf(),of(x,1,1,(function(){x=null})),ef())},i:function(t){p||(rf(g),rf(l.$$.fragment,t),rf(x),p=!0)},o:function(t){of(g),of(l.$$.fragment,t),of(x),p=!1},d:function(t){t&&fc(n),h&&h.d(),t&&fc(o),y&&y.d(t),t&&fc(i),g&&g.d(t),t&&fc(u),t&&fc(a),lc($,t),t&&fc(c),w&&w.d(t),t&&fc(f),sf(l,t),t&&fc(s),x&&x.d(t),t&&fc(d)}}}function Iv(t,n,e){var r,o,i,a,c,f,l,s,d;Va(t,ks,(function(t){return e(1,r=t)})),Va(t,Zl,(function(t){return e(2,o=t)})),Va(t,Pf,(function(t){return e(16,i=t)})),Va(t,os,(function(t){return e(17,a=t)})),Va(t,Ml,(function(t){return e(18,c=t)})),Va(t,Cl,(function(t){return e(3,f=t)})),Va(t,gs,(function(t){return e(19,l=t)})),Va(t,_s,(function(t){return e(20,s=t)})),Va(t,es,(function(t){return e(4,d=t)}));var p=!1;function v(t){tc(Zl,o=Oa(o).call(o,(function(n){return n!==t})),o)}return[p,r,o,f,d,function(t){BooklyCustomerDetailsDialog.showDialog({customer:t,service:Cl.get(),capacity:Math.max(1,r.max-fs(o,t)),done:function(){return Zl.set(o)}})},function(t){BooklyCustomerDialog.showDialog({action:"load",customerId:t,onDone:function(t){var n=ss(t);Oa(o).call(o,(function(e){e.id===t.id&&(e.name=n,e.group_id=t.group_id)}));var e=kl(t.id,i.customers);e&&(e.name=n,e.group_id=t.group_id),Pf.set(i),Zl.set(o),tc(os,a=!0,a)}})},function(t){if(!t.payment_id||t.payment_action){var n="";if(c&&f){var e=kl(f.id,c.services);null!=e&&e.price&&(n=e.price)}BooklyAttachPaymentDialog.showDialog({customer:t,onlyForCurrent:!(El("recurring-appointments")&&(null===l.id||t.series_id)),price:n,done:function(){return Zl.set(o)}})}else BooklyPaymentDetailsDialog.showDialog({customer:t,done:function(){return Zl.set(o)}})},function(t){u.default(document.body).trigger("bookly_packages.schedule_dialog",[t.package_id,function(n){xl(n).call(n,Number(t.ca_id))&&v(t),s("refresh")}])},function(t){var n=u.default(".bookly-js-staff-pills li > a.active"),e=n.length?function(){return n.trigger("click")}:function(){return u.default("#bookly-appointments-list").DataTable().ajax.reload()};BooklyCollaborativeDialog.showDialog({collaborative_token:t.collaborative_token,done:e})},function(t){var n=u.default(".bookly-js-staff-pills li > a.active"),e=n.length?function(){return n.trigger("click")}:function(){return u.default("#bookly-appointments-list").DataTable().ajax.reload()};BooklyCompoundDialog.showDialog({compound_token:t.compound_token,done:e})},function(t){var n=u.default(".bookly-js-staff-pills li > a.active"),e=n.length?function(){return n.trigger("click")}:function(){return u.default("#bookly-appointments-list").DataTable().ajax.reload()};BooklySeriesDialog.showDialog({series_id:t.series_id,done:e})},v,function(){return e(0,p=!p)},function(t,n,e,r){return tc(Zl,e[r].status=n.id,o)},function(){return e(0,p=!p)}]}var Mv=function(t){nn(e,t);var n=vv(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Iv,Dv,Wa,{}),r}return e}(vf);function Cv(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Nv(t,n){var e;if(void 0===Ji||null==hu(t)){if(yu(t)||(e=function(t,n){var e;if(!t)return;if("string"==typeof t)return Lv(t,n);var r=vu(e=Object.prototype.toString.call(t)).call(e,8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return oa(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Lv(t,n)}(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){e=Si(t)},n:function(){var t=e.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==e.return||e.return()}finally{if(a)throw i}}}}function Lv(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}function Fv(t,n,e){var r=vu(t).call(t);return r[12]=n[e],r}function zv(t){var n,e,r,o=t[12].name+"";return{c:function(){n=sc("option"),e=dc(o),n.__value=r=t[12].id,n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,i){2&i&&o!==(o=t[12].name+"")&&wc(e,o),2&i&&r!==(r=t[12].id)&&(n.__value=r,n.value=n.__value)},d:function(t){t&&fc(n)}}}function qv(t){for(var n,e,r,o,i,u,a,c,f,l,s=Pl.l10n.new_customer+"",d=t[1].customers,p=[],v=0;v<d.length;v+=1)p[v]=zv(Fv(t,d,v));return{c:function(){n=sc("div"),e=sc("select");for(var f=0;f<p.length;f+=1)p[f].c();r=pc(),o=sc("div"),i=sc("button"),u=sc("i"),a=pc(),c=dc(s),yc(e,"class","form-control"),yc(e,"data-placeholder",Pl.l10n.search_customers),e.multiple=!0,yc(u,"class","fas fa-fw fa-plus"),yc(i,"class","btn btn-success"),yc(i,"type","button"),yc(o,"class","input-group-append"),yc(n,"class","input-group"),Ec(n,"d-none",t[2])},m:function(s,d){cc(s,n,d),ac(n,e);for(var v=0;v<p.length;v+=1)p[v].m(e,null);t[8](e),ac(n,r),ac(n,o),ac(o,i),ac(i,u),ac(i,a),ac(i,c),f||(l=mc(i,"click",t[3]),f=!0)},p:function(t,r){var o=Wi(r,1)[0];if(2&o){var i;for(d=t[1].customers,i=0;i<d.length;i+=1){var u=Fv(t,d,i);p[i]?p[i].p(u,o):(p[i]=zv(u),p[i].c(),p[i].m(e,null))}for(;i<p.length;i+=1)p[i].d(1);p.length=d.length}4&o&&Ec(n,"d-none",t[2])},i:Fa,o:Fa,d:function(e){e&&fc(n),lc(p,e),t[8](null),f=!1,l()}}}function Yv(t,n,e){var r,o,i,a,c,f,l,s,d;function p(){!function(t,n){u.default(t).booklySelect2({theme:"bootstrap4",dropdownParent:"#bookly-appointment-dialog",allowClear:!1,language:{noResults:function(){return Pl.l10n.no_result_found}}}).off().on("booklySelect2:select booklySelect2:unselect",(function(t){return n(Xf(t.params.data.id))}))}(f,(function(t){var n,e=Ol(kl(t,r.customers));as(e),tc(Zl,o=Zu(n=[]).call(n,Gu(o),[e]),o)}))}function v(){!function(t,n,e){u.default(t).booklySelect2({theme:"bootstrap4",dropdownParent:"#bookly-appointment-dialog",allowClear:!1,language:{noResults:function(){return Pl.l10n.no_result_found},searching:function(){return Pl.l10n.searching}},ajax:{url:ajaxurl,dataType:"json",delay:250,data:function(t){return{action:"bookly_get_customers_list",filter:t.term,page:t.page||1,timezone:!0,csrf_token:Al}},processResults:function(t){var n;return e(t),{results:_a(n=t.results).call(n,(function(t){return{id:t.id,text:t.name}})),pagination:t.pagination}}}}).off().on("booklySelect2:selecting",(function(e){e.preventDefault(),n(e.params.args.data.id),u.default(t).booklySelect2("close")}))}(f,(function(t){var n,e=Ol(kl(t,r.customers));as(e),tc(Zl,o=Zu(n=[]).call(n,Gu(o),[e]),o)}),(function(t){var n,e=Nv(t.results);try{for(e.s();!(n=e.n()).done;){var o,i=n.value;if(!kl(i.id,r.customers))tc(Pf,r.customers=Zu(o=[]).call(o,Gu(r.customers),[i]),r)}}catch(t){e.e(t)}finally{e.f()}}))}return Va(t,Pf,(function(t){return e(1,r=t)})),Va(t,Zl,(function(t){return e(5,o=t)})),Va(t,os,(function(t){return e(9,i=t)})),Va(t,Cl,(function(t){return e(6,a=t)})),Va(t,ks,(function(t){return e(7,c=t)})),d=function(){if(f&&i){var t=u.default(f).data("booklySelect2");if(t){var n=t.options.options;u.default(f).booklySelect2("destroy"),u.default(f).booklySelect2(n)}tc(os,i=!1,i)}},Ic().$$.after_update.push(d),t.$$.update=function(){2&t.$$.dirty&&e(4,l=r.customers_loaded?"normal":!1===r.customers_loaded?"remote":void 0),17&t.$$.dirty&&f&&("normal"===l?p():"remote"===l&&v()),224&t.$$.dirty&&e(2,s=!El("waiting-list")&&a&&fs(o)>=c.max)},[f,r,s,function(){BooklyCustomerDialog.showDialog({action:"create",onDone:function(t){var n=ss(t);r.customers.push({name:n,group_id:t.group_id,id:t.id,number_of_persons:1,timezone:null});var e={id:t.id,name:n,group_id:t.group_id,number_of_persons:1,timezone:null};as(e),o.push(e),Zl.set(o),Pf.set(r)}})},l,o,a,c,function(t){Nc[t?"unshift":"push"]((function(){e(0,f=t)}))}]}var Hv=function(t){nn(e,t);var n=Cv(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Yv,qv,Wa,{}),r}return e}(vf);function Uv(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Gv(t){for(var n,e,r,o,i,u,a,c,f=t[3]?"…":"",l=t[9].default,s=Qa(l,t,t[8],null),d=[{type:t[0]},{class:i="btn ladda-button "+t[1]},{"data-spinner-size":"40"},{"data-style":"zoom-in"},t[6]],p={},v=0;v<d.length;v+=1)p=qa(p,d[v]);return{c:function(){n=sc("button"),e=sc("span"),s&&s.c(),r=dc(t[2]),o=dc(f),yc(e,"class","ladda-label"),gc(n,p)},m:function(i,f){cc(i,n,f),ac(n,e),s&&s.m(e,null),ac(e,r),ac(e,o),t[11](n),u=!0,a||(c=[mc(n,"click",t[12]),mc(n,"click",t[10])],a=!0)},p:function(t,e){var a=Wi(e,1)[0];s&&s.p&&256&a&&Xa(s,l,t,t[8],a,null,null),(!u||4&a)&&wc(r,t[2]),(!u||8&a)&&f!==(f=t[3]?"…":"")&&wc(o,f),gc(n,p=function(t,n){for(var e={},r={},o={$$scope:1},i=t.length;i--;){var u=t[i],a=n[i];if(a){for(var c in u)c in a||(r[c]=1);for(var f in a)o[f]||(e[f]=a[f],o[f]=1);t[i]=a}else for(var l in u)o[l]=1}for(var s in r)s in e||(e[s]=void 0);return e}(d,[(!u||1&a)&&{type:t[0]},(!u||2&a&&i!==(i="btn ladda-button "+t[1]))&&{class:i},{"data-spinner-size":"40"},{"data-style":"zoom-in"},64&a&&t[6]]))},i:function(t){u||(rf(s,t),u=!0)},o:function(t){of(s,t),u=!1},d:function(e){e&&fc(n),s&&s.d(e),t[11](null),a=!1,Ua(c)}}}function Wv(t,n,e){var r,o,i,u=["type","class","caption","loading","ellipsis"],a=Za(n,u),c=n,l=c.$$slots,s=void 0===l?{}:l,d=c.$$scope,p=n.type,v=void 0===p?"button":p,m=n.class,h=void 0===m?"btn-default":m,y=n.caption,g=void 0===y?"":y,_=n.loading,$=void 0!==_&&_,b=n.ellipsis,w=void 0!==b&&b;i=function(){return o&&o.remove()},Ic().$$.on_destroy.push(i);return t.$$set=function(t){n=qa(qa({},n),function(t){var n={};for(var e in t)"$"!==e[0]&&(n[e]=t[e]);return n}(t)),e(6,a=Za(n,u)),"type"in t&&e(0,v=t.type),"class"in t&&e(1,h=t.class),"caption"in t&&e(2,g=t.caption),"loading"in t&&e(7,$=t.loading),"ellipsis"in t&&e(3,w=t.ellipsis),"$$scope"in t&&e(8,d=t.$$scope)},t.$$.update=function(){144&t.$$.dirty&&o&&($?o.start():o.stop())},[v,h,g,w,o,r,a,$,d,s,function(n){!function(t,n){var e,r=t.$$.callbacks[n.type];r&&uu(e=vu(r).call(r)).call(e,(function(t){return t(n)}))}(t,n)},function(t){Nc[t?"unshift":"push"]((function(){e(5,r=t)}))},function(){return!o&&e(4,o=f.default.create(r))}]}var Jv=function(t){nn(e,t);var n=Uv(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Wv,Gv,Wa,{type:0,class:1,caption:2,loading:7,ellipsis:3}),r}return e}(vf);function Vv(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Qv(t){var n,e=Pl.l10n.notices.date_interval_warning+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Kv(t){var n,e=Pl.l10n.notices.interval_not_in_staff_schedule+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Xv(t){var n,e=Pl.l10n.notices.interval_not_in_service_schedule+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Zv(t){var n;return{c:function(){yc(n=sc("i"),"class","far fa-fw fa-edit mr-1")},m:function(t,e){cc(t,n,e)},d:function(t){t&&fc(n)}}}function tm(t){var n,e,r,o,i,u,a=Pl.l10n.notices.date_interval_not_available+"",c=Pl.l10n.view+"";return(i=new Jv({props:{class:"btn-link btn-sm p-0",caption:t[0].date_interval_not_available.service,$$slots:{default:[Zv]},$$scope:{ctx:t}}})).$on("click",t[1]),{c:function(){n=dc(a),e=dc(". "),r=dc(c),o=pc(),ff(i.$$.fragment)},m:function(t,a){cc(t,n,a),cc(t,e,a),cc(t,r,a),cc(t,o,a),lf(i,t,a),u=!0},p:function(t,n){var e={};1&n&&(e.caption=t[0].date_interval_not_available.service),4&n&&(e.$$scope={dirty:n,ctx:t}),i.$set(e)},i:function(t){u||(rf(i.$$.fragment,t),u=!0)},o:function(t){of(i.$$.fragment,t),u=!1},d:function(t){t&&fc(n),t&&fc(e),t&&fc(r),t&&fc(o),sf(i,t)}}}function nm(t){var n,e=Pl.l10n.notices.staff_reaches_working_time_limit+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function em(t){var n,e=Pl.l10n.notices.no_timeslots_available+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function rm(t){var n,e,r,o,i,u,a,c,f,l,s,d;return n=new wd({props:{show:t[0].date_interval_warning,class:"mt-n2",$$slots:{default:[Qv]},$$scope:{ctx:t}}}),r=new wd({props:{show:t[0].interval_not_in_staff_schedule,class:"mt-n2",$$slots:{default:[Kv]},$$scope:{ctx:t}}}),i=new wd({props:{show:t[0].interval_not_in_service_schedule,class:"mt-n2",$$slots:{default:[Xv]},$$scope:{ctx:t}}}),a=new wd({props:{show:t[0].date_interval_not_available,class:"mt-n2",$$slots:{default:[tm]},$$scope:{ctx:t}}}),f=new wd({props:{show:t[0].staff_reaches_working_time_limit,class:"mt-n2",$$slots:{default:[nm]},$$scope:{ctx:t}}}),s=new wd({props:{show:t[0].no_timeslots_available,class:"mt-n2",$$slots:{default:[em]},$$scope:{ctx:t}}}),{c:function(){ff(n.$$.fragment),e=pc(),ff(r.$$.fragment),o=pc(),ff(i.$$.fragment),u=pc(),ff(a.$$.fragment),c=pc(),ff(f.$$.fragment),l=pc(),ff(s.$$.fragment)},m:function(t,p){lf(n,t,p),cc(t,e,p),lf(r,t,p),cc(t,o,p),lf(i,t,p),cc(t,u,p),lf(a,t,p),cc(t,c,p),lf(f,t,p),cc(t,l,p),lf(s,t,p),d=!0},p:function(t,e){var o=Wi(e,1)[0],u={};1&o&&(u.show=t[0].date_interval_warning),4&o&&(u.$$scope={dirty:o,ctx:t}),n.$set(u);var c={};1&o&&(c.show=t[0].interval_not_in_staff_schedule),4&o&&(c.$$scope={dirty:o,ctx:t}),r.$set(c);var l={};1&o&&(l.show=t[0].interval_not_in_service_schedule),4&o&&(l.$$scope={dirty:o,ctx:t}),i.$set(l);var d={};1&o&&(d.show=t[0].date_interval_not_available),5&o&&(d.$$scope={dirty:o,ctx:t}),a.$set(d);var p={};1&o&&(p.show=t[0].staff_reaches_working_time_limit),4&o&&(p.$$scope={dirty:o,ctx:t}),f.$set(p);var v={};1&o&&(v.show=t[0].no_timeslots_available),4&o&&(v.$$scope={dirty:o,ctx:t}),s.$set(v)},i:function(t){d||(rf(n.$$.fragment,t),rf(r.$$.fragment,t),rf(i.$$.fragment,t),rf(a.$$.fragment,t),rf(f.$$.fragment,t),rf(s.$$.fragment,t),d=!0)},o:function(t){of(n.$$.fragment,t),of(r.$$.fragment,t),of(i.$$.fragment,t),of(a.$$.fragment,t),of(f.$$.fragment,t),of(s.$$.fragment,t),d=!1},d:function(t){sf(n,t),t&&fc(e),sf(r,t),t&&fc(o),sf(i,t),t&&fc(u),sf(a,t),t&&fc(c),sf(f,t),t&&fc(l),sf(s,t)}}}function om(t,n,e){var r;Va(t,es,(function(t){return e(0,r=t)}));return[r,function(){return BooklyAppointmentDialog.showDialog(r.date_interval_not_available.appointment_id,null,null,(function(){}))}]}var im=function(t){nn(e,t);var n=Vv(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,om,rm,Wa,{}),r}return e}(vf);function um(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function am(t){var n,e,r,o,i,u;return{c:function(){n=sc("div"),e=sc("input"),r=pc(),(o=sc("label")).textContent="".concat(Pl.l10n.skip_date),yc(e,"type","checkbox"),yc(e,"id","bookly-skip-date"),yc(e,"class","custom-control-input"),yc(o,"for","bookly-skip-date"),yc(o,"class","custom-control-label"),yc(n,"class","custom-control custom-checkbox mb-2")},m:function(a,c){cc(a,n,c),ac(n,e),e.checked=t[0],ac(n,r),ac(n,o),i||(u=mc(e,"change",t[1]),i=!0)},p:function(t,n){1&Wi(n,1)[0]&&(e.checked=t[0])},i:Fa,o:Fa,d:function(t){t&&fc(n),i=!1,u()}}}function cm(t,n,e){var r;return Va(t,ql,(function(t){return e(0,r=t)})),[r,function(){r=this.checked,ql.set(r)}]}var fm=function(t){nn(e,t);var n=um(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,cm,am,Wa,{}),r}return e}(vf);function lm(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function sm(t){var n,e,r,o;function i(t,n){return t[1]&&t[1].url?pm:dm}var u=i(t),a=u(t);return{c:function(){n=sc("div"),(e=sc("label")).textContent="".concat(Pl.l10n.online_meeting),r=pc(),o=sc("div"),a.c(),yc(n,"class","form-group")},m:function(i,u){cc(i,n,u),ac(n,e),ac(n,r),ac(n,o),a.m(o,null),t[4](n)},p:function(t,n){u===(u=i(t))&&a?a.p(t,n):(a.d(1),(a=u(t))&&(a.c(),a.m(o,null)))},d:function(e){e&&fc(n),a.d(),t[4](null)}}}function dm(t){var n;return{c:function(){(n=sc("small")).textContent="".concat(Pl.l10n.meeting_create),yc(n,"class","text-muted")},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function pm(t){var n,e,r,o,i,u,a,c,f,l=t[1].url+"";function s(t,n){return t[1].copied?mm:vm}var d=s(t),p=d(t);return{c:function(){n=sc("div"),e=sc("a"),r=dc(l),i=pc(),u=sc("i"),a=pc(),p.c(),c=pc(),(f=sc("small")).textContent="".concat(Pl.l10n.meeting_code),yc(e,"href",o=t[1].url),yc(e,"target","_blank"),yc(e,"class","text-truncate"),yc(u,"class","fas fa-external-link-alt fa-fw fa-sm text-muted ml-1 mr-2"),yc(n,"class","btn btn-default disabled d-flex align-items-center"),kc(n,"opacity","1"),kc(n,"cursor","default"),yc(f,"class","text-muted")},m:function(t,o){cc(t,n,o),ac(n,e),ac(e,r),ac(n,i),ac(n,u),ac(n,a),p.m(n,null),cc(t,c,o),cc(t,f,o)},p:function(t,i){2&i&&l!==(l=t[1].url+"")&&wc(r,l),2&i&&o!==(o=t[1].url)&&yc(e,"href",o),d===(d=s(t))&&p?p.p(t,i):(p.d(1),(p=d(t))&&(p.c(),p.m(n,null)))},d:function(t){t&&fc(n),p.d(),t&&fc(c),t&&fc(f)}}}function vm(t){var n,e,r;return{c:function(){yc(n=sc("a"),"class","far fa-copy fa-fw text-secondary text-decoration-none ml-auto"),yc(n,"href",""),yc(n,"title",Pl.l10n.copy_to_clipboard)},m:function(o,i){cc(o,n,i),e||(r=mc(n,"click",hc(t[3])),e=!0)},p:Fa,d:function(t){t&&fc(n),e=!1,r()}}}function mm(t){var n;return{c:function(){(n=sc("small")).textContent="".concat(Pl.l10n.copied),yc(n,"class","text-muted ml-auto")},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function hm(t){var n,e=(t[1]&&t[1].url||t[2]&&t[2].id&&"off"!==t[2].online_meetings)&&sm(t);return{c:function(){e&&e.c(),n=vc()},m:function(t,r){e&&e.m(t,r),cc(t,n,r)},p:function(t,r){var o=Wi(r,1)[0];t[1]&&t[1].url||t[2]&&t[2].id&&"off"!==t[2].online_meetings?e?e.p(t,o):((e=sm(t)).c(),e.m(n.parentNode,n)):e&&(e.d(1),e=null)},i:Fa,o:Fa,d:function(t){e&&e.d(t),t&&fc(n)}}}function ym(t,n,e){var r,o,i;return Va(t,Fl,(function(t){return e(1,r=t)})),Va(t,Cl,(function(t){return e(2,o=t)})),[i,r,o,function(){var t=document.createElement("textarea");t.textContent=r.url,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",i.appendChild(t),t.select(),t.setSelectionRange(0,99999),document.execCommand("copy"),i.removeChild(t),tc(Fl,r.copied=!0,r),If((function(){tc(Fl,r.copied=!1,r)}),1e3)},function(t){Nc[t?"unshift":"push"]((function(){e(0,i=t)}))}]}var gm=function(t){nn(e,t);var n=lm(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,ym,hm,Wa,{}),r}return e}(vf);function _m(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function $m(t){var n,e,r,o,i;return{c:function(){(n=sc("label")).textContent="".concat(Pl.l10n.internal_note),e=pc(),r=sc("textarea"),yc(n,"for","bookly-internal-note"),yc(r,"class","form-control"),yc(r,"id","bookly-internal-note")},m:function(u,a){cc(u,n,a),cc(u,e,a),cc(u,r,a),xc(r,t[0]),o||(i=mc(r,"input",t[1]),o=!0)},p:function(t,n){1&Wi(n,1)[0]&&xc(r,t[0])},i:Fa,o:Fa,d:function(t){t&&fc(n),t&&fc(e),t&&fc(r),o=!1,i()}}}function bm(t,n,e){var r;return Va(t,ts,(function(t){return e(0,r=t)})),[r,function(){r=this.value,ts.set(r)}]}var wm=function(t){nn(e,t);var n=_m(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,bm,$m,Wa,{}),r}return e}(vf);function xm(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function km(t){var n,e,r,o,i,u;return{c:function(){n=sc("div"),e=sc("input"),r=pc(),(o=sc("label")).textContent="".concat(Pl.l10n.send_notifications),yc(e,"type","checkbox"),yc(e,"id","bookly-send-notifications"),yc(e,"class","custom-control-input"),yc(o,"for","bookly-send-notifications"),yc(o,"class","custom-control-label"),yc(n,"class","custom-control custom-checkbox mb-2")},m:function(a,c){cc(a,n,c),ac(n,e),e.checked=t[0],ac(n,r),ac(n,o),i||(u=mc(e,"change",t[1]),i=!0)},p:function(t,n){1&Wi(n,1)[0]&&(e.checked=t[0])},i:Fa,o:Fa,d:function(t){t&&fc(n),i=!1,u()}}}function Om(t,n,e){var r;return Va(t,ns,(function(t){return e(0,r=t)})),null===r&&tc(ns,r="1"===Pl.send_notifications,r),[r,function(){r=this.checked,ns.set(r)}]}var Sm=function(t){nn(e,t);var n=xm(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Om,km,Wa,{}),r}return e}(vf);function Em(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Am(t){var n,e,r,o,i,u,a=El("locations"),c=El("tasks"),f=t[0]&&null===t[0].id&&jm();e=new gm({});var l=a&&function(t){var n,e,r;return e=new ep({}),{c:function(){n=sc("div"),ff(e.$$.fragment),yc(n,"class","form-group")},m:function(t,o){cc(t,n,o),lf(e,n,null),r=!0},i:function(t){r||(rf(e.$$.fragment,t),r=!0)},o:function(t){of(e.$$.fragment,t),r=!1},d:function(t){t&&fc(n),sf(e)}}}(),s=c&&function(t){var n,e;return n=new fm({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}();return{c:function(){f&&f.c(),n=pc(),ff(e.$$.fragment),r=pc(),l&&l.c(),o=pc(),s&&s.c(),i=vc()},m:function(t,a){f&&f.m(t,a),cc(t,n,a),lf(e,t,a),cc(t,r,a),l&&l.m(t,a),cc(t,o,a),s&&s.m(t,a),cc(t,i,a),u=!0},p:function(t,e){t[0]&&null===t[0].id?f?1&e&&rf(f,1):((f=jm()).c(),rf(f,1),f.m(n.parentNode,n)):f&&(nf(),of(f,1,1,(function(){f=null})),ef())},i:function(t){u||(rf(f),rf(e.$$.fragment,t),rf(l),rf(s),u=!0)},o:function(t){of(f),of(e.$$.fragment,t),of(l),of(s),u=!1},d:function(t){f&&f.d(t),t&&fc(n),sf(e,t),t&&fc(r),l&&l.d(t),t&&fc(o),s&&s.d(t),t&&fc(i)}}}function jm(t){var n,e;return n=new Qd({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Tm(t){var n,e,r,o,i,u,a,c;r=new up({});var f=(!t[0]||!1==(t[0].duration>=86400&&1===t[0].units_max))&&Pm();return a=new im({}),{c:function(){n=sc("div"),e=sc("div"),ff(r.$$.fragment),o=pc(),i=sc("div"),f&&f.c(),u=pc(),ff(a.$$.fragment),yc(e,"class","col-sm-4 form-group"),yc(i,"class","col-sm-8 form-group"),yc(n,"class","form-row")},m:function(t,l){cc(t,n,l),ac(n,e),lf(r,e,null),ac(n,o),ac(n,i),f&&f.m(i,null),cc(t,u,l),lf(a,t,l),c=!0},p:function(t,n){t[0]&&!1!=(t[0].duration>=86400&&1===t[0].units_max)?f&&(nf(),of(f,1,1,(function(){f=null})),ef()):f?1&n&&rf(f,1):((f=Pm()).c(),rf(f,1),f.m(i,null))},i:function(t){c||(rf(r.$$.fragment,t),rf(f),rf(a.$$.fragment,t),c=!0)},o:function(t){of(r.$$.fragment,t),of(f),of(a.$$.fragment,t),c=!1},d:function(t){t&&fc(n),sf(r),f&&f.d(),t&&fc(u),sf(a,t)}}}function Pm(t){var n,e;return n=new hp({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Rm(t){var n,e,r;return e=new lv({}),{c:function(){n=sc("div"),ff(e.$$.fragment),yc(n,"class","mb-2")},m:function(t,o){cc(t,n,o),lf(e,n,null),r=!0},i:function(t){r||(rf(e.$$.fragment,t),r=!0)},o:function(t){of(e.$$.fragment,t),r=!1},d:function(t){t&&fc(n),sf(e)}}}function Bm(t){var n,e,r,o,i,u,a,c,f,l,s,d,p,v,m,h,y,g,_=El("pro"),$=El("recurring-appointments")&&null===t[2].id&&!t[1],b=Pl.service_main&&function(t){var n,e,r;return e=new Ud({}),{c:function(){n=sc("div"),ff(e.$$.fragment),yc(n,"class","form-group")},m:function(t,o){cc(t,n,o),lf(e,n,null),r=!0},i:function(t){r||(rf(e.$$.fragment,t),r=!0)},o:function(t){of(e.$$.fragment,t),r=!1},d:function(t){t&&fc(n),sf(e)}}}();r=new Dd({});var w=!Pl.service_main&&function(t){var n,e,r;return e=new Ud({}),{c:function(){n=sc("div"),ff(e.$$.fragment),yc(n,"class","form-group")},m:function(t,o){cc(t,n,o),lf(e,n,null),r=!0},i:function(t){r||(rf(e.$$.fragment,t),r=!0)},o:function(t){of(e.$$.fragment,t),r=!1},d:function(t){t&&fc(n),sf(e)}}}(),x=_&&Am(t),k=!t[1]&&Tm(t),O=$&&Rm();return l=new Mv({}),d=new Hv({}),m=new wm({}),y=new Sm({}),{c:function(){b&&b.c(),n=pc(),e=sc("div"),ff(r.$$.fragment),o=pc(),w&&w.c(),i=pc(),x&&x.c(),u=pc(),k&&k.c(),a=pc(),O&&O.c(),c=pc(),f=sc("div"),ff(l.$$.fragment),s=pc(),ff(d.$$.fragment),p=pc(),v=sc("div"),ff(m.$$.fragment),h=pc(),ff(y.$$.fragment),yc(e,"class","form-group"),yc(f,"class","form-group"),yc(v,"class","form-group")},m:function(t,_){b&&b.m(t,_),cc(t,n,_),cc(t,e,_),lf(r,e,null),cc(t,o,_),w&&w.m(t,_),cc(t,i,_),x&&x.m(t,_),cc(t,u,_),k&&k.m(t,_),cc(t,a,_),O&&O.m(t,_),cc(t,c,_),cc(t,f,_),lf(l,f,null),ac(f,s),lf(d,f,null),cc(t,p,_),cc(t,v,_),lf(m,v,null),cc(t,h,_),lf(y,t,_),g=!0},p:function(t,n){var e=Wi(n,1)[0];_&&x.p(t,e),t[1]?k&&(nf(),of(k,1,1,(function(){k=null})),ef()):k?(k.p(t,e),2&e&&rf(k,1)):((k=Tm(t)).c(),rf(k,1),k.m(a.parentNode,a)),6&e&&($=El("recurring-appointments")&&null===t[2].id&&!t[1]),$?O?6&e&&rf(O,1):((O=Rm()).c(),rf(O,1),O.m(c.parentNode,c)):O&&(nf(),of(O,1,1,(function(){O=null})),ef())},i:function(t){g||(rf(b),rf(r.$$.fragment,t),rf(w),rf(x),rf(k),rf(O),rf(l.$$.fragment,t),rf(d.$$.fragment,t),rf(m.$$.fragment,t),rf(y.$$.fragment,t),g=!0)},o:function(t){of(b),of(r.$$.fragment,t),of(w),of(x),of(k),of(O),of(l.$$.fragment,t),of(d.$$.fragment,t),of(m.$$.fragment,t),of(y.$$.fragment,t),g=!1},d:function(t){b&&b.d(t),t&&fc(n),t&&fc(e),sf(r),t&&fc(o),w&&w.d(t),t&&fc(i),x&&x.d(t),t&&fc(u),k&&k.d(t),t&&fc(a),O&&O.d(t),t&&fc(c),t&&fc(f),sf(l),sf(d),t&&fc(p),t&&fc(v),sf(m),t&&fc(h),sf(y,t)}}}function Dm(t,n,e){var r,o,i;return Va(t,Cl,(function(t){return e(0,r=t)})),Va(t,ql,(function(t){return e(1,o=t)})),Va(t,gs,(function(t){return e(2,i=t)})),[r,o,i]}var Im=function(t){nn(e,t);var n=Em(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Dm,Bm,Wa,{}),r}return e}(vf),Mm=Tf(0),Cm=Of([Rs,Mm],(function(t){var n=Wi(t,2),e=n[0],r=n[1];return e?vu(e).call(e,10*r,10*(r+1)):[]})),Nm=Of([Rs],(function(t){var n=Wi(t,1)[0];return n?Math.ceil(n.length/10):0}));function Lm(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Fm(t){var n;return{c:function(){yc(n=sc("input"),"autocomplete","off"),yc(n,"class","form-control"),yc(n,"type","text")},m:function(e,r){cc(e,n,r),t[4](n)},p:Fa,i:Fa,o:Fa,d:function(e){e&&fc(n),t[4](null)}}}function zm(t,n,e){var r,o,i,a=n.item;return i=moment(a.date),Mc((function(){return e(2,o=u.default(r).daterangepicker({parentEl:"#bookly-appointment-dialog > div",singleDatePicker:!0,showDropdowns:!0,locale:Pl.datePicker},(function(t){e(1,a.date=t.format("YYYY-MM-DD"),a),nd(a)})))})),t.$$set=function(t){"item"in t&&e(1,a=t.item)},t.$$.update=function(){12&t.$$.dirty&&i&&o&&(o.data("daterangepicker").setStartDate(i),o.data("daterangepicker").setEndDate(i))},[r,a,o,i,function(t){Nc[t?"unshift":"push"]((function(){e(0,r=t)}))}]}var qm=function(t){nn(e,t);var n=Lm(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,zm,Fm,Wa,{item:1}),r}return e}(vf);function Ym(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Hm(t,n,e){var r=vu(t).call(t);return r[4]=n[e],r}function Um(t){var n,e,r,o,i=t[4].title+"";return{c:function(){n=sc("option"),e=dc(i),n.__value=r=t[4].value,n.value=n.__value,n.disabled=o=t[4].disabled},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,u){2&u&&i!==(i=t[4].title+"")&&wc(e,i),2&u&&r!==(r=t[4].value)&&(n.__value=r,n.value=n.__value),2&u&&o!==(o=t[4].disabled)&&(n.disabled=o)},d:function(t){t&&fc(n)}}}function Gm(t){for(var n,e,r,o=t[1],i=[],u=0;u<o.length;u+=1)i[u]=Um(Hm(t,o,u));return{c:function(){n=sc("select");for(var e=0;e<i.length;e+=1)i[e].c();yc(n,"class","form-control custom-select"),void 0===t[0].slots&&Uc((function(){return t[3].call(n)}))},m:function(o,u){cc(o,n,u);for(var a=0;a<i.length;a+=1)i[a].m(n,null);Oc(n,t[0].slots),e||(r=[mc(n,"change",t[3]),mc(n,"change",(function(){Ga(t[2](t[0]))&&t[2](t[0]).apply(this,arguments)}))],e=!0)},p:function(e,r){var u=Wi(r,1)[0];if(t=e,2&u){var a;for(o=t[1],a=0;a<o.length;a+=1){var c=Hm(t,o,a);i[a]?i[a].p(c,u):(i[a]=Um(c),i[a].c(),i[a].m(n,null))}for(;a<i.length;a+=1)i[a].d(1);i.length=o.length}3&u&&Oc(n,t[0].slots)},i:Fa,o:Fa,d:function(t){t&&fc(n),lc(i,t),e=!1,Ua(r)}}}function Wm(t,n,e){var r;Va(t,js,(function(t){return e(1,r=t)}));var o=n.item;return t.$$set=function(t){"item"in t&&e(0,o=t.item)},[o,r,function(){e(0,o.options=Oa(r).call(r,(function(t){return t.value===o.slots})),o)},function(){o.slots=Sc(this),e(0,o)}]}var Jm=function(t){nn(e,t);var n=Ym(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Wm,Gm,Wa,{item:0}),r}return e}(vf);function Vm(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Qm(t){var n,e,r,o;function i(n){t[2](n)}var u={};return void 0!==t[0]&&(u.item=t[0]),e=new qm({props:u}),Nc.push((function(){return cf(e,"item",i)})),{c:function(){n=sc("div"),ff(e.$$.fragment),yc(n,"class","col-sm-4")},m:function(t,r){cc(t,n,r),lf(e,n,null),o=!0},p:function(t,n){var o={};!r&&1&n&&(r=!0,o.item=t[0],Gc((function(){return r=!1}))),e.$set(o)},i:function(t){o||(rf(e.$$.fragment,t),o=!0)},o:function(t){of(e.$$.fragment,t),o=!1},d:function(t){t&&fc(n),sf(e)}}}function Km(t){var n,e,r,o;function i(n){t[3](n)}var u={};return void 0!==t[0]&&(u.item=t[0]),e=new Jm({props:u}),Nc.push((function(){return cf(e,"item",i)})),{c:function(){n=sc("div"),ff(e.$$.fragment),yc(n,"class","col-sm-3")},m:function(t,r){cc(t,n,r),lf(e,n,null),o=!0},p:function(t,n){var o={};!r&&1&n&&(r=!0,o.item=t[0],Gc((function(){return r=!1}))),e.$set(o)},i:function(t){o||(rf(e.$$.fragment,t),o=!0)},o:function(t){of(e.$$.fragment,t),o=!1},d:function(t){t&&fc(n),sf(e)}}}function Xm(t){var n,e,r,o,i,u,a,c,f,l,s,d,p=Cs(t[0].date)+"",v=Ns(t[0].slots,t[0].options)+"",m=t[0].all_day_service_time+"",h=t[1]===t[0].index&&Qm(t),y=t[1]===t[0].index&&Km(t);return{c:function(){n=sc("div"),e=dc(p),r=pc(),h&&h.c(),o=pc(),i=sc("div"),u=dc(v),a=pc(),c=sc("div"),f=dc(m),l=pc(),y&&y.c(),s=vc(),yc(n,"class","col-sm-3"),Ec(n,"d-none",t[0].deleted||t[1]===t[0].index),yc(i,"class","col-sm-2"),Ec(i,"d-none",t[0].all_day_service_time||t[0].deleted||t[1]===t[0].index),yc(c,"class","col-sm-2"),Ec(c,"d-none",!t[0].all_day_service_time)},m:function(t,p){cc(t,n,p),ac(n,e),cc(t,r,p),h&&h.m(t,p),cc(t,o,p),cc(t,i,p),ac(i,u),cc(t,a,p),cc(t,c,p),ac(c,f),cc(t,l,p),y&&y.m(t,p),cc(t,s,p),d=!0},p:function(t,r){var a=Wi(r,1)[0];(!d||1&a)&&p!==(p=Cs(t[0].date)+"")&&wc(e,p),3&a&&Ec(n,"d-none",t[0].deleted||t[1]===t[0].index),t[1]===t[0].index?h?(h.p(t,a),3&a&&rf(h,1)):((h=Qm(t)).c(),rf(h,1),h.m(o.parentNode,o)):h&&(nf(),of(h,1,1,(function(){h=null})),ef()),(!d||1&a)&&v!==(v=Ns(t[0].slots,t[0].options)+"")&&wc(u,v),3&a&&Ec(i,"d-none",t[0].all_day_service_time||t[0].deleted||t[1]===t[0].index),(!d||1&a)&&m!==(m=t[0].all_day_service_time+"")&&wc(f,m),1&a&&Ec(c,"d-none",!t[0].all_day_service_time),t[1]===t[0].index?y?(y.p(t,a),3&a&&rf(y,1)):((y=Km(t)).c(),rf(y,1),y.m(s.parentNode,s)):y&&(nf(),of(y,1,1,(function(){y=null})),ef())},i:function(t){d||(rf(h),rf(y),d=!0)},o:function(t){of(h),of(y),d=!1},d:function(t){t&&fc(n),t&&fc(r),h&&h.d(t),t&&fc(o),t&&fc(i),t&&fc(a),t&&fc(c),t&&fc(l),y&&y.d(t),t&&fc(s)}}}function Zm(t,n,e){var r;Va(t,Ps,(function(t){return e(1,r=t)}));var o=n.item;return t.$$set=function(t){"item"in t&&e(0,o=t.item)},[o,r,function(t){e(0,o=t)},function(t){e(0,o=t)}]}var th=function(t){nn(e,t);var n=Vm(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Zm,Xm,Wa,{item:0}),r}return e}(vf);function nh(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function eh(t){var n,e,r;return{c:function(){yc(n=sc("a"),"href",""),yc(n,"class","fas fa-fw fa-check text-decoration-none"),yc(n,"title",Pl.l10n.recurring.apply),Ec(n,"d-none",t[1]!==t[0].index)},m:function(o,i){cc(o,n,i),e||(r=mc(n,"click",hc(t[2])),e=!0)},p:function(t,e){3&Wi(e,1)[0]&&Ec(n,"d-none",t[1]!==t[0].index)},i:Fa,o:Fa,d:function(t){t&&fc(n),e=!1,r()}}}function rh(t,n,e){var r;Va(t,Ps,(function(t){return e(1,r=t)}));var o=n.item;return t.$$set=function(t){"item"in t&&e(0,o=t.item)},[o,r,function(){return tc(Ps,r=0,r)}]}var oh=function(t){nn(e,t);var n=nh(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,rh,eh,Wa,{item:0}),r}return e}(vf);function ih(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function uh(t){var n,e,r;return{c:function(){yc(n=sc("a"),"href",""),yc(n,"class","far fa-fw fa-trash-alt text-danger"),yc(n,"title",Pl.l10n.recurring.delete)},m:function(o,i){cc(o,n,i),e||(r=mc(n,"click",hc(t[1])),e=!0)},p:Fa,i:Fa,o:Fa,d:function(t){t&&fc(n),e=!1,r()}}}function ah(t,n,e){var r=n.item;return t.$$set=function(t){"item"in t&&e(0,r=t.item)},[r,function(){return e(0,r.deleted=!0,r)}]}var ch=function(t){nn(e,t);var n=ih(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,ah,uh,Wa,{item:0}),r}return e}(vf);function fh(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function lh(t){var n,e,r;return{c:function(){yc(n=sc("a"),"href",""),yc(n,"class","far fa-fw fa-edit text-decoration-none"),yc(n,"title",Pl.l10n.recurring.edit)},m:function(o,i){cc(o,n,i),e||(r=mc(n,"click",hc(t[2])),e=!0)},p:Fa,i:Fa,o:Fa,d:function(t){t&&fc(n),e=!1,r()}}}function sh(t,n,e){var r;Va(t,Ps,(function(t){return e(1,r=t)}));var o=n.item;return t.$$set=function(t){"item"in t&&e(0,o=t.item)},[o,r,function(){nd(o),tc(Ps,r=o.index,r)}]}var dh=function(t){nn(e,t);var n=fh(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,sh,lh,Wa,{item:0}),r}return e}(vf);function ph(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function vh(t){var n,e,r,o;return{c:function(){n=sc("a"),yc(e=sc("span"),"class","fas fa-fw fa-undo"),yc(n,"href",""),yc(n,"class","text-muted"),yc(n,"title",Pl.l10n.recurring.restore)},m:function(i,u){cc(i,n,u),ac(n,e),r||(o=mc(n,"click",hc(t[1])),r=!0)},p:Fa,i:Fa,o:Fa,d:function(t){t&&fc(n),r=!1,o()}}}function mh(t,n,e){var r=n.item;return t.$$set=function(t){"item"in t&&e(0,r=t.item)},[r,function(){return e(0,r.deleted=!1,r)}]}var hh=function(t){nn(e,t);var n=ph(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,mh,vh,Wa,{item:0}),r}return e}(vf);function yh(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function gh(t){var n,e,r,o,i,u,a,c,f,l,s,d,p,v,m,h,y,g,_,$,b,w,x,k,O,S,E,A,j,T,P=t[0].index+"",R=Pl.l10n.recurring.another_time+"";function B(n){t[2](n)}var D={};function I(n){t[3](n)}void 0!==t[0]&&(D.item=t[0]),l=new hh({props:D}),Nc.push((function(){return cf(l,"item",B)})),p=new th({props:{item:t[0]}});var M={};function C(n){t[4](n)}void 0!==t[0]&&(M.item=t[0]),b=new dh({props:M}),Nc.push((function(){return cf(b,"item",I)}));var N={};function L(n){t[5](n)}void 0!==t[0]&&(N.item=t[0]),k=new ch({props:N}),Nc.push((function(){return cf(k,"item",C)}));var F={};return void 0!==t[0]&&(F.item=t[0]),A=new oh({props:F}),Nc.push((function(){return cf(A,"item",L)})),{c:function(){n=sc("li"),e=sc("div"),r=sc("div"),o=sc("b"),i=dc(P),u=pc(),(a=sc("div")).textContent="".concat(Pl.l10n.recurring.deleted),c=pc(),f=sc("div"),ff(l.$$.fragment),d=pc(),ff(p.$$.fragment),v=pc(),m=sc("div"),h=sc("span"),y=sc("span"),g=dc(R),_=pc(),$=sc("div"),ff(b.$$.fragment),x=pc(),ff(k.$$.fragment),S=pc(),E=sc("div"),ff(A.$$.fragment),yc(r,"class","col-sm-1"),yc(a,"class","col-sm-10 text-muted"),Ec(a,"d-none",!t[0].deleted),yc(f,"class","col-sm-1 text-right"),Ec(f,"d-none",!0!==t[0].deleted),yc(y,"class","fas fa-fw fa-exclamation-triangle text-warning mr-1"),Ec(h,"d-none",!t[0].another_time),yc(m,"class","col-sm-4"),Ec(m,"d-none",t[0].deleted||t[1]===t[0].index),yc($,"class","col-sm-2 text-right"),Ec($,"d-none",t[0].deleted||t[1]===t[0].index),yc(E,"class","col-sm-4 text-right"),Ec(E,"d-none",t[1]!==t[0].index),yc(e,"class","row"),yc(n,"class","list-group-item")},m:function(t,s){cc(t,n,s),ac(n,e),ac(e,r),ac(r,o),ac(o,i),ac(e,u),ac(e,a),ac(e,c),ac(e,f),lf(l,f,null),ac(e,d),lf(p,e,null),ac(e,v),ac(e,m),ac(m,h),ac(h,y),ac(h,g),ac(e,_),ac(e,$),lf(b,$,null),ac($,x),lf(k,$,null),ac(e,S),ac(e,E),lf(A,E,null),T=!0},p:function(t,n){var e=Wi(n,1)[0];(!T||1&e)&&P!==(P=t[0].index+"")&&wc(i,P),1&e&&Ec(a,"d-none",!t[0].deleted);var r={};!s&&1&e&&(s=!0,r.item=t[0],Gc((function(){return s=!1}))),l.$set(r),1&e&&Ec(f,"d-none",!0!==t[0].deleted);var o={};1&e&&(o.item=t[0]),p.$set(o),1&e&&Ec(h,"d-none",!t[0].another_time),3&e&&Ec(m,"d-none",t[0].deleted||t[1]===t[0].index);var u={};!w&&1&e&&(w=!0,u.item=t[0],Gc((function(){return w=!1}))),b.$set(u);var c={};!O&&1&e&&(O=!0,c.item=t[0],Gc((function(){return O=!1}))),k.$set(c),3&e&&Ec($,"d-none",t[0].deleted||t[1]===t[0].index);var d={};!j&&1&e&&(j=!0,d.item=t[0],Gc((function(){return j=!1}))),A.$set(d),3&e&&Ec(E,"d-none",t[1]!==t[0].index)},i:function(t){T||(rf(l.$$.fragment,t),rf(p.$$.fragment,t),rf(b.$$.fragment,t),rf(k.$$.fragment,t),rf(A.$$.fragment,t),T=!0)},o:function(t){of(l.$$.fragment,t),of(p.$$.fragment,t),of(b.$$.fragment,t),of(k.$$.fragment,t),of(A.$$.fragment,t),T=!1},d:function(t){t&&fc(n),sf(l),sf(p),sf(b),sf(k),sf(A)}}}function _h(t,n,e){var r;Va(t,Ps,(function(t){return e(1,r=t)}));var o=n.item;return t.$$set=function(t){"item"in t&&e(0,o=t.item)},[o,r,function(t){e(0,o=t)},function(t){e(0,o=t)},function(t){e(0,o=t)},function(t){e(0,o=t)}]}var $h=function(t){nn(e,t);var n=yh(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,_h,gh,Wa,{item:0}),r}return e}(vf);function bh(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function wh(t,n,e){var r=vu(t).call(t);return r[5]=n[e],r[7]=e,r}function xh(t){var n,e,r,o,i,u=t[7]+1+"";function a(){return t[3](t[7])}return{c:function(){n=sc("li"),e=sc("a"),r=dc(u),yc(e,"href",""),yc(e,"class","page-link"),yc(n,"class","page-item"),Ec(n,"active",t[7]===t[1])},m:function(t,u){cc(t,n,u),ac(n,e),ac(e,r),o||(i=mc(e,"click",hc(a)),o=!0)},p:function(e,r){t=e,2&r&&Ec(n,"active",t[7]===t[1])},d:function(t){t&&fc(n),o=!1,i()}}}function kh(t){for(var n,e,r,o,i,u,a,c,f,l,s=Array(t[0]),d=[],p=0;p<s.length;p+=1)d[p]=xh(wh(t,s,p));return{c:function(){n=sc("nav"),e=sc("ul"),r=sc("li"),(o=sc("a")).innerHTML="<span>«</span>",i=pc();for(var f=0;f<d.length;f+=1)d[f].c();u=pc(),a=sc("li"),(c=sc("a")).innerHTML="<span>»</span>",yc(o,"href",""),yc(o,"class","page-link"),yc(r,"class","page-item"),Ec(r,"disabled",0===t[1]),yc(c,"href",""),yc(c,"class","page-link"),yc(a,"class","page-item"),Ec(a,"disabled",t[1]===t[0]-1),yc(e,"class","pagination"),Ec(n,"d-none",t[0]<=1)},m:function(s,p){cc(s,n,p),ac(n,e),ac(e,r),ac(r,o),ac(e,i);for(var v=0;v<d.length;v+=1)d[v].m(e,null);ac(e,u),ac(e,a),ac(a,c),f||(l=[mc(o,"click",hc(t[2])),mc(c,"click",hc(t[4]))],f=!0)},p:function(t,o){var i=Wi(o,1)[0];if(2&i&&Ec(r,"disabled",0===t[1]),3&i){var c;for(s=Array(t[0]),c=0;c<s.length;c+=1){var f=wh(t,s,c);d[c]?d[c].p(f,i):(d[c]=xh(f),d[c].c(),d[c].m(e,u))}for(;c<d.length;c+=1)d[c].d(1);d.length=s.length}3&i&&Ec(a,"disabled",t[1]===t[0]-1),1&i&&Ec(n,"d-none",t[0]<=1)},i:Fa,o:Fa,d:function(t){t&&fc(n),lc(d,t),f=!1,Ua(l)}}}function Oh(t,n,e){var r,o;Va(t,Nm,(function(t){return e(0,r=t)})),Va(t,Mm,(function(t){return e(1,o=t)}));return[r,o,function(){return tc(Mm,--o,o)},function(t){return tc(Mm,o=t,o)},function(){return tc(Mm,++o,o)}]}var Sh=function(t){nn(e,t);var n=bh(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Oh,kh,Wa,{}),r}return e}(vf);function Eh(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Ah(t,n,e){var r=vu(t).call(t);return r[1]=n[e],r}function jh(t){var n,e;return n=new $h({props:{item:t[1]}}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},p:function(t,e){var r={};1&e&&(r.item=t[1]),n.$set(r)},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Th(t){for(var n,e,r,o,i=t[0],u=[],a=0;a<i.length;a+=1)u[a]=jh(Ah(t,i,a));var c=function(t){return of(u[t],1,1,(function(){u[t]=null}))};return r=new Sh({}),{c:function(){n=sc("ul");for(var t=0;t<u.length;t+=1)u[t].c();e=pc(),ff(r.$$.fragment),yc(n,"id","bookly-schedule-items"),yc(n,"class","list-group mb-3")},m:function(t,i){cc(t,n,i);for(var a=0;a<u.length;a+=1)u[a].m(n,null);cc(t,e,i),lf(r,t,i),o=!0},p:function(t,e){var r=Wi(e,1)[0];if(1&r){var o;for(i=t[0],o=0;o<i.length;o+=1){var a=Ah(t,i,o);u[o]?(u[o].p(a,r),rf(u[o],1)):(u[o]=jh(a),u[o].c(),rf(u[o],1),u[o].m(n,null))}for(nf(),o=i.length;o<u.length;o+=1)c(o);ef()}},i:function(t){if(!o){for(var n=0;n<i.length;n+=1)rf(u[n]);rf(r.$$.fragment,t),o=!0}},o:function(t){u=Oa(u).call(u,Boolean);for(var n=0;n<u.length;n+=1)of(u[n]);of(r.$$.fragment,t),o=!1},d:function(t){t&&fc(n),lc(u,t),t&&fc(e),sf(r,t)}}}function Ph(t,n,e){var r;return Va(t,Cm,(function(t){return e(0,r=t)})),[r]}var Rh=function(t){nn(e,t);var n=Eh(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Ph,Th,Wa,{}),r}return e}(vf);function Bh(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Dh(t){var n,e,r,o=t[4].default,i=Qa(o,t,t[3],null);return{c:function(){n=sc("div"),i&&i.c(),yc(n,"class",e="alert-"+t[1]+" "+t[2])},m:function(t,e){cc(t,n,e),i&&i.m(n,null),r=!0},p:function(t,u){i&&i.p&&8&u&&Xa(i,o,t,t[3],u,null,null),(!r||6&u&&e!==(e="alert-"+t[1]+" "+t[2]))&&yc(n,"class",e)},i:function(t){r||(rf(i,t),r=!0)},o:function(t){of(i,t),r=!1},d:function(t){t&&fc(n),i&&i.d(t)}}}function Ih(t){var n,e,r=t[0]&&Dh(t);return{c:function(){r&&r.c(),n=vc()},m:function(t,o){r&&r.m(t,o),cc(t,n,o),e=!0},p:function(t,e){var o=Wi(e,1)[0];t[0]?r?(r.p(t,o),1&o&&rf(r,1)):((r=Dh(t)).c(),rf(r,1),r.m(n.parentNode,n)):r&&(nf(),of(r,1,1,(function(){r=null})),ef())},i:function(t){e||(rf(r),e=!0)},o:function(t){of(r),e=!1},d:function(t){r&&r.d(t),t&&fc(n)}}}function Mh(t,n,e){var r=n.$$slots,o=void 0===r?{}:r,i=n.$$scope,u=n.show,a=void 0===u||u,c=n.type,f=void 0===c?"info":c,l=n.class,s=void 0===l?"alert":l;return t.$$set=function(t){"show"in t&&e(0,a=t.show),"type"in t&&e(1,f=t.type),"class"in t&&e(2,s=t.class),"$$scope"in t&&e(3,i=t.$$scope)},[a,f,s,i,o]}var Ch=function(t){nn(e,t);var n=Bh(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Mh,Ih,Wa,{show:0,type:1,class:2}),r}return e}(vf);function Nh(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Lh(t){var n,e,r,o,i,u;return n=new Ch({props:{type:"danger",show:t[1].length,$$slots:{default:[zh]},$$scope:{ctx:t}}}),r=new Rh({}),i=new Ch({props:{type:"danger",show:t[2]>1&&t[1].length,$$slots:{default:[qh]},$$scope:{ctx:t}}}),{c:function(){ff(n.$$.fragment),e=pc(),ff(r.$$.fragment),o=pc(),ff(i.$$.fragment)},m:function(t,a){lf(n,t,a),cc(t,e,a),lf(r,t,a),cc(t,o,a),lf(i,t,a),u=!0},p:function(t,e){var r={};2&e&&(r.show=t[1].length),16&e&&(r.$$scope={dirty:e,ctx:t}),n.$set(r);var o={};6&e&&(o.show=t[2]>1&&t[1].length),18&e&&(o.$$scope={dirty:e,ctx:t}),i.$set(o)},i:function(t){u||(rf(n.$$.fragment,t),rf(r.$$.fragment,t),rf(i.$$.fragment,t),u=!0)},o:function(t){of(n.$$.fragment,t),of(r.$$.fragment,t),of(i.$$.fragment,t),u=!1},d:function(t){sf(n,t),t&&fc(e),sf(r,t),t&&fc(o),sf(i,t)}}}function Fh(t){var n;return{c:function(){yc(n=sc("div"),"class","bookly-loading")},m:function(t,e){cc(t,n,e)},p:Fa,i:Fa,o:Fa,d:function(t){t&&fc(n)}}}function zh(t){var n,e,r,o=Pl.l10n.recurring.some_slots_are_busy+"";return{c:function(){n=sc("span"),e=pc(),r=dc(o),yc(n,"class","fas fa-info-circle text-primary fa-lg")},m:function(t,o){cc(t,n,o),cc(t,e,o),cc(t,r,o)},p:Fa,d:function(t){t&&fc(n),t&&fc(e),t&&fc(r)}}}function qh(t){var n,e,r,o,i,u=Pl.l10n.recurring.another_time_on_pages+"",a=t[1].join(", ")+"";return{c:function(){n=sc("span"),e=pc(),r=dc(u),o=pc(),i=dc(a),yc(n,"class","fas fa-fw fa-exclamation-triangle text-warning fa-lg mr-2")},m:function(t,u){cc(t,n,u),cc(t,e,u),cc(t,r,u),cc(t,o,u),cc(t,i,u)},p:function(t,n){2&n&&a!==(a=t[1].join(", ")+"")&&wc(i,a)},d:function(t){t&&fc(n),t&&fc(e),t&&fc(r),t&&fc(o),t&&fc(i)}}}function Yh(t){var n,e,r,o,i=[Fh,Lh],u=[];function a(t,n){return t[0]?0:1}return e=a(t),r=u[e]=i[e](t),{c:function(){n=sc("div"),r.c()},m:function(t,r){cc(t,n,r),u[e].m(n,null),o=!0},p:function(t,o){var c=Wi(o,1)[0],f=e;(e=a(t))===f?u[e].p(t,c):(nf(),of(u[f],1,1,(function(){u[f]=null})),ef(),(r=u[e])?r.p(t,c):(r=u[e]=i[e](t)).c(),rf(r,1),r.m(n,null))},i:function(t){o||(rf(r),o=!0)},o:function(t){of(r),o=!1},d:function(t){t&&fc(n),u[e].d()}}}function Hh(t,n,e){var r,o,i;Va(t,rs,(function(t){return e(3,r=t)})),Va(t,Ts,(function(t){return e(1,o=t)})),Va(t,Nm,(function(t){return e(2,i=t)}));var u=!0;return t.$$.update=function(){8&t.$$.dirty&&"schedule"===r&&(e(0,u=!0),(Ps.reset(),ed().done((function(t){var n;Rs.set(t.data);var e=[];uu(n=t.data).call(n,(function(t){if(t.another_time){var n=Xf((t.index-1)/10)+1;na(e).call(e,n)<0&&e.push(n)}})),Ts.set(e)}))).always((function(){return e(0,u=!1)})))},[u,o,i,r]}var Uh=function(t){nn(e,t);var n=Nh(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Hh,Yh,Wa,{}),r}return e}(vf);function Gh(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Wh(t){var n,e;return(n=new Jv({props:{class:"btn-success",disabled:!t[3]||!t[4].length||t[5]||"weekly"===t[6].type&&!t[6].weekly.on.length||null===t[3].id&&""===t[7],caption:Pl.l10n.recurring.next}})).$on("click",t[10]),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},p:function(t,e){var r={};248&e&&(r.disabled=!t[3]||!t[4].length||t[5]||"weekly"===t[6].type&&!t[6].weekly.on.length||null===t[3].id&&""===t[7]),n.$set(r)},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Jh(t){var n,e;return(n=new Jv({props:{class:"btn-default",caption:Pl.l10n.recurring.back}})).$on("click",t[9]),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},p:Fa,i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Vh(t){var n,e,r,o,i=[Jh,Wh],u=[];function a(t,n){return"schedule"===t[0]?0:"main"===t[0]&&t[1]&&!t[2]?1:-1}return~(n=a(t))&&(e=u[n]=i[n](t)),{c:function(){e&&e.c(),r=vc()},m:function(t,e){~n&&u[n].m(t,e),cc(t,r,e),o=!0},p:function(t,o){var c=Wi(o,1)[0],f=n;(n=a(t))===f?~n&&u[n].p(t,c):(e&&(nf(),of(u[f],1,1,(function(){u[f]=null})),ef()),~n?((e=u[n])?e.p(t,c):(e=u[n]=i[n](t)).c(),rf(e,1),e.m(r.parentNode,r)):e=null)},i:function(t){o||(rf(e),o=!0)},o:function(t){of(e),o=!1},d:function(t){~n&&u[n].d(t),t&&fc(r)}}}function Qh(t,n,e){var r,o,i,u,a,c,f,l,s;Va(t,rs,(function(t){return e(0,r=t)})),Va(t,Vl,(function(t){return e(1,o=t)})),Va(t,ql,(function(t){return e(2,i=t)})),Va(t,Cl,(function(t){return e(3,u=t)})),Va(t,Zl,(function(t){return e(4,a=t)})),Va(t,Ql,(function(t){return e(5,c=t)})),Va(t,Xl,(function(t){return e(6,f=t)})),Va(t,Nl,(function(t){return e(7,l=t)})),Va(t,Mm,(function(t){return e(8,s=t)}));return[r,o,i,u,a,c,f,l,s,function(){return tc(rs,r="main",r)},function(){tc(rs,r="schedule",r),tc(Mm,s=0,s)}]}var Kh=function(t){nn(e,t);var n=Gh(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Qh,Vh,Wa,{}),r}return e}(vf);function Xh(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Zh(t){var n,e,r,o,i,u,a,c,f,l,s,d,p,v,m,h,y,g,_;return{c:function(){n=sc("div"),(e=sc("label")).textContent="".concat(Pl.l10n.recurring.reschedule_info),r=pc(),o=sc("div"),i=sc("input"),u=pc(),(a=sc("label")).textContent="".concat(Pl.l10n.recurring.only_this_appointment),c=pc(),f=sc("div"),l=sc("input"),s=pc(),(d=sc("label")).textContent="".concat(Pl.l10n.recurring.this_and_next_appointments),p=pc(),v=sc("div"),m=sc("input"),h=pc(),(y=sc("label")).textContent="".concat(Pl.l10n.recurring.all_appointments),yc(i,"id","bookly-reschedule-type-current"),yc(i,"class","custom-control-input"),yc(i,"type","radio"),i.__value="current",i.value=i.__value,t[2][0].push(i),yc(a,"for","bookly-reschedule-type-current"),yc(a,"class","custom-control-label"),yc(o,"class","custom-control custom-radio"),yc(l,"id","bookly-reschedule-type-next"),yc(l,"class","custom-control-input"),yc(l,"type","radio"),l.__value="next",l.value=l.__value,t[2][0].push(l),yc(d,"for","bookly-reschedule-type-next"),yc(d,"class","custom-control-label"),yc(f,"class","custom-control custom-radio"),yc(m,"id","bookly-reschedule-type-all"),yc(m,"class","custom-control-input"),yc(m,"type","radio"),m.__value="all",m.value=m.__value,t[2][0].push(m),yc(y,"for","bookly-reschedule-type-all"),yc(y,"class","custom-control-label"),yc(v,"class","custom-control custom-radio"),yc(n,"class","form-group")},m:function($,b){cc($,n,b),ac(n,e),ac(n,r),ac(n,o),ac(o,i),i.checked=i.__value===t[0],ac(o,u),ac(o,a),ac(n,c),ac(n,f),ac(f,l),l.checked=l.__value===t[0],ac(f,s),ac(f,d),ac(n,p),ac(n,v),ac(v,m),m.checked=m.__value===t[0],ac(v,h),ac(v,y),g||(_=[mc(i,"change",t[1]),mc(l,"change",t[3]),mc(m,"change",t[4])],g=!0)},p:function(t,n){var e=Wi(n,1)[0];1&e&&(i.checked=i.__value===t[0]),1&e&&(l.checked=l.__value===t[0]),1&e&&(m.checked=m.__value===t[0])},i:Fa,o:Fa,d:function(e){var r,o,u,a,c,f;e&&fc(n),pa(r=t[2][0]).call(r,na(o=t[2][0]).call(o,i),1),pa(u=t[2][0]).call(u,na(a=t[2][0]).call(a,l),1),pa(c=t[2][0]).call(c,na(f=t[2][0]).call(f,m),1),g=!1,Ua(_)}}}function ty(t,n,e){var r;Va(t,Bs,(function(t){return e(0,r=t)}));return[r,function(){r=this.__value,Bs.set(r)},[[]],function(){r=this.__value,Bs.set(r)},function(){r=this.__value,Bs.set(r)}]}var ny=function(t){nn(e,t);var n=Xh(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,ty,Zh,Wa,{}),r}return e}(vf);function ey(t,n){var e=n.get(t);if(!e)throw new TypeError("attempted to get private field on non-instance");return e.get?e.get.call(t):e.value}var ry=wu.getWeakData,oy=ce.set,iy=ce.getterFor,uy=se.find,ay=se.findIndex,cy=0,fy=function(t){return t.frozen||(t.frozen=new ly)},ly=function(){this.entries=[]},sy=function(t,n){return uy(t.entries,(function(t){return t[0]===n}))};ly.prototype={get:function(t){var n=sy(this,t);if(n)return n[1]},has:function(t){return!!sy(this,t)},set:function(t,n){var e=sy(this,t);e?e[1]=n:this.entries.push([t,n])},delete:function(t){var n=ay(this.entries,(function(n){return n[0]===t}));return~n&&this.entries.splice(n,1),!!~n}};var dy={getConstructor:function(t,n,e,r){var o=t((function(t,i){Ur(t,o,n),oy(t,{type:n,id:cy++,frozen:void 0}),null!=i&&Lr(i,t[r],{that:t,AS_ENTRIES:e})})),i=iy(n),u=function(t,n,e){var r=i(t),o=ry(W(n),!0);return!0===o?fy(r).set(n,e):o[r.id]=e,t};return qr(o.prototype,{delete:function(t){var n=i(this);if(!E(t))return!1;var e=ry(t);return!0===e?fy(n).delete(t):e&&T(e,n.id)&&delete e[n.id]},has:function(t){var n=i(this);if(!E(t))return!1;var e=ry(t);return!0===e?fy(n).has(t):e&&T(e,n.id)}}),qr(o.prototype,e?{get:function(t){var n=i(this);if(E(t)){var e=ry(t);return!0===e?fy(n).get(t):e?e[n.id]:void 0}},set:function(t,n){return u(this,t,n)}}:{add:function(t){return u(this,t,!0)}}),o}};s((function(t){var n,e=ce.enforce,r=!v.ActiveXObject&&"ActiveXObject"in v,o=Object.isExtensible,i=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},u=t.exports=Eu("WeakMap",i,dy);if(ne&&r){n=dy.getConstructor(i,"WeakMap",!0),wu.REQUIRED=!0;var a=u.prototype,c=a.delete,f=a.has,l=a.get,s=a.set;qr(a,{delete:function(t){if(E(t)&&!o(t)){var r=e(this);return r.frozen||(r.frozen=new n),c.call(this,t)||r.frozen.delete(t)}return c.call(this,t)},has:function(t){if(E(t)&&!o(t)){var r=e(this);return r.frozen||(r.frozen=new n),f.call(this,t)||r.frozen.has(t)}return f.call(this,t)},get:function(t){if(E(t)&&!o(t)){var r=e(this);return r.frozen||(r.frozen=new n),f.call(this,t)?l.call(this,t):r.frozen.get(t)}return l.call(this,t)},set:function(t,r){if(E(t)&&!o(t)){var i=e(this);i.frozen||(i.frozen=new n),f.call(this,t)?s.call(this,t,r):i.frozen.set(t,r)}else s.call(this,t,r);return this}})}}));var py=new(0,H.WeakMap),vy=function(){function t(n){qt(this,t),py.set(this,{writable:!0,value:void 0}),function(t,n,e){var r=n.get(t);if(!r)throw new TypeError("attempted to set private field on non-instance");if(r.set)r.set.call(t,e);else{if(!r.writable)throw new TypeError("attempted to set read only private field");r.value=e}}(this,py,n)}return Gt(t,[{key:"price",value:function(t){var n=ey(this,py).format_price.format;return t=md(t),n=(n=n.replace("{sign}",t<0?"-":"")).replace("{price}",this._formatNumber(Math.abs(t),ey(this,py).format_price.decimals,ey(this,py).format_price.decimal_separator,ey(this,py).format_price.thousands_separator))}},{key:"date",value:function(t){switch(Sr(t)){case"string":return a.default(t).format(ey(this,py).moment_format_date)}}},{key:"time",value:function(t){switch(Sr(t)){case"string":return a.default(t).format(ey(this,py).moment_format_time);case"object":return t.format(ey(this,py).moment_format_time)}}},{key:"dateTime",value:function(t){switch(Sr(t)){case"string":return a.default(t).format(ey(this,py).moment_format_date+" "+ey(this,py).moment_format_time)}}},{key:"_formatNumber",value:function(t,n,e,r){var o;t=Math.abs(Number(t)||0).toFixed(n),n=isNaN(n=Math.abs(n))?2:n,e=void 0===e?".":e,r=void 0===r?",":r;var i=t<0?"-":"",u=String(Xf(t)),a=u.length>3?u.length%3:0;return i+(a?u.substr(0,a)+r:"")+u.substr(a).replace(/(\d{3})(?=\d)/g,"$1"+r)+(n?e+vu(o=Math.abs(t-u).toFixed(n)).call(o,2):"")}}]),t}();function my(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function hy(t){var n,e,r,o,i=Pl.l10n.recurring.number_of_days_to_shift_appointments+"";return{c:function(){n=sc("div"),e=dc(i),r=dc(": "),o=dc(t[0])},m:function(t,i){cc(t,n,i),ac(n,e),ac(n,r),ac(n,o)},p:function(t,n){1&n&&wc(o,t[0])},d:function(t){t&&fc(n)}}}function yy(t){var n,e,r=0!==t[0]&&hy(t);return{c:function(){var o;r&&r.c(),n=pc(),(e=sc("div")).textContent=Zu(o="".concat(Pl.l10n.recurring.appointments_will_be_scheduled_at,": ")).call(o,t[2].time(ps()))},m:function(t,o){r&&r.m(t,o),cc(t,n,o),cc(t,e,o)},p:function(t,e){0!==t[0]?r?r.p(t,e):((r=hy(t)).c(),r.m(n.parentNode,n)):r&&(r.d(1),r=null)},d:function(t){r&&r.d(t),t&&fc(n),t&&fc(e)}}}function gy(t){var n,e,r,o;return n=new ny({}),r=new Ch({props:{type:"success",show:"current"!==t[1],$$slots:{default:[yy]},$$scope:{ctx:t}}}),{c:function(){ff(n.$$.fragment),e=pc(),ff(r.$$.fragment)},m:function(t,i){lf(n,t,i),cc(t,e,i),lf(r,t,i),o=!0},p:function(t,n){var e=Wi(n,1)[0],o={};2&e&&(o.show="current"!==t[1]),33&e&&(o.$$scope={dirty:e,ctx:t}),r.$set(o)},i:function(t){o||(rf(n.$$.fragment,t),rf(r.$$.fragment,t),o=!0)},o:function(t){of(n.$$.fragment,t),of(r.$$.fragment,t),o=!1},d:function(t){sf(n,t),t&&fc(e),sf(r,t)}}}function _y(t,n,e){var r,o,i;Va(t,Yl,(function(t){return e(3,r=t)})),Va(t,gs,(function(t){return e(4,o=t)})),Va(t,Bs,(function(t){return e(1,i=t)}));var u=new vy(Pl),a=0;return t.$$.update=function(){24&t.$$.dirty&&e(0,a=r?ps().startOf("day").diff(o.startDate.startOf("day"),"days"):0)},[a,i,u,r,o]}var $y=function(t){nn(e,t);var n=my(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,_y,gy,Wa,{}),r}return e}(vf);function by(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function wy(t){var n,e,r,o,i,u,a,c,f,l,s,d,p,v,m,h;return{c:function(){n=sc("div"),(e=sc("label")).textContent="".concat(Pl.l10n.send_notifications),r=pc(),o=sc("div"),i=sc("input"),u=pc(),(a=sc("label")).textContent="".concat(Pl.l10n.send_if_new_or_status_changed),c=pc(),f=sc("div"),l=sc("input"),s=pc(),(d=sc("label")).textContent="".concat(Pl.l10n.send_as_for_new),p=pc(),(v=sc("small")).textContent="".concat(Pl.l10n.chose_queue_type_info),yc(i,"id","bookly-queue-type-changed-status"),yc(i,"class","custom-control-input"),yc(i,"type","radio"),i.__value="changed_status",i.value=i.__value,t[2][0].push(i),yc(a,"for","bookly-queue-type-changed-status"),yc(a,"class","custom-control-label"),yc(o,"class","custom-control custom-radio"),yc(l,"id","bookly-queue-type-all"),yc(l,"class","custom-control-input"),yc(l,"type","radio"),l.__value="all",l.value=l.__value,t[2][0].push(l),yc(d,"for","bookly-queue-type-all"),yc(d,"class","custom-control-label"),yc(f,"class","custom-control custom-radio"),yc(v,"class","help-block"),yc(n,"class","form-group")},m:function(y,g){cc(y,n,g),ac(n,e),ac(n,r),ac(n,o),ac(o,i),i.checked=i.__value===t[0],ac(o,u),ac(o,a),ac(n,c),ac(n,f),ac(f,l),l.checked=l.__value===t[0],ac(f,s),ac(f,d),ac(n,p),ac(n,v),m||(h=[mc(i,"change",t[1]),mc(l,"change",t[3])],m=!0)},p:function(t,n){var e=Wi(n,1)[0];1&e&&(i.checked=i.__value===t[0]),1&e&&(l.checked=l.__value===t[0])},i:Fa,o:Fa,d:function(e){var r,o,u,a;e&&fc(n),pa(r=t[2][0]).call(r,na(o=t[2][0]).call(o,i),1),pa(u=t[2][0]).call(u,na(a=t[2][0]).call(a,l),1),m=!1,Ua(h)}}}function xy(t,n,e){var r;Va(t,Is,(function(t){return e(0,r=t)}));return[r,function(){r=this.__value,Is.set(r)},[[]],function(){r=this.__value,Is.set(r)}]}var ky=function(t){nn(e,t);var n=by(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,xy,wy,Wa,{}),r}return e}(vf);function Oy(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Sy(t,n,e){var r=vu(t).call(t);return r[6]=n[e],r[8]=e,r}function Ey(t){var n,e,r,o,i,u,a,c,f,l,s,d,p,v,m,h,y,g,_=t[6].data.name+"",$=t[6].address+"",b=t[6].name+"";return{c:function(){n=sc("div"),e=sc("input"),r=pc(),o=sc("label"),i=sc("i"),a=pc(),c=sc("b"),f=dc(_),l=dc(" ("),s=dc($),d=dc(")"),p=sc("br"),v=pc(),m=dc(b),h=pc(),yc(e,"class","custom-control-input"),yc(e,"id","bookly-notification-"+t[8]),yc(e,"type","checkbox"),e.__value=t[8],e.value=e.__value,t[5][0].push(e),yc(i,"class",u="fa-fw "+("sms"===t[6].gateway?"fas fa-sms":"far fa-envelope")),yc(o,"class","custom-control-label"),yc(o,"for","bookly-notification-"+t[8]),yc(n,"class","custom-control custom-checkbox")},m:function(u,_){var $;cc(u,n,_),ac(n,e),e.checked=~na($=t[1]).call($,e.__value),ac(n,r),ac(n,o),ac(o,i),ac(o,a),ac(o,c),ac(c,f),ac(o,l),ac(o,s),ac(o,d),ac(o,p),ac(o,v),ac(o,m),ac(n,h),y||(g=mc(e,"change",t[4]),y=!0)},p:function(t,n){var r;2&n&&(e.checked=~na(r=t[1]).call(r,e.__value));1&n&&u!==(u="fa-fw "+("sms"===t[6].gateway?"fas fa-sms":"far fa-envelope"))&&yc(i,"class",u),1&n&&_!==(_=t[6].data.name+"")&&wc(f,_),1&n&&$!==($=t[6].address+"")&&wc(s,$),1&n&&b!==(b=t[6].name+"")&&wc(m,b)},d:function(r){var o,i;r&&fc(n),pa(o=t[5][0]).call(o,na(i=t[5][0]).call(i,e),1),y=!1,g()}}}function Ay(t){for(var n,e=t[0],r=[],o=0;o<e.length;o+=1)r[o]=Ey(Sy(t,e,o));return{c:function(){n=sc("div");for(var t=0;t<r.length;t+=1)r[t].c();yc(n,"class","form-group")},m:function(t,e){cc(t,n,e);for(var o=0;o<r.length;o+=1)r[o].m(n,null)},p:function(t,o){var i=Wi(o,1)[0];if(3&i){var u;for(e=t[0],u=0;u<e.length;u+=1){var a=Sy(t,e,u);r[u]?r[u].p(a,i):(r[u]=Ey(a),r[u].c(),r[u].m(n,null))}for(;u<r.length;u+=1)r[u].d(1);r.length=e.length}},i:Fa,o:Fa,d:function(t){t&&fc(n),lc(r,t)}}}function jy(t,n,e){var r,o,i;Va(t,Is,(function(t){return e(2,r=t)})),Va(t,Ds,(function(t){return e(3,o=t)})),Va(t,Ms,(function(t){return e(1,i=t)}));var u=n.notifications,a=void 0===u?[]:u,c=[[]];return t.$$set=function(t){"notifications"in t&&e(0,a=t.notifications)},t.$$.update=function(){var n;(8&t.$$.dirty&&tc(Is,r=o&&o.changed_status.length?"changed_status":"all",r),13&t.$$.dirty)&&(o?(e(0,a=o[r]),tc(Ms,i=_a(n=Vu(a)).call(n,(function(t){return Xf(t)})),i)):(e(0,a=[]),tc(Ms,i=[],i)))},[a,i,r,o,function(){i=_c(c[0],this.__value,this.checked),Ms.set(i)},c]}var Ty=function(t){nn(e,t);var n=Oy(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,jy,Ay,Wa,{notifications:0}),r}return e}(vf);function Py(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Ry(t){var n,e;return n=new ky({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function By(t){var n,e,r,o=t[0].changed_status.length&&t[0].all.length&&Ry();return e=new Ty({}),{c:function(){o&&o.c(),n=pc(),ff(e.$$.fragment)},m:function(t,i){o&&o.m(t,i),cc(t,n,i),lf(e,t,i),r=!0},p:function(t,e){var r=Wi(e,1)[0];t[0].changed_status.length&&t[0].all.length?o?1&r&&rf(o,1):((o=Ry()).c(),rf(o,1),o.m(n.parentNode,n)):o&&(nf(),of(o,1,1,(function(){o=null})),ef())},i:function(t){r||(rf(o),rf(e.$$.fragment,t),r=!0)},o:function(t){of(o),of(e.$$.fragment,t),r=!1},d:function(t){o&&o.d(t),t&&fc(n),sf(e,t)}}}function Dy(t,n,e){var r;return Va(t,Ds,(function(t){return e(0,r=t)})),[r]}var Iy=function(t){nn(e,t);var n=Py(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Dy,By,Wa,{}),r}return e}(vf);function My(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Cy(t){var n,e;return(n=new Jv({props:{loading:t[0],class:"btn-success",caption:Pl.l10n.send}})).$on("click",t[2]),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},p:function(t,e){var r={};1&e&&(r.loading=t[0]),n.$set(r)},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Ny(t){var n,e,r="queue"===t[1]&&Cy(t);return{c:function(){r&&r.c(),n=vc()},m:function(t,o){r&&r.m(t,o),cc(t,n,o),e=!0},p:function(t,e){var o=Wi(e,1)[0];"queue"===t[1]?r?(r.p(t,o),2&o&&rf(r,1)):((r=Cy(t)).c(),rf(r,1),r.m(n.parentNode,n)):r&&(nf(),of(r,1,1,(function(){r=null})),ef())},i:function(t){e||(rf(r),e=!0)},o:function(t){of(r),e=!1},d:function(t){r&&r.d(t),t&&fc(n)}}}function Ly(t,n,e){var r;Va(t,rs,(function(t){return e(1,r=t)}));var o,i=(o="cxt",Ic().$$.context.get(o)),a=!1;return[a,r,function(){var t=rd();t.selected.length>0?(e(0,a=!0),u.default.post(ajaxurl,{action:"bookly_send_queue",csrf_token:Al,queue:t.selected,attachments:t.attachments},(function(t){t.success&&(i.modal.hide(),tc(rs,r="main",r))}),"json").always((function(){return e(0,a=!1)}))):(i.modal.hide(),tc(rs,r="main",r))}]}var Fy=function(t){nn(e,t);var n=My(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Ly,Ny,Wa,{}),r}return e}(vf);function zy(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function qy(t){var n,e;return n=new Iy({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Yy(t){var n,e;return n=new $y({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Hy(t){var n,e;return n=new Uh({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Uy(t){var n,e;return n=new Im({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Gy(t){var n;return{c:function(){yc(n=sc("div"),"class","bookly-loading")},m:function(t,e){cc(t,n,e)},i:Fa,o:Fa,d:function(t){t&&fc(n)}}}function Wy(t){var n,e,r,o,i,u,a=[Gy,Uy,Hy,Yy,qy],c=[];function f(t,r){return t[2]?0:"main"===t[5]?1:(32&r&&(n=!(!El("recurring-appointments")||"schedule"!==t[5])),n?2:(32&r&&(e=!(!El("recurring-appointments")||"reschedule"!==t[5])),e?3:"queue"===t[5]?4:-1))}return~(r=f(t,-1))&&(o=c[r]=a[r](t)),{c:function(){o&&o.c(),i=vc()},m:function(t,n){~r&&c[r].m(t,n),cc(t,i,n),u=!0},p:function(t,n){var e=r;(r=f(t,n))!==e&&(o&&(nf(),of(c[e],1,1,(function(){c[e]=null})),ef()),~r?((o=c[r])||(o=c[r]=a[r](t)).c(),rf(o,1),o.m(i.parentNode,i)):o=null)},i:function(t){u||(rf(o),u=!0)},o:function(t){of(o),u=!1},d:function(t){~r&&c[r].d(t),t&&fc(i)}}}function Jy(t){var n,e;return n=new Fy({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Vy(t){var n,e;return(n=new Jv({props:{class:"btn-success",loading:t[3],disabled:!t[7]&&Vl&&Ls()||!t[4]&&!t[7]||t[8],className:"btn-success",caption:Pl.l10n.save}})).$on("click",t[9]),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},p:function(t,e){var r={};8&e&&(r.loading=t[3]),400&e&&(r.disabled=!t[7]&&Vl&&Ls()||!t[4]&&!t[7]||t[8]),n.$set(r)},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Qy(t){var n,e,r,o,i,u,a=El("recurring-appointments")&&function(t){var n,e;return n=new Kh({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}(),c="queue"===t[5]&&Jy(),f=!("queue"===t[5]||t[6]&&!t[7]&&"main"===t[5])&&Vy(t);return(i=new Jv({props:{caption:Pl.l10n.cancel}})).$on("click",(function(){Ga(t[0].modal.hide())&&t[0].modal.hide().apply(this,arguments)})),{c:function(){n=sc("div"),a&&a.c(),e=pc(),c&&c.c(),r=pc(),f&&f.c(),o=pc(),ff(i.$$.fragment),yc(n,"slot","footer")},m:function(t,l){cc(t,n,l),a&&a.m(n,null),ac(n,e),c&&c.m(n,null),ac(n,r),f&&f.m(n,null),ac(n,o),lf(i,n,null),u=!0},p:function(e,i){"queue"===(t=e)[5]?c?32&i&&rf(c,1):((c=Jy()).c(),rf(c,1),c.m(n,r)):c&&(nf(),of(c,1,1,(function(){c=null})),ef()),"queue"===t[5]||t[6]&&!t[7]&&"main"===t[5]?f&&(nf(),of(f,1,1,(function(){f=null})),ef()):f?(f.p(t,i),224&i&&rf(f,1)):((f=Vy(t)).c(),rf(f,1),f.m(n,o))},i:function(t){u||(rf(a),rf(c),rf(f),rf(i.$$.fragment,t),u=!0)},o:function(t){of(a),of(c),of(f),of(i.$$.fragment,t),u=!1},d:function(t){t&&fc(n),a&&a.d(),c&&c.d(),f&&f.d(),sf(i)}}}function Ky(t){var n,e,r={title:t[1],$$slots:{footer:[Qy],default:[Wy]},$$scope:{ctx:t}};return n=new sd({props:r}),t[13](n),n.$on("hidden",t[10]),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},p:function(t,e){var r=Wi(e,1)[0],o={};2&r&&(o.title=t[1]),2097661&r&&(o.$$scope={dirty:r,ctx:t}),n.$set(o)},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(e){t[13](null),sf(n,e)}}}function Xy(t,n,e){var r,o,i,a,c,f,l,s,d,p,v,m;Va(t,_s,(function(t){return e(14,r=t)})),Va(t,Ml,(function(t){return e(15,o=t)})),Va(t,Pf,(function(t){return e(16,i=t)})),Va(t,Yl,(function(t){return e(4,a=t)})),Va(t,Hl,(function(t){return e(17,c=t)})),Va(t,Ul,(function(t){return e(18,f=t)})),Va(t,Os,(function(t){return e(19,l=t)})),Va(t,rs,(function(t){return e(5,s=t)})),Va(t,Bs,(function(t){return e(20,d=t)})),Va(t,Vl,(function(t){return e(6,p=t)})),Va(t,ql,(function(t){return e(7,v=t)})),Va(t,Jl,(function(t){return e(8,m=t)}));var h,y,g={modal:null},_="",$=!0,b=!1;return h="cxt",y=g,Ic().$$.context.set(h,y),[g,_,$,b,a,s,p,v,m,function(){!function(){var t=rs.get();Pf.get();var n=gs.get(),e=vs();if("reschedule"!==t&&n.startDate&&e!==n.startDate.format("YYYY-MM-DD HH:mm:00")){var r,o=od(Zl.get());try{for(o.s();!(r=o.n()).done;)if(r.value.series_id)return!0}catch(t){o.e(t)}finally{o.f()}}return!1}()?(e(3,b=!0),function(){var t,n,e={action:"bookly_save_appointment_form",csrf_token:Al,id:gs.get().id,staff_id:Ml.get()?Ml.get().id:null,location_id:zl.get()?zl.get().id:null,skip_date:ql.get()?1:0,repeat:Ma(Vl.get()?{enabled:1,repeat:Xl.get()}:{enabled:0}),schedule:(n=[],uu(t=Rs.get()).call(t,(function(t){t.deleted||n.push(t.slots)})),n),customers:ls(),notification:ns.get()?1:0,internal_note:ts.get(),reschedule_type:Bs.get(),created_from:"undefined"!=typeof BooklySCCalendarL10n?"staff-cabinet":"backend"};return ql.get()||(e.start_date=vs(),e.end_date=ms()),null===Cl.get()||(Cl.get().id?e.service_id=Cl.get().id:(e.service_id="",e.custom_service_name=Nl.get(),e.custom_service_price=Ll.get())),u.default.post(ajaxurl,e,(function(t){t.success?Ds.set(t.queue):es.update((function(n){var e;return uu(e=Vu(t.errors)).call(e,(function(e){return n[e]=t.errors[e]})),n})),t.alert_errors&&booklyAlert({error:t.alert_errors})}),"json")}().then((function(t){t.success&&(t.queue.all.length||t.queue.changed_status.length?tc(rs,s="queue",s):g.modal.hide(),r("current"!==d?"refresh":t.data))})).always((function(){return e(3,b=!1)}))):tc(rs,s="reschedule",s)},function(){!function(){if("queue"===rs.get()){var t=rd().attachments;if(t.length>0)jQuery.post(ajaxurl,{action:"bookly_clear_attachments",csrf_token:Al,attachments:t},"json")}}(),Ks()},function(t,n){e(2,$=!0),Ks(),tc(_s,r=n,r),e(1,_=Pl.l10n.edit_appointment),Qs().then((function(){return function(t){return u.default.get(ajaxurl,{action:"bookly_get_data_for_appointment",id:t,csrf_token:Al}).done((function(n){if(n.success){var e,r=n.data,o=Pf.get(),i=r.start_date&&moment(r.start_date),a=r.start_date&&moment(r.end_date),c=kl(r.staff_id,o.staff);0!==r.service_id&&null===kl(r.service_id,c.services)&&c.services.push(r.service),Ml.set(c),ys.set(r.staff_any?c:null),Cl.set(kl(0===r.service_id?null:r.service_id,c.services)),zl.set(0!==r.location_id?kl(r.location_id,c.locations):null),ql.set(!r.start_date),gs.set({id:t,startDate:i&&i.clone(),startTime:r.start_time,endTime:r.end_time}),Nl.set(r.custom_service_name),Ll.set(r.custom_service_price),ts.set(r.internal_note),null!==i?(Yl.set(i.clone()),Hl.set(i.format("HH:mm")),i.format("YYYY-MM-DD")===a.format("YYYY-MM-DD")?Gl.set(a.format("HH:mm")):Gl.set(24*a.clone().startOf("day").diff(i.clone().startOf("day"),"days")+a.hour()+a.format(":mm"))):(Yl.set(moment()),Hl.set(moment().format("HH:mm")),ds()),o.customers_loaded||(o.customers=r.customers_data||[],Pf.set(o)),Zl.set(_a(e=r.customers).call(e,(function(t){var n=Ol(kl(t.id,o.customers));return as(n),u.default.extend(n,t),n}))),Fl.set({url:n.data.online_meeting_start_url,copied:!1})}}))}(t)})).always((function(){return e(2,$=!1)})),g.modal.show()},function(t,n,s){e(2,$=!0),Ks(),tc(_s,r=s,r),e(1,_=Pl.l10n.new_appointment),Qs().then((function(){return u.default.Deferred(function(){var e,r=(e=mu.mark((function e(r){return mu.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return tc(Ml,o=null===t?null:kl(t,i.staff),o),tc(Yl,a=n,a),e.next=4,Hc();case 4:return tc(Hl,c=a.format("HH:mm"),c),tc(Ul,f=As(c,l),f),e.next=8,Hc();case 8:ds(),r.resolve();case 10:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new _i((function(r,o){var i=e.apply(t,n);function u(t){$i(i,r,o,u,a,"next",t)}function a(t){$i(i,r,o,u,a,"throw",t)}u(void 0)}))});return function(t){return r.apply(this,arguments)}}())})).always((function(){return e(2,$=!1)})),g.modal.show()},function(t){Nc[t?"unshift":"push"]((function(){g.modal=t,e(0,g)}))}]}var Zy,tg=function(t){nn(e,t);var n=zy(e);function e(t){var r;return qt(this,e),pf(Wt(r=n.call(this)),t,Xy,Ky,Wa,{edit:11,create:12}),r}return Gt(e,[{key:"edit",get:function(){return this.$$.ctx[11]}},{key:"create",get:function(){return this.$$.ctx[12]}}]),e}(vf);return t.showDialog=function(t,n,e,r){Zy||(Zy=new tg({target:document.getElementById("bookly-appointment-dialog"),props:{}})),t?Zy.edit(t,r):Zy.create(n,e,r)},Object.defineProperty(t,"__esModule",{value:!0}),t}({},jQuery,moment,BooklyL10nAppDialog,Ladda);
1
+ var BooklyAppointmentDialog=function(t,n,e,r,o){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var u=i(n),a=i(e),c=i(r),f=i(o),l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t){var n={exports:{}};return t(n,n.exports),n.exports}var d,v=function(t){return t&&t.Math==Math&&t},p=v("object"==typeof globalThis&&globalThis)||v("object"==typeof window&&window)||v("object"==typeof self&&self)||v("object"==typeof l&&l)||function(){return this}()||Function("return this")(),h=function(t){try{return!!t()}catch(t){return!0}},m=!h((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),y={}.propertyIsEnumerable,g=Object.getOwnPropertyDescriptor,_={f:g&&!y.call({1:2},1)?function(t){var n=g(this,t);return!!n&&n.enumerable}:y},$=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}},b={}.toString,w=function(t){return b.call(t).slice(8,-1)},x="".split,k=h((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==w(t)?x.call(t,""):Object(t)}:Object,O=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},S=function(t){return k(O(t))},E=function(t){return"object"==typeof t?null!==t:"function"==typeof t},A=function(t,n){if(!E(t))return t;var e,r;if(n&&"function"==typeof(e=t.toString)&&!E(r=e.call(t)))return r;if("function"==typeof(e=t.valueOf)&&!E(r=e.call(t)))return r;if(!n&&"function"==typeof(e=t.toString)&&!E(r=e.call(t)))return r;throw TypeError("Can't convert object to primitive value")},j={}.hasOwnProperty,T=function(t,n){return j.call(t,n)},P=p.document,R=E(P)&&E(P.createElement),B=function(t){return R?P.createElement(t):{}},D=!m&&!h((function(){return 7!=Object.defineProperty(B("div"),"a",{get:function(){return 7}}).a})),M=Object.getOwnPropertyDescriptor,I={f:m?M:function(t,n){if(t=S(t),n=A(n,!0),D)try{return M(t,n)}catch(t){}if(T(t,n))return $(!_.f.call(t,n),t[n])}},C=/#|\.prototype\./,N=function(t,n){var e=F[L(t)];return e==Y||e!=z&&("function"==typeof n?h(n):!!n)},L=N.normalize=function(t){return String(t).replace(C,".").toLowerCase()},F=N.data={},z=N.NATIVE="N",Y=N.POLYFILL="P",q=N,H={},U=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t},G=function(t,n,e){if(U(t),void 0===n)return t;switch(e){case 0:return function(){return t.call(n)};case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,o){return t.call(n,e,r,o)}}return function(){return t.apply(n,arguments)}},W=function(t){if(!E(t))throw TypeError(String(t)+" is not an object");return t},J=Object.defineProperty,V={f:m?J:function(t,n,e){if(W(t),n=A(n,!0),W(e),D)try{return J(t,n,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported");return"value"in e&&(t[n]=e.value),t}},Q=m?function(t,n,e){return V.f(t,n,$(1,e))}:function(t,n,e){return t[n]=e,t},K=I.f,X=function(t){var n=function(n,e,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,e)}return new t(n,e,r)}return t.apply(this,arguments)};return n.prototype=t.prototype,n},Z=function(t,n){var e,r,o,i,u,a,c,f,l=t.target,s=t.global,d=t.stat,v=t.proto,h=s?p:d?p[l]:(p[l]||{}).prototype,m=s?H:H[l]||(H[l]={}),y=m.prototype;for(o in n)e=!q(s?o:l+(d?".":"#")+o,t.forced)&&h&&T(h,o),u=m[o],e&&(a=t.noTargetGet?(f=K(h,o))&&f.value:h[o]),i=e&&a?a:n[o],e&&typeof u==typeof i||(c=t.bind&&e?G(i,p):t.wrap&&e?X(i):v&&"function"==typeof i?G(Function.call,i):i,(t.sham||i&&i.sham||u&&u.sham)&&Q(c,"sham",!0),m[o]=c,v&&(T(H,r=l+"Prototype")||Q(H,r,{}),H[r][o]=i,t.real&&y&&!y[o]&&Q(y,o,i)))},tt=function(t){return"function"==typeof t?t:void 0},nt=function(t,n){return arguments.length<2?tt(H[t])||tt(p[t]):H[t]&&H[t][n]||p[t]&&p[t][n]},et=Math.ceil,rt=Math.floor,ot=function(t){return isNaN(t=+t)?0:(t>0?rt:et)(t)},it=Math.min,ut=function(t){return t>0?it(ot(t),9007199254740991):0},at=Math.max,ct=Math.min,ft=function(t,n){var e=ot(t);return e<0?at(e+n,0):ct(e,n)},lt=function(t){return function(n,e,r){var o,i=S(n),u=ut(i.length),a=ft(r,u);if(t&&e!=e){for(;u>a;)if((o=i[a++])!=o)return!0}else for(;u>a;a++)if((t||a in i)&&i[a]===e)return t||a||0;return!t&&-1}},st={includes:lt(!0),indexOf:lt(!1)},dt={},vt=st.indexOf,pt=function(t,n){var e,r=S(t),o=0,i=[];for(e in r)!T(dt,e)&&T(r,e)&&i.push(e);for(;n.length>o;)T(r,e=n[o++])&&(~vt(i,e)||i.push(e));return i},ht=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],mt=Object.keys||function(t){return pt(t,ht)},yt=m?Object.defineProperties:function(t,n){W(t);for(var e,r=mt(n),o=r.length,i=0;o>i;)V.f(t,e=r[i++],n[e]);return t},gt=nt("document","documentElement"),_t=!0,$t="__core-js_shared__",bt=p[$t]||function(t,n){try{Q(p,t,n)}catch(e){p[t]=n}return n}($t,{}),wt=s((function(t){(t.exports=function(t,n){return bt[t]||(bt[t]=void 0!==n?n:{})})("versions",[]).push({version:"3.8.3",mode:"pure",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),xt=0,kt=Math.random(),Ot=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++xt+kt).toString(36)},St=wt("keys"),Et=function(t){return St[t]||(St[t]=Ot(t))},At=Et("IE_PROTO"),jt=function(){},Tt=function(t){return"<script>"+t+"</"+"script>"},Pt=function(){try{d=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,n;Pt=d?function(t){t.write(Tt("")),t.close();var n=t.parentWindow.Object;return t=null,n}(d):((n=B("iframe")).style.display="none",gt.appendChild(n),n.src=String("javascript:"),(t=n.contentWindow.document).open(),t.write(Tt("document.F=Object")),t.close(),t.F);for(var e=ht.length;e--;)delete Pt.prototype[ht[e]];return Pt()};dt[At]=!0;var Rt=Object.create||function(t,n){var e;return null!==t?(jt.prototype=W(t),e=new jt,jt.prototype=null,e[At]=t):e=Pt(),void 0===n?e:yt(e,n)},Bt=[].slice,Dt={},Mt=function(t,n,e){if(!(n in Dt)){for(var r=[],o=0;o<n;o++)r[o]="a["+o+"]";Dt[n]=Function("C,a","return new C("+r.join(",")+")")}return Dt[n](t,e)},It=Function.bind||function(t){var n=U(this),e=Bt.call(arguments,1),r=function(){var o=e.concat(Bt.call(arguments));return this instanceof r?Mt(n,o.length,o):n.apply(t,o)};return E(n.prototype)&&(r.prototype=n.prototype),r},Ct=nt("Reflect","construct"),Nt=h((function(){function t(){}return!(Ct((function(){}),[],t)instanceof t)})),Lt=!h((function(){Ct((function(){}))})),Ft=Nt||Lt;Z({target:"Reflect",stat:!0,forced:Ft,sham:Ft},{construct:function(t,n){U(t),W(n);var e=arguments.length<3?t:U(arguments[2]);if(Lt&&!Nt)return Ct(t,n,e);if(t==e){switch(n.length){case 0:return new t;case 1:return new t(n[0]);case 2:return new t(n[0],n[1]);case 3:return new t(n[0],n[1],n[2]);case 4:return new t(n[0],n[1],n[2],n[3])}var r=[null];return r.push.apply(r,n),new(It.apply(t,r))}var o=e.prototype,i=Rt(E(o)?o:Object.prototype),u=Function.apply.call(t,i,n);return E(u)?u:i}});var zt=H.Reflect.construct;function Yt(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}Z({target:"Object",stat:!0,forced:!m,sham:!m},{defineProperty:V.f});var qt=s((function(t){var n=H.Object,e=t.exports=function(t,e,r){return n.defineProperty(t,e,r)};n.defineProperty.sham&&(e.sham=!0)})),Ht=qt;function Ut(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Ht(t,r.key,r)}}function Gt(t,n,e){return n&&Ut(t.prototype,n),e&&Ut(t,e),t}function Wt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}Z({target:"Object",stat:!0,sham:!m},{create:Rt});var Jt=H.Object,Vt=function(t,n){return Jt.create(t,n)},Qt=Vt,Kt=Object.setPrototypeOf||("__proto__"in{}?function(){var t,n=!1,e={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(e,[]),n=e instanceof Array}catch(t){}return function(e,r){return W(e),function(t){if(!E(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype")}(r),n?t.call(e,r):e.__proto__=r,e}}():void 0);Z({target:"Object",stat:!0},{setPrototypeOf:Kt});var Xt=H.Object.setPrototypeOf,Zt=Xt;function tn(t,n){return(tn=Zt||function(t,n){return t.__proto__=n,t})(t,n)}function nn(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Qt(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&tn(t,n)}var en,rn,on=Array.isArray||function(t){return"Array"==w(t)},un=function(t){return Object(O(t))},an=function(t,n,e){var r=A(n);r in t?V.f(t,r,$(0,e)):t[r]=e},cn=!!Object.getOwnPropertySymbols&&!h((function(){return!String(Symbol())})),fn=cn&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ln=wt("wks"),sn=p.Symbol,dn=fn?sn:sn&&sn.withoutSetter||Ot,vn=function(t){return T(ln,t)||(cn&&T(sn,t)?ln[t]=sn[t]:ln[t]=dn("Symbol."+t)),ln[t]},pn=vn("species"),hn=function(t,n){var e;return on(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!on(e.prototype)?E(e)&&null===(e=e[pn])&&(e=void 0):e=void 0),new(void 0===e?Array:e)(0===n?0:n)},mn=nt("navigator","userAgent")||"",yn=p.process,gn=yn&&yn.versions,_n=gn&&gn.v8;_n?rn=(en=_n.split("."))[0]+en[1]:mn&&(!(en=mn.match(/Edge\/(\d+)/))||en[1]>=74)&&(en=mn.match(/Chrome\/(\d+)/))&&(rn=en[1]);var $n=rn&&+rn,bn=vn("species"),wn=function(t){return $n>=51||!h((function(){var n=[];return(n.constructor={})[bn]=function(){return{foo:1}},1!==n[t](Boolean).foo}))},xn=vn("isConcatSpreadable"),kn=9007199254740991,On="Maximum allowed index exceeded",Sn=$n>=51||!h((function(){var t=[];return t[xn]=!1,t.concat()[0]!==t})),En=wn("concat"),An=function(t){if(!E(t))return!1;var n=t[xn];return void 0!==n?!!n:on(t)};Z({target:"Array",proto:!0,forced:!Sn||!En},{concat:function(t){var n,e,r,o,i,u=un(this),a=hn(u,0),c=0;for(n=-1,r=arguments.length;n<r;n++)if(An(i=-1===n?u:arguments[n])){if(c+(o=ut(i.length))>kn)throw TypeError(On);for(e=0;e<o;e++,c++)e in i&&an(a,c,i[e])}else{if(c>=kn)throw TypeError(On);an(a,c++,i)}return a.length=c,a}});var jn=ht.concat("length","prototype"),Tn={f:Object.getOwnPropertyNames||function(t){return pt(t,jn)}},Pn=Tn.f,Rn={}.toString,Bn="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Dn={f:function(t){return Bn&&"[object Window]"==Rn.call(t)?function(t){try{return Pn(t)}catch(t){return Bn.slice()}}(t):Pn(S(t))}},Mn={f:Object.getOwnPropertySymbols},In=function(t,n,e,r){r&&r.enumerable?t[n]=e:Q(t,n,e)},Cn={f:vn},Nn=V.f,Ln=function(t){var n=H.Symbol||(H.Symbol={});T(n,t)||Nn(n,t,{value:Cn.f(t)})},Fn={};Fn[vn("toStringTag")]="z";var zn="[object z]"===String(Fn),Yn=vn("toStringTag"),qn="Arguments"==w(function(){return arguments}()),Hn=zn?w:function(t){var n,e,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=function(t,n){try{return t[n]}catch(t){}}(n=Object(t),Yn))?e:qn?w(n):"Object"==(r=w(n))&&"function"==typeof n.callee?"Arguments":r},Un=zn?{}.toString:function(){return"[object "+Hn(this)+"]"},Gn=V.f,Wn=vn("toStringTag"),Jn=function(t,n,e,r){if(t){var o=e?t:t.prototype;T(o,Wn)||Gn(o,Wn,{configurable:!0,value:n}),r&&!zn&&Q(o,"toString",Un)}},Vn=Function.toString;"function"!=typeof bt.inspectSource&&(bt.inspectSource=function(t){return Vn.call(t)});var Qn,Kn,Xn,Zn=bt.inspectSource,te=p.WeakMap,ne="function"==typeof te&&/native code/.test(Zn(te)),ee=p.WeakMap;if(ne){var re=bt.state||(bt.state=new ee),oe=re.get,ie=re.has,ue=re.set;Qn=function(t,n){return n.facade=t,ue.call(re,t,n),n},Kn=function(t){return oe.call(re,t)||{}},Xn=function(t){return ie.call(re,t)}}else{var ae=Et("state");dt[ae]=!0,Qn=function(t,n){return n.facade=t,Q(t,ae,n),n},Kn=function(t){return T(t,ae)?t[ae]:{}},Xn=function(t){return T(t,ae)}}var ce={set:Qn,get:Kn,has:Xn,enforce:function(t){return Xn(t)?Kn(t):Qn(t,{})},getterFor:function(t){return function(n){var e;if(!E(n)||(e=Kn(n)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return e}}},fe=[].push,le=function(t){var n=1==t,e=2==t,r=3==t,o=4==t,i=6==t,u=7==t,a=5==t||i;return function(c,f,l,s){for(var d,v,p=un(c),h=k(p),m=G(f,l,3),y=ut(h.length),g=0,_=s||hn,$=n?_(c,y):e||u?_(c,0):void 0;y>g;g++)if((a||g in h)&&(v=m(d=h[g],g,p),t))if(n)$[g]=v;else if(v)switch(t){case 3:return!0;case 5:return d;case 6:return g;case 2:fe.call($,d)}else switch(t){case 4:return!1;case 7:fe.call($,d)}return i?-1:r||o?o:$}},se={forEach:le(0),map:le(1),filter:le(2),some:le(3),every:le(4),find:le(5),findIndex:le(6),filterOut:le(7)},de=se.forEach,ve=Et("hidden"),pe="Symbol",he=vn("toPrimitive"),me=ce.set,ye=ce.getterFor(pe),ge=Object.prototype,_e=p.Symbol,$e=nt("JSON","stringify"),be=I.f,we=V.f,xe=Dn.f,ke=_.f,Oe=wt("symbols"),Se=wt("op-symbols"),Ee=wt("string-to-symbol-registry"),Ae=wt("symbol-to-string-registry"),je=wt("wks"),Te=p.QObject,Pe=!Te||!Te.prototype||!Te.prototype.findChild,Re=m&&h((function(){return 7!=Rt(we({},"a",{get:function(){return we(this,"a",{value:7}).a}})).a}))?function(t,n,e){var r=be(ge,n);r&&delete ge[n],we(t,n,e),r&&t!==ge&&we(ge,n,r)}:we,Be=function(t,n){var e=Oe[t]=Rt(_e.prototype);return me(e,{type:pe,tag:t,description:n}),m||(e.description=n),e},De=fn?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof _e},Me=function(t,n,e){t===ge&&Me(Se,n,e),W(t);var r=A(n,!0);return W(e),T(Oe,r)?(e.enumerable?(T(t,ve)&&t[ve][r]&&(t[ve][r]=!1),e=Rt(e,{enumerable:$(0,!1)})):(T(t,ve)||we(t,ve,$(1,{})),t[ve][r]=!0),Re(t,r,e)):we(t,r,e)},Ie=function(t,n){W(t);var e=S(n),r=mt(e).concat(Fe(e));return de(r,(function(n){m&&!Ce.call(e,n)||Me(t,n,e[n])})),t},Ce=function(t){var n=A(t,!0),e=ke.call(this,n);return!(this===ge&&T(Oe,n)&&!T(Se,n))&&(!(e||!T(this,n)||!T(Oe,n)||T(this,ve)&&this[ve][n])||e)},Ne=function(t,n){var e=S(t),r=A(n,!0);if(e!==ge||!T(Oe,r)||T(Se,r)){var o=be(e,r);return!o||!T(Oe,r)||T(e,ve)&&e[ve][r]||(o.enumerable=!0),o}},Le=function(t){var n=xe(S(t)),e=[];return de(n,(function(t){T(Oe,t)||T(dt,t)||e.push(t)})),e},Fe=function(t){var n=t===ge,e=xe(n?Se:S(t)),r=[];return de(e,(function(t){!T(Oe,t)||n&&!T(ge,t)||r.push(Oe[t])})),r};if(cn||(In((_e=function(){if(this instanceof _e)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,n=Ot(t),e=function(t){this===ge&&e.call(Se,t),T(this,ve)&&T(this[ve],n)&&(this[ve][n]=!1),Re(this,n,$(1,t))};return m&&Pe&&Re(ge,n,{configurable:!0,set:e}),Be(n,t)}).prototype,"toString",(function(){return ye(this).tag})),In(_e,"withoutSetter",(function(t){return Be(Ot(t),t)})),_.f=Ce,V.f=Me,I.f=Ne,Tn.f=Dn.f=Le,Mn.f=Fe,Cn.f=function(t){return Be(vn(t),t)},m&&we(_e.prototype,"description",{configurable:!0,get:function(){return ye(this).description}})),Z({global:!0,wrap:!0,forced:!cn,sham:!cn},{Symbol:_e}),de(mt(je),(function(t){Ln(t)})),Z({target:pe,stat:!0,forced:!cn},{for:function(t){var n=String(t);if(T(Ee,n))return Ee[n];var e=_e(n);return Ee[n]=e,Ae[e]=n,e},keyFor:function(t){if(!De(t))throw TypeError(t+" is not a symbol");if(T(Ae,t))return Ae[t]},useSetter:function(){Pe=!0},useSimple:function(){Pe=!1}}),Z({target:"Object",stat:!0,forced:!cn,sham:!m},{create:function(t,n){return void 0===n?Rt(t):Ie(Rt(t),n)},defineProperty:Me,defineProperties:Ie,getOwnPropertyDescriptor:Ne}),Z({target:"Object",stat:!0,forced:!cn},{getOwnPropertyNames:Le,getOwnPropertySymbols:Fe}),Z({target:"Object",stat:!0,forced:h((function(){Mn.f(1)}))},{getOwnPropertySymbols:function(t){return Mn.f(un(t))}}),$e){var ze=!cn||h((function(){var t=_e();return"[null]"!=$e([t])||"{}"!=$e({a:t})||"{}"!=$e(Object(t))}));Z({target:"JSON",stat:!0,forced:ze},{stringify:function(t,n,e){for(var r,o=[t],i=1;arguments.length>i;)o.push(arguments[i++]);if(r=n,(E(n)||void 0!==t)&&!De(t))return on(n)||(n=function(t,n){if("function"==typeof r&&(n=r.call(this,t,n)),!De(n))return n}),o[1]=n,$e.apply(null,o)}})}_e.prototype[he]||Q(_e.prototype,he,_e.prototype.valueOf),Jn(_e,pe),dt[ve]=!0,Ln("asyncIterator"),Ln("hasInstance"),Ln("isConcatSpreadable"),Ln("iterator"),Ln("match"),Ln("matchAll"),Ln("replace"),Ln("search"),Ln("species"),Ln("split"),Ln("toPrimitive"),Ln("toStringTag"),Ln("unscopables"),Jn(p.JSON,"JSON",!0);var Ye=H.Symbol;Ln("asyncDispose"),Ln("dispose"),Ln("observable"),Ln("patternMatch"),Ln("replaceAll");var qe,He,Ue,Ge=Ye,We=function(t){return function(n,e){var r,o,i=String(O(n)),u=ot(e),a=i.length;return u<0||u>=a?t?"":void 0:(r=i.charCodeAt(u))<55296||r>56319||u+1===a||(o=i.charCodeAt(u+1))<56320||o>57343?t?i.charAt(u):r:t?i.slice(u,u+2):o-56320+(r-55296<<10)+65536}},Je={codeAt:We(!1),charAt:We(!0)},Ve=!h((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Qe=Et("IE_PROTO"),Ke=Object.prototype,Xe=Ve?Object.getPrototypeOf:function(t){return t=un(t),T(t,Qe)?t[Qe]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Ke:null},Ze=vn("iterator"),tr=!1;[].keys&&("next"in(Ue=[].keys())?(He=Xe(Xe(Ue)))!==Object.prototype&&(qe=He):tr=!0);var nr=null==qe||h((function(){var t={};return qe[Ze].call(t)!==t}));nr&&(qe={}),nr&&!T(qe,Ze)&&Q(qe,Ze,(function(){return this}));var er={IteratorPrototype:qe,BUGGY_SAFARI_ITERATORS:tr},rr={},or=er.IteratorPrototype,ir=function(){return this},ur=er.IteratorPrototype,ar=er.BUGGY_SAFARI_ITERATORS,cr=vn("iterator"),fr="keys",lr="values",sr="entries",dr=function(){return this},vr=function(t,n,e,r,o,i,u){!function(t,n,e){var r=n+" Iterator";t.prototype=Rt(or,{next:$(1,e)}),Jn(t,r,!1,!0),rr[r]=ir}(e,n,r);var a,c,f,l=function(t){if(t===o&&h)return h;if(!ar&&t in v)return v[t];switch(t){case fr:case lr:case sr:return function(){return new e(this,t)}}return function(){return new e(this)}},s=n+" Iterator",d=!1,v=t.prototype,p=v[cr]||v["@@iterator"]||o&&v[o],h=!ar&&p||l(o),m="Array"==n&&v.entries||p;if(m&&(a=Xe(m.call(new t)),ur!==Object.prototype&&a.next&&(Jn(a,s,!0,!0),rr[s]=dr)),o==lr&&p&&p.name!==lr&&(d=!0,h=function(){return p.call(this)}),u&&v[cr]!==h&&Q(v,cr,h),rr[n]=h,o)if(c={values:l(lr),keys:i?h:l(fr),entries:l(sr)},u)for(f in c)(ar||d||!(f in v))&&In(v,f,c[f]);else Z({target:n,proto:!0,forced:ar||d},c);return c},pr=Je.charAt,hr="String Iterator",mr=ce.set,yr=ce.getterFor(hr);vr(String,"String",(function(t){mr(this,{type:hr,string:String(t),index:0})}),(function(){var t,n=yr(this),e=n.string,r=n.index;return r>=e.length?{value:void 0,done:!0}:(t=pr(e,r),n.index+=t.length,{value:t,done:!1})}));var gr="Array Iterator",_r=ce.set,$r=ce.getterFor(gr);vr(Array,"Array",(function(t,n){_r(this,{type:gr,target:S(t),index:0,kind:n})}),(function(){var t=$r(this),n=t.target,e=t.kind,r=t.index++;return!n||r>=n.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==e?{value:r,done:!1}:"values"==e?{value:n[r],done:!1}:{value:[r,n[r]],done:!1}}),"values"),rr.Arguments=rr.Array;var br=vn("toStringTag");for(var wr in{CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}){var xr=p[wr],kr=xr&&xr.prototype;kr&&Hn(kr)!==br&&Q(kr,br,wr),rr[wr]=rr.Array}var Or=Cn.f("iterator");function Sr(t){return(Sr="function"==typeof Ge&&"symbol"==typeof Or?function(t){return typeof t}:function(t){return t&&"function"==typeof Ge&&t.constructor===Ge&&t!==Ge.prototype?"symbol":typeof t})(t)}function Er(t,n){return!n||"object"!==Sr(n)&&"function"!=typeof n?Wt(t):n}var Ar=h((function(){Xe(1)}));Z({target:"Object",stat:!0,forced:Ar,sham:!Ve},{getPrototypeOf:function(t){return Xe(un(t))}});var jr=H.Object.getPrototypeOf,Tr=jr;function Pr(t){return(Pr=Zt?Tr:function(t){return t.__proto__||Tr(t)})(t)}var Rr=vn("iterator"),Br=Array.prototype,Dr=function(t){return void 0!==t&&(rr.Array===t||Br[Rr]===t)},Mr=vn("iterator"),Ir=function(t){if(null!=t)return t[Mr]||t["@@iterator"]||rr[Hn(t)]},Cr=function(t){var n=t.return;if(void 0!==n)return W(n.call(t)).value},Nr=function(t,n){this.stopped=t,this.result=n},Lr=function(t,n,e){var r,o,i,u,a,c,f,l=e&&e.that,s=!(!e||!e.AS_ENTRIES),d=!(!e||!e.IS_ITERATOR),v=!(!e||!e.INTERRUPTED),p=G(n,l,1+s+v),h=function(t){return r&&Cr(r),new Nr(!0,t)},m=function(t){return s?(W(t),v?p(t[0],t[1],h):p(t[0],t[1])):v?p(t,h):p(t)};if(d)r=t;else{if("function"!=typeof(o=Ir(t)))throw TypeError("Target is not iterable");if(Dr(o)){for(i=0,u=ut(t.length);u>i;i++)if((a=m(t[i]))&&a instanceof Nr)return a;return new Nr(!1)}r=o.call(t)}for(c=r.next;!(f=c.call(r)).done;){try{a=m(f.value)}catch(t){throw Cr(r),t}if("object"==typeof a&&a&&a instanceof Nr)return a}return new Nr(!1)},Fr=function(t,n){var e=this;if(!(e instanceof Fr))return new Fr(t,n);Kt&&(e=Kt(new Error(void 0),Xe(e))),void 0!==n&&Q(e,"message",String(n));var r=[];return Lr(t,r.push,{that:r}),Q(e,"errors",r),e};Fr.prototype=Rt(Error.prototype,{constructor:$(5,Fr),message:$(5,""),name:$(5,"AggregateError")}),Z({global:!0},{AggregateError:Fr});var zr=p.Promise,Yr=function(t,n,e){for(var r in n)e&&e.unsafe&&t[r]?t[r]=n[r]:In(t,r,n[r],e);return t},qr=vn("species"),Hr=function(t){var n=nt(t),e=V.f;m&&n&&!n[qr]&&e(n,qr,{configurable:!0,get:function(){return this}})},Ur=function(t,n,e){if(!(t instanceof n))throw TypeError("Incorrect "+(e?e+" ":"")+"invocation");return t},Gr=vn("iterator"),Wr=!1;try{var Jr=0,Vr={next:function(){return{done:!!Jr++}},return:function(){Wr=!0}};Vr[Gr]=function(){return this},Array.from(Vr,(function(){throw 2}))}catch(t){}var Qr,Kr,Xr,Zr=function(t,n){if(!n&&!Wr)return!1;var e=!1;try{var r={};r[Gr]=function(){return{next:function(){return{done:e=!0}}}},t(r)}catch(t){}return e},to=vn("species"),no=function(t,n){var e,r=W(t).constructor;return void 0===r||null==(e=W(r)[to])?n:U(e)},eo=/(iphone|ipod|ipad).*applewebkit/i.test(mn),ro="process"==w(p.process),oo=p.location,io=p.setImmediate,uo=p.clearImmediate,ao=p.process,co=p.MessageChannel,fo=p.Dispatch,lo=0,so={},vo="onreadystatechange",po=function(t){if(so.hasOwnProperty(t)){var n=so[t];delete so[t],n()}},ho=function(t){return function(){po(t)}},mo=function(t){po(t.data)},yo=function(t){p.postMessage(t+"",oo.protocol+"//"+oo.host)};io&&uo||(io=function(t){for(var n=[],e=1;arguments.length>e;)n.push(arguments[e++]);return so[++lo]=function(){("function"==typeof t?t:Function(t)).apply(void 0,n)},Qr(lo),lo},uo=function(t){delete so[t]},ro?Qr=function(t){ao.nextTick(ho(t))}:fo&&fo.now?Qr=function(t){fo.now(ho(t))}:co&&!eo?(Xr=(Kr=new co).port2,Kr.port1.onmessage=mo,Qr=G(Xr.postMessage,Xr,1)):p.addEventListener&&"function"==typeof postMessage&&!p.importScripts&&oo&&"file:"!==oo.protocol&&!h(yo)?(Qr=yo,p.addEventListener("message",mo,!1)):Qr=vo in B("script")?function(t){gt.appendChild(B("script")).onreadystatechange=function(){gt.removeChild(this),po(t)}}:function(t){setTimeout(ho(t),0)});var go,_o,$o,bo,wo,xo,ko,Oo,So={set:io,clear:uo},Eo=/web0s(?!.*chrome)/i.test(mn),Ao=I.f,jo=So.set,To=p.MutationObserver||p.WebKitMutationObserver,Po=p.document,Ro=p.process,Bo=p.Promise,Do=Ao(p,"queueMicrotask"),Mo=Do&&Do.value;Mo||(go=function(){var t,n;for(ro&&(t=Ro.domain)&&t.exit();_o;){n=_o.fn,_o=_o.next;try{n()}catch(t){throw _o?bo():$o=void 0,t}}$o=void 0,t&&t.enter()},eo||ro||Eo||!To||!Po?Bo&&Bo.resolve?(ko=Bo.resolve(void 0),Oo=ko.then,bo=function(){Oo.call(ko,go)}):bo=ro?function(){Ro.nextTick(go)}:function(){jo.call(p,go)}:(wo=!0,xo=Po.createTextNode(""),new To(go).observe(xo,{characterData:!0}),bo=function(){xo.data=wo=!wo}));var Io=Mo||function(t){var n={fn:t,next:void 0};$o&&($o.next=n),_o||(_o=n,bo()),$o=n},Co=function(t){var n,e;this.promise=new t((function(t,r){if(void 0!==n||void 0!==e)throw TypeError("Bad Promise constructor");n=t,e=r})),this.resolve=U(n),this.reject=U(e)},No={f:function(t){return new Co(t)}},Lo=function(t,n){if(W(t),E(n)&&n.constructor===t)return n;var e=No.f(t);return(0,e.resolve)(n),e.promise},Fo=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},zo=So.set,Yo=vn("species"),qo="Promise",Ho=ce.get,Uo=ce.set,Go=ce.getterFor(qo),Wo=zr,Jo=p.TypeError,Vo=p.document,Qo=p.process;nt("fetch");var Ko,Xo,Zo,ti=No.f,ni=ti,ei=!!(Vo&&Vo.createEvent&&p.dispatchEvent),ri="function"==typeof PromiseRejectionEvent,oi="unhandledrejection",ii=q(qo,(function(){if(!(Zn(Wo)!==String(Wo))){if(66===$n)return!0;if(!ro&&!ri)return!0}if(!Wo.prototype.finally)return!0;if($n>=51&&/native code/.test(Wo))return!1;var t=Wo.resolve(1),n=function(t){t((function(){}),(function(){}))};return(t.constructor={})[Yo]=n,!(t.then((function(){}))instanceof n)})),ui=ii||!Zr((function(t){Wo.all(t).catch((function(){}))})),ai=function(t){var n;return!(!E(t)||"function"!=typeof(n=t.then))&&n},ci=function(t,n){if(!t.notified){t.notified=!0;var e=t.reactions;Io((function(){for(var r=t.value,o=1==t.state,i=0;e.length>i;){var u,a,c,f=e[i++],l=o?f.ok:f.fail,s=f.resolve,d=f.reject,v=f.domain;try{l?(o||(2===t.rejection&&di(t),t.rejection=1),!0===l?u=r:(v&&v.enter(),u=l(r),v&&(v.exit(),c=!0)),u===f.promise?d(Jo("Promise-chain cycle")):(a=ai(u))?a.call(u,s,d):s(u)):d(r)}catch(t){v&&!c&&v.exit(),d(t)}}t.reactions=[],t.notified=!1,n&&!t.rejection&&li(t)}))}},fi=function(t,n,e){var r,o;ei?((r=Vo.createEvent("Event")).promise=n,r.reason=e,r.initEvent(t,!1,!0),p.dispatchEvent(r)):r={promise:n,reason:e},!ri&&(o=p["on"+t])?o(r):t===oi&&function(t,n){var e=p.console;e&&e.error&&(1===arguments.length?e.error(t):e.error(t,n))}("Unhandled promise rejection",e)},li=function(t){zo.call(p,(function(){var n,e=t.facade,r=t.value;if(si(t)&&(n=Fo((function(){ro?Qo.emit("unhandledRejection",r,e):fi(oi,e,r)})),t.rejection=ro||si(t)?2:1,n.error))throw n.value}))},si=function(t){return 1!==t.rejection&&!t.parent},di=function(t){zo.call(p,(function(){var n=t.facade;ro?Qo.emit("rejectionHandled",n):fi("rejectionhandled",n,t.value)}))},vi=function(t,n,e){return function(r){t(n,r,e)}},pi=function(t,n,e){t.done||(t.done=!0,e&&(t=e),t.value=n,t.state=2,ci(t,!0))},hi=function(t,n,e){if(!t.done){t.done=!0,e&&(t=e);try{if(t.facade===n)throw Jo("Promise can't be resolved itself");var r=ai(n);r?Io((function(){var e={done:!1};try{r.call(n,vi(hi,e,t),vi(pi,e,t))}catch(n){pi(e,n,t)}})):(t.value=n,t.state=1,ci(t,!1))}catch(n){pi({done:!1},n,t)}}};ii&&(Wo=function(t){Ur(this,Wo,qo),U(t),Ko.call(this);var n=Ho(this);try{t(vi(hi,n),vi(pi,n))}catch(t){pi(n,t)}},(Ko=function(t){Uo(this,{type:qo,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=Yr(Wo.prototype,{then:function(t,n){var e=Go(this),r=ti(no(this,Wo));return r.ok="function"!=typeof t||t,r.fail="function"==typeof n&&n,r.domain=ro?Qo.domain:void 0,e.parent=!0,e.reactions.push(r),0!=e.state&&ci(e,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),Xo=function(){var t=new Ko,n=Ho(t);this.promise=t,this.resolve=vi(hi,n),this.reject=vi(pi,n)},No.f=ti=function(t){return t===Wo||t===Zo?new Xo(t):ni(t)}),Z({global:!0,wrap:!0,forced:ii},{Promise:Wo}),Jn(Wo,qo,!1,!0),Hr(qo),Zo=nt(qo),Z({target:qo,stat:!0,forced:ii},{reject:function(t){var n=ti(this);return n.reject.call(void 0,t),n.promise}}),Z({target:qo,stat:!0,forced:_t},{resolve:function(t){return Lo(this===Zo?Wo:this,t)}}),Z({target:qo,stat:!0,forced:ui},{all:function(t){var n=this,e=ti(n),r=e.resolve,o=e.reject,i=Fo((function(){var e=U(n.resolve),i=[],u=0,a=1;Lr(t,(function(t){var c=u++,f=!1;i.push(void 0),a++,e.call(n,t).then((function(t){f||(f=!0,i[c]=t,--a||r(i))}),o)})),--a||r(i)}));return i.error&&o(i.value),e.promise},race:function(t){var n=this,e=ti(n),r=e.reject,o=Fo((function(){var o=U(n.resolve);Lr(t,(function(t){o.call(n,t).then(e.resolve,r)}))}));return o.error&&r(o.value),e.promise}}),Z({target:"Promise",stat:!0},{allSettled:function(t){var n=this,e=No.f(n),r=e.resolve,o=e.reject,i=Fo((function(){var e=U(n.resolve),o=[],i=0,u=1;Lr(t,(function(t){var a=i++,c=!1;o.push(void 0),u++,e.call(n,t).then((function(t){c||(c=!0,o[a]={status:"fulfilled",value:t},--u||r(o))}),(function(t){c||(c=!0,o[a]={status:"rejected",reason:t},--u||r(o))}))})),--u||r(o)}));return i.error&&o(i.value),e.promise}});var mi="No one promise resolved";Z({target:"Promise",stat:!0},{any:function(t){var n=this,e=No.f(n),r=e.resolve,o=e.reject,i=Fo((function(){var e=U(n.resolve),i=[],u=0,a=1,c=!1;Lr(t,(function(t){var f=u++,l=!1;i.push(void 0),a++,e.call(n,t).then((function(t){l||c||(c=!0,r(t))}),(function(t){l||c||(l=!0,i[f]=t,--a||o(new(nt("AggregateError"))(i,mi)))}))})),--a||o(new(nt("AggregateError"))(i,mi))}));return i.error&&o(i.value),e.promise}});var yi=!!zr&&h((function(){zr.prototype.finally.call({then:function(){}},(function(){}))}));Z({target:"Promise",proto:!0,real:!0,forced:yi},{finally:function(t){var n=no(this,nt("Promise")),e="function"==typeof t;return this.then(e?function(e){return Lo(n,t()).then((function(){return e}))}:t,e?function(e){return Lo(n,t()).then((function(){throw e}))}:t)}});var gi=H.Promise;Z({target:"Promise",stat:!0},{try:function(t){var n=No.f(this),e=Fo(t);return(e.error?n.reject:n.resolve)(e.value),n.promise}});var _i=gi;function $i(t,n,e,r,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void e(t)}a.done?n(c):_i.resolve(c).then(r,o)}Z({target:"Array",stat:!0},{isArray:on});var bi=H.Array.isArray,wi=bi;var xi=vn("iterator"),ki=function(t){var n=Object(t);return void 0!==n[xi]||"@@iterator"in n||rr.hasOwnProperty(Hn(n))},Oi=function(t){var n=Ir(t);if("function"!=typeof n)throw TypeError(String(t)+" is not iterable");return W(n.call(t))},Si=Oi;var Ei=Object.defineProperty,Ai={},ji=function(t){throw t},Ti=function(t,n){if(T(Ai,t))return Ai[t];n||(n={});var e=[][t],r=!!T(n,"ACCESSORS")&&n.ACCESSORS,o=T(n,0)?n[0]:ji,i=T(n,1)?n[1]:void 0;return Ai[t]=!!e&&!h((function(){if(r&&!m)return!0;var t={length:-1};r?Ei(t,1,{enumerable:!0,get:ji}):t[1]=1,e.call(t,o,i)}))},Pi=wn("slice"),Ri=Ti("slice",{ACCESSORS:!0,0:0,1:2}),Bi=vn("species"),Di=[].slice,Mi=Math.max;Z({target:"Array",proto:!0,forced:!Pi||!Ri},{slice:function(t,n){var e,r,o,i=S(this),u=ut(i.length),a=ft(t,u),c=ft(void 0===n?u:n,u);if(on(i)&&("function"!=typeof(e=i.constructor)||e!==Array&&!on(e.prototype)?E(e)&&null===(e=e[Bi])&&(e=void 0):e=void 0,e===Array||void 0===e))return Di.call(i,a,c);for(r=new(void 0===e?Array:e)(Mi(c-a,0)),o=0;a<c;a++,o++)a in i&&an(r,o,i[a]);return r.length=o,r}});var Ii=function(t){return H[t+"Prototype"]},Ci=Ii("Array").slice,Ni=Array.prototype,Li=function(t){var n=t.slice;return t===Ni||t instanceof Array&&n===Ni.slice?Ci:n},Fi=Li,zi=function(t,n,e,r){try{return r?n(W(e)[0],e[1]):n(e)}catch(n){throw Cr(t),n}},Yi=!Zr((function(t){Array.from(t)}));Z({target:"Array",stat:!0,forced:Yi},{from:function(t){var n,e,r,o,i,u,a=un(t),c="function"==typeof this?this:Array,f=arguments.length,l=f>1?arguments[1]:void 0,s=void 0!==l,d=Ir(a),v=0;if(s&&(l=G(l,f>2?arguments[2]:void 0,2)),null==d||c==Array&&Dr(d))for(e=new c(n=ut(a.length));n>v;v++)u=s?l(a[v],v):a[v],an(e,v,u);else for(i=(o=d.call(a)).next,e=new c;!(r=i.call(o)).done;v++)u=s?zi(o,l,[r.value,v],!0):r.value,an(e,v,u);return e.length=v,e}});var qi=H.Array.from,Hi=qi;function Ui(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}function Gi(t,n){var e;if(t){if("string"==typeof t)return Ui(t,n);var r=Fi(e=Object.prototype.toString.call(t)).call(e,8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Hi(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ui(t,n):void 0}}function Wi(t,n){return function(t){if(wi(t))return t}(t)||function(t,n){if(void 0!==Ge&&ki(Object(t))){var e=[],r=!0,o=!1,i=void 0;try{for(var u,a=Si(t);!(r=(u=a.next()).done)&&(e.push(u.value),!n||e.length!==n);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return e}}(t,n)||Gi(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Ji=Ye,Vi=qt,Qi=Vt,Ki=jr,Xi=function(t,n){var e=[][t];return!!e&&h((function(){e.call(null,n||function(){throw 1},1)}))},Zi=se.forEach,tu=Xi("forEach"),nu=Ti("forEach"),eu=tu&&nu?[].forEach:function(t){return Zi(this,t,arguments.length>1?arguments[1]:void 0)};Z({target:"Array",proto:!0,forced:[].forEach!=eu},{forEach:eu});var ru=Ii("Array").forEach,ou=Array.prototype,iu={DOMTokenList:!0,NodeList:!0},uu=function(t){var n=t.forEach;return t===ou||t instanceof Array&&n===ou.forEach||iu.hasOwnProperty(Hn(t))?ru:n},au=Xt,cu=gi,fu=[].reverse,lu=[1,2];Z({target:"Array",proto:!0,forced:String(lu)===String(lu.reverse())},{reverse:function(){return on(this)&&(this.length=this.length),fu.call(this)}});var su=Ii("Array").reverse,du=Array.prototype,vu=function(t){var n=t.reverse;return t===du||t instanceof Array&&n===du.reverse?su:n},pu=Li,hu=s((function(t){var n=function(t){var n,e=Object.prototype,r=e.hasOwnProperty,o="function"==typeof Ji?Ji:{},i=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function c(t,n,e){return Vi(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[n]}try{c({},"")}catch(t){c=function(t,n,e){return t[n]=e}}function f(t,n,e,r){var o=n&&n.prototype instanceof m?n:m,i=Qi(o.prototype),u=new E(r||[]);return i._invoke=function(t,n,e){var r=s;return function(o,i){if(r===v)throw new Error("Generator is already running");if(r===p){if("throw"===o)throw i;return j()}for(e.method=o,e.arg=i;;){var u=e.delegate;if(u){var a=k(u,e);if(a){if(a===h)continue;return a}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(r===s)throw r=p,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);r=v;var c=l(t,n,e);if("normal"===c.type){if(r=e.done?p:d,c.arg===h)continue;return{value:c.arg,done:e.done}}"throw"===c.type&&(r=p,e.method="throw",e.arg=c.arg)}}}(t,e,u),i}function l(t,n,e){try{return{type:"normal",arg:t.call(n,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var s="suspendedStart",d="suspendedYield",v="executing",p="completed",h={};function m(){}function y(){}function g(){}var _={};_[i]=function(){return this};var $=Ki&&Ki(Ki(A([])));$&&$!==e&&r.call($,i)&&(_=$);var b=g.prototype=m.prototype=Qi(_);function w(t){var n;uu(n=["next","throw","return"]).call(n,(function(n){c(t,n,(function(t){return this._invoke(n,t)}))}))}function x(t,n){function e(o,i,u,a){var c=l(t[o],t,i);if("throw"!==c.type){var f=c.arg,s=f.value;return s&&"object"===Sr(s)&&r.call(s,"__await")?n.resolve(s.__await).then((function(t){e("next",t,u,a)}),(function(t){e("throw",t,u,a)})):n.resolve(s).then((function(t){f.value=t,u(f)}),(function(t){return e("throw",t,u,a)}))}a(c.arg)}var o;this._invoke=function(t,r){function i(){return new n((function(n,o){e(t,r,n,o)}))}return o=o?o.then(i,i):i()}}function k(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,k(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var o=l(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function O(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function S(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function E(t){this.tryEntries=[{tryLoc:"root"}],uu(t).call(t,O,this),this.reset(!0)}function A(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,u=function e(){for(;++o<t.length;)if(r.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=n,e.done=!0,e};return u.next=u}}return{next:j}}function j(){return{value:n,done:!0}}return y.prototype=b.constructor=g,g.constructor=y,y.displayName=c(g,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var n="function"==typeof t&&t.constructor;return!!n&&(n===y||"GeneratorFunction"===(n.displayName||n.name))},t.mark=function(t){return au?au(t,g):(t.__proto__=g,c(t,a,"GeneratorFunction")),t.prototype=Qi(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),x.prototype[u]=function(){return this},t.AsyncIterator=x,t.async=function(n,e,r,o,i){void 0===i&&(i=cu);var u=new x(f(n,e,r,o),i);return t.isGeneratorFunction(e)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},w(b),c(b,a,"Generator"),b[i]=function(){return this},b.toString=function(){return"[object Generator]"},t.keys=function(t){var n=[];for(var e in t)n.push(e);return vu(n).call(n),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=A,E.prototype={constructor:E,reset:function(t){var e;if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,uu(e=this.tryEntries).call(e,S),!t)for(var o in this)"t"===o.charAt(0)&&r.call(this,o)&&!isNaN(+pu(o).call(o,1))&&(this[o]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(r,o){return a.type="throw",a.arg=t,e.next=r,o&&(e.method="next",e.arg=n),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=r.call(u,"catchLoc"),f=r.call(u,"finallyLoc");if(c&&f){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(t,n){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=n&&n<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=n,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(u)},complete:function(t,n){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&n&&(this.next=n),h},finish:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var e=this.tryEntries[n];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),S(e),h}},catch:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var e=this.tryEntries[n];if(e.tryLoc===t){var r=e.completion;if("throw"===r.type){var o=r.arg;S(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:A(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),h}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}})),mu=Ir,yu=bi;Z({target:"Reflect",stat:!0},{get:function t(n,e){var r,o,i=arguments.length<3?n:arguments[2];return W(n)===i?n[e]:(r=I.f(n,e))?T(r,"value")?r.value:void 0===r.get?void 0:r.get.call(i):E(o=Xe(n))?t(o,e,i):void 0}}),H.Reflect.get;var gu=I.f,_u=h((function(){gu(1)}));Z({target:"Object",stat:!0,forced:!m||_u,sham:!m},{getOwnPropertyDescriptor:function(t,n){return gu(S(t),n)}});var $u=s((function(t){var n=H.Object,e=t.exports=function(t,e){return n.getOwnPropertyDescriptor(t,e)};n.getOwnPropertyDescriptor.sham&&(e.sham=!0)})),bu=!h((function(){return Object.isExtensible(Object.preventExtensions({}))})),wu=s((function(t){var n=V.f,e=Ot("meta"),r=0,o=Object.isExtensible||function(){return!0},i=function(t){n(t,e,{value:{objectID:"O"+ ++r,weakData:{}}})},u=t.exports={REQUIRED:!1,fastKey:function(t,n){if(!E(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!T(t,e)){if(!o(t))return"F";if(!n)return"E";i(t)}return t[e].objectID},getWeakData:function(t,n){if(!T(t,e)){if(!o(t))return!0;if(!n)return!1;i(t)}return t[e].weakData},onFreeze:function(t){return bu&&u.REQUIRED&&o(t)&&!T(t,e)&&i(t),t}};dt[e]=!0})),xu=V.f,ku=se.forEach,Ou=ce.set,Su=ce.getterFor,Eu=function(t,n,e){var r,o=-1!==t.indexOf("Map"),i=-1!==t.indexOf("Weak"),u=o?"set":"add",a=p[t],c=a&&a.prototype,f={};if(m&&"function"==typeof a&&(i||c.forEach&&!h((function(){(new a).entries().next()})))){r=n((function(n,e){Ou(Ur(n,r,t),{type:t,collection:new a}),null!=e&&Lr(e,n[u],{that:n,AS_ENTRIES:o})}));var l=Su(t);ku(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(t){var n="add"==t||"set"==t;!(t in c)||i&&"clear"==t||Q(r.prototype,t,(function(e,r){var o=l(this).collection;if(!n&&i&&!E(e))return"get"==t&&void 0;var u=o[t](0===e?0:e,r);return n?this:u}))})),i||xu(r.prototype,"size",{configurable:!0,get:function(){return l(this).collection.size}})}else r=e.getConstructor(n,t,o,u),wu.REQUIRED=!0;return Jn(r,t,!1,!0),f[t]=r,Z({global:!0,forced:!0},f),i||e.setStrong(r,t,o),r},Au=V.f,ju=wu.fastKey,Tu=ce.set,Pu=ce.getterFor,Ru={getConstructor:function(t,n,e,r){var o=t((function(t,i){Ur(t,o,n),Tu(t,{type:n,index:Rt(null),first:void 0,last:void 0,size:0}),m||(t.size=0),null!=i&&Lr(i,t[r],{that:t,AS_ENTRIES:e})})),i=Pu(n),u=function(t,n,e){var r,o,u=i(t),c=a(t,n);return c?c.value=e:(u.last=c={index:o=ju(n,!0),key:n,value:e,previous:r=u.last,next:void 0,removed:!1},u.first||(u.first=c),r&&(r.next=c),m?u.size++:t.size++,"F"!==o&&(u.index[o]=c)),t},a=function(t,n){var e,r=i(t),o=ju(n);if("F"!==o)return r.index[o];for(e=r.first;e;e=e.next)if(e.key==n)return e};return Yr(o.prototype,{clear:function(){for(var t=i(this),n=t.index,e=t.first;e;)e.removed=!0,e.previous&&(e.previous=e.previous.next=void 0),delete n[e.index],e=e.next;t.first=t.last=void 0,m?t.size=0:this.size=0},delete:function(t){var n=this,e=i(n),r=a(n,t);if(r){var o=r.next,u=r.previous;delete e.index[r.index],r.removed=!0,u&&(u.next=o),o&&(o.previous=u),e.first==r&&(e.first=o),e.last==r&&(e.last=u),m?e.size--:n.size--}return!!r},forEach:function(t){for(var n,e=i(this),r=G(t,arguments.length>1?arguments[1]:void 0,3);n=n?n.next:e.first;)for(r(n.value,n.key,this);n&&n.removed;)n=n.previous},has:function(t){return!!a(this,t)}}),Yr(o.prototype,e?{get:function(t){var n=a(this,t);return n&&n.value},set:function(t,n){return u(this,0===t?0:t,n)}}:{add:function(t){return u(this,t=0===t?0:t,t)}}),m&&Au(o.prototype,"size",{get:function(){return i(this).size}}),o},setStrong:function(t,n,e){var r=n+" Iterator",o=Pu(n),i=Pu(r);vr(t,n,(function(t,n){Tu(this,{type:r,target:t,state:o(t),kind:n,last:void 0})}),(function(){for(var t=i(this),n=t.kind,e=t.last;e&&e.removed;)e=e.previous;return t.target&&(t.last=e=e?e.next:t.state.first)?"keys"==n?{value:e.key,done:!1}:"values"==n?{value:e.value,done:!1}:{value:[e.key,e.value],done:!1}:(t.target=void 0,{value:void 0,done:!0})}),e?"entries":"values",!e,!0),Hr(n)}};Eu("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),Ru);var Bu=H.Map;Z({target:"Map",stat:!0},{from:function(t){var n,e,r,o,i=arguments.length,u=i>1?arguments[1]:void 0;return U(this),(n=void 0!==u)&&U(u),null==t?new this:(e=[],n?(r=0,o=G(u,i>2?arguments[2]:void 0,2),Lr(t,(function(t){e.push(o(t,r++))}))):Lr(t,e.push,{that:e}),new this(e))}});Z({target:"Map",stat:!0},{of:function(){for(var t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return new this(n)}});var Du=function(){for(var t,n=W(this),e=U(n.delete),r=!0,o=0,i=arguments.length;o<i;o++)t=e.call(n,arguments[o]),r=r&&t;return!!r};Z({target:"Map",proto:!0,real:!0,forced:_t},{deleteAll:function(){return Du.apply(this,arguments)}});Z({target:"Map",proto:!0,real:!0,forced:_t},{emplace:function(t,n){var e=W(this),r=e.has(t)&&"update"in n?n.update(e.get(t),t,e):n.insert(t,e);return e.set(t,r),r}});var Mu=Oi;Z({target:"Map",proto:!0,real:!0,forced:_t},{every:function(t){var n=W(this),e=Mu(n),r=G(t,arguments.length>1?arguments[1]:void 0,3);return!Lr(e,(function(t,e,o){if(!r(e,t,n))return o()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{filter:function(t){var n=W(this),e=Mu(n),r=G(t,arguments.length>1?arguments[1]:void 0,3),o=new(no(n,nt("Map"))),i=U(o.set);return Lr(e,(function(t,e){r(e,t,n)&&i.call(o,t,e)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),o}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{find:function(t){var n=W(this),e=Mu(n),r=G(t,arguments.length>1?arguments[1]:void 0,3);return Lr(e,(function(t,e,o){if(r(e,t,n))return o(e)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{findKey:function(t){var n=W(this),e=Mu(n),r=G(t,arguments.length>1?arguments[1]:void 0,3);return Lr(e,(function(t,e,o){if(r(e,t,n))return o(t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),Z({target:"Map",stat:!0},{groupBy:function(t,n){var e=new this;U(n);var r=U(e.has),o=U(e.get),i=U(e.set);return Lr(t,(function(t){var u=n(t);r.call(e,u)?o.call(e,u).push(t):i.call(e,u,[t])})),e}});Z({target:"Map",proto:!0,real:!0,forced:_t},{includes:function(t){return Lr(Mu(W(this)),(function(n,e,r){if((o=e)===(i=t)||o!=o&&i!=i)return r();var o,i}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),Z({target:"Map",stat:!0},{keyBy:function(t,n){var e=new this;U(n);var r=U(e.set);return Lr(t,(function(t){r.call(e,n(t),t)})),e}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{keyOf:function(t){return Lr(Mu(W(this)),(function(n,e,r){if(e===t)return r(n)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{mapKeys:function(t){var n=W(this),e=Mu(n),r=G(t,arguments.length>1?arguments[1]:void 0,3),o=new(no(n,nt("Map"))),i=U(o.set);return Lr(e,(function(t,e){i.call(o,r(e,t,n),e)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),o}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{mapValues:function(t){var n=W(this),e=Mu(n),r=G(t,arguments.length>1?arguments[1]:void 0,3),o=new(no(n,nt("Map"))),i=U(o.set);return Lr(e,(function(t,e){i.call(o,t,r(e,t,n))}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),o}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{merge:function(t){for(var n=W(this),e=U(n.set),r=0;r<arguments.length;)Lr(arguments[r++],e,{that:n,AS_ENTRIES:!0});return n}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{reduce:function(t){var n=W(this),e=Mu(n),r=arguments.length<2,o=r?void 0:arguments[1];if(U(t),Lr(e,(function(e,i){r?(r=!1,o=i):o=t(o,i,e,n)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),r)throw TypeError("Reduce of empty map with no initial value");return o}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{some:function(t){var n=W(this),e=Mu(n),r=G(t,arguments.length>1?arguments[1]:void 0,3);return Lr(e,(function(t,e,o){if(r(e,t,n))return o()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),Z({target:"Map",proto:!0,real:!0,forced:_t},{update:function(t,n){var e=W(this),r=arguments.length;U(n);var o=e.has(t);if(!o&&r<3)throw TypeError("Updating absent value");var i=o?e.get(t):U(r>2?arguments[2]:void 0)(t,e);return e.set(t,n(i,t,e)),e}});var Iu=function(t,n){var e,r=W(this),o=arguments.length>2?arguments[2]:void 0;if("function"!=typeof n&&"function"!=typeof o)throw TypeError("At least one callback required");return r.has(t)?(e=r.get(t),"function"==typeof n&&(e=n(e),r.set(t,e))):"function"==typeof o&&(e=o(),r.set(t,e)),e};Z({target:"Map",proto:!0,real:!0,forced:_t},{upsert:Iu}),Z({target:"Map",proto:!0,real:!0,forced:_t},{updateOrInsert:Iu});var Cu=st.indexOf,Nu=[].indexOf,Lu=!!Nu&&1/[1].indexOf(1,-0)<0,Fu=Xi("indexOf"),zu=Ti("indexOf",{ACCESSORS:!0,1:0});Z({target:"Array",proto:!0,forced:Lu||!Fu||!zu},{indexOf:function(t){return Lu?Nu.apply(this,arguments)||0:Cu(this,t,arguments.length>1?arguments[1]:void 0)}});var Yu=Ii("Array").indexOf,qu=Array.prototype,Hu=function(t){var n=t.indexOf;return t===qu||t instanceof Array&&n===qu.indexOf?Yu:n},Uu=Hu;function Gu(t){return function(t){if(wi(t))return Ui(t)}(t)||function(t){if(void 0!==Ge&&ki(Object(t)))return Hi(t)}(t)||Gi(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}Z({target:"Function",proto:!0},{bind:It}),Ii("Function").bind;var Wu=h((function(){mt(1)}));Z({target:"Object",stat:!0,forced:Wu},{keys:function(t){return mt(un(t))}});var Ju=H.Object.keys,Vu=Ju;Eu("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),Ru);var Qu=H.Set,Ku=Ii("Array").concat,Xu=Array.prototype,Zu=function(t){var n=t.concat;return t===Xu||t instanceof Array&&n===Xu.concat?Ku:n};Z({target:"Date",stat:!0},{now:function(){return(new Date).getTime()}});var ta=H.Date.now,na=Hu,ea=nt("Reflect","ownKeys")||function(t){var n=Tn.f(W(t)),e=Mn.f;return e?n.concat(e(t)):n};Z({target:"Object",stat:!0,sham:!m},{getOwnPropertyDescriptors:function(t){for(var n,e,r=S(t),o=I.f,i=ea(r),u={},a=0;i.length>a;)void 0!==(e=o(r,n=i[a++]))&&an(u,n,e);return u}});var ra=H.Object.getOwnPropertyDescriptors,oa=qi,ia=wn("splice"),ua=Ti("splice",{ACCESSORS:!0,0:0,1:2}),aa=Math.max,ca=Math.min,fa=9007199254740991,la="Maximum allowed length exceeded";Z({target:"Array",proto:!0,forced:!ia||!ua},{splice:function(t,n){var e,r,o,i,u,a,c=un(this),f=ut(c.length),l=ft(t,f),s=arguments.length;if(0===s?e=r=0:1===s?(e=0,r=f-l):(e=s-2,r=ca(aa(ot(n),0),f-l)),f+e-r>fa)throw TypeError(la);for(o=hn(c,r),i=0;i<r;i++)(u=l+i)in c&&an(o,i,c[u]);if(o.length=r,e<r){for(i=l;i<f-r;i++)a=i+e,(u=i+r)in c?c[a]=c[u]:delete c[a];for(i=f;i>f-r+e;i--)delete c[i-1]}else if(e>r)for(i=f-r;i>l;i--)a=i+e-1,(u=i+r-1)in c?c[a]=c[u]:delete c[a];for(i=0;i<e;i++)c[i+l]=arguments[i+2];return c.length=f-r+e,o}});var sa=Ii("Array").splice,da=Array.prototype,va=function(t){var n=t.splice;return t===da||t instanceof Array&&n===da.splice?sa:n},pa=se.map,ha=wn("map"),ma=Ti("map");Z({target:"Array",proto:!0,forced:!ha||!ma},{map:function(t){return pa(this,t,arguments.length>1?arguments[1]:void 0)}});var ya=Ii("Array").map,ga=Array.prototype,_a=function(t){var n=t.map;return t===ga||t instanceof Array&&n===ga.map?ya:n},$a=se.filter,ba=wn("filter"),wa=Ti("filter");Z({target:"Array",proto:!0,forced:!ba||!wa},{filter:function(t){return $a(this,t,arguments.length>1?arguments[1]:void 0)}});var xa=Ii("Array").filter,ka=Array.prototype,Oa=function(t){var n=t.filter;return t===ka||t instanceof Array&&n===ka.filter?xa:n},Sa=Bu,Ea=Object.assign,Aa=Object.defineProperty,ja=!Ea||h((function(){if(m&&1!==Ea({b:1},Ea(Aa({},"a",{enumerable:!0,get:function(){Aa(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},n={},e=Symbol(),r="abcdefghijklmnopqrst";return t[e]=7,r.split("").forEach((function(t){n[t]=t})),7!=Ea({},t)[e]||mt(Ea({},n)).join("")!=r}))?function(t,n){for(var e=un(t),r=arguments.length,o=1,i=Mn.f,u=_.f;r>o;)for(var a,c=k(arguments[o++]),f=i?mt(c).concat(i(c)):mt(c),l=f.length,s=0;l>s;)a=f[s++],m&&!u.call(c,a)||(e[a]=c[a]);return e}:Ea;Z({target:"Object",stat:!0,forced:Object.assign!==ja},{assign:ja}),H.Object.assign;var Ta=nt("JSON","stringify"),Pa=/[\uD800-\uDFFF]/g,Ra=/^[\uD800-\uDBFF]$/,Ba=/^[\uDC00-\uDFFF]$/,Da=function(t,n,e){var r=e.charAt(n-1),o=e.charAt(n+1);return Ra.test(t)&&!Ba.test(o)||Ba.test(t)&&!Ra.test(r)?"\\u"+t.charCodeAt(0).toString(16):t},Ma=h((function(){return'"\\udf06\\ud834"'!==Ta("\udf06\ud834")||'"\\udead"'!==Ta("\udead")}));Ta&&Z({target:"JSON",stat:!0,forced:Ma},{stringify:function(t,n,e){var r=Ta.apply(null,arguments);return"string"==typeof r?r.replace(Pa,Da):r}}),H.JSON||(H.JSON={stringify:JSON.stringify});var Ia=function(t,n,e){return H.JSON.stringify.apply(null,arguments)};Z({target:"Array",proto:!0},{fill:function(t){for(var n=un(this),e=ut(n.length),r=arguments.length,o=ft(r>1?arguments[1]:void 0,e),i=r>2?arguments[2]:void 0,u=void 0===i?e:ft(i,e);u>o;)n[o++]=t;return n}});var Ca=Ii("Array").fill,Na=Array.prototype,La=function(t){var n=t.fill;return t===Na||t instanceof Array&&n===Na.fill?Ca:n};function Fa(){}var za=function(t){return t};function Ya(t,n){for(var e in n)t[e]=n[e];return t}function qa(t){return t()}function Ha(){return Qi(null)}function Ua(t){uu(t).call(t,qa)}function Ga(t){return"function"==typeof t}function Wa(t,n){return t!=t?n==n:t!==n||t&&"object"===Sr(t)||"function"==typeof t}function Ja(t){if(null==t)return Fa;for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];var o=t.subscribe.apply(t,e);return o.unsubscribe?function(){return o.unsubscribe()}:o}function Va(t,n,e){t.$$.on_destroy.push(Ja(n,e))}function Qa(t,n,e,r){if(t){var o=Ka(t,n,e,r);return t[0](o)}}function Ka(t,n,e,r){var o;return t[1]&&r?Ya(pu(o=e.ctx).call(o),t[1](r(n))):e.ctx}function Xa(t,n,e,r,o,i,u){var a=function(t,n,e,r){if(t[2]&&r){var o=t[2](r(e));if(void 0===n.dirty)return o;if("object"===Sr(o)){for(var i=[],u=Math.max(n.dirty.length,o.length),a=0;a<u;a+=1)i[a]=n.dirty[a]|o[a];return i}return n.dirty|o}return n.dirty}(n,r,o,i);if(a){var c=Ka(n,e,r,u);t.p(c,a)}}function Za(t,n){var e={};for(var r in n=new Qu(n),t)n.has(r)||"$"===r[0]||(e[r]=t[r]);return e}function tc(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n;return t.set(e),n}function nc(t){return t&&Ga(t.destroy)?t.destroy:Fa}var ec="undefined"!=typeof window,rc=ec?function(){return window.performance.now()}:function(){return ta()},oc=ec?function(t){return requestAnimationFrame(t)}:Fa,ic=new Qu;function uc(t){uu(ic).call(ic,(function(n){n.c(t)||(ic.delete(n),n.f())})),0!==ic.size&&oc(uc)}function ac(t,n){t.appendChild(n)}function cc(t,n,e){t.insertBefore(n,e||null)}function fc(t){t.parentNode.removeChild(t)}function lc(t,n){for(var e=0;e<t.length;e+=1)t[e]&&t[e].d(n)}function sc(t){return document.createElement(t)}function dc(t){return document.createTextNode(t)}function vc(){return dc(" ")}function pc(){return dc("")}function hc(t,n,e,r){return t.addEventListener(n,e,r),function(){return t.removeEventListener(n,e,r)}}function mc(t){return function(n){return n.preventDefault(),t.call(this,n)}}function yc(t,n,e){null==e?t.removeAttribute(n):t.getAttribute(n)!==e&&t.setAttribute(n,e)}function gc(t,n){var e=ra(t.__proto__);for(var r in n)null==n[r]?t.removeAttribute(r):"style"===r?t.style.cssText=n[r]:"__value"===r?t.value=t[r]=n[r]:e[r]&&e[r].set?t[r]=n[r]:yc(t,r,n[r])}function _c(t,n,e){for(var r=new Qu,o=0;o<t.length;o+=1)t[o].checked&&r.add(t[o].__value);return e||r.delete(n),oa(r)}function $c(t){return""===t?null:+t}function bc(t){return oa(t.childNodes)}function wc(t,n){n=""+n,t.wholeText!==n&&(t.data=n)}function xc(t,n){t.value=null==n?"":n}function kc(t,n,e,r){t.style.setProperty(n,e,r?"important":"")}function Oc(t,n){for(var e=0;e<t.options.length;e+=1){var r=t.options[e];if(r.__value===n)return void(r.selected=!0)}}function Sc(t){var n=t.querySelector(":checked")||t.options[0];return n&&n.__value}function Ec(t,n,e){t.classList[e?"add":"remove"](n)}function Ac(t,n){var e=document.createEvent("CustomEvent");return e.initCustomEvent(t,!1,!1,n),e}var jc,Tc=new Qu,Pc=0;function Rc(t){for(var n=5381,e=t.length;e--;)n=(n<<5)-n^t.charCodeAt(e);return n>>>0}function Bc(t,n){var e=(t.style.animation||"").split(", "),r=Oa(e).call(e,n?function(t){return na(t).call(t,n)<0}:function(t){return-1===na(t).call(t,"__svelte")}),o=e.length-r.length;o&&(t.style.animation=r.join(", "),(Pc-=o)||oc((function(){Pc||(uu(Tc).call(Tc,(function(t){for(var n=t.__svelte_stylesheet,e=n.cssRules.length;e--;)n.deleteRule(e);t.__svelte_rules={}})),Tc.clear())})))}function Dc(t){jc=t}function Mc(){if(!jc)throw new Error("Function called outside component initialization");return jc}function Ic(t){Mc().$$.on_mount.push(t)}var Cc=[],Nc=[],Lc=[],Fc=[],zc=cu.resolve(),Yc=!1;function qc(){Yc||(Yc=!0,zc.then(Qc))}function Hc(){return qc(),zc}function Uc(t){Lc.push(t)}function Gc(t){Fc.push(t)}var Wc,Jc=!1,Vc=new Qu;function Qc(){if(!Jc){Jc=!0;do{for(var t=0;t<Cc.length;t+=1){var n=Cc[t];Dc(n),Kc(n.$$)}for(Dc(null),Cc.length=0;Nc.length;)Nc.pop()();for(var e=0;e<Lc.length;e+=1){var r=Lc[e];Vc.has(r)||(Vc.add(r),r())}Lc.length=0}while(Cc.length);for(;Fc.length;)Fc.pop()();Yc=!1,Jc=!1,Vc.clear()}}function Kc(t){if(null!==t.fragment){var n;t.update(),Ua(t.before_update);var e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),uu(n=t.after_update).call(n,Uc)}}function Xc(t,n,e){var r;t.dispatchEvent(Ac(Zu(r="".concat(n?"intro":"outro")).call(r,e)))}var Zc,tf=new Qu;function nf(){Zc={r:0,c:[],p:Zc}}function ef(){Zc.r||Ua(Zc.c),Zc=Zc.p}function rf(t,n){t&&t.i&&(tf.delete(t),t.i(n))}function of(t,n,e,r){if(t&&t.o){if(tf.has(t))return;tf.add(t),Zc.c.push((function(){tf.delete(t),r&&(e&&t.d(1),r())})),t.o(n)}}var uf={duration:0};function af(t,n,e){var r,o,i=n(t,e),u=!1,a=0;function c(){r&&Bc(t,r)}function f(){var n=i||uf,e=n.delay,f=void 0===e?0:e,l=n.duration,s=void 0===l?300:l,d=n.easing,v=void 0===d?za:d,p=n.tick,h=void 0===p?Fa:p,m=n.css;m&&(r=function(t,n,e,r,o,i,u){for(var a,c,f,l,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,d=16.666/r,v="{\n",p=0;p<=1;p+=d){var h=n+(e-n)*i(p);v+=100*p+"%{".concat(u(h,1-h),"}\n")}var m=v+"100% {".concat(u(e,1-e),"}\n}"),y=Zu(a="__svelte_".concat(Rc(m),"_")).call(a,s),g=t.ownerDocument;Tc.add(g);var _,$=g.__svelte_stylesheet||(g.__svelte_stylesheet=g.head.appendChild(sc("style")).sheet),b=g.__svelte_rules||(g.__svelte_rules={});b[y]||(b[y]=!0,$.insertRule(Zu(_="@keyframes ".concat(y," ")).call(_,m),$.cssRules.length));var w=t.style.animation||"";return t.style.animation=Zu(c=Zu(f=Zu(l="".concat(w?"".concat(w,", "):"")).call(l,y," ")).call(f,r,"ms linear ")).call(c,o,"ms 1 both"),Pc+=1,y}(t,0,1,s,f,v,m,a++)),h(0,1);var y=rc()+f,g=y+s;o&&o.abort(),u=!0,Uc((function(){return Xc(t,!0,"start")})),o=function(t){var n;return 0===ic.size&&oc(uc),{promise:new cu((function(e){ic.add(n={c:t,f:e})})),abort:function(){ic.delete(n)}}}((function(n){if(u){if(n>=g)return h(1,0),Xc(t,!0,"end"),c(),u=!1;if(n>=y){var e=v((n-y)/s);h(e,1-e)}}return u}))}var l=!1;return{start:function(){l||(Bc(t),Ga(i)?(i=i(),(Wc||(Wc=cu.resolve()).then((function(){Wc=null})),Wc).then(f)):f())},invalidate:function(){l=!1},end:function(){u&&(c(),u=!1)}}}function cf(t,n,e){var r=t.$$.props[n];void 0!==r&&(t.$$.bound[r]=e,e(t.$$.ctx[r]))}function ff(t){t&&t.c()}function lf(t,n,e,r){var o=t.$$,i=o.fragment,u=o.on_mount,a=o.on_destroy,c=o.after_update;i&&i.m(n,e),r||Uc((function(){var n,e=Oa(n=_a(u).call(u,qa)).call(n,Ga);a?a.push.apply(a,Gu(e)):Ua(e),t.$$.on_mount=[]})),uu(c).call(c,Uc)}function sf(t,n){var e=t.$$;null!==e.fragment&&(Ua(e.on_destroy),e.fragment&&e.fragment.d(n),e.on_destroy=e.fragment=null,e.ctx=[])}function df(t,n){var e;-1===t.$$.dirty[0]&&(Cc.push(t),qc(),La(e=t.$$.dirty).call(e,0));t.$$.dirty[n/31|0]|=1<<n%31}function vf(t,n,e,r,o,i){var u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:[-1],a=jc;Dc(t);var c=t.$$={fragment:null,ctx:null,props:i,update:Fa,not_equal:o,bound:Ha(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Sa(a?a.$$.context:[]),callbacks:Ha(),dirty:u,skip_bound:!1},f=!1;if(c.ctx=e?e(t,n.props||{},(function(n,e){var r=!(arguments.length<=2)&&arguments.length-2?arguments.length<=2?void 0:arguments[2]:e;return c.ctx&&o(c.ctx[n],c.ctx[n]=r)&&(!c.skip_bound&&c.bound[n]&&c.bound[n](r),f&&df(t,n)),e})):[],c.update(),f=!0,Ua(c.before_update),c.fragment=!!r&&r(c.ctx),n.target){if(n.hydrate){var l=bc(n.target);c.fragment&&c.fragment.l(l),uu(l).call(l,fc)}else c.fragment&&c.fragment.c();n.intro&&rf(t.$$.fragment),lf(t,n.target,n.anchor,n.customElement),Qc()}Dc(a)}new Qu(["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]);var pf=function(){function t(){Yt(this,t)}return Gt(t,[{key:"$destroy",value:function(){sf(this,1),this.$destroy=Fa}},{key:"$on",value:function(t,n){var e=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return e.push(n),function(){var t=na(e).call(e,n);-1!==t&&va(e).call(e,t,1)}}},{key:"$set",value:function(t){this.$$set&&0!==Vu(t).length&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}]),t}(),hf=H.Object.getOwnPropertySymbols,mf=hf,yf=$u;Z({target:"Object",stat:!0,forced:!m,sham:!m},{defineProperties:yt});var gf=s((function(t){var n=H.Object,e=t.exports=function(t,e){return n.defineProperties(t,e)};n.defineProperties.sham&&(e.sham=!0)}));function _f(t,n,e){return n in t?Ht(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}var $f=[];function bf(t){var n,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fa,r=[];function o(e){if(Wa(t,e)&&(t=e,n)){for(var o=!$f.length,i=0;i<r.length;i+=1){var u=r[i];u[1](),$f.push(u,t)}if(o){for(var a=0;a<$f.length;a+=2)$f[a][0]($f[a+1]);$f.length=0}}}function i(n){o(n(t))}function u(i){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fa,a=[i,u];return r.push(a),1===r.length&&(n=e(o)||Fa),i(t),function(){var t=na(r).call(r,a);-1!==t&&va(r).call(r,t,1),0===r.length&&(n(),n=null)}}return{set:o,update:i,subscribe:u}}function wf(t,n,e){var r=!yu(t),o=r?[t]:t,i=n.length<2;return{subscribe:bf(e,(function(t){var e=!1,u=[],a=0,c=Fa,f=function(){if(!a){c();var e=n(r?u[0]:u,t);i?t(e):c=Ga(e)?e:Fa}},l=_a(o).call(o,(function(t,n){return Ja(t,(function(t){u[n]=t,a&=~(1<<n),e&&f()}),(function(){a|=1<<n}))}));return e=!0,f(),function(){Ua(l),c()}})).subscribe}}function xf(t,n){var e=Vu(t);if(mf){var r=mf(t);n&&(r=Oa(r).call(r,(function(n){return yf(t,n).enumerable}))),e.push.apply(e,r)}return e}function kf(t){for(var n=1;n<arguments.length;n++){var e,r=null!=arguments[n]?arguments[n]:{};if(n%2)uu(e=xf(Object(r),!0)).call(e,(function(n){_f(t,n,r[n])}));else if(ra)gf(t,ra(r));else{var o;uu(o=xf(Object(r))).call(o,(function(n){Vi(t,n,yf(r,n))}))}}return t}function Of(t,n,e){var r=e,o=!1,i=n.length<2,u=wf(t,(function(t,e){return o=!0,i?(r=n(t,e),e(r)):n(t,(function(t){r=t,e(t)})),function(){o=!1}}),e);return kf(kf({},u),{},{get:function(){return o?r:function(t){var n;return Ja(t,(function(t){return n=t}))(),n}(u)}})}var Sf=hf,Ef=Ju;function Af(t,n){if(null==t)return{};var e,r,o=function(t,n){if(null==t)return{};var e,r,o={},i=Ef(t);for(r=0;r<i.length;r++)e=i[r],Uu(n).call(n,e)>=0||(o[e]=t[e]);return o}(t,n);if(Sf){var i=Sf(t);for(r=0;r<i.length;r++)e=i[r],Uu(n).call(n,e)>=0||Object.prototype.propertyIsEnumerable.call(t,e)&&(o[e]=t[e])}return o}function jf(t,n){var e=Vu(t);if(mf){var r=mf(t);n&&(r=Oa(r).call(r,(function(n){return yf(t,n).enumerable}))),e.push.apply(e,r)}return e}function Tf(t,n){var e=t,r=bf(t,n),o=r.set;return function(t){for(var n=1;n<arguments.length;n++){var e,r=null!=arguments[n]?arguments[n]:{};if(n%2)uu(e=jf(Object(r),!0)).call(e,(function(n){_f(t,n,r[n])}));else if(ra)gf(t,ra(r));else{var o;uu(o=jf(Object(r))).call(o,(function(n){Vi(t,n,yf(r,n))}))}}return t}({set:function(t){e=t,o(t)},get:function(){return e}},Af(r,["set"]))}var Pf=Tf({staff:[],start_time:[],end_time:[],time_interval:900,customers:[],customers_loaded:void 0,week_days:[],customer_gr_def_app_status:[]}),Rf=[].slice,Bf=/MSIE .\./.test(mn),Df=function(t){return function(n,e){var r=arguments.length>2,o=r?Rf.call(arguments,2):void 0;return t(r?function(){("function"==typeof n?n:Function(n)).apply(this,o)}:n,e)}};Z({global:!0,bind:!0,forced:Bf},{setTimeout:Df(p.setTimeout),setInterval:Df(p.setInterval)});var Mf=H.setTimeout,If=se.every,Cf=Xi("every"),Nf=Ti("every");Z({target:"Array",proto:!0,forced:!Cf||!Nf},{every:function(t){return If(this,t,arguments.length>1?arguments[1]:void 0)}});var Lf=Ii("Array").every,Ff=Array.prototype,zf=function(t){var n=t.every;return t===Ff||t instanceof Array&&n===Ff.every?Lf:n},Yf="\t\n\v\f\r                 \u2028\u2029\ufeff",qf="["+Yf+"]",Hf=RegExp("^"+qf+qf+"*"),Uf=RegExp(qf+qf+"*$"),Gf=function(t){return function(n){var e=String(O(n));return 1&t&&(e=e.replace(Hf,"")),2&t&&(e=e.replace(Uf,"")),e}},Wf={start:Gf(1),end:Gf(2),trim:Gf(3)},Jf=Wf.trim,Vf=p.parseInt,Qf=/^[+-]?0[Xx]/,Kf=8!==Vf(Yf+"08")||22!==Vf(Yf+"0x16")?function(t,n){var e=Jf(String(t));return Vf(e,n>>>0||(Qf.test(e)?16:10))}:Vf;Z({global:!0,forced:parseInt!=Kf},{parseInt:Kf});var Xf=H.parseInt,Zf=[],tl=Zf.sort,nl=h((function(){Zf.sort(void 0)})),el=h((function(){Zf.sort(null)})),rl=Xi("sort");Z({target:"Array",proto:!0,forced:nl||!el||!rl},{sort:function(t){return void 0===t?tl.call(un(this)):tl.call(un(this),U(t))}});var ol=Ii("Array").sort,il=Array.prototype,ul=function(t){var n=t.sort;return t===il||t instanceof Array&&n===il.sort?ol:n},al=se.find,cl="find",fl=!0,ll=Ti(cl);cl in[]&&Array(1).find((function(){fl=!1})),Z({target:"Array",proto:!0,forced:fl||!ll},{find:function(t){return al(this,t,arguments.length>1?arguments[1]:void 0)}});var sl=Ii("Array").find,dl=Array.prototype,vl=function(t){var n=t.find;return t===dl||t instanceof Array&&n===dl.find?sl:n},pl=st.includes,hl=Ti("indexOf",{ACCESSORS:!0,1:0});Z({target:"Array",proto:!0,forced:!hl},{includes:function(t){return pl(this,t,arguments.length>1?arguments[1]:void 0)}});var ml=Ii("Array").includes,yl=vn("match"),gl=function(t){if(function(t){var n;return E(t)&&(void 0!==(n=t[yl])?!!n:"RegExp"==w(t))}(t))throw TypeError("The method doesn't accept regular expressions");return t},_l=vn("match");Z({target:"String",proto:!0,forced:!function(t){var n=/./;try{"/./"[t](n)}catch(e){try{return n[_l]=!1,"/./"[t](n)}catch(t){}}return!1}("includes")},{includes:function(t){return!!~String(O(this)).indexOf(gl(t),arguments.length>1?arguments[1]:void 0)}});var $l=Ii("String").includes,bl=Array.prototype,wl=String.prototype,xl=function(t){var n=t.includes;return t===bl||t instanceof Array&&n===bl.includes?ml:"string"==typeof t||t===wl||t instanceof String&&n===wl.includes?$l:n};function kl(t,n){return vl(n).call(n,(function(n){return n.id===t}))||null}function Ol(t){for(var n,e=arguments.length,r=new Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return jl.apply(void 0,Zu(n=[{},t]).call(n,r))}function Sl(t){for(var n,e=arguments.length,r=new Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];return jl.apply(void 0,Zu(n=[!0,{},t]).call(n,r))}function El(t){var n;return xl(n=BooklyL10nGlobal.addons).call(n,t)}var Al=BooklyL10nGlobal.csrf_token,jl=function t(){var n={},e=!1,r=0,o=arguments.length;"[object Boolean]"===Object.prototype.toString.call(arguments[0])&&(e=arguments[0],r++);for(var i=function(r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e&&"[object Object]"===Object.prototype.toString.call(r[o])?n[o]=t(!0,n[o],r[o]):n[o]=r[o])};r<o;r++){var u=arguments[r];i(u)}return n};function Tl(t,n){var e;if(void 0===Ji||null==mu(t)){if(yu(t)||(e=function(t,n){var e;if(!t)return;if("string"==typeof t)return Pl(t,n);var r=pu(e=Object.prototype.toString.call(t)).call(e,8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return oa(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Pl(t,n)}(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){e=Si(t)},n:function(){var t=e.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==e.return||e.return()}finally{if(a)throw i}}}}function Pl(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}var Rl=c.default;function Bl(t,n){var e,r={items:[],groups:[]},o=Tl(t);try{var i=function(){var t=e.value;if(t[n]){var o,i=vl(o=r.groups).call(o,(function(e){return e.label===t[n]}));i||(i={label:t[n],items:[]},r.groups.push(i)),i.items.push(t)}else r.items.push(t)};for(o.s();!(e=o.n()).done;)i()}catch(t){o.e(t)}finally{o.f()}return r}function Dl(t,n){var e=Vu(t);if(mf){var r=mf(t);n&&(r=Oa(r).call(r,(function(n){return yf(t,n).enumerable}))),e.push.apply(e,r)}return e}function Ml(t){for(var n=1;n<arguments.length;n++){var e,r=null!=arguments[n]?arguments[n]:{};if(n%2)uu(e=Dl(Object(r),!0)).call(e,(function(n){_f(t,n,r[n])}));else if(ra)gf(t,ra(r));else{var o;uu(o=Dl(Object(r))).call(o,(function(n){Vi(t,n,yf(r,n))}))}}return t}function Il(t,n){var e=Sl({value:t}),r=Tf(t,n);return Ml(Ml({},r),{},{reset:function(){return r.set(Sl(e).value)}})}var Cl=Il(null),Nl=Il(null),Ll=Il(""),Fl=Il(0),zl=Il({url:null,copied:!1}),Yl=Il(null),ql=Il(!1),Hl=Il(null),Ul=Il(null),Gl=Il(null),Wl=Il(null),Jl=Il(null),Vl=Il(!1),Ql=Il(!1),Kl=Il(!1),Xl=Il(null),Zl=Il({until:null,type:"daily",monthly:{on:"day",day:null,weekday:null},daily:{every:1},weekly:{on:[]}}),ts=Il([]),ns=Il(""),es=Tf(null),rs=Il({customers_appointments_limit:!1,date_interval_not_available:!1,date_interval_warning:!1,interval_not_in_service_schedule:!1,interval_not_in_staff_schedule:!1,overflow_capacity:!1,service_required:!1,provider_required:!1,staff_reaches_working_time_limit:!1,custom_service_name_required:!1,no_timeslots_available:!1}),os=Il("main"),is=Tf(!1);function us(t,n){var e;if(void 0===Ji||null==mu(t)){if(yu(t)||(e=function(t,n){var e;if(!t)return;if("string"==typeof t)return as(t,n);var r=pu(e=Object.prototype.toString.call(t)).call(e,8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return oa(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return as(t,n)}(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){e=Si(t)},n:function(){var t=e.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==e.return||e.return()}finally{if(a)throw i}}}}function as(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}function cs(t){var n=Pf.get();t.custom_fields=[],t.extras=[],t.number_of_persons=Nl.get()?Math.max(Os.get().min-ls(ts.get()),1):1,t.notes=null,t.collaborative_token=null,t.collaborative_service=null,t.compound_token=null,t.compound_service=null,t.payment_action=null,t.payment_id=null,t.payment_type=null,t.payment_title=null,t.payment_price=null,t.payment_tax=null,t.payment_for=null,t.package_id=null,t.series_id=null,t.ca_id=null,t.status=n.customer_gr_def_app_status[t.group_id||0]}function fs(t){var n,e=0,r=us(t);try{for(r.s();!(n=r.n()).done;){e+=n.value.number_of_persons}}catch(t){r.e(t)}finally{r.f()}return e}function ls(t,n){var e,r=0,o=us(t);try{for(o.s();!(e=o.n()).done;){var i,u=e.value;n&&u.id===n.id||xl(i=Rl.freeStatuses).call(i,u.status)||(r+=u.number_of_persons)}}catch(t){o.e(t)}finally{o.f()}return r}function ss(t){var n,e=[];return uu(n=ts.get()).call(n,(function(n){var r={id:n.id,ca_id:n.ca_id,custom_fields:n.custom_fields,extras:n.extras,number_of_persons:n.number_of_persons,timezone:n.timezone,status:n.status};t||(r.series_id=n.series_id,r.notes=n.notes,r.payment_id=n.payment_id,r.payment_action=n.payment_action||"",r.payment_price=n.payment_price,r.payment_tax=n.payment_tax,r.payment_for=n.payment_for),e.push(r)})),Ia(e)}function ds(t){var n=t.full_name;return""===t.email&&""===t.phone||(n+=" (",""!==t.email&&(n+=t.email,""!==t.phone&&(n+=", ")),""!==t.phone&&(n+=t.phone),n+=")"),n}function vs(){var t=Nl.get(),n=t?t.duration*t.units_min:Pf.get().time_interval;(n<86400||t&&t.units_max>1)&&(Wl.set(moment(Ul.get(),"HH:mm").add(n,"seconds").format("HH:mm")),Es.get()&&Jl.set(js(Wl.get(),Es.get())))}function ps(){return ys("start")}function hs(){return ps().format("YYYY-MM-DD HH:mm:00")}function ms(){return ys("end").format("YYYY-MM-DD HH:mm:00")}function ys(t){if(Hl.get()){var n=Hl.get().clone(),e=Nl.get(),r=Ul.get(),o=Wl.get(),i=[0,0];if("end"===t)if(e&&e.duration>=86400){var u;if(o){var a=r.split(":"),c=o.split(":"),f=Math.max(e.duration,60*(60*c[0]+Xf(c[1])-60*a[0]-Xf(a[1])));u=Xf(f/86400)}else u=e&&e.units_max>1?Xf(e.duration*e.units_min/86400):Xf(e.duration/86400);n.add(u,"days")}else i=o.split(":");else e&&e.duration<86400&&(i=r.split(":"));return n.hours(i[0]),n.minutes(i[1]),n}}var gs=Il(null),_s=Il({id:null,startDate:null,startTime:null,endTime:null}),$s=Tf((function(){}));function bs(t,n){var e;if(void 0===Ji||null==mu(t)){if(yu(t)||(e=function(t,n){var e;if(!t)return;if("string"==typeof t)return ws(t,n);var r=pu(e=Object.prototype.toString.call(t)).call(e,8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return oa(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ws(t,n)}(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){e=Si(t)},n:function(){var t=e.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==e.return||e.return()}finally{if(a)throw i}}}}function ws(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}var xs=null,ks=null,Os=Of([Cl,Nl,Yl],(function(t){var n=Wi(t,3),e=n[0],r=n[1],o=n[2],i={min:1,max:1};if(e&&r)if(null===r.id)i.max=r.locations[0].capacity_max;else{var u=o?[o.id,0]:[0],a=kl(r.id,e.services);if(a){var c,f=bs(u);try{for(f.s();!(c=f.n()).done;){var l=c.value;if(l in a.locations){i.min=a.locations[l].capacity_min,i.max=a.locations[l].capacity_max;break}}}catch(t){f.e(t)}finally{f.f()}}}return i})),Ss=Of([Pf,_s,Nl,Cl,ts,Yl,Hl],(function(t,n){var e=Wi(t,7),r=e[0],o=e[1],i=e[2],a=e[3],c=e[4],f=e[5],l=e[6];if(!Rl.appropriate_slots||i&&null===i.id){var s,d;Vl.set(!1);var v=i&&i.hasOwnProperty("custom_time_slots")?pu(s=i.custom_time_slots.start_time).call(s):pu(d=r.start_time).call(d);o.startTime&&zf(v).call(v,(function(t){return t.value!==o.startTime.value}))&&(v.push(o.startTime),As(v)),n(v)}else if(i&&l&&a){null!==ks&&(clearTimeout(ks),ks=null);var p,h=[],m=bs(c);try{for(m.s();!(p=m.n()).done;){var y=p.value;h.push(y.extras)}}catch(t){m.e(t)}finally{m.f()}ks=Mf((function(){null!==xs&&(xs.abort(),xs=null),Vl.set(!0);var t={action:"bookly_get_day_schedule",csrf_token:Al,appointment_id:_s.get().id,staff_id:a.id,location_id:f?f.id:null,service_id:i.id,date:l.format("YYYY-MM-DD"),nop:Math.max(ls(c),Os.get().min),extras:h};xs=u.default.post(ajaxurl,t,(function(t){var e=rs.get();t.data.start&&t.data.start.length>0?(e.no_timeslots_available=!1,Vl.set(!1),i.custom_time_slots=[],i.custom_time_slots.end_time=t.data.end,n(t.data.start)):null!=o&&o.startTime&&null!=o&&o.startDate&&l.format("YYYY-MM-DD")===o.startDate.format("YYYY-MM-DD")?(e.no_timeslots_available=!1,n([o.startTime]),Vl.set(!1)):e.no_timeslots_available=!0,rs.set(e)}),"json")}),10)}else Vl.set(!0),n([])})),Es=Of([Pf,Ul,_s,Nl,Ss],(function(t){var n=Wi(t,5),e=n[0],r=n[1],o=n[2],i=n[3],u=n[4],c=[];if(r&&u)if(i&&i.units_max>1)for(var f=a.default(r,"HH:mm"),l=i.units_min;l<=i.units_max;++l){var s,d=f.clone().add(l*i.duration,"seconds"),v=Math.floor(d.diff(a.default("00:00","HH:mm"))/3600/1e3),p=bs(e.end_time);try{for(p.s();!(s=p.n()).done;){var h=s.value;h.value===(v<10?"0"+v:v)+":"+d.format("mm")&&(h.title=h.title_time+" ("+l+")",c.push(h))}}catch(t){p.e(t)}finally{p.f()}}else{var m,y=r.split(":"),g=24+Xf(y[0])+":"+y[1],_=bs(i&&i.hasOwnProperty("custom_time_slots")?i.custom_time_slots.end_time:e.end_time);try{for(_.s();!(m=_.n()).done;){var $=m.value;if($.value>g)break;$.value>r&&($.title=$.title_time,c.push($))}}catch(t){_.e(t)}finally{_.f()}o.endTime&&o.endTime.value>r&&zf(c).call(c,(function(t){return t.value!==o.endTime.value}))&&(c.push(o.endTime),As(c))}return c}));function As(t){ul(t).call(t,(function(t,n){return t.value<n.value?-1:t.value>n.value?1:0}))}function js(t,n){if(!n)return null;var e=vl(n).call(n,(function(n){return e=n.value,r=t,o=e.split(":"),i=r.split(":"),Xf(60*o[0]+o[1])>=Xf(60*i[0]+i[1]);var e,r,o,i}));return e||n[n.length-1]}Ss.subscribe((function(t){Ul.get()&&t.length&&(Gl.set(js(Ul.get(),t)),Ul.set(Gl.get().value))})),Es.subscribe((function(t){if(Wl.get()&&t.length){var n=Nl.get();n&&1===n.units_max&&Rl.appropriate_slots&&vs(),Jl.set(js(Wl.get(),t)),Wl.set(Jl.get().value)}}));var Ts=Il([]),Ps=Il([]),Rs=Il(null),Bs=Il([]),Ds=Il("current"),Ms=Il({all:[],changed_status:[]}),Is=Il("changed_status"),Cs=Il([]);function Ns(t){var n=moment(t),e=n.format("d"),r=n.format("M"),o=n.format("DD");return Rl.datePicker.dayNamesShort[e]+", "+Rl.datePicker.monthNamesShort[r-1]+" "+o}function Ls(t,n){for(var e=0;e<n.length;++e)if(t===n[e].value)return n[e].title}function Fs(){var t,n=Bs.get();return n.items&&zf(t=n.items).call(t,(function(t){return t.deleted}))}var zs=se.some,Ys=Xi("some"),qs=Ti("some");Z({target:"Array",proto:!0,forced:!Ys||!qs},{some:function(t){return zs(this,t,arguments.length>1?arguments[1]:void 0)}});var Hs=Ii("Array").some,Us=Array.prototype,Gs=function(t){var n=t.some;return t===Us||t instanceof Array&&n===Us.some?Hs:n},Ws=["sun","mon","tue","wed","thu","fri","sat"];function Js(t,n,e){var r,o=Vs(t);switch(n.type){case"daily":var i;if(t.diff(e,"days")%zf(n.daily)==0)if(zf(n.daily)>6||Gs(i=Pf.get().week_days).call(i,(function(t){return t===o})))return!0;break;case"weekly":case"biweekly":if(("weekly"===n.type||t.diff(e.clone().startOf("isoWeek"),"weeks")%2==0)&&Gs(r=n.weekly.on).call(r,(function(t){return t===o})))return!0;break;case"monthly":switch(n.monthly.on){case"day":if(t.date()===n.monthly.day)return!0;break;case"last":if(o===n.monthly.weekday&&t.clone().endOf("month").diff(t,"days")<7)return!0;break;default:var u=t.diff(t.clone().startOf("month"),"days"),a=["first","second","third","fourth"],c=na(a).call(a,n.monthly.on);if(o===n.monthly.weekday&&u>=7*c&&u<7*(c+1))return!0}}return!1}function Vs(t){return Ws[t.format("d")]}function Qs(){var t=Cl.get();1===t.locations.length&&Yl.set(t.locations[0])}var Ks=!1;function Xs(){return Ks?u.default.Deferred((function(t){return t.resolve()})):u.default.get(ajaxurl,{action:"bookly_get_data_for_appointment_form",csrf_token:Al}).done((function(t){if(Ks=!0,Rl.service_main){var n,e=[];uu(n=t.staff).call(n,(function(t){var n;uu(n=t.services).call(n,(function(t){void 0===vl(e).call(e,(function(n){return n.id===t.id}))&&e.push(t)}))})),t.services=e}Pf.set(t)}))}function Zs(){Cl.reset(),gs.reset(),Nl.reset(),Ll.reset(),Fl.reset(),zl.reset(),Yl.reset(),ql.reset(),Hl.reset(),Ul.reset(),Gl.reset(),Wl.reset(),Jl.reset(),ts.reset(),Ds.reset(),ns.reset(),_s.reset(),os.reset(),td(),Ql.reset(),Xl.reset(),Zl.reset(),Kl.reset(),Ms.reset(),Is.reset(),Cs.reset(),Ts.reset(),Ps.reset(),Rs.reset(),Bs.reset(),Ds.reset()}function td(){rs.reset()}var nd=null,ed=null;wf([Nl,Cl,Yl,ql,Ul,Wl,Hl,ts,Vl],(function(t,n){var e=Wi(t,9),r=e[0],o=e[1],i=e[2],a=e[3],c=e[4],f=e[5];e[6],e[7];var l=e[8];null!==ed&&(clearTimeout(ed),ed=null),ed=Mf((function(){if(null!==nd&&(nd.abort(),nd=null),o&&r&&c&&f&&!l){var t={action:"bookly_check_appointment_errors",csrf_token:Al,appointment_id:_s.get().id,customers:ss(!0),staff_id:o.id,location_id:i?i.id:null};r.id?t.service_id=r.id:t.service_id="",a||(t.start_date=hs(),t.end_date=ms()),nd=u.default.post(ajaxurl,t,n,"json")}else n(null)}),10)}),null).subscribe((function(t){null===t?td():rs.update((function(n){var e;return uu(e=Vu(t)).call(e,(function(e){return n[e]=t[e]})),n}))}));function rd(t){var n,e=[];uu(n=Bs.get()).call(n,(function(n){t.slots===n.slots||n.deleted||e.push(n.slots)})),od(t.date,e).done((function(n){if(n.data.length){if(Ts.set(n.data[0].options),n.data[0].options.length){var e,r,o=JSON.parse(t.slots)[0][2].split(" ").pop(),i=Oa(e=n.data[0].options).call(e,(function(t){var n;return xl(n=t.value).call(n,o)}));t.slots=i.length?i[0].value:n.data[0].options[0].value,t.options=Oa(r=Ts.get()).call(r,(function(n){return n.value===t.slots}))}}else Ts.set([])}))}function od(t,n){var e={action:"bookly_recurring_appointments_get_schedule",csrf_token:Al,staff_id:Cl.get().id,service_id:Nl.get().id,location_id:Yl.get()?Yl.get().id:null,exclude:n,nop:fs(ts.get())};if(t)e.repeat="daily",e.datetime=t,e.until=t,e.params={every:1},e.with_options=1;else{var r=Zl.get();e.repeat=r.type,e.datetime=hs(),e.until=r.until.format("YYYY-MM-DD"),e.params=r["biweekly"===r.type?"weekly":r.type],e.with_options=0}return jQuery.post(ajaxurl,e)}function id(){for(var t=Ms.get(),n=Is.get(),e=Cs.get(),r=[],o=[],i=function(){var i,c=a[u];uu(i=t[c]).call(i,(function(t,i){n===c&&xl(e).call(e,i)&&r.push(t),t.attachments&&o.push.apply(o,Gu(t.attachments))}))},u=0,a=Vu(t);u<a.length;u++)i();return{selected:r,attachments:o}}function ud(t,n){var e;if(void 0===Ji||null==mu(t)){if(yu(t)||(e=function(t,n){var e;if(!t)return;if("string"==typeof t)return ad(t,n);var r=pu(e=Object.prototype.toString.call(t)).call(e,8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return oa(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ad(t,n)}(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){e=Si(t)},n:function(){var t=e.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==e.return||e.return()}finally{if(a)throw i}}}}function ad(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}function cd(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}var fd=function(t){return{}},ld=function(t){return{}};function sd(t){var n,e,r,o,i,u,a,c,f,l,s,d,v,p,h=t[7].default,m=Qa(h,t,t[6],null),y=t[7].footer,g=Qa(y,t,t[6],ld);return{c:function(){n=sc("div"),e=sc("div"),r=sc("div"),o=sc("div"),i=sc("h5"),u=dc(t[1]),a=vc(),(c=sc("button")).innerHTML='<span aria-hidden="true">×</span>',f=vc(),l=sc("div"),m&&m.c(),s=vc(),d=sc("div"),g&&g.c(),yc(i,"class","modal-title"),yc(c,"type","button"),yc(c,"class","close"),yc(c,"data-dismiss","bookly-modal"),yc(c,"aria-label","Close"),yc(o,"class","modal-header"),yc(l,"class","modal-body"),yc(d,"class","modal-footer"),yc(r,"class","modal-content"),yc(e,"class",v="modal-dialog modal-"+t[0]),yc(n,"class","bookly-modal bookly-fade"),yc(n,"tabindex","-1"),yc(n,"role","dialog")},m:function(v,h){cc(v,n,h),ac(n,e),ac(e,r),ac(r,o),ac(o,i),ac(i,u),ac(o,a),ac(o,c),ac(r,f),ac(r,l),m&&m.m(l,null),ac(r,s),ac(r,d),g&&g.m(d,null),t[8](n),p=!0},p:function(t,n){var r=Wi(n,1)[0];(!p||2&r)&&wc(u,t[1]),m&&m.p&&64&r&&Xa(m,h,t,t[6],r,null,null),g&&g.p&&64&r&&Xa(g,y,t,t[6],r,fd,ld),(!p||1&r&&v!==(v="modal-dialog modal-"+t[0]))&&yc(e,"class",v)},i:function(t){p||(rf(m,t),rf(g,t),p=!0)},o:function(t){of(m,t),of(g,t),p=!1},d:function(e){e&&fc(n),m&&m.d(e),g&&g.d(e),t[8](null)}}}function dd(t,n,e){var r,o,i=n.$$slots,a=void 0===i?{}:i,c=n.$$scope,f=(r=Mc(),function(t,n){var e=r.$$.callbacks[t];if(e){var o,i=Ac(t,n);uu(o=pu(e).call(e)).call(o,(function(t){t.call(r,i)}))}}),l=n.size,s=void 0===l?"lg":l,d=n.title,v=void 0===d?"":d,p=n.hidden,h=void 0!==p&&p;return Ic((function(){h||u.default(o).booklyModal().on("hidden.bs.modal",(function(){return f("hidden")}))})),t.$$set=function(t){"size"in t&&e(0,s=t.size),"title"in t&&e(1,v=t.title),"hidden"in t&&e(3,h=t.hidden),"$$scope"in t&&e(6,c=t.$$scope)},[s,v,o,h,function(){u.default(o).booklyModal("show")},function(){u.default(o).booklyModal("hide")},c,a,function(t){Nc[t?"unshift":"push"]((function(){e(2,o=t)}))}]}var vd=function(t){nn(e,t);var n=cd(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,dd,sd,Wa,{size:0,title:1,hidden:3,show:4,hide:5}),r}return Gt(e,[{key:"show",get:function(){return this.$$.ctx[4]}},{key:"hide",get:function(){return this.$$.ctx[5]}}]),e}(pf),pd=Wf.trim,hd=p.parseFloat,md=1/hd(Yf+"-0")!=-1/0?function(t){var n=pd(String(t)),e=hd(n);return 0===e&&"-"==n.charAt(0)?-0:e}:hd;Z({global:!0,forced:parseFloat!=md},{parseFloat:md});var yd=H.parseFloat;function gd(t){var n=t-1;return n*n*n+1}function _d(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=n.delay,r=void 0===e?0:e,o=n.duration,i=void 0===o?400:o,u=n.easing,a=void 0===u?gd:u,c=getComputedStyle(t),f=+c.opacity,l=yd(c.height),s=yd(c.paddingTop),d=yd(c.paddingBottom),v=yd(c.marginTop),p=yd(c.marginBottom),h=yd(c.borderTopWidth),m=yd(c.borderBottomWidth);return{delay:r,duration:i,easing:a,css:function(t){return"overflow: hidden;"+"opacity: ".concat(Math.min(20*t,1)*f,";")+"height: ".concat(t*l,"px;")+"padding-top: ".concat(t*s,"px;")+"padding-bottom: ".concat(t*d,"px;")+"margin-top: ".concat(t*v,"px;")+"margin-bottom: ".concat(t*p,"px;")+"border-top-width: ".concat(t*h,"px;")+"border-bottom-width: ".concat(t*m,"px;")}}}function $d(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function bd(t){var n,e,r,o,i,u,a,c=t[4].default,f=Qa(c,t,t[3],null);return{c:function(){n=sc("div"),e=sc("i"),o=vc(),f&&f.c(),yc(e,"class",r="fas pl-1 "+("danger"===t[1]?"fa-times":"fa-exclamation-triangle")),yc(n,"class",i="alert alert-"+t[1]+" form-group "+t[2]+" py-1 ps-2")},m:function(t,r){cc(t,n,r),ac(n,e),ac(n,o),f&&f.m(n,null),a=!0},p:function(t,o){(!a||2&o&&r!==(r="fas pl-1 "+("danger"===t[1]?"fa-times":"fa-exclamation-triangle")))&&yc(e,"class",r),f&&f.p&&8&o&&Xa(f,c,t,t[3],o,null,null),(!a||6&o&&i!==(i="alert alert-"+t[1]+" form-group "+t[2]+" py-1 ps-2"))&&yc(n,"class",i)},i:function(t){a||(rf(f,t),u||Uc((function(){(u=af(n,_d,{})).start()})),a=!0)},o:function(t){of(f,t),a=!1},d:function(t){t&&fc(n),f&&f.d(t)}}}function wd(t){var n,e,r=t[0]&&bd(t);return{c:function(){r&&r.c(),n=pc()},m:function(t,o){r&&r.m(t,o),cc(t,n,o),e=!0},p:function(t,e){var o=Wi(e,1)[0];t[0]?r?(r.p(t,o),1&o&&rf(r,1)):((r=bd(t)).c(),rf(r,1),r.m(n.parentNode,n)):r&&(nf(),of(r,1,1,(function(){r=null})),ef())},i:function(t){e||(rf(r),e=!0)},o:function(t){of(r),e=!1},d:function(t){r&&r.d(t),t&&fc(n)}}}function xd(t,n,e){var r=n.$$slots,o=void 0===r?{}:r,i=n.$$scope,u=n.show,a=void 0===u||u,c=n.type,f=void 0===c?"warning":c,l=n.class,s=void 0===l?"":l;return t.$$set=function(t){"show"in t&&e(0,a=t.show),"type"in t&&e(1,f=t.type),"class"in t&&e(2,s=t.class),"$$scope"in t&&e(3,i=t.$$scope)},[a,f,s,i,o]}var kd=function(t){nn(e,t);var n=$d(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,xd,wd,Wa,{show:0,type:1,class:2}),r}return e}(pf);function Od(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Sd(t,n,e){var r=pu(t).call(t);return r[10]=n[e],r}function Ed(t,n,e){var r=pu(t).call(t);return r[13]=n[e],r}function Ad(t,n,e){var r=pu(t).call(t);return r[13]=n[e],r}function jd(t){var n;return{c:function(){(n=sc("option")).__value=null,n.value=n.__value},m:function(t,e){cc(t,n,e)},d:function(t){t&&fc(n)}}}function Td(t){var n,e,r,o=t[4](t[13],t[2])+"";return{c:function(){n=sc("option"),e=dc(o),n.__value=r=t[13],n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,i){6&i&&o!==(o=t[4](t[13],t[2])+"")&&wc(e,o),2&i&&r!==(r=t[13])&&(n.__value=r,n.value=n.__value)},d:function(t){t&&fc(n)}}}function Pd(t){var n,e,r,o=t[4](t[13],t[2])+"";return{c:function(){n=sc("option"),e=dc(o),n.__value=r=t[13],n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,i){6&i&&o!==(o=t[4](t[13],t[2])+"")&&wc(e,o),2&i&&r!==(r=t[13])&&(n.__value=r,n.value=n.__value)},d:function(t){t&&fc(n)}}}function Rd(t){for(var n,e,r=t[10].items,o=[],i=0;i<r.length;i+=1)o[i]=Pd(Ed(t,r,i));return{c:function(){n=sc("optgroup");for(var r=0;r<o.length;r+=1)o[r].c();yc(n,"label",e=t[10].label)},m:function(t,e){cc(t,n,e);for(var r=0;r<o.length;r+=1)o[r].m(n,null)},p:function(t,i){if(22&i){var u;for(r=t[10].items,u=0;u<r.length;u+=1){var a=Ed(t,r,u);o[u]?o[u].p(a,i):(o[u]=Pd(a),o[u].c(),o[u].m(n,null))}for(;u<o.length;u+=1)o[u].d(1);o.length=r.length}2&i&&e!==(e=t[10].label)&&yc(n,"label",e)},d:function(t){t&&fc(n),lc(o,t)}}}function Bd(t){var n,e=Rl.l10n.notices.provider_required+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Dd(t){for(var n,e,r,o,i,u,a,c,f,l,s=null===t[0]&&jd(),d=t[1].items,v=[],p=0;p<d.length;p+=1)v[p]=Td(Ad(t,d,p));for(var h=t[1].groups,m=[],y=0;y<h.length;y+=1)m[y]=Rd(Sd(t,h,y));return a=new kd({props:{show:t[3].provider_required,type:"danger",class:"mt-2",$$slots:{default:[Bd]},$$scope:{ctx:t}}}),{c:function(){(n=sc("label")).textContent="".concat(Rl.l10n.provider),e=vc(),r=sc("select"),s&&s.c(),o=pc();for(var c=0;c<v.length;c+=1)v[c].c();i=pc();for(var f=0;f<m.length;f+=1)m[f].c();u=vc(),ff(a.$$.fragment),yc(n,"for","bookly-provider"),yc(r,"id","bookly-provider"),yc(r,"class","form-control custom-select"),void 0===t[0]&&Uc((function(){return t[9].call(r)}))},m:function(d,p){cc(d,n,p),cc(d,e,p),cc(d,r,p),s&&s.m(r,null),ac(r,o);for(var h=0;h<v.length;h+=1)v[h].m(r,null);ac(r,i);for(var y=0;y<m.length;y+=1)m[y].m(r,null);Oc(r,t[0]),cc(d,u,p),lf(a,d,p),c=!0,f||(l=[hc(r,"change",t[9]),hc(r,"change",t[5])],f=!0)},p:function(t,n){var e=Wi(n,1)[0];if(null===t[0]?s||((s=jd()).c(),s.m(r,o)):s&&(s.d(1),s=null),22&e){var u;for(d=t[1].items,u=0;u<d.length;u+=1){var c=Ad(t,d,u);v[u]?v[u].p(c,e):(v[u]=Td(c),v[u].c(),v[u].m(r,i))}for(;u<v.length;u+=1)v[u].d(1);v.length=d.length}if(22&e){var f;for(h=t[1].groups,f=0;f<h.length;f+=1){var l=Sd(t,h,f);m[f]?m[f].p(l,e):(m[f]=Rd(l),m[f].c(),m[f].m(r,null))}for(;f<m.length;f+=1)m[f].d(1);m.length=h.length}3&e&&Oc(r,t[0]);var p={};8&e&&(p.show=t[3].provider_required),262144&e&&(p.$$scope={dirty:e,ctx:t}),a.$set(p)},i:function(t){c||(rf(a.$$.fragment,t),c=!0)},o:function(t){of(a.$$.fragment,t),c=!1},d:function(t){t&&fc(n),t&&fc(e),t&&fc(r),s&&s.d(),lc(v,t),lc(m,t),t&&fc(u),sf(a,t),f=!1,Ua(l)}}}function Md(t,n,e){var r,o,i,u,a,c,f;function l(){Qs()}return Va(t,Pf,(function(t){return e(7,r=t)})),Va(t,Cl,(function(t){return e(0,o=t)})),Va(t,Nl,(function(t){return e(8,i=t)})),Va(t,gs,(function(t){return e(2,u=t)})),Va(t,rs,(function(t){return e(3,a=t)})),t.$$.update=function(){if(449&t.$$.dirty)if(Rl.service_main)if(i){var n=function(t,n){return Oa(t).call(t,(function(t){var e;return vl(e=t.services).call(e,(function(t){return t.id===n}))}))}(r.staff,i.id);o&&!kl(o.id,n)&&tc(Cl,o=null,o),e(1,c=Bl(n,"category")),f!==i.id&&(null===o&&n.length<=2&&(tc(Cl,o=n[0],o),l()),e(6,f=i.id))}else e(1,c=Bl([],"category")),tc(Nl,i=null,i);else e(1,c=Bl(function(t,n){return Oa(t).call(t,(function(t){return!t.archived||t===n}))}(r.staff,o),"category"))},[o,c,u,a,function(t,n){return t.full_name+(t===n?" (".concat(Rl.l10n.staff_any,")"):"")},l,f,r,i,function(){o=Sc(this),Cl.set(o),e(1,c),e(7,r),e(0,o),e(8,i),e(6,f)}]}var Id=function(t){nn(e,t);var n=Od(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Md,Dd,Wa,{}),r}return e}(pf);function Cd(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Nd(t,n,e){var r=pu(t).call(t);return r[9]=n[e],r}function Ld(t,n,e){var r=pu(t).call(t);return r[12]=n[e],r}function Fd(t,n,e){var r=pu(t).call(t);return r[12]=n[e],r}function zd(t){var n,e,r,o=t[12].name+"";return{c:function(){n=sc("option"),e=dc(o),n.__value=r=t[12],n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,i){2&i&&o!==(o=t[12].name+"")&&wc(e,o),2&i&&r!==(r=t[12])&&(n.__value=r,n.value=n.__value)},d:function(t){t&&fc(n)}}}function Yd(t){var n,e,r,o=t[12].name+"";return{c:function(){n=sc("option"),e=dc(o),n.__value=r=t[12],n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,i){2&i&&o!==(o=t[12].name+"")&&wc(e,o),2&i&&r!==(r=t[12])&&(n.__value=r,n.value=n.__value)},d:function(t){t&&fc(n)}}}function qd(t){for(var n,e,r=t[9].items,o=[],i=0;i<r.length;i+=1)o[i]=Yd(Ld(t,r,i));return{c:function(){n=sc("optgroup");for(var r=0;r<o.length;r+=1)o[r].c();yc(n,"label",e=t[9].label)},m:function(t,e){cc(t,n,e);for(var r=0;r<o.length;r+=1)o[r].m(n,null)},p:function(t,i){if(2&i){var u;for(r=t[9].items,u=0;u<r.length;u+=1){var a=Ld(t,r,u);o[u]?o[u].p(a,i):(o[u]=Yd(a),o[u].c(),o[u].m(n,null))}for(;u<o.length;u+=1)o[u].d(1);o.length=r.length}2&i&&e!==(e=t[9].label)&&yc(n,"label",e)},d:function(t){t&&fc(n),lc(o,t)}}}function Hd(t){var n,e=Rl.l10n.notices.service_required+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Ud(t){for(var n,e,r,o,i,u,a,c,f,l,s=t[1].items,d=[],v=0;v<s.length;v+=1)d[v]=zd(Fd(t,s,v));for(var p=t[1].groups,h=[],m=0;m<p.length;m+=1)h[m]=qd(Nd(t,p,m));return a=new kd({props:{show:t[2].service_required,type:"danger",class:"mt-2",$$slots:{default:[Hd]},$$scope:{ctx:t}}}),{c:function(){(n=sc("label")).textContent="".concat(Rl.l10n.service),e=vc(),r=sc("select"),(o=sc("option")).textContent="".concat(Rl.l10n.select_a_service);for(var c=0;c<d.length;c+=1)d[c].c();i=pc();for(var f=0;f<h.length;f+=1)h[f].c();u=vc(),ff(a.$$.fragment),yc(n,"for","bookly-service"),o.__value=null,o.value=o.__value,yc(r,"id","bookly-service"),yc(r,"class","form-control custom-select"),void 0===t[0]&&Uc((function(){return t[7].call(r)}))},m:function(s,v){cc(s,n,v),cc(s,e,v),cc(s,r,v),ac(r,o);for(var p=0;p<d.length;p+=1)d[p].m(r,null);ac(r,i);for(var m=0;m<h.length;m+=1)h[m].m(r,null);Oc(r,t[0]),cc(s,u,v),lf(a,s,v),c=!0,f||(l=[hc(r,"change",t[7]),hc(r,"change",t[3])],f=!0)},p:function(t,n){var e=Wi(n,1)[0];if(2&e){var o;for(s=t[1].items,o=0;o<s.length;o+=1){var u=Fd(t,s,o);d[o]?d[o].p(u,e):(d[o]=zd(u),d[o].c(),d[o].m(r,i))}for(;o<d.length;o+=1)d[o].d(1);d.length=s.length}if(2&e){var c;for(p=t[1].groups,c=0;c<p.length;c+=1){var f=Nd(t,p,c);h[c]?h[c].p(f,e):(h[c]=qd(f),h[c].c(),h[c].m(r,null))}for(;c<h.length;c+=1)h[c].d(1);h.length=p.length}3&e&&Oc(r,t[0]);var l={};4&e&&(l.show=t[2].service_required),131072&e&&(l.$$scope={dirty:e,ctx:t}),a.$set(l)},i:function(t){c||(rf(a.$$.fragment,t),c=!0)},o:function(t){of(a.$$.fragment,t),c=!1},d:function(t){t&&fc(n),t&&fc(e),t&&fc(r),lc(d,t),lc(h,t),t&&fc(u),sf(a,t),f=!1,Ua(l)}}}function Gd(t,n,e){var r,o,i,u,a,c,f;function l(){u&&vs()}return Va(t,Pf,(function(t){return e(5,r=t)})),Va(t,Nl,(function(t){return e(0,o=t)})),Va(t,Cl,(function(t){return e(6,i=t)})),Va(t,Ul,(function(t){return e(8,u=t)})),Va(t,rs,(function(t){return e(2,a=t)})),t.$$.update=function(){113&t.$$.dirty&&(Rl.service_main?(e(1,c=Bl(r.services,"category")),o&&tc(Nl,o=kl(o.id,r.services),o)):i?(e(1,c=Bl(i.services,"category")),f!==i.id&&(o&&tc(Nl,o=kl(o.id,i.services),o),null===o&&i.services.length<=2&&(tc(Nl,o=i.services[i.services.length-1],o),l()),e(4,f=i.id))):(e(1,c=Bl([],"category")),tc(Nl,o=null,o)))},[o,c,a,l,f,r,i,function(){o=Sc(this),Nl.set(o),e(1,c),e(5,r),e(0,o),e(6,i),e(4,f)}]}var Wd=function(t){nn(e,t);var n=Cd(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Gd,Ud,Wa,{}),r}return e}(pf);function Jd(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Vd(t){var n,e=Rl.l10n.notices.custom_service_name_required+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Qd(t){var n,e,r,o,i,u,a,c,f,l,s,d,v,p;return u=new kd({props:{show:t[1].custom_service_name_required,type:"danger",class:"mt-2",$$slots:{default:[Vd]},$$scope:{ctx:t}}}),{c:function(){n=sc("div"),(e=sc("label")).textContent="".concat(Rl.l10n.custom_service_name),r=vc(),o=sc("input"),i=vc(),ff(u.$$.fragment),a=vc(),c=sc("div"),(f=sc("label")).textContent="".concat(Rl.l10n.custom_service_price),l=vc(),s=sc("input"),yc(e,"for","bookly-custom-service-name"),yc(o,"id","bookly-custom-service-name"),yc(o,"class","form-control"),yc(o,"type","text"),yc(n,"class","form-group"),yc(f,"for","bookly-custom-service-price"),yc(s,"id","bookly-custom-service-price"),yc(s,"class","form-control"),yc(s,"type","number"),yc(s,"min","0"),yc(s,"step","1"),yc(c,"class","form-group")},m:function(h,m){cc(h,n,m),ac(n,e),ac(n,r),ac(n,o),xc(o,t[0]),ac(n,i),lf(u,n,null),cc(h,a,m),cc(h,c,m),ac(c,f),ac(c,l),ac(c,s),xc(s,t[2]),d=!0,v||(p=[hc(o,"input",t[3]),hc(s,"input",t[4])],v=!0)},p:function(t,n){var e=Wi(n,1)[0];1&e&&o.value!==t[0]&&xc(o,t[0]);var r={};2&e&&(r.show=t[1].custom_service_name_required),32&e&&(r.$$scope={dirty:e,ctx:t}),u.$set(r),4&e&&$c(s.value)!==t[2]&&xc(s,t[2])},i:function(t){d||(rf(u.$$.fragment,t),d=!0)},o:function(t){of(u.$$.fragment,t),d=!1},d:function(t){t&&fc(n),sf(u),t&&fc(a),t&&fc(c),v=!1,Ua(p)}}}function Kd(t,n,e){var r,o,i;return Va(t,Ll,(function(t){return e(0,r=t)})),Va(t,rs,(function(t){return e(1,o=t)})),Va(t,Fl,(function(t){return e(2,i=t)})),[r,o,i,function(){r=this.value,Ll.set(r)},function(){i=$c(this.value),Fl.set(i)}]}var Xd=function(t){nn(e,t);var n=Jd(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Kd,Qd,Wa,{}),r}return e}(pf);function Zd(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function tv(t,n,e){var r=pu(t).call(t);return r[4]=n[e],r}function nv(t){var n,e,r,o=t[4].name+"";return{c:function(){n=sc("option"),e=dc(o),n.__value=r=t[4],n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,i){1&i&&o!==(o=t[4].name+"")&&wc(e,o),1&i&&r!==(r=t[4])&&(n.__value=r,n.value=n.__value)},d:function(t){t&&fc(n)}}}function ev(t){for(var n,e,r,o,i,u,a=t[0],c=[],f=0;f<a.length;f+=1)c[f]=nv(tv(t,a,f));return{c:function(){(n=sc("label")).textContent="".concat(Rl.l10n.location),e=vc(),r=sc("select"),o=sc("option");for(var i=0;i<c.length;i+=1)c[i].c();yc(n,"for","bookly-location"),o.__value=null,o.value=o.__value,yc(r,"id","bookly-location"),yc(r,"class","form-control custom-select"),void 0===t[1]&&Uc((function(){return t[3].call(r)}))},m:function(a,f){cc(a,n,f),cc(a,e,f),cc(a,r,f),ac(r,o);for(var l=0;l<c.length;l+=1)c[l].m(r,null);Oc(r,t[1]),i||(u=hc(r,"change",t[3]),i=!0)},p:function(t,n){var e=Wi(n,1)[0];if(1&e){var o;for(a=t[0],o=0;o<a.length;o+=1){var i=tv(t,a,o);c[o]?c[o].p(i,e):(c[o]=nv(i),c[o].c(),c[o].m(r,null))}for(;o<c.length;o+=1)c[o].d(1);c.length=a.length}3&e&&Oc(r,t[1])},i:Fa,o:Fa,d:function(t){t&&fc(n),t&&fc(e),t&&fc(r),lc(c,t),i=!1,u()}}}function rv(t,n,e){var r,o,i;return Va(t,Cl,(function(t){return e(2,r=t)})),Va(t,Yl,(function(t){return e(1,o=t)})),t.$$.update=function(){4&t.$$.dirty&&e(0,i=r?r.locations:[]),1&t.$$.dirty&&(i&&0!==i.length||tc(Yl,o=null,o)),3&t.$$.dirty&&i&&o&&tc(Yl,o=kl(o.id,i),o)},[i,o,r,function(){o=Sc(this),Yl.set(o),e(0,i),e(2,r)}]}var ov=function(t){nn(e,t);var n=Zd(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,rv,ev,Wa,{}),r}return e}(pf);function iv(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function uv(t){var n,e,r;return{c:function(){(n=sc("label")).textContent="".concat(Rl.l10n.date),e=vc(),r=sc("input"),yc(n,"for","bookly-date"),yc(r,"type","text"),yc(r,"id","bookly-date"),yc(r,"class","form-control"),yc(r,"autocomplete","off")},m:function(o,i){cc(o,n,i),cc(o,e,i),cc(o,r,i),t[3](r)},p:Fa,i:Fa,o:Fa,d:function(o){o&&fc(n),o&&fc(e),o&&fc(r),t[3](null)}}}function av(t,n,e){var r,o,i;return Va(t,Hl,(function(t){return e(2,r=t)})),Ic((function(){return e(1,i=u.default(o).daterangepicker({parentEl:"#bookly-appointment-dialog > div",singleDatePicker:!0,showDropdowns:!0,locale:Rl.datePicker},(function(t){return tc(Hl,r=t,r)})).data("daterangepicker"))})),t.$$.update=function(){6&t.$$.dirty&&r&&i&&(i.setStartDate(r),i.setEndDate(r))},[o,i,r,function(t){Nc[t?"unshift":"push"]((function(){e(0,o=t)}))}]}var cv=function(t){nn(e,t);var n=iv(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,av,uv,Wa,{}),r}return e}(pf);function fv(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function lv(t,n,e){var r=pu(t).call(t);return r[12]=n[e],r}function sv(t,n,e){var r=pu(t).call(t);return r[15]=n[e],r}function dv(t){for(var n,e=t[4],r=[],o=0;o<e.length;o+=1)r[o]=vv(sv(t,e,o));return{c:function(){for(var t=0;t<r.length;t+=1)r[t].c();n=pc()},m:function(t,e){for(var o=0;o<r.length;o+=1)r[o].m(t,e);cc(t,n,e)},p:function(t,o){if(16&o){var i;for(e=t[4],i=0;i<e.length;i+=1){var u=sv(t,e,i);r[i]?r[i].p(u,o):(r[i]=vv(u),r[i].c(),r[i].m(n.parentNode,n))}for(;i<r.length;i+=1)r[i].d(1);r.length=e.length}},d:function(t){lc(r,t),t&&fc(n)}}}function vv(t){var n,e,r,o,i=t[15].title+"";return{c:function(){n=sc("option"),e=dc(i),n.__value=r=t[15],n.value=n.__value,n.disabled=o=t[15].disabled},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,u){16&u&&i!==(i=t[15].title+"")&&wc(e,i),16&u&&r!==(r=t[15])&&(n.__value=r,n.value=n.__value),16&u&&o!==(o=t[15].disabled)&&(n.disabled=o)},d:function(t){t&&fc(n)}}}function pv(t){for(var n,e=t[5],r=[],o=0;o<e.length;o+=1)r[o]=hv(lv(t,e,o));return{c:function(){for(var t=0;t<r.length;t+=1)r[t].c();n=pc()},m:function(t,e){for(var o=0;o<r.length;o+=1)r[o].m(t,e);cc(t,n,e)},p:function(t,o){if(32&o){var i;for(e=t[5],i=0;i<e.length;i+=1){var u=lv(t,e,i);r[i]?r[i].p(u,o):(r[i]=hv(u),r[i].c(),r[i].m(n.parentNode,n))}for(;i<r.length;i+=1)r[i].d(1);r.length=e.length}},d:function(t){lc(r,t),t&&fc(n)}}}function hv(t){var n,e,r,o=t[12].title+"";return{c:function(){n=sc("option"),e=dc(o),n.__value=r=t[12],n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,i){32&i&&o!==(o=t[12].title+"")&&wc(e,o),32&i&&r!==(r=t[12])&&(n.__value=r,n.value=n.__value)},d:function(t){t&&fc(n)}}}function mv(t){var n,e,r,o,i,u,a,c,f,l,s,d,v,p=!!t[4]&&!t[3]&&dv(t),h=!!t[5]&&!t[3]&&pv(t);return{c:function(){(n=sc("label")).textContent="".concat(Rl.l10n.period),e=vc(),r=sc("div"),o=sc("div"),i=sc("select"),p&&p.c(),u=vc(),(a=sc("div")).textContent="".concat(Rl.l10n.to),c=vc(),f=sc("div"),l=sc("select"),h&&h.c(),yc(n,"for","bookly-period"),yc(i,"id","bookly-period"),yc(i,"class","form-control custom-select"),i.disabled=t[3],void 0===t[0]&&Uc((function(){return t[8].call(i)})),yc(o,"class","col"),yc(a,"class","col-auto"),yc(l,"class","form-control custom-select"),l.disabled=s=Rl.appropriate_slots&&t[1]&&t[1].id&&1===t[1].units_max,void 0===t[2]&&Uc((function(){return t[9].call(l)})),yc(f,"class","col"),yc(r,"class","form-row align-items-center")},m:function(s,m){cc(s,n,m),cc(s,e,m),cc(s,r,m),ac(r,o),ac(o,i),p&&p.m(i,null),Oc(i,t[0]),ac(r,u),ac(r,a),ac(r,c),ac(r,f),ac(f,l),h&&h.m(l,null),Oc(l,t[2]),d||(v=[hc(i,"change",t[8]),hc(i,"change",t[6]),hc(l,"change",t[9]),hc(l,"change",t[7])],d=!0)},p:function(t,n){var e=Wi(n,1)[0];t[4]&&!t[3]?p?p.p(t,e):((p=dv(t)).c(),p.m(i,null)):p&&(p.d(1),p=null),8&e&&(i.disabled=t[3]),17&e&&Oc(i,t[0]),t[5]&&!t[3]?h?h.p(t,e):((h=pv(t)).c(),h.m(l,null)):h&&(h.d(1),h=null),2&e&&s!==(s=Rl.appropriate_slots&&t[1]&&t[1].id&&1===t[1].units_max)&&(l.disabled=s),36&e&&Oc(l,t[2])},i:Fa,o:Fa,d:function(t){t&&fc(n),t&&fc(e),t&&fc(r),p&&p.d(),h&&h.d(),d=!1,Ua(v)}}}function yv(t,n,e){var r,o,i,u,a,c,f,l;return Va(t,Ul,(function(t){return e(10,r=t)})),Va(t,Gl,(function(t){return e(0,o=t)})),Va(t,Nl,(function(t){return e(1,i=t)})),Va(t,Wl,(function(t){return e(11,u=t)})),Va(t,Jl,(function(t){return e(2,a=t)})),Va(t,Vl,(function(t){return e(3,c=t)})),Va(t,Ss,(function(t){return e(4,f=t)})),Va(t,Es,(function(t){return e(5,l=t)})),[o,i,a,c,f,l,function(){tc(Ul,r=o.value,r),i&&vs()},function(){tc(Wl,u=a.value,u)},function(){o=Sc(this),Gl.set(o)},function(){a=Sc(this),Jl.set(a)}]}var gv=function(t){nn(e,t);var n=fv(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,yv,mv,Wa,{}),r}return e}(pf);function _v(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function $v(t){var n,e,r,o,i,u;return{c:function(){n=sc("div"),e=sc("input"),r=vc(),(o=sc("label")).textContent="".concat(Rl.l10n.recurring.repeat_this_appointment),yc(e,"type","checkbox"),yc(e,"id","bookly-repeat-enabled"),yc(e,"class","custom-control-input"),yc(o,"for","bookly-repeat-enabled"),yc(o,"class","custom-control-label"),yc(n,"class","custom-control custom-checkbox")},m:function(a,c){cc(a,n,c),ac(n,e),e.checked=t[0],ac(n,r),ac(n,o),i||(u=hc(e,"change",t[1]),i=!0)},p:function(t,n){1&Wi(n,1)[0]&&(e.checked=t[0])},i:Fa,o:Fa,d:function(t){t&&fc(n),i=!1,u()}}}function bv(t,n,e){var r;return Va(t,Ql,(function(t){return e(0,r=t)})),[r,function(){r=this.checked,Ql.set(r)}]}var wv=function(t){nn(e,t);var n=_v(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,bv,$v,Wa,{}),r}return e}(pf);Z({target:"String",proto:!0},{repeat:"".repeat||function(t){var n=String(O(this)),e="",r=ot(t);if(r<0||r==1/0)throw RangeError("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(n+=n))1&r&&(e+=n);return e}});var xv=Ii("String").repeat,kv=String.prototype,Ov=function(t){var n=t.repeat;return"string"==typeof t||t===kv||t instanceof String&&n===kv.repeat?xv:n};function Sv(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Ev(t,n,e){var r=pu(t).call(t);return r[2]=n[e],r}function Av(t){var n,e,r=t[2].title+"";return{c:function(){n=sc("option"),e=dc(r),n.__value=t[2].id,n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:Fa,d:function(t){t&&fc(n)}}}function jv(t){for(var n,e,r,o,i,u,a,c=Rl.recurring.types,f=[],l=0;l<c.length;l+=1)f[l]=Av(Ev(t,c,l));return{c:function(){n=sc("div"),(e=sc("div")).textContent="".concat(Ov(Rl.l10n.recurring)),r=vc(),o=sc("div"),i=sc("select");for(var u=0;u<f.length;u+=1)f[u].c();yc(e,"class","col-sm-2 col-form-label"),yc(i,"id","bookly-recurring-type"),yc(i,"class","form-control custom-select"),void 0===t[0].type&&Uc((function(){return t[1].call(i)})),yc(o,"class","col-sm-4"),yc(n,"class","form-group form-row")},m:function(c,l){cc(c,n,l),ac(n,e),ac(n,r),ac(n,o),ac(o,i);for(var s=0;s<f.length;s+=1)f[s].m(i,null);Oc(i,t[0].type),u||(a=hc(i,"change",t[1]),u=!0)},p:function(t,n){var e=Wi(n,1)[0];if(0&e){var r;for(c=Rl.recurring.types,r=0;r<c.length;r+=1){var o=Ev(t,c,r);f[r]?f[r].p(o,e):(f[r]=Av(o),f[r].c(),f[r].m(i,null))}for(;r<f.length;r+=1)f[r].d(1);f.length=c.length}1&e&&Oc(i,t[0].type)},i:Fa,o:Fa,d:function(t){t&&fc(n),lc(f,t),u=!1,a()}}}function Tv(t,n,e){var r;return Va(t,Zl,(function(t){return e(0,r=t)})),[r,function(){r.type=Sc(this),Zl.set(r)}]}var Pv=function(t){nn(e,t);var n=Sv(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Tv,jv,Wa,{}),r}return e}(pf);function Rv(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Bv(t){var n,e,r,o,i,u,a,c,f,l,s;return{c:function(){n=sc("div"),(e=sc("div")).textContent="".concat(zf(Rl.l10n.recurring)),r=vc(),o=sc("div"),i=sc("div"),u=sc("input"),a=vc(),c=sc("div"),(f=sc("span")).textContent="".concat(Rl.l10n.recurring.days),yc(e,"class","col-sm-2 col-form-label"),yc(u,"type","number"),yc(u,"step","1"),yc(u,"min","1"),yc(u,"class","form-control"),yc(f,"class","input-group-text"),yc(c,"class","input-group-append"),yc(i,"class","input-group"),yc(o,"class","col-sm-4"),yc(n,"class","form-group form-row")},m:function(d,v){cc(d,n,v),ac(n,e),ac(n,r),ac(n,o),ac(o,i),ac(i,u),xc(u,zf(t[0].daily)),ac(i,a),ac(i,c),ac(c,f),l||(s=hc(u,"input",t[1]),l=!0)},p:function(t,n){1&Wi(n,1)[0]&&$c(u.value)!==zf(t[0].daily)&&xc(u,zf(t[0].daily))},i:Fa,o:Fa,d:function(t){t&&fc(n),l=!1,s()}}}function Dv(t,n,e){var r;return Va(t,Zl,(function(t){return e(0,r=t)})),[r,function(){r.daily.every=$c(this.value),Zl.set(r)}]}var Mv=function(t){nn(e,t);var n=Rv(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Dv,Bv,Wa,{}),r}return e}(pf);function Iv(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Cv(t,n,e){var r=pu(t).call(t);return r[6]=n[e],r}function Nv(t){var n,e,r,o,i,u,a,c,f=t[6].title+"";return{c:function(){n=sc("div"),e=sc("input"),r=vc(),o=sc("label"),i=dc(f),u=vc(),yc(e,"type","checkbox"),yc(e,"id","bookly-week-"+t[6].id),e.__value=t[6].id,e.value=e.__value,yc(e,"class","custom-control-input"),t[3][0].push(e),yc(o,"for","bookly-week-"+t[6].id),yc(o,"class","custom-control-label"),yc(n,"class","custom-control custom-checkbox d-inline mr-3")},m:function(f,l){var s;cc(f,n,l),ac(n,e),e.checked=~na(s=t[0].weekly.on).call(s,e.__value),ac(n,r),ac(n,o),ac(o,i),ac(n,u),a||(c=hc(e,"change",t[2]),a=!0)},p:function(t,n){var r;1&n&&(e.checked=~na(r=t[0].weekly.on).call(r,e.__value))},d:function(r){var o,i;r&&fc(n),va(o=t[3][0]).call(o,na(i=t[3][0]).call(i,e),1),a=!1,c()}}}function Lv(t){for(var n,e,r,o,i=Rl.recurring.days,u=[],a=0;a<i.length;a+=1)u[a]=Nv(Cv(t,i,a));return{c:function(){n=sc("div"),(e=sc("div")).textContent="".concat(Rl.l10n.recurring.on),r=vc(),o=sc("div");for(var i=0;i<u.length;i+=1)u[i].c();yc(e,"class","col-sm-2 col-form-label"),yc(o,"id","bookly-repeat-on"),yc(o,"class","col-sm-10 mt-1"),Ec(o,"text-danger",!t[0].weekly.on.length),yc(n,"class","form-group form-row")},m:function(t,i){cc(t,n,i),ac(n,e),ac(n,r),ac(n,o);for(var a=0;a<u.length;a+=1)u[a].m(o,null)},p:function(t,n){var e=Wi(n,1)[0];if(1&e){var r;for(i=Rl.recurring.days,r=0;r<i.length;r+=1){var a=Cv(t,i,r);u[r]?u[r].p(a,e):(u[r]=Nv(a),u[r].c(),u[r].m(o,null))}for(;r<u.length;r+=1)u[r].d(1);u.length=i.length}1&e&&Ec(o,"text-danger",!t[0].weekly.on.length)},i:Fa,o:Fa,d:function(t){t&&fc(n),lc(u,t)}}}function Fv(t,n,e){var r,o;Va(t,Hl,(function(t){return e(1,r=t)})),Va(t,Zl,(function(t){return e(0,o=t)}));var i=!1;var u=[[]];return t.$$.update=function(){2&t.$$.dirty&&r&&0===o.weekly.on.length&&(i||(tc(Zl,o.weekly.on=[Vs(r)],o),i=!0))},[o,r,function(){o.weekly.on=_c(u[0],this.__value,this.checked),Zl.set(o)},u]}var zv=function(t){nn(e,t);var n=Iv(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Fv,Lv,Wa,{}),r}return e}(pf);function Yv(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function qv(t,n,e){var r=pu(t).call(t);return r[6]=n[e],r}function Hv(t,n,e){var r=pu(t).call(t);return r[4]=n[e],r[6]=e,r}function Uv(t,n,e){var r=pu(t).call(t);return r[9]=n[e],r}function Gv(t){var n,e,r=t[9].title+"";return{c:function(){n=sc("option"),e=dc(r),n.__value=t[9].id,n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Wv(t){for(var n,e,r,o,i=Rl.recurring.days,u=[],a=0;a<i.length;a+=1)u[a]=Vv(qv(t,i,a));return{c:function(){n=sc("div"),e=sc("select");for(var r=0;r<u.length;r+=1)u[r].c();yc(e,"class","form-control custom-select"),void 0===t[0].monthly.weekday&&Uc((function(){return t[3].call(e)})),yc(n,"class","col-sm-2")},m:function(i,a){cc(i,n,a),ac(n,e);for(var c=0;c<u.length;c+=1)u[c].m(e,null);Oc(e,t[0].monthly.weekday),r||(o=hc(e,"change",t[3]),r=!0)},p:function(t,n){if(0&n){var r;for(i=Rl.recurring.days,r=0;r<i.length;r+=1){var o=qv(t,i,r);u[r]?u[r].p(o,n):(u[r]=Vv(o),u[r].c(),u[r].m(e,null))}for(;r<u.length;r+=1)u[r].d(1);u.length=i.length}1&n&&Oc(e,t[0].monthly.weekday)},d:function(t){t&&fc(n),lc(u,t),r=!1,o()}}}function Jv(t){for(var n,e,r,o,i=Array(31),u=[],a=0;a<i.length;a+=1)u[a]=Qv(Hv(t,i,a));return{c:function(){n=sc("div"),e=sc("select");for(var r=0;r<u.length;r+=1)u[r].c();yc(e,"class","form-control custom-select"),void 0===t[0].monthly.day&&Uc((function(){return t[2].call(e)})),yc(n,"class","col-sm-2 mr-4")},m:function(i,a){cc(i,n,a),ac(n,e);for(var c=0;c<u.length;c+=1)u[c].m(e,null);Oc(e,t[0].monthly.day),r||(o=hc(e,"change",t[2]),r=!0)},p:function(t,n){1&n&&Oc(e,t[0].monthly.day)},d:function(t){t&&fc(n),lc(u,t),r=!1,o()}}}function Vv(t){var n,e,r=t[6].title+"";return{c:function(){n=sc("option"),e=dc(r),n.__value=t[6].id,n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Qv(t){var n,e,r=t[6]+1+"";return{c:function(){n=sc("option"),e=dc(r),n.__value=t[6]+1,n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Kv(t){for(var n,e,r,o,i,u,a,c,f=Rl.recurring.monthly_items,l=[],s=0;s<f.length;s+=1)l[s]=Gv(Uv(t,f,s));function d(t,n){return"day"===t[0].monthly.on?Jv:Wv}var v=d(t),p=v(t);return{c:function(){n=sc("div"),(e=sc("div")).textContent="".concat(Rl.l10n.recurring.on),r=vc(),o=sc("div"),i=sc("select");for(var a=0;a<l.length;a+=1)l[a].c();u=vc(),p.c(),yc(e,"class","col-sm-2 col-form-label"),yc(i,"class","form-control custom-select"),void 0===t[0].monthly.on&&Uc((function(){return t[1].call(i)})),yc(o,"class","col-sm-4"),yc(n,"class","form-group form-row")},m:function(f,s){cc(f,n,s),ac(n,e),ac(n,r),ac(n,o),ac(o,i);for(var d=0;d<l.length;d+=1)l[d].m(i,null);Oc(i,t[0].monthly.on),ac(n,u),p.m(n,null),a||(c=hc(i,"change",t[1]),a=!0)},p:function(t,e){var r=Wi(e,1)[0];if(0&r){var o;for(f=Rl.recurring.monthly_items,o=0;o<f.length;o+=1){var u=Uv(t,f,o);l[o]?l[o].p(u,r):(l[o]=Gv(u),l[o].c(),l[o].m(i,null))}for(;o<l.length;o+=1)l[o].d(1);l.length=f.length}1&r&&Oc(i,t[0].monthly.on),v===(v=d(t))&&p?p.p(t,r):(p.d(1),(p=v(t))&&(p.c(),p.m(n,null)))},i:Fa,o:Fa,d:function(t){t&&fc(n),lc(l,t),p.d(),a=!1,c()}}}function Xv(t,n,e){var r;return Va(t,Zl,(function(t){return e(0,r=t)})),[r,function(){r.monthly.on=Sc(this),Zl.set(r)},function(){r.monthly.day=Sc(this),Zl.set(r)},function(){r.monthly.weekday=Sc(this),Zl.set(r)}]}var Zv=function(t){nn(e,t);var n=Yv(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Xv,Kv,Wa,{}),r}return e}(pf);function tp(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function np(t){var n,e,r,o,i,u,a,c,f,l,s,d,v,p;return{c:function(){n=sc("div"),(e=sc("div")).textContent="".concat(Rl.l10n.recurring.until),r=vc(),o=sc("div"),i=sc("input"),u=vc(),(a=sc("div")).textContent="".concat(Rl.l10n.recurring.or),c=vc(),f=sc("div"),l=sc("input"),s=vc(),(d=sc("div")).textContent="".concat(Rl.l10n.recurring.times),yc(e,"class","col-sm-2 col-form-label"),yc(i,"type","text"),yc(i,"class","form-control"),yc(i,"autocomplete","off"),yc(o,"class","col col-sm-4"),yc(a,"class","col-auto"),yc(l,"class","form-control"),yc(l,"type","number"),yc(l,"min","1"),yc(f,"class","col-3 col-sm-2"),yc(d,"class","col-auto"),yc(n,"class","form-group form-row align-items-center")},m:function(h,m){cc(h,n,m),ac(n,e),ac(n,r),ac(n,o),ac(o,i),t[6](i),ac(n,u),ac(n,a),ac(n,c),ac(n,f),ac(f,l),xc(l,t[1]),ac(n,s),ac(n,d),v||(p=[hc(l,"input",t[7]),hc(l,"input",t[2])],v=!0)},p:function(t,n){2&Wi(n,1)[0]&&$c(l.value)!==t[1]&&xc(l,t[1])},i:Fa,o:Fa,d:function(e){e&&fc(n),t[6](null),v=!1,Ua(p)}}}function ep(t,n,e){var r,o,i,a,c,f;return Va(t,Zl,(function(t){return e(5,r=t)})),Va(t,Hl,(function(t){return e(8,o=t)})),Va(t,Xl,(function(t){return e(1,i=t)})),Ic((function(){null===r.until&&tc(Zl,r.until=o?o.clone().add(1,"month"):moment().add(1,"month"),r),tc(Zl,r.monthly.day=o.date(),r),tc(Zl,r.monthly.weekday=Vs(ps()),r),e(3,c=u.default(a).daterangepicker({parentEl:"#bookly-appointment-dialog > div",singleDatePicker:!0,showDropdowns:!0,locale:Rl.datePicker},(function(t){return tc(Zl,r.until=t,r)})).data("daterangepicker"))})),t.$$.update=function(){32&t.$$.dirty&&e(4,f=r.until),24&t.$$.dirty&&f&&c&&(c.setStartDate(f),c.setEndDate(f))},[a,i,function(){var t=0,n=o.clone().add(5,"years"),e=o.clone();do{Js(e,r,o)&&t++,e.add(1,"days")}while(t<i&&e.isBefore(n));tc(Zl,r.until=e.subtract(1,"days"),r)},c,f,r,function(t){Nc[t?"unshift":"push"]((function(){e(0,a=t)}))},function(){i=$c(this.value),Xl.set(i)}]}var rp=function(t){nn(e,t);var n=tp(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,ep,np,Wa,{}),r}return e}(pf);function op(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function ip(t){var n,e,r,o,i,u,a,c,f,l,s;r=new Pv({});var d=[cp,ap,up],v=[];function p(t,n){return"daily"===t[0].type?0:"weekly"===t[0].type||"biweekly"===t[0].type?1:2}return i=p(t),u=v[i]=d[i](t),c=new rp({}),l=new kd({props:{type:"danger",show:t[1],class:"mt-n2",$$slots:{default:[fp]},$$scope:{ctx:t}}}),{c:function(){n=sc("div"),e=sc("div"),ff(r.$$.fragment),o=vc(),u.c(),a=vc(),ff(c.$$.fragment),f=vc(),ff(l.$$.fragment),yc(e,"class","mt-3"),yc(n,"class","border-left ml-4 pl-3")},m:function(t,u){cc(t,n,u),ac(n,e),lf(r,e,null),ac(e,o),v[i].m(e,null),ac(e,a),lf(c,e,null),ac(e,f),lf(l,e,null),s=!0},p:function(t,n){var r=i;(i=p(t))!==r&&(nf(),of(v[r],1,1,(function(){v[r]=null})),ef(),(u=v[i])||(u=v[i]=d[i](t)).c(),rf(u,1),u.m(e,a));var o={};2&n&&(o.show=t[1]),32&n&&(o.$$scope={dirty:n,ctx:t}),l.$set(o)},i:function(t){s||(rf(r.$$.fragment,t),rf(u),rf(c.$$.fragment,t),rf(l.$$.fragment,t),s=!0)},o:function(t){of(r.$$.fragment,t),of(u),of(c.$$.fragment,t),of(l.$$.fragment,t),s=!1},d:function(t){t&&fc(n),sf(r),v[i].d(),sf(c),sf(l)}}}function up(t){var n,e;return n=new Zv({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function ap(t){var n,e;return n=new zv({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function cp(t){var n,e;return n=new Mv({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function fp(t){var n,e=Rl.l10n.notices.until_cant_be_earlier+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function lp(t){var n,e,r,o;n=new wv({});var i=t[2]&&ip(t);return{c:function(){ff(n.$$.fragment),e=vc(),i&&i.c(),r=pc()},m:function(t,u){lf(n,t,u),cc(t,e,u),i&&i.m(t,u),cc(t,r,u),o=!0},p:function(t,n){var e=Wi(n,1)[0];t[2]?i?(i.p(t,e),4&e&&rf(i,1)):((i=ip(t)).c(),rf(i,1),i.m(r.parentNode,r)):i&&(nf(),of(i,1,1,(function(){i=null})),ef())},i:function(t){o||(rf(n.$$.fragment,t),rf(i),o=!0)},o:function(t){of(n.$$.fragment,t),of(i),o=!1},d:function(t){sf(n,t),t&&fc(e),i&&i.d(t),t&&fc(r)}}}function sp(t,n,e){var r,o,i,u,a;return Va(t,Zl,(function(t){return e(0,r=t)})),Va(t,Hl,(function(t){return e(3,o=t)})),Va(t,Xl,(function(t){return e(4,i=t)})),Va(t,Kl,(function(t){return e(1,u=t)})),Va(t,Ql,(function(t){return e(2,a=t)})),t.$$.update=function(){if(9&t.$$.dirty&&r.until&&o){var n=0,e=r.until.clone().add(1,"days"),a=o.clone();do{Js(a,r,o)&&n++,a.add(1,"days")}while(a.isBefore(e));tc(Xl,i=n,i),tc(Kl,u=r.until.isBefore(o),u)}},[r,u,a,o]}var dp=function(t){nn(e,t);var n=op(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,sp,lp,Wa,{}),r}return e}(pf);function vp(t){var n=kl(t,Rl.statuses);return n?n.title:t}function pp(t){var n=kl(t,Rl.statuses);return n?n.icon:"far fa-question-circle"}function hp(t,n){var e=n,r=u.default(t);return r.booklyPopover({trigger:"hover",container:r.closest(".bookly-js-popover-container"),content:function(){return e},html:!0,placement:"top",template:'<div class="bookly-popover"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'}),{update:function(t){e=t},destroy:function(){r.booklyPopover("dispose")}}}function mp(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function yp(t,n,e){var r=pu(t).call(t);return r[21]=n[e],r}function gp(t,n,e){var r=pu(t).call(t);return r[24]=n[e],r[25]=n,r[26]=e,r}function _p(t,n,e){var r=pu(t).call(t);return r[27]=n[e],r}function $p(t){var n,e,r,o,i,u,a=ls(t[2])+"",c=t[1].max+"";return{c:function(){n=sc("span"),e=dc("("),r=dc(a),o=dc("/"),i=dc(c),u=dc(")"),yc(n,"title",Rl.l10n.selected_maximum)},m:function(t,a){cc(t,n,a),ac(n,e),ac(n,r),ac(n,o),ac(n,i),ac(n,u)},p:function(t,n){4&n&&a!==(a=ls(t[2])+"")&&wc(r,a),2&n&&c!==(c=t[1].max+"")&&wc(i,c)},d:function(t){t&&fc(n)}}}function bp(t){var n,e,r,o;return{c:function(){n=sc("span"),yc(e=sc("i"),"class","fas fa-fw"),Ec(e,"fa-angle-down",!t[0]),Ec(e,"fa-angle-up",t[0]),yc(n,"role","button")},m:function(i,u){cc(i,n,u),ac(n,e),r||(o=hc(n,"click",t[13]),r=!0)},p:function(t,n){1&n&&Ec(e,"fa-angle-down",!t[0]),1&n&&Ec(e,"fa-angle-up",t[0])},d:function(t){t&&fc(n),r=!1,o()}}}function wp(t){var n,e;return n=new kd({props:{type:"success",$$slots:{default:[xp]},$$scope:{ctx:t}}}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},p:function(t,e){var r={};1073741826&e&&(r.$$scope={dirty:e,ctx:t}),n.$set(r)},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function xp(t){var n,e,r,o=Rl.l10n.minimum_capacity+"",i=t[1].min+"";return{c:function(){n=dc(o),e=dc(": "),r=dc(i)},m:function(t,o){cc(t,n,o),cc(t,e,o),cc(t,r,o)},p:function(t,n){2&n&&i!==(i=t[1].min+"")&&wc(r,i)},d:function(t){t&&fc(n),t&&fc(e),t&&fc(r)}}}function kp(t){var n,e,r,o;return{c:function(){(n=sc("button")).innerHTML='<i class="fas fa-fw fa-list"></i>',yc(n,"type","button"),yc(n,"class","btn btn-default px-2 py-1")},m:function(i,u){var a;(cc(i,n,u),r)||(o=[hc(n,"click",(function(){Ga(t[9](t[24]))&&t[9](t[24]).apply(this,arguments)})),nc(e=hp.call(null,n,Zu(a="".concat(Rl.l10n.part_of_collaborative_services,": ")).call(a,t[24].collaborative_service)))],r=!0)},p:function(n,r){var o;t=n,e&&Ga(e.update)&&4&r&&e.update.call(null,Zu(o="".concat(Rl.l10n.part_of_collaborative_services,": ")).call(o,t[24].collaborative_service))},d:function(t){t&&fc(n),r=!1,Ua(o)}}}function Op(t){var n,e,r,o;return{c:function(){(n=sc("button")).innerHTML='<i class="fas fa-fw fa-list"></i>',yc(n,"type","button"),yc(n,"class","btn btn-default px-2 py-1")},m:function(i,u){var a;(cc(i,n,u),r)||(o=[hc(n,"click",(function(){Ga(t[10](t[24]))&&t[10](t[24]).apply(this,arguments)})),nc(e=hp.call(null,n,Zu(a="".concat(Rl.l10n.part_of_compound_services,": ")).call(a,t[24].compound_service)))],r=!0)},p:function(n,r){var o;t=n,e&&Ga(e.update)&&4&r&&e.update.call(null,Zu(o="".concat(Rl.l10n.part_of_compound_services,": ")).call(o,t[24].compound_service))},d:function(t){t&&fc(n),r=!1,Ua(o)}}}function Sp(t){var n,e,r,o,i,u,a=t[27].title+"";function c(){return t[14](t[24],t[27],t[25],t[26])}return{c:function(){n=sc("a"),e=sc("span"),r=dc(a),o=vc(),yc(e,"class","fa-fw mr-2 "+t[27].icon),yc(n,"href",""),yc(n,"class","dropdown-item pl-3")},m:function(t,a){cc(t,n,a),ac(n,e),ac(n,r),ac(n,o),i||(u=hc(n,"click",mc(c)),i=!0)},p:function(n,e){t=n},d:function(t){t&&fc(n),i=!1,u()}}}function Ep(t){var n,e,r,o,i;return{c:function(){n=sc("button"),yc(e=sc("span"),"class","fas fa-fw"),Ec(e,"fa-search-dollar",El("pro")&&!t[24].payment_type),Ec(e,"fa-dollar-sign","full"===t[24].payment_type),Ec(e,"fa-hand-holding-usd","partial"===t[24].payment_type),yc(n,"type","button"),yc(n,"class","btn btn-default px-2 py-1")},m:function(u,a){var c;(cc(u,n,a),ac(n,e),o)||(i=[hc(n,"click",(function(){Ga(t[7](t[24]))&&t[7](t[24]).apply(this,arguments)})),nc(r=hp.call(null,n,t[24].payment_type?Zu(c="".concat(Rl.l10n.payment,": ")).call(c,t[24].payment_title):Rl.l10n.attach_payment))],o=!0)},p:function(n,o){var i;t=n,4&o&&Ec(e,"fa-search-dollar",El("pro")&&!t[24].payment_type),4&o&&Ec(e,"fa-dollar-sign","full"===t[24].payment_type),4&o&&Ec(e,"fa-hand-holding-usd","partial"===t[24].payment_type),r&&Ga(r.update)&&4&o&&r.update.call(null,t[24].payment_type?Zu(i="".concat(Rl.l10n.payment,": ")).call(i,t[24].payment_title):Rl.l10n.attach_payment)},d:function(t){t&&fc(n),o=!1,Ua(i)}}}function Ap(t){var n,e,r;return{c:function(){(n=sc("button")).innerHTML='<span class="far fa-fw fa-calendar-alt"></span>',yc(n,"type","button"),yc(n,"class","btn btn-default px-2 py-1")},m:function(o,i){cc(o,n,i),e||(r=[hc(n,"click",(function(){Ga(t[8](t[24]))&&t[8](t[24]).apply(this,arguments)})),nc(hp.call(null,n,Rl.l10n.package_schedule))],e=!0)},p:function(n,e){t=n},d:function(t){t&&fc(n),e=!1,Ua(r)}}}function jp(t){var n,e,r;return{c:function(){(n=sc("button")).innerHTML='<span class="fas fa-fw fa-link"></span>',yc(n,"type","button"),yc(n,"class","btn btn-default px-2 py-1")},m:function(o,i){cc(o,n,i),e||(r=[hc(n,"click",(function(){Ga(t[11](t[24]))&&t[11](t[24]).apply(this,arguments)})),nc(hp.call(null,n,Rl.l10n.view_series))],e=!0)},p:function(n,e){t=n},d:function(t){t&&fc(n),e=!1,Ua(r)}}}function Tp(t){for(var n,e,r,o,i,u,a,c,f,l,s,d,v,p,h,m,y,g,_,$,b,w,x,k,O,S,E,A,j=t[24].name+"",T=El("collaborative-services")&&t[24].collaborative_token,P=El("compound-services")&&t[24].compound_token,R=t[24].payment_id||El("pro"),B=t[24].number_of_persons+"",D=El("packages")&&t[24].package_id,M=El("recurring-appointments")&&t[24].series_id,I=T&&kp(t),C=P&&Op(t),N=Rl.statuses,L=[],F=0;F<N.length;F+=1)L[F]=Sp(_p(t,N,F));var z=R&&Ep(t),Y=D&&Ap(t),q=M&&jp(t);return{c:function(){n=sc("li"),e=sc("div"),r=sc("a"),o=dc(j),i=vc(),u=sc("div"),I&&I.c(),a=vc(),C&&C.c(),c=vc(),f=sc("div"),l=sc("button"),s=sc("span"),p=vc(),h=sc("div");for(var v=0;v<L.length;v+=1)L[v].c();m=vc(),z&&z.c(),y=vc(),g=sc("button"),_=sc("i"),$=dc("×"),b=dc(B),w=vc(),Y&&Y.c(),x=vc(),q&&q.c(),k=vc(),O=sc("a"),S=vc(),yc(r,"title",Rl.l10n.edit_booking_details),yc(r,"href",""),yc(e,"class","col mt-1"),yc(s,"class",d="fa-fw "+pp(t[24].status)),yc(l,"type","button"),yc(l,"class","btn btn-default px-2 py-1 dropdown-toggle"),yc(l,"data-toggle","dropdown"),yc(h,"class","dropdown-menu"),yc(f,"class","dropdown d-inline-block"),yc(_,"class","far fa-fw fa-user"),yc(g,"class","btn btn-default px-2 py-1"),kc(g,"opacity","1"),yc(O,"href","#"),yc(O,"class","far fa-fw fa-trash-alt text-danger"),yc(u,"class","ml-auto"),yc(n,"class","row mb-1 bookly-js-popover-container"),Ec(n,"d-none",t[26]>4&&!t[0])},m:function(d,j){cc(d,n,j),ac(n,e),ac(e,r),ac(r,o),ac(n,i),ac(n,u),I&&I.m(u,null),ac(u,a),C&&C.m(u,null),ac(u,c),ac(u,f),ac(f,l),ac(l,s),ac(f,p),ac(f,h);for(var T=0;T<L.length;T+=1)L[T].m(h,null);var P;(ac(u,m),z&&z.m(u,null),ac(u,y),ac(u,g),ac(g,_),ac(g,$),ac(g,b),ac(u,w),Y&&Y.m(u,null),ac(u,x),q&&q.m(u,null),ac(u,k),ac(u,O),ac(n,S),E)||(A=[hc(r,"click",mc((function(){Ga(t[5](t[24]))&&t[5](t[24]).apply(this,arguments)}))),nc(v=hp.call(null,l,Zu(P="".concat(Rl.l10n.status,": ")).call(P,vp(t[24].status)))),hc(g,"click",(function(){Ga(t[6](t[24].id))&&t[6](t[24].id).apply(this,arguments)})),hc(O,"click",mc((function(){Ga(t[12](t[24]))&&t[12](t[24]).apply(this,arguments)}))),nc(hp.call(null,O,Rl.l10n.remove_customer))],E=!0)},p:function(e,r){var i;if(t=e,4&r&&j!==(j=t[24].name+"")&&wc(o,j),4&r&&(T=El("collaborative-services")&&t[24].collaborative_token),T?I?I.p(t,r):((I=kp(t)).c(),I.m(u,a)):I&&(I.d(1),I=null),4&r&&(P=El("compound-services")&&t[24].compound_token),P?C?C.p(t,r):((C=Op(t)).c(),C.m(u,c)):C&&(C.d(1),C=null),4&r&&d!==(d="fa-fw "+pp(t[24].status))&&yc(s,"class",d),v&&Ga(v.update)&&4&r&&v.update.call(null,Zu(i="".concat(Rl.l10n.status,": ")).call(i,vp(t[24].status))),4&r){var f;for(N=Rl.statuses,f=0;f<N.length;f+=1){var l=_p(t,N,f);L[f]?L[f].p(l,r):(L[f]=Sp(l),L[f].c(),L[f].m(h,null))}for(;f<L.length;f+=1)L[f].d(1);L.length=N.length}4&r&&(R=t[24].payment_id||El("pro")),R?z?z.p(t,r):((z=Ep(t)).c(),z.m(u,y)):z&&(z.d(1),z=null),4&r&&B!==(B=t[24].number_of_persons+"")&&wc(b,B),4&r&&(D=El("packages")&&t[24].package_id),D?Y?Y.p(t,r):((Y=Ap(t)).c(),Y.m(u,x)):Y&&(Y.d(1),Y=null),4&r&&(M=El("recurring-appointments")&&t[24].series_id),M?q?q.p(t,r):((q=jp(t)).c(),q.m(u,k)):q&&(q.d(1),q=null),1&r&&Ec(n,"d-none",t[26]>4&&!t[0])},d:function(t){t&&fc(n),I&&I.d(),C&&C.d(),lc(L,t),z&&z.d(),Y&&Y.d(),q&&q.d(),E=!1,Ua(A)}}}function Pp(t){var n,e,r;return{c:function(){(n=sc("span")).textContent="...",yc(n,"class","btn btn-default"),kc(n,"width","100%"),kc(n,"line-height","0"),kc(n,"padding-top","0"),kc(n,"padding-bottom","8px"),kc(n,"margin-bottom","10px"),yc(n,"role","button")},m:function(o,i){cc(o,n,i),e||(r=hc(n,"click",t[15]),e=!0)},p:Fa,d:function(t){t&&fc(n),e=!1,r()}}}function Rp(t){var n,e=Rl.l10n.notices.overflow_capacity.replace("%d",t[4].overflow_capacity)+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:function(t,r){16&r&&e!==(e=Rl.l10n.notices.overflow_capacity.replace("%d",t[4].overflow_capacity)+"")&&wc(n,e)},d:function(t){t&&fc(n)}}}function Bp(t){for(var n,e,r=t[4].customers_appointments_limit,o=[],i=0;i<r.length;i+=1)o[i]=Mp(yp(t,r,i));var u=function(t){return of(o[t],1,1,(function(){o[t]=null}))};return{c:function(){for(var t=0;t<o.length;t+=1)o[t].c();n=pc()},m:function(t,r){for(var i=0;i<o.length;i+=1)o[i].m(t,r);cc(t,n,r),e=!0},p:function(t,e){if(16&e){var i;for(r=t[4].customers_appointments_limit,i=0;i<r.length;i+=1){var a=yp(t,r,i);o[i]?(o[i].p(a,e),rf(o[i],1)):(o[i]=Mp(a),o[i].c(),rf(o[i],1),o[i].m(n.parentNode,n))}for(nf(),i=r.length;i<o.length;i+=1)u(i);ef()}},i:function(t){if(!e){for(var n=0;n<r.length;n+=1)rf(o[n]);e=!0}},o:function(t){o=Oa(o).call(o,Boolean);for(var n=0;n<o.length;n+=1)of(o[n]);e=!1},d:function(t){lc(o,t),t&&fc(n)}}}function Dp(t){var n,e=t[21]+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:function(t,r){16&r&&e!==(e=t[21]+"")&&wc(n,e)},d:function(t){t&&fc(n)}}}function Mp(t){var n,e;return n=new kd({props:{$$slots:{default:[Dp]},$$scope:{ctx:t}}}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},p:function(t,e){var r={};1073741840&e&&(r.$$scope={dirty:e,ctx:t}),n.$set(r)},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Ip(t){for(var n,e,r,o,i,u,a,c,f,l,s,d,v,p=Rl.l10n.customers+"",h=t[1].min>1&&t[1].min>ls(t[2]),m=t[3]&&$p(t),y=t[2].length>5&&bp(t),g=h&&wp(t),_=t[2],$=[],b=0;b<_.length;b+=1)$[b]=Tp(gp(t,_,b));var w=t[2].length>5&&!t[0]&&Pp(t);l=new kd({props:{show:t[4].overflow_capacity>0,type:"danger",$$slots:{default:[Rp]},$$scope:{ctx:t}}});var x=t[4].customers_appointments_limit&&Bp(t);return{c:function(){n=sc("label"),e=dc(p),r=vc(),m&&m.c(),o=vc(),y&&y.c(),i=vc(),g&&g.c(),u=vc(),a=sc("ul");for(var v=0;v<$.length;v+=1)$[v].c();c=vc(),w&&w.c(),f=vc(),ff(l.$$.fragment),s=vc(),x&&x.c(),d=pc(),yc(a,"class","list-unstyled pl-0 bookly-hide-empty mr-3"),Ec(a,"my-0",!t[2].length)},m:function(t,p){cc(t,n,p),ac(n,e),ac(n,r),m&&m.m(n,null),cc(t,o,p),y&&y.m(t,p),cc(t,i,p),g&&g.m(t,p),cc(t,u,p),cc(t,a,p);for(var h=0;h<$.length;h+=1)$[h].m(a,null);cc(t,c,p),w&&w.m(t,p),cc(t,f,p),lf(l,t,p),cc(t,s,p),x&&x.m(t,p),cc(t,d,p),v=!0},p:function(t,e){var r=Wi(e,1)[0];if(t[3]?m?m.p(t,r):((m=$p(t)).c(),m.m(n,null)):m&&(m.d(1),m=null),t[2].length>5?y?y.p(t,r):((y=bp(t)).c(),y.m(i.parentNode,i)):y&&(y.d(1),y=null),6&r&&(h=t[1].min>1&&t[1].min>ls(t[2])),h?g?(g.p(t,r),6&r&&rf(g,1)):((g=wp(t)).c(),rf(g,1),g.m(u.parentNode,u)):g&&(nf(),of(g,1,1,(function(){g=null})),ef()),8165&r){var o;for(_=t[2],o=0;o<_.length;o+=1){var c=gp(t,_,o);$[o]?$[o].p(c,r):($[o]=Tp(c),$[o].c(),$[o].m(a,null))}for(;o<$.length;o+=1)$[o].d(1);$.length=_.length}4&r&&Ec(a,"my-0",!t[2].length),t[2].length>5&&!t[0]?w?w.p(t,r):((w=Pp(t)).c(),w.m(f.parentNode,f)):w&&(w.d(1),w=null);var s={};16&r&&(s.show=t[4].overflow_capacity>0),1073741840&r&&(s.$$scope={dirty:r,ctx:t}),l.$set(s),t[4].customers_appointments_limit?x?(x.p(t,r),16&r&&rf(x,1)):((x=Bp(t)).c(),rf(x,1),x.m(d.parentNode,d)):x&&(nf(),of(x,1,1,(function(){x=null})),ef())},i:function(t){v||(rf(g),rf(l.$$.fragment,t),rf(x),v=!0)},o:function(t){of(g),of(l.$$.fragment,t),of(x),v=!1},d:function(t){t&&fc(n),m&&m.d(),t&&fc(o),y&&y.d(t),t&&fc(i),g&&g.d(t),t&&fc(u),t&&fc(a),lc($,t),t&&fc(c),w&&w.d(t),t&&fc(f),sf(l,t),t&&fc(s),x&&x.d(t),t&&fc(d)}}}function Cp(t,n,e){var r,o,i,a,c,f,l,s,d;Va(t,Os,(function(t){return e(1,r=t)})),Va(t,ts,(function(t){return e(2,o=t)})),Va(t,Pf,(function(t){return e(16,i=t)})),Va(t,is,(function(t){return e(17,a=t)})),Va(t,Cl,(function(t){return e(18,c=t)})),Va(t,Nl,(function(t){return e(3,f=t)})),Va(t,_s,(function(t){return e(19,l=t)})),Va(t,$s,(function(t){return e(20,s=t)})),Va(t,rs,(function(t){return e(4,d=t)}));var v=!1;function p(t){tc(ts,o=Oa(o).call(o,(function(n){return n!==t})),o)}return[v,r,o,f,d,function(t){BooklyCustomerDetailsDialog.showDialog({customer:t,service:Nl.get(),capacity:Math.max(1,r.max-ls(o,t)),done:function(){return ts.set(o)}})},function(t){BooklyCustomerDialog.showDialog({action:"load",customerId:t,onDone:function(t){var n=ds(t);Oa(o).call(o,(function(e){e.id===t.id&&(e.name=n,e.group_id=t.group_id)}));var e=kl(t.id,i.customers);e&&(e.name=n,e.group_id=t.group_id),Pf.set(i),ts.set(o),tc(is,a=!0,a)}})},function(t){if(!t.payment_id||t.payment_action){var n="";if(c&&f){var e=kl(f.id,c.services);null!=e&&e.price&&(n=e.price)}BooklyAttachPaymentDialog.showDialog({customer:t,onlyForCurrent:!(El("recurring-appointments")&&(null===l.id||t.series_id)),price:n,done:function(){return ts.set(o)}})}else BooklyPaymentDetailsDialog.showDialog({customer:t,done:function(){return ts.set(o)}})},function(t){u.default(document.body).trigger("bookly_packages.schedule_dialog",[t.package_id,function(n){xl(n).call(n,Number(t.ca_id))&&p(t),s("refresh")}])},function(t){var n=u.default(".bookly-js-staff-pills li > a.active"),e=n.length?function(){return n.trigger("click")}:function(){return u.default("#bookly-appointments-list").DataTable().ajax.reload()};BooklyCollaborativeDialog.showDialog({collaborative_token:t.collaborative_token,done:e})},function(t){var n=u.default(".bookly-js-staff-pills li > a.active"),e=n.length?function(){return n.trigger("click")}:function(){return u.default("#bookly-appointments-list").DataTable().ajax.reload()};BooklyCompoundDialog.showDialog({compound_token:t.compound_token,done:e})},function(t){var n=u.default(".bookly-js-staff-pills li > a.active"),e=n.length?function(){return n.trigger("click")}:function(){return u.default("#bookly-appointments-list").DataTable().ajax.reload()};BooklySeriesDialog.showDialog({series_id:t.series_id,done:e})},p,function(){return e(0,v=!v)},function(t,n,e,r){return tc(ts,e[r].status=n.id,o)},function(){return e(0,v=!v)}]}var Np=function(t){nn(e,t);var n=mp(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Cp,Ip,Wa,{}),r}return e}(pf);function Lp(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Fp(t,n){var e;if(void 0===Ji||null==mu(t)){if(yu(t)||(e=function(t,n){var e;if(!t)return;if("string"==typeof t)return zp(t,n);var r=pu(e=Object.prototype.toString.call(t)).call(e,8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return oa(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zp(t,n)}(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){e=Si(t)},n:function(){var t=e.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==e.return||e.return()}finally{if(a)throw i}}}}function zp(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}function Yp(t,n,e){var r=pu(t).call(t);return r[12]=n[e],r}function qp(t){var n,e,r,o=t[12].name+"";return{c:function(){n=sc("option"),e=dc(o),n.__value=r=t[12].id,n.value=n.__value},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,i){2&i&&o!==(o=t[12].name+"")&&wc(e,o),2&i&&r!==(r=t[12].id)&&(n.__value=r,n.value=n.__value)},d:function(t){t&&fc(n)}}}function Hp(t){for(var n,e,r,o,i,u,a,c,f,l,s=Rl.l10n.new_customer+"",d=t[1].customers,v=[],p=0;p<d.length;p+=1)v[p]=qp(Yp(t,d,p));return{c:function(){n=sc("div"),e=sc("select");for(var f=0;f<v.length;f+=1)v[f].c();r=vc(),o=sc("div"),i=sc("button"),u=sc("i"),a=vc(),c=dc(s),yc(e,"class","form-control"),yc(e,"data-placeholder",Rl.l10n.search_customers),e.multiple=!0,yc(u,"class","fas fa-fw fa-plus"),yc(i,"class","btn btn-success"),yc(i,"type","button"),yc(o,"class","input-group-append"),yc(n,"class","input-group"),Ec(n,"d-none",t[2])},m:function(s,d){cc(s,n,d),ac(n,e);for(var p=0;p<v.length;p+=1)v[p].m(e,null);t[8](e),ac(n,r),ac(n,o),ac(o,i),ac(i,u),ac(i,a),ac(i,c),f||(l=hc(i,"click",t[3]),f=!0)},p:function(t,r){var o=Wi(r,1)[0];if(2&o){var i;for(d=t[1].customers,i=0;i<d.length;i+=1){var u=Yp(t,d,i);v[i]?v[i].p(u,o):(v[i]=qp(u),v[i].c(),v[i].m(e,null))}for(;i<v.length;i+=1)v[i].d(1);v.length=d.length}4&o&&Ec(n,"d-none",t[2])},i:Fa,o:Fa,d:function(e){e&&fc(n),lc(v,e),t[8](null),f=!1,l()}}}function Up(t,n,e){var r,o,i,a,c,f,l,s,d;function v(){!function(t,n){u.default(t).booklySelect2({theme:"bootstrap4",dropdownParent:"#bookly-appointment-dialog",allowClear:!1,language:{noResults:function(){return Rl.l10n.no_result_found}}}).off().on("booklySelect2:select booklySelect2:unselect",(function(t){return n(Xf(t.params.data.id))}))}(f,(function(t){var n,e=Ol(kl(t,r.customers));cs(e),tc(ts,o=Zu(n=[]).call(n,Gu(o),[e]),o)}))}function p(){!function(t,n,e){u.default(t).booklySelect2({theme:"bootstrap4",dropdownParent:"#bookly-appointment-dialog",allowClear:!1,language:{noResults:function(){return Rl.l10n.no_result_found},searching:function(){return Rl.l10n.searching}},ajax:{url:ajaxurl,dataType:"json",delay:250,data:function(t){return{action:"bookly_get_customers_list",filter:t.term,page:t.page||1,timezone:!0,csrf_token:Al}},processResults:function(t){var n;return e(t),{results:_a(n=t.results).call(n,(function(t){return{id:t.id,text:t.name}})),pagination:t.pagination}}}}).off().on("booklySelect2:selecting",(function(e){e.preventDefault(),n(e.params.args.data.id),u.default(t).booklySelect2("close")}))}(f,(function(t){var n,e=Ol(kl(t,r.customers));cs(e),tc(ts,o=Zu(n=[]).call(n,Gu(o),[e]),o)}),(function(t){var n,e=Fp(t.results);try{for(e.s();!(n=e.n()).done;){var o,i=n.value;if(!kl(i.id,r.customers))tc(Pf,r.customers=Zu(o=[]).call(o,Gu(r.customers),[i]),r)}}catch(t){e.e(t)}finally{e.f()}}))}return Va(t,Pf,(function(t){return e(1,r=t)})),Va(t,ts,(function(t){return e(5,o=t)})),Va(t,is,(function(t){return e(9,i=t)})),Va(t,Nl,(function(t){return e(6,a=t)})),Va(t,Os,(function(t){return e(7,c=t)})),d=function(){if(f&&i){var t=u.default(f).data("booklySelect2");if(t){var n=t.options.options;u.default(f).booklySelect2("destroy"),u.default(f).booklySelect2(n)}tc(is,i=!1,i)}},Mc().$$.after_update.push(d),t.$$.update=function(){2&t.$$.dirty&&e(4,l=r.customers_loaded?"normal":!1===r.customers_loaded?"remote":void 0),17&t.$$.dirty&&f&&("normal"===l?v():"remote"===l&&p()),224&t.$$.dirty&&e(2,s=!El("waiting-list")&&a&&ls(o)>=c.max)},[f,r,s,function(){BooklyCustomerDialog.showDialog({action:"create",onDone:function(t){var n=ds(t);r.customers.push({name:n,group_id:t.group_id,id:t.id,number_of_persons:1,timezone:null});var e={id:t.id,name:n,group_id:t.group_id,number_of_persons:1,timezone:null};cs(e),o.push(e),ts.set(o),Pf.set(r)}})},l,o,a,c,function(t){Nc[t?"unshift":"push"]((function(){e(0,f=t)}))}]}var Gp=function(t){nn(e,t);var n=Lp(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Up,Hp,Wa,{}),r}return e}(pf);function Wp(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Jp(t){for(var n,e,r,o,i,u,a,c,f=t[3]?"…":"",l=t[9].default,s=Qa(l,t,t[8],null),d=[{type:t[0]},{class:i="btn ladda-button "+t[1]},{"data-spinner-size":"40"},{"data-style":"zoom-in"},t[6]],v={},p=0;p<d.length;p+=1)v=Ya(v,d[p]);return{c:function(){n=sc("button"),e=sc("span"),s&&s.c(),r=dc(t[2]),o=dc(f),yc(e,"class","ladda-label"),gc(n,v)},m:function(i,f){cc(i,n,f),ac(n,e),s&&s.m(e,null),ac(e,r),ac(e,o),t[11](n),u=!0,a||(c=[hc(n,"click",t[12]),hc(n,"click",t[10])],a=!0)},p:function(t,e){var a=Wi(e,1)[0];s&&s.p&&256&a&&Xa(s,l,t,t[8],a,null,null),(!u||4&a)&&wc(r,t[2]),(!u||8&a)&&f!==(f=t[3]?"…":"")&&wc(o,f),gc(n,v=function(t,n){for(var e={},r={},o={$$scope:1},i=t.length;i--;){var u=t[i],a=n[i];if(a){for(var c in u)c in a||(r[c]=1);for(var f in a)o[f]||(e[f]=a[f],o[f]=1);t[i]=a}else for(var l in u)o[l]=1}for(var s in r)s in e||(e[s]=void 0);return e}(d,[(!u||1&a)&&{type:t[0]},(!u||2&a&&i!==(i="btn ladda-button "+t[1]))&&{class:i},{"data-spinner-size":"40"},{"data-style":"zoom-in"},64&a&&t[6]]))},i:function(t){u||(rf(s,t),u=!0)},o:function(t){of(s,t),u=!1},d:function(e){e&&fc(n),s&&s.d(e),t[11](null),a=!1,Ua(c)}}}function Vp(t,n,e){var r,o,i,u=["type","class","caption","loading","ellipsis"],a=Za(n,u),c=n,l=c.$$slots,s=void 0===l?{}:l,d=c.$$scope,v=n.type,p=void 0===v?"button":v,h=n.class,m=void 0===h?"btn-default":h,y=n.caption,g=void 0===y?"":y,_=n.loading,$=void 0!==_&&_,b=n.ellipsis,w=void 0!==b&&b;i=function(){return o&&o.remove()},Mc().$$.on_destroy.push(i);return t.$$set=function(t){n=Ya(Ya({},n),function(t){var n={};for(var e in t)"$"!==e[0]&&(n[e]=t[e]);return n}(t)),e(6,a=Za(n,u)),"type"in t&&e(0,p=t.type),"class"in t&&e(1,m=t.class),"caption"in t&&e(2,g=t.caption),"loading"in t&&e(7,$=t.loading),"ellipsis"in t&&e(3,w=t.ellipsis),"$$scope"in t&&e(8,d=t.$$scope)},t.$$.update=function(){144&t.$$.dirty&&o&&($?o.start():o.stop())},[p,m,g,w,o,r,a,$,d,s,function(n){!function(t,n){var e,r=t.$$.callbacks[n.type];r&&uu(e=pu(r).call(r)).call(e,(function(t){return t(n)}))}(t,n)},function(t){Nc[t?"unshift":"push"]((function(){e(5,r=t)}))},function(){return!o&&e(4,o=f.default.create(r))}]}var Qp=function(t){nn(e,t);var n=Wp(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Vp,Jp,Wa,{type:0,class:1,caption:2,loading:7,ellipsis:3}),r}return e}(pf);function Kp(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Xp(t){var n,e=Rl.l10n.notices.date_interval_warning+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function Zp(t){var n,e=Rl.l10n.notices.interval_not_in_staff_schedule+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function th(t){var n,e=Rl.l10n.notices.interval_not_in_service_schedule+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function nh(t){var n;return{c:function(){yc(n=sc("i"),"class","far fa-fw fa-edit mr-1")},m:function(t,e){cc(t,n,e)},d:function(t){t&&fc(n)}}}function eh(t){var n,e,r,o,i,u,a=Rl.l10n.notices.date_interval_not_available+"",c=Rl.l10n.view+"";return(i=new Qp({props:{class:"btn-link btn-sm p-0",caption:t[0].date_interval_not_available.service,$$slots:{default:[nh]},$$scope:{ctx:t}}})).$on("click",t[1]),{c:function(){n=dc(a),e=dc(". "),r=dc(c),o=vc(),ff(i.$$.fragment)},m:function(t,a){cc(t,n,a),cc(t,e,a),cc(t,r,a),cc(t,o,a),lf(i,t,a),u=!0},p:function(t,n){var e={};1&n&&(e.caption=t[0].date_interval_not_available.service),4&n&&(e.$$scope={dirty:n,ctx:t}),i.$set(e)},i:function(t){u||(rf(i.$$.fragment,t),u=!0)},o:function(t){of(i.$$.fragment,t),u=!1},d:function(t){t&&fc(n),t&&fc(e),t&&fc(r),t&&fc(o),sf(i,t)}}}function rh(t){var n,e=Rl.l10n.notices.staff_reaches_working_time_limit+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function oh(t){var n,e=Rl.l10n.notices.no_timeslots_available+"";return{c:function(){n=dc(e)},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function ih(t){var n,e,r,o,i,u,a,c,f,l,s,d;return n=new kd({props:{show:t[0].date_interval_warning,class:"mt-n2",$$slots:{default:[Xp]},$$scope:{ctx:t}}}),r=new kd({props:{show:t[0].interval_not_in_staff_schedule,class:"mt-n2",$$slots:{default:[Zp]},$$scope:{ctx:t}}}),i=new kd({props:{show:t[0].interval_not_in_service_schedule,class:"mt-n2",$$slots:{default:[th]},$$scope:{ctx:t}}}),a=new kd({props:{show:t[0].date_interval_not_available,class:"mt-n2",$$slots:{default:[eh]},$$scope:{ctx:t}}}),f=new kd({props:{show:t[0].staff_reaches_working_time_limit,class:"mt-n2",$$slots:{default:[rh]},$$scope:{ctx:t}}}),s=new kd({props:{show:t[0].no_timeslots_available,class:"mt-n2",$$slots:{default:[oh]},$$scope:{ctx:t}}}),{c:function(){ff(n.$$.fragment),e=vc(),ff(r.$$.fragment),o=vc(),ff(i.$$.fragment),u=vc(),ff(a.$$.fragment),c=vc(),ff(f.$$.fragment),l=vc(),ff(s.$$.fragment)},m:function(t,v){lf(n,t,v),cc(t,e,v),lf(r,t,v),cc(t,o,v),lf(i,t,v),cc(t,u,v),lf(a,t,v),cc(t,c,v),lf(f,t,v),cc(t,l,v),lf(s,t,v),d=!0},p:function(t,e){var o=Wi(e,1)[0],u={};1&o&&(u.show=t[0].date_interval_warning),4&o&&(u.$$scope={dirty:o,ctx:t}),n.$set(u);var c={};1&o&&(c.show=t[0].interval_not_in_staff_schedule),4&o&&(c.$$scope={dirty:o,ctx:t}),r.$set(c);var l={};1&o&&(l.show=t[0].interval_not_in_service_schedule),4&o&&(l.$$scope={dirty:o,ctx:t}),i.$set(l);var d={};1&o&&(d.show=t[0].date_interval_not_available),5&o&&(d.$$scope={dirty:o,ctx:t}),a.$set(d);var v={};1&o&&(v.show=t[0].staff_reaches_working_time_limit),4&o&&(v.$$scope={dirty:o,ctx:t}),f.$set(v);var p={};1&o&&(p.show=t[0].no_timeslots_available),4&o&&(p.$$scope={dirty:o,ctx:t}),s.$set(p)},i:function(t){d||(rf(n.$$.fragment,t),rf(r.$$.fragment,t),rf(i.$$.fragment,t),rf(a.$$.fragment,t),rf(f.$$.fragment,t),rf(s.$$.fragment,t),d=!0)},o:function(t){of(n.$$.fragment,t),of(r.$$.fragment,t),of(i.$$.fragment,t),of(a.$$.fragment,t),of(f.$$.fragment,t),of(s.$$.fragment,t),d=!1},d:function(t){sf(n,t),t&&fc(e),sf(r,t),t&&fc(o),sf(i,t),t&&fc(u),sf(a,t),t&&fc(c),sf(f,t),t&&fc(l),sf(s,t)}}}function uh(t,n,e){var r;Va(t,rs,(function(t){return e(0,r=t)}));return[r,function(){return BooklyAppointmentDialog.showDialog(r.date_interval_not_available.appointment_id,null,null,(function(){}))}]}var ah=function(t){nn(e,t);var n=Kp(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,uh,ih,Wa,{}),r}return e}(pf);function ch(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function fh(t){var n,e,r,o,i,u;return{c:function(){n=sc("div"),e=sc("input"),r=vc(),(o=sc("label")).textContent="".concat(Rl.l10n.skip_date),yc(e,"type","checkbox"),yc(e,"id","bookly-skip-date"),yc(e,"class","custom-control-input"),yc(o,"for","bookly-skip-date"),yc(o,"class","custom-control-label"),yc(n,"class","custom-control custom-checkbox mb-2")},m:function(a,c){cc(a,n,c),ac(n,e),e.checked=t[0],ac(n,r),ac(n,o),i||(u=hc(e,"change",t[1]),i=!0)},p:function(t,n){1&Wi(n,1)[0]&&(e.checked=t[0])},i:Fa,o:Fa,d:function(t){t&&fc(n),i=!1,u()}}}function lh(t,n,e){var r;return Va(t,ql,(function(t){return e(0,r=t)})),[r,function(){r=this.checked,ql.set(r)}]}var sh=function(t){nn(e,t);var n=ch(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,lh,fh,Wa,{}),r}return e}(pf);function dh(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function vh(t){var n,e,r,o;function i(t,n){return t[1]&&t[1].url?hh:ph}var u=i(t),a=u(t);return{c:function(){n=sc("div"),(e=sc("label")).textContent="".concat(Rl.l10n.online_meeting),r=vc(),o=sc("div"),a.c(),yc(n,"class","form-group")},m:function(i,u){cc(i,n,u),ac(n,e),ac(n,r),ac(n,o),a.m(o,null),t[4](n)},p:function(t,n){u===(u=i(t))&&a?a.p(t,n):(a.d(1),(a=u(t))&&(a.c(),a.m(o,null)))},d:function(e){e&&fc(n),a.d(),t[4](null)}}}function ph(t){var n;return{c:function(){(n=sc("small")).textContent="".concat(Rl.l10n.meeting_create),yc(n,"class","text-muted")},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function hh(t){var n,e,r,o,i,u,a,c,f,l=t[1].url+"";function s(t,n){return t[1].copied?yh:mh}var d=s(t),v=d(t);return{c:function(){n=sc("div"),e=sc("a"),r=dc(l),i=vc(),u=sc("i"),a=vc(),v.c(),c=vc(),(f=sc("small")).textContent="".concat(Rl.l10n.meeting_code),yc(e,"href",o=t[1].url),yc(e,"target","_blank"),yc(e,"class","text-truncate"),yc(u,"class","fas fa-external-link-alt fa-fw fa-sm text-muted ml-1 mr-2"),yc(n,"class","btn btn-default disabled d-flex align-items-center"),kc(n,"opacity","1"),kc(n,"cursor","default"),yc(f,"class","text-muted")},m:function(t,o){cc(t,n,o),ac(n,e),ac(e,r),ac(n,i),ac(n,u),ac(n,a),v.m(n,null),cc(t,c,o),cc(t,f,o)},p:function(t,i){2&i&&l!==(l=t[1].url+"")&&wc(r,l),2&i&&o!==(o=t[1].url)&&yc(e,"href",o),d===(d=s(t))&&v?v.p(t,i):(v.d(1),(v=d(t))&&(v.c(),v.m(n,null)))},d:function(t){t&&fc(n),v.d(),t&&fc(c),t&&fc(f)}}}function mh(t){var n,e,r;return{c:function(){yc(n=sc("a"),"class","far fa-copy fa-fw text-secondary text-decoration-none ml-auto"),yc(n,"href",""),yc(n,"title",Rl.l10n.copy_to_clipboard)},m:function(o,i){cc(o,n,i),e||(r=hc(n,"click",mc(t[3])),e=!0)},p:Fa,d:function(t){t&&fc(n),e=!1,r()}}}function yh(t){var n;return{c:function(){(n=sc("small")).textContent="".concat(Rl.l10n.copied),yc(n,"class","text-muted ml-auto")},m:function(t,e){cc(t,n,e)},p:Fa,d:function(t){t&&fc(n)}}}function gh(t){var n,e=(t[1]&&t[1].url||t[2]&&t[2].id&&"off"!==t[2].online_meetings)&&vh(t);return{c:function(){e&&e.c(),n=pc()},m:function(t,r){e&&e.m(t,r),cc(t,n,r)},p:function(t,r){var o=Wi(r,1)[0];t[1]&&t[1].url||t[2]&&t[2].id&&"off"!==t[2].online_meetings?e?e.p(t,o):((e=vh(t)).c(),e.m(n.parentNode,n)):e&&(e.d(1),e=null)},i:Fa,o:Fa,d:function(t){e&&e.d(t),t&&fc(n)}}}function _h(t,n,e){var r,o,i;return Va(t,zl,(function(t){return e(1,r=t)})),Va(t,Nl,(function(t){return e(2,o=t)})),[i,r,o,function(){var t=document.createElement("textarea");t.textContent=r.url,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",i.appendChild(t),t.select(),t.setSelectionRange(0,99999),document.execCommand("copy"),i.removeChild(t),tc(zl,r.copied=!0,r),Mf((function(){tc(zl,r.copied=!1,r)}),1e3)},function(t){Nc[t?"unshift":"push"]((function(){e(0,i=t)}))}]}var $h=function(t){nn(e,t);var n=dh(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,_h,gh,Wa,{}),r}return e}(pf);function bh(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function wh(t){var n,e,r,o,i;return{c:function(){(n=sc("label")).textContent="".concat(Rl.l10n.internal_note),e=vc(),r=sc("textarea"),yc(n,"for","bookly-internal-note"),yc(r,"class","form-control"),yc(r,"id","bookly-internal-note")},m:function(u,a){cc(u,n,a),cc(u,e,a),cc(u,r,a),xc(r,t[0]),o||(i=hc(r,"input",t[1]),o=!0)},p:function(t,n){1&Wi(n,1)[0]&&xc(r,t[0])},i:Fa,o:Fa,d:function(t){t&&fc(n),t&&fc(e),t&&fc(r),o=!1,i()}}}function xh(t,n,e){var r;return Va(t,ns,(function(t){return e(0,r=t)})),[r,function(){r=this.value,ns.set(r)}]}var kh=function(t){nn(e,t);var n=bh(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,xh,wh,Wa,{}),r}return e}(pf);function Oh(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Sh(t){var n,e,r,o,i,u;return{c:function(){n=sc("div"),e=sc("input"),r=vc(),(o=sc("label")).textContent="".concat(Rl.l10n.send_notifications),yc(e,"type","checkbox"),yc(e,"id","bookly-send-notifications"),yc(e,"class","custom-control-input"),yc(o,"for","bookly-send-notifications"),yc(o,"class","custom-control-label"),yc(n,"class","custom-control custom-checkbox mb-2")},m:function(a,c){cc(a,n,c),ac(n,e),e.checked=t[0],ac(n,r),ac(n,o),i||(u=hc(e,"change",t[1]),i=!0)},p:function(t,n){1&Wi(n,1)[0]&&(e.checked=t[0])},i:Fa,o:Fa,d:function(t){t&&fc(n),i=!1,u()}}}function Eh(t,n,e){var r;return Va(t,es,(function(t){return e(0,r=t)})),null===r&&tc(es,r="1"===Rl.send_notifications,r),[r,function(){r=this.checked,es.set(r)}]}var Ah=function(t){nn(e,t);var n=Oh(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Eh,Sh,Wa,{}),r}return e}(pf);function jh(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Th(t){var n,e,r,o,i,u,a=El("locations"),c=El("tasks"),f=t[0]&&null===t[0].id&&Ph();e=new $h({});var l=a&&function(t){var n,e,r;return e=new ov({}),{c:function(){n=sc("div"),ff(e.$$.fragment),yc(n,"class","form-group")},m:function(t,o){cc(t,n,o),lf(e,n,null),r=!0},i:function(t){r||(rf(e.$$.fragment,t),r=!0)},o:function(t){of(e.$$.fragment,t),r=!1},d:function(t){t&&fc(n),sf(e)}}}(),s=c&&function(t){var n,e;return n=new sh({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}();return{c:function(){f&&f.c(),n=vc(),ff(e.$$.fragment),r=vc(),l&&l.c(),o=vc(),s&&s.c(),i=pc()},m:function(t,a){f&&f.m(t,a),cc(t,n,a),lf(e,t,a),cc(t,r,a),l&&l.m(t,a),cc(t,o,a),s&&s.m(t,a),cc(t,i,a),u=!0},p:function(t,e){t[0]&&null===t[0].id?f?1&e&&rf(f,1):((f=Ph()).c(),rf(f,1),f.m(n.parentNode,n)):f&&(nf(),of(f,1,1,(function(){f=null})),ef())},i:function(t){u||(rf(f),rf(e.$$.fragment,t),rf(l),rf(s),u=!0)},o:function(t){of(f),of(e.$$.fragment,t),of(l),of(s),u=!1},d:function(t){f&&f.d(t),t&&fc(n),sf(e,t),t&&fc(r),l&&l.d(t),t&&fc(o),s&&s.d(t),t&&fc(i)}}}function Ph(t){var n,e;return n=new Xd({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Rh(t){var n,e,r,o,i,u,a,c;r=new cv({});var f=(!t[0]||!1==(t[0].duration>=86400&&1===t[0].units_max))&&Bh();return a=new ah({}),{c:function(){n=sc("div"),e=sc("div"),ff(r.$$.fragment),o=vc(),i=sc("div"),f&&f.c(),u=vc(),ff(a.$$.fragment),yc(e,"class","col-sm-4 form-group"),yc(i,"class","col-sm-8 form-group"),yc(n,"class","form-row")},m:function(t,l){cc(t,n,l),ac(n,e),lf(r,e,null),ac(n,o),ac(n,i),f&&f.m(i,null),cc(t,u,l),lf(a,t,l),c=!0},p:function(t,n){t[0]&&!1!=(t[0].duration>=86400&&1===t[0].units_max)?f&&(nf(),of(f,1,1,(function(){f=null})),ef()):f?1&n&&rf(f,1):((f=Bh()).c(),rf(f,1),f.m(i,null))},i:function(t){c||(rf(r.$$.fragment,t),rf(f),rf(a.$$.fragment,t),c=!0)},o:function(t){of(r.$$.fragment,t),of(f),of(a.$$.fragment,t),c=!1},d:function(t){t&&fc(n),sf(r),f&&f.d(),t&&fc(u),sf(a,t)}}}function Bh(t){var n,e;return n=new gv({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Dh(t){var n,e,r;return e=new dp({}),{c:function(){n=sc("div"),ff(e.$$.fragment),yc(n,"class","mb-2")},m:function(t,o){cc(t,n,o),lf(e,n,null),r=!0},i:function(t){r||(rf(e.$$.fragment,t),r=!0)},o:function(t){of(e.$$.fragment,t),r=!1},d:function(t){t&&fc(n),sf(e)}}}function Mh(t){var n,e,r,o,i,u,a,c,f,l,s,d,v,p,h,m,y,g,_=El("pro"),$=El("recurring-appointments")&&null===t[2].id&&!t[1],b=Rl.service_main&&function(t){var n,e,r;return e=new Wd({}),{c:function(){n=sc("div"),ff(e.$$.fragment),yc(n,"class","form-group")},m:function(t,o){cc(t,n,o),lf(e,n,null),r=!0},i:function(t){r||(rf(e.$$.fragment,t),r=!0)},o:function(t){of(e.$$.fragment,t),r=!1},d:function(t){t&&fc(n),sf(e)}}}();r=new Id({});var w=!Rl.service_main&&function(t){var n,e,r;return e=new Wd({}),{c:function(){n=sc("div"),ff(e.$$.fragment),yc(n,"class","form-group")},m:function(t,o){cc(t,n,o),lf(e,n,null),r=!0},i:function(t){r||(rf(e.$$.fragment,t),r=!0)},o:function(t){of(e.$$.fragment,t),r=!1},d:function(t){t&&fc(n),sf(e)}}}(),x=_&&Th(t),k=!t[1]&&Rh(t),O=$&&Dh();return l=new Np({}),d=new Gp({}),h=new kh({}),y=new Ah({}),{c:function(){b&&b.c(),n=vc(),e=sc("div"),ff(r.$$.fragment),o=vc(),w&&w.c(),i=vc(),x&&x.c(),u=vc(),k&&k.c(),a=vc(),O&&O.c(),c=vc(),f=sc("div"),ff(l.$$.fragment),s=vc(),ff(d.$$.fragment),v=vc(),p=sc("div"),ff(h.$$.fragment),m=vc(),ff(y.$$.fragment),yc(e,"class","form-group"),yc(f,"class","form-group"),yc(p,"class","form-group")},m:function(t,_){b&&b.m(t,_),cc(t,n,_),cc(t,e,_),lf(r,e,null),cc(t,o,_),w&&w.m(t,_),cc(t,i,_),x&&x.m(t,_),cc(t,u,_),k&&k.m(t,_),cc(t,a,_),O&&O.m(t,_),cc(t,c,_),cc(t,f,_),lf(l,f,null),ac(f,s),lf(d,f,null),cc(t,v,_),cc(t,p,_),lf(h,p,null),cc(t,m,_),lf(y,t,_),g=!0},p:function(t,n){var e=Wi(n,1)[0];_&&x.p(t,e),t[1]?k&&(nf(),of(k,1,1,(function(){k=null})),ef()):k?(k.p(t,e),2&e&&rf(k,1)):((k=Rh(t)).c(),rf(k,1),k.m(a.parentNode,a)),6&e&&($=El("recurring-appointments")&&null===t[2].id&&!t[1]),$?O?6&e&&rf(O,1):((O=Dh()).c(),rf(O,1),O.m(c.parentNode,c)):O&&(nf(),of(O,1,1,(function(){O=null})),ef())},i:function(t){g||(rf(b),rf(r.$$.fragment,t),rf(w),rf(x),rf(k),rf(O),rf(l.$$.fragment,t),rf(d.$$.fragment,t),rf(h.$$.fragment,t),rf(y.$$.fragment,t),g=!0)},o:function(t){of(b),of(r.$$.fragment,t),of(w),of(x),of(k),of(O),of(l.$$.fragment,t),of(d.$$.fragment,t),of(h.$$.fragment,t),of(y.$$.fragment,t),g=!1},d:function(t){b&&b.d(t),t&&fc(n),t&&fc(e),sf(r),t&&fc(o),w&&w.d(t),t&&fc(i),x&&x.d(t),t&&fc(u),k&&k.d(t),t&&fc(a),O&&O.d(t),t&&fc(c),t&&fc(f),sf(l),sf(d),t&&fc(v),t&&fc(p),sf(h),t&&fc(m),sf(y,t)}}}function Ih(t,n,e){var r,o,i;return Va(t,Nl,(function(t){return e(0,r=t)})),Va(t,ql,(function(t){return e(1,o=t)})),Va(t,_s,(function(t){return e(2,i=t)})),[r,o,i]}var Ch=function(t){nn(e,t);var n=jh(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Ih,Mh,Wa,{}),r}return e}(pf),Nh=Tf(0),Lh=Of([Bs,Nh],(function(t){var n=Wi(t,2),e=n[0],r=n[1];return e?pu(e).call(e,10*r,10*(r+1)):[]})),Fh=Of([Bs],(function(t){var n=Wi(t,1)[0];return n?Math.ceil(n.length/10):0}));function zh(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Yh(t){var n;return{c:function(){yc(n=sc("input"),"autocomplete","off"),yc(n,"class","form-control"),yc(n,"type","text")},m:function(e,r){cc(e,n,r),t[4](n)},p:Fa,i:Fa,o:Fa,d:function(e){e&&fc(n),t[4](null)}}}function qh(t,n,e){var r,o,i,a=n.item;return i=moment(a.date),Ic((function(){return e(2,o=u.default(r).daterangepicker({parentEl:"#bookly-appointment-dialog > div",singleDatePicker:!0,showDropdowns:!0,locale:Rl.datePicker},(function(t){e(1,a.date=t.format("YYYY-MM-DD"),a),rd(a)})))})),t.$$set=function(t){"item"in t&&e(1,a=t.item)},t.$$.update=function(){12&t.$$.dirty&&i&&o&&(o.data("daterangepicker").setStartDate(i),o.data("daterangepicker").setEndDate(i))},[r,a,o,i,function(t){Nc[t?"unshift":"push"]((function(){e(0,r=t)}))}]}var Hh=function(t){nn(e,t);var n=zh(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,qh,Yh,Wa,{item:1}),r}return e}(pf);function Uh(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Gh(t,n,e){var r=pu(t).call(t);return r[4]=n[e],r}function Wh(t){var n,e,r,o,i=t[4].title+"";return{c:function(){n=sc("option"),e=dc(i),n.__value=r=t[4].value,n.value=n.__value,n.disabled=o=t[4].disabled},m:function(t,r){cc(t,n,r),ac(n,e)},p:function(t,u){2&u&&i!==(i=t[4].title+"")&&wc(e,i),2&u&&r!==(r=t[4].value)&&(n.__value=r,n.value=n.__value),2&u&&o!==(o=t[4].disabled)&&(n.disabled=o)},d:function(t){t&&fc(n)}}}function Jh(t){for(var n,e,r,o=t[1],i=[],u=0;u<o.length;u+=1)i[u]=Wh(Gh(t,o,u));return{c:function(){n=sc("select");for(var e=0;e<i.length;e+=1)i[e].c();yc(n,"class","form-control custom-select"),void 0===t[0].slots&&Uc((function(){return t[3].call(n)}))},m:function(o,u){cc(o,n,u);for(var a=0;a<i.length;a+=1)i[a].m(n,null);Oc(n,t[0].slots),e||(r=[hc(n,"change",t[3]),hc(n,"change",(function(){Ga(t[2](t[0]))&&t[2](t[0]).apply(this,arguments)}))],e=!0)},p:function(e,r){var u=Wi(r,1)[0];if(t=e,2&u){var a;for(o=t[1],a=0;a<o.length;a+=1){var c=Gh(t,o,a);i[a]?i[a].p(c,u):(i[a]=Wh(c),i[a].c(),i[a].m(n,null))}for(;a<i.length;a+=1)i[a].d(1);i.length=o.length}3&u&&Oc(n,t[0].slots)},i:Fa,o:Fa,d:function(t){t&&fc(n),lc(i,t),e=!1,Ua(r)}}}function Vh(t,n,e){var r;Va(t,Ts,(function(t){return e(1,r=t)}));var o=n.item;return t.$$set=function(t){"item"in t&&e(0,o=t.item)},[o,r,function(){e(0,o.options=Oa(r).call(r,(function(t){return t.value===o.slots})),o)},function(){o.slots=Sc(this),e(0,o)}]}var Qh=function(t){nn(e,t);var n=Uh(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Vh,Jh,Wa,{item:0}),r}return e}(pf);function Kh(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Xh(t){var n,e,r,o;function i(n){t[2](n)}var u={};return void 0!==t[0]&&(u.item=t[0]),e=new Hh({props:u}),Nc.push((function(){return cf(e,"item",i)})),{c:function(){n=sc("div"),ff(e.$$.fragment),yc(n,"class","col-sm-4")},m:function(t,r){cc(t,n,r),lf(e,n,null),o=!0},p:function(t,n){var o={};!r&&1&n&&(r=!0,o.item=t[0],Gc((function(){return r=!1}))),e.$set(o)},i:function(t){o||(rf(e.$$.fragment,t),o=!0)},o:function(t){of(e.$$.fragment,t),o=!1},d:function(t){t&&fc(n),sf(e)}}}function Zh(t){var n,e,r,o;function i(n){t[3](n)}var u={};return void 0!==t[0]&&(u.item=t[0]),e=new Qh({props:u}),Nc.push((function(){return cf(e,"item",i)})),{c:function(){n=sc("div"),ff(e.$$.fragment),yc(n,"class","col-sm-3")},m:function(t,r){cc(t,n,r),lf(e,n,null),o=!0},p:function(t,n){var o={};!r&&1&n&&(r=!0,o.item=t[0],Gc((function(){return r=!1}))),e.$set(o)},i:function(t){o||(rf(e.$$.fragment,t),o=!0)},o:function(t){of(e.$$.fragment,t),o=!1},d:function(t){t&&fc(n),sf(e)}}}function tm(t){var n,e,r,o,i,u,a,c,f,l,s,d,v=Ns(t[0].date)+"",p=Ls(t[0].slots,t[0].options)+"",h=t[0].all_day_service_time+"",m=t[1]===t[0].index&&Xh(t),y=t[1]===t[0].index&&Zh(t);return{c:function(){n=sc("div"),e=dc(v),r=vc(),m&&m.c(),o=vc(),i=sc("div"),u=dc(p),a=vc(),c=sc("div"),f=dc(h),l=vc(),y&&y.c(),s=pc(),yc(n,"class","col-sm-3"),Ec(n,"d-none",t[0].deleted||t[1]===t[0].index),yc(i,"class","col-sm-2"),Ec(i,"d-none",t[0].all_day_service_time||t[0].deleted||t[1]===t[0].index),yc(c,"class","col-sm-2"),Ec(c,"d-none",!t[0].all_day_service_time)},m:function(t,v){cc(t,n,v),ac(n,e),cc(t,r,v),m&&m.m(t,v),cc(t,o,v),cc(t,i,v),ac(i,u),cc(t,a,v),cc(t,c,v),ac(c,f),cc(t,l,v),y&&y.m(t,v),cc(t,s,v),d=!0},p:function(t,r){var a=Wi(r,1)[0];(!d||1&a)&&v!==(v=Ns(t[0].date)+"")&&wc(e,v),3&a&&Ec(n,"d-none",t[0].deleted||t[1]===t[0].index),t[1]===t[0].index?m?(m.p(t,a),3&a&&rf(m,1)):((m=Xh(t)).c(),rf(m,1),m.m(o.parentNode,o)):m&&(nf(),of(m,1,1,(function(){m=null})),ef()),(!d||1&a)&&p!==(p=Ls(t[0].slots,t[0].options)+"")&&wc(u,p),3&a&&Ec(i,"d-none",t[0].all_day_service_time||t[0].deleted||t[1]===t[0].index),(!d||1&a)&&h!==(h=t[0].all_day_service_time+"")&&wc(f,h),1&a&&Ec(c,"d-none",!t[0].all_day_service_time),t[1]===t[0].index?y?(y.p(t,a),3&a&&rf(y,1)):((y=Zh(t)).c(),rf(y,1),y.m(s.parentNode,s)):y&&(nf(),of(y,1,1,(function(){y=null})),ef())},i:function(t){d||(rf(m),rf(y),d=!0)},o:function(t){of(m),of(y),d=!1},d:function(t){t&&fc(n),t&&fc(r),m&&m.d(t),t&&fc(o),t&&fc(i),t&&fc(a),t&&fc(c),t&&fc(l),y&&y.d(t),t&&fc(s)}}}function nm(t,n,e){var r;Va(t,Rs,(function(t){return e(1,r=t)}));var o=n.item;return t.$$set=function(t){"item"in t&&e(0,o=t.item)},[o,r,function(t){e(0,o=t)},function(t){e(0,o=t)}]}var em=function(t){nn(e,t);var n=Kh(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,nm,tm,Wa,{item:0}),r}return e}(pf);function rm(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function om(t){var n,e,r;return{c:function(){yc(n=sc("a"),"href",""),yc(n,"class","fas fa-fw fa-check text-decoration-none"),yc(n,"title",Rl.l10n.recurring.apply),Ec(n,"d-none",t[1]!==t[0].index)},m:function(o,i){cc(o,n,i),e||(r=hc(n,"click",mc(t[2])),e=!0)},p:function(t,e){3&Wi(e,1)[0]&&Ec(n,"d-none",t[1]!==t[0].index)},i:Fa,o:Fa,d:function(t){t&&fc(n),e=!1,r()}}}function im(t,n,e){var r;Va(t,Rs,(function(t){return e(1,r=t)}));var o=n.item;return t.$$set=function(t){"item"in t&&e(0,o=t.item)},[o,r,function(){return tc(Rs,r=0,r)}]}var um=function(t){nn(e,t);var n=rm(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,im,om,Wa,{item:0}),r}return e}(pf);function am(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function cm(t){var n,e,r;return{c:function(){yc(n=sc("a"),"href",""),yc(n,"class","far fa-fw fa-trash-alt text-danger"),yc(n,"title",Rl.l10n.recurring.delete)},m:function(o,i){cc(o,n,i),e||(r=hc(n,"click",mc(t[1])),e=!0)},p:Fa,i:Fa,o:Fa,d:function(t){t&&fc(n),e=!1,r()}}}function fm(t,n,e){var r=n.item;return t.$$set=function(t){"item"in t&&e(0,r=t.item)},[r,function(){return e(0,r.deleted=!0,r)}]}var lm=function(t){nn(e,t);var n=am(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,fm,cm,Wa,{item:0}),r}return e}(pf);function sm(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function dm(t){var n,e,r;return{c:function(){yc(n=sc("a"),"href",""),yc(n,"class","far fa-fw fa-edit text-decoration-none"),yc(n,"title",Rl.l10n.recurring.edit)},m:function(o,i){cc(o,n,i),e||(r=hc(n,"click",mc(t[2])),e=!0)},p:Fa,i:Fa,o:Fa,d:function(t){t&&fc(n),e=!1,r()}}}function vm(t,n,e){var r;Va(t,Rs,(function(t){return e(1,r=t)}));var o=n.item;return t.$$set=function(t){"item"in t&&e(0,o=t.item)},[o,r,function(){rd(o),tc(Rs,r=o.index,r)}]}var pm=function(t){nn(e,t);var n=sm(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,vm,dm,Wa,{item:0}),r}return e}(pf);function hm(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function mm(t){var n,e,r,o;return{c:function(){n=sc("a"),yc(e=sc("span"),"class","fas fa-fw fa-undo"),yc(n,"href",""),yc(n,"class","text-muted"),yc(n,"title",Rl.l10n.recurring.restore)},m:function(i,u){cc(i,n,u),ac(n,e),r||(o=hc(n,"click",mc(t[1])),r=!0)},p:Fa,i:Fa,o:Fa,d:function(t){t&&fc(n),r=!1,o()}}}function ym(t,n,e){var r=n.item;return t.$$set=function(t){"item"in t&&e(0,r=t.item)},[r,function(){return e(0,r.deleted=!1,r)}]}var gm=function(t){nn(e,t);var n=hm(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,ym,mm,Wa,{item:0}),r}return e}(pf);function _m(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function $m(t){var n,e,r,o,i,u,a,c,f,l,s,d,v,p,h,m,y,g,_,$,b,w,x,k,O,S,E,A,j,T,P=t[0].index+"",R=Rl.l10n.recurring.another_time+"";function B(n){t[2](n)}var D={};function M(n){t[3](n)}void 0!==t[0]&&(D.item=t[0]),l=new gm({props:D}),Nc.push((function(){return cf(l,"item",B)})),v=new em({props:{item:t[0]}});var I={};function C(n){t[4](n)}void 0!==t[0]&&(I.item=t[0]),b=new pm({props:I}),Nc.push((function(){return cf(b,"item",M)}));var N={};function L(n){t[5](n)}void 0!==t[0]&&(N.item=t[0]),k=new lm({props:N}),Nc.push((function(){return cf(k,"item",C)}));var F={};return void 0!==t[0]&&(F.item=t[0]),A=new um({props:F}),Nc.push((function(){return cf(A,"item",L)})),{c:function(){n=sc("li"),e=sc("div"),r=sc("div"),o=sc("b"),i=dc(P),u=vc(),(a=sc("div")).textContent="".concat(Rl.l10n.recurring.deleted),c=vc(),f=sc("div"),ff(l.$$.fragment),d=vc(),ff(v.$$.fragment),p=vc(),h=sc("div"),m=sc("span"),y=sc("span"),g=dc(R),_=vc(),$=sc("div"),ff(b.$$.fragment),x=vc(),ff(k.$$.fragment),S=vc(),E=sc("div"),ff(A.$$.fragment),yc(r,"class","col-sm-1"),yc(a,"class","col-sm-10 text-muted"),Ec(a,"d-none",!t[0].deleted),yc(f,"class","col-sm-1 text-right"),Ec(f,"d-none",!0!==t[0].deleted),yc(y,"class","fas fa-fw fa-exclamation-triangle text-warning mr-1"),Ec(m,"d-none",!t[0].another_time),yc(h,"class","col-sm-4"),Ec(h,"d-none",t[0].deleted||t[1]===t[0].index),yc($,"class","col-sm-2 text-right"),Ec($,"d-none",t[0].deleted||t[1]===t[0].index),yc(E,"class","col-sm-4 text-right"),Ec(E,"d-none",t[1]!==t[0].index),yc(e,"class","row"),yc(n,"class","list-group-item")},m:function(t,s){cc(t,n,s),ac(n,e),ac(e,r),ac(r,o),ac(o,i),ac(e,u),ac(e,a),ac(e,c),ac(e,f),lf(l,f,null),ac(e,d),lf(v,e,null),ac(e,p),ac(e,h),ac(h,m),ac(m,y),ac(m,g),ac(e,_),ac(e,$),lf(b,$,null),ac($,x),lf(k,$,null),ac(e,S),ac(e,E),lf(A,E,null),T=!0},p:function(t,n){var e=Wi(n,1)[0];(!T||1&e)&&P!==(P=t[0].index+"")&&wc(i,P),1&e&&Ec(a,"d-none",!t[0].deleted);var r={};!s&&1&e&&(s=!0,r.item=t[0],Gc((function(){return s=!1}))),l.$set(r),1&e&&Ec(f,"d-none",!0!==t[0].deleted);var o={};1&e&&(o.item=t[0]),v.$set(o),1&e&&Ec(m,"d-none",!t[0].another_time),3&e&&Ec(h,"d-none",t[0].deleted||t[1]===t[0].index);var u={};!w&&1&e&&(w=!0,u.item=t[0],Gc((function(){return w=!1}))),b.$set(u);var c={};!O&&1&e&&(O=!0,c.item=t[0],Gc((function(){return O=!1}))),k.$set(c),3&e&&Ec($,"d-none",t[0].deleted||t[1]===t[0].index);var d={};!j&&1&e&&(j=!0,d.item=t[0],Gc((function(){return j=!1}))),A.$set(d),3&e&&Ec(E,"d-none",t[1]!==t[0].index)},i:function(t){T||(rf(l.$$.fragment,t),rf(v.$$.fragment,t),rf(b.$$.fragment,t),rf(k.$$.fragment,t),rf(A.$$.fragment,t),T=!0)},o:function(t){of(l.$$.fragment,t),of(v.$$.fragment,t),of(b.$$.fragment,t),of(k.$$.fragment,t),of(A.$$.fragment,t),T=!1},d:function(t){t&&fc(n),sf(l),sf(v),sf(b),sf(k),sf(A)}}}function bm(t,n,e){var r;Va(t,Rs,(function(t){return e(1,r=t)}));var o=n.item;return t.$$set=function(t){"item"in t&&e(0,o=t.item)},[o,r,function(t){e(0,o=t)},function(t){e(0,o=t)},function(t){e(0,o=t)},function(t){e(0,o=t)}]}var wm=function(t){nn(e,t);var n=_m(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,bm,$m,Wa,{item:0}),r}return e}(pf);function xm(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function km(t,n,e){var r=pu(t).call(t);return r[5]=n[e],r[7]=e,r}function Om(t){var n,e,r,o,i,u=t[7]+1+"";function a(){return t[3](t[7])}return{c:function(){n=sc("li"),e=sc("a"),r=dc(u),yc(e,"href",""),yc(e,"class","page-link"),yc(n,"class","page-item"),Ec(n,"active",t[7]===t[1])},m:function(t,u){cc(t,n,u),ac(n,e),ac(e,r),o||(i=hc(e,"click",mc(a)),o=!0)},p:function(e,r){t=e,2&r&&Ec(n,"active",t[7]===t[1])},d:function(t){t&&fc(n),o=!1,i()}}}function Sm(t){for(var n,e,r,o,i,u,a,c,f,l,s=Array(t[0]),d=[],v=0;v<s.length;v+=1)d[v]=Om(km(t,s,v));return{c:function(){n=sc("nav"),e=sc("ul"),r=sc("li"),(o=sc("a")).innerHTML="<span>«</span>",i=vc();for(var f=0;f<d.length;f+=1)d[f].c();u=vc(),a=sc("li"),(c=sc("a")).innerHTML="<span>»</span>",yc(o,"href",""),yc(o,"class","page-link"),yc(r,"class","page-item"),Ec(r,"disabled",0===t[1]),yc(c,"href",""),yc(c,"class","page-link"),yc(a,"class","page-item"),Ec(a,"disabled",t[1]===t[0]-1),yc(e,"class","pagination"),Ec(n,"d-none",t[0]<=1)},m:function(s,v){cc(s,n,v),ac(n,e),ac(e,r),ac(r,o),ac(e,i);for(var p=0;p<d.length;p+=1)d[p].m(e,null);ac(e,u),ac(e,a),ac(a,c),f||(l=[hc(o,"click",mc(t[2])),hc(c,"click",mc(t[4]))],f=!0)},p:function(t,o){var i=Wi(o,1)[0];if(2&i&&Ec(r,"disabled",0===t[1]),3&i){var c;for(s=Array(t[0]),c=0;c<s.length;c+=1){var f=km(t,s,c);d[c]?d[c].p(f,i):(d[c]=Om(f),d[c].c(),d[c].m(e,u))}for(;c<d.length;c+=1)d[c].d(1);d.length=s.length}3&i&&Ec(a,"disabled",t[1]===t[0]-1),1&i&&Ec(n,"d-none",t[0]<=1)},i:Fa,o:Fa,d:function(t){t&&fc(n),lc(d,t),f=!1,Ua(l)}}}function Em(t,n,e){var r,o;Va(t,Fh,(function(t){return e(0,r=t)})),Va(t,Nh,(function(t){return e(1,o=t)}));return[r,o,function(){return tc(Nh,--o,o)},function(t){return tc(Nh,o=t,o)},function(){return tc(Nh,++o,o)}]}var Am=function(t){nn(e,t);var n=xm(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Em,Sm,Wa,{}),r}return e}(pf);function jm(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Tm(t,n,e){var r=pu(t).call(t);return r[1]=n[e],r}function Pm(t){var n,e;return n=new wm({props:{item:t[1]}}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},p:function(t,e){var r={};1&e&&(r.item=t[1]),n.$set(r)},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Rm(t){for(var n,e,r,o,i=t[0],u=[],a=0;a<i.length;a+=1)u[a]=Pm(Tm(t,i,a));var c=function(t){return of(u[t],1,1,(function(){u[t]=null}))};return r=new Am({}),{c:function(){n=sc("ul");for(var t=0;t<u.length;t+=1)u[t].c();e=vc(),ff(r.$$.fragment),yc(n,"id","bookly-schedule-items"),yc(n,"class","list-group mb-3")},m:function(t,i){cc(t,n,i);for(var a=0;a<u.length;a+=1)u[a].m(n,null);cc(t,e,i),lf(r,t,i),o=!0},p:function(t,e){var r=Wi(e,1)[0];if(1&r){var o;for(i=t[0],o=0;o<i.length;o+=1){var a=Tm(t,i,o);u[o]?(u[o].p(a,r),rf(u[o],1)):(u[o]=Pm(a),u[o].c(),rf(u[o],1),u[o].m(n,null))}for(nf(),o=i.length;o<u.length;o+=1)c(o);ef()}},i:function(t){if(!o){for(var n=0;n<i.length;n+=1)rf(u[n]);rf(r.$$.fragment,t),o=!0}},o:function(t){u=Oa(u).call(u,Boolean);for(var n=0;n<u.length;n+=1)of(u[n]);of(r.$$.fragment,t),o=!1},d:function(t){t&&fc(n),lc(u,t),t&&fc(e),sf(r,t)}}}function Bm(t,n,e){var r;return Va(t,Lh,(function(t){return e(0,r=t)})),[r]}var Dm=function(t){nn(e,t);var n=jm(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Bm,Rm,Wa,{}),r}return e}(pf);function Mm(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Im(t){var n,e,r,o=t[4].default,i=Qa(o,t,t[3],null);return{c:function(){n=sc("div"),i&&i.c(),yc(n,"class",e="alert-"+t[1]+" "+t[2])},m:function(t,e){cc(t,n,e),i&&i.m(n,null),r=!0},p:function(t,u){i&&i.p&&8&u&&Xa(i,o,t,t[3],u,null,null),(!r||6&u&&e!==(e="alert-"+t[1]+" "+t[2]))&&yc(n,"class",e)},i:function(t){r||(rf(i,t),r=!0)},o:function(t){of(i,t),r=!1},d:function(t){t&&fc(n),i&&i.d(t)}}}function Cm(t){var n,e,r=t[0]&&Im(t);return{c:function(){r&&r.c(),n=pc()},m:function(t,o){r&&r.m(t,o),cc(t,n,o),e=!0},p:function(t,e){var o=Wi(e,1)[0];t[0]?r?(r.p(t,o),1&o&&rf(r,1)):((r=Im(t)).c(),rf(r,1),r.m(n.parentNode,n)):r&&(nf(),of(r,1,1,(function(){r=null})),ef())},i:function(t){e||(rf(r),e=!0)},o:function(t){of(r),e=!1},d:function(t){r&&r.d(t),t&&fc(n)}}}function Nm(t,n,e){var r=n.$$slots,o=void 0===r?{}:r,i=n.$$scope,u=n.show,a=void 0===u||u,c=n.type,f=void 0===c?"info":c,l=n.class,s=void 0===l?"alert":l;return t.$$set=function(t){"show"in t&&e(0,a=t.show),"type"in t&&e(1,f=t.type),"class"in t&&e(2,s=t.class),"$$scope"in t&&e(3,i=t.$$scope)},[a,f,s,i,o]}var Lm=function(t){nn(e,t);var n=Mm(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Nm,Cm,Wa,{show:0,type:1,class:2}),r}return e}(pf);function Fm(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function zm(t){var n,e,r,o,i,u;return n=new Lm({props:{type:"danger",show:t[1].length,$$slots:{default:[qm]},$$scope:{ctx:t}}}),r=new Dm({}),i=new Lm({props:{type:"danger",show:t[2]>1&&t[1].length,$$slots:{default:[Hm]},$$scope:{ctx:t}}}),{c:function(){ff(n.$$.fragment),e=vc(),ff(r.$$.fragment),o=vc(),ff(i.$$.fragment)},m:function(t,a){lf(n,t,a),cc(t,e,a),lf(r,t,a),cc(t,o,a),lf(i,t,a),u=!0},p:function(t,e){var r={};2&e&&(r.show=t[1].length),16&e&&(r.$$scope={dirty:e,ctx:t}),n.$set(r);var o={};6&e&&(o.show=t[2]>1&&t[1].length),18&e&&(o.$$scope={dirty:e,ctx:t}),i.$set(o)},i:function(t){u||(rf(n.$$.fragment,t),rf(r.$$.fragment,t),rf(i.$$.fragment,t),u=!0)},o:function(t){of(n.$$.fragment,t),of(r.$$.fragment,t),of(i.$$.fragment,t),u=!1},d:function(t){sf(n,t),t&&fc(e),sf(r,t),t&&fc(o),sf(i,t)}}}function Ym(t){var n;return{c:function(){yc(n=sc("div"),"class","bookly-loading")},m:function(t,e){cc(t,n,e)},p:Fa,i:Fa,o:Fa,d:function(t){t&&fc(n)}}}function qm(t){var n,e,r,o=Rl.l10n.recurring.some_slots_are_busy+"";return{c:function(){n=sc("span"),e=vc(),r=dc(o),yc(n,"class","fas fa-info-circle text-primary fa-lg")},m:function(t,o){cc(t,n,o),cc(t,e,o),cc(t,r,o)},p:Fa,d:function(t){t&&fc(n),t&&fc(e),t&&fc(r)}}}function Hm(t){var n,e,r,o,i,u=Rl.l10n.recurring.another_time_on_pages+"",a=t[1].join(", ")+"";return{c:function(){n=sc("span"),e=vc(),r=dc(u),o=vc(),i=dc(a),yc(n,"class","fas fa-fw fa-exclamation-triangle text-warning fa-lg mr-2")},m:function(t,u){cc(t,n,u),cc(t,e,u),cc(t,r,u),cc(t,o,u),cc(t,i,u)},p:function(t,n){2&n&&a!==(a=t[1].join(", ")+"")&&wc(i,a)},d:function(t){t&&fc(n),t&&fc(e),t&&fc(r),t&&fc(o),t&&fc(i)}}}function Um(t){var n,e,r,o,i=[Ym,zm],u=[];function a(t,n){return t[0]?0:1}return e=a(t),r=u[e]=i[e](t),{c:function(){n=sc("div"),r.c()},m:function(t,r){cc(t,n,r),u[e].m(n,null),o=!0},p:function(t,o){var c=Wi(o,1)[0],f=e;(e=a(t))===f?u[e].p(t,c):(nf(),of(u[f],1,1,(function(){u[f]=null})),ef(),(r=u[e])?r.p(t,c):(r=u[e]=i[e](t)).c(),rf(r,1),r.m(n,null))},i:function(t){o||(rf(r),o=!0)},o:function(t){of(r),o=!1},d:function(t){t&&fc(n),u[e].d()}}}function Gm(t,n,e){var r,o,i;Va(t,os,(function(t){return e(3,r=t)})),Va(t,Ps,(function(t){return e(1,o=t)})),Va(t,Fh,(function(t){return e(2,i=t)}));var u=!0;return t.$$.update=function(){8&t.$$.dirty&&"schedule"===r&&(e(0,u=!0),(Rs.reset(),od().done((function(t){var n;Bs.set(t.data);var e=[];uu(n=t.data).call(n,(function(t){if(t.another_time){var n=Xf((t.index-1)/10)+1;na(e).call(e,n)<0&&e.push(n)}})),Ps.set(e)}))).always((function(){return e(0,u=!1)})))},[u,o,i,r]}var Wm=function(t){nn(e,t);var n=Fm(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Gm,Um,Wa,{}),r}return e}(pf);function Jm(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Vm(t){var n,e;return(n=new Qp({props:{class:"btn-success",disabled:!t[3]||!t[4].length||t[5]||"weekly"===t[6].type&&!t[6].weekly.on.length||null===t[3].id&&""===t[7],caption:Rl.l10n.recurring.next}})).$on("click",t[10]),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},p:function(t,e){var r={};248&e&&(r.disabled=!t[3]||!t[4].length||t[5]||"weekly"===t[6].type&&!t[6].weekly.on.length||null===t[3].id&&""===t[7]),n.$set(r)},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Qm(t){var n,e;return(n=new Qp({props:{class:"btn-default",caption:Rl.l10n.recurring.back}})).$on("click",t[9]),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},p:Fa,i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Km(t){var n,e,r,o,i=[Qm,Vm],u=[];function a(t,n){return"schedule"===t[0]?0:"main"===t[0]&&t[1]&&!t[2]?1:-1}return~(n=a(t))&&(e=u[n]=i[n](t)),{c:function(){e&&e.c(),r=pc()},m:function(t,e){~n&&u[n].m(t,e),cc(t,r,e),o=!0},p:function(t,o){var c=Wi(o,1)[0],f=n;(n=a(t))===f?~n&&u[n].p(t,c):(e&&(nf(),of(u[f],1,1,(function(){u[f]=null})),ef()),~n?((e=u[n])?e.p(t,c):(e=u[n]=i[n](t)).c(),rf(e,1),e.m(r.parentNode,r)):e=null)},i:function(t){o||(rf(e),o=!0)},o:function(t){of(e),o=!1},d:function(t){~n&&u[n].d(t),t&&fc(r)}}}function Xm(t,n,e){var r,o,i,u,a,c,f,l,s;Va(t,os,(function(t){return e(0,r=t)})),Va(t,Ql,(function(t){return e(1,o=t)})),Va(t,ql,(function(t){return e(2,i=t)})),Va(t,Nl,(function(t){return e(3,u=t)})),Va(t,ts,(function(t){return e(4,a=t)})),Va(t,Kl,(function(t){return e(5,c=t)})),Va(t,Zl,(function(t){return e(6,f=t)})),Va(t,Ll,(function(t){return e(7,l=t)})),Va(t,Nh,(function(t){return e(8,s=t)}));return[r,o,i,u,a,c,f,l,s,function(){return tc(os,r="main",r)},function(){tc(os,r="schedule",r),tc(Nh,s=0,s)}]}var Zm=function(t){nn(e,t);var n=Jm(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Xm,Km,Wa,{}),r}return e}(pf);function ty(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function ny(t){var n,e,r,o,i,u,a,c,f,l,s,d,v,p,h,m,y,g,_;return{c:function(){n=sc("div"),(e=sc("label")).textContent="".concat(Rl.l10n.recurring.reschedule_info),r=vc(),o=sc("div"),i=sc("input"),u=vc(),(a=sc("label")).textContent="".concat(Rl.l10n.recurring.only_this_appointment),c=vc(),f=sc("div"),l=sc("input"),s=vc(),(d=sc("label")).textContent="".concat(Rl.l10n.recurring.this_and_next_appointments),v=vc(),p=sc("div"),h=sc("input"),m=vc(),(y=sc("label")).textContent="".concat(Rl.l10n.recurring.all_appointments),yc(i,"id","bookly-reschedule-type-current"),yc(i,"class","custom-control-input"),yc(i,"type","radio"),i.__value="current",i.value=i.__value,t[2][0].push(i),yc(a,"for","bookly-reschedule-type-current"),yc(a,"class","custom-control-label"),yc(o,"class","custom-control custom-radio"),yc(l,"id","bookly-reschedule-type-next"),yc(l,"class","custom-control-input"),yc(l,"type","radio"),l.__value="next",l.value=l.__value,t[2][0].push(l),yc(d,"for","bookly-reschedule-type-next"),yc(d,"class","custom-control-label"),yc(f,"class","custom-control custom-radio"),yc(h,"id","bookly-reschedule-type-all"),yc(h,"class","custom-control-input"),yc(h,"type","radio"),h.__value="all",h.value=h.__value,t[2][0].push(h),yc(y,"for","bookly-reschedule-type-all"),yc(y,"class","custom-control-label"),yc(p,"class","custom-control custom-radio"),yc(n,"class","form-group")},m:function($,b){cc($,n,b),ac(n,e),ac(n,r),ac(n,o),ac(o,i),i.checked=i.__value===t[0],ac(o,u),ac(o,a),ac(n,c),ac(n,f),ac(f,l),l.checked=l.__value===t[0],ac(f,s),ac(f,d),ac(n,v),ac(n,p),ac(p,h),h.checked=h.__value===t[0],ac(p,m),ac(p,y),g||(_=[hc(i,"change",t[1]),hc(l,"change",t[3]),hc(h,"change",t[4])],g=!0)},p:function(t,n){var e=Wi(n,1)[0];1&e&&(i.checked=i.__value===t[0]),1&e&&(l.checked=l.__value===t[0]),1&e&&(h.checked=h.__value===t[0])},i:Fa,o:Fa,d:function(e){var r,o,u,a,c,f;e&&fc(n),va(r=t[2][0]).call(r,na(o=t[2][0]).call(o,i),1),va(u=t[2][0]).call(u,na(a=t[2][0]).call(a,l),1),va(c=t[2][0]).call(c,na(f=t[2][0]).call(f,h),1),g=!1,Ua(_)}}}function ey(t,n,e){var r;Va(t,Ds,(function(t){return e(0,r=t)}));return[r,function(){r=this.__value,Ds.set(r)},[[]],function(){r=this.__value,Ds.set(r)},function(){r=this.__value,Ds.set(r)}]}var ry=function(t){nn(e,t);var n=ty(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,ey,ny,Wa,{}),r}return e}(pf);function oy(t,n){var e=n.get(t);if(!e)throw new TypeError("attempted to get private field on non-instance");return e.get?e.get.call(t):e.value}var iy=wu.getWeakData,uy=ce.set,ay=ce.getterFor,cy=se.find,fy=se.findIndex,ly=0,sy=function(t){return t.frozen||(t.frozen=new dy)},dy=function(){this.entries=[]},vy=function(t,n){return cy(t.entries,(function(t){return t[0]===n}))};dy.prototype={get:function(t){var n=vy(this,t);if(n)return n[1]},has:function(t){return!!vy(this,t)},set:function(t,n){var e=vy(this,t);e?e[1]=n:this.entries.push([t,n])},delete:function(t){var n=fy(this.entries,(function(n){return n[0]===t}));return~n&&this.entries.splice(n,1),!!~n}};var py={getConstructor:function(t,n,e,r){var o=t((function(t,i){Ur(t,o,n),uy(t,{type:n,id:ly++,frozen:void 0}),null!=i&&Lr(i,t[r],{that:t,AS_ENTRIES:e})})),i=ay(n),u=function(t,n,e){var r=i(t),o=iy(W(n),!0);return!0===o?sy(r).set(n,e):o[r.id]=e,t};return Yr(o.prototype,{delete:function(t){var n=i(this);if(!E(t))return!1;var e=iy(t);return!0===e?sy(n).delete(t):e&&T(e,n.id)&&delete e[n.id]},has:function(t){var n=i(this);if(!E(t))return!1;var e=iy(t);return!0===e?sy(n).has(t):e&&T(e,n.id)}}),Yr(o.prototype,e?{get:function(t){var n=i(this);if(E(t)){var e=iy(t);return!0===e?sy(n).get(t):e?e[n.id]:void 0}},set:function(t,n){return u(this,t,n)}}:{add:function(t){return u(this,t,!0)}}),o}};s((function(t){var n,e=ce.enforce,r=!p.ActiveXObject&&"ActiveXObject"in p,o=Object.isExtensible,i=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},u=t.exports=Eu("WeakMap",i,py);if(ne&&r){n=py.getConstructor(i,"WeakMap",!0),wu.REQUIRED=!0;var a=u.prototype,c=a.delete,f=a.has,l=a.get,s=a.set;Yr(a,{delete:function(t){if(E(t)&&!o(t)){var r=e(this);return r.frozen||(r.frozen=new n),c.call(this,t)||r.frozen.delete(t)}return c.call(this,t)},has:function(t){if(E(t)&&!o(t)){var r=e(this);return r.frozen||(r.frozen=new n),f.call(this,t)||r.frozen.has(t)}return f.call(this,t)},get:function(t){if(E(t)&&!o(t)){var r=e(this);return r.frozen||(r.frozen=new n),f.call(this,t)?l.call(this,t):r.frozen.get(t)}return l.call(this,t)},set:function(t,r){if(E(t)&&!o(t)){var i=e(this);i.frozen||(i.frozen=new n),f.call(this,t)?s.call(this,t,r):i.frozen.set(t,r)}else s.call(this,t,r);return this}})}}));var hy=new(0,H.WeakMap),my=function(){function t(n){Yt(this,t),hy.set(this,{writable:!0,value:void 0}),function(t,n,e){var r=n.get(t);if(!r)throw new TypeError("attempted to set private field on non-instance");if(r.set)r.set.call(t,e);else{if(!r.writable)throw new TypeError("attempted to set read only private field");r.value=e}}(this,hy,n)}return Gt(t,[{key:"price",value:function(t){var n=oy(this,hy).format_price.format;return t=yd(t),n=(n=n.replace("{sign}",t<0?"-":"")).replace("{price}",this._formatNumber(Math.abs(t),oy(this,hy).format_price.decimals,oy(this,hy).format_price.decimal_separator,oy(this,hy).format_price.thousands_separator))}},{key:"date",value:function(t){switch(Sr(t)){case"string":return a.default(t).format(oy(this,hy).moment_format_date)}}},{key:"time",value:function(t){switch(Sr(t)){case"string":return a.default(t).format(oy(this,hy).moment_format_time);case"object":return t.format(oy(this,hy).moment_format_time)}}},{key:"dateTime",value:function(t){switch(Sr(t)){case"string":return a.default(t).format(oy(this,hy).moment_format_date+" "+oy(this,hy).moment_format_time)}}},{key:"_formatNumber",value:function(t,n,e,r){var o;t=Math.abs(Number(t)||0).toFixed(n),n=isNaN(n=Math.abs(n))?2:n,e=void 0===e?".":e,r=void 0===r?",":r;var i=t<0?"-":"",u=String(Xf(t)),a=u.length>3?u.length%3:0;return i+(a?u.substr(0,a)+r:"")+u.substr(a).replace(/(\d{3})(?=\d)/g,"$1"+r)+(n?e+pu(o=Math.abs(t-u).toFixed(n)).call(o,2):"")}}]),t}();function yy(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function gy(t){var n,e,r,o,i=Rl.l10n.recurring.number_of_days_to_shift_appointments+"";return{c:function(){n=sc("div"),e=dc(i),r=dc(": "),o=dc(t[0])},m:function(t,i){cc(t,n,i),ac(n,e),ac(n,r),ac(n,o)},p:function(t,n){1&n&&wc(o,t[0])},d:function(t){t&&fc(n)}}}function _y(t){var n,e,r=0!==t[0]&&gy(t);return{c:function(){var o;r&&r.c(),n=vc(),(e=sc("div")).textContent=Zu(o="".concat(Rl.l10n.recurring.appointments_will_be_scheduled_at,": ")).call(o,t[2].time(ps()))},m:function(t,o){r&&r.m(t,o),cc(t,n,o),cc(t,e,o)},p:function(t,e){0!==t[0]?r?r.p(t,e):((r=gy(t)).c(),r.m(n.parentNode,n)):r&&(r.d(1),r=null)},d:function(t){r&&r.d(t),t&&fc(n),t&&fc(e)}}}function $y(t){var n,e,r,o;return n=new ry({}),r=new Lm({props:{type:"success",show:"current"!==t[1],$$slots:{default:[_y]},$$scope:{ctx:t}}}),{c:function(){ff(n.$$.fragment),e=vc(),ff(r.$$.fragment)},m:function(t,i){lf(n,t,i),cc(t,e,i),lf(r,t,i),o=!0},p:function(t,n){var e=Wi(n,1)[0],o={};2&e&&(o.show="current"!==t[1]),33&e&&(o.$$scope={dirty:e,ctx:t}),r.$set(o)},i:function(t){o||(rf(n.$$.fragment,t),rf(r.$$.fragment,t),o=!0)},o:function(t){of(n.$$.fragment,t),of(r.$$.fragment,t),o=!1},d:function(t){sf(n,t),t&&fc(e),sf(r,t)}}}function by(t,n,e){var r,o,i;Va(t,Hl,(function(t){return e(3,r=t)})),Va(t,_s,(function(t){return e(4,o=t)})),Va(t,Ds,(function(t){return e(1,i=t)}));var u=new my(Rl),a=0;return t.$$.update=function(){24&t.$$.dirty&&e(0,a=r?ps().startOf("day").diff(o.startDate.startOf("day"),"days"):0)},[a,i,u,r,o]}var wy=function(t){nn(e,t);var n=yy(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,by,$y,Wa,{}),r}return e}(pf);function xy(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function ky(t){var n,e,r,o,i,u,a,c,f,l,s,d,v,p,h,m;return{c:function(){n=sc("div"),(e=sc("label")).textContent="".concat(Rl.l10n.send_notifications),r=vc(),o=sc("div"),i=sc("input"),u=vc(),(a=sc("label")).textContent="".concat(Rl.l10n.send_if_new_or_status_changed),c=vc(),f=sc("div"),l=sc("input"),s=vc(),(d=sc("label")).textContent="".concat(Rl.l10n.send_as_for_new),v=vc(),(p=sc("small")).textContent="".concat(Rl.l10n.chose_queue_type_info),yc(i,"id","bookly-queue-type-changed-status"),yc(i,"class","custom-control-input"),yc(i,"type","radio"),i.__value="changed_status",i.value=i.__value,t[2][0].push(i),yc(a,"for","bookly-queue-type-changed-status"),yc(a,"class","custom-control-label"),yc(o,"class","custom-control custom-radio"),yc(l,"id","bookly-queue-type-all"),yc(l,"class","custom-control-input"),yc(l,"type","radio"),l.__value="all",l.value=l.__value,t[2][0].push(l),yc(d,"for","bookly-queue-type-all"),yc(d,"class","custom-control-label"),yc(f,"class","custom-control custom-radio"),yc(p,"class","help-block"),yc(n,"class","form-group")},m:function(y,g){cc(y,n,g),ac(n,e),ac(n,r),ac(n,o),ac(o,i),i.checked=i.__value===t[0],ac(o,u),ac(o,a),ac(n,c),ac(n,f),ac(f,l),l.checked=l.__value===t[0],ac(f,s),ac(f,d),ac(n,v),ac(n,p),h||(m=[hc(i,"change",t[1]),hc(l,"change",t[3])],h=!0)},p:function(t,n){var e=Wi(n,1)[0];1&e&&(i.checked=i.__value===t[0]),1&e&&(l.checked=l.__value===t[0])},i:Fa,o:Fa,d:function(e){var r,o,u,a;e&&fc(n),va(r=t[2][0]).call(r,na(o=t[2][0]).call(o,i),1),va(u=t[2][0]).call(u,na(a=t[2][0]).call(a,l),1),h=!1,Ua(m)}}}function Oy(t,n,e){var r;Va(t,Is,(function(t){return e(0,r=t)}));return[r,function(){r=this.__value,Is.set(r)},[[]],function(){r=this.__value,Is.set(r)}]}var Sy=function(t){nn(e,t);var n=xy(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Oy,ky,Wa,{}),r}return e}(pf);function Ey(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Ay(t,n,e){var r=pu(t).call(t);return r[6]=n[e],r[8]=e,r}function jy(t){var n,e,r,o,i,u,a,c,f,l,s,d,v,p,h,m,y,g,_=t[6].data.name+"",$=t[6].address+"",b=t[6].name+"";return{c:function(){n=sc("div"),e=sc("input"),r=vc(),o=sc("label"),i=sc("i"),a=vc(),c=sc("b"),f=dc(_),l=dc(" ("),s=dc($),d=dc(")"),v=sc("br"),p=vc(),h=dc(b),m=vc(),yc(e,"class","custom-control-input"),yc(e,"id","bookly-notification-"+t[8]),yc(e,"type","checkbox"),e.__value=t[8],e.value=e.__value,t[5][0].push(e),yc(i,"class",u="fa-fw "+("sms"===t[6].gateway?"fas fa-sms":"far fa-envelope")),yc(o,"class","custom-control-label"),yc(o,"for","bookly-notification-"+t[8]),yc(n,"class","custom-control custom-checkbox")},m:function(u,_){var $;cc(u,n,_),ac(n,e),e.checked=~na($=t[1]).call($,e.__value),ac(n,r),ac(n,o),ac(o,i),ac(o,a),ac(o,c),ac(c,f),ac(o,l),ac(o,s),ac(o,d),ac(o,v),ac(o,p),ac(o,h),ac(n,m),y||(g=hc(e,"change",t[4]),y=!0)},p:function(t,n){var r;2&n&&(e.checked=~na(r=t[1]).call(r,e.__value));1&n&&u!==(u="fa-fw "+("sms"===t[6].gateway?"fas fa-sms":"far fa-envelope"))&&yc(i,"class",u),1&n&&_!==(_=t[6].data.name+"")&&wc(f,_),1&n&&$!==($=t[6].address+"")&&wc(s,$),1&n&&b!==(b=t[6].name+"")&&wc(h,b)},d:function(r){var o,i;r&&fc(n),va(o=t[5][0]).call(o,na(i=t[5][0]).call(i,e),1),y=!1,g()}}}function Ty(t){for(var n,e=t[0],r=[],o=0;o<e.length;o+=1)r[o]=jy(Ay(t,e,o));return{c:function(){n=sc("div");for(var t=0;t<r.length;t+=1)r[t].c();yc(n,"class","form-group")},m:function(t,e){cc(t,n,e);for(var o=0;o<r.length;o+=1)r[o].m(n,null)},p:function(t,o){var i=Wi(o,1)[0];if(3&i){var u;for(e=t[0],u=0;u<e.length;u+=1){var a=Ay(t,e,u);r[u]?r[u].p(a,i):(r[u]=jy(a),r[u].c(),r[u].m(n,null))}for(;u<r.length;u+=1)r[u].d(1);r.length=e.length}},i:Fa,o:Fa,d:function(t){t&&fc(n),lc(r,t)}}}function Py(t,n,e){var r,o,i;Va(t,Is,(function(t){return e(2,r=t)})),Va(t,Ms,(function(t){return e(3,o=t)})),Va(t,Cs,(function(t){return e(1,i=t)}));var u=n.notifications,a=void 0===u?[]:u,c=[[]];return t.$$set=function(t){"notifications"in t&&e(0,a=t.notifications)},t.$$.update=function(){var n;(8&t.$$.dirty&&tc(Is,r=o&&o.changed_status.length?"changed_status":"all",r),13&t.$$.dirty)&&(o?(e(0,a=o[r]),tc(Cs,i=_a(n=Vu(a)).call(n,(function(t){return Xf(t)})),i)):(e(0,a=[]),tc(Cs,i=[],i)))},[a,i,r,o,function(){i=_c(c[0],this.__value,this.checked),Cs.set(i)},c]}var Ry=function(t){nn(e,t);var n=Ey(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Py,Ty,Wa,{notifications:0}),r}return e}(pf);function By(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Dy(t){var n,e;return n=new Sy({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function My(t){var n,e,r,o=t[0].changed_status.length&&t[0].all.length&&Dy();return e=new Ry({}),{c:function(){o&&o.c(),n=vc(),ff(e.$$.fragment)},m:function(t,i){o&&o.m(t,i),cc(t,n,i),lf(e,t,i),r=!0},p:function(t,e){var r=Wi(e,1)[0];t[0].changed_status.length&&t[0].all.length?o?1&r&&rf(o,1):((o=Dy()).c(),rf(o,1),o.m(n.parentNode,n)):o&&(nf(),of(o,1,1,(function(){o=null})),ef())},i:function(t){r||(rf(o),rf(e.$$.fragment,t),r=!0)},o:function(t){of(o),of(e.$$.fragment,t),r=!1},d:function(t){o&&o.d(t),t&&fc(n),sf(e,t)}}}function Iy(t,n,e){var r;return Va(t,Ms,(function(t){return e(0,r=t)})),[r]}var Cy=function(t){nn(e,t);var n=By(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,Iy,My,Wa,{}),r}return e}(pf);function Ny(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Ly(t){var n,e;return(n=new Qp({props:{loading:t[0],class:"btn-success",caption:Rl.l10n.send}})).$on("click",t[2]),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},p:function(t,e){var r={};1&e&&(r.loading=t[0]),n.$set(r)},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Fy(t){var n,e,r="queue"===t[1]&&Ly(t);return{c:function(){r&&r.c(),n=pc()},m:function(t,o){r&&r.m(t,o),cc(t,n,o),e=!0},p:function(t,e){var o=Wi(e,1)[0];"queue"===t[1]?r?(r.p(t,o),2&o&&rf(r,1)):((r=Ly(t)).c(),rf(r,1),r.m(n.parentNode,n)):r&&(nf(),of(r,1,1,(function(){r=null})),ef())},i:function(t){e||(rf(r),e=!0)},o:function(t){of(r),e=!1},d:function(t){r&&r.d(t),t&&fc(n)}}}function zy(t,n,e){var r;Va(t,os,(function(t){return e(1,r=t)}));var o,i=(o="cxt",Mc().$$.context.get(o)),a=!1;return[a,r,function(){var t=id();t.selected.length>0?(e(0,a=!0),u.default.post(ajaxurl,{action:"bookly_send_queue",csrf_token:Al,queue:t.selected,attachments:t.attachments},(function(t){t.success&&(i.modal.hide(),tc(os,r="main",r))}),"json").always((function(){return e(0,a=!1)}))):(i.modal.hide(),tc(os,r="main",r))}]}var Yy=function(t){nn(e,t);var n=Ny(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,zy,Fy,Wa,{}),r}return e}(pf);function qy(t){var n=function(){if("undefined"==typeof Reflect||!zt)return!1;if(zt.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(zt(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=Pr(t);if(n){var o=Pr(this).constructor;e=zt(r,arguments,o)}else e=r.apply(this,arguments);return Er(this,e)}}function Hy(t){var n,e;return n=new Cy({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Uy(t){var n,e;return n=new wy({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Gy(t){var n,e;return n=new Wm({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Wy(t){var n,e;return n=new Ch({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Jy(t){var n;return{c:function(){yc(n=sc("div"),"class","bookly-loading")},m:function(t,e){cc(t,n,e)},i:Fa,o:Fa,d:function(t){t&&fc(n)}}}function Vy(t){var n,e,r,o,i,u,a=[Jy,Wy,Gy,Uy,Hy],c=[];function f(t,r){return t[2]?0:"main"===t[5]?1:(32&r&&(n=!(!El("recurring-appointments")||"schedule"!==t[5])),n?2:(32&r&&(e=!(!El("recurring-appointments")||"reschedule"!==t[5])),e?3:"queue"===t[5]?4:-1))}return~(r=f(t,-1))&&(o=c[r]=a[r](t)),{c:function(){o&&o.c(),i=pc()},m:function(t,n){~r&&c[r].m(t,n),cc(t,i,n),u=!0},p:function(t,n){var e=r;(r=f(t,n))!==e&&(o&&(nf(),of(c[e],1,1,(function(){c[e]=null})),ef()),~r?((o=c[r])||(o=c[r]=a[r](t)).c(),rf(o,1),o.m(i.parentNode,i)):o=null)},i:function(t){u||(rf(o),u=!0)},o:function(t){of(o),u=!1},d:function(t){~r&&c[r].d(t),t&&fc(i)}}}function Qy(t){var n,e;return n=new Yy({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Ky(t){var n,e;return(n=new Qp({props:{class:"btn-success",loading:t[3],disabled:t[3]||t[2]||!t[7]&&Ql&&Fs()||!t[4]&&!t[7]||t[8],className:"btn-success",caption:Rl.l10n.save}})).$on("click",t[9]),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},p:function(t,e){var r={};8&e&&(r.loading=t[3]),412&e&&(r.disabled=t[3]||t[2]||!t[7]&&Ql&&Fs()||!t[4]&&!t[7]||t[8]),n.$set(r)},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}function Xy(t){var n,e,r,o,i,u,a=El("recurring-appointments")&&function(t){var n,e;return n=new Zm({}),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(t){sf(n,t)}}}(),c="queue"===t[5]&&Qy(),f=!("queue"===t[5]||t[6]&&!t[7]&&"main"===t[5])&&Ky(t);return(i=new Qp({props:{caption:Rl.l10n.cancel}})).$on("click",(function(){Ga(t[0].modal.hide())&&t[0].modal.hide().apply(this,arguments)})),{c:function(){n=sc("div"),a&&a.c(),e=vc(),c&&c.c(),r=vc(),f&&f.c(),o=vc(),ff(i.$$.fragment),yc(n,"slot","footer")},m:function(t,l){cc(t,n,l),a&&a.m(n,null),ac(n,e),c&&c.m(n,null),ac(n,r),f&&f.m(n,null),ac(n,o),lf(i,n,null),u=!0},p:function(e,i){"queue"===(t=e)[5]?c?32&i&&rf(c,1):((c=Qy()).c(),rf(c,1),c.m(n,r)):c&&(nf(),of(c,1,1,(function(){c=null})),ef()),"queue"===t[5]||t[6]&&!t[7]&&"main"===t[5]?f&&(nf(),of(f,1,1,(function(){f=null})),ef()):f?(f.p(t,i),224&i&&rf(f,1)):((f=Ky(t)).c(),rf(f,1),f.m(n,o))},i:function(t){u||(rf(a),rf(c),rf(f),rf(i.$$.fragment,t),u=!0)},o:function(t){of(a),of(c),of(f),of(i.$$.fragment,t),u=!1},d:function(t){t&&fc(n),a&&a.d(),c&&c.d(),f&&f.d(),sf(i)}}}function Zy(t){var n,e,r={title:t[1],$$slots:{footer:[Xy],default:[Vy]},$$scope:{ctx:t}};return n=new vd({props:r}),t[13](n),n.$on("hidden",t[10]),{c:function(){ff(n.$$.fragment)},m:function(t,r){lf(n,t,r),e=!0},p:function(t,e){var r=Wi(e,1)[0],o={};2&r&&(o.title=t[1]),2097661&r&&(o.$$scope={dirty:r,ctx:t}),n.$set(o)},i:function(t){e||(rf(n.$$.fragment,t),e=!0)},o:function(t){of(n.$$.fragment,t),e=!1},d:function(e){t[13](null),sf(n,e)}}}function tg(t,n,e){var r,o,i,a,c,f,l,s,d,v,p,h;Va(t,$s,(function(t){return e(14,r=t)})),Va(t,Cl,(function(t){return e(15,o=t)})),Va(t,Pf,(function(t){return e(16,i=t)})),Va(t,Hl,(function(t){return e(4,a=t)})),Va(t,Ul,(function(t){return e(17,c=t)})),Va(t,Gl,(function(t){return e(18,f=t)})),Va(t,Ss,(function(t){return e(19,l=t)})),Va(t,os,(function(t){return e(5,s=t)})),Va(t,Ds,(function(t){return e(20,d=t)})),Va(t,Ql,(function(t){return e(6,v=t)})),Va(t,ql,(function(t){return e(7,p=t)})),Va(t,Vl,(function(t){return e(8,h=t)}));var m,y,g={modal:null},_="",$=!0,b=!1;return m="cxt",y=g,Mc().$$.context.set(m,y),[g,_,$,b,a,s,v,p,h,function(){!function(){var t=os.get();Pf.get();var n=_s.get(),e=hs();if("reschedule"!==t&&n.startDate&&e!==n.startDate.format("YYYY-MM-DD HH:mm:00")){var r,o=ud(ts.get());try{for(o.s();!(r=o.n()).done;)if(r.value.series_id)return!0}catch(t){o.e(t)}finally{o.f()}}return!1}()?(e(3,b=!0),function(){var t,n,e={action:"bookly_save_appointment_form",csrf_token:Al,id:_s.get().id,staff_id:Cl.get()?Cl.get().id:null,location_id:Yl.get()?Yl.get().id:null,skip_date:ql.get()?1:0,repeat:Ia(Ql.get()?{enabled:1,repeat:Zl.get()}:{enabled:0}),schedule:(n=[],uu(t=Bs.get()).call(t,(function(t){t.deleted||n.push(t.slots)})),n),customers:ss(),notification:es.get()?1:0,internal_note:ns.get(),reschedule_type:Ds.get(),created_from:"undefined"!=typeof BooklySCCalendarL10n?"staff-cabinet":"backend"};return ql.get()||(e.start_date=hs(),e.end_date=ms()),null===Nl.get()||(Nl.get().id?e.service_id=Nl.get().id:(e.service_id="",e.custom_service_name=Ll.get(),e.custom_service_price=Fl.get())),u.default.post(ajaxurl,e,(function(t){t.success?Ms.set(t.queue):rs.update((function(n){var e;return uu(e=Vu(t.errors)).call(e,(function(e){return n[e]=t.errors[e]})),n})),t.alert_errors&&booklyAlert({error:t.alert_errors})}),"json")}().then((function(t){t.success&&(t.queue.all.length||t.queue.changed_status.length?tc(os,s="queue",s):(e(2,$=!0),g.modal.hide()),r("current"!==d?"refresh":t.data))})).always((function(){return e(3,b=!1)}))):tc(os,s="reschedule",s)},function(){!function(){if("queue"===os.get()){var t=id().attachments;if(t.length>0)jQuery.post(ajaxurl,{action:"bookly_clear_attachments",csrf_token:Al,attachments:t},"json")}}(),Zs()},function(t,n){e(2,$=!0),Zs(),tc($s,r=n,r),e(1,_=Rl.l10n.edit_appointment),Xs().then((function(){return function(t){return u.default.get(ajaxurl,{action:"bookly_get_data_for_appointment",id:t,csrf_token:Al}).done((function(n){if(n.success){var e,r=n.data,o=Pf.get(),i=r.start_date&&moment(r.start_date),a=r.start_date&&moment(r.end_date),c=kl(r.staff_id,o.staff);0!==r.service_id&&null===kl(r.service_id,c.services)&&c.services.push(r.service),Cl.set(c),gs.set(r.staff_any?c:null),Nl.set(kl(0===r.service_id?null:r.service_id,c.services)),Yl.set(0!==r.location_id?kl(r.location_id,c.locations):null),ql.set(!r.start_date),_s.set({id:t,startDate:i&&i.clone(),startTime:r.start_time,endTime:r.end_time}),Ll.set(r.custom_service_name),Fl.set(r.custom_service_price),ns.set(r.internal_note),null!==i?(Hl.set(i.clone()),Ul.set(i.format("HH:mm")),i.format("YYYY-MM-DD")===a.format("YYYY-MM-DD")?Wl.set(a.format("HH:mm")):Wl.set(24*a.clone().startOf("day").diff(i.clone().startOf("day"),"days")+a.hour()+a.format(":mm"))):(Hl.set(moment()),Ul.set(moment().format("HH:mm")),vs()),o.customers_loaded||(o.customers=r.customers_data||[],Pf.set(o)),ts.set(_a(e=r.customers).call(e,(function(t){var n=Ol(kl(t.id,o.customers));return cs(n),u.default.extend(n,t),n}))),zl.set({url:n.data.online_meeting_start_url,copied:!1})}}))}(t)})).always((function(){return e(2,$=!1)})),g.modal.show()},function(t,n,s){e(2,$=!0),Zs(),tc($s,r=s,r),e(1,_=Rl.l10n.new_appointment),Xs().then((function(){return u.default.Deferred(function(){var e,r=(e=hu.mark((function e(r){return hu.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return tc(Cl,o=null===t?null:kl(t,i.staff),o),tc(Hl,a=n,a),e.next=4,Hc();case 4:return tc(Ul,c=a.format("HH:mm"),c),tc(Gl,f=js(c,l),f),e.next=8,Hc();case 8:vs(),o&&Qs(),r.resolve();case 11:case"end":return e.stop()}}),e)})),function(){var t=this,n=arguments;return new _i((function(r,o){var i=e.apply(t,n);function u(t){$i(i,r,o,u,a,"next",t)}function a(t){$i(i,r,o,u,a,"throw",t)}u(void 0)}))});return function(t){return r.apply(this,arguments)}}())})).always((function(){return e(2,$=!1)})),g.modal.show()},function(t){Nc[t?"unshift":"push"]((function(){g.modal=t,e(0,g)}))}]}var ng,eg=function(t){nn(e,t);var n=qy(e);function e(t){var r;return Yt(this,e),vf(Wt(r=n.call(this)),t,tg,Zy,Wa,{edit:11,create:12}),r}return Gt(e,[{key:"edit",get:function(){return this.$$.ctx[11]}},{key:"create",get:function(){return this.$$.ctx[12]}}]),e}(pf);return t.showDialog=function(t,n,e,r){ng||(ng=new eg({target:document.getElementById("bookly-appointment-dialog"),props:{}})),t?ng.edit(t,r):ng.create(n,e,r)},Object.defineProperty(t,"__esModule",{value:!0}),t}({},jQuery,moment,BooklyL10nAppDialog,Ladda);
backend/components/dialogs/customer/delete/Dialog.php CHANGED
@@ -2,7 +2,6 @@
2
  namespace Bookly\Backend\Components\Dialogs\Customer\Delete;
3
 
4
  use Bookly\Lib;
5
- use Bookly\Backend\Components\Controls\Buttons;
6
 
7
  /**
8
  * Class Dialog
2
  namespace Bookly\Backend\Components\Dialogs\Customer\Delete;
3
 
4
  use Bookly\Lib;
 
5
 
6
  /**
7
  * Class Dialog
backend/components/dialogs/customer/delete/templates/dialog.php CHANGED
@@ -13,7 +13,7 @@ use Bookly\Backend\Components\Controls\Inputs;
13
  <div class="modal-body">
14
  <p class="bookly-js-delete-with-events"><?php esc_html_e( 'You are going to delete customers with existing bookings. Notifications will not be sent to them.', 'bookly' ) ?></p>
15
  <p class="bookly-js-delete-without-events"><?php esc_html_e( 'You are going to delete customers, are you sure?', 'bookly' ) ?></p>
16
- <div class="bookly-js-delete-with-events collapse">
17
  <?php Inputs::renderCheckBox( __( 'Delete customers with existing bookings', 'bookly' ), null, null, array( 'id' => 'bookly-js-delete-with-events-checkbox' ) ) ?>
18
  </div>
19
  <div>
13
  <div class="modal-body">
14
  <p class="bookly-js-delete-with-events"><?php esc_html_e( 'You are going to delete customers with existing bookings. Notifications will not be sent to them.', 'bookly' ) ?></p>
15
  <p class="bookly-js-delete-without-events"><?php esc_html_e( 'You are going to delete customers, are you sure?', 'bookly' ) ?></p>
16
+ <div class="bookly-js-delete-with-events bookly-collapse">
17
  <?php Inputs::renderCheckBox( __( 'Delete customers with existing bookings', 'bookly' ), null, null, array( 'id' => 'bookly-js-delete-with-events-checkbox' ) ) ?>
18
  </div>
19
  <div>
backend/components/dialogs/notifications/templates/_codes.php CHANGED
@@ -3,10 +3,10 @@ use Bookly\Lib\Entities\Notification;
3
  $codes = new \Bookly\Backend\Modules\Notifications\Lib\Codes( 'email' );
4
  ?>
5
  <div class="form-group bookly-js-codes-container">
6
- <a class="collapsed mb-2 d-inline-block" data-toggle="collapse" href="#bookly-notification-codes" role="button" aria-expanded="false" aria-controls="collapseExample">
7
  <?php esc_attr_e( 'Codes', 'bookly' ) ?>
8
  </a>
9
- <div class="collapse" id="bookly-notification-codes">
10
  <?php foreach ( Notification::getTypes() as $notification_type ) :
11
  $codes->render( $notification_type );
12
  endforeach ?>
3
  $codes = new \Bookly\Backend\Modules\Notifications\Lib\Codes( 'email' );
4
  ?>
5
  <div class="form-group bookly-js-codes-container">
6
+ <a class="bookly-collapsed mb-2 d-inline-block" data-toggle="bookly-collapse" href="#bookly-notification-codes" role="button" aria-expanded="false" aria-controls="collapseExample">
7
  <?php esc_attr_e( 'Codes', 'bookly' ) ?>
8
  </a>
9
+ <div class="bookly-collapse" id="bookly-notification-codes">
10
  <?php foreach ( Notification::getTypes() as $notification_type ) :
11
  $codes->render( $notification_type );
12
  endforeach ?>
backend/components/dialogs/notifications/templates/_editor.php CHANGED
@@ -5,7 +5,7 @@ use Bookly\Backend\Components\Ace;
5
  <div class="col-md-12">
6
  <div class="form-group">
7
  <label class="float-left mt-2"><?php esc_html_e( 'Body', 'bookly' ) ?></label>
8
- <ul class="nav nav-tabs justify-content-end mr-2<?php if ( !user_can_richedit() ) : ?> collapse<?php endif ?>" style="border-bottom: none;">
9
  <li class="nav-item">
10
  <a class="nav-link active" href="#bookly-wp-editor-pane" data-toggle="bookly-tab" data-tinymce><?php esc_html_e( 'Visual', 'bookly' ) ?></a>
11
  </li>
5
  <div class="col-md-12">
6
  <div class="form-group">
7
  <label class="float-left mt-2"><?php esc_html_e( 'Body', 'bookly' ) ?></label>
8
+ <ul class="nav nav-tabs justify-content-end mr-2<?php if ( !user_can_richedit() ) : ?> bookly-collapse<?php endif ?>" style="border-bottom: none;">
9
  <li class="nav-item">
10
  <a class="nav-link active" href="#bookly-wp-editor-pane" data-toggle="bookly-tab" data-tinymce><?php esc_html_e( 'Visual', 'bookly' ) ?></a>
11
  </li>
backend/components/dialogs/payment/Dialog.php CHANGED
@@ -26,7 +26,7 @@ class Dialog extends Lib\Base\Component
26
  $types = array();
27
  foreach ( array( Payment::TYPE_PAYPAL, Payment::TYPE_LOCAL, Payment::TYPE_STRIPE, Payment::TYPE_CLOUD_STRIPE,
28
  Payment::TYPE_AUTHORIZENET, Payment::TYPE_2CHECKOUT, Payment::TYPE_PAYUBIZ, Payment::TYPE_PAYULATAM,
29
- Payment::TYPE_PAYSON, Payment::TYPE_MOLLIE, Payment::TYPE_FREE, Payment::TYPE_WOOCOMMERCE,
30
  ) as $type ) {
31
  $types[ $type ] = Payment::typeToString( $type );
32
  }
26
  $types = array();
27
  foreach ( array( Payment::TYPE_PAYPAL, Payment::TYPE_LOCAL, Payment::TYPE_STRIPE, Payment::TYPE_CLOUD_STRIPE,
28
  Payment::TYPE_AUTHORIZENET, Payment::TYPE_2CHECKOUT, Payment::TYPE_PAYUBIZ, Payment::TYPE_PAYULATAM,
29
+ Payment::TYPE_PAYSON, Payment::TYPE_MOLLIE, Payment::TYPE_FREE, Payment::TYPE_WOOCOMMERCE, Payment::TYPE_SQUARE
30
  ) as $type ) {
31
  $types[ $type ] = Payment::typeToString( $type );
32
  }
backend/components/dialogs/service/categories/resources/js/service-categories-dialog.js CHANGED
@@ -1,37 +1,65 @@
1
  jQuery(function ($) {
2
  'use strict';
3
 
4
- var $dialog = $('#bookly-service-categories-modal'),
5
- $categories = $('#bookly-services-categories', $dialog),
6
- $template = $('#bookly-new-category-template'),
7
- $newCategory = $('#bookly-js-new-category', $dialog),
8
  $servicesList = $('#services-list'),
9
- $save = $('#bookly-save', $dialog),
10
- new_category_id
11
- ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  // Add category
14
  $newCategory.on('click', function () {
15
- $categories.append(
16
- $template.clone().show().html()
17
- .replace(/{{id}}/g, 'new' + ++new_category_id)
18
- .replace(/{{name}}/g, '')
19
- );
20
- $categories.find('.form-group:last input[name="category_name"]').focus();
 
 
21
  });
22
  // Remove category
23
  $categories.on('click', '.bookly-js-delete-category', function (e) {
24
  e.preventDefault();
25
- $(this).closest('li.form-group').remove();
26
  });
27
  // Save categories
28
  $save.on('click', function (e) {
29
  e.preventDefault();
30
- var ladda = Ladda.create(this),
31
  categories = [];
32
  ladda.start();
33
- $categories.find('li').each(function (position, category) {
34
- categories.push({id: $(category).find('[name="category_id"]').val(), name: $(category).find('[name="category_name"]').val()});
 
 
 
 
 
 
35
  });
36
  $.post(
37
  ajaxurl,
@@ -51,17 +79,48 @@ jQuery(function ($) {
51
  });
52
 
53
  $dialog.off().on('show.bs.modal', function () {
54
- new_category_id = 0;
55
  // Show categories list
56
  $categories.html('');
57
  BooklyL10n.categories.forEach(function (category) {
58
- $categories.append(
59
- $template.clone().show().html()
60
- .replace(/{{id}}/g, category.id)
61
- .replace(/{{name}}/g, category.name)
62
- );
63
  });
64
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  Sortable.create($categories[0], {
66
  handle: '.bookly-js-draghandle',
67
  });
1
  jQuery(function ($) {
2
  'use strict';
3
 
4
+ let $dialog = $('#bookly-service-categories-modal'),
5
+ $categories = $('#bookly-services-categories', $dialog),
6
+ $template = $('#bookly-new-category-template').clone().removeAttr('id').addClass('bookly-js-category-wrap'),
7
+ $newCategory = $('#bookly-js-new-category', $dialog),
8
  $servicesList = $('#services-list'),
9
+ $save = $('#bookly-save', $dialog),
10
+ $thumb_container,
11
+ frame = wp.media({
12
+ library: {type: 'image'},
13
+ multiple: false
14
+ })
15
+ .on('select', function () {
16
+ let selection = frame.state().get('selection').toJSON(),
17
+ img_src;
18
+ if (selection.length) {
19
+ if (selection[0].sizes['thumbnail'] !== undefined) {
20
+ img_src = selection[0].sizes['thumbnail'].url;
21
+ } else {
22
+ img_src = selection[0].url;
23
+ }
24
+ $('[name="attachment_id"]', $thumb_container).val(selection[0].id).trigger('change');
25
+ $('.bookly-thumb-delete', $thumb_container).show();
26
+ $thumb_container
27
+ .css({'background-image': 'url(' + img_src + ')', 'background-size': 'cover'})
28
+ .addClass('bookly-thumb-with-image');
29
+ $(this).hide();
30
+ }
31
+ });
32
 
33
  // Add category
34
  $newCategory.on('click', function () {
35
+ appendCategory({
36
+ id: 'new-' + Math.random().toString(36).substring(2),
37
+ name: '',
38
+ info: '',
39
+ attachment: null,
40
+ attachment_id: null
41
+ });
42
+ $categories.find('.card:last input[name="name"]').focus();
43
  });
44
  // Remove category
45
  $categories.on('click', '.bookly-js-delete-category', function (e) {
46
  e.preventDefault();
47
+ $(this).closest('.card').remove();
48
  });
49
  // Save categories
50
  $save.on('click', function (e) {
51
  e.preventDefault();
52
+ let ladda = Ladda.create(this),
53
  categories = [];
54
  ladda.start();
55
+ $('.card', $categories).each(function (position, category) {
56
+ let $card = $(category);
57
+ categories.push({
58
+ id: $('[name="id"]', $card).val(),
59
+ name: $('[name="name"]', $card).val(),
60
+ info: $('[name="info"]', $card).val(),
61
+ attachment_id: $('[name="attachment_id"]', $card).val(),
62
+ });
63
  });
64
  $.post(
65
  ajaxurl,
79
  });
80
 
81
  $dialog.off().on('show.bs.modal', function () {
 
82
  // Show categories list
83
  $categories.html('');
84
  BooklyL10n.categories.forEach(function (category) {
85
+ appendCategory(category);
 
 
 
 
86
  });
87
  });
88
+
89
+ function appendCategory(category) {
90
+ let $category = $template.clone(),
91
+ attr_id = 'bookly-category-' + category.id;
92
+ $('[name="id"]', $category).attr('value', category.id);
93
+ $('[name="name"]', $category).attr('value', category.name);
94
+ $('[name="info"]', $category).text(category.info);
95
+ $('.card-header [data-toggle="bookly-collapse"]', $category).attr('href', '#' + attr_id)
96
+ $('.bookly-collapse', $category).attr('id', attr_id)
97
+ if (category.attachment !== null) {
98
+ $('[name="attachment_id"]', $category).attr('value', category.attachment_id);
99
+ $('.bookly-thumb-delete', $category).show();
100
+ $('.bookly-thumb', $category)
101
+ .css({'background-image': 'url(' + category.attachment + ')', 'background-size': 'cover'})
102
+ .addClass('bookly-thumb-with-image');
103
+ }
104
+
105
+ $category
106
+ .on('click', '.bookly-thumb label', function (e) {
107
+ e.preventDefault();
108
+ e.stopPropagation();
109
+ $thumb_container = $(this).closest('.bookly-thumb');
110
+ frame.open();
111
+ $(document).off('focusin.modal');
112
+ })
113
+ // Delete img
114
+ .on('click', '.bookly-thumb-delete', function () {
115
+ $('.bookly-thumb', $category).attr('style', '');
116
+ $('[name="attachment_id"]', $category).val('').trigger('change');
117
+ $('.bookly-thumb', $category).removeClass('bookly-thumb-with-image');
118
+ $('.bookly-thumb-delete', $category).hide();
119
+ })
120
+
121
+ $categories.append($category);
122
+ }
123
+
124
  Sortable.create($categories[0], {
125
  handle: '.bookly-js-draghandle',
126
  });
backend/components/dialogs/service/categories/templates/dialog.php CHANGED
@@ -10,7 +10,7 @@ use Bookly\Backend\Components\Controls\Elements;
10
  <button type="button" class="close" data-dismiss="bookly-modal" aria-label="Close"><span>&times;</span></button>
11
  </div>
12
  <div class="modal-body">
13
- <ul id="bookly-services-categories" class="list-unstyled"></ul>
14
  <?php Buttons::renderAdd( 'bookly-js-new-category', null, __( 'Add category', 'bookly' ), array(), false ) ?>
15
  <small class="d-block text-muted mt-3"><?php esc_html_e( 'Adjust the order of categories in your booking form', 'bookly' ) ?></small>
16
  </div>
@@ -21,13 +21,46 @@ use Bookly\Backend\Components\Controls\Elements;
21
  </div>
22
  </div>
23
  </form>
24
- <div class="collapse" id="bookly-new-category-template">
25
- <li class="form-group">
26
- <div class="row align-items-center">
27
- <input type="hidden" name="category_id" value="{{id}}"/>
28
- <div class="col-auto"><?php Elements::renderReorder() ?></div>
29
- <div class="col-auto px-1"><input type="text" class="form-control" name="category_name" value="{{name}}"/></div>
30
- <div class="col-auto"><a href="#"><i class="far fa-fw fa-trash-alt text-danger bookly-js-delete-category" title="<?php esc_attr_e( 'Delete', 'bookly' ) ?>"></i></a></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  </div>
32
- </li>
33
  </div>
10
  <button type="button" class="close" data-dismiss="bookly-modal" aria-label="Close"><span>&times;</span></button>
11
  </div>
12
  <div class="modal-body">
13
+ <div id="bookly-services-categories"></div>
14
  <?php Buttons::renderAdd( 'bookly-js-new-category', null, __( 'Add category', 'bookly' ), array(), false ) ?>
15
  <small class="d-block text-muted mt-3"><?php esc_html_e( 'Adjust the order of categories in your booking form', 'bookly' ) ?></small>
16
  </div>
21
  </div>
22
  </div>
23
  </form>
24
+
25
+ <div style="display: none">
26
+ <div id="bookly-new-category-template">
27
+ <div class="card bookly-collapse-with-arrow">
28
+ <div class="card-header d-flex align-items-center py-1 pr-0">
29
+ <?php Elements::renderReorder() ?>
30
+ <input type="text" class="form-control ml-3 my-0" name="name"/>
31
+ <a href="#" class="mx-2 bookly-collapsed" role="button" data-toggle="bookly-collapse"></a>
32
+ <button type="button" title="<?php esc_attr_e( 'Delete', 'bookly' ) ?>" data-spinner-size="40" data-style="zoom-in" class="btn ladda-button mx-2 p-0 bookly-js-delete-category"><span class="ladda-label"><i
33
+ class="far fa-fw fa-trash-alt text-danger"></i></span></button>
34
+ </div>
35
+ <div class="bookly-collapse">
36
+ <div class="card-body">
37
+ <div class="row form-row">
38
+ <div class="col-auto">
39
+ <div class="bookly-mw-150 bookly-thumb">
40
+ <i class="fas fa-fw fa-4x fa-camera mt-2 text-white w-100"></i>
41
+ <?php if ( current_user_can( 'upload_files' ) ) : ?>
42
+ <a class="bookly-js-remove-attachment far fa-fw fa-trash-alt text-danger bookly-thumb-delete"
43
+ href="javascript:void(0)"
44
+ title="<?php esc_attr_e( 'Delete', 'bookly' ) ?>"
45
+ style="display: none">
46
+ </a>
47
+ <div class="bookly-thumb-edit">
48
+ <label class="bookly-thumb-edit-btn"><?php esc_html_e( 'Image', 'bookly' ) ?></label>
49
+ </div>
50
+ <?php endif ?>
51
+ <input type="hidden" name="attachment_id" value="">
52
+ </div>
53
+ </div>
54
+ <div class="col">
55
+ <input type="hidden" name="id" value=""/>
56
+ <textarea class="form-control" name="info" rows="2"></textarea>
57
+ <small class="form-text text-muted">
58
+ <?php esc_html_e( 'This text can be inserted into notifications with {category_info} code', 'bookly' ) ?>
59
+ </small>
60
+ </div>
61
+ </div>
62
+ </div>
63
+ </div>
64
  </div>
65
+ </div>
66
  </div>
backend/components/dialogs/service/edit/templates/dialog.php CHANGED
@@ -79,5 +79,5 @@ use Bookly\Lib;
79
  </form>
80
  </div>
81
  </div>
82
- <div class="collapse" id="bookly-service-additional-html"></div>
83
  </div>
79
  </form>
80
  </div>
81
  </div>
82
+ <div class="bookly-collapse" id="bookly-service-additional-html"></div>
83
  </div>
backend/components/dialogs/service/order/templates/dialog.php CHANGED
@@ -20,7 +20,7 @@ use Bookly\Backend\Components\Controls\Elements;
20
  </div>
21
  </div>
22
  </form>
23
- <div class="collapse" id="bookly-service-template">
24
  <li class="mb-1">
25
  <div class="row align-items-center">
26
  <input type="hidden" name="id" value="{{id}}"/>
20
  </div>
21
  </div>
22
  </form>
23
+ <div class="bookly-collapse" id="bookly-service-template">
24
  <li class="mb-1">
25
  <div class="row align-items-center">
26
  <input type="hidden" name="id" value="{{id}}"/>
backend/components/dialogs/sms/resources/js/notification-dialog.js CHANGED
@@ -45,7 +45,7 @@ jQuery(function ($) {
45
  if (useTinyMCE) {
46
  tinymce.init(tinyMCEPreInit);
47
  }
48
- containers.message.siblings('a[data-toggle=collapse]').html(BooklyNotificationDialogL10n.title.container);
49
  $('.bookly-js-services', containers.settings).booklyDropdown();
50
  $('.modal-title', $modalNotification).html(BooklyNotificationDialogL10n.title.edit);
51
  });
@@ -209,8 +209,8 @@ jQuery(function ($) {
209
  });
210
 
211
  function showNotificationDialog(id) {
212
- $('.bookly-js-loading:first-child', $modalNotification).addClass('bookly-loading').removeClass('collapse');
213
- $('.bookly-js-loading:last-child', $modalNotification).addClass('collapse');
214
  $modalNotification.booklyModal('show');
215
  if (id === undefined) {
216
  setNotificationData(BooklyNotificationDialogL10n.defaultNotification);
@@ -282,18 +282,18 @@ jQuery(function ($) {
282
 
283
  if (data.hasOwnProperty('id')) {
284
  $('.modal-title', $modalNotification).html(BooklyNotificationDialogL10n.title.edit);
285
- containers.settings.collapse('hide');
286
- containers.message.collapse('show');
287
  $('.bookly-js-save > span.ladda-label', $modalNotification).text(BooklyNotificationDialogL10n.title.save);
288
  } else {
289
  $('.modal-title', $modalNotification).html(BooklyNotificationDialogL10n.title.new);
290
- containers.settings.collapse('show');
291
  $('.bookly-js-save > span.ladda-label', $modalNotification).text(BooklyNotificationDialogL10n.title.create);
292
  }
293
 
294
  $notificationType.val(data.type).trigger('change');
295
 
296
- $('.bookly-js-loading', $modalNotification).toggleClass('collapse');
297
 
298
  $('a[href="#bookly-wp-editor-pane"]').click();
299
  }
45
  if (useTinyMCE) {
46
  tinymce.init(tinyMCEPreInit);
47
  }
48
+ containers.message.siblings('a[data-toggle=bookly-collapse]').html(BooklyNotificationDialogL10n.title.container);
49
  $('.bookly-js-services', containers.settings).booklyDropdown();
50
  $('.modal-title', $modalNotification).html(BooklyNotificationDialogL10n.title.edit);
51
  });
209
  });
210
 
211
  function showNotificationDialog(id) {
212
+ $('.bookly-js-loading:first-child', $modalNotification).addClass('bookly-loading').removeClass('bookly-collapse');
213
+ $('.bookly-js-loading:last-child', $modalNotification).addClass('bookly-collapse');
214
  $modalNotification.booklyModal('show');
215
  if (id === undefined) {
216
  setNotificationData(BooklyNotificationDialogL10n.defaultNotification);
282
 
283
  if (data.hasOwnProperty('id')) {
284
  $('.modal-title', $modalNotification).html(BooklyNotificationDialogL10n.title.edit);
285
+ containers.settings.booklyCollapse('hide');
286
+ containers.message.booklyCollapse('show');
287
  $('.bookly-js-save > span.ladda-label', $modalNotification).text(BooklyNotificationDialogL10n.title.save);
288
  } else {
289
  $('.modal-title', $modalNotification).html(BooklyNotificationDialogL10n.title.new);
290
+ containers.settings.booklyCollapse('show');
291
  $('.bookly-js-save > span.ladda-label', $modalNotification).text(BooklyNotificationDialogL10n.title.create);
292
  }
293
 
294
  $notificationType.val(data.type).trigger('change');
295
 
296
+ $('.bookly-js-loading', $modalNotification).toggleClass('bookly-collapse');
297
 
298
  $('a[href="#bookly-wp-editor-pane"]').click();
299
  }
backend/components/dialogs/staff/edit/resources/js/staff-details.js CHANGED
@@ -11,8 +11,7 @@
11
  $staff_locations = $('#bookly-js-locations', $container),
12
  $staff_gateways_list = $('#bookly-js-gateways-list', $form),
13
  $staff_gateways = $('#bookly-gateways', $container),
14
- $staff_color = $('.bookly-js-color-picker', $container)
15
- ;
16
 
17
  if (obj.options.intlTelInput.enabled) {
18
  $staff_phone.intlTelInput({
@@ -60,10 +59,10 @@
60
  } else {
61
  img_src = selection[0].url;
62
  }
63
- $container.find('[name=attachment_id]').val(selection[0].id).trigger('change');
64
- $('#bookly-js-staff-avatar').find('.bookly-js-image').css({'background-image': 'url(' + img_src + ')', 'background-size': 'cover'});
65
- $('.bookly-thumb-delete').show();
66
- $('.bookly-thumb').addClass('bookly-thumb-with-image');
67
  $(this).hide();
68
  }
69
  });
@@ -75,9 +74,9 @@
75
  .on('click', '.bookly-thumb-delete', function () {
76
  var $thumb = $(this).parents('.bookly-js-image');
77
  $thumb.attr('style', '');
78
- $container.find('[name=attachment_id]').val('').trigger('change');
79
- $('.bookly-thumb').removeClass('bookly-thumb-with-image');
80
- $('.bookly-thumb-delete').hide();
81
  })
82
  // Save staff member details.
83
  .on('click', '#bookly-details-save', function (e) {
11
  $staff_locations = $('#bookly-js-locations', $container),
12
  $staff_gateways_list = $('#bookly-js-gateways-list', $form),
13
  $staff_gateways = $('#bookly-gateways', $container),
14
+ $staff_color = $('.bookly-js-color-picker', $container);
 
15
 
16
  if (obj.options.intlTelInput.enabled) {
17
  $staff_phone.intlTelInput({
59
  } else {
60
  img_src = selection[0].url;
61
  }
62
+ $('[name=attachment_id]',$form).val(selection[0].id).trigger('change');
63
+ $('#bookly-js-staff-avatar', $form).find('.bookly-js-image').css({'background-image': 'url(' + img_src + ')', 'background-size': 'cover'});
64
+ $('.bookly-thumb-delete', $form).show();
65
+ $('.bookly-thumb', $form).addClass('bookly-thumb-with-image');
66
  $(this).hide();
67
  }
68
  });
74
  .on('click', '.bookly-thumb-delete', function () {
75
  var $thumb = $(this).parents('.bookly-js-image');
76
  $thumb.attr('style', '');
77
+ $('[name=attachment_id]',$form).val('').trigger('change');
78
+ $('.bookly-thumb',$form).removeClass('bookly-thumb-with-image');
79
+ $('.bookly-thumb-delete',$form).hide();
80
  })
81
  // Save staff member details.
82
  .on('click', '#bookly-details-save', function (e) {
backend/components/dialogs/staff/edit/templates/details.php CHANGED
@@ -10,10 +10,10 @@ use Bookly\Lib\Config;
10
  <div class="col-md-auto">
11
  <div id="bookly-js-staff-avatar">
12
  <div class="form-group">
13
- <?php $img = wp_get_attachment_image_src( $staff->getAttachmentId(), 'thumbnail' ) ?>
14
 
15
  <div class="bookly-js-image bookly-thumb<?php echo esc_attr( $img ? ' bookly-thumb-with-image' : '' ) ?>"
16
- style="<?php echo esc_attr( $img ? 'background-image: url(' . $img[0] . '); background-size: cover;' : '' ) ?>"
17
  >
18
  <i class="fas fa-fw fa-4x fa-camera mt-2 text-white w-100"></i>
19
  <?php if ( current_user_can( 'upload_files' ) ) : ?>
10
  <div class="col-md-auto">
11
  <div id="bookly-js-staff-avatar">
12
  <div class="form-group">
13
+ <?php $img = $staff->getImageUrl( 'thumbnail' ) ?>
14
 
15
  <div class="bookly-js-image bookly-thumb<?php echo esc_attr( $img ? ' bookly-thumb-with-image' : '' ) ?>"
16
+ style="<?php echo esc_attr( $img ? 'background-image: url(' . $img . '); background-size: cover;' : '' ) ?>"
17
  >
18
  <i class="fas fa-fw fa-4x fa-camera mt-2 text-white w-100"></i>
19
  <?php if ( current_user_can( 'upload_files' ) ) : ?>
backend/components/dialogs/staff/order/templates/dialog.php CHANGED
@@ -20,7 +20,7 @@ use Bookly\Backend\Components\Controls\Elements;
20
  </div>
21
  </div>
22
  </form>
23
- <div class="collapse" id="bookly-staff-template">
24
  <li class="form-group">
25
  <div class="row align-items-center">
26
  <input type="hidden" name="id" value="{{id}}"/>
20
  </div>
21
  </div>
22
  </form>
23
+ <div class="bookly-collapse" id="bookly-staff-template">
24
  <li class="form-group">
25
  <div class="row align-items-center">
26
  <input type="hidden" name="id" value="{{id}}"/>
backend/components/notices/nps/templates/nps.php CHANGED
@@ -13,7 +13,7 @@ use Bookly\Backend\Components\Controls\Buttons;
13
  <?php for ( $i = 1; $i <= 10; ++ $i ): ?><i class="bookly-js-star bookly-cursor-pointer far fa-star fa-lg text-muted"></i><?php endfor ?>
14
  </div>
15
  </div>
16
- <div id="bookly-nps-form" class="mt-4 collapse" style="max-width:400px;">
17
  <div class="form-group">
18
  <label for="bookly-nps-msg" class="control-label"><?php esc_html_e( 'What do you think should be improved?', 'bookly' ) ?></label>
19
  <textarea id="bookly-nps-msg" class="form-control"></textarea>
13
  <?php for ( $i = 1; $i <= 10; ++ $i ): ?><i class="bookly-js-star bookly-cursor-pointer far fa-star fa-lg text-muted"></i><?php endfor ?>
14
  </div>
15
  </div>
16
+ <div id="bookly-nps-form" class="mt-4 bookly-collapse" style="max-width:400px;">
17
  <div class="form-group">
18
  <label for="bookly-nps-msg" class="control-label"><?php esc_html_e( 'What do you think should be improved?', 'bookly' ) ?></label>
19
  <textarea id="bookly-nps-msg" class="form-control"></textarea>
backend/components/settings/Image.php CHANGED
@@ -17,13 +17,13 @@ class Image extends Lib\Base\Component
17
  */
18
  public static function render( $option_name, $class = 'lg' )
19
  {
20
- $img = wp_get_attachment_image_src( get_option( $option_name ), 'full' );
21
 
22
  self::renderTemplate( 'image', array(
23
- 'option_name' => $option_name,
24
  'option_value' => get_option( $option_name ),
25
- 'class' => $class,
26
- 'img_style' => $img ? 'background-image: url(' . $img[0] . '); background-size: contain;' : '',
27
  'delete_style' => $img ? '' : 'display: none;',
28
  ) );
29
  }
17
  */
18
  public static function render( $option_name, $class = 'lg' )
19
  {
20
+ $img = Lib\Utils\Common::getAttachmentUrl( get_option( $option_name ), 'full' );
21
 
22
  self::renderTemplate( 'image', array(
23
+ 'option_name' => $option_name,
24
  'option_value' => get_option( $option_name ),
25
+ 'class' => $class,
26
+ 'img_style' => $img ? 'background-image: url(' . $img . '); background-size: contain;' : '',
27
  'delete_style' => $img ? '' : 'display: none;',
28
  ) );
29
  }
backend/components/settings/Inputs.php CHANGED
@@ -35,6 +35,57 @@ class Inputs
35
  echo self::buildControl( $option_name, $label, $help, $control );
36
  }
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  /**
39
  * Render row with numeric inputs
40
  *
35
  echo self::buildControl( $option_name, $label, $help, $control );
36
  }
37
 
38
+ /**
39
+ * Render reorder.
40
+ *
41
+ * @param string $option_name
42
+ * @param string $label
43
+ * @param string $help
44
+ * @param array $titles
45
+ */
46
+ public static function renderReorder( $option_name, $label = null, $help = null, array $titles = array() )
47
+ {
48
+ $values = (array) get_option( $option_name );
49
+ $getTitle = function ( &$titles, $value ) {
50
+ foreach ( $titles as $key => $data ) {
51
+ if ( $data[0] == $value ) {
52
+ $title = $data[1];
53
+ unset( $titles[ $key ] );
54
+
55
+ return $title;
56
+ }
57
+ }
58
+
59
+ return str_replace( array( '-', '_' ), array( ' ', ' ' ), ucfirst( $value ) );
60
+ };
61
+ $reorder = esc_attr__( 'Reorder', 'bookly' );
62
+ $getItem = function ( $value, $title ) use ( $option_name, $reorder ) {
63
+ return strtr(
64
+ '<div>
65
+ <i class="fas fa-fw fa-bars text-muted bookly-cursor-move bookly-js-draghandle" title="{reorder}"></i>
66
+ <input type="hidden" name="{name}[]" value="{value}">{caption}
67
+ </div>',
68
+ array(
69
+ '{reorder}' => $reorder,
70
+ '{name}' => $option_name,
71
+ '{value}' => esc_attr( $value ),
72
+ '{caption}' => esc_html( $title ),
73
+ )
74
+ );
75
+ };
76
+ $control = '';
77
+ foreach ( $values as $value ) {
78
+ $control .= $getItem( $value, $getTitle( $titles, $value ) );
79
+ }
80
+ foreach ( $titles as $option ) {
81
+ $control .= $getItem( $option[0], $option[1] );
82
+ }
83
+
84
+ $control = "<div id=\"$option_name\" class=\"bookly-js-drag-container\">$control</div>";
85
+
86
+ echo self::buildControl( $option_name, $label, $help, $control );
87
+ }
88
+
89
  /**
90
  * Render row with numeric inputs
91
  *
backend/modules/appearance/Ajax.php CHANGED
@@ -29,7 +29,8 @@ class Ajax extends Lib\Base\Ajax
29
  'bookly_l10n_info_payment_step_several_apps',
30
  'bookly_l10n_info_service_step',
31
  'bookly_l10n_info_time_step',
32
- // Service and staff info at service step.
 
33
  'bookly_l10n_step_service_service_info',
34
  'bookly_l10n_step_service_staff_info',
35
  // Step, label and option texts.
@@ -98,6 +99,7 @@ class Ajax extends Lib\Base\Ajax
98
  'bookly_app_show_login_button',
99
  'bookly_app_show_notes',
100
  'bookly_app_show_progress_tracker',
 
101
  'bookly_app_show_service_info',
102
  'bookly_app_show_staff_info',
103
  'bookly_app_show_single_slot',
29
  'bookly_l10n_info_payment_step_several_apps',
30
  'bookly_l10n_info_service_step',
31
  'bookly_l10n_info_time_step',
32
+ // Category, service and staff info at service step.
33
+ 'bookly_l10n_step_service_category_info',
34
  'bookly_l10n_step_service_service_info',
35
  'bookly_l10n_step_service_staff_info',
36
  // Step, label and option texts.
99
  'bookly_app_show_login_button',
100
  'bookly_app_show_notes',
101
  'bookly_app_show_progress_tracker',
102
+ 'bookly_app_show_category_info',
103
  'bookly_app_show_service_info',
104
  'bookly_app_show_staff_info',
105
  'bookly_app_show_single_slot',
backend/modules/appearance/Codes.php CHANGED
@@ -25,23 +25,28 @@ class Codes
25
  'loop' => array(
26
  'item' => 'appointment',
27
  'codes' => array(
28
- 'service_name' => array( 'description' => __( 'Service name of appointment', 'bookly' ) ),
29
- 'service_info' => array( 'description' => __( 'Info of service', 'bookly' ), 'if' => true ),
 
 
30
  'category_name' => array( 'description' => __( 'Service category name of appointment', 'bookly' ), 'if' => true ),
31
  'service_duration' => array( 'description' => __( 'Service duration of appointment', 'bookly' ) ),
 
 
32
  'service_price' => array( 'description' => __( 'Service price of appointment', 'bookly' ), 'if' => true ),
33
  'staff_name' => array( 'description' => __( 'Staff member full name in appointment', 'bookly' ) ),
34
- 'appointment_date' => array( 'description' => __( 'Date of appointment', 'bookly' ), 'if' => true ),
35
- 'appointment_time' => array( 'description' => __( 'Time of appointment', 'bookly' ), 'if' => true ),
36
  ),
37
  ),
38
  'flags' => array( 'step' => '>1' ),
39
  ),
40
- 'appointments_count' => array( 'description' => __( 'Total quantity of appointments in cart', 'bookly' ), 'flags' => array( 'step' => 7, 'extra_codes' => true ) ),
41
  'appointment_date' => array( 'description' => __( 'Date of appointment', 'bookly' ), 'if' => true, 'flags' => array( 'step' => '>3' ) ),
42
  'appointment_time' => array( 'description' => __( 'Time of appointment', 'bookly' ), 'if' => true, 'flags' => array( 'step' => '>3' ) ),
 
43
  'booking_number' => array( 'description' => __( 'Booking number', 'bookly' ), 'flags' => array( 'step' => 8, 'extra_codes' => true ) ),
44
- 'category_name' => array( 'description' => __( 'Name of category', 'bookly' ) ),
 
 
45
  'client_address' => array( 'description' => __( 'Address of client', 'bookly' ), 'if' => true ),
46
  'client_email' => array( 'description' => __( 'Email of client', 'bookly' ), 'if' => true ),
47
  'client_first_name' => array( 'description' => __( 'First name of client', 'bookly' ), 'if' => true ),
@@ -51,9 +56,9 @@ class Codes
51
  'client_phone' => array( 'description' => __( 'Phone of client', 'bookly' ), 'if' => true ),
52
  'login_form' => array( 'description' => __( 'Login form', 'bookly' ), 'flags' => array( 'step' => 6, 'extra_codes' => true ) ),
53
  'service_duration' => array( 'description' => __( 'Duration of service', 'bookly' ) ),
 
54
  'service_info' => array( 'description' => __( 'Info of service', 'bookly' ), 'if' => true ),
55
  'service_name' => array( 'description' => __( 'Name of service', 'bookly' ) ),
56
- 'service_image' => array( 'description' => __( 'Image of service', 'bookly' ), 'if' => true ),
57
  'service_price' => array( 'description' => __( 'Price of service', 'bookly' ), 'if' => true ),
58
  'staff_info' => array( 'description' => __( 'Info of staff member', 'bookly' ), 'if' => true ),
59
  'staff_name' => array( 'description' => __( 'Full name of staff member', 'bookly' ) ),
@@ -90,14 +95,29 @@ class Codes
90
  {
91
  return json_encode( array(
92
  'service_duration' => array( 'description' => __( 'Duration of service', 'bookly' ) ),
93
- 'service_info' => array( 'description' => __( 'Info of service', 'bookly' ), 'if' => true ),
94
- 'service_name' => array( 'description' => __( 'Name of service', 'bookly' ) ),
95
  'service_image' => array( 'description' => __( 'Image of service', 'bookly' ), 'if' => true ),
96
  'service_image_url' => array( 'description' => __( 'URL of service image (to use inside img tag)', 'bookly' ), 'if' => true ),
 
 
97
  'service_price' => array( 'description' => __( 'Price of service', 'bookly' ), 'if' => true ),
98
  ) );
99
  }
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  /**
102
  * Get JSON for appearance staff codes
103
  *
25
  'loop' => array(
26
  'item' => 'appointment',
27
  'codes' => array(
28
+ 'appointment_id' => array( 'description' => __( 'Date of appointment', 'bookly' ), 'if' => true ),
29
+ 'appointment_date' => array( 'description' => __( 'Date of appointment', 'bookly' ), 'if' => true ),
30
+ 'appointment_time' => array( 'description' => __( 'Time of appointment', 'bookly' ), 'if' => true ),
31
+ 'category_info' => array( 'description' => __( 'Service category info of appointment', 'bookly' ), 'if' => true ),
32
  'category_name' => array( 'description' => __( 'Service category name of appointment', 'bookly' ), 'if' => true ),
33
  'service_duration' => array( 'description' => __( 'Service duration of appointment', 'bookly' ) ),
34
+ 'service_info' => array( 'description' => __( 'Info of service', 'bookly' ), 'if' => true ),
35
+ 'service_name' => array( 'description' => __( 'Service name of appointment', 'bookly' ) ),
36
  'service_price' => array( 'description' => __( 'Service price of appointment', 'bookly' ), 'if' => true ),
37
  'staff_name' => array( 'description' => __( 'Staff member full name in appointment', 'bookly' ) ),
 
 
38
  ),
39
  ),
40
  'flags' => array( 'step' => '>1' ),
41
  ),
42
+ 'appointment_id' => array( 'description' => __( 'Date of appointment', 'bookly' ), 'if' => true, 'flags' => array( 'step' => '>3' ) ),
43
  'appointment_date' => array( 'description' => __( 'Date of appointment', 'bookly' ), 'if' => true, 'flags' => array( 'step' => '>3' ) ),
44
  'appointment_time' => array( 'description' => __( 'Time of appointment', 'bookly' ), 'if' => true, 'flags' => array( 'step' => '>3' ) ),
45
+ 'appointments_count' => array( 'description' => __( 'Total quantity of appointments in cart', 'bookly' ), 'flags' => array( 'step' => 7, 'extra_codes' => true ) ),
46
  'booking_number' => array( 'description' => __( 'Booking number', 'bookly' ), 'flags' => array( 'step' => 8, 'extra_codes' => true ) ),
47
+ 'category_image' => array( 'description' => __( 'Image of category', 'bookly' ), 'if' => true, 'flags' => array( 'step' => '>1' ) ),
48
+ 'category_info' => array( 'description' => __( 'Info of category', 'bookly' ), 'if' => true, 'flags' => array( 'step' => '>1' ) ),
49
+ 'category_name' => array( 'description' => __( 'Name of category', 'bookly' ), 'if' => true, 'flags' => array( 'step' => '>1' ) ),
50
  'client_address' => array( 'description' => __( 'Address of client', 'bookly' ), 'if' => true ),
51
  'client_email' => array( 'description' => __( 'Email of client', 'bookly' ), 'if' => true ),
52
  'client_first_name' => array( 'description' => __( 'First name of client', 'bookly' ), 'if' => true ),
56
  'client_phone' => array( 'description' => __( 'Phone of client', 'bookly' ), 'if' => true ),
57
  'login_form' => array( 'description' => __( 'Login form', 'bookly' ), 'flags' => array( 'step' => 6, 'extra_codes' => true ) ),
58
  'service_duration' => array( 'description' => __( 'Duration of service', 'bookly' ) ),
59
+ 'service_image' => array( 'description' => __( 'Image of service', 'bookly' ), 'if' => true ),
60
  'service_info' => array( 'description' => __( 'Info of service', 'bookly' ), 'if' => true ),
61
  'service_name' => array( 'description' => __( 'Name of service', 'bookly' ) ),
 
62
  'service_price' => array( 'description' => __( 'Price of service', 'bookly' ), 'if' => true ),
63
  'staff_info' => array( 'description' => __( 'Info of staff member', 'bookly' ), 'if' => true ),
64
  'staff_name' => array( 'description' => __( 'Full name of staff member', 'bookly' ) ),
95
  {
96
  return json_encode( array(
97
  'service_duration' => array( 'description' => __( 'Duration of service', 'bookly' ) ),
 
 
98
  'service_image' => array( 'description' => __( 'Image of service', 'bookly' ), 'if' => true ),
99
  'service_image_url' => array( 'description' => __( 'URL of service image (to use inside img tag)', 'bookly' ), 'if' => true ),
100
+ 'service_info' => array( 'description' => __( 'Info of service', 'bookly' ), 'if' => true ),
101
+ 'service_name' => array( 'description' => __( 'Name of service', 'bookly' ) ),
102
  'service_price' => array( 'description' => __( 'Price of service', 'bookly' ), 'if' => true ),
103
  ) );
104
  }
105
 
106
+ /**
107
+ * Get JSON for appearance category codes
108
+ *
109
+ * @return string
110
+ */
111
+ public static function getCategoryCodes()
112
+ {
113
+ return json_encode( array(
114
+ 'category_image' => array( 'description' => __( 'Image of category', 'bookly' ), 'if' => true ),
115
+ 'category_image_url' => array( 'description' => __( 'URL of category image (to use inside img tag)', 'bookly' ), 'if' => true ),
116
+ 'category_info' => array( 'description' => __( 'Info of category', 'bookly' ), 'if' => true ),
117
+ 'category_name' => array( 'description' => __( 'Name of category', 'bookly' ) ),
118
+ ) );
119
+ }
120
+
121
  /**
122
  * Get JSON for appearance staff codes
123
  *
backend/modules/appearance/resources/js/appearance.js CHANGED
@@ -31,6 +31,8 @@ jQuery(function ($) {
31
  $staff_select = $('.bookly-js-select-employee'),
32
  $duration_select = $('.bookly-js-select-duration'),
33
  $location_select = $('.bookly-js-select-location'),
 
 
34
  $show_service_info = $('#bookly-show-service-info'),
35
  $service_info = $('#bookly-service-info'),
36
  $show_staff_info = $('#bookly-show-staff-info'),
@@ -292,6 +294,11 @@ jQuery(function ($) {
292
  $duration_select.val(-1);
293
  }
294
 
 
 
 
 
 
295
  // Service info.
296
  $show_service_info.on('change', function () {
297
  $service_info.toggle($(this).prop('checked'));
@@ -687,28 +694,28 @@ jQuery(function ($) {
687
  $first_last_name.on('change', function () {
688
  $first_last_name.closest('[data-toggle="bookly-popover"]').booklyPopover('toggle');
689
  if (this.checked) {
690
- $('.bookly-js-details-full-name').addClass('collapse');
691
- $('.bookly-js-details-first-last-name').removeClass('collapse');
692
  if ($confirm_email.is(':checked')) {
693
- $('.bookly-js-details-email').removeClass('collapse');
694
- $('.bookly-js-details-confirm').removeClass('collapse');
695
- $('.bookly-js-details-email-confirm').addClass('collapse');
696
  } else {
697
- $('.bookly-js-details-email').removeClass('collapse');
698
- $('.bookly-js-details-confirm').addClass('collapse');
699
- $('.bookly-js-details-email-confirm').addClass('collapse');
700
  }
701
  } else {
702
- $('.bookly-js-details-full-name').removeClass('collapse');
703
- $('.bookly-js-details-first-last-name').addClass('collapse');
704
  if ($confirm_email.is(':checked')) {
705
- $('.bookly-js-details-email').addClass('collapse');
706
- $('.bookly-js-details-confirm').addClass('collapse');
707
- $('.bookly-js-details-email-confirm').removeClass('collapse');
708
  } else {
709
- $('.bookly-js-details-email').removeClass('collapse');
710
- $('.bookly-js-details-confirm').addClass('collapse');
711
- $('.bookly-js-details-email-confirm').addClass('collapse');
712
  }
713
  }
714
  });
@@ -717,23 +724,23 @@ jQuery(function ($) {
717
  $confirm_email.on('change', function () {
718
  if (this.checked) {
719
  if ($first_last_name.is(':checked')) {
720
- $('.bookly-js-details-email').removeClass('collapse');
721
- $('.bookly-js-details-confirm').removeClass('collapse');
722
- $('.bookly-js-details-email-confirm').addClass('collapse');
723
  } else {
724
- $('.bookly-js-details-email').addClass('collapse');
725
- $('.bookly-js-details-confirm').addClass('collapse');
726
- $('.bookly-js-details-email-confirm').removeClass('collapse');
727
  }
728
  } else {
729
  if ($first_last_name.is(':checked')) {
730
- $('.bookly-js-details-email').removeClass('collapse');
731
- $('.bookly-js-details-confirm').addClass('collapse');
732
- $('.bookly-js-details-email-confirm').addClass('collapse');
733
  } else {
734
- $('.bookly-js-details-email').removeClass('collapse');
735
- $('.bookly-js-details-confirm').addClass('collapse');
736
- $('.bookly-js-details-email-confirm').addClass('collapse');
737
  }
738
  }
739
  });
@@ -981,8 +988,9 @@ jQuery(function ($) {
981
  'bookly_group_booking_app_show_nop': Number($time_step_nop.prop('checked')),
982
  'bookly_ratings_app_show_on_frontend': Number($show_ratings.prop('checked')),
983
  'bookly_app_show_service_info': Number($show_service_info.prop('checked')),
 
984
  'bookly_app_show_staff_info': Number($show_staff_info.prop('checked')),
985
- 'bookly_cst_required_details': $required_details.val() == 'both' ? ['phone', 'email'] : [$required_details.val()],
986
  'bookly_cst_first_last_name': Number($first_last_name.prop('checked')),
987
  'bookly_app_show_email_confirm': Number($confirm_email.prop('checked')),
988
  'bookly_service_extras_enabled': Number($bookly_show_step_extras.prop('checked')),
31
  $staff_select = $('.bookly-js-select-employee'),
32
  $duration_select = $('.bookly-js-select-duration'),
33
  $location_select = $('.bookly-js-select-location'),
34
+ $show_category_info = $('#bookly-show-category-info'),
35
+ $category_info = $('#bookly-category-info'),
36
  $show_service_info = $('#bookly-show-service-info'),
37
  $service_info = $('#bookly-service-info'),
38
  $show_staff_info = $('#bookly-show-staff-info'),
294
  $duration_select.val(-1);
295
  }
296
 
297
+ // Category info.
298
+ $show_category_info.on('change', function () {
299
+ $category_info.toggle($(this).prop('checked'));
300
+ }).trigger('change');
301
+
302
  // Service info.
303
  $show_service_info.on('change', function () {
304
  $service_info.toggle($(this).prop('checked'));
694
  $first_last_name.on('change', function () {
695
  $first_last_name.closest('[data-toggle="bookly-popover"]').booklyPopover('toggle');
696
  if (this.checked) {
697
+ $('.bookly-js-details-full-name').addClass('bookly-collapse');
698
+ $('.bookly-js-details-first-last-name').removeClass('bookly-collapse');
699
  if ($confirm_email.is(':checked')) {
700
+ $('.bookly-js-details-email').removeClass('bookly-collapse');
701
+ $('.bookly-js-details-confirm').removeClass('bookly-collapse');
702
+ $('.bookly-js-details-email-confirm').addClass('bookly-collapse');
703
  } else {
704
+ $('.bookly-js-details-email').removeClass('bookly-collapse');
705
+ $('.bookly-js-details-confirm').addClass('bookly-collapse');
706
+ $('.bookly-js-details-email-confirm').addClass('bookly-collapse');
707
  }
708
  } else {
709
+ $('.bookly-js-details-full-name').removeClass('bookly-collapse');
710
+ $('.bookly-js-details-first-last-name').addClass('bookly-collapse');
711
  if ($confirm_email.is(':checked')) {
712
+ $('.bookly-js-details-email').addClass('bookly-collapse');
713
+ $('.bookly-js-details-confirm').addClass('bookly-collapse');
714
+ $('.bookly-js-details-email-confirm').removeClass('bookly-collapse');
715
  } else {
716
+ $('.bookly-js-details-email').removeClass('bookly-collapse');
717
+ $('.bookly-js-details-confirm').addClass('bookly-collapse');
718
+ $('.bookly-js-details-email-confirm').addClass('bookly-collapse');
719
  }
720
  }
721
  });
724
  $confirm_email.on('change', function () {
725
  if (this.checked) {
726
  if ($first_last_name.is(':checked')) {
727
+ $('.bookly-js-details-email').removeClass('bookly-collapse');
728
+ $('.bookly-js-details-confirm').removeClass('bookly-collapse');
729
+ $('.bookly-js-details-email-confirm').addClass('bookly-collapse');
730
  } else {
731
+ $('.bookly-js-details-email').addClass('bookly-collapse');
732
+ $('.bookly-js-details-confirm').addClass('bookly-collapse');
733
+ $('.bookly-js-details-email-confirm').removeClass('bookly-collapse');
734
  }
735
  } else {
736
  if ($first_last_name.is(':checked')) {
737
+ $('.bookly-js-details-email').removeClass('bookly-collapse');
738
+ $('.bookly-js-details-confirm').addClass('bookly-collapse');
739
+ $('.bookly-js-details-email-confirm').addClass('bookly-collapse');
740
  } else {
741
+ $('.bookly-js-details-email').removeClass('bookly-collapse');
742
+ $('.bookly-js-details-confirm').addClass('bookly-collapse');
743
+ $('.bookly-js-details-email-confirm').addClass('bookly-collapse');
744
  }
745
  }
746
  });
988
  'bookly_group_booking_app_show_nop': Number($time_step_nop.prop('checked')),
989
  'bookly_ratings_app_show_on_frontend': Number($show_ratings.prop('checked')),
990
  'bookly_app_show_service_info': Number($show_service_info.prop('checked')),
991
+ 'bookly_app_show_category_info': Number($show_category_info.prop('checked')),
992
  'bookly_app_show_staff_info': Number($show_staff_info.prop('checked')),
993
+ 'bookly_cst_required_details': $required_details.val() === 'both' ? ['phone', 'email'] : [$required_details.val()],
994
  'bookly_cst_first_last_name': Number($first_last_name.prop('checked')),
995
  'bookly_app_show_email_confirm': Number($confirm_email.prop('checked')),
996
  'bookly_service_extras_enabled': Number($bookly_show_step_extras.prop('checked')),
backend/modules/appearance/templates/_1_service.php CHANGED
@@ -101,7 +101,9 @@ global $wp_locale;
101
  <?php Proxy\GroupBooking::renderNOP() ?>
102
  <?php Proxy\MultiplyAppointments::renderQuantity() ?>
103
  <?php Proxy\ChainAppointments::renderChainTip() ?>
104
-
 
 
105
  </div>
106
  <div id="bookly-service-info" class="bookly-box bookly-service-info">
107
  <?php Elements::renderText( 'bookly_l10n_step_service_service_info', Codes::getServiceCodes() ) ?>
101
  <?php Proxy\GroupBooking::renderNOP() ?>
102
  <?php Proxy\MultiplyAppointments::renderQuantity() ?>
103
  <?php Proxy\ChainAppointments::renderChainTip() ?>
104
+ </div>
105
+ <div id="bookly-category-info" class="bookly-box bookly-category-info">
106
+ <?php Elements::renderText( 'bookly_l10n_step_service_category_info', Codes::getCategoryCodes() ) ?>
107
  </div>
108
  <div id="bookly-service-info" class="bookly-box bookly-service-info">
109
  <?php Elements::renderText( 'bookly_l10n_step_service_service_info', Codes::getServiceCodes() ) ?>
backend/modules/appearance/templates/_6_details.php CHANGED
@@ -22,7 +22,7 @@ use Bookly\Lib\Config;
22
  </div>
23
  <div class="bookly-details-step">
24
 
25
- <div class="bookly-box bookly-table bookly-js-details-first-last-name<?php echo ! get_option( 'bookly_cst_first_last_name' ) ? ' collapse' : '' ?>">
26
  <div class="bookly-form-group">
27
  <?php Elements::renderLabel( array( 'bookly_l10n_label_first_name', 'bookly_l10n_required_first_name', ) ) ?>
28
  <div>
@@ -38,7 +38,7 @@ use Bookly\Lib\Config;
38
  </div>
39
 
40
  <div class="bookly-box bookly-table">
41
- <div class="bookly-form-group bookly-js-details-full-name<?php echo get_option( 'bookly_cst_first_last_name' ) ? ' collapse' : '' ?>">
42
  <?php Elements::renderLabel( array( 'bookly_l10n_label_name', 'bookly_l10n_required_name', ) ) ?>
43
  <div>
44
  <input type="text" value="" maxlength="60" />
@@ -50,13 +50,13 @@ use Bookly\Lib\Config;
50
  <input type="text" class="bookly-animate<?php if ( get_option( 'bookly_cst_phone_default_country' ) != 'disabled' ) : ?> bookly-user-phone<?php endif ?>" value="" />
51
  </div>
52
  </div>
53
- <div class="bookly-form-group bookly-js-details-email<?php echo ! get_option( 'bookly_cst_first_last_name' ) && get_option( 'bookly_app_show_email_confirm' ) ? ' collapse' : '' ?>">
54
  <?php Elements::renderLabel( array( 'bookly_l10n_label_email', 'bookly_l10n_required_email', 'bookly_l10n_email_in_use' ) ) ?>
55
  <div>
56
  <input class="bookly-animate" maxlength="40" type="text" value="" />
57
  </div>
58
  </div>
59
- <div class="bookly-form-group bookly-js-details-confirm<?php echo ! get_option( 'bookly_cst_first_last_name' ) || ! get_option( 'bookly_app_show_email_confirm' ) ? ' collapse' : '' ?>">
60
  <?php Elements::renderLabel( array( 'bookly_l10n_label_email_confirm', 'bookly_l10n_email_confirm_not_match' ) ) ?>
61
  <div>
62
  <input maxlength="40" type="text" value="" />
@@ -64,7 +64,7 @@ use Bookly\Lib\Config;
64
  </div>
65
  </div>
66
 
67
- <div class="bookly-box bookly-table bookly-js-details-email-confirm<?php echo get_option( 'bookly_cst_first_last_name' ) || ! get_option( 'bookly_app_show_email_confirm' ) ? ' collapse' : '' ?>">
68
  <div class="bookly-form-group">
69
  <?php Elements::renderLabel( array( 'bookly_l10n_label_email', 'bookly_l10n_required_email' ) ) ?>
70
  <div>
22
  </div>
23
  <div class="bookly-details-step">
24
 
25
+ <div class="bookly-box bookly-table bookly-js-details-first-last-name<?php echo ! get_option( 'bookly_cst_first_last_name' ) ? ' bookly-collapse' : '' ?>">
26
  <div class="bookly-form-group">
27
  <?php Elements::renderLabel( array( 'bookly_l10n_label_first_name', 'bookly_l10n_required_first_name', ) ) ?>
28
  <div>
38
  </div>
39
 
40
  <div class="bookly-box bookly-table">
41
+ <div class="bookly-form-group bookly-js-details-full-name<?php echo get_option( 'bookly_cst_first_last_name' ) ? ' bookly-collapse' : '' ?>">
42
  <?php Elements::renderLabel( array( 'bookly_l10n_label_name', 'bookly_l10n_required_name', ) ) ?>
43
  <div>
44
  <input type="text" value="" maxlength="60" />
50
  <input type="text" class="bookly-animate<?php if ( get_option( 'bookly_cst_phone_default_country' ) != 'disabled' ) : ?> bookly-user-phone<?php endif ?>" value="" />
51
  </div>
52
  </div>
53
+ <div class="bookly-form-group bookly-js-details-email<?php echo ! get_option( 'bookly_cst_first_last_name' ) && get_option( 'bookly_app_show_email_confirm' ) ? ' bookly-collapse' : '' ?>">
54
  <?php Elements::renderLabel( array( 'bookly_l10n_label_email', 'bookly_l10n_required_email', 'bookly_l10n_email_in_use' ) ) ?>
55
  <div>
56
  <input class="bookly-animate" maxlength="40" type="text" value="" />
57
  </div>
58
  </div>
59
+ <div class="bookly-form-group bookly-js-details-confirm<?php echo ! get_option( 'bookly_cst_first_last_name' ) || ! get_option( 'bookly_app_show_email_confirm' ) ? ' bookly-collapse' : '' ?>">
60
  <?php Elements::renderLabel( array( 'bookly_l10n_label_email_confirm', 'bookly_l10n_email_confirm_not_match' ) ) ?>
61
  <div>
62
  <input maxlength="40" type="text" value="" />
64
  </div>
65
  </div>
66
 
67
+ <div class="bookly-box bookly-table bookly-js-details-email-confirm<?php echo get_option( 'bookly_cst_first_last_name' ) || ! get_option( 'bookly_app_show_email_confirm' ) ? ' bookly-collapse' : '' ?>">
68
  <div class="bookly-form-group">
69
  <?php Elements::renderLabel( array( 'bookly_l10n_label_email', 'bookly_l10n_required_email' ) ) ?>
70
  <div>
backend/modules/appearance/templates/_8_complete.php CHANGED
@@ -9,10 +9,10 @@ use Bookly\Backend\Components\Editable\Elements;
9
  <?php Elements::renderText( 'bookly_l10n_info_complete_step', Codes::getJson( 8, true ) ) ?>
10
  <?php Proxy\Pro::renderQRCode() ?>
11
  </div>
12
- <div class="bookly-box bookly-js-done-limit-error collapse">
13
  <?php Elements::renderText( 'bookly_l10n_info_complete_step_limit_error', Codes::getJson( 8 ) ) ?>
14
  </div>
15
- <div class="bookly-box bookly-js-done-processing collapse">
16
  <?php Elements::renderText( 'bookly_l10n_info_complete_step_processing', Codes::getJson( 8, true ) ) ?>
17
  <?php Proxy\Pro::renderQRCode() ?>
18
  </div>
9
  <?php Elements::renderText( 'bookly_l10n_info_complete_step', Codes::getJson( 8, true ) ) ?>
10
  <?php Proxy\Pro::renderQRCode() ?>
11
  </div>
12
+ <div class="bookly-box bookly-js-done-limit-error bookly-collapse">
13
  <?php Elements::renderText( 'bookly_l10n_info_complete_step_limit_error', Codes::getJson( 8 ) ) ?>
14
  </div>
15
+ <div class="bookly-box bookly-js-done-processing bookly-collapse">
16
  <?php Elements::renderText( 'bookly_l10n_info_complete_step_processing', Codes::getJson( 8, true ) ) ?>
17
  <?php Proxy\Pro::renderQRCode() ?>
18
  </div>
backend/modules/appearance/templates/index.php CHANGED
@@ -83,6 +83,9 @@ use Bookly\Backend\Modules\Appearance\Proxy;
83
  <div class="col-md-3 my-2">
84
  <?php Inputs::renderCheckBox( __( 'Show service duration next to service name', 'bookly' ), null, get_option( 'bookly_app_service_name_with_duration' ), array( 'id' => 'bookly-service-name-with-duration' ) ) ?>
85
  </div>
 
 
 
86
  <div class="col-md-3 my-2">
87
  <?php Inputs::renderCheckBox( __( 'Show service info', 'bookly' ), null, get_option( 'bookly_app_show_service_info' ), array( 'id' => 'bookly-show-service-info' ) ) ?>
88
  </div>
@@ -92,7 +95,7 @@ use Bookly\Backend\Modules\Appearance\Proxy;
92
  <?php Proxy\Shared::renderServiceStepSettings() ?>
93
  </div>
94
  </div>
95
- <div class="bookly-js-time-settings collapse">
96
  <div class="row">
97
  <div class="col-md-3 my-2">
98
  <?php Inputs::renderCheckBox( __( 'Show calendar', 'bookly' ), null, get_option( 'bookly_app_show_calendar' ), array( 'id' => 'bookly-show-calendar' ) ) ?>
@@ -117,7 +120,7 @@ use Bookly\Backend\Modules\Appearance\Proxy;
117
  <?php Proxy\Cart::renderCartStepSettings() ?>
118
  <?php Proxy\ServiceExtras::renderStepSettings() ?>
119
 
120
- <div class="bookly-js-details-settings collapse">
121
  <div class="row">
122
  <div class="col-md-3">
123
  <div class="form-group mb-0">
@@ -154,7 +157,7 @@ use Bookly\Backend\Modules\Appearance\Proxy;
154
  </div>
155
  </div>
156
  </div>
157
- <div class="bookly-js-payment-settings collapse">
158
  <div class="row">
159
  <?php Proxy\Coupons::renderShowCoupons() ?>
160
  <?php Proxy\Pro::renderShowTips() ?>
@@ -162,7 +165,7 @@ use Bookly\Backend\Modules\Appearance\Proxy;
162
  <?php Proxy\Pro::renderBookingStatesSelector() ?>
163
  </div>
164
 
165
- <div class="bookly-js-done-settings collapse">
166
  <div class="row">
167
  <div class="col-md-3 my-2">
168
  <?php Inputs::renderCheckBox( __( 'Show \'Start over\' button', 'bookly' ), null, get_option( 'bookly_app_show_start_over' ), array( 'id' => 'bookly-show-start-over' ) ) ?>
83
  <div class="col-md-3 my-2">
84
  <?php Inputs::renderCheckBox( __( 'Show service duration next to service name', 'bookly' ), null, get_option( 'bookly_app_service_name_with_duration' ), array( 'id' => 'bookly-service-name-with-duration' ) ) ?>
85
  </div>
86
+ <div class="col-md-3 my-2">
87
+ <?php Inputs::renderCheckBox( __( 'Show category info', 'bookly' ), null, get_option( 'bookly_app_show_category_info' ), array( 'id' => 'bookly-show-category-info' ) ) ?>
88
+ </div>
89
  <div class="col-md-3 my-2">
90
  <?php Inputs::renderCheckBox( __( 'Show service info', 'bookly' ), null, get_option( 'bookly_app_show_service_info' ), array( 'id' => 'bookly-show-service-info' ) ) ?>
91
  </div>
95
  <?php Proxy\Shared::renderServiceStepSettings() ?>
96
  </div>
97
  </div>
98
+ <div class="bookly-js-time-settings bookly-collapse">
99
  <div class="row">
100
  <div class="col-md-3 my-2">
101
  <?php Inputs::renderCheckBox( __( 'Show calendar', 'bookly' ), null, get_option( 'bookly_app_show_calendar' ), array( 'id' => 'bookly-show-calendar' ) ) ?>
120
  <?php Proxy\Cart::renderCartStepSettings() ?>
121
  <?php Proxy\ServiceExtras::renderStepSettings() ?>
122
 
123
+ <div class="bookly-js-details-settings bookly-collapse">
124
  <div class="row">
125
  <div class="col-md-3">
126
  <div class="form-group mb-0">
157
  </div>
158
  </div>
159
  </div>
160
+ <div class="bookly-js-payment-settings bookly-collapse">
161
  <div class="row">
162
  <?php Proxy\Coupons::renderShowCoupons() ?>
163
  <?php Proxy\Pro::renderShowTips() ?>
165
  <?php Proxy\Pro::renderBookingStatesSelector() ?>
166
  </div>
167
 
168
+ <div class="bookly-js-done-settings bookly-collapse">
169
  <div class="row">
170
  <div class="col-md-3 my-2">
171
  <?php Inputs::renderCheckBox( __( 'Show \'Start over\' button', 'bookly' ), null, get_option( 'bookly_app_show_start_over' ), array( 'id' => 'bookly-show-start-over' ) ) ?>
backend/modules/appointments/Ajax.php CHANGED
@@ -285,7 +285,8 @@ class Ajax extends Lib\Base\Ajax
285
  }
286
 
287
  $data[] = array(
288
- 'id' => Lib\Config::groupBookingActive() && $row['ca_id'] ? $row['id'] . '-' . $row['ca_id'] : $row['id'],
 
289
  'start_date' => $row['start_date'] === null ? __( 'N/A', 'bookly' ) : Lib\Utils\DateTime::formatDateTime( $row['start_date'] ),
290
  'staff' => array(
291
  'name' => $row['staff_name'] . ( $row['staff_any'] ? $postfix_any : '' ) . ( $row['staff_visibility'] == 'archive' ? $postfix_archived : '' ),
285
  }
286
 
287
  $data[] = array(
288
+ 'id' => $row['id'],
289
+ 'no' => Lib\Config::groupBookingActive() && $row['ca_id'] ? $row['id'] . '-' . $row['ca_id'] : $row['id'],
290
  'start_date' => $row['start_date'] === null ? __( 'N/A', 'bookly' ) : Lib\Utils\DateTime::formatDateTime( $row['start_date'] ),
291
  'staff' => array(
292
  'name' => $row['staff_name'] . ( $row['staff_any'] ? $postfix_any : '' ) . ( $row['staff_visibility'] == 'archive' ? $postfix_archived : '' ),
backend/modules/appointments/Page.php CHANGED
@@ -22,7 +22,7 @@ class Page extends Lib\Base\Component
22
  'module' => array( 'js/appointments.js' => array( 'bookly-backend-globals' ) ),
23
  ) );
24
 
25
- $datatables = Lib\Utils\Tables::getSettings( 'appointments' );
26
 
27
  wp_localize_script( 'bookly-appointments.js', 'BooklyL10n', array(
28
  'datePicker' => Lib\Utils\DateTime::datePickerOptions(),
22
  'module' => array( 'js/appointments.js' => array( 'bookly-backend-globals' ) ),
23
  ) );
24
 
25
+ $datatables = Lib\Utils\Tables::getSettings( Lib\Utils\Tables::APPOINTMENTS );
26
 
27
  wp_localize_script( 'bookly-appointments.js', 'BooklyL10n', array(
28
  'datePicker' => Lib\Utils\DateTime::datePickerOptions(),
backend/modules/appointments/resources/js/appointments.js CHANGED
@@ -1,56 +1,57 @@
1
  jQuery(function($) {
2
  'use strict';
3
  let
4
- $appointmentsList = $('#bookly-appointments-list'),
5
- $checkAllButton = $('#bookly-check-all'),
6
- $idFilter = $('#bookly-filter-id'),
7
  $appointmentDateFilter = $('#bookly-filter-date'),
8
  $creationDateFilter = $('#bookly-filter-creation-date'),
9
- $staffFilter = $('#bookly-filter-staff'),
10
- $customerFilter = $('#bookly-filter-customer'),
11
- $serviceFilter = $('#bookly-filter-service'),
12
- $statusFilter = $('#bookly-filter-status'),
13
- $locationFilter = $('#bookly-filter-location'),
14
- $newAppointmentBtn = $('#bookly-new-appointment'),
15
- $printDialog = $('#bookly-print-dialog'),
16
- $printSelectAll = $('#bookly-js-print-select-all', $printDialog),
17
- $printButton = $(':submit',$printDialog),
18
- $exportDialog = $('#bookly-export-dialog'),
19
- $exportSelectAll = $('#bookly-js-export-select-all', $exportDialog),
20
- $exportForm = $('form', $exportDialog),
21
  $showDeleteConfirmation = $('#bookly-js-show-confirm-deletion'),
22
- isMobile = false,
23
- urlParts = document.URL.split('#'),
24
- columns = [],
25
- order = [],
26
  pickers = {
27
- dateFormat: 'YYYY-MM-DD',
28
  appointmentDate: {
29
  startDate: moment().startOf('month'),
30
- endDate : moment().endOf('month'),
31
  },
32
  creationDate: {
33
  startDate: moment(),
34
- endDate : moment().add(100, 'years'),
35
  },
36
- }
 
37
  ;
38
 
39
  try {
40
- document.createEvent("TouchEvent");
41
  isMobile = true;
42
- } catch (e) {
43
 
44
- }
45
 
46
  $('.bookly-js-select').val(null);
47
 
48
  // Apply filter from anchor
49
  if (urlParts.length > 1) {
50
- urlParts[1].split('&').forEach(function (part) {
51
  var params = part.split('=');
52
- if (params[0] == 'appointment-date') {
53
- if (params['1'] == 'any') {
54
  $appointmentDateFilter
55
  .data('date', 'any').find('span')
56
  .html(BooklyL10n.dateRange.anyTime);
@@ -62,23 +63,30 @@ jQuery(function($) {
62
  .find('span')
63
  .html(pickers.appointmentDate.startDate.format(BooklyL10n.dateRange.format) + ' - ' + pickers.appointmentDate.endDate.format(BooklyL10n.dateRange.format));
64
  }
65
- } else if (params[0] == 'tasks') {
66
  $appointmentDateFilter
67
  .data('date', 'null').find('span')
68
  .html(BooklyL10n.tasks.title);
69
- } else if (params[0] == 'created-date') {
70
  pickers.creationDate.startDate = moment(params['1'].substring(0, 10));
71
  pickers.creationDate.endDate = moment(params['1'].substring(11));
72
  $creationDateFilter
73
  .data('date', pickers.creationDate.startDate.format(pickers.dateFormat) + ' - ' + pickers.creationDate.endDate.format(pickers.dateFormat))
74
  .find('span')
75
  .html(pickers.creationDate.startDate.format(BooklyL10n.dateRange.format) + ' - ' + pickers.creationDate.endDate.format(BooklyL10n.dateRange.format));
 
 
 
 
 
 
 
76
  } else {
77
  $('#bookly-filter-' + params[0]).val(params[1]);
78
  }
79
  });
80
  } else {
81
- $.each(BooklyL10n.datatables.appointments.settings.filter, function (field, value) {
82
  if (field !== 'status') {
83
  if (value != '') {
84
  $('#bookly-filter-' + field).val(value);
@@ -93,12 +101,20 @@ jQuery(function($) {
93
  });
94
  }
95
 
 
 
 
 
 
 
 
 
96
  Ladda.bind($('button[type=submit]', $exportForm).get(0), {timeout: 2000});
97
 
98
  /**
99
  * Init table columns.
100
  */
101
- $.each(BooklyL10n.datatables.appointments.settings.columns, function (column, show) {
102
  if (show) {
103
  switch (column) {
104
  case 'customer_full_name':
@@ -107,7 +123,7 @@ jQuery(function($) {
107
  case 'customer_phone':
108
  columns.push({
109
  data: 'customer.phone',
110
- render: function (data, type, row, meta) {
111
  if (isMobile) {
112
  return '<a href="tel:' + $.fn.dataTable.render.text().display(data) + '">' + $.fn.dataTable.render.text().display(data) + '</a>';
113
  } else {
@@ -131,17 +147,16 @@ jQuery(function($) {
131
  case 'service_title':
132
  columns.push({
133
  data: 'service.title',
134
- render: function ( data, type, row, meta ) {
135
  data = $.fn.dataTable.render.text().display(data);
136
  if (row.service.extras.length) {
137
  var extras = '<ul class="bookly-list list-dots">';
138
- $.each(row.service.extras, function (key, item) {
139
  extras += '<li><nobr>' + item.title + '</nobr></li>';
140
  });
141
  extras += '</ul>';
142
  return data + extras;
143
- }
144
- else {
145
  return data;
146
  }
147
  }
@@ -150,7 +165,7 @@ jQuery(function($) {
150
  case 'payment':
151
  columns.push({
152
  data: 'payment',
153
- render: function ( data, type, row, meta ) {
154
  if (row.payment_id) {
155
  return '<a type="button" data-action="show-payment" class="text-primary" data-payment_id="' + row.payment_id + '">' + data + '</a>';
156
  }
@@ -164,7 +179,7 @@ jQuery(function($) {
164
  case 'attachments':
165
  columns.push({
166
  data: 'attachment',
167
- render: function (data, type, row, meta) {
168
  if (data == '1') {
169
  return '<button type="button" class="btn btn-link" data-action="show-attachments" title="' + BooklyL10n.attachments + '"><i class="fas fa-fw fa-paperclip"></i></button>';
170
  }
@@ -175,7 +190,7 @@ jQuery(function($) {
175
  case 'rating':
176
  columns.push({
177
  data: 'rating',
178
- render: function ( data, type, row, meta ) {
179
  if (row.rating_comment == null) {
180
  return row.rating;
181
  } else {
@@ -193,7 +208,7 @@ jQuery(function($) {
193
  case 'online_meeting':
194
  columns.push({
195
  data: 'online_meeting_provider',
196
- render: function ( data, type, row, meta ) {
197
  switch (data) {
198
  case 'zoom':
199
  return '<a class="badge badge-primary" href="https://zoom.us/j/' + $.fn.dataTable.render.text().display(row.online_meeting_id) + '" target="_blank"><i class="fas fa-video fa-fw"></i> Zoom <i class="fas fa-external-link-alt fa-fw"></i></a>';
@@ -224,17 +239,19 @@ jQuery(function($) {
224
  }
225
  });
226
  columns.push({
 
227
  responsivePriority: 1,
228
- orderable : false,
229
- width : 120,
230
- render : function (data, type, row, meta) {
231
  return '<button type="button" class="btn btn-default" data-action="edit"><i class="far fa-fw fa-edit mr-lg-1"></i><span class="d-none d-lg-inline">' + BooklyL10n.edit + '…</span></button>';
232
  }
233
  });
234
  columns.push({
 
235
  responsivePriority: 1,
236
- orderable : false,
237
- render : function (data, type, row, meta) {
238
  const cb_id = row.ca_id === null ? 'bookly-dt-a-' + row.id : 'bookly-dt-ca-' + row.ca_id;
239
  return '<div class="custom-control custom-checkbox">' +
240
  '<input value="' + row.ca_id + '" data-appointment="' + row.id + '" id="' + cb_id + '" type="checkbox" class="custom-control-input">' +
@@ -245,8 +262,8 @@ jQuery(function($) {
245
 
246
  columns[0].responsivePriority = 0;
247
 
248
- $.each(BooklyL10n.datatables.appointments.settings.order, function (_, value) {
249
- const index = columns.findIndex(function (c) { return c.data === value.column; });
250
  if (index !== -1) {
251
  order.push([index, value.order]);
252
  }
@@ -255,25 +272,25 @@ jQuery(function($) {
255
  * Init DataTables.
256
  */
257
  var dt = $appointmentsList.DataTable({
258
- order : order,
259
- info : false,
260
- searching : false,
261
  lengthChange: false,
262
- processing : true,
263
- responsive : true,
264
- pageLength : 25,
265
- pagingType : 'numbers',
266
- serverSide : true,
267
- drawCallback: function( settings ) {
268
- $('[data-toggle="bookly-popover"]', $appointmentsList).on('click', function (e) {
269
  e.preventDefault();
270
  }).booklyPopover();
271
  dt.responsive.recalc();
272
  },
273
  ajax: {
274
- url : ajaxurl,
275
  type: 'POST',
276
- data: function (d) {
277
  return $.extend({action: 'bookly_get_appointments', csrf_token: BooklyL10nGlobal.csrf_token}, {
278
  filter: {
279
  id: $idFilter.val(),
@@ -289,17 +306,17 @@ jQuery(function($) {
289
  }
290
  },
291
  columns: columns,
292
- dom : "<'row'<'col-sm-12'tr>><'row float-left mt-3'<'col-sm-12'p>>",
293
  language: {
294
  zeroRecords: BooklyL10n.zeroRecords,
295
- processing: BooklyL10n.processing
296
  }
297
  });
298
 
299
  // Show ratings in expanded rows.
300
- dt.on( 'responsive-display', function (e, datatable, row, showHide, update) {
301
  if (showHide) {
302
- $('[data-toggle="bookly-popover"]', row.child()).on('click', function (e) {
303
  e.preventDefault();
304
  }).booklyPopover();
305
  }
@@ -308,7 +325,7 @@ jQuery(function($) {
308
  /**
309
  * Add appointment.
310
  */
311
- $newAppointmentBtn.on('click', function () {
312
  BooklyAppointmentDialog.showDialog(
313
  null,
314
  null,
@@ -322,7 +339,7 @@ jQuery(function($) {
322
  /**
323
  * Export.
324
  */
325
- $exportForm.on('submit', function () {
326
  $('[name="filter"]', $exportDialog).val(JSON.stringify({
327
  id: $idFilter.val(),
328
  date: $appointmentDateFilter.data('date'),
@@ -339,24 +356,24 @@ jQuery(function($) {
339
  });
340
 
341
  $exportSelectAll
342
- .on('click', function () {
343
  let checked = this.checked;
344
- $('.bookly-js-columns input', $exportDialog).each(function () {
345
  $(this).prop('checked', checked);
346
  });
347
  });
348
 
349
  $('.bookly-js-columns input', $exportDialog)
350
- .on('change', function () {
351
  $exportSelectAll.prop('checked', $('.bookly-js-columns input:checked', $exportDialog).length == $('.bookly-js-columns input', $exportDialog).length);
352
  });
353
 
354
  /**
355
  * Print.
356
  */
357
- $printButton.on('click', function () {
358
  let columns = [];
359
- $('input:checked', $printDialog).each(function () {
360
  columns.push(this.value);
361
  });
362
  let config = {
@@ -364,67 +381,67 @@ jQuery(function($) {
364
  exportOptions: {
365
  columns: columns
366
  },
367
- customize: function (win) {
368
  win.document.firstChild.style.backgroundColor = '#fff';
369
  win.document.body.id = 'bookly-tbs';
370
- $(win.document.body).find('table').removeClass('collapsed');
371
  }
372
  };
373
  $.fn.dataTable.ext.buttons.print.action(null, dt, null, $.extend({}, $.fn.dataTable.ext.buttons.print, config));
374
  });
375
 
376
  $printSelectAll
377
- .on('click', function () {
378
  let checked = this.checked;
379
- $('.bookly-js-columns input', $printDialog).each(function () {
380
  $(this).prop('checked', checked);
381
  });
382
  });
383
 
384
  $('.bookly-js-columns input', $printDialog)
385
- .on('change', function () {
386
  $printSelectAll.prop('checked', $('.bookly-js-columns input:checked', $printDialog).length == $('.bookly-js-columns input', $printDialog).length);
387
  });
388
 
389
  /**
390
  * Select all appointments.
391
  */
392
- $checkAllButton.on('change', function () {
393
  $appointmentsList.find('tbody input:checkbox').prop('checked', this.checked);
394
  });
395
 
396
  $appointmentsList
397
  // On appointment select.
398
- .on('change', 'tbody input:checkbox', function () {
399
  $checkAllButton.prop('checked', $appointmentsList.find('tbody input:not(:checked)').length == 0);
400
  })
401
  // Show payment details
402
- .on('click', '[data-action=show-payment]', function () {
403
  BooklyPaymentDetailsDialog.showDialog({
404
  payment_id: getDTRowData(this).payment_id,
405
- done: function (event) {
406
  dt.ajax.reload();
407
  }
408
  });
409
  })
410
  // Edit appointment.
411
- .on('click', '[data-action=edit]', function (e) {
412
  e.preventDefault();
413
  BooklyAppointmentDialog.showDialog(
414
  getDTRowData(this).id,
415
  null,
416
  null,
417
- function (event) {
418
  dt.ajax.reload();
419
  }
420
  )
421
  });
422
 
423
- $showDeleteConfirmation.on('click', function () {
424
  let data = [],
425
  $checkboxes = $appointmentsList.find('tbody input:checked');
426
 
427
- $checkboxes.each(function () {
428
  data.push({ca_id: this.value, id: $(this).data('appointment')});
429
  });
430
 
@@ -503,11 +520,11 @@ jQuery(function($) {
503
 
504
  $creationDateFilter.daterangepicker(
505
  {
506
- parentEl : $creationDateFilter.parent(),
507
  startDate: pickers.creationDate.startDate,
508
- endDate : pickers.creationDate.endDate,
509
  ranges: pickerRanges2,
510
- showDropdowns : true,
511
  linkedCalendars: false,
512
  autoUpdateInput: false,
513
  locale: $.extend(BooklyL10n.dateRange, BooklyL10n.datePicker)
@@ -546,11 +563,11 @@ jQuery(function($) {
546
  allowClear: true,
547
  placeholder: '',
548
  language: {
549
- noResults: function () {
550
  return BooklyL10n.no_result_found;
551
  }
552
  },
553
- matcher: function (params, data) {
554
  const term = $.trim(params.term).toLowerCase();
555
  if (term === '' || data.text.toLowerCase().indexOf(term) !== -1) {
556
  return data;
@@ -559,7 +576,7 @@ jQuery(function($) {
559
  let result = null;
560
  const search = $(data.element).data('search');
561
  search &&
562
- search.find(function (text) {
563
  if (result === null && text.toLowerCase().indexOf(term) !== -1) {
564
  result = data;
565
  }
@@ -569,17 +586,7 @@ jQuery(function($) {
569
  }
570
  });
571
 
572
- $statusFilter.booklyDropdown({
573
- onChange: function () {
574
- dt.ajax.reload();
575
- }
576
- });
577
 
578
- if (BooklyL10n.datatables.appointments.settings.filter.status) {
579
- $statusFilter.booklyDropdown('setSelected', BooklyL10n.datatables.appointments.settings.filter.status);
580
- } else {
581
- $statusFilter.booklyDropdown('selectAll');
582
- }
583
 
584
  $('.bookly-js-select-ajax')
585
  .booklySelect2({
@@ -589,10 +596,10 @@ jQuery(function($) {
589
  allowClear: true,
590
  placeholder: '',
591
  language: {
592
- noResults: function () {
593
  return BooklyL10n.no_result_found;
594
  },
595
- searching: function () {
596
  return BooklyL10n.searching;
597
  }
598
  },
@@ -600,7 +607,7 @@ jQuery(function($) {
600
  url: ajaxurl,
601
  dataType: 'json',
602
  delay: 250,
603
- data: function (params) {
604
  params.page = params.page || 1;
605
  return {
606
  action: this.action === undefined ? $(this).data('ajax--action') : this.action,
@@ -620,11 +627,11 @@ jQuery(function($) {
620
  return dt.row($el).data();
621
  }
622
 
623
- $idFilter.on('keyup', function () { dt.ajax.reload(); });
624
- $appointmentDateFilter.on('apply.daterangepicker', function () { dt.ajax.reload(); });
625
- $creationDateFilter.on('apply.daterangepicker', function () { dt.ajax.reload(); });
626
- $staffFilter.on('change', function () { dt.ajax.reload(); });
627
- $customerFilter.on('change', function () { dt.ajax.reload(); });
628
- $serviceFilter.on('change', function () { dt.ajax.reload(); });
629
- $locationFilter.on('change', function () { dt.ajax.reload(); });
630
  });
1
  jQuery(function($) {
2
  'use strict';
3
  let
4
+ $appointmentsList = $('#bookly-appointments-list'),
5
+ $checkAllButton = $('#bookly-check-all'),
6
+ $idFilter = $('#bookly-filter-id'),
7
  $appointmentDateFilter = $('#bookly-filter-date'),
8
  $creationDateFilter = $('#bookly-filter-creation-date'),
9
+ $staffFilter = $('#bookly-filter-staff'),
10
+ $customerFilter = $('#bookly-filter-customer'),
11
+ $serviceFilter = $('#bookly-filter-service'),
12
+ $statusFilter = $('#bookly-filter-status'),
13
+ $locationFilter = $('#bookly-filter-location'),
14
+ $newAppointmentBtn = $('#bookly-new-appointment'),
15
+ $printDialog = $('#bookly-print-dialog'),
16
+ $printSelectAll = $('#bookly-js-print-select-all', $printDialog),
17
+ $printButton = $(':submit', $printDialog),
18
+ $exportDialog = $('#bookly-export-dialog'),
19
+ $exportSelectAll = $('#bookly-js-export-select-all', $exportDialog),
20
+ $exportForm = $('form', $exportDialog),
21
  $showDeleteConfirmation = $('#bookly-js-show-confirm-deletion'),
22
+ isMobile = false,
23
+ urlParts = document.URL.split('#'),
24
+ columns = [],
25
+ order = [],
26
  pickers = {
27
+ dateFormat: 'YYYY-MM-DD',
28
  appointmentDate: {
29
  startDate: moment().startOf('month'),
30
+ endDate: moment().endOf('month'),
31
  },
32
  creationDate: {
33
  startDate: moment(),
34
+ endDate: moment().add(100, 'years'),
35
  },
36
+ },
37
+ status_filtered = false
38
  ;
39
 
40
  try {
41
+ document.createEvent('TouchEvent');
42
  isMobile = true;
43
+ } catch (e) {}
44
 
45
+ $statusFilter.booklyDropdown({onChange: function() { dt.ajax.reload(); }});
46
 
47
  $('.bookly-js-select').val(null);
48
 
49
  // Apply filter from anchor
50
  if (urlParts.length > 1) {
51
+ urlParts[1].split('&').forEach(function(part) {
52
  var params = part.split('=');
53
+ if (params[0] === 'appointment-date') {
54
+ if (params['1'] === 'any') {
55
  $appointmentDateFilter
56
  .data('date', 'any').find('span')
57
  .html(BooklyL10n.dateRange.anyTime);
63
  .find('span')
64
  .html(pickers.appointmentDate.startDate.format(BooklyL10n.dateRange.format) + ' - ' + pickers.appointmentDate.endDate.format(BooklyL10n.dateRange.format));
65
  }
66
+ } else if (params[0] === 'tasks') {
67
  $appointmentDateFilter
68
  .data('date', 'null').find('span')
69
  .html(BooklyL10n.tasks.title);
70
+ } else if (params[0] === 'created-date') {
71
  pickers.creationDate.startDate = moment(params['1'].substring(0, 10));
72
  pickers.creationDate.endDate = moment(params['1'].substring(11));
73
  $creationDateFilter
74
  .data('date', pickers.creationDate.startDate.format(pickers.dateFormat) + ' - ' + pickers.creationDate.endDate.format(pickers.dateFormat))
75
  .find('span')
76
  .html(pickers.creationDate.startDate.format(BooklyL10n.dateRange.format) + ' - ' + pickers.creationDate.endDate.format(BooklyL10n.dateRange.format));
77
+ } else if (params[0] === 'status') {
78
+ status_filtered = true;
79
+ if (params[1] == 'any') {
80
+ $statusFilter.booklyDropdown('selectAll');
81
+ } else {
82
+ $statusFilter.booklyDropdown('setSelected', params[1].split(','));
83
+ }
84
  } else {
85
  $('#bookly-filter-' + params[0]).val(params[1]);
86
  }
87
  });
88
  } else {
89
+ $.each(BooklyL10n.datatables.appointments.settings.filter, function(field, value) {
90
  if (field !== 'status') {
91
  if (value != '') {
92
  $('#bookly-filter-' + field).val(value);
101
  });
102
  }
103
 
104
+ if (!status_filtered) {
105
+ if (BooklyL10n.datatables.appointments.settings.filter.status) {
106
+ $statusFilter.booklyDropdown('setSelected', BooklyL10n.datatables.appointments.settings.filter.status);
107
+ } else {
108
+ $statusFilter.booklyDropdown('selectAll');
109
+ }
110
+ }
111
+
112
  Ladda.bind($('button[type=submit]', $exportForm).get(0), {timeout: 2000});
113
 
114
  /**
115
  * Init table columns.
116
  */
117
+ $.each(BooklyL10n.datatables.appointments.settings.columns, function(column, show) {
118
  if (show) {
119
  switch (column) {
120
  case 'customer_full_name':
123
  case 'customer_phone':
124
  columns.push({
125
  data: 'customer.phone',
126
+ render: function(data, type, row, meta) {
127
  if (isMobile) {
128
  return '<a href="tel:' + $.fn.dataTable.render.text().display(data) + '">' + $.fn.dataTable.render.text().display(data) + '</a>';
129
  } else {
147
  case 'service_title':
148
  columns.push({
149
  data: 'service.title',
150
+ render: function(data, type, row, meta) {
151
  data = $.fn.dataTable.render.text().display(data);
152
  if (row.service.extras.length) {
153
  var extras = '<ul class="bookly-list list-dots">';
154
+ $.each(row.service.extras, function(key, item) {
155
  extras += '<li><nobr>' + item.title + '</nobr></li>';
156
  });
157
  extras += '</ul>';
158
  return data + extras;
159
+ } else {
 
160
  return data;
161
  }
162
  }
165
  case 'payment':
166
  columns.push({
167
  data: 'payment',
168
+ render: function(data, type, row, meta) {
169
  if (row.payment_id) {
170
  return '<a type="button" data-action="show-payment" class="text-primary" data-payment_id="' + row.payment_id + '">' + data + '</a>';
171
  }
179
  case 'attachments':
180
  columns.push({
181
  data: 'attachment',
182
+ render: function(data, type, row, meta) {
183
  if (data == '1') {
184
  return '<button type="button" class="btn btn-link" data-action="show-attachments" title="' + BooklyL10n.attachments + '"><i class="fas fa-fw fa-paperclip"></i></button>';
185
  }
190
  case 'rating':
191
  columns.push({
192
  data: 'rating',
193
+ render: function(data, type, row, meta) {
194
  if (row.rating_comment == null) {
195
  return row.rating;
196
  } else {
208
  case 'online_meeting':
209
  columns.push({
210
  data: 'online_meeting_provider',
211
+ render: function(data, type, row, meta) {
212
  switch (data) {
213
  case 'zoom':
214
  return '<a class="badge badge-primary" href="https://zoom.us/j/' + $.fn.dataTable.render.text().display(row.online_meeting_id) + '" target="_blank"><i class="fas fa-video fa-fw"></i> Zoom <i class="fas fa-external-link-alt fa-fw"></i></a>';
239
  }
240
  });
241
  columns.push({
242
+ data: null,
243
  responsivePriority: 1,
244
+ orderable: false,
245
+ width: 120,
246
+ render: function(data, type, row, meta) {
247
  return '<button type="button" class="btn btn-default" data-action="edit"><i class="far fa-fw fa-edit mr-lg-1"></i><span class="d-none d-lg-inline">' + BooklyL10n.edit + '…</span></button>';
248
  }
249
  });
250
  columns.push({
251
+ data: null,
252
  responsivePriority: 1,
253
+ orderable: false,
254
+ render: function(data, type, row, meta) {
255
  const cb_id = row.ca_id === null ? 'bookly-dt-a-' + row.id : 'bookly-dt-ca-' + row.ca_id;
256
  return '<div class="custom-control custom-checkbox">' +
257
  '<input value="' + row.ca_id + '" data-appointment="' + row.id + '" id="' + cb_id + '" type="checkbox" class="custom-control-input">' +
262
 
263
  columns[0].responsivePriority = 0;
264
 
265
+ $.each(BooklyL10n.datatables.appointments.settings.order, function(_, value) {
266
+ const index = columns.findIndex(function(c) { return c.data === value.column; });
267
  if (index !== -1) {
268
  order.push([index, value.order]);
269
  }
272
  * Init DataTables.
273
  */
274
  var dt = $appointmentsList.DataTable({
275
+ order: order,
276
+ info: false,
277
+ searching: false,
278
  lengthChange: false,
279
+ processing: true,
280
+ responsive: true,
281
+ pageLength: 25,
282
+ pagingType: 'numbers',
283
+ serverSide: true,
284
+ drawCallback: function(settings) {
285
+ $('[data-toggle="bookly-popover"]', $appointmentsList).on('click', function(e) {
286
  e.preventDefault();
287
  }).booklyPopover();
288
  dt.responsive.recalc();
289
  },
290
  ajax: {
291
+ url: ajaxurl,
292
  type: 'POST',
293
+ data: function(d) {
294
  return $.extend({action: 'bookly_get_appointments', csrf_token: BooklyL10nGlobal.csrf_token}, {
295
  filter: {
296
  id: $idFilter.val(),
306
  }
307
  },
308
  columns: columns,
309
+ dom: "<'row'<'col-sm-12'tr>><'row float-left mt-3'<'col-sm-12'p>>",
310
  language: {
311
  zeroRecords: BooklyL10n.zeroRecords,
312
+ processing: BooklyL10n.processing
313
  }
314
  });
315
 
316
  // Show ratings in expanded rows.
317
+ dt.on('responsive-display', function(e, datatable, row, showHide, update) {
318
  if (showHide) {
319
+ $('[data-toggle="bookly-popover"]', row.child()).on('click', function(e) {
320
  e.preventDefault();
321
  }).booklyPopover();
322
  }
325
  /**
326
  * Add appointment.
327
  */
328
+ $newAppointmentBtn.on('click', function() {
329
  BooklyAppointmentDialog.showDialog(
330
  null,
331
  null,
339
  /**
340
  * Export.
341
  */
342
+ $exportForm.on('submit', function() {
343
  $('[name="filter"]', $exportDialog).val(JSON.stringify({
344
  id: $idFilter.val(),
345
  date: $appointmentDateFilter.data('date'),
356
  });
357
 
358
  $exportSelectAll
359
+ .on('click', function() {
360
  let checked = this.checked;
361
+ $('.bookly-js-columns input', $exportDialog).each(function() {
362
  $(this).prop('checked', checked);
363
  });
364
  });
365
 
366
  $('.bookly-js-columns input', $exportDialog)
367
+ .on('change', function() {
368
  $exportSelectAll.prop('checked', $('.bookly-js-columns input:checked', $exportDialog).length == $('.bookly-js-columns input', $exportDialog).length);
369
  });
370
 
371
  /**
372
  * Print.
373
  */
374
+ $printButton.on('click', function() {
375
  let columns = [];
376
+ $('input:checked', $printDialog).each(function() {
377
  columns.push(this.value);
378
  });
379
  let config = {
381
  exportOptions: {
382
  columns: columns
383
  },
384
+ customize: function(win) {
385
  win.document.firstChild.style.backgroundColor = '#fff';
386
  win.document.body.id = 'bookly-tbs';
387
+ $(win.document.body).find('table').removeClass('bookly-collapsed');
388
  }
389
  };
390
  $.fn.dataTable.ext.buttons.print.action(null, dt, null, $.extend({}, $.fn.dataTable.ext.buttons.print, config));
391
  });
392
 
393
  $printSelectAll
394
+ .on('click', function() {
395
  let checked = this.checked;
396
+ $('.bookly-js-columns input', $printDialog).each(function() {
397
  $(this).prop('checked', checked);
398
  });
399
  });
400
 
401
  $('.bookly-js-columns input', $printDialog)
402
+ .on('change', function() {
403
  $printSelectAll.prop('checked', $('.bookly-js-columns input:checked', $printDialog).length == $('.bookly-js-columns input', $printDialog).length);
404
  });
405
 
406
  /**
407
  * Select all appointments.
408
  */
409
+ $checkAllButton.on('change', function() {
410
  $appointmentsList.find('tbody input:checkbox').prop('checked', this.checked);
411
  });
412
 
413
  $appointmentsList
414
  // On appointment select.
415
+ .on('change', 'tbody input:checkbox', function() {
416
  $checkAllButton.prop('checked', $appointmentsList.find('tbody input:not(:checked)').length == 0);
417
  })
418
  // Show payment details
419
+ .on('click', '[data-action=show-payment]', function() {
420
  BooklyPaymentDetailsDialog.showDialog({
421
  payment_id: getDTRowData(this).payment_id,
422
+ done: function(event) {
423
  dt.ajax.reload();
424
  }
425
  });
426
  })
427
  // Edit appointment.
428
+ .on('click', '[data-action=edit]', function(e) {
429
  e.preventDefault();
430
  BooklyAppointmentDialog.showDialog(
431
  getDTRowData(this).id,
432
  null,
433
  null,
434
+ function(event) {
435
  dt.ajax.reload();
436
  }
437
  )
438
  });
439
 
440
+ $showDeleteConfirmation.on('click', function() {
441
  let data = [],
442
  $checkboxes = $appointmentsList.find('tbody input:checked');
443
 
444
+ $checkboxes.each(function() {
445
  data.push({ca_id: this.value, id: $(this).data('appointment')});
446
  });
447
 
520
 
521
  $creationDateFilter.daterangepicker(
522
  {
523
+ parentEl: $creationDateFilter.parent(),
524
  startDate: pickers.creationDate.startDate,
525
+ endDate: pickers.creationDate.endDate,
526
  ranges: pickerRanges2,
527
+ showDropdowns: true,
528
  linkedCalendars: false,
529
  autoUpdateInput: false,
530
  locale: $.extend(BooklyL10n.dateRange, BooklyL10n.datePicker)
563
  allowClear: true,
564
  placeholder: '',
565
  language: {
566
+ noResults: function() {
567
  return BooklyL10n.no_result_found;
568
  }
569
  },
570
+ matcher: function(params, data) {
571
  const term = $.trim(params.term).toLowerCase();
572
  if (term === '' || data.text.toLowerCase().indexOf(term) !== -1) {
573
  return data;
576
  let result = null;
577
  const search = $(data.element).data('search');
578
  search &&
579
+ search.find(function(text) {
580
  if (result === null && text.toLowerCase().indexOf(term) !== -1) {
581
  result = data;
582
  }
586
  }
587
  });
588
 
 
 
 
 
 
589
 
 
 
 
 
 
590
 
591
  $('.bookly-js-select-ajax')
592
  .booklySelect2({
596
  allowClear: true,
597
  placeholder: '',
598
  language: {
599
+ noResults: function() {
600
  return BooklyL10n.no_result_found;
601
  },
602
+ searching: function() {
603
  return BooklyL10n.searching;
604
  }
605
  },
607
  url: ajaxurl,
608
  dataType: 'json',
609
  delay: 250,
610
+ data: function(params) {
611
  params.page = params.page || 1;
612
  return {
613
  action: this.action === undefined ? $(this).data('ajax--action') : this.action,
627
  return dt.row($el).data();
628
  }
629
 
630
+ $idFilter.on('keyup', function() { dt.ajax.reload(); });
631
+ $appointmentDateFilter.on('apply.daterangepicker', function() { dt.ajax.reload(); });
632
+ $creationDateFilter.on('apply.daterangepicker', function() { dt.ajax.reload(); });
633
+ $staffFilter.on('change', function() { dt.ajax.reload(); });
634
+ $customerFilter.on('change', function() { dt.ajax.reload(); });
635
+ $serviceFilter.on('change', function() { dt.ajax.reload(); });
636
+ $locationFilter.on('change', function() { dt.ajax.reload(); });
637
  });
backend/modules/calendar/Page.php CHANGED
@@ -228,6 +228,7 @@ class Page extends Lib\Base\Ajax
228
  $appointments[ $appointment['id'] ] = $appointment;
229
  }
230
  $appointments[ $appointment['id'] ]['customers'][] = array(
 
231
  'appointment_notes' => $appointment['appointment_notes'],
232
  'booking_number' => Config::groupBookingActive() ? $appointment['id'] . '-' . $appointment['ca_id'] : $appointment['id'],
233
  'client_birthday' => $appointment['client_birthday'],
@@ -272,6 +273,7 @@ class Page extends Lib\Base\Ajax
272
  }
273
  foreach ( $appointments as $key => $appointment ) {
274
  $codes = $default_codes;
 
275
  $codes['appointment_date'] = DateTime::formatDate( $appointment['start_date'] );
276
  $codes['appointment_time'] = $appointment['duration'] >= DAY_IN_SECONDS && $appointment['start_time_info'] ? $appointment['start_time_info'] : Lib\Utils\DateTime::formatTime( $appointment['start_date'] );
277
  $codes['booking_number'] = $appointment['id'];
228
  $appointments[ $appointment['id'] ] = $appointment;
229
  }
230
  $appointments[ $appointment['id'] ]['customers'][] = array(
231
+ 'appointment_id' => $appointment['id'],
232
  'appointment_notes' => $appointment['appointment_notes'],
233
  'booking_number' => Config::groupBookingActive() ? $appointment['id'] . '-' . $appointment['ca_id'] : $appointment['id'],
234
  'client_birthday' => $appointment['client_birthday'],
273
  }
274
  foreach ( $appointments as $key => $appointment ) {
275
  $codes = $default_codes;
276
+ $codes['appointment_id'] = $appointment['id'];
277
  $codes['appointment_date'] = DateTime::formatDate( $appointment['start_date'] );
278
  $codes['appointment_time'] = $appointment['duration'] >= DAY_IN_SECONDS && $appointment['start_time_info'] ? $appointment['start_time_info'] : Lib\Utils\DateTime::formatTime( $appointment['start_date'] );
279
  $codes['booking_number'] = $appointment['id'];
backend/modules/cloud_billing/resources/js/cloud-billing.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(function ($) {
2
  'use strict';
3
 
4
  const $date_range = $('#purchases_date_range');
@@ -9,23 +9,23 @@ jQuery(function ($) {
9
  */
10
  var picker_ranges = {};
11
  picker_ranges[BooklyL10n.dateRange.yesterday] = [moment().subtract(1, 'days'), moment().subtract(1, 'days')];
12
- picker_ranges[BooklyL10n.dateRange.today] = [moment(), moment()];
13
- picker_ranges[BooklyL10n.dateRange.last_7] = [moment().subtract(7, 'days'), moment()];
14
- picker_ranges[BooklyL10n.dateRange.last_30] = [moment().subtract(30, 'days'), moment()];
15
  picker_ranges[BooklyL10n.dateRange.thisMonth] = [moment().startOf('month'), moment().endOf('month')];
16
  picker_ranges[BooklyL10n.dateRange.lastMonth] = [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')];
17
- var locale = $.extend({},BooklyL10n.dateRange, BooklyL10n.datePicker);
18
 
19
  $date_range.daterangepicker(
20
  {
21
- parentEl : $date_range.parent(),
22
- startDate : moment().subtract(30, 'days'), // by default select "Last 30 days"
23
- ranges : picker_ranges,
24
- locale : locale,
25
- showDropdowns : true,
26
  linkedCalendars: false,
27
  },
28
- function (start, end) {
29
  var format = 'YYYY-MM-DD';
30
  $date_range
31
  .data('date', start.format(format) + ' - ' + end.format(format))
@@ -39,12 +39,12 @@ jQuery(function ($) {
39
  */
40
  let columns = [];
41
 
42
- $.each(BooklyL10n.datatables.cloud_purchases.settings.columns, function (column, show) {
43
  if (show) {
44
  if (column === 'amount') {
45
  columns.push({
46
- data : column,
47
- render: function (data, type, row, meta) {
48
  const disabled = ['Pending', 'Rejected', 'Cancelled reversal'].includes(row.status);
49
  return data >= 0
50
  ? '<span class="text-' + (disabled ? 'muted' : 'success') + '">+ $' + data + '</span>'
@@ -57,8 +57,9 @@ jQuery(function ($) {
57
  }
58
  });
59
  columns.push({
 
60
  className: "text-right",
61
- render : function (data, type, row, meta) {
62
  if ((row.type === 'PayPal' || row.type === 'Card') && row.status === 'Paid') {
63
  return '<button type="button" class="btn btn-default" data-action="download-invoice"><i class="far fa-fw fa-file-pdf mr-1"></i> ' + BooklyL10n.invoice.button + '</button>';
64
  }
@@ -67,35 +68,35 @@ jQuery(function ($) {
67
  });
68
 
69
  var dt = $datatable.DataTable({
70
- ordering : false,
71
- paging : false,
72
- info : false,
73
- searching : false,
74
  processing: true,
75
  responsive: true,
76
- ajax : {
77
- url : ajaxurl,
78
- data : function (d) {
79
  return {
80
- action : 'bookly_get_purchases_list',
81
  csrf_token: BooklyL10n.csrfToken,
82
- range : $date_range.data('date')
83
  };
84
  },
85
  dataSrc: 'list'
86
  },
87
- columns : columns,
88
- language : {
89
  zeroRecords: BooklyL10n.zeroRecords,
90
- processing : BooklyL10n.processing
91
  }
92
  });
93
 
94
- $date_range.on('apply.daterangepicker', function () {
95
  dt.ajax.reload();
96
  });
97
 
98
- $datatable.on('click', '[data-action=download-invoice]', function () {
99
  if (BooklyL10n.invoice.valid) {
100
  const data = $('#bookly-purchases').DataTable().row($(this).closest('td')).data();
101
  window.location = BooklyL10n.invoice.link + '/' + data.id;
1
+ jQuery(function($) {
2
  'use strict';
3
 
4
  const $date_range = $('#purchases_date_range');
9
  */
10
  var picker_ranges = {};
11
  picker_ranges[BooklyL10n.dateRange.yesterday] = [moment().subtract(1, 'days'), moment().subtract(1, 'days')];
12
+ picker_ranges[BooklyL10n.dateRange.today] = [moment(), moment()];
13
+ picker_ranges[BooklyL10n.dateRange.last_7] = [moment().subtract(7, 'days'), moment()];
14
+ picker_ranges[BooklyL10n.dateRange.last_30] = [moment().subtract(30, 'days'), moment()];
15
  picker_ranges[BooklyL10n.dateRange.thisMonth] = [moment().startOf('month'), moment().endOf('month')];
16
  picker_ranges[BooklyL10n.dateRange.lastMonth] = [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')];
17
+ var locale = $.extend({}, BooklyL10n.dateRange, BooklyL10n.datePicker);
18
 
19
  $date_range.daterangepicker(
20
  {
21
+ parentEl: $date_range.parent(),
22
+ startDate: moment().subtract(30, 'days'), // by default select "Last 30 days"
23
+ ranges: picker_ranges,
24
+ locale: locale,
25
+ showDropdowns: true,
26
  linkedCalendars: false,
27
  },
28
+ function(start, end) {
29
  var format = 'YYYY-MM-DD';
30
  $date_range
31
  .data('date', start.format(format) + ' - ' + end.format(format))
39
  */
40
  let columns = [];
41
 
42
+ $.each(BooklyL10n.datatables.cloud_purchases.settings.columns, function(column, show) {
43
  if (show) {
44
  if (column === 'amount') {
45
  columns.push({
46
+ data: column,
47
+ render: function(data, type, row, meta) {
48
  const disabled = ['Pending', 'Rejected', 'Cancelled reversal'].includes(row.status);
49
  return data >= 0
50
  ? '<span class="text-' + (disabled ? 'muted' : 'success') + '">+ $' + data + '</span>'
57
  }
58
  });
59
  columns.push({
60
+ data: null,
61
  className: "text-right",
62
+ render: function(data, type, row, meta) {
63
  if ((row.type === 'PayPal' || row.type === 'Card') && row.status === 'Paid') {
64
  return '<button type="button" class="btn btn-default" data-action="download-invoice"><i class="far fa-fw fa-file-pdf mr-1"></i> ' + BooklyL10n.invoice.button + '</button>';
65
  }
68
  });
69
 
70
  var dt = $datatable.DataTable({
71
+ ordering: false,
72
+ paging: false,
73
+ info: false,
74
+ searching: false,
75
  processing: true,
76
  responsive: true,
77
+ ajax: {
78
+ url: ajaxurl,
79
+ data: function(d) {
80
  return {
81
+ action: 'bookly_get_purchases_list',
82
  csrf_token: BooklyL10n.csrfToken,
83
+ range: $date_range.data('date')
84
  };
85
  },
86
  dataSrc: 'list'
87
  },
88
+ columns: columns,
89
+ language: {
90
  zeroRecords: BooklyL10n.zeroRecords,
91
+ processing: BooklyL10n.processing
92
  }
93
  });
94
 
95
+ $date_range.on('apply.daterangepicker', function() {
96
  dt.ajax.reload();
97
  });
98
 
99
+ $datatable.on('click', '[data-action=download-invoice]', function() {
100
  if (BooklyL10n.invoice.valid) {
101
  const data = $('#bookly-purchases').DataTable().row($(this).closest('td')).data();
102
  window.location = BooklyL10n.invoice.link + '/' + data.id;
backend/modules/cloud_billing/templates/index.php CHANGED
@@ -3,7 +3,6 @@ use Bookly\Lib\Utils;
3
  use Bookly\Backend\Components\Support;
4
  use Bookly\Backend\Components\Dialogs;
5
  use Bookly\Backend\Components\Cloud;
6
- use Bookly\Lib;
7
  /** @var array $datatables */
8
  ?>
9
  <div id="bookly-tbs" class="wrap">
3
  use Bookly\Backend\Components\Support;
4
  use Bookly\Backend\Components\Dialogs;
5
  use Bookly\Backend\Components\Cloud;
 
6
  /** @var array $datatables */
7
  ?>
8
  <div id="bookly-tbs" class="wrap">
backend/modules/cloud_products/templates/_action_btn.php CHANGED
@@ -10,8 +10,8 @@ use Bookly\Backend\Components\Controls\Buttons;
10
  <?php if ( isset( $product['cancel_on_renewal'] ) && $product['cancel_on_renewal'] === true ) : ?>
11
  <?php Buttons::render( null, 'bookly-js-product-revert-cancel btn-success', $product['texts']['action-revert-cancel'] ) ?>
12
  <?php else : ?>
13
- <?php Buttons::render( null, 'bookly-js-product-enable btn-success collapse', $product['texts']['action-on'] ) ?>
14
- <?php Buttons::render( null, 'bookly-js-product-disable btn-danger collapse', $product['texts']['action-off'] ) ?>
15
  <?php endif ?>
16
  <?php else: ?>
17
  <?php Buttons::render( null, 'bookly-js-product-login-button btn-success', $product['texts']['action-on'] ) ?>
10
  <?php if ( isset( $product['cancel_on_renewal'] ) && $product['cancel_on_renewal'] === true ) : ?>
11
  <?php Buttons::render( null, 'bookly-js-product-revert-cancel btn-success', $product['texts']['action-revert-cancel'] ) ?>
12
  <?php else : ?>
13
+ <?php Buttons::render( null, 'bookly-js-product-enable btn-success bookly-collapse', $product['texts']['action-on'] ) ?>
14
+ <?php Buttons::render( null, 'bookly-js-product-disable btn-danger bookly-collapse', $product['texts']['action-off'] ) ?>
15
  <?php endif ?>
16
  <?php else: ?>
17
  <?php Buttons::render( null, 'bookly-js-product-login-button btn-success', $product['texts']['action-on'] ) ?>
backend/modules/cloud_sms/resources/js/notifications-list.js CHANGED
@@ -1,27 +1,27 @@
1
- jQuery(function ($) {
2
  'use strict';
3
- window.BooklyNotificationsList = function () {
4
- let $notificationList = $('#bookly-js-notification-list'),
5
- $btnCheckAll = $('#bookly-check-all', $notificationList),
6
- $modalTestEmail = $('#bookly-test-email-notifications-modal'),
7
- $btnTestEmail = $('#bookly-js-test-email-notifications'),
8
- $testNotificationsList = $('#bookly-js-test-notifications-list', $modalTestEmail),
9
  $btnDeleteNotifications = $('#bookly-js-delete-notifications'),
10
- $filter = $('#bookly-filter'),
11
- columns = [],
12
- order = []
13
  ;
14
 
15
  /**
16
  * Init Columns.
17
  */
18
- $.each(BooklyL10n.datatables[BooklyL10n.gateway + '_notifications'].settings.columns, function (column, show) {
19
  if (show) {
20
  switch (column) {
21
  case 'type':
22
  columns.push({
23
  data: 'order',
24
- render: function (data, type, row, meta) {
25
  return '<span class="hidden">' + data + '</span><i class="fa-fw ' + row.icon + '" title="' + row.title + '"></i>';
26
  }
27
  });
@@ -29,7 +29,7 @@ jQuery(function ($) {
29
  case 'active':
30
  columns.push({
31
  data: column,
32
- render: function (data, type, row, meta) {
33
  return '<span class="badge ' + (row.active == 1 ? 'badge-success' : 'badge-info') + '">' + BooklyL10n.state[data] + '</span>' + ' (<a href="#" data-action="toggle-active">' + BooklyL10n.action[data] + '</a>)';
34
  }
35
  });
@@ -41,17 +41,19 @@ jQuery(function ($) {
41
  }
42
  });
43
  columns.push({
 
44
  className: 'text-right',
45
  orderable: false,
46
  responsivePriority: 1,
47
- render: function (data, type, row, meta) {
48
  return ' <button type="button" class="btn btn-default ladda-button" data-action="edit" data-spinner-size="40" data-style="zoom-in" data-spinner-color="#666666"><i class="far fa-fw fa-edit mr-lg-1"></i><span class="ladda-label"><span class="d-none d-lg-inline">' + BooklyL10n.edit + '…</span></span></button>';
49
  }
50
  });
51
  columns.push({
 
52
  orderable: false,
53
  responsivePriority: 1,
54
- render: function (data, type, row, meta) {
55
  return '<div class="custom-control custom-checkbox">' +
56
  '<input value="' + row.id + '" id="bookly-dt-' + row.id + '" type="checkbox" class="custom-control-input">' +
57
  '<label for="bookly-dt-' + row.id + '" class="custom-control-label"></label>' +
@@ -61,8 +63,8 @@ jQuery(function ($) {
61
 
62
  columns[0].responsivePriority = 0;
63
 
64
- $.each(BooklyL10n.datatables[BooklyL10n.gateway + '_notifications'].settings.order, function (_, value) {
65
- const index = columns.findIndex(function (c) {
66
  return c.data === value.column;
67
  });
68
  if (index !== -1) {
@@ -90,8 +92,8 @@ jQuery(function ($) {
90
  zeroRecords: BooklyL10n.noResults,
91
  processing: BooklyL10n.processing
92
  }
93
- }).on('click', '[data-action=toggle-active]', function (e) {
94
- var row = dt.row($(this).closest('td')),
95
  data = row.data();
96
  e.preventDefault();
97
  data.active = data.active === '1' ? '0' : '1';
@@ -105,7 +107,7 @@ jQuery(function ($) {
105
  active: data.active
106
  },
107
  dataType: 'json',
108
- success: function (response) {
109
  if (response.success) {
110
  row.data(data).draw();
111
  booklyAlert({success: [BooklyL10n.settingsSaved]});
@@ -113,9 +115,9 @@ jQuery(function ($) {
113
  }
114
  });
115
  });
116
- dt.on('order', function () {
117
  let order = [];
118
- dt.order().forEach(function (data) {
119
  order.push({
120
  column: columns[data[0]].data,
121
  order: data[1]
@@ -138,41 +140,41 @@ jQuery(function ($) {
138
  * On filters change.
139
  */
140
  $filter
141
- .on('keyup', function () {
142
- dt.search(this.value).draw();
143
- })
144
- .on('keydown', function (e) {
145
- if (e.keyCode == 13) {
146
- e.preventDefault();
147
- return false;
148
- }
149
- })
150
  ;
151
 
152
  /**
153
  * Select all notifications.
154
  */
155
  $btnCheckAll
156
- .on('change', function () {
157
- $('tbody input:checkbox', $notificationList).prop('checked', this.checked);
158
- });
159
 
160
  $notificationList
161
- .on('change', 'tbody input:checkbox', function () {
162
- $btnCheckAll.prop('checked', $notificationList.find('tbody input:not(:checked)').length === 0);
163
- });
164
 
165
  /**
166
  * Delete notifications.
167
  */
168
- $btnDeleteNotifications.on('click', function () {
169
  if (confirm(BooklyL10n.areYouSure)) {
170
- let ladda = Ladda.create(this),
171
- data = [],
172
  $checkboxes = $('input:checked', $notificationList);
173
  ladda.start();
174
 
175
- $checkboxes.each(function () {
176
  data.push(this.value);
177
  });
178
 
@@ -185,7 +187,7 @@ jQuery(function ($) {
185
  notifications: data
186
  },
187
  dataType: 'json',
188
- success: function (response) {
189
  ladda.stop();
190
  if (response.success) {
191
  dt.rows($checkboxes.closest('td')).remove().draw();
@@ -196,7 +198,7 @@ jQuery(function ($) {
196
  });
197
 
198
  $('[href="#bookly-js-auto"]').click(
199
- function () {
200
  if (this.classList.contains("toggle")) {
201
  $(this).removeClass("border rounded mb-3 toggle");
202
  $(this).addClass("border-light rounded-top bg-light");
@@ -207,9 +209,9 @@ jQuery(function ($) {
207
  });
208
 
209
  $btnTestEmail
210
- .on('click', function () {
211
- $modalTestEmail.booklyModal()
212
- });
213
 
214
  let $check = $('<div/>', {class: 'dropdown-item my-0 pl-3'}).append(
215
  $('<div>', {class: 'custom-control custom-checkbox'}).append(
@@ -217,67 +219,67 @@ jQuery(function ($) {
217
  $('<label>', {class: 'custom-control-label text-wrap w-100'})
218
  ));
219
  $modalTestEmail
220
- .on('change', '#bookly-check-all-entities', function () {
221
- $(':checkbox', $testNotificationsList).prop('checked', this.checked);
222
- $(':checkbox:first-child', $testNotificationsList).trigger('change');
223
- })
224
- .on('click', '[for=bookly-check-all-entities]', function (e) {
225
- e.stopPropagation();
226
- })
227
- .on('click', '.btn-success', function () {
228
- var ladda = Ladda.create(this),
229
- data = $(this).closest('form').serializeArray();
230
- ladda.start();
231
- $(':checked', $testNotificationsList).each(function () {
232
- data.push({name: 'notification_ids[]', value: $(this).data('notification-id')});
233
- });
234
- data.push({name: 'action', value: 'bookly_test_email_notifications'});
235
- $.ajax({
236
- url: ajaxurl,
237
- type: 'POST',
238
- data: data,
239
- dataType: 'json',
240
- success: function (response) {
241
- ladda.stop();
242
- if (response.success) {
243
- booklyAlert({success: [BooklyL10n.sentSuccessfully]});
244
- $modalTestEmail.booklyModal('hide');
 
245
  }
246
- }
247
- });
248
- })
249
- .on('shown.bs.modal', function () {
250
- let $send = $(this).find('.btn-success'),
251
- active = 0;
252
- $send.prop('disabled', true);
253
- $testNotificationsList.html('');
254
- (dt.rows().data()).each(function (notification) {
255
- let $cloneCheck = $check.clone();
256
 
257
- $('label', $cloneCheck).html(notification.name).attr('for', 'bookly-n-' + notification.id)
258
- .on('click', function (e) {
259
- e.stopPropagation();
260
- })
261
- ;
262
- $(':checkbox', $cloneCheck)
263
- .prop('checked', notification.active == '1')
264
- .attr('id', 'bookly-n-' + notification.id)
265
- .data('notification-id', notification.id)
266
- ;
267
 
268
- $testNotificationsList.append($cloneCheck);
269
 
270
- if (notification.active == '1') {
271
- active++;
272
- }
 
 
 
273
  });
274
- $('.bookly-js-count', $modalTestEmail).html(active);
275
- $send.prop('disabled', false);
276
- });
277
 
278
  $testNotificationsList
279
- .on('change', ':checkbox', function () {
280
- $('.bookly-js-count', $modalTestEmail).html($(':checked', $testNotificationsList).length);
281
- });
282
  };
283
  });
1
+ jQuery(function($) {
2
  'use strict';
3
+ window.BooklyNotificationsList = function() {
4
+ let $notificationList = $('#bookly-js-notification-list'),
5
+ $btnCheckAll = $('#bookly-check-all', $notificationList),
6
+ $modalTestEmail = $('#bookly-test-email-notifications-modal'),
7
+ $btnTestEmail = $('#bookly-js-test-email-notifications'),
8
+ $testNotificationsList = $('#bookly-js-test-notifications-list', $modalTestEmail),
9
  $btnDeleteNotifications = $('#bookly-js-delete-notifications'),
10
+ $filter = $('#bookly-filter'),
11
+ columns = [],
12
+ order = []
13
  ;
14
 
15
  /**
16
  * Init Columns.
17
  */
18
+ $.each(BooklyL10n.datatables[BooklyL10n.gateway + '_notifications'].settings.columns, function(column, show) {
19
  if (show) {
20
  switch (column) {
21
  case 'type':
22
  columns.push({
23
  data: 'order',
24
+ render: function(data, type, row, meta) {
25
  return '<span class="hidden">' + data + '</span><i class="fa-fw ' + row.icon + '" title="' + row.title + '"></i>';
26
  }
27
  });
29
  case 'active':
30
  columns.push({
31
  data: column,
32
+ render: function(data, type, row, meta) {
33
  return '<span class="badge ' + (row.active == 1 ? 'badge-success' : 'badge-info') + '">' + BooklyL10n.state[data] + '</span>' + ' (<a href="#" data-action="toggle-active">' + BooklyL10n.action[data] + '</a>)';
34
  }
35
  });
41
  }
42
  });
43
  columns.push({
44
+ data: null,
45
  className: 'text-right',
46
  orderable: false,
47
  responsivePriority: 1,
48
+ render: function(data, type, row, meta) {
49
  return ' <button type="button" class="btn btn-default ladda-button" data-action="edit" data-spinner-size="40" data-style="zoom-in" data-spinner-color="#666666"><i class="far fa-fw fa-edit mr-lg-1"></i><span class="ladda-label"><span class="d-none d-lg-inline">' + BooklyL10n.edit + '…</span></span></button>';
50
  }
51
  });
52
  columns.push({
53
+ data: null,
54
  orderable: false,
55
  responsivePriority: 1,
56
+ render: function(data, type, row, meta) {
57
  return '<div class="custom-control custom-checkbox">' +
58
  '<input value="' + row.id + '" id="bookly-dt-' + row.id + '" type="checkbox" class="custom-control-input">' +
59
  '<label for="bookly-dt-' + row.id + '" class="custom-control-label"></label>' +
63
 
64
  columns[0].responsivePriority = 0;
65
 
66
+ $.each(BooklyL10n.datatables[BooklyL10n.gateway + '_notifications'].settings.order, function(_, value) {
67
+ const index = columns.findIndex(function(c) {
68
  return c.data === value.column;
69
  });
70
  if (index !== -1) {
92
  zeroRecords: BooklyL10n.noResults,
93
  processing: BooklyL10n.processing
94
  }
95
+ }).on('click', '[data-action=toggle-active]', function(e) {
96
+ var row = dt.row($(this).closest('td')),
97
  data = row.data();
98
  e.preventDefault();
99
  data.active = data.active === '1' ? '0' : '1';
107
  active: data.active
108
  },
109
  dataType: 'json',
110
+ success: function(response) {
111
  if (response.success) {
112
  row.data(data).draw();
113
  booklyAlert({success: [BooklyL10n.settingsSaved]});
115
  }
116
  });
117
  });
118
+ dt.on('order', function() {
119
  let order = [];
120
+ dt.order().forEach(function(data) {
121
  order.push({
122
  column: columns[data[0]].data,
123
  order: data[1]
140
  * On filters change.
141
  */
142
  $filter
143
+ .on('keyup', function() {
144
+ dt.search(this.value).draw();
145
+ })
146
+ .on('keydown', function(e) {
147
+ if (e.keyCode == 13) {
148
+ e.preventDefault();
149
+ return false;
150
+ }
151
+ })
152
  ;
153
 
154
  /**
155
  * Select all notifications.
156
  */
157
  $btnCheckAll
158
+ .on('change', function() {
159
+ $('tbody input:checkbox', $notificationList).prop('checked', this.checked);
160
+ });
161
 
162
  $notificationList
163
+ .on('change', 'tbody input:checkbox', function() {
164
+ $btnCheckAll.prop('checked', $notificationList.find('tbody input:not(:checked)').length === 0);
165
+ });
166
 
167
  /**
168
  * Delete notifications.
169
  */
170
+ $btnDeleteNotifications.on('click', function() {
171
  if (confirm(BooklyL10n.areYouSure)) {
172
+ let ladda = Ladda.create(this),
173
+ data = [],
174
  $checkboxes = $('input:checked', $notificationList);
175
  ladda.start();
176
 
177
+ $checkboxes.each(function() {
178
  data.push(this.value);
179
  });
180
 
187
  notifications: data
188
  },
189
  dataType: 'json',
190
+ success: function(response) {
191
  ladda.stop();
192
  if (response.success) {
193
  dt.rows($checkboxes.closest('td')).remove().draw();
198
  });
199
 
200
  $('[href="#bookly-js-auto"]').click(
201
+ function() {
202
  if (this.classList.contains("toggle")) {
203
  $(this).removeClass("border rounded mb-3 toggle");
204
  $(this).addClass("border-light rounded-top bg-light");
209
  });
210
 
211
  $btnTestEmail
212
+ .on('click', function() {
213
+ $modalTestEmail.booklyModal()
214
+ });
215
 
216
  let $check = $('<div/>', {class: 'dropdown-item my-0 pl-3'}).append(
217
  $('<div>', {class: 'custom-control custom-checkbox'}).append(
219
  $('<label>', {class: 'custom-control-label text-wrap w-100'})
220
  ));
221
  $modalTestEmail
222
+ .on('change', '#bookly-check-all-entities', function() {
223
+ $(':checkbox', $testNotificationsList).prop('checked', this.checked);
224
+ $(':checkbox:first-child', $testNotificationsList).trigger('change');
225
+ })
226
+ .on('click', '[for=bookly-check-all-entities]', function(e) {
227
+ e.stopPropagation();
228
+ })
229
+ .on('click', '.btn-success', function() {
230
+ var ladda = Ladda.create(this),
231
+ data = $(this).closest('form').serializeArray();
232
+ ladda.start();
233
+ $(':checked', $testNotificationsList).each(function() {
234
+ data.push({name: 'notification_ids[]', value: $(this).data('notification-id')});
235
+ });
236
+ data.push({name: 'action', value: 'bookly_test_email_notifications'});
237
+ $.ajax({
238
+ url: ajaxurl,
239
+ type: 'POST',
240
+ data: data,
241
+ dataType: 'json',
242
+ success: function(response) {
243
+ ladda.stop();
244
+ if (response.success) {
245
+ booklyAlert({success: [BooklyL10n.sentSuccessfully]});
246
+ $modalTestEmail.booklyModal('hide');
247
+ }
248
  }
249
+ });
250
+ })
251
+ .on('shown.bs.modal', function() {
252
+ let $send = $(this).find('.btn-success'),
253
+ active = 0;
254
+ $send.prop('disabled', true);
255
+ $testNotificationsList.html('');
256
+ (dt.rows().data()).each(function(notification) {
257
+ let $cloneCheck = $check.clone();
 
258
 
259
+ $('label', $cloneCheck).html(notification.name).attr('for', 'bookly-n-' + notification.id)
260
+ .on('click', function(e) {
261
+ e.stopPropagation();
262
+ })
263
+ ;
264
+ $(':checkbox', $cloneCheck)
265
+ .prop('checked', notification.active == '1')
266
+ .attr('id', 'bookly-n-' + notification.id)
267
+ .data('notification-id', notification.id)
268
+ ;
269
 
270
+ $testNotificationsList.append($cloneCheck);
271
 
272
+ if (notification.active == '1') {
273
+ active++;
274
+ }
275
+ });
276
+ $('.bookly-js-count', $modalTestEmail).html(active);
277
+ $send.prop('disabled', false);
278
  });
 
 
 
279
 
280
  $testNotificationsList
281
+ .on('change', ':checkbox', function() {
282
+ $('.bookly-js-count', $modalTestEmail).html($(':checked', $testNotificationsList).length);
283
+ });
284
  };
285
  });
backend/modules/cloud_sms/resources/js/sms.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(function ($) {
2
  'use strict';
3
 
4
  /**
@@ -12,8 +12,8 @@ jQuery(function ($) {
12
  $phone_input.intlTelInput({
13
  preferredCountries: [BooklyL10n.intlTelInput.country],
14
  initialCountry: BooklyL10n.intlTelInput.country,
15
- geoIpLookup: function (callback) {
16
- $.get('https://ipinfo.io', function () {}, 'jsonp').always(function (resp) {
17
  var countryCode = (resp && resp.country) ? resp.country : '';
18
  callback(countryCode);
19
  });
@@ -21,7 +21,7 @@ jQuery(function ($) {
21
  utilsScript: BooklyL10n.intlTelInput.utils
22
  });
23
  }
24
- $('#bookly-js-submit-notifications').on('click', function (e) {
25
  e.preventDefault();
26
  var ladda = Ladda.create(this);
27
  ladda.start();
@@ -29,7 +29,7 @@ jQuery(function ($) {
29
  $form.bookly_sms_administrator_phone = getPhoneNumber();
30
  $form.submit();
31
  });
32
- $('#send_test_sms').on('click', function (e) {
33
  e.preventDefault();
34
  $.ajax({
35
  url: ajaxurl,
@@ -39,7 +39,7 @@ jQuery(function ($) {
39
  phone_number: getPhoneNumber()
40
  },
41
  dataType: 'json',
42
- success: function (response) {
43
  if (response.success) {
44
  booklyAlert({success: [response.message]});
45
  } else {
@@ -50,7 +50,7 @@ jQuery(function ($) {
50
  });
51
 
52
  $('[data-action=save-administrator-phone]')
53
- .on('click', function (e) {
54
  e.preventDefault();
55
  $.ajax({
56
  url: ajaxurl,
@@ -60,7 +60,7 @@ jQuery(function ($) {
60
  bookly_sms_administrator_phone: getPhoneNumber(),
61
  csrf_token: BooklyL10nGlobal.csrf_token
62
  },
63
- success: function (response) {
64
  if (response.success) {
65
  booklyAlert({success: [BooklyL10n.settingsSaved]});
66
  }
@@ -87,11 +87,11 @@ jQuery(function ($) {
87
  */
88
  $("[href='#campaigns']").one('click', function() {
89
  let $container = $('#campaigns'),
90
- $add_campaign = $('#bookly-js-new-campaign',$container),
91
- $check_all_button = $('#bookly-cam-check-all',$container),
92
- $list = $('#bookly-campaigns',$container),
93
- $filter = $('#bookly-filter',$container),
94
- $delete_button = $('#bookly-delete',$container),
95
  columns = [],
96
  order = [],
97
  current_time,
@@ -104,14 +104,14 @@ jQuery(function ($) {
104
  /**
105
  * Init table columns.
106
  */
107
- $.each(BooklyL10n.datatables.sms_mailing_campaigns.settings.columns, function (column, show) {
108
  if (show) {
109
  switch (column) {
110
  case 'state':
111
  columns.push({
112
  data: column,
113
  className: 'align-middle',
114
- render: function (data, type, row, meta) {
115
  switch (data) {
116
  case 'pending':
117
  return campaign_pending;
@@ -131,7 +131,7 @@ jQuery(function ($) {
131
  columns.push({
132
  data: column,
133
  className: 'align-middle',
134
- render: function (data, type, row, meta) {
135
  return moment(data).format(BooklyL10n.moment_format_date_time);
136
  }
137
  });
@@ -143,25 +143,27 @@ jQuery(function ($) {
143
  }
144
  });
145
 
146
- $.each(BooklyL10n.datatables.sms_mailing_campaigns.settings.order, function (_, value) {
147
- const index = columns.findIndex(function (c) { return c.data === value.column; });
148
  if (index !== -1) {
149
  order.push([index, value.order]);
150
  }
151
  });
152
 
153
  columns.push({
 
154
  responsivePriority: 1,
155
  orderable: false,
156
  className: "text-right",
157
- render: function (data, type, row, meta) {
158
  return '<button type="button" class="btn btn-default"><i class="far fa-fw fa-edit mr-lg-1"></i><span class="d-none d-lg-inline">' + BooklyL10n.edit + '…</span></button>';
159
  }
160
  });
161
  columns.push({
 
162
  responsivePriority: 1,
163
  orderable: false,
164
- render: function (data, type, row, meta) {
165
  return '<div class="custom-control custom-checkbox">' +
166
  '<input value="' + row.id + '" id="bookly-dtcam-' + row.id + '" type="checkbox" class="custom-control-input">' +
167
  '<label for="bookly-dtcam-' + row.id + '" class="custom-control-label"></label>' +
@@ -181,7 +183,7 @@ jQuery(function ($) {
181
  ajax: {
182
  type: 'POST',
183
  url: ajaxurl,
184
- data: function (d) {
185
  return $.extend({
186
  action: 'bookly_get_campaign_list',
187
  csrf_token: BooklyL10nGlobal.csrf_token,
@@ -199,7 +201,7 @@ jQuery(function ($) {
199
 
200
  $add_campaign
201
  .on('click', function() {
202
- BooklyCampaignDialog.showDialog(null, function () {
203
  dt.ajax.reload();
204
  });
205
  });
@@ -207,9 +209,9 @@ jQuery(function ($) {
207
  /**
208
  * Edit campaign.
209
  */
210
- $list.on('click', 'button', function () {
211
  let data = dt.row($(this).closest('td')).data();
212
- BooklyCampaignDialog.showDialog(data.id, function () {
213
  dt.ajax.reload();
214
  })
215
  });
@@ -217,28 +219,28 @@ jQuery(function ($) {
217
  /**
218
  * Select all mailing lists.
219
  */
220
- $check_all_button.on('change', function () {
221
  $list.find('tbody input:checkbox').prop('checked', this.checked);
222
  });
223
 
224
  /**
225
  * On campaign select.
226
  */
227
- $list.on('change', 'tbody input:checkbox', function () {
228
  $check_all_button.prop('checked', $list.find('tbody input:not(:checked)').length == 0);
229
  });
230
 
231
  /**
232
  * Delete campaign(s).
233
  */
234
- $delete_button.on('click', function () {
235
  if (confirm(BooklyL10n.areYouSure)) {
236
  let ladda = Ladda.create(this),
237
- ids = [],
238
- $checkboxes = $('tbody input:checked',$list);
239
  ladda.start();
240
 
241
- $checkboxes.each(function () {
242
  ids.push(this.value);
243
  });
244
 
@@ -251,7 +253,7 @@ jQuery(function ($) {
251
  ids: ids
252
  },
253
  dataType: 'json',
254
- success: function (response) {
255
  ladda.stop();
256
  if (response.success) {
257
  dt.rows($checkboxes.closest('td')).remove().draw();
@@ -267,10 +269,10 @@ jQuery(function ($) {
267
  * On filters change.
268
  */
269
  $filter
270
- .on('keyup', function () {
271
  dt.ajax.reload();
272
  })
273
- .on('keydown', function (e) {
274
  if (e.keyCode == 13) {
275
  e.preventDefault();
276
  return false;
@@ -301,58 +303,60 @@ jQuery(function ($) {
301
  $filter: $('#bookly-filter', $mr_container),
302
  columns: [],
303
  order: [],
304
- $list_name: $('#bookly-js-mailing-list-name',$mr_container),
305
  dt: null,
306
  $back: $('#bookly-js-show-mailing-list', $mr_container),
307
  $add_recipients_button: $('#bookly-js-add-recipients', $mr_container)
308
  };
309
 
310
- mr.$add_recipients_button.on('click', function () {
311
- BooklyAddRecipientsDialog.showDialog(ml.list_id, function () {
312
  mr.dt.ajax.reload();
313
  });
314
  });
315
 
316
  $(document.body)
317
  .on('bookly.mailing-recipients.show', {},
318
- function (event, mailing_list) {
319
  ml.list_id = mailing_list.id;
320
  mr.$list_name.html(mailing_list.name);
321
  switchView('mailing_recipients');
322
  });
323
 
324
- mr.$back.on('click', function(){
325
  switchView('mailing_lists');
326
  });
327
 
328
  /**
329
  * Init table columns.
330
  */
331
- $.each(BooklyL10n.datatables.sms_mailing_lists.settings.columns, function (column, show) {
332
  if (show) {
333
  ml.columns.push({data: column, render: $.fn.dataTable.render.text()});
334
  }
335
  });
336
 
337
- $.each(BooklyL10n.datatables.sms_mailing_lists.settings.order, function (_, value) {
338
- const index = ml.columns.findIndex(function (c) { return c.data === value.column; });
339
  if (index !== -1) {
340
  ml.order.push([index, value.order]);
341
  }
342
  });
343
 
344
  ml.columns.push({
 
345
  responsivePriority: 1,
346
  orderable: false,
347
  className: "text-right",
348
- render: function (data, type, row, meta) {
349
  return '<button type="button" class="btn btn-default"><i class="far fa-fw fa-edit mr-lg-1"></i><span class="d-none d-lg-inline">' + BooklyL10n.edit + '…</span></button>';
350
  }
351
  });
352
  ml.columns.push({
 
353
  responsivePriority: 1,
354
  orderable: false,
355
- render: function (data, type, row, meta) {
356
  return '<div class="custom-control custom-checkbox">' +
357
  '<input value="' + row.id + '" id="bookly-dtml-' + row.id + '" type="checkbox" class="custom-control-input">' +
358
  '<label for="bookly-dtml-' + row.id + '" class="custom-control-label"></label>' +
@@ -375,7 +379,7 @@ jQuery(function ($) {
375
  ajax: {
376
  url: ajaxurl,
377
  type: 'POST',
378
- data: function (d) {
379
  return $.extend({
380
  action: 'bookly_get_mailing_list',
381
  csrf_token: BooklyL10nGlobal.csrf_token,
@@ -386,7 +390,7 @@ jQuery(function ($) {
386
  columns: ml.columns,
387
  language: {
388
  zeroRecords: BooklyL10n.noResults,
389
- processing: BooklyL10n.processing
390
  },
391
  dom: "<'row'<'col-sm-12'tr>><'row float-left mt-3'<'col-sm-12'p>>",
392
  });
@@ -394,35 +398,35 @@ jQuery(function ($) {
394
  /**
395
  * Select all mailing lists.
396
  */
397
- ml.$check_all_button.on('change', function () {
398
  ml.$list.find('tbody input:checkbox').prop('checked', this.checked);
399
  });
400
 
401
  /**
402
  * On mailing list select.
403
  */
404
- ml.$list.on('change', 'tbody input:checkbox', function () {
405
  ml.$check_all_button.prop('checked', ml.$list.find('tbody input:not(:checked)').length == 0);
406
  });
407
 
408
  /**
409
  * Edit mailing list.
410
  */
411
- ml.$list.on('click', 'button', function () {
412
  $(document.body).trigger('bookly.mailing-recipients.show', [ml.dt.row($(this).closest('td')).data()]);
413
  });
414
 
415
  /**
416
  * Delete mailing lists.
417
  */
418
- ml.$delete_button.on('click', function () {
419
  if (confirm(BooklyL10n.areYouSure)) {
420
  let ladda = Ladda.create(this),
421
- ids = [],
422
- $checkboxes = $('tbody input:checked',ml.$list);
423
  ladda.start();
424
 
425
- $checkboxes.each(function () {
426
  ids.push(this.value);
427
  });
428
 
@@ -435,7 +439,7 @@ jQuery(function ($) {
435
  ids: ids
436
  },
437
  dataType: 'json',
438
- success: function (response) {
439
  ladda.stop();
440
  if (response.success) {
441
  ml.dt.rows($checkboxes.closest('td')).remove().draw();
@@ -450,23 +454,24 @@ jQuery(function ($) {
450
  /**
451
  * Init table columns.
452
  */
453
- $.each(BooklyL10n.datatables.sms_mailing_recipients_list.settings.columns, function (column, show) {
454
  if (show) {
455
  mr.columns.push({data: column, render: $.fn.dataTable.render.text()});
456
  }
457
  });
458
 
459
- $.each(BooklyL10n.datatables.sms_mailing_recipients_list.settings.order, function (_, value) {
460
- const index = mr.columns.findIndex(function (c) { return c.data === value.column; });
461
  if (index !== -1) {
462
  mr.order.push([index, value.order]);
463
  }
464
  });
465
 
466
  mr.columns.push({
 
467
  responsivePriority: 1,
468
  orderable: false,
469
- render: function (data, type, row, meta) {
470
  return '<div class="custom-control custom-checkbox">' +
471
  '<input value="' + row.id + '" id="bookly-dtmr-' + row.id + '" type="checkbox" class="custom-control-input">' +
472
  '<label for="bookly-dtmr-' + row.id + '" class="custom-control-label"></label>' +
@@ -477,28 +482,28 @@ jQuery(function ($) {
477
  /**
478
  * Select all recipients.
479
  */
480
- mr.$check_all_button.on('change', function () {
481
  mr.$list.find('tbody input:checkbox').prop('checked', this.checked);
482
  });
483
 
484
  /**
485
  * On recipient select.
486
  */
487
- mr.$list.on('change', 'tbody input:checkbox', function () {
488
  mr.$check_all_button.prop('checked', mr.$list.find('tbody input:not(:checked)').length == 0);
489
  });
490
 
491
  /**
492
  * Delete recipients.
493
  */
494
- mr.$delete_button.on('click', function () {
495
  if (confirm(BooklyL10n.areYouSure)) {
496
  let ladda = Ladda.create(this),
497
- ids = [],
498
- $checkboxes = $('tbody input:checked',mr.$list);
499
  ladda.start();
500
 
501
- $checkboxes.each(function () {
502
  ids.push(this.value);
503
  });
504
 
@@ -511,7 +516,7 @@ jQuery(function ($) {
511
  ids: ids
512
  },
513
  dataType: 'json',
514
- success: function (response) {
515
  ladda.stop();
516
  if (response.success) {
517
  mr.dt.rows($checkboxes.closest('td')).remove().draw();
@@ -527,28 +532,28 @@ jQuery(function ($) {
527
  * On filters change.
528
  */
529
  ml.$filter
530
- .on('keyup', function () {
531
  ml.dt.ajax.reload();
532
  })
533
- .on('keydown', function (e) {
534
  if (e.keyCode == 13) {
535
  e.preventDefault();
536
  return false;
537
  }
538
  });
539
  mr.$filter
540
- .on('keyup', function () {
541
  mr.dt.ajax.reload();
542
  })
543
- .on('keydown', function (e) {
544
  if (e.keyCode == 13) {
545
  e.preventDefault();
546
  return false;
547
  }
548
  });
549
 
550
- function switchView( view ) {
551
- if( view === 'mailing_lists' ) {
552
  $mr_container.hide();
553
  $ml_container.show();
554
  ml.dt.ajax.reload();
@@ -567,7 +572,7 @@ jQuery(function ($) {
567
  ajax: {
568
  type: 'POST',
569
  url: ajaxurl,
570
- data: function (d) {
571
  return $.extend({
572
  action: 'bookly_get_mailing_recipients',
573
  csrf_token: BooklyL10nGlobal.csrf_token,
@@ -606,7 +611,7 @@ jQuery(function ($) {
606
  /**
607
  * SMS Details Tab.
608
  */
609
- $('[href="#sms_details"]').one('click', function () {
610
  var $date_range = $('#sms_date_range');
611
  $date_range.daterangepicker(
612
  {
@@ -617,7 +622,7 @@ jQuery(function ($) {
617
  showDropdowns: true,
618
  linkedCalendars: false,
619
  },
620
- function (start, end) {
621
  var format = 'YYYY-MM-DD';
622
  $date_range
623
  .data('date', start.format(format) + ' - ' + end.format(format))
@@ -631,7 +636,7 @@ jQuery(function ($) {
631
  */
632
  let columns = [];
633
 
634
- $.each(BooklyL10n.datatables.sms_details.settings.columns, function (column, show) {
635
  if (show) {
636
  columns.push({data: column, render: $.fn.dataTable.render.text()});
637
  }
@@ -646,7 +651,7 @@ jQuery(function ($) {
646
  responsive: true,
647
  ajax: {
648
  url: ajaxurl,
649
- data: function (d) {
650
  return {
651
  action: 'bookly_get_sms_list',
652
  csrf_token: BooklyL10nGlobal.csrf_token,
@@ -661,10 +666,10 @@ jQuery(function ($) {
661
  processing: BooklyL10n.processing
662
  }
663
  });
664
- $date_range.on('apply.daterangepicker', function () {
665
  dt.ajax.reload();
666
  });
667
- $(this).on('click', function () {
668
  dt.ajax.reload();
669
  });
670
  }
@@ -684,14 +689,14 @@ jQuery(function ($) {
684
  return '$' + number;
685
  }
686
 
687
- $.each(BooklyL10n.datatables.sms_prices.settings.columns, function (column, show) {
688
  if (show) {
689
  switch (column) {
690
  case 'country_iso_code':
691
  columns.push({
692
  data: column,
693
  className: 'align-middle',
694
- render: function (data, type, row, meta) {
695
  return '<div class="iti-flag ' + data + '"></div>';
696
  }
697
  });
@@ -700,7 +705,7 @@ jQuery(function ($) {
700
  columns.push({
701
  data: column,
702
  className: "text-right",
703
- render: function ( data, type, row, meta ) {
704
  return formatPrice(data);
705
  }
706
  });
@@ -709,7 +714,7 @@ jQuery(function ($) {
709
  columns.push({
710
  data: column,
711
  className: "text-right",
712
- render: function ( data, type, row, meta ) {
713
  if (row.price_alt === '') {
714
  return BooklyL10n.na;
715
  } else {
@@ -750,22 +755,22 @@ jQuery(function ($) {
750
  */
751
  $("[href='#sender_id']").one('click', function() {
752
  var $request_sender_id = $('#bookly-request-sender_id'),
753
- $reset_sender_id = $('#bookly-reset-sender_id'),
754
- $cancel_sender_id = $('#bookly-cancel-sender_id'),
755
- $sender_id = $('#bookly-sender-id-input');
756
 
757
  /**
758
  * Init Columns.
759
  */
760
  let columns = [];
761
 
762
- $.each(BooklyL10n.datatables.sms_sender.settings.columns, function (column, show) {
763
  if (show) {
764
  switch (column) {
765
  case 'name':
766
  columns.push({
767
  data: column,
768
- render: function (data, type, row, meta) {
769
  if (data === null) {
770
  return '<i>' + BooklyL10n.default + '</i>';
771
  } else {
@@ -790,7 +795,7 @@ jQuery(function ($) {
790
  ajax: {
791
  url: ajaxurl,
792
  data: {action: 'bookly_get_sender_ids_list', csrf_token: BooklyL10nGlobal.csrf_token},
793
- dataSrc: function (json) {
794
  if (json.pending) {
795
  $sender_id.val(json.pending);
796
  $request_sender_id.hide();
@@ -809,37 +814,37 @@ jQuery(function ($) {
809
  });
810
  }
811
 
812
- $request_sender_id.on('click', function () {
813
  let ladda = Ladda.create(this);
814
  ladda.start();
815
  $.ajax({
816
  url: ajaxurl,
817
  data: {action: 'bookly_request_sender_id', csrf_token: BooklyL10nGlobal.csrf_token, 'sender_id': $sender_id.val()},
818
  dataType: 'json',
819
- success: function (response) {
820
  if (response.success) {
821
  booklyAlert({success: [BooklyL10n.sender_id.sent]});
822
  $request_sender_id.hide();
823
- $sender_id.prop('disabled',true);
824
  $cancel_sender_id.show();
825
  dt.ajax.reload();
826
  } else {
827
  booklyAlert({error: [response.data.message]});
828
  }
829
  }
830
- }).always(function () {
831
  ladda.stop();
832
  });
833
  });
834
 
835
- $reset_sender_id.on('click', function (e) {
836
  e.preventDefault();
837
  if (confirm(BooklyL10n.areYouSure)) {
838
  $.ajax({
839
  url: ajaxurl,
840
- data: {action: 'bookly_reset_sender_id', csrf_token : BooklyL10nGlobal.csrf_token},
841
  dataType: 'json',
842
- success: function (response) {
843
  if (response.success) {
844
  booklyAlert({success: [BooklyL10n.sender_id.set_default]});
845
  $('.bookly-js-sender-id').html('Bookly');
@@ -856,16 +861,16 @@ jQuery(function ($) {
856
  }
857
  });
858
 
859
- $cancel_sender_id.on('click',function () {
860
  if (confirm(BooklyL10n.areYouSure)) {
861
  var ladda = Ladda.create(this);
862
  ladda.start();
863
  $.ajax({
864
  method: 'POST',
865
  url: ajaxurl,
866
- data: {action: 'bookly_cancel_sender_id', csrf_token : BooklyL10nGlobal.csrf_token},
867
  dataType: 'json',
868
- success: function (response) {
869
  if (response.success) {
870
  $sender_id.prop('disabled', false).val('');
871
  $request_sender_id.show();
@@ -877,15 +882,15 @@ jQuery(function ($) {
877
  }
878
  }
879
  }
880
- }).always(function () {
881
  ladda.stop();
882
  });
883
  }
884
  });
885
- $(this).on('click', function () { dt.ajax.reload(); });
886
  });
887
 
888
- $('#bookly-open-tab-sender-id').on('click', function (e) {
889
  e.preventDefault();
890
  $('#sms_tabs li a[href="#sender_id"]').trigger('click');
891
  });
1
+ jQuery(function($) {
2
  'use strict';
3
 
4
  /**
12
  $phone_input.intlTelInput({
13
  preferredCountries: [BooklyL10n.intlTelInput.country],
14
  initialCountry: BooklyL10n.intlTelInput.country,
15
+ geoIpLookup: function(callback) {
16
+ $.get('https://ipinfo.io', function() {}, 'jsonp').always(function(resp) {
17
  var countryCode = (resp && resp.country) ? resp.country : '';
18
  callback(countryCode);
19
  });
21
  utilsScript: BooklyL10n.intlTelInput.utils
22
  });
23
  }
24
+ $('#bookly-js-submit-notifications').on('click', function(e) {
25
  e.preventDefault();
26
  var ladda = Ladda.create(this);
27
  ladda.start();
29
  $form.bookly_sms_administrator_phone = getPhoneNumber();
30
  $form.submit();
31
  });
32
+ $('#send_test_sms').on('click', function(e) {
33
  e.preventDefault();
34
  $.ajax({
35
  url: ajaxurl,
39
  phone_number: getPhoneNumber()
40
  },
41
  dataType: 'json',
42
+ success: function(response) {
43
  if (response.success) {
44
  booklyAlert({success: [response.message]});
45
  } else {
50
  });
51
 
52
  $('[data-action=save-administrator-phone]')
53
+ .on('click', function(e) {
54
  e.preventDefault();
55
  $.ajax({
56
  url: ajaxurl,
60
  bookly_sms_administrator_phone: getPhoneNumber(),
61
  csrf_token: BooklyL10nGlobal.csrf_token
62
  },
63
+ success: function(response) {
64
  if (response.success) {
65
  booklyAlert({success: [BooklyL10n.settingsSaved]});
66
  }
87
  */
88
  $("[href='#campaigns']").one('click', function() {
89
  let $container = $('#campaigns'),
90
+ $add_campaign = $('#bookly-js-new-campaign', $container),
91
+ $check_all_button = $('#bookly-cam-check-all', $container),
92
+ $list = $('#bookly-campaigns', $container),
93
+ $filter = $('#bookly-filter', $container),
94
+ $delete_button = $('#bookly-delete', $container),
95
  columns = [],
96
  order = [],
97
  current_time,
104
  /**
105
  * Init table columns.
106
  */
107
+ $.each(BooklyL10n.datatables.sms_mailing_campaigns.settings.columns, function(column, show) {
108
  if (show) {
109
  switch (column) {
110
  case 'state':
111
  columns.push({
112
  data: column,
113
  className: 'align-middle',
114
+ render: function(data, type, row, meta) {
115
  switch (data) {
116
  case 'pending':
117
  return campaign_pending;
131
  columns.push({
132
  data: column,
133
  className: 'align-middle',
134
+ render: function(data, type, row, meta) {
135
  return moment(data).format(BooklyL10n.moment_format_date_time);
136
  }
137
  });
143
  }
144
  });
145
 
146
+ $.each(BooklyL10n.datatables.sms_mailing_campaigns.settings.order, function(_, value) {
147
+ const index = columns.findIndex(function(c) { return c.data === value.column; });
148
  if (index !== -1) {
149
  order.push([index, value.order]);
150
  }
151
  });
152
 
153
  columns.push({
154
+ data: null,
155
  responsivePriority: 1,
156
  orderable: false,
157
  className: "text-right",
158
+ render: function(data, type, row, meta) {
159
  return '<button type="button" class="btn btn-default"><i class="far fa-fw fa-edit mr-lg-1"></i><span class="d-none d-lg-inline">' + BooklyL10n.edit + '…</span></button>';
160
  }
161
  });
162
  columns.push({
163
+ data: null,
164
  responsivePriority: 1,
165
  orderable: false,
166
+ render: function(data, type, row, meta) {
167
  return '<div class="custom-control custom-checkbox">' +
168
  '<input value="' + row.id + '" id="bookly-dtcam-' + row.id + '" type="checkbox" class="custom-control-input">' +
169
  '<label for="bookly-dtcam-' + row.id + '" class="custom-control-label"></label>' +
183
  ajax: {
184
  type: 'POST',
185
  url: ajaxurl,
186
+ data: function(d) {
187
  return $.extend({
188
  action: 'bookly_get_campaign_list',
189
  csrf_token: BooklyL10nGlobal.csrf_token,
201
 
202
  $add_campaign
203
  .on('click', function() {
204
+ BooklyCampaignDialog.showDialog(null, function() {
205
  dt.ajax.reload();
206
  });
207
  });
209
  /**
210
  * Edit campaign.
211
  */
212
+ $list.on('click', 'button', function() {
213
  let data = dt.row($(this).closest('td')).data();
214
+ BooklyCampaignDialog.showDialog(data.id, function() {
215
  dt.ajax.reload();
216
  })
217
  });
219
  /**
220
  * Select all mailing lists.
221
  */
222
+ $check_all_button.on('change', function() {
223
  $list.find('tbody input:checkbox').prop('checked', this.checked);
224
  });
225
 
226
  /**
227
  * On campaign select.
228
  */
229
+ $list.on('change', 'tbody input:checkbox', function() {
230
  $check_all_button.prop('checked', $list.find('tbody input:not(:checked)').length == 0);
231
  });
232
 
233
  /**
234
  * Delete campaign(s).
235
  */
236
+ $delete_button.on('click', function() {
237
  if (confirm(BooklyL10n.areYouSure)) {
238
  let ladda = Ladda.create(this),
239
+ ids = [],
240
+ $checkboxes = $('tbody input:checked', $list);
241
  ladda.start();
242
 
243
+ $checkboxes.each(function() {
244
  ids.push(this.value);
245
  });
246
 
253
  ids: ids
254
  },
255
  dataType: 'json',
256
+ success: function(response) {
257
  ladda.stop();
258
  if (response.success) {
259
  dt.rows($checkboxes.closest('td')).remove().draw();
269
  * On filters change.
270
  */
271
  $filter
272
+ .on('keyup', function() {
273
  dt.ajax.reload();
274
  })
275
+ .on('keydown', function(e) {
276
  if (e.keyCode == 13) {
277
  e.preventDefault();
278
  return false;
303
  $filter: $('#bookly-filter', $mr_container),
304
  columns: [],
305
  order: [],
306
+ $list_name: $('#bookly-js-mailing-list-name', $mr_container),
307
  dt: null,
308
  $back: $('#bookly-js-show-mailing-list', $mr_container),
309
  $add_recipients_button: $('#bookly-js-add-recipients', $mr_container)
310
  };
311
 
312
+ mr.$add_recipients_button.on('click', function() {
313
+ BooklyAddRecipientsDialog.showDialog(ml.list_id, function() {
314
  mr.dt.ajax.reload();
315
  });
316
  });
317
 
318
  $(document.body)
319
  .on('bookly.mailing-recipients.show', {},
320
+ function(event, mailing_list) {
321
  ml.list_id = mailing_list.id;
322
  mr.$list_name.html(mailing_list.name);
323
  switchView('mailing_recipients');
324
  });
325
 
326
+ mr.$back.on('click', function() {
327
  switchView('mailing_lists');
328
  });
329
 
330
  /**
331
  * Init table columns.
332
  */
333
+ $.each(BooklyL10n.datatables.sms_mailing_lists.settings.columns, function(column, show) {
334
  if (show) {
335
  ml.columns.push({data: column, render: $.fn.dataTable.render.text()});
336
  }
337
  });
338
 
339
+ $.each(BooklyL10n.datatables.sms_mailing_lists.settings.order, function(_, value) {
340
+ const index = ml.columns.findIndex(function(c) { return c.data === value.column; });
341
  if (index !== -1) {
342
  ml.order.push([index, value.order]);
343
  }
344
  });
345
 
346
  ml.columns.push({
347
+ data: null,
348
  responsivePriority: 1,
349
  orderable: false,
350
  className: "text-right",
351
+ render: function(data, type, row, meta) {
352
  return '<button type="button" class="btn btn-default"><i class="far fa-fw fa-edit mr-lg-1"></i><span class="d-none d-lg-inline">' + BooklyL10n.edit + '…</span></button>';
353
  }
354
  });
355
  ml.columns.push({
356
+ data: null,
357
  responsivePriority: 1,
358
  orderable: false,
359
+ render: function(data, type, row, meta) {
360
  return '<div class="custom-control custom-checkbox">' +
361
  '<input value="' + row.id + '" id="bookly-dtml-' + row.id + '" type="checkbox" class="custom-control-input">' +
362
  '<label for="bookly-dtml-' + row.id + '" class="custom-control-label"></label>' +
379
  ajax: {
380
  url: ajaxurl,
381
  type: 'POST',
382
+ data: function(d) {
383
  return $.extend({
384
  action: 'bookly_get_mailing_list',
385
  csrf_token: BooklyL10nGlobal.csrf_token,
390
  columns: ml.columns,
391
  language: {
392
  zeroRecords: BooklyL10n.noResults,
393
+ processing: BooklyL10n.processing
394
  },
395
  dom: "<'row'<'col-sm-12'tr>><'row float-left mt-3'<'col-sm-12'p>>",
396
  });
398
  /**
399
  * Select all mailing lists.
400
  */
401
+ ml.$check_all_button.on('change', function() {
402
  ml.$list.find('tbody input:checkbox').prop('checked', this.checked);
403
  });
404
 
405
  /**
406
  * On mailing list select.
407
  */
408
+ ml.$list.on('change', 'tbody input:checkbox', function() {
409
  ml.$check_all_button.prop('checked', ml.$list.find('tbody input:not(:checked)').length == 0);
410
  });
411
 
412
  /**
413
  * Edit mailing list.
414
  */
415
+ ml.$list.on('click', 'button', function() {
416
  $(document.body).trigger('bookly.mailing-recipients.show', [ml.dt.row($(this).closest('td')).data()]);
417
  });
418
 
419
  /**
420
  * Delete mailing lists.
421
  */
422
+ ml.$delete_button.on('click', function() {
423
  if (confirm(BooklyL10n.areYouSure)) {
424
  let ladda = Ladda.create(this),
425
+ ids = [],
426
+ $checkboxes = $('tbody input:checked', ml.$list);
427
  ladda.start();
428
 
429
+ $checkboxes.each(function() {
430
  ids.push(this.value);
431
  });
432
 
439
  ids: ids
440
  },
441
  dataType: 'json',
442
+ success: function(response) {
443
  ladda.stop();
444
  if (response.success) {
445
  ml.dt.rows($checkboxes.closest('td')).remove().draw();
454
  /**
455
  * Init table columns.
456
  */
457
+ $.each(BooklyL10n.datatables.sms_mailing_recipients_list.settings.columns, function(column, show) {
458
  if (show) {
459
  mr.columns.push({data: column, render: $.fn.dataTable.render.text()});
460
  }
461
  });
462
 
463
+ $.each(BooklyL10n.datatables.sms_mailing_recipients_list.settings.order, function(_, value) {
464
+ const index = mr.columns.findIndex(function(c) { return c.data === value.column; });
465
  if (index !== -1) {
466
  mr.order.push([index, value.order]);
467
  }
468
  });
469
 
470
  mr.columns.push({
471
+ data: null,
472
  responsivePriority: 1,
473
  orderable: false,
474
+ render: function(data, type, row, meta) {
475
  return '<div class="custom-control custom-checkbox">' +
476
  '<input value="' + row.id + '" id="bookly-dtmr-' + row.id + '" type="checkbox" class="custom-control-input">' +
477
  '<label for="bookly-dtmr-' + row.id + '" class="custom-control-label"></label>' +
482
  /**
483
  * Select all recipients.
484
  */
485
+ mr.$check_all_button.on('change', function() {
486
  mr.$list.find('tbody input:checkbox').prop('checked', this.checked);
487
  });
488
 
489
  /**
490
  * On recipient select.
491
  */
492
+ mr.$list.on('change', 'tbody input:checkbox', function() {
493
  mr.$check_all_button.prop('checked', mr.$list.find('tbody input:not(:checked)').length == 0);
494
  });
495
 
496
  /**
497
  * Delete recipients.
498
  */
499
+ mr.$delete_button.on('click', function() {
500
  if (confirm(BooklyL10n.areYouSure)) {
501
  let ladda = Ladda.create(this),
502
+ ids = [],
503
+ $checkboxes = $('tbody input:checked', mr.$list);
504
  ladda.start();
505
 
506
+ $checkboxes.each(function() {
507
  ids.push(this.value);
508
  });
509
 
516
  ids: ids
517
  },
518
  dataType: 'json',
519
+ success: function(response) {
520
  ladda.stop();
521
  if (response.success) {
522
  mr.dt.rows($checkboxes.closest('td')).remove().draw();
532
  * On filters change.
533
  */
534
  ml.$filter
535
+ .on('keyup', function() {
536
  ml.dt.ajax.reload();
537
  })
538
+ .on('keydown', function(e) {
539
  if (e.keyCode == 13) {
540
  e.preventDefault();
541
  return false;
542
  }
543
  });
544
  mr.$filter
545
+ .on('keyup', function() {
546
  mr.dt.ajax.reload();
547
  })
548
+ .on('keydown', function(e) {
549
  if (e.keyCode == 13) {
550
  e.preventDefault();
551
  return false;
552
  }
553
  });
554
 
555
+ function switchView(view) {
556
+ if (view === 'mailing_lists') {
557
  $mr_container.hide();
558
  $ml_container.show();
559
  ml.dt.ajax.reload();
572
  ajax: {
573
  type: 'POST',
574
  url: ajaxurl,
575
+ data: function(d) {
576
  return $.extend({
577
  action: 'bookly_get_mailing_recipients',
578
  csrf_token: BooklyL10nGlobal.csrf_token,
611
  /**
612
  * SMS Details Tab.
613
  */
614
+ $('[href="#sms_details"]').one('click', function() {
615
  var $date_range = $('#sms_date_range');
616
  $date_range.daterangepicker(
617
  {
622
  showDropdowns: true,
623
  linkedCalendars: false,
624
  },
625
+ function(start, end) {
626
  var format = 'YYYY-MM-DD';
627
  $date_range
628
  .data('date', start.format(format) + ' - ' + end.format(format))
636
  */
637
  let columns = [];
638
 
639
+ $.each(BooklyL10n.datatables.sms_details.settings.columns, function(column, show) {
640
  if (show) {
641
  columns.push({data: column, render: $.fn.dataTable.render.text()});
642
  }
651
  responsive: true,
652
  ajax: {
653
  url: ajaxurl,
654
+ data: function(d) {
655
  return {
656
  action: 'bookly_get_sms_list',
657
  csrf_token: BooklyL10nGlobal.csrf_token,
666
  processing: BooklyL10n.processing
667
  }
668
  });
669
+ $date_range.on('apply.daterangepicker', function() {
670
  dt.ajax.reload();
671
  });
672
+ $(this).on('click', function() {
673
  dt.ajax.reload();
674
  });
675
  }
689
  return '$' + number;
690
  }
691
 
692
+ $.each(BooklyL10n.datatables.sms_prices.settings.columns, function(column, show) {
693
  if (show) {
694
  switch (column) {
695
  case 'country_iso_code':
696
  columns.push({
697
  data: column,
698
  className: 'align-middle',
699
+ render: function(data, type, row, meta) {
700
  return '<div class="iti-flag ' + data + '"></div>';
701
  }
702
  });
705
  columns.push({
706
  data: column,
707
  className: "text-right",
708
+ render: function(data, type, row, meta) {
709
  return formatPrice(data);
710
  }
711
  });
714
  columns.push({
715
  data: column,
716
  className: "text-right",
717
+ render: function(data, type, row, meta) {
718
  if (row.price_alt === '') {
719
  return BooklyL10n.na;
720
  } else {
755
  */
756
  $("[href='#sender_id']").one('click', function() {
757
  var $request_sender_id = $('#bookly-request-sender_id'),
758
+ $reset_sender_id = $('#bookly-reset-sender_id'),
759
+ $cancel_sender_id = $('#bookly-cancel-sender_id'),
760
+ $sender_id = $('#bookly-sender-id-input');
761
 
762
  /**
763
  * Init Columns.
764
  */
765
  let columns = [];
766
 
767
+ $.each(BooklyL10n.datatables.sms_sender.settings.columns, function(column, show) {
768
  if (show) {
769
  switch (column) {
770
  case 'name':
771
  columns.push({
772
  data: column,
773
+ render: function(data, type, row, meta) {
774
  if (data === null) {
775
  return '<i>' + BooklyL10n.default + '</i>';
776
  } else {
795
  ajax: {
796
  url: ajaxurl,
797
  data: {action: 'bookly_get_sender_ids_list', csrf_token: BooklyL10nGlobal.csrf_token},
798
+ dataSrc: function(json) {
799
  if (json.pending) {
800
  $sender_id.val(json.pending);
801
  $request_sender_id.hide();
814
  });
815
  }
816
 
817
+ $request_sender_id.on('click', function() {
818
  let ladda = Ladda.create(this);
819
  ladda.start();
820
  $.ajax({
821
  url: ajaxurl,
822
  data: {action: 'bookly_request_sender_id', csrf_token: BooklyL10nGlobal.csrf_token, 'sender_id': $sender_id.val()},
823
  dataType: 'json',
824
+ success: function(response) {
825
  if (response.success) {
826
  booklyAlert({success: [BooklyL10n.sender_id.sent]});
827
  $request_sender_id.hide();
828
+ $sender_id.prop('disabled', true);
829
  $cancel_sender_id.show();
830
  dt.ajax.reload();
831
  } else {
832
  booklyAlert({error: [response.data.message]});
833
  }
834
  }
835
+ }).always(function() {
836
  ladda.stop();
837
  });
838
  });
839
 
840
+ $reset_sender_id.on('click', function(e) {
841
  e.preventDefault();
842
  if (confirm(BooklyL10n.areYouSure)) {
843
  $.ajax({
844
  url: ajaxurl,
845
+ data: {action: 'bookly_reset_sender_id', csrf_token: BooklyL10nGlobal.csrf_token},
846
  dataType: 'json',
847
+ success: function(response) {
848
  if (response.success) {
849
  booklyAlert({success: [BooklyL10n.sender_id.set_default]});
850
  $('.bookly-js-sender-id').html('Bookly');
861
  }
862
  });
863
 
864
+ $cancel_sender_id.on('click', function() {
865
  if (confirm(BooklyL10n.areYouSure)) {
866
  var ladda = Ladda.create(this);
867
  ladda.start();
868
  $.ajax({
869
  method: 'POST',
870
  url: ajaxurl,
871
+ data: {action: 'bookly_cancel_sender_id', csrf_token: BooklyL10nGlobal.csrf_token},
872
  dataType: 'json',
873
+ success: function(response) {
874
  if (response.success) {
875
  $sender_id.prop('disabled', false).val('');
876
  $request_sender_id.show();
882
  }
883
  }
884
  }
885
+ }).always(function() {
886
  ladda.stop();
887
  });
888
  }
889
  });
890
+ $(this).on('click', function() { dt.ajax.reload(); });
891
  });
892
 
893
+ $('#bookly-open-tab-sender-id').on('click', function(e) {
894
  e.preventDefault();
895
  $('#sms_tabs li a[href="#sender_id"]').trigger('click');
896
  });
backend/modules/customers/resources/js/customers.js CHANGED
@@ -1,27 +1,27 @@
1
  jQuery(function($) {
2
  'use strict';
3
  let
4
- $customersList = $('#bookly-customers-list'),
5
- $mergeListContainer = $('#bookly-merge-list'),
6
- $mergeList = $customersList.clone().prop('id', '').find('th:last').remove().end().appendTo($mergeListContainer),
7
- $filter = $('#bookly-filter'),
8
- $checkAllButton = $('#bookly-check-all'),
9
- $customerDialog = $('#bookly-customer-dialog'),
10
- $newCustomerBtn = $('#bookly-new-customer'),
11
  $selectForMergeButton = $('#bookly-select-for-merge'),
12
- $mergeWithButton = $('[data-target="#bookly-merge-dialog"]'),
13
- $mergeDialog = $('#bookly-merge-dialog'),
14
- $mergeButton = $('#bookly-merge', $mergeDialog),
15
- $exportDialog = $('#bookly-export-customers-dialog'),
16
- $exportSelectAll = $('#bookly-js-export-select-all', $exportDialog),
17
- columns = [],
18
- order = []
19
  ;
20
 
21
  /**
22
  * Init table columns.
23
  */
24
- $.each(BooklyL10n.datatables.customers.settings.columns, function (column, show) {
25
  if (show) {
26
  switch (column) {
27
  case 'id':
@@ -37,14 +37,15 @@ jQuery(function($) {
37
  case 'facebook':
38
  columns.push({
39
  data: 'facebook_id',
40
- render: function (data, type, row, meta) {
41
  return data ? '<a href="https://www.facebook.com/app_scoped_user_id/' + data + '/" target="_blank"><span class="dashicons dashicons-facebook"></span></a>' : '';
42
  }
43
  });
44
  break;
45
  case 'birthday': {
46
- columns.push({data: 'birthday',
47
- render: function (data, type, row, meta) {
 
48
  return row.birthday_formatted;
49
  }
50
  });
@@ -53,7 +54,7 @@ jQuery(function($) {
53
  default:
54
  if (column.startsWith('info_fields_')) {
55
  const id = parseInt(column.split('_').pop());
56
- const field = BooklyL10n.infoFields.find( function(i) { return i.id === id; });
57
  columns.push({
58
  data: 'info_fields.' + id + '.value' + (field.type === 'checkboxes' ? '[, ]' : ''),
59
  render: $.fn.dataTable.render.text(),
@@ -68,8 +69,8 @@ jQuery(function($) {
68
  });
69
  columns[0].responsivePriority = 0;
70
 
71
- $.each(BooklyL10n.datatables.customers.settings.order, function (_, value) {
72
- const index = columns.findIndex(function (c) { return c.data === value.column; });
73
  if (index !== -1) {
74
  order.push([index, value.order]);
75
  }
@@ -91,7 +92,7 @@ jQuery(function($) {
91
  ajax: {
92
  url: ajaxurl,
93
  type: 'POST',
94
- data: function (d) {
95
  return $.extend({}, d, {
96
  action: 'bookly_get_customers',
97
  csrf_token: BooklyL10nGlobal.csrf_token,
@@ -101,19 +102,21 @@ jQuery(function($) {
101
  },
102
  columns: columns.concat([
103
  {
 
104
  responsivePriority: 1,
105
- orderable : false,
106
- searchable : false,
107
- width : 120,
108
- render : function (data, type, row, meta) {
109
  return '<button type="button" class="btn btn-default" data-action="edit"><i class="far fa-fw fa-edit mr-lg-1"></i><span class="d-none d-lg-inline">' + BooklyL10n.edit + '…</span></button>';
110
  }
111
  },
112
  {
 
113
  responsivePriority: 1,
114
- orderable : false,
115
- searchable : false,
116
- render : function (data, type, row, meta) {
117
  return '<div class="custom-control custom-checkbox">' +
118
  '<input value="' + row.id + '" id="bookly-dt-' + row.id + '" type="checkbox" class="custom-control-input">' +
119
  '<label for="bookly-dt-' + row.id + '" class="custom-control-label"></label>' +
@@ -121,20 +124,20 @@ jQuery(function($) {
121
  }
122
  }
123
  ]),
124
- dom : "<'row'<'col-sm-12'tr>><'row float-left mt-3'<'col-sm-12'p>>",
125
  language: {
126
  zeroRecords: BooklyL10n.zeroRecords,
127
- processing: BooklyL10n.processing
128
  }
129
  });
130
 
131
  /**
132
  * Add customer.
133
  */
134
- $newCustomerBtn.on('click', function () {
135
  BooklyCustomerDialog.showDialog({
136
  action: 'create',
137
- onDone: function (event) {
138
  dt.ajax.reload();
139
  }
140
  })
@@ -143,47 +146,47 @@ jQuery(function($) {
143
  /**
144
  * Select all customers.
145
  */
146
- $checkAllButton.on('change', function () {
147
  $customersList.find('tbody input:checkbox').prop('checked', this.checked);
148
  });
149
 
150
  $customersList
151
- // On customer select.
152
- .on('change', 'tbody input:checkbox', function () {
153
- $checkAllButton.prop('checked', $customersList.find('tbody input:not(:checked)').length == 0);
154
- $mergeWithButton.prop('disabled', $customersList.find('tbody input:checked').length != 1);
155
- })
156
- // Edit customer.
157
- .on('click', '[data-action=edit]', function () {
158
- BooklyCustomerDialog.showDialog({
159
- action: 'load',
160
- customerId: getDTRowData(this).id,
161
- onDone: function (event) {
162
- dt.ajax.reload();
163
- }
164
  })
165
- });
 
 
 
 
 
 
 
 
 
166
 
167
  /**
168
  * On filters change.
169
  */
170
- $filter.on('keyup', function () { dt.ajax.reload(); });
171
 
172
  /**
173
  * Merge list.
174
  */
175
  var mdt = $mergeList.DataTable({
176
- order : [[0, 'asc']],
177
- info : false,
178
- searching : false,
179
- paging : false,
180
- responsive : true,
181
  columns: columns.concat([
182
  {
183
  responsivePriority: 1,
184
- orderable : false,
185
- searchable : false,
186
- render : function (data, type, row, meta) {
187
  return '<button type="button" class="btn btn-default"><i class="fas fa-fw fa-times"></i></button>';
188
  }
189
  }
@@ -196,11 +199,11 @@ jQuery(function($) {
196
  /**
197
  * Select for merge.
198
  */
199
- $selectForMergeButton.on('click', function () {
200
  var $checkboxes = $customersList.find('tbody input:checked');
201
 
202
  if ($checkboxes.length) {
203
- $checkboxes.each(function () {
204
  var data = getDTRowData(this);
205
  if (mdt.rows().data().indexOf(data) < 0) {
206
  mdt.row.add(data).draw();
@@ -216,12 +219,12 @@ jQuery(function($) {
216
  /**
217
  * Merge customers.
218
  */
219
- $mergeButton.on('click', function (e) {
220
  e.preventDefault();
221
  let ladda = Ladda.create(this),
222
  ids = [];
223
  ladda.start();
224
- mdt.rows().every(function () {
225
  ids.push(this.data().id);
226
  });
227
  $.ajax({
@@ -234,7 +237,7 @@ jQuery(function($) {
234
  ids: ids
235
  },
236
  dataType: 'json',
237
- success: function (response) {
238
  ladda.stop();
239
  $mergeDialog.booklyModal('hide');
240
  if (response.success) {
@@ -252,7 +255,7 @@ jQuery(function($) {
252
  /**
253
  * Remove customer from merge list.
254
  */
255
- $mergeList.on('click', 'button', function () {
256
  mdt.row($(this).closest('td')).remove().draw();
257
  var any = mdt.rows().any();
258
  $mergeWithButton.toggle(any);
@@ -260,15 +263,15 @@ jQuery(function($) {
260
  });
261
 
262
  $exportSelectAll
263
- .on('click', function () {
264
  let checked = this.checked;
265
- $('.bookly-js-columns input', $exportDialog).each(function () {
266
  $(this).prop('checked', checked);
267
  });
268
  });
269
 
270
  $('.bookly-js-columns input', $exportDialog)
271
- .on('change', function () {
272
  $exportSelectAll.prop('checked', $('.bookly-js-columns input:checked', $exportDialog).length == $('.bookly-js-columns input', $exportDialog).length);
273
  });
274
 
1
  jQuery(function($) {
2
  'use strict';
3
  let
4
+ $customersList = $('#bookly-customers-list'),
5
+ $mergeListContainer = $('#bookly-merge-list'),
6
+ $mergeList = $customersList.clone().prop('id', '').find('th:last').remove().end().appendTo($mergeListContainer),
7
+ $filter = $('#bookly-filter'),
8
+ $checkAllButton = $('#bookly-check-all'),
9
+ $customerDialog = $('#bookly-customer-dialog'),
10
+ $newCustomerBtn = $('#bookly-new-customer'),
11
  $selectForMergeButton = $('#bookly-select-for-merge'),
12
+ $mergeWithButton = $('[data-target="#bookly-merge-dialog"]'),
13
+ $mergeDialog = $('#bookly-merge-dialog'),
14
+ $mergeButton = $('#bookly-merge', $mergeDialog),
15
+ $exportDialog = $('#bookly-export-customers-dialog'),
16
+ $exportSelectAll = $('#bookly-js-export-select-all', $exportDialog),
17
+ columns = [],
18
+ order = []
19
  ;
20
 
21
  /**
22
  * Init table columns.
23
  */
24
+ $.each(BooklyL10n.datatables.customers.settings.columns, function(column, show) {
25
  if (show) {
26
  switch (column) {
27
  case 'id':
37
  case 'facebook':
38
  columns.push({
39
  data: 'facebook_id',
40
+ render: function(data, type, row, meta) {
41
  return data ? '<a href="https://www.facebook.com/app_scoped_user_id/' + data + '/" target="_blank"><span class="dashicons dashicons-facebook"></span></a>' : '';
42
  }
43
  });
44
  break;
45
  case 'birthday': {
46
+ columns.push({
47
+ data: 'birthday',
48
+ render: function(data, type, row, meta) {
49
  return row.birthday_formatted;
50
  }
51
  });
54
  default:
55
  if (column.startsWith('info_fields_')) {
56
  const id = parseInt(column.split('_').pop());
57
+ const field = BooklyL10n.infoFields.find(function(i) { return i.id === id; });
58
  columns.push({
59
  data: 'info_fields.' + id + '.value' + (field.type === 'checkboxes' ? '[, ]' : ''),
60
  render: $.fn.dataTable.render.text(),
69
  });
70
  columns[0].responsivePriority = 0;
71
 
72
+ $.each(BooklyL10n.datatables.customers.settings.order, function(_, value) {
73
+ const index = columns.findIndex(function(c) { return c.data === value.column; });
74
  if (index !== -1) {
75
  order.push([index, value.order]);
76
  }
92
  ajax: {
93
  url: ajaxurl,
94
  type: 'POST',
95
+ data: function(d) {
96
  return $.extend({}, d, {
97
  action: 'bookly_get_customers',
98
  csrf_token: BooklyL10nGlobal.csrf_token,
102
  },
103
  columns: columns.concat([
104
  {
105
+ data: null,
106
  responsivePriority: 1,
107
+ orderable: false,
108
+ searchable: false,
109
+ width: 120,
110
+ render: function(data, type, row, meta) {
111
  return '<button type="button" class="btn btn-default" data-action="edit"><i class="far fa-fw fa-edit mr-lg-1"></i><span class="d-none d-lg-inline">' + BooklyL10n.edit + '…</span></button>';
112
  }
113
  },
114
  {
115
+ data: null,
116
  responsivePriority: 1,
117
+ orderable: false,
118
+ searchable: false,
119
+ render: function(data, type, row, meta) {
120
  return '<div class="custom-control custom-checkbox">' +
121
  '<input value="' + row.id + '" id="bookly-dt-' + row.id + '" type="checkbox" class="custom-control-input">' +
122
  '<label for="bookly-dt-' + row.id + '" class="custom-control-label"></label>' +
124
  }
125
  }
126
  ]),
127
+ dom: "<'row'<'col-sm-12'tr>><'row float-left mt-3'<'col-sm-12'p>>",
128
  language: {
129
  zeroRecords: BooklyL10n.zeroRecords,
130
+ processing: BooklyL10n.processing
131
  }
132
  });
133
 
134
  /**
135
  * Add customer.
136
  */
137
+ $newCustomerBtn.on('click', function() {
138
  BooklyCustomerDialog.showDialog({
139
  action: 'create',
140
+ onDone: function(event) {
141
  dt.ajax.reload();
142
  }
143
  })
146
  /**
147
  * Select all customers.
148
  */
149
+ $checkAllButton.on('change', function() {
150
  $customersList.find('tbody input:checkbox').prop('checked', this.checked);
151
  });
152
 
153
  $customersList
154
+ // On customer select.
155
+ .on('change', 'tbody input:checkbox', function() {
156
+ $checkAllButton.prop('checked', $customersList.find('tbody input:not(:checked)').length == 0);
157
+ $mergeWithButton.prop('disabled', $customersList.find('tbody input:checked').length != 1);
 
 
 
 
 
 
 
 
 
158
  })
159
+ // Edit customer.
160
+ .on('click', '[data-action=edit]', function() {
161
+ BooklyCustomerDialog.showDialog({
162
+ action: 'load',
163
+ customerId: getDTRowData(this).id,
164
+ onDone: function(event) {
165
+ dt.ajax.reload();
166
+ }
167
+ })
168
+ });
169
 
170
  /**
171
  * On filters change.
172
  */
173
+ $filter.on('keyup', function() { dt.ajax.reload(); });
174
 
175
  /**
176
  * Merge list.
177
  */
178
  var mdt = $mergeList.DataTable({
179
+ order: [[0, 'asc']],
180
+ info: false,
181
+ searching: false,
182
+ paging: false,
183
+ responsive: true,
184
  columns: columns.concat([
185
  {
186
  responsivePriority: 1,
187
+ orderable: false,
188
+ searchable: false,
189
+ render: function(data, type, row, meta) {
190
  return '<button type="button" class="btn btn-default"><i class="fas fa-fw fa-times"></i></button>';
191
  }
192
  }
199
  /**
200
  * Select for merge.
201
  */
202
+ $selectForMergeButton.on('click', function() {
203
  var $checkboxes = $customersList.find('tbody input:checked');
204
 
205
  if ($checkboxes.length) {
206
+ $checkboxes.each(function() {
207
  var data = getDTRowData(this);
208
  if (mdt.rows().data().indexOf(data) < 0) {
209
  mdt.row.add(data).draw();
219
  /**
220
  * Merge customers.
221
  */
222
+ $mergeButton.on('click', function(e) {
223
  e.preventDefault();
224
  let ladda = Ladda.create(this),
225
  ids = [];
226
  ladda.start();
227
+ mdt.rows().every(function() {
228
  ids.push(this.data().id);
229
  });
230
  $.ajax({
237
  ids: ids
238
  },
239
  dataType: 'json',
240
+ success: function(response) {
241
  ladda.stop();
242
  $mergeDialog.booklyModal('hide');
243
  if (response.success) {
255
  /**
256
  * Remove customer from merge list.
257
  */
258
+ $mergeList.on('click', 'button', function() {
259
  mdt.row($(this).closest('td')).remove().draw();
260
  var any = mdt.rows().any();
261
  $mergeWithButton.toggle(any);
263
  });
264
 
265
  $exportSelectAll
266
+ .on('click', function() {
267
  let checked = this.checked;
268
+ $('.bookly-js-columns input', $exportDialog).each(function() {
269
  $(this).prop('checked', checked);
270
  });
271
  });
272
 
273
  $('.bookly-js-columns input', $exportDialog)
274
+ .on('change', function() {
275
  $exportSelectAll.prop('checked', $('.bookly-js-columns input:checked', $exportDialog).length == $('.bookly-js-columns input', $exportDialog).length);
276
  });
277
 
backend/modules/debug/Ajax.php DELETED
@@ -1,950 +0,0 @@
1
- <?php
2
- namespace Bookly\Backend\Modules\Debug;
3
-
4
- use Bookly\Lib;
5
- use Bookly\Backend\Modules\Debug\Lib\QueryBuilder;
6
- use Bookly\Backend\Modules\Debug\Lib\Schema;
7
-
8
- /**
9
- * Class Ajax
10
- * @package Bookly\Backend\Modules\Debug
11
- */
12
- class Ajax extends Lib\Base\Ajax
13
- {
14
- /**
15
- * @inheritDoc
16
- */
17
- protected static function permissions()
18
- {
19
- return array( 'runTest' => 'anonymous' );
20
- }
21
-
22
- /**
23
- * Export database data.
24
- */
25
- public static function exportData()
26
- {
27
- /** @global \wpdb $wpdb */
28
- global $wpdb;
29
-
30
- $result = array();
31
- $schema = new Schema();
32
- foreach ( apply_filters( 'bookly_plugins', array() ) as $plugin ) {
33
- /** @var Lib\Base\Plugin $plugin */
34
- $installer_class = $plugin::getRootNamespace() . '\Lib\Installer';
35
- /** @var Lib\Base\Installer $installer */
36
- $installer = new $installer_class();
37
- $result['plugins'][ $plugin::getBasename() ] = $plugin::getVersion();
38
-
39
- foreach ( $plugin::getEntityClasses() as $entity_class ) {
40
- $table_name = $entity_class::getTableName();
41
- $result['entities'][ $entity_class ] = array(
42
- 'fields' => array_keys( $schema->getTableStructure( $table_name ) ),
43
- 'values' => $wpdb->get_results( 'SELECT * FROM ' . $table_name, ARRAY_N )
44
- );
45
- }
46
- $plugin_prefix = $plugin::getPrefix();
47
- $options_postfix = array( 'data_loaded', 'grace_start', 'db_version', 'installation_time' );
48
- foreach ( $options_postfix as $option ) {
49
- $option_name = $plugin_prefix . $option;
50
- $result['options'][ $option_name ] = get_option( $option_name );
51
- }
52
-
53
- $result['options'][ $plugin::getPurchaseCodeOption() ] = $plugin::getPurchaseCode();
54
- foreach ( $installer->getOptions() as $option_name => $option_value ) {
55
- $result['options'][ $option_name ] = get_option( $option_name );
56
- }
57
- }
58
-
59
- header( 'Content-type: application/json' );
60
- header( 'Content-Disposition: attachment; filename=bookly_db_export_' . date( 'YmdHis' ) . '.json' );
61
- echo json_encode( $result );
62
-
63
- exit ( 0 );
64
- }
65
-
66
- /**
67
- * Import database data.
68
- */
69
- public static function importData()
70
- {
71
- /** @global \wpdb $wpdb */
72
- global $wpdb;
73
- $fs = Lib\Utils\Common::getFilesystem();
74
-
75
- if ( $_FILES['import']['name'] ) {
76
- $json = $fs->get_contents( $_FILES['import']['tmp_name'] );
77
- if ( $json !== false) {
78
- $wpdb->query( 'SET FOREIGN_KEY_CHECKS = 0' );
79
-
80
- $data = json_decode( $json, true );
81
- /** @var Lib\Base\Plugin[] $bookly_plugins */
82
- $bookly_plugins = apply_filters( 'bookly_plugins', array() );
83
- /** @since Bookly 17.7 */
84
- if ( isset( $data['plugins'] ) ) {
85
- foreach ( $bookly_plugins as $plugin ) {
86
- if ( ! array_key_exists( $plugin::getBasename(), $data['plugins'] ) ) {
87
- deactivate_plugins( $plugin::getBasename(), true, is_network_admin() );
88
- }
89
- }
90
- }
91
- foreach ( array_merge( array( 'bookly-responsive-appointment-booking-tool', 'bookly-addon-pro' ), array_keys( $bookly_plugins ) ) as $slug ) {
92
- if ( ! array_key_exists( $slug, $bookly_plugins ) ) {
93
- continue;
94
- }
95
- /** @var Lib\Base\Plugin $plugin */
96
- $plugin = $bookly_plugins[ $slug ];
97
- unset( $bookly_plugins[ $slug ] );
98
- $installer_class = $plugin::getRootNamespace() . '\Lib\Installer';
99
- /** @var Lib\Base\Installer $installer */
100
- $installer = new $installer_class();
101
-
102
- // Drop all data and options.
103
- $installer->removeData();
104
- $installer->dropTables();
105
- $installer->createTables();
106
-
107
- // Insert tables data.
108
- foreach ( $plugin::getEntityClasses() as $entity_class ) {
109
- if ( isset ( $data['entities'][ $entity_class ]['values'][0] ) ) {
110
- $table_name = $entity_class::getTableName();
111
- $query = sprintf(
112
- 'INSERT INTO `%s` (`%s`) VALUES (%%s)',
113
- $table_name,
114
- implode( '`,`', $data['entities'][ $entity_class ]['fields'] )
115
- );
116
- $placeholders = array();
117
- $values = array();
118
- $counter = 0;
119
- foreach ( $data['entities'][ $entity_class ]['values'] as $row ) {
120
- $params = array();
121
- foreach ( $row as $value ) {
122
- if ( $value === null ) {
123
- $params[] = 'NULL';
124
- } else {
125
- $params[] = '%s';
126
- $values[] = $value;
127
- }
128
- }
129
- $placeholders[] = implode( ',', $params );
130
- if ( ++ $counter > 50 ) {
131
- // Flush.
132
- $wpdb->query( $wpdb->prepare( sprintf( $query, implode( '),(', $placeholders ) ), $values ) );
133
- $placeholders = array();
134
- $values = array();
135
- $counter = 0;
136
- }
137
- }
138
- if ( ! empty ( $placeholders ) ) {
139
- $wpdb->query( $wpdb->prepare( sprintf( $query, implode( '),(', $placeholders ) ), $values ) );
140
- }
141
- }
142
- }
143
-
144
- // Insert options data.
145
- foreach ( $installer->getOptions() as $option_name => $option_value ) {
146
- add_option( $option_name, $data['options'][ $option_name ] );
147
- }
148
-
149
- $plugin_prefix = $plugin::getPrefix();
150
- $options_postfix = array( 'data_loaded', 'grace_start', 'db_version' );
151
- foreach ( $options_postfix as $option ) {
152
- $option_name = $plugin_prefix . $option;
153
- add_option( $option_name, $data['options'][ $option_name ] );
154
- }
155
- }
156
-
157
- header( 'Location: ' . admin_url( 'admin.php?page=bookly-debug&status=imported' ) );
158
- }
159
- }
160
-
161
- header( 'Location: ' . admin_url( 'admin.php?page=bookly-debug' ) );
162
-
163
- exit ( 0 );
164
- }
165
-
166
- /**
167
- * manual
168
- */
169
- public static function getFieldData()
170
- {
171
- /** @global \wpdb $wpdb*/
172
- global $wpdb;
173
-
174
- $table = self::parameter( 'table' );
175
- $column = self::parameter( 'column' );
176
-
177
- /* SELECT CONCAT ( '\'', CONCAT_WS( '.', SUBSTR(TABLE_NAME,4), COLUMN_NAME ), '\' => "' , COLUMN_TYPE, ' ', IF(IS_NULLABLE = 'YES','null', 'not null') ,
178
- IF ( EXTRA = 'auto_increment', ' auto_increment primary key',
179
- CONCAT ( IF (COLUMN_DEFAULT is NULL, IF(IS_NULLABLE = 'NO', '', ' default null' ), CONCAT(' default \'',COLUMN_DEFAULT, '\'')))) , '",') AS data
180
- FROM INFORMATION_SCHEMA.COLUMNS
181
- WHERE TABLE_SCHEMA = SCHEMA()
182
- AND TABLE_NAME LIKE 'wp_bookly_%'
183
- ORDER BY TABLE_NAME, ORDINAL_POSITION
184
- */
185
-
186
- $fields = array(
187
- 'bookly_appointments.id' => 'int unsigned not null auto_increment primary key',
188
- 'bookly_appointments.location_id' => 'int unsigned null default null',
189
- 'bookly_appointments.staff_id' => 'int unsigned not null',
190
- 'bookly_appointments.staff_any' => "tinyint(1) not null default '0'",
191
- 'bookly_appointments.service_id' => 'int unsigned null default null',
192
- 'bookly_appointments.custom_service_name' => 'varchar(255) null default null',
193
- 'bookly_appointments.custom_service_price' => 'decimal(10,2) null default null',
194
- 'bookly_appointments.start_date' => 'datetime null default null',
195
- 'bookly_appointments.end_date' => 'datetime null default null',
196
- 'bookly_appointments.extras_duration' => "int not null default '0'",
197
- 'bookly_appointments.internal_note' => 'text null default null',
198
- 'bookly_appointments.google_event_id' => 'varchar(255) null default null',
199
- 'bookly_appointments.google_event_etag' => 'varchar(255) null default null',
200
- 'bookly_appointments.outlook_event_id' => 'varchar(255) null default null',
201
- 'bookly_appointments.outlook_event_change_key' => 'varchar(255) null default null',
202
- 'bookly_appointments.outlook_event_series_id' => 'varchar(255) null default null',
203
- 'bookly_appointments.online_meeting_provider' => "enum('zoom','google_meet','jitsi','bbb') null default null",
204
- 'bookly_appointments.online_meeting_id' => 'varchar(255) null default null',
205
- 'bookly_appointments.online_meeting_data' => 'text null default null',
206
- 'bookly_appointments.created_from' => "enum('bookly','google','outlook') not null default 'bookly'",
207
- 'bookly_appointments.created_at' => 'datetime not null',
208
- 'bookly_appointments.updated_at' => 'datetime not null',
209
- 'bookly_categories.id' => 'int unsigned not null auto_increment primary key',
210
- 'bookly_categories.name' => 'varchar(255) not null',
211
- 'bookly_categories.position' => "int not null default '9999'",
212
- 'bookly_coupon_customers.id' => 'int unsigned not null auto_increment primary key',
213
- 'bookly_coupon_customers.coupon_id' => 'int unsigned not null',
214
- 'bookly_coupon_customers.customer_id' => 'int unsigned not null',
215
- 'bookly_coupon_services.id' => 'int unsigned not null auto_increment primary key',
216
- 'bookly_coupon_services.coupon_id' => 'int unsigned not null',
217
- 'bookly_coupon_services.service_id' => 'int unsigned not null',
218
- 'bookly_coupon_staff.id' => 'int unsigned not null auto_increment primary key',
219
- 'bookly_coupon_staff.coupon_id' => 'int unsigned not null',
220
- 'bookly_coupon_staff.staff_id' => 'int unsigned not null',
221
- 'bookly_coupons.id' => 'int unsigned not null auto_increment primary key',
222
- 'bookly_coupons.code' => "varchar(255) not null default ''",
223
- 'bookly_coupons.discount' => "decimal(5,2) not null default '0.00'",
224
- 'bookly_coupons.deduction' => "decimal(10,2) not null default '0.00'",
225
- 'bookly_coupons.usage_limit' => "int unsigned not null default '1'",
226
- 'bookly_coupons.used' => "int unsigned not null default '0'",
227
- 'bookly_coupons.once_per_customer' => "tinyint(1) not null default '0'",
228
- 'bookly_coupons.date_limit_start' => 'date null default null',
229
- 'bookly_coupons.date_limit_end' => 'date null default null',
230
- 'bookly_coupons.min_appointments' => "int unsigned not null default '1'",
231
- 'bookly_coupons.max_appointments' => 'int unsigned null default null',
232
- 'bookly_custom_statuses.id' => 'int unsigned not null auto_increment primary key',
233
- 'bookly_custom_statuses.slug' => 'varchar(255) not null',
234
- 'bookly_custom_statuses.name' => 'varchar(255) null default null',
235
- 'bookly_custom_statuses.busy' => "tinyint(1) not null default '1'",
236
- 'bookly_custom_statuses.color' => "varchar(255) not null default '#dddddd'",
237
- 'bookly_custom_statuses.position' => "int not null default '9999'",
238
- 'bookly_customer_appointment_files.id' => 'int unsigned not null auto_increment primary key',
239
- 'bookly_customer_appointment_files.customer_appointment_id' => 'int unsigned not null',
240
- 'bookly_customer_appointment_files.file_id' => 'int unsigned not null',
241
- 'bookly_customer_appointments.id' => 'int unsigned not null auto_increment primary key',
242
- 'bookly_customer_appointments.series_id' => 'int unsigned null default null',
243
- 'bookly_customer_appointments.package_id' => 'int unsigned null default null',
244
- 'bookly_customer_appointments.customer_id' => 'int unsigned not null',
245
- 'bookly_customer_appointments.appointment_id' => 'int unsigned not null',
246
- 'bookly_customer_appointments.payment_id' => 'int unsigned null default null',
247
- 'bookly_customer_appointments.order_id' => 'int unsigned null default null',
248
- 'bookly_customer_appointments.number_of_persons' => "int unsigned not null default '1'",
249
- 'bookly_customer_appointments.units' => "int unsigned not null default '1'",
250
- 'bookly_customer_appointments.notes' => 'text null default null',
251
- 'bookly_customer_appointments.extras' => 'text null default null',
252
- 'bookly_customer_appointments.extras_multiply_nop' => "tinyint(1) not null default '1'",
253
- 'bookly_customer_appointments.custom_fields' => 'text null default null',
254
- 'bookly_customer_appointments.status' => "varchar(255) not null default 'approved'",
255
- 'bookly_customer_appointments.status_changed_at' => 'datetime null default null',
256
- 'bookly_customer_appointments.token' => 'varchar(255) null default null',
257
- 'bookly_customer_appointments.time_zone' => 'varchar(255) null default null',
258
- 'bookly_customer_appointments.time_zone_offset' => 'int null default null',
259
- 'bookly_customer_appointments.rating' => 'int null default null',
260
- 'bookly_customer_appointments.rating_comment' => 'text null default null',
261
- 'bookly_customer_appointments.locale' => 'varchar(8) null default null',
262
- 'bookly_customer_appointments.collaborative_service_id' => 'int unsigned null default null',
263
- 'bookly_customer_appointments.collaborative_token' => 'varchar(255) null default null',
264
- 'bookly_customer_appointments.compound_service_id' => 'int unsigned null default null',
265
- 'bookly_customer_appointments.compound_token' => 'varchar(255) null default null',
266
- 'bookly_customer_appointments.created_from' => "enum('frontend','backend') not null default 'frontend'",
267
- 'bookly_customer_appointments.created_at' => 'datetime not null',
268
- 'bookly_customer_appointments.updated_at' => 'datetime not null',
269
- 'bookly_customer_groups.id' => 'int unsigned not null auto_increment primary key',
270
- 'bookly_customer_groups.name' => 'varchar(255) not null',
271
- 'bookly_customer_groups.description' => 'text not null',
272
- 'bookly_customer_groups.appointment_status' => "varchar(255) not null default ''",
273
- 'bookly_customer_groups.discount' => "varchar(100) not null default '0'",
274
- 'bookly_customer_groups.skip_payment' => "tinyint(1) not null default '0'",
275
- 'bookly_customer_groups.gateways' => 'varchar(255) null default null',
276
- 'bookly_customer_groups_services.id' => 'int unsigned not null auto_increment primary key',
277
- 'bookly_customer_groups_services.group_id' => 'int unsigned not null',
278
- 'bookly_customer_groups_services.service_id' => 'int unsigned not null',
279
- 'bookly_customers.id' => 'int unsigned not null auto_increment primary key',
280
- 'bookly_customers.wp_user_id' => 'bigint unsigned null default null',
281
- 'bookly_customers.facebook_id' => 'bigint unsigned null default null',
282
- 'bookly_customers.group_id' => 'int unsigned null default null',
283
- 'bookly_customers.full_name' => "varchar(255) not null default ''",
284
- 'bookly_customers.first_name' => "varchar(255) not null default ''",
285
- 'bookly_customers.last_name' => "varchar(255) not null default ''",
286
- 'bookly_customers.phone' => "varchar(255) not null default ''",
287
- 'bookly_customers.email' => "varchar(255) not null default ''",
288
- 'bookly_customers.birthday' => 'date null default null',
289
- 'bookly_customers.country' => 'varchar(255) null default null',
290
- 'bookly_customers.state' => 'varchar(255) null default null',
291
- 'bookly_customers.postcode' => 'varchar(255) null default null',
292
- 'bookly_customers.city' => 'varchar(255) null default null',
293
- 'bookly_customers.street' => 'varchar(255) null default null',
294
- 'bookly_customers.street_number' => 'varchar(255) null default null',
295
- 'bookly_customers.additional_address' => 'varchar(255) null default null',
296
- 'bookly_customers.notes' => 'text not null',
297
- 'bookly_customers.info_fields' => 'text null default null',
298
- 'bookly_customers.stripe_account' => 'varchar(255) null default null',
299
- 'bookly_customers.created_at' => 'datetime not null',
300
- 'bookly_discounts.id' => 'int unsigned not null auto_increment primary key',
301
- 'bookly_discounts.title' => "varchar(255) null default ''",
302
- 'bookly_discounts.type' => "enum('nop','appointments') not null default 'nop'",
303
- 'bookly_discounts.threshold' => 'int unsigned null default null',
304
- 'bookly_discounts.discount' => "decimal(5,2) not null default '0.00'",
305
- 'bookly_discounts.deduction' => "decimal(10,2) not null default '0.00'",
306
- 'bookly_discounts.date_start' => 'date null default null',
307
- 'bookly_discounts.date_end' => 'date null default null',
308
- 'bookly_discounts.enabled' => "tinyint(1) not null default '0'",
309
- 'bookly_email_log.id' => 'int unsigned not null auto_increment primary key',
310
- 'bookly_email_log.to' => 'varchar(255) not null',
311
- 'bookly_email_log.subject' => 'varchar(255) not null',
312
- 'bookly_email_log.body' => 'text not null',
313
- 'bookly_email_log.headers' => 'text not null',
314
- 'bookly_email_log.attach' => 'text not null',
315
- 'bookly_email_log.type' => "varchar(255) not null default ''",
316
- 'bookly_email_log.created_at' => 'datetime not null',
317
- 'bookly_files.id' => 'int unsigned not null auto_increment primary key',
318
- 'bookly_files.name' => 'text not null',
319
- 'bookly_files.slug' => 'varchar(32) not null',
320
- 'bookly_files.path' => 'text not null',
321
- 'bookly_files.custom_field_id' => 'int null default null',
322
- 'bookly_holidays.id' => 'int unsigned not null auto_increment primary key',
323
- 'bookly_holidays.staff_id' => 'int unsigned null default null',
324
- 'bookly_holidays.parent_id' => 'int unsigned null default null',
325
- 'bookly_holidays.date' => 'date not null',
326
- 'bookly_holidays.repeat_event' => "tinyint(1) not null default '0'",
327
- 'bookly_locations.id' => 'int unsigned not null auto_increment primary key',
328
- 'bookly_locations.name' => "varchar(255) null default ''",
329
- 'bookly_locations.info' => 'text null default null',
330
- 'bookly_locations.position' => "int not null default '9999'",
331
- 'bookly_log.id' => 'int unsigned not null auto_increment primary key',
332
- 'bookly_log.action' => "enum('create','update','delete') null default null",
333
- 'bookly_log.target' => 'varchar(255) null default null',
334
- 'bookly_log.target_id' => 'int unsigned null default null',
335
- 'bookly_log.author' => 'varchar(255) null default null',
336
- 'bookly_log.details' => 'text null default null',
337
- 'bookly_log.ref' => 'varchar(255) null default null',
338
- 'bookly_log.comment' => 'varchar(255) null default null',
339
- 'bookly_log.created_at' => 'datetime not null',
340
- 'bookly_mailing_campaigns.id' => 'int unsigned not null auto_increment primary key',
341
- 'bookly_mailing_campaigns.mailing_list_id' => 'int unsigned null default null',
342
- 'bookly_mailing_campaigns.name' => 'varchar(255) null default null',
343
- 'bookly_mailing_campaigns.text' => 'text null default null',
344
- 'bookly_mailing_campaigns.state' => "enum('pending','in-progress','completed','canceled') not null default 'pending'",
345
- 'bookly_mailing_campaigns.send_at' => 'datetime not null',
346
- 'bookly_mailing_campaigns.created_at' => 'datetime not null',
347
- 'bookly_mailing_list_recipients.id' => 'int unsigned not null auto_increment primary key',
348
- 'bookly_mailing_list_recipients.mailing_list_id' => 'int unsigned not null',
349
- 'bookly_mailing_list_recipients.name' => 'varchar(255) null default null',
350
- 'bookly_mailing_list_recipients.phone' => 'varchar(255) null default null',
351
- 'bookly_mailing_list_recipients.created_at' => 'datetime not null',
352
- 'bookly_mailing_lists.id' => 'int unsigned not null auto_increment primary key',
353
- 'bookly_mailing_lists.name' => 'varchar(255) null default null',
354
- 'bookly_mailing_queue.id' => 'int unsigned not null auto_increment primary key',
355
- 'bookly_mailing_queue.phone' => 'varchar(255) not null',
356
- 'bookly_mailing_queue.text' => 'text null default null',
357
- 'bookly_mailing_queue.sent' => "tinyint(1) null default '0'",
358
- 'bookly_mailing_queue.campaign_id' => "int not null default '0'",
359
- 'bookly_mailing_queue.created_at' => 'datetime not null',
360
- 'bookly_news.id' => 'int unsigned not null auto_increment primary key',
361
- 'bookly_news.news_id' => 'int unsigned not null',
362
- 'bookly_news.title' => 'text null default null',
363
- 'bookly_news.media_type' => "enum('image','youtube') not null default 'image'",
364
- 'bookly_news.media_url' => 'varchar(255) not null',
365
- 'bookly_news.text' => 'text null default null',
366
- 'bookly_news.button_url' => 'varchar(255) null default null',
367
- 'bookly_news.button_text' => 'varchar(255) null default null',
368
- 'bookly_news.seen' => "tinyint(1) not null default '0'",
369
- 'bookly_news.updated_at' => 'datetime not null',
370
- 'bookly_news.created_at' => 'datetime not null',
371
- 'bookly_notifications.id' => 'int unsigned not null auto_increment primary key',
372
- 'bookly_notifications.gateway' => "enum('email','sms') not null default 'email'",
373
- 'bookly_notifications.type' => "varchar(255) not null default ''",
374
- 'bookly_notifications.active' => "tinyint(1) not null default '0'",
375
- 'bookly_notifications.name' => "varchar(255) not null default ''",
376
- 'bookly_notifications.subject' => "varchar(255) not null default ''",
377
- 'bookly_notifications.message' => 'text null default null',
378
- 'bookly_notifications.to_staff' => "tinyint(1) not null default '0'",
379
- 'bookly_notifications.to_customer' => "tinyint(1) not null default '0'",
380
- 'bookly_notifications.to_admin' => "tinyint(1) not null default '0'",
381
- 'bookly_notifications.to_custom' => "tinyint(1) not null default '0'",
382
- 'bookly_notifications.custom_recipients' => 'varchar(255) null default null',
383
- 'bookly_notifications.attach_ics' => "tinyint(1) not null default '0'",
384
- 'bookly_notifications.attach_invoice' => "tinyint(1) not null default '0'",
385
- 'bookly_notifications.settings' => 'text null default null',
386
- 'bookly_orders.id' => 'int unsigned not null auto_increment primary key',
387
- 'bookly_orders.token' => 'varchar(255) null default null',
388
- 'bookly_packages.id' => 'int unsigned not null auto_increment primary key',
389
- 'bookly_packages.location_id' => 'int unsigned null default null',
390
- 'bookly_packages.staff_id' => 'int unsigned null default null',
391
- 'bookly_packages.service_id' => 'int unsigned not null',
392
- 'bookly_packages.customer_id' => 'int unsigned not null',
393
- 'bookly_packages.internal_note' => 'text null default null',
394
- 'bookly_packages.payment_id' => 'int unsigned null default null',
395
- 'bookly_packages.created_at' => 'datetime not null',
396
- 'bookly_payments.id' => 'int unsigned not null auto_increment primary key',
397
- 'bookly_payments.target' => "enum('appointments','packages') not null default 'appointments'",
398
- 'bookly_payments.coupon_id' => 'int unsigned null default null',
399
- 'bookly_payments.type' => "enum('local','free','paypal','authorize_net','stripe','2checkout','payu_biz','payu_latam','payson','mollie','woocommerce','cloud_stripe') not null default 'local'",
400
- 'bookly_payments.total' => "decimal(10,2) not null default '0.00'",
401
- 'bookly_payments.tax' => "decimal(10,2) not null default '0.00'",
402
- 'bookly_payments.paid' => "decimal(10,2) not null default '0.00'",
403
- 'bookly_payments.paid_type' => "enum('in_full','deposit') not null default 'in_full'",
404
- 'bookly_payments.gateway_price_correction' => "decimal(10,2) null default '0.00'",
405
- 'bookly_payments.status' => "enum('pending','completed','rejected','refunded') not null default 'completed'",
406
- 'bookly_payments.token' => 'varchar(255) null default null',
407
- 'bookly_payments.details' => 'text null default null',
408
- 'bookly_payments.ref_id' => 'varchar(255) null default null',
409
- 'bookly_payments.created_at' => 'datetime not null',
410
- 'bookly_payments.updated_at' => 'datetime not null',
411
- 'bookly_schedule_item_breaks.id' => 'int unsigned not null auto_increment primary key',
412
- 'bookly_schedule_item_breaks.staff_schedule_item_id' => 'int unsigned not null',
413
- 'bookly_schedule_item_breaks.start_time' => 'time null default null',
414
- 'bookly_schedule_item_breaks.end_time' => 'time null default null',
415
- 'bookly_sent_notifications.id' => 'int unsigned not null auto_increment primary key',
416
- 'bookly_sent_notifications.ref_id' => 'int unsigned not null',
417
- 'bookly_sent_notifications.notification_id' => 'int unsigned not null',
418
- 'bookly_sent_notifications.created_at' => 'datetime not null',
419
- 'bookly_series.id' => 'int unsigned not null auto_increment primary key',
420
- 'bookly_series.repeat' => 'varchar(255) null default null',
421
- 'bookly_series.token' => 'varchar(255) not null',
422
- 'bookly_service_discounts.id' => 'int unsigned not null auto_increment primary key',
423
- 'bookly_service_discounts.service_id' => 'int unsigned not null',
424
- 'bookly_service_discounts.discount_id' => 'int unsigned not null',
425
- 'bookly_service_extras.id' => 'int unsigned not null auto_increment primary key',
426
- 'bookly_service_extras.service_id' => 'int unsigned not null',
427
- 'bookly_service_extras.attachment_id' => 'int unsigned null default null',
428
- 'bookly_service_extras.title' => "varchar(255) null default ''",
429
- 'bookly_service_extras.duration' => "int not null default '0'",
430
- 'bookly_service_extras.price' => "decimal(10,2) not null default '0.00'",
431
- 'bookly_service_extras.min_quantity' => "int not null default '0'",
432
- 'bookly_service_extras.max_quantity' => "int not null default '1'",
433
- 'bookly_service_extras.position' => "int not null default '9999'",
434
- 'bookly_service_schedule_breaks.id' => 'int unsigned not null auto_increment primary key',
435
- 'bookly_service_schedule_breaks.service_schedule_day_id' => 'int unsigned not null',
436
- 'bookly_service_schedule_breaks.start_time' => 'time null default null',
437
- 'bookly_service_schedule_breaks.end_time' => 'time null default null',
438
- 'bookly_service_schedule_days.id' => 'int unsigned not null auto_increment primary key',
439
- 'bookly_service_schedule_days.service_id' => 'int unsigned not null',
440
- 'bookly_service_schedule_days.day_index' => 'smallint null default null',
441
- 'bookly_service_schedule_days.start_time' => 'time null default null',
442
- 'bookly_service_schedule_days.end_time' => 'time null default null',
443
- 'bookly_service_special_days.id' => 'int unsigned not null auto_increment primary key',
444
- 'bookly_service_special_days.service_id' => 'int unsigned not null',
445
- 'bookly_service_special_days.date' => 'date null default null',
446
- 'bookly_service_special_days.start_time' => 'time null default null',
447
- 'bookly_service_special_days.end_time' => 'time null default null',
448
- 'bookly_service_special_days_breaks.id' => 'int unsigned not null auto_increment primary key',
449
- 'bookly_service_special_days_breaks.service_special_day_id' => 'int unsigned not null',
450
- 'bookly_service_special_days_breaks.start_time' => 'time null default null',
451
- 'bookly_service_special_days_breaks.end_time' => 'time null default null',
452
- 'bookly_service_taxes.id' => 'int unsigned not null auto_increment primary key',
453
- 'bookly_service_taxes.service_id' => 'int unsigned not null',
454
- 'bookly_service_taxes.tax_id' => 'int unsigned not null',
455
- 'bookly_services.id' => 'int unsigned not null auto_increment primary key',
456
- 'bookly_services.category_id' => 'int unsigned null default null',
457
- 'bookly_services.type' => "enum('simple','collaborative','compound','package') not null default 'simple'",
458
- 'bookly_services.title' => "varchar(255) null default ''",
459
- 'bookly_services.attachment_id' => 'int unsigned null default null',
460
- 'bookly_services.duration' => "int not null default '900'",
461
- 'bookly_services.slot_length' => "varchar(255) not null default 'default'",
462
- 'bookly_services.price' => "decimal(10,2) not null default '0.00'",
463
- 'bookly_services.color' => "varchar(255) not null default '#FFFFFF'",
464
- 'bookly_services.deposit' => "varchar(100) not null default '100%'",
465
- 'bookly_services.capacity_min' => "int not null default '1'",
466
- 'bookly_services.capacity_max' => "int not null default '1'",
467
- 'bookly_services.one_booking_per_slot' => "tinyint(1) not null default '0'",
468
- 'bookly_services.padding_left' => "int not null default '0'",
469
- 'bookly_services.padding_right' => "int not null default '0'",
470
- 'bookly_services.info' => 'text null default null',
471
- 'bookly_services.start_time_info' => "varchar(255) null default ''",
472
- 'bookly_services.end_time_info' => "varchar(255) null default ''",
473
- 'bookly_services.same_staff_for_subservices' => "tinyint(1) not null default '0'",
474
- 'bookly_services.units_min' => "int unsigned not null default '1'",
475
- 'bookly_services.units_max' => "int unsigned not null default '1'",
476
- 'bookly_services.package_life_time' => 'int null default null',
477
- 'bookly_services.package_size' => 'int null default null',
478
- 'bookly_services.package_unassigned' => "tinyint(1) not null default '0'",
479
- 'bookly_services.appointments_limit' => 'int null default null',
480
- 'bookly_services.limit_period' => "enum('off','day','week','month','year','upcoming','calendar_day','calendar_week','calendar_month','calendar_year') not null default 'off'",
481
- 'bookly_services.staff_preference' => "enum('order','least_occupied','most_occupied','least_occupied_for_period','most_occupied_for_period','least_expensive','most_expensive') not null default 'most_expensive'",
482
- 'bookly_services.staff_preference_settings' => 'text null default null',
483
- 'bookly_services.recurrence_enabled' => "tinyint(1) not null default '1'",
484
- 'bookly_services.recurrence_frequencies' => "set('daily','weekly','biweekly','monthly') not null default 'daily,weekly,biweekly,monthly'",
485
- 'bookly_services.time_requirements' => "enum('required','optional','off') not null default 'required'",
486
- 'bookly_services.collaborative_equal_duration' => "tinyint(1) not null default '0'",
487
- 'bookly_services.online_meetings' => "enum('off','zoom','google_meet','jitsi','bbb') not null default 'off'",
488
- 'bookly_services.final_step_url' => "varchar(512) not null default ''",
489
- 'bookly_services.wc_product_id' => "int unsigned not null default '0'",
490
- 'bookly_services.wc_cart_info_name' => 'varchar(255) null default null',
491
- 'bookly_services.wc_cart_info' => 'text null default null',
492
- 'bookly_services.min_time_prior_booking' => 'int null default null',
493
- 'bookly_services.min_time_prior_cancel' => 'int null default null',
494
- 'bookly_services.visibility' => "enum('public','private','group') not null default 'public'",
495
- 'bookly_services.position' => "int not null default '9999'",
496
- 'bookly_shop.id' => 'int unsigned not null auto_increment primary key',
497
- 'bookly_shop.plugin_id' => 'int unsigned not null',
498
- 'bookly_shop.type' => "enum('plugin','bundle') not null default 'plugin'",
499
- 'bookly_shop.highlighted' => "tinyint(1) not null default '0'",
500
- 'bookly_shop.priority' => "int unsigned null default '0'",
501
- 'bookly_shop.demo_url' => 'varchar(255) null default null',
502
- 'bookly_shop.title' => 'varchar(255) not null',
503
- 'bookly_shop.slug' => 'varchar(255) not null',
504
- 'bookly_shop.description' => 'text not null',
505
- 'bookly_shop.url' => 'varchar(255) not null',
506
- 'bookly_shop.icon' => 'varchar(255) not null',
507
- 'bookly_shop.price' => 'decimal(10,2) not null',
508
- 'bookly_shop.sales' => 'int unsigned not null',
509
- 'bookly_shop.rating' => 'decimal(10,2) not null',
510
- 'bookly_shop.reviews' => 'int unsigned not null',
511
- 'bookly_shop.published' => 'datetime not null',
512
- 'bookly_shop.seen' => "tinyint(1) not null default '0'",
513
- 'bookly_shop.created_at' => 'datetime not null',
514
- 'bookly_special_days_breaks.id' => 'int unsigned not null auto_increment primary key',
515
- 'bookly_special_days_breaks.staff_special_day_id' => 'int unsigned not null',
516
- 'bookly_special_days_breaks.start_time' => 'time null default null',
517
- 'bookly_special_days_breaks.end_time' => 'time null default null',
518
- 'bookly_staff.id' => 'int unsigned not null auto_increment primary key',
519
- 'bookly_staff.category_id' => 'int unsigned null default null',
520
- 'bookly_staff.wp_user_id' => 'bigint unsigned null default null',
521
- 'bookly_staff.attachment_id' => 'int unsigned null default null',
522
- 'bookly_staff.full_name' => 'varchar(255) null default null',
523
- 'bookly_staff.email' => 'varchar(255) null default null',
524
- 'bookly_staff.phone' => 'varchar(255) null default null',
525
- 'bookly_staff.time_zone' => 'varchar(255) null default null',
526
- 'bookly_staff.info' => 'text null default null',
527
- 'bookly_staff.working_time_limit' => 'int unsigned null default null',
528
- 'bookly_staff.visibility' => "enum('public','private','archive') not null default 'public'",
529
- 'bookly_staff.position' => "int not null default '9999'",
530
- 'bookly_staff.google_data' => 'text null default null',
531
- 'bookly_staff.outlook_data' => 'text null default null',
532
- 'bookly_staff.zoom_authentication' => "enum('default','jwt','oauth') not null default 'default'",
533
- 'bookly_staff.zoom_jwt_api_key' => 'varchar(255) null default null',
534
- 'bookly_staff.zoom_jwt_api_secret' => 'varchar(255) null default null',
535
- 'bookly_staff.zoom_oauth_token' => 'text null default null',
536
- 'bookly_staff.icalendar' => "tinyint(1) not null default '0'",
537
- 'bookly_staff.icalendar_token' => 'varchar(255) null default null',
538
- 'bookly_staff.icalendar_days_before' => "int not null default '365'",
539
- 'bookly_staff.icalendar_days_after' => "int not null default '365'",
540
- 'bookly_staff.color' => "varchar(255) not null default '#dddddd'",
541
- 'bookly_staff.gateways' => 'varchar(255) null default null',
542
- 'bookly_staff_categories.id' => 'int unsigned not null auto_increment primary key',
543
- 'bookly_staff_categories.name' => 'varchar(255) not null',
544
- 'bookly_staff_categories.position' => "int not null default '9999'",
545
- 'bookly_staff_locations.id' => 'int unsigned not null auto_increment primary key',
546
- 'bookly_staff_locations.staff_id' => 'int unsigned not null',
547
- 'bookly_staff_locations.location_id' => 'int unsigned not null',
548
- 'bookly_staff_locations.custom_services' => "tinyint(1) not null default '0'",
549
- 'bookly_staff_locations.custom_schedule' => "tinyint(1) not null default '0'",
550
- 'bookly_staff_locations.custom_special_days' => "tinyint(1) not null default '0'",
551
- 'bookly_staff_preference_orders.id' => 'int unsigned not null auto_increment primary key',
552
- 'bookly_staff_preference_orders.service_id' => 'int unsigned not null',
553
- 'bookly_staff_preference_orders.staff_id' => 'int unsigned not null',
554
- 'bookly_staff_preference_orders.position' => "int not null default '9999'",
555
- 'bookly_staff_schedule_items.id' => 'int unsigned not null auto_increment primary key',
556
- 'bookly_staff_schedule_items.staff_id' => 'int unsigned not null',
557
- 'bookly_staff_schedule_items.location_id' => 'int unsigned null default null',
558
- 'bookly_staff_schedule_items.day_index' => 'int unsigned not null',
559
- 'bookly_staff_schedule_items.start_time' => 'time null default null',
560
- 'bookly_staff_schedule_items.end_time' => 'time null default null',
561
- 'bookly_staff_services.id' => 'int unsigned not null auto_increment primary key',
562
- 'bookly_staff_services.staff_id' => 'int unsigned not null',
563
- 'bookly_staff_services.service_id' => 'int unsigned not null',
564
- 'bookly_staff_services.location_id' => 'int unsigned null default null',
565
- 'bookly_staff_services.price' => "decimal(10,2) not null default '0.00'",
566
- 'bookly_staff_services.deposit' => "varchar(100) not null default '100%'",
567
- 'bookly_staff_services.capacity_min' => "int not null default '1'",
568
- 'bookly_staff_services.capacity_max' => "int not null default '1'",
569
- 'bookly_staff_special_days.id' => 'int unsigned not null auto_increment primary key',
570
- 'bookly_staff_special_days.staff_id' => 'int unsigned not null',
571
- 'bookly_staff_special_days.location_id' => 'int unsigned null default null',
572
- 'bookly_staff_special_days.date' => 'date null default null',
573
- 'bookly_staff_special_days.start_time' => 'time null default null',
574
- 'bookly_staff_special_days.end_time' => 'time null default null',
575
- 'bookly_staff_special_hours.id' => 'int unsigned not null auto_increment primary key',
576
- 'bookly_staff_special_hours.staff_id' => 'int unsigned not null',
577
- 'bookly_staff_special_hours.service_id' => 'int unsigned not null',
578
- 'bookly_staff_special_hours.location_id' => 'int unsigned null default null',
579
- 'bookly_staff_special_hours.start_time' => 'time null default null',
580
- 'bookly_staff_special_hours.end_time' => 'time null default null',
581
- 'bookly_staff_special_hours.days' => "varchar(255) not null default '1,2,3,4,5,6,7'",
582
- 'bookly_staff_special_hours.price' => "decimal(10,2) not null default '0.00'",
583
- 'bookly_stats.id' => 'int unsigned not null auto_increment primary key',
584
- 'bookly_stats.name' => 'varchar(255) not null',
585
- 'bookly_stats.value' => 'text null default null',
586
- 'bookly_stats.created_at' => 'datetime not null',
587
- 'bookly_sub_services.id' => 'int unsigned not null auto_increment primary key',
588
- 'bookly_sub_services.type' => "enum('service','spare_time') not null default 'service'",
589
- 'bookly_sub_services.service_id' => 'int unsigned not null',
590
- 'bookly_sub_services.sub_service_id' => 'int unsigned null default null',
591
- 'bookly_sub_services.duration' => 'int null default null',
592
- 'bookly_sub_services.position' => "int not null default '9999'",
593
- 'bookly_taxes.id' => 'int unsigned not null auto_increment primary key',
594
- 'bookly_taxes.title' => "varchar(255) null default ''",
595
- 'bookly_taxes.rate' => "decimal(10,3) not null default '0.000'",
596
- );
597
-
598
- $prefix_len = strlen( $wpdb->prefix );
599
- $key = substr( $table, $prefix_len ) . '.' . $column;
600
- if ( isset( $fields[ $key ] ) ) {
601
- wp_send_json_success( $fields[ $key ] );
602
- } else {
603
- wp_send_json_error();
604
- }
605
- }
606
-
607
- /**
608
- * Execute query
609
- */
610
- public static function executeQuery()
611
- {
612
- $success = self::execute( self::parameter( 'query' ) );
613
-
614
- if ( $success === true ) {
615
- wp_send_json_success( array( 'message' => 'Query completed successfully' ) );
616
- } else {
617
- wp_send_json_error( array( 'message' => $success ) );
618
- }
619
- }
620
-
621
- /**
622
- * Execute query
623
- */
624
- public static function dropColumn()
625
- {
626
- global $wpdb;
627
-
628
- /** @var Lib\Base\Entity $entity */
629
- $entity = self::parameter( 'entity' );
630
- $column = self::parameter( 'column' );
631
- $table = $entity::getTableName();
632
-
633
- $get_foreign_keys = sprintf(
634
- 'SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
635
- WHERE TABLE_SCHEMA = SCHEMA() AND TABLE_NAME = "%s" AND COLUMN_NAME = "%s" AND REFERENCED_TABLE_NAME IS NOT NULL',
636
- $table,
637
- $column
638
- );
639
- $constraints = $wpdb->get_results( $wpdb->prepare( $get_foreign_keys, $column ) );
640
- foreach ( $constraints as $foreign_key ) {
641
- $wpdb->query( "ALTER TABLE `$table` DROP FOREIGN KEY `$foreign_key->CONSTRAINT_NAME`" );
642
- }
643
-
644
- $query = 'ALTER TABLE `' . $table . '` DROP COLUMN `' . $column . '`';
645
-
646
- $success = self::execute( $query );
647
-
648
- if ( $success === true ) {
649
- wp_send_json_success( array( 'message' => 'Query completed successfully' ) );
650
- } else {
651
- wp_send_json_error( array( 'message' => $success ) );
652
- }
653
- }
654
-
655
- /**
656
- * manual
657
- */
658
- public static function getConstraintData()
659
- {
660
- $table = self::parameter( 'table' );
661
- $column = self::parameter( 'column' );
662
- $ref_table = self::parameter( 'ref_table' );
663
- $ref_column = self::parameter( 'ref_column' );
664
-
665
- wp_send_json_success ( QueryBuilder::getConstraintRules( $table, $column, $ref_table, $ref_column ) );
666
- }
667
-
668
- /**
669
- * manual
670
- */
671
- public static function addConstraint()
672
- {
673
- $table = self::parameter( 'table' );
674
- $column = self::parameter( 'column' );
675
- $ref_table = self::parameter( 'ref_table' );
676
- $ref_column = self::parameter( 'ref_column' );
677
-
678
- $sql = sprintf( 'ALTER TABLE `%s` ADD CONSTRAINT FOREIGN KEY (`%s`) REFERENCES `%s` (`%s`)', $table, $column, $ref_table, $ref_column );
679
- $delete_rule = self::parameter( 'delete_rule' );
680
- switch ( $delete_rule ) {
681
- case 'RESTRICT':
682
- case 'CASCADE':
683
- case 'SET NULL':
684
- case 'NO ACTIONS':
685
- $sql .= ' ON DELETE ' . $delete_rule;
686
- break;
687
- default:
688
- wp_send_json_error( array( 'message' => 'Select ON DELETE action' ) );
689
- }
690
- $update_rule = self::parameter( 'update_rule' );
691
- switch ( $update_rule ) {
692
- case 'RESTRICT':
693
- case 'CASCADE':
694
- case 'SET NULL':
695
- case 'NO ACTIONS':
696
- $sql .= ' ON UPDATE ' . $update_rule;
697
- break;
698
- default:
699
- wp_send_json_error( array( 'message' => 'Select ON UPDATE action' ) );
700
- }
701
-
702
- $success = self::execute( $sql );
703
-
704
- if ( $success === true ) {
705
- wp_send_json_success( array( 'message' => 'Constraint created' ) );
706
- } else {
707
- wp_send_json_error( array( 'message' => $success ) );
708
- }
709
- }
710
-
711
- /**
712
- * manual
713
- */
714
- public static function fixConsistency()
715
- {
716
- $rule = self::parameter( 'rule' );
717
- $table = self::parameter( 'table' );
718
- $column = self::parameter( 'column' );
719
- $ref_table = self::parameter( 'ref_table' );
720
- $ref_column = self::parameter( 'ref_column' );
721
-
722
- switch ( $rule ) {
723
- case 'CASCADE':
724
- $sql = sprintf( 'DELETE FROM `%s` WHERE `%s` NOT IN ( SELECT `%s` FROM `%s` )',
725
- $table, $column, $ref_column, $ref_table );
726
- break;
727
- case 'SET NULL':
728
- $sql = sprintf( 'UPDATE `%s` SET `%s` = NULL WHERE `%s` NOT IN ( SELECT `%s` FROM `%s` )',
729
- $table, $column, $column, $ref_column, $ref_table );
730
- break;
731
- default:
732
- wp_send_json_success( array( 'message' => 'No manipulation actions were performed' ) );
733
- }
734
-
735
- $success = self::execute( $sql );
736
-
737
- if ( $success === true ) {
738
- wp_send_json_success( array( 'message' => 'Successful, click Add constraint' ) );
739
- } else {
740
- wp_send_json_error( array( 'message' => $success ) );
741
- }
742
- }
743
-
744
- public static function fixCharsetCollate()
745
- {
746
- /** @var \wpdb $wpdb*/
747
- global $wpdb;
748
-
749
- $table = self::parameter( 'table' );
750
- $character_set = $wpdb->charset;
751
- $collate = $wpdb->collate;
752
- $fix = self::parameter( 'fix' );
753
- $schema = new Schema();
754
-
755
- if ( $fix && $schema->existsTable( $table ) ) {
756
- $query = 'ALTER TABLE `' . $table . '` ';
757
- if ( in_array( 'character_set', $fix ) ) {
758
- $query .= ' CONVERT TO CHARACTER SET ' . $character_set;
759
- }
760
- if ( in_array( 'collate', $fix ) ) {
761
- $query .= ' COLLATE ' . $collate;
762
- }
763
- $success = self::execute( $query );
764
- if ( ! $success === true ) {
765
- wp_send_json_error( array( 'message' => $success ) );
766
- }
767
- }
768
-
769
- wp_send_json_success( array( 'message' => 'Query completed successfully' ) );
770
- }
771
-
772
- public static function fixDataBaseSchema()
773
- {
774
- $errors = array();
775
- $queries = 0;
776
- $schema = new Schema();
777
- /** @var Lib\Base\Plugin $plugin */
778
- foreach ( apply_filters( 'bookly_plugins', array() ) as $plugin ) {
779
- foreach ( $plugin::getEntityClasses() as $entity_class ) {
780
- $table_name = $entity_class::getTableName();
781
- if ( ! $schema->existsTable( $table_name ) ) {
782
- $queries ++;
783
- $success = self::execute( QueryBuilder::getCreateTable( $table_name ) );
784
- if ( $success !== true ) {
785
- $errors[] = sprintf( 'Can`t create table <b>%s</b>, Error:%s', $table_name, $success );
786
- }
787
- }
788
- if ( $schema->existsTable( $table_name ) ) {
789
- $table_structure = $schema->getTableStructure( $table_name );
790
- $entity_schema = $entity_class::getSchema();
791
-
792
- // Comparing model schema with real DB schema
793
- foreach ( $entity_schema as $column => $data ) {
794
- if ( array_key_exists( $column, $table_structure ) ) {
795
- $expect = QueryBuilder::getColumnData( $table_name, $column );
796
- $actual = $table_structure[ $column ];
797
- unset( $expect['key'], $actual['key'], $actual['character_set'], $actual['collation'] );
798
- if ( $expect && array_diff_assoc( $actual, $expect ) ) {
799
- $sql = QueryBuilder::getChangeColumn( $table_name, $column );
800
- if ( $table_structure[ $column ]['key'] == 'PRI' ) {
801
- $sql = str_replace( ' primary key', '', $sql );
802
- }
803
- $queries ++;
804
- $success = self::execute( $sql );
805
- if ( $success !== true ) {
806
- $errors[] = sprintf( 'Can`t change column <b>%s.%s</b>, Error:%s', $table_name, $column, $success );
807
- }
808
- }
809
- } else {
810
- $queries ++;
811
- $success = self::execute( QueryBuilder::getAddColumn( $table_name, $column ) );
812
- if ( $success !== true ) {
813
- $errors[] = sprintf( 'Can`t add column <b>%s.%s</b>, Error:%s', $table_name, $column, $success );
814
- }
815
- }
816
- }
817
- }
818
- }
819
-
820
- foreach ( $plugin::getEntityClasses() as $entity_class ) {
821
- $table_name = $entity_class::getTableName();
822
- if ( $schema->existsTable( $table_name ) ) {
823
- $entity_constraints = $entity_class::getConstraints();
824
- $table_constraints = $schema->getTableConstraints( $table_name );
825
- // Comparing model constraints with real DB constraints
826
- foreach ( $entity_constraints as $constraint ) {
827
- $key = $constraint['column_name'] . $constraint['referenced_table_name'] . $constraint['referenced_column_name'];
828
- if ( ! array_key_exists( $key, $table_constraints ) ) {
829
- $query = QueryBuilder::getAddConstraint( $table_name, $constraint['column_name'], $constraint['referenced_table_name'], $constraint['referenced_column_name'] );
830
- if ( $query !== '' ) {
831
- $queries ++;
832
- $success = self::execute( $query );
833
- if ( $success !== true ) {
834
- $errors[] = sprintf( 'Can`t add constraint <b>%s.%s</b> REFERENCES `%s` (`%s`), Error:%s', $table_name, $constraint['column_name'], $constraint['referenced_table_name'], $constraint['referenced_column_name'], $success );
835
- }
836
- }
837
- }
838
- }
839
-
840
- foreach ( $table_constraints as $constraint ) {
841
- if ( $constraint['reference_exists'] === false ) {
842
- $queries ++;
843
- $success = self::execute( QueryBuilder::getDropForeignKey( $table_name, $constraint['constraint_name'] ) );
844
- if ( $success !== true ) {
845
- $errors[] = sprintf( 'Can`t drop foreign key <b>%s</b>, Error:%s', $constraint['constraint_name'], $success );
846
- }
847
- }
848
- }
849
- }
850
- }
851
- }
852
-
853
- $message = ( $queries - count( $errors ) ) . ' queries completed successfully, with errors ' . count( $errors );
854
- $errors
855
- ? wp_send_json_error( compact( 'errors', 'message' ) )
856
- : wp_send_json_success( compact( 'message' ) );
857
- }
858
-
859
- /**
860
- * @param string $sql
861
- * @return bool|string
862
- */
863
- protected static function execute( $sql )
864
- {
865
- global $wpdb;
866
-
867
- ob_start();
868
- $result = $wpdb->query( $sql );
869
- ob_end_clean();
870
-
871
- return $result !== false ? true : $wpdb->last_error;
872
- }
873
-
874
- public static function runTest()
875
- {
876
- $test_name = self::parameter( 'test_name' );
877
- $test_class = '\Bookly\Backend\Modules\Debug\Lib\Tests\\' . $test_name;
878
- /** @var \Bookly\Backend\Modules\Debug\Lib\Tests\Base $test */
879
- $test = new $test_class( self::parameter( 'test_data' ) );
880
- if ( $test->execute() ) {
881
- wp_send_json_success();
882
- } else {
883
- wp_send_json_error( array( 'test_name' => $test->getName(), 'error' => $test->error() ) );
884
- }
885
- }
886
-
887
- /**
888
- *
889
- */
890
- public static function runTool()
891
- {
892
- $data = self::parameter( 'tool' );
893
- $tool_class = '\Bookly\Backend\Modules\Debug\Lib\Tools\\' . $data['tool'];
894
- /** @var \Bookly\Backend\Modules\Debug\Lib\Tools\Base $tool */
895
- $tool = new $tool_class( $data );
896
- if ( $tool->execute() ) {
897
- wp_send_json_success( array( 'name' => $tool->getName(), 'alerts' => $tool->alerts(), 'result' => $tool->getResult() ) );
898
- } else {
899
- wp_send_json_error( array( 'name' => $tool->getName(), 'alerts' => $tool->alerts() ) );
900
- }
901
-
902
- }
903
-
904
- /**
905
- * Extend parent method to control access on staff member level.
906
- *
907
- * @param string $action
908
- * @return bool
909
- */
910
- protected static function hasAccess( $action )
911
- {
912
- switch ( $action ) {
913
- case 'runTest':
914
- if ( self::parameter( 'test_name' ) == 'Session' ) {
915
- return true;
916
- } else {
917
- return Lib\Utils\Common::isCurrentUserAdmin();
918
- }
919
- case 'runTool':
920
- $tool = self::parameter( 'tool' );
921
- if ( $tool['tool'] == 'Cloud' && $tool['action'] == 'get_data_from_bookly' ) {
922
- return true;
923
- }
924
- default:
925
- return parent::hasAccess( $action );
926
- }
927
- }
928
-
929
- /**
930
- * Override parent method to exclude actions from CSRF token verification.
931
- *
932
- * @param string $action
933
- * @return bool
934
- */
935
- protected static function csrfTokenValid( $action = null )
936
- {
937
- if ( $action == 'runTool' ) {
938
- $tool = self::parameter( 'tool' );
939
- if ( $tool['tool'] == 'Cloud' && $tool['action'] == 'get_data_from_bookly' ) {
940
- return true;
941
- }
942
- }
943
-
944
- $excluded_actions = array(
945
- 'runTest',
946
- );
947
-
948
- return in_array( $action, $excluded_actions ) || parent::csrfTokenValid( $action );
949
- }
950
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/modules/debug/Page.php DELETED
@@ -1,187 +0,0 @@
1
- <?php
2
- namespace Bookly\Backend\Modules\Debug;
3
-
4
- use Bookly\Lib;
5
- use Bookly\Backend\Modules\Debug\Lib\Schema;
6
- use Bookly\Backend\Modules\Debug\Lib\QueryBuilder;
7
-
8
- /**
9
- * Class Page
10
- * @package Bookly\Backend\Modules\Debug
11
- */
12
- class Page extends Lib\Base\Component
13
- {
14
- const TABLE_STATUS_OK = 1;
15
- const TABLE_STATUS_ERROR = 0;
16
- const TABLE_STATUS_WARNING = 2;
17
- const TABLE_STATUS_INFO = 3;
18
-
19
- /**
20
- * Render page.
21
- */
22
- public static function render()
23
- {
24
- /** @var \wpdb $wpdb*/
25
- global $wpdb;
26
-
27
- self::enqueueStyles( array(
28
- 'backend' => array( 'css/fontawesome-all.min.css' => array( 'bookly-backend-globals' ) ),
29
- 'module' => array( 'css/style.css' ),
30
- ) );
31
-
32
- self::enqueueScripts( array(
33
- 'module' => array(
34
- 'js/tools.js' => array( 'bookly-backend-globals' ),
35
- 'js/schema.js' => array( 'bookly-tools.js' ),
36
- ),
37
- ) );
38
-
39
- $debug = array();
40
- $schema = new Schema();
41
- $trouble = false;
42
- if ( ! self::hasParameter( 'x' ) ) {
43
- /** @var Lib\Base\Plugin $plugin */
44
- foreach ( apply_filters( 'bookly_plugins', array() ) as $plugin ) {
45
- foreach ( $plugin::getEntityClasses() as $entity_class ) {
46
- $table_name = $entity_class::getTableName();
47
- $debug[ $table_name ] = array(
48
- 'fields' => null,
49
- 'constraints' => null,
50
- 'status' => null,
51
- 'valid' => array(
52
- 'collation' => true,
53
- 'character_set' => true
54
- )
55
- );
56
- if ( $schema->existsTable( $table_name ) ) {
57
- $table_structure = $schema->getTableStructure( $table_name );
58
- $table_constraints = $schema->getTableConstraints( $table_name );
59
- $entity_schema = $entity_class::getSchema();
60
- $entity_constraints = $entity_class::getConstraints();
61
- $debug[ $table_name ]['status'] = self::TABLE_STATUS_OK;
62
- $debug[ $table_name ]['fields'] = array();
63
-
64
- // Comparing model schema with real DB schema
65
- foreach ( $entity_schema as $field => $data ) {
66
- if ( array_key_exists( $field, $table_structure ) ) {
67
- $debug[ $table_name ]['fields'][ $field ] = 1;
68
- $expect = QueryBuilder::getColumnData( $table_name, $field );
69
- $actual = $table_structure[ $field ];
70
- if ( $debug[ $table_name ]['valid']['character_set']
71
- && isset( $actual['character_set'] )
72
- && $actual['character_set'] !== $wpdb->charset )
73
- {
74
- $debug[ $table_name ]['valid']['character_set'] = false;
75
- }
76
- if ( $debug[ $table_name ]['valid']['collation']
77
- && isset( $actual['collation'] )
78
- && $actual['collation'] !== $wpdb->collate )
79
- {
80
- $debug[ $table_name ]['valid']['collation'] = false;
81
- }
82
-
83
- if ( isset( $actual['character_set'] ) ) {
84
- $expect['character_set'] = $wpdb->charset;
85
- } else {
86
- unset ( $actual['character_set'] );
87
- }
88
- if ( isset( $actual['collation'] ) ) {
89
- $expect['collation'] = $wpdb->collate;
90
- } else {
91
- unset ( $actual['collation'] );
92
- }
93
- unset( $expect['key'], $actual['key'] );
94
- $diff = array_diff_assoc( $actual, $expect );
95
- if ( $expect && $diff ) {
96
- $debug[ $table_name ]['status'] = self::TABLE_STATUS_WARNING;
97
- $debug[ $table_name ]['info'][ $field ] = array_keys( $diff );
98
- $trouble = true;
99
- }
100
- } else {
101
- $debug[ $table_name ]['fields'][ $field ] = 0;
102
- $debug[ $table_name ]['status'] = self::TABLE_STATUS_WARNING;
103
- $trouble = true;
104
- }
105
- unset( $table_structure[ $field ] );
106
- }
107
- foreach ( $table_structure as $field => $data ) {
108
- $data['class'] = $entity_class;
109
- if ( $debug[ $table_name ]['status'] != self::TABLE_STATUS_WARNING ) {
110
- $debug[ $table_name ]['status'] = self::TABLE_STATUS_INFO;
111
- }
112
- $debug[ $table_name ]['fields_3d'][ $field ] = $data;
113
- }
114
-
115
- // Comparing model constraints with real DB constraints
116
- foreach ( $entity_constraints as $constraint ) {
117
- $key = $constraint['column_name'] . $constraint['referenced_table_name'] . $constraint['referenced_column_name'];
118
- $debug[ $table_name ]['constraints'][ $key ] = $constraint;
119
- if ( array_key_exists( $key, $table_constraints ) ) {
120
- $debug[ $table_name ]['constraints'][ $key ]['status'] = 1;
121
- } else {
122
- $debug[ $table_name ]['constraints'][ $key ]['status'] = 0;
123
- $debug[ $table_name ]['status'] = self::TABLE_STATUS_WARNING;
124
- $trouble = true;
125
- }
126
- }
127
- $debug[ $table_name ]['constraints_3d'] = array();
128
- foreach ( $table_constraints as $constraint_name => $constraint ) {
129
- $key = $constraint['column_name'] . $constraint['referenced_table_name'] . $constraint['referenced_column_name'];
130
- if ( ! isset( $debug[ $table_name ]['constraints'][ $key ] ) ) {
131
- $debug[ $table_name ]['constraints_3d'][ $key ] = $constraint;
132
- $debug[ $table_name ]['constraints_3d'][ $key ]['status'] = 0;
133
- if ( $debug[ $table_name ]['status'] != self::TABLE_STATUS_WARNING ) {
134
- $debug[ $table_name ]['status'] = self::TABLE_STATUS_INFO;
135
- }
136
- }
137
- }
138
- } else {
139
- $debug[ $table_name ]['status'] = self::TABLE_STATUS_ERROR;
140
- $trouble = true;
141
- }
142
- }
143
- }
144
- }
145
-
146
- $tests = array();
147
- foreach ( glob( __DIR__ . '/lib/tests/*.php' ) as $path ) {
148
- $test = basename( $path, '.php' );
149
- if ( $test !== 'Base' ) {
150
- $tests[] = $test;
151
- }
152
- }
153
-
154
- wp_localize_script( 'bookly-schema.js', 'BooklyL10n', array(
155
- 'tests' => $tests,
156
- 'datePicker' => Lib\Utils\DateTime::datePickerOptions(),
157
- 'dateRange' => Lib\Utils\DateTime::dateRangeOptions( array( 'lastMonth' => __( 'Last month', 'bookly' ), ) ),
158
- 'character_set' => $wpdb->charset,
159
- 'collate' => $wpdb->collate,
160
- 'charsetCollate' => $wpdb->has_cap( 'collation' )
161
- ? $wpdb->get_charset_collate()
162
- : 'DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci'
163
- ) );
164
-
165
- ksort( $debug );
166
- $import_status = self::parameter( 'status' );
167
- $tools = '';
168
- $plugins = '';
169
- foreach ( glob( __DIR__ . '/lib/tools/*.php' ) as $path ) {
170
- $tool = basename( $path, '.php' );
171
- if ( $tool !== 'Base' ) {
172
- $tool_class = '\Bookly\Backend\Modules\Debug\Lib\Tools\\' . $tool;
173
- if ( class_exists( $tool_class, true ) ) {
174
- /** @var \Bookly\Backend\Modules\Debug\Lib\Tools\Base $tool */
175
- $tool = new $tool_class;
176
- if ( $tool->getType() == 'tools' ) {
177
- $tools .= $tool->getMenu();
178
- } else {
179
- $plugins .= $tool->getMenu();
180
- }
181
- }
182
- }
183
- }
184
- $db = $wpdb->get_row( 'SELECT version() AS version', ARRAY_A );
185
- self::renderTemplate( 'index', compact( 'debug', 'import_status', 'tools', 'plugins', 'trouble', 'db' ) );
186
- }
187
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/modules/debug/lib/QueryBuilder.php DELETED
@@ -1,679 +0,0 @@
1
- <?php
2
- namespace Bookly\Backend\Modules\Debug\Lib;
3
-
4
- /**
5
- * Class QueryBuilder
6
- * @package Bookly\Backend\Modules\Debug\Lib
7
- */
8
- class QueryBuilder
9
- {
10
- /**
11
- * Get add column query
12
- *
13
- * @param string $table
14
- * @param string $column
15
- * @return string
16
- */
17
- public static function getAddColumn( $table, $column )
18
- {
19
- $data = self::getColumnData( $table, $column );
20
- if ( $data ) {
21
- return sprintf( 'ALTER TABLE `%s` ADD COLUMN `%s` %s',
22
- $table,
23
- $column,
24
- self::getColumnDataType( $data )
25
- );
26
- }
27
-
28
- return '';
29
- }
30
-
31
- /**
32
- * Get drop foreign key query
33
- *
34
- * @param string $table
35
- * @param string $constraint_name
36
- * @return string
37
- */
38
- public static function getDropForeignKey( $table, $constraint_name )
39
- {
40
- return sprintf( 'ALTER TABLE `%s` DROP FOREIGN KEY `%s`',
41
- $table,
42
- $constraint_name
43
- );
44
- }
45
-
46
- /**
47
- * Get change column query
48
- *
49
- * @param string $table
50
- * @param string $column
51
- * @return string
52
- */
53
- public static function getChangeColumn( $table, $column )
54
- {
55
- $data = self::getColumnData( $table, $column );
56
- if ( $data ) {
57
- return sprintf( 'ALTER TABLE `%1$s` CHANGE COLUMN `%2$s` `%2$s` %3$s',
58
- $table,
59
- $column,
60
- self::getColumnDataType( $data )
61
- );
62
- }
63
-
64
- return '';
65
- }
66
-
67
- /**
68
- * Get add constraint query
69
- *
70
- * @param string $table
71
- * @param string $column
72
- * @param string $ref_table
73
- * @param string $ref_column
74
- * @return bool|string
75
- */
76
- public static function getAddConstraint( $table, $column, $ref_table, $ref_column )
77
- {
78
- $rules = self::getConstraintRules( $table, $column, $ref_table, $ref_column );
79
- $sql = sprintf( 'ALTER TABLE `%s` ADD CONSTRAINT FOREIGN KEY (`%s`) REFERENCES `%s` (`%s`)', $table, $column, $ref_table, $ref_column );
80
- $delete_rule = $rules['DELETE_RULE'];
81
- switch ( $delete_rule ) {
82
- case 'RESTRICT':
83
- case 'CASCADE':
84
- case 'SET NULL':
85
- case 'NO ACTIONS':
86
- $sql .= ' ON DELETE ' . $delete_rule;
87
- break;
88
- default:
89
- return false;
90
- }
91
- $update_rule = $rules['UPDATE_RULE'];
92
- switch ( $update_rule ) {
93
- case 'RESTRICT':
94
- case 'CASCADE':
95
- case 'SET NULL':
96
- case 'NO ACTIONS':
97
- $sql .= ' ON UPDATE ' . $update_rule;
98
- break;
99
- default:
100
- return false;
101
- }
102
-
103
- return $sql;
104
- }
105
-
106
- /**
107
- * Get create table query
108
- *
109
- * @param string $table
110
- * @return string
111
- */
112
- public static function getCreateTable( $table )
113
- {
114
- /** @global \wpdb */
115
- global $wpdb;
116
-
117
- return sprintf( 'CREATE TABLE `%s` ( `id` %s, PRIMARY KEY (`id`)) ENGINE = INNODB %s',
118
- $table,
119
- str_replace( ' primary key', '', self::getColumnDataType( self::getColumnData( $table, 'id' ) ) ),
120
- $wpdb->has_cap( 'collation' )
121
- ? $wpdb->get_charset_collate()
122
- : 'DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci'
123
- );
124
- }
125
-
126
- /**
127
- * Get column data type array
128
- *
129
- * @param string $table
130
- * @param string $column
131
- * @return array
132
- */
133
- public static function getColumnData( $table, $column )
134
- {
135
- /*
136
- SELECT CONCAT ( '\'', CONCAT_WS( '.', SUBSTR(TABLE_NAME,4), COLUMN_NAME ), '\' => array( \'type\' => "', COLUMN_TYPE, '", \'is_nullabe\' => ', IF(IS_NULLABLE = 'NO', '0', '1' ), ', \'extra\' => "', EXTRA, '", \'default\' => ', CONCAT (
137
- IF (COLUMN_DEFAULT is NULL, IF( IS_NULLABLE = 'NO', COALESCE(COLUMN_DEFAULT,'null'), 'null' ), CONCAT('"',COALESCE(COLUMN_DEFAULT,''), '"'))), ', \'key\' => "' , COLUMN_KEY ,'" ),'
138
- ) as l
139
- FROM INFORMATION_SCHEMA.COLUMNS
140
- WHERE TABLE_SCHEMA = SCHEMA()
141
- AND TABLE_NAME LIKE 'wp_bookly_%'
142
- ORDER BY TABLE_NAME, ORDINAL_POSITION
143
- */
144
-
145
- $data = array(
146
- 'bookly_appointments.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
147
- 'bookly_appointments.location_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
148
- 'bookly_appointments.staff_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
149
- 'bookly_appointments.staff_any' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
150
- 'bookly_appointments.service_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
151
- 'bookly_appointments.custom_service_name' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
152
- 'bookly_appointments.custom_service_price' => array( 'type' => 'decimal(10,2)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
153
- 'bookly_appointments.start_date' => array( 'type' => 'datetime', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
154
- 'bookly_appointments.end_date' => array( 'type' => 'datetime', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
155
- 'bookly_appointments.extras_duration' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
156
- 'bookly_appointments.internal_note' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
157
- 'bookly_appointments.google_event_id' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
158
- 'bookly_appointments.google_event_etag' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
159
- 'bookly_appointments.outlook_event_id' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
160
- 'bookly_appointments.outlook_event_change_key' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
161
- 'bookly_appointments.outlook_event_series_id' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
162
- 'bookly_appointments.online_meeting_provider' => array( 'type' => "enum('zoom','google_meet','jitsi','bbb')", 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
163
- 'bookly_appointments.online_meeting_id' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
164
- 'bookly_appointments.online_meeting_data' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
165
- 'bookly_appointments.created_from' => array( 'type' => "enum('bookly','google','outlook')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'bookly', 'key' => '' ),
166
- 'bookly_appointments.created_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
167
- 'bookly_appointments.updated_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
168
- 'bookly_categories.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
169
- 'bookly_categories.name' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
170
- 'bookly_categories.position' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '9999', 'key' => '' ),
171
- 'bookly_coupon_customers.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
172
- 'bookly_coupon_customers.coupon_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
173
- 'bookly_coupon_customers.customer_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
174
- 'bookly_coupon_services.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
175
- 'bookly_coupon_services.coupon_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
176
- 'bookly_coupon_services.service_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
177
- 'bookly_coupon_staff.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
178
- 'bookly_coupon_staff.coupon_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
179
- 'bookly_coupon_staff.staff_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
180
- 'bookly_coupons.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
181
- 'bookly_coupons.code' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => '', 'key' => '' ),
182
- 'bookly_coupons.discount' => array( 'type' => 'decimal(5,2)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0.00', 'key' => '' ),
183
- 'bookly_coupons.deduction' => array( 'type' => 'decimal(10,2)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0.00', 'key' => '' ),
184
- 'bookly_coupons.usage_limit' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => '1', 'key' => '' ),
185
- 'bookly_coupons.used' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
186
- 'bookly_coupons.once_per_customer' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
187
- 'bookly_coupons.date_limit_start' => array( 'type' => 'date', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
188
- 'bookly_coupons.date_limit_end' => array( 'type' => 'date', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
189
- 'bookly_coupons.min_appointments' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => '1', 'key' => '' ),
190
- 'bookly_coupons.max_appointments' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
191
- 'bookly_custom_statuses.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
192
- 'bookly_custom_statuses.slug' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'UNI' ),
193
- 'bookly_custom_statuses.name' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
194
- 'bookly_custom_statuses.busy' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '1', 'key' => '' ),
195
- 'bookly_custom_statuses.color' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => '#dddddd', 'key' => '' ),
196
- 'bookly_custom_statuses.position' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '9999', 'key' => '' ),
197
- 'bookly_customer_appointment_files.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
198
- 'bookly_customer_appointment_files.customer_appointment_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
199
- 'bookly_customer_appointment_files.file_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
200
- 'bookly_customer_appointments.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
201
- 'bookly_customer_appointments.series_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
202
- 'bookly_customer_appointments.package_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
203
- 'bookly_customer_appointments.customer_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
204
- 'bookly_customer_appointments.appointment_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
205
- 'bookly_customer_appointments.payment_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
206
- 'bookly_customer_appointments.order_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
207
- 'bookly_customer_appointments.number_of_persons' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => '1', 'key' => '' ),
208
- 'bookly_customer_appointments.units' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => '1', 'key' => '' ),
209
- 'bookly_customer_appointments.notes' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
210
- 'bookly_customer_appointments.extras' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
211
- 'bookly_customer_appointments.extras_multiply_nop' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '1', 'key' => '' ),
212
- 'bookly_customer_appointments.custom_fields' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
213
- 'bookly_customer_appointments.status' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => 'approved', 'key' => '' ),
214
- 'bookly_customer_appointments.status_changed_at' => array( 'type' => 'datetime', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
215
- 'bookly_customer_appointments.token' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
216
- 'bookly_customer_appointments.time_zone' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
217
- 'bookly_customer_appointments.time_zone_offset' => array( 'type' => 'int', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
218
- 'bookly_customer_appointments.rating' => array( 'type' => 'int', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
219
- 'bookly_customer_appointments.rating_comment' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
220
- 'bookly_customer_appointments.locale' => array( 'type' => 'varchar(8)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
221
- 'bookly_customer_appointments.collaborative_service_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
222
- 'bookly_customer_appointments.collaborative_token' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
223
- 'bookly_customer_appointments.compound_service_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
224
- 'bookly_customer_appointments.compound_token' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
225
- 'bookly_customer_appointments.created_from' => array( 'type' => "enum('frontend','backend')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'frontend', 'key' => '' ),
226
- 'bookly_customer_appointments.created_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
227
- 'bookly_customer_appointments.updated_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
228
- 'bookly_customer_groups.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
229
- 'bookly_customer_groups.name' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
230
- 'bookly_customer_groups.description' => array( 'type' => 'text', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
231
- 'bookly_customer_groups.appointment_status' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => '', 'key' => '' ),
232
- 'bookly_customer_groups.discount' => array( 'type' => 'varchar(100)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
233
- 'bookly_customer_groups.skip_payment' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
234
- 'bookly_customer_groups.gateways' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
235
- 'bookly_customer_groups_services.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
236
- 'bookly_customer_groups_services.group_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
237
- 'bookly_customer_groups_services.service_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
238
- 'bookly_customers.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
239
- 'bookly_customers.wp_user_id' => array( 'type' => 'bigint unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
240
- 'bookly_customers.facebook_id' => array( 'type' => 'bigint unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
241
- 'bookly_customers.group_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
242
- 'bookly_customers.full_name' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => '', 'key' => '' ),
243
- 'bookly_customers.first_name' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => '', 'key' => '' ),
244
- 'bookly_customers.last_name' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => '', 'key' => '' ),
245
- 'bookly_customers.phone' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => '', 'key' => '' ),
246
- 'bookly_customers.email' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => '', 'key' => '' ),
247
- 'bookly_customers.birthday' => array( 'type' => 'date', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
248
- 'bookly_customers.country' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
249
- 'bookly_customers.state' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
250
- 'bookly_customers.postcode' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
251
- 'bookly_customers.city' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
252
- 'bookly_customers.street' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
253
- 'bookly_customers.street_number' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
254
- 'bookly_customers.additional_address' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
255
- 'bookly_customers.notes' => array( 'type' => 'text', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
256
- 'bookly_customers.info_fields' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
257
- 'bookly_customers.stripe_account' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
258
- 'bookly_customers.created_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
259
- 'bookly_discounts.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
260
- 'bookly_discounts.title' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => '', 'key' => '' ),
261
- 'bookly_discounts.type' => array( 'type' => "enum('nop','appointments')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'nop', 'key' => '' ),
262
- 'bookly_discounts.threshold' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
263
- 'bookly_discounts.discount' => array( 'type' => 'decimal(5,2)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0.00', 'key' => '' ),
264
- 'bookly_discounts.deduction' => array( 'type' => 'decimal(10,2)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0.00', 'key' => '' ),
265
- 'bookly_discounts.date_start' => array( 'type' => 'date', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
266
- 'bookly_discounts.date_end' => array( 'type' => 'date', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
267
- 'bookly_discounts.enabled' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
268
- 'bookly_email_log.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
269
- 'bookly_email_log.to' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
270
- 'bookly_email_log.subject' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
271
- 'bookly_email_log.body' => array( 'type' => 'text', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
272
- 'bookly_email_log.headers' => array( 'type' => 'text', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
273
- 'bookly_email_log.attach' => array( 'type' => 'text', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
274
- 'bookly_email_log.type' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => '', 'key' => '' ),
275
- 'bookly_email_log.created_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
276
- 'bookly_files.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
277
- 'bookly_files.name' => array( 'type' => 'text', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
278
- 'bookly_files.slug' => array( 'type' => 'varchar(32)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
279
- 'bookly_files.path' => array( 'type' => 'text', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
280
- 'bookly_files.custom_field_id' => array( 'type' => 'int', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
281
- 'bookly_holidays.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
282
- 'bookly_holidays.staff_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
283
- 'bookly_holidays.parent_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
284
- 'bookly_holidays.date' => array( 'type' => 'date', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
285
- 'bookly_holidays.repeat_event' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
286
- 'bookly_locations.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
287
- 'bookly_locations.name' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => '', 'key' => '' ),
288
- 'bookly_locations.info' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
289
- 'bookly_locations.position' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '9999', 'key' => '' ),
290
- 'bookly_log.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
291
- 'bookly_log.action' => array( 'type' => "enum('create','update','delete')", 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
292
- 'bookly_log.target' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
293
- 'bookly_log.target_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
294
- 'bookly_log.author' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
295
- 'bookly_log.details' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
296
- 'bookly_log.ref' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
297
- 'bookly_log.comment' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
298
- 'bookly_log.created_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
299
- 'bookly_mailing_campaigns.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
300
- 'bookly_mailing_campaigns.mailing_list_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
301
- 'bookly_mailing_campaigns.name' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
302
- 'bookly_mailing_campaigns.text' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
303
- 'bookly_mailing_campaigns.state' => array( 'type' => "enum('pending','in-progress','completed','canceled')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'pending', 'key' => '' ),
304
- 'bookly_mailing_campaigns.send_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
305
- 'bookly_mailing_campaigns.created_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
306
- 'bookly_mailing_list_recipients.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
307
- 'bookly_mailing_list_recipients.mailing_list_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
308
- 'bookly_mailing_list_recipients.name' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
309
- 'bookly_mailing_list_recipients.phone' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
310
- 'bookly_mailing_list_recipients.created_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
311
- 'bookly_mailing_lists.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
312
- 'bookly_mailing_lists.name' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
313
- 'bookly_mailing_queue.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
314
- 'bookly_mailing_queue.phone' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
315
- 'bookly_mailing_queue.text' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
316
- 'bookly_mailing_queue.sent' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 1, 'extra' => '', 'default' => '0', 'key' => '' ),
317
- 'bookly_mailing_queue.campaign_id' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
318
- 'bookly_mailing_queue.created_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
319
- 'bookly_news.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
320
- 'bookly_news.news_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
321
- 'bookly_news.title' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
322
- 'bookly_news.media_type' => array( 'type' => "enum('image','youtube')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'image', 'key' => '' ),
323
- 'bookly_news.media_url' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
324
- 'bookly_news.text' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
325
- 'bookly_news.button_url' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
326
- 'bookly_news.button_text' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
327
- 'bookly_news.seen' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
328
- 'bookly_news.updated_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
329
- 'bookly_news.created_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
330
- 'bookly_notifications.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
331
- 'bookly_notifications.gateway' => array( 'type' => "enum('email','sms')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'email', 'key' => '' ),
332
- 'bookly_notifications.type' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => '', 'key' => '' ),
333
- 'bookly_notifications.active' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
334
- 'bookly_notifications.name' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => '', 'key' => '' ),
335
- 'bookly_notifications.subject' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => '', 'key' => '' ),
336
- 'bookly_notifications.message' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
337
- 'bookly_notifications.to_staff' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
338
- 'bookly_notifications.to_customer' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
339
- 'bookly_notifications.to_admin' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
340
- 'bookly_notifications.to_custom' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
341
- 'bookly_notifications.custom_recipients' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
342
- 'bookly_notifications.attach_ics' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
343
- 'bookly_notifications.attach_invoice' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
344
- 'bookly_notifications.settings' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
345
- 'bookly_orders.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
346
- 'bookly_orders.token' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
347
- 'bookly_packages.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
348
- 'bookly_packages.location_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
349
- 'bookly_packages.staff_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
350
- 'bookly_packages.service_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
351
- 'bookly_packages.customer_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
352
- 'bookly_packages.internal_note' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
353
- 'bookly_packages.payment_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
354
- 'bookly_packages.created_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
355
- 'bookly_payments.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
356
- 'bookly_payments.target' => array( 'type' => "enum('appointments','packages')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'appointments', 'key' => '' ),
357
- 'bookly_payments.coupon_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
358
- 'bookly_payments.type' => array( 'type' => "enum('local','free','paypal','authorize_net','stripe','2checkout','payu_biz','payu_latam','payson','mollie','woocommerce','cloud_stripe')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'local', 'key' => '' ),
359
- 'bookly_payments.total' => array( 'type' => 'decimal(10,2)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0.00', 'key' => '' ),
360
- 'bookly_payments.tax' => array( 'type' => 'decimal(10,2)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0.00', 'key' => '' ),
361
- 'bookly_payments.paid' => array( 'type' => 'decimal(10,2)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0.00', 'key' => '' ),
362
- 'bookly_payments.paid_type' => array( 'type' => "enum('in_full','deposit')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'in_full', 'key' => '' ),
363
- 'bookly_payments.gateway_price_correction' => array( 'type' => 'decimal(10,2)', 'is_nullabe' => 1, 'extra' => '', 'default' => '0.00', 'key' => '' ),
364
- 'bookly_payments.status' => array( 'type' => "enum('pending','completed','rejected','refunded')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'completed', 'key' => '' ),
365
- 'bookly_payments.token' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
366
- 'bookly_payments.details' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
367
- 'bookly_payments.ref_id' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
368
- 'bookly_payments.created_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
369
- 'bookly_payments.updated_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
370
- 'bookly_schedule_item_breaks.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
371
- 'bookly_schedule_item_breaks.staff_schedule_item_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
372
- 'bookly_schedule_item_breaks.start_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
373
- 'bookly_schedule_item_breaks.end_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
374
- 'bookly_sent_notifications.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
375
- 'bookly_sent_notifications.ref_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
376
- 'bookly_sent_notifications.notification_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
377
- 'bookly_sent_notifications.created_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
378
- 'bookly_series.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
379
- 'bookly_series.repeat' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
380
- 'bookly_series.token' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
381
- 'bookly_service_discounts.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
382
- 'bookly_service_discounts.service_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
383
- 'bookly_service_discounts.discount_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
384
- 'bookly_service_extras.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
385
- 'bookly_service_extras.service_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
386
- 'bookly_service_extras.attachment_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
387
- 'bookly_service_extras.title' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => '', 'key' => '' ),
388
- 'bookly_service_extras.duration' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
389
- 'bookly_service_extras.price' => array( 'type' => 'decimal(10,2)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0.00', 'key' => '' ),
390
- 'bookly_service_extras.min_quantity' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
391
- 'bookly_service_extras.max_quantity' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '1', 'key' => '' ),
392
- 'bookly_service_extras.position' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '9999', 'key' => '' ),
393
- 'bookly_service_schedule_breaks.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
394
- 'bookly_service_schedule_breaks.service_schedule_day_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
395
- 'bookly_service_schedule_breaks.start_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
396
- 'bookly_service_schedule_breaks.end_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
397
- 'bookly_service_schedule_days.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
398
- 'bookly_service_schedule_days.service_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
399
- 'bookly_service_schedule_days.day_index' => array( 'type' => 'smallint', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
400
- 'bookly_service_schedule_days.start_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
401
- 'bookly_service_schedule_days.end_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
402
- 'bookly_service_special_days.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
403
- 'bookly_service_special_days.service_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
404
- 'bookly_service_special_days.date' => array( 'type' => 'date', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
405
- 'bookly_service_special_days.start_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
406
- 'bookly_service_special_days.end_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
407
- 'bookly_service_special_days_breaks.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
408
- 'bookly_service_special_days_breaks.service_special_day_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
409
- 'bookly_service_special_days_breaks.start_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
410
- 'bookly_service_special_days_breaks.end_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
411
- 'bookly_service_taxes.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
412
- 'bookly_service_taxes.service_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
413
- 'bookly_service_taxes.tax_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
414
- 'bookly_services.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
415
- 'bookly_services.category_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
416
- 'bookly_services.type' => array( 'type' => "enum('simple','collaborative','compound','package')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'simple', 'key' => '' ),
417
- 'bookly_services.title' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => '', 'key' => '' ),
418
- 'bookly_services.attachment_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
419
- 'bookly_services.duration' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '900', 'key' => '' ),
420
- 'bookly_services.slot_length' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => 'default', 'key' => '' ),
421
- 'bookly_services.price' => array( 'type' => 'decimal(10,2)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0.00', 'key' => '' ),
422
- 'bookly_services.color' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => '#FFFFFF', 'key' => '' ),
423
- 'bookly_services.deposit' => array( 'type' => 'varchar(100)', 'is_nullabe' => 0, 'extra' => '', 'default' => '100%', 'key' => '' ),
424
- 'bookly_services.capacity_min' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '1', 'key' => '' ),
425
- 'bookly_services.capacity_max' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '1', 'key' => '' ),
426
- 'bookly_services.one_booking_per_slot' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
427
- 'bookly_services.padding_left' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
428
- 'bookly_services.padding_right' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
429
- 'bookly_services.info' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
430
- 'bookly_services.start_time_info' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => '', 'key' => '' ),
431
- 'bookly_services.end_time_info' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => '', 'key' => '' ),
432
- 'bookly_services.same_staff_for_subservices' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
433
- 'bookly_services.units_min' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => '1', 'key' => '' ),
434
- 'bookly_services.units_max' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => '1', 'key' => '' ),
435
- 'bookly_services.package_life_time' => array( 'type' => 'int', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
436
- 'bookly_services.package_size' => array( 'type' => 'int', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
437
- 'bookly_services.package_unassigned' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
438
- 'bookly_services.appointments_limit' => array( 'type' => 'int', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
439
- 'bookly_services.limit_period' => array( 'type' => "enum('off','day','week','month','year','upcoming','calendar_day','calendar_week','calendar_month','calendar_year')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'off', 'key' => '' ),
440
- 'bookly_services.staff_preference' => array( 'type' => "enum('order','least_occupied','most_occupied','least_occupied_for_period','most_occupied_for_period','least_expensive','most_expensive')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'most_expensive', 'key' => '' ),
441
- 'bookly_services.staff_preference_settings' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
442
- 'bookly_services.recurrence_enabled' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '1', 'key' => '' ),
443
- 'bookly_services.recurrence_frequencies' => array( 'type' => "set('daily','weekly','biweekly','monthly')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'daily,weekly,biweekly,monthly', 'key' => '' ),
444
- 'bookly_services.time_requirements' => array( 'type' => "enum('required','optional','off')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'required', 'key' => '' ),
445
- 'bookly_services.collaborative_equal_duration' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
446
- 'bookly_services.online_meetings' => array( 'type' => "enum('off','zoom','google_meet','jitsi','bbb')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'off', 'key' => '' ),
447
- 'bookly_services.final_step_url' => array( 'type' => 'varchar(512)', 'is_nullabe' => 0, 'extra' => '', 'default' => '', 'key' => '' ),
448
- 'bookly_services.wc_product_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
449
- 'bookly_services.wc_cart_info_name' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
450
- 'bookly_services.wc_cart_info' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
451
- 'bookly_services.min_time_prior_booking' => array( 'type' => 'int', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
452
- 'bookly_services.min_time_prior_cancel' => array( 'type' => 'int', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
453
- 'bookly_services.visibility' => array( 'type' => "enum('public','private','group')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'public', 'key' => '' ),
454
- 'bookly_services.position' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '9999', 'key' => '' ),
455
- 'bookly_shop.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
456
- 'bookly_shop.plugin_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
457
- 'bookly_shop.type' => array( 'type' => "enum('plugin','bundle')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'plugin', 'key' => '' ),
458
- 'bookly_shop.highlighted' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
459
- 'bookly_shop.priority' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => '0', 'key' => '' ),
460
- 'bookly_shop.demo_url' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
461
- 'bookly_shop.title' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
462
- 'bookly_shop.slug' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
463
- 'bookly_shop.description' => array( 'type' => 'text', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
464
- 'bookly_shop.url' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
465
- 'bookly_shop.icon' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
466
- 'bookly_shop.price' => array( 'type' => 'decimal(10,2)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
467
- 'bookly_shop.sales' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
468
- 'bookly_shop.rating' => array( 'type' => 'decimal(10,2)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
469
- 'bookly_shop.reviews' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
470
- 'bookly_shop.published' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
471
- 'bookly_shop.seen' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
472
- 'bookly_shop.created_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
473
- 'bookly_special_days_breaks.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
474
- 'bookly_special_days_breaks.staff_special_day_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
475
- 'bookly_special_days_breaks.start_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
476
- 'bookly_special_days_breaks.end_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
477
- 'bookly_staff.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
478
- 'bookly_staff.category_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
479
- 'bookly_staff.wp_user_id' => array( 'type' => 'bigint unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
480
- 'bookly_staff.attachment_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
481
- 'bookly_staff.full_name' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
482
- 'bookly_staff.email' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
483
- 'bookly_staff.phone' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
484
- 'bookly_staff.time_zone' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
485
- 'bookly_staff.info' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
486
- 'bookly_staff.working_time_limit' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
487
- 'bookly_staff.visibility' => array( 'type' => "enum('public','private','archive')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'public', 'key' => '' ),
488
- 'bookly_staff.position' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '9999', 'key' => '' ),
489
- 'bookly_staff.google_data' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
490
- 'bookly_staff.outlook_data' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
491
- 'bookly_staff.zoom_authentication' => array( 'type' => "enum('default','jwt','oauth')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'default', 'key' => '' ),
492
- 'bookly_staff.zoom_jwt_api_key' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
493
- 'bookly_staff.zoom_jwt_api_secret' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
494
- 'bookly_staff.zoom_oauth_token' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
495
- 'bookly_staff.icalendar' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
496
- 'bookly_staff.icalendar_token' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
497
- 'bookly_staff.icalendar_days_before' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '365', 'key' => '' ),
498
- 'bookly_staff.icalendar_days_after' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '365', 'key' => '' ),
499
- 'bookly_staff.color' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => '#dddddd', 'key' => '' ),
500
- 'bookly_staff.gateways' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
501
- 'bookly_staff_categories.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
502
- 'bookly_staff_categories.name' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
503
- 'bookly_staff_categories.position' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '9999', 'key' => '' ),
504
- 'bookly_staff_locations.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
505
- 'bookly_staff_locations.staff_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
506
- 'bookly_staff_locations.location_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
507
- 'bookly_staff_locations.custom_services' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
508
- 'bookly_staff_locations.custom_schedule' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
509
- 'bookly_staff_locations.custom_special_days' => array( 'type' => 'tinyint(1)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0', 'key' => '' ),
510
- 'bookly_staff_preference_orders.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
511
- 'bookly_staff_preference_orders.service_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
512
- 'bookly_staff_preference_orders.staff_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
513
- 'bookly_staff_preference_orders.position' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '9999', 'key' => '' ),
514
- 'bookly_staff_schedule_items.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
515
- 'bookly_staff_schedule_items.staff_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
516
- 'bookly_staff_schedule_items.location_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
517
- 'bookly_staff_schedule_items.day_index' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
518
- 'bookly_staff_schedule_items.start_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
519
- 'bookly_staff_schedule_items.end_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
520
- 'bookly_staff_services.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
521
- 'bookly_staff_services.staff_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
522
- 'bookly_staff_services.service_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
523
- 'bookly_staff_services.location_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
524
- 'bookly_staff_services.price' => array( 'type' => 'decimal(10,2)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0.00', 'key' => '' ),
525
- 'bookly_staff_services.deposit' => array( 'type' => 'varchar(100)', 'is_nullabe' => 0, 'extra' => '', 'default' => '100%', 'key' => '' ),
526
- 'bookly_staff_services.capacity_min' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '1', 'key' => '' ),
527
- 'bookly_staff_services.capacity_max' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '1', 'key' => '' ),
528
- 'bookly_staff_special_days.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
529
- 'bookly_staff_special_days.staff_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
530
- 'bookly_staff_special_days.location_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
531
- 'bookly_staff_special_days.date' => array( 'type' => 'date', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
532
- 'bookly_staff_special_days.start_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
533
- 'bookly_staff_special_days.end_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
534
- 'bookly_staff_special_hours.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
535
- 'bookly_staff_special_hours.staff_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
536
- 'bookly_staff_special_hours.service_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
537
- 'bookly_staff_special_hours.location_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
538
- 'bookly_staff_special_hours.start_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
539
- 'bookly_staff_special_hours.end_time' => array( 'type' => 'time', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
540
- 'bookly_staff_special_hours.days' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => '1,2,3,4,5,6,7', 'key' => '' ),
541
- 'bookly_staff_special_hours.price' => array( 'type' => 'decimal(10,2)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0.00', 'key' => '' ),
542
- 'bookly_stats.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
543
- 'bookly_stats.name' => array( 'type' => 'varchar(255)', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
544
- 'bookly_stats.value' => array( 'type' => 'text', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
545
- 'bookly_stats.created_at' => array( 'type' => 'datetime', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => '' ),
546
- 'bookly_sub_services.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
547
- 'bookly_sub_services.type' => array( 'type' => "enum('service','spare_time')", 'is_nullabe' => 0, 'extra' => '', 'default' => 'service', 'key' => '' ),
548
- 'bookly_sub_services.service_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
549
- 'bookly_sub_services.sub_service_id' => array( 'type' => 'int unsigned', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => 'MUL' ),
550
- 'bookly_sub_services.duration' => array( 'type' => 'int', 'is_nullabe' => 1, 'extra' => '', 'default' => null, 'key' => '' ),
551
- 'bookly_sub_services.position' => array( 'type' => 'int', 'is_nullabe' => 0, 'extra' => '', 'default' => '9999', 'key' => '' ),
552
- 'bookly_taxes.id' => array( 'type' => 'int unsigned', 'is_nullabe' => 0, 'extra' => 'auto_increment', 'default' => null, 'key' => 'PRI' ),
553
- 'bookly_taxes.title' => array( 'type' => 'varchar(255)', 'is_nullabe' => 1, 'extra' => '', 'default' => '', 'key' => '' ),
554
- 'bookly_taxes.rate' => array( 'type' => 'decimal(10,3)', 'is_nullabe' => 0, 'extra' => '', 'default' => '0.000', 'key' => '' ),
555
- );
556
-
557
- /** @global \wpdb */
558
- global $wpdb;
559
-
560
- $prefix_len = strlen( $wpdb->prefix );
561
- $key = substr( $table, $prefix_len ) . '.' . $column;
562
-
563
- return array_key_exists( $key, $data )
564
- ? $data[ $key ]
565
- : array();
566
- }
567
-
568
- /**
569
- * Get constraint rules
570
- *
571
- * @param string $table
572
- * @param string $column
573
- * @param string $ref_table
574
- * @param string $ref_column
575
- * @return array
576
- */
577
- public static function getConstraintRules( $table, $column, $ref_table, $ref_column )
578
- {
579
- /*
580
- SELECT CONCAT( '\'', SUBSTR(kcu.TABLE_NAME,4), '.', kcu.COLUMN_NAME , '\' => array( \'', SUBSTR(kcu.REFERENCED_TABLE_NAME,4), '.', kcu.REFERENCED_COLUMN_NAME, '\' => array( \'UPDATE_RULE\' => \'', rc.UPDATE_RULE, '\', \'DELETE_RULE\' => \'', rc.DELETE_RULE, '\', ), ),' ) AS c
581
- FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS AS rc
582
- LEFT JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS kcu ON ( rc.CONSTRAINT_NAME = kcu.CONSTRAINT_NAME )
583
- WHERE rc.UNIQUE_CONSTRAINT_SCHEMA = SCHEMA()
584
- AND kcu.CONSTRAINT_NAME LIKE 'wp_bookly_%'
585
- ORDER BY kcu.TABLE_NAME,kcu.REFERENCED_TABLE_NAME,kcu.REFERENCED_COLUMN_NAME
586
- */
587
-
588
- $rules = array(
589
- 'bookly_appointments.location_id' => array( 'bookly_locations.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
590
- 'bookly_appointments.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
591
- 'bookly_appointments.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
592
- 'bookly_coupon_customers.coupon_id' => array( 'bookly_coupons.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
593
- 'bookly_coupon_customers.customer_id' => array( 'bookly_customers.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
594
- 'bookly_coupon_services.coupon_id' => array( 'bookly_coupons.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
595
- 'bookly_coupon_services.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
596
- 'bookly_coupon_staff.coupon_id' => array( 'bookly_coupons.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
597
- 'bookly_coupon_staff.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
598
- 'bookly_customer_appointment_files.customer_appointment_id' => array( 'bookly_customer_appointments.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
599
- 'bookly_customer_appointment_files.file_id' => array( 'bookly_files.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
600
- 'bookly_customer_appointments.appointment_id' => array( 'bookly_appointments.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
601
- 'bookly_customer_appointments.customer_id' => array( 'bookly_customers.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
602
- 'bookly_customer_appointments.order_id' => array( 'bookly_orders.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
603
- 'bookly_customer_appointments.package_id' => array( 'bookly_packages.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
604
- 'bookly_customer_appointments.payment_id' => array( 'bookly_payments.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
605
- 'bookly_customer_appointments.series_id' => array( 'bookly_series.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
606
- 'bookly_customer_groups_services.group_id' => array( 'bookly_customer_groups.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
607
- 'bookly_customer_groups_services.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
608
- 'bookly_customers.group_id' => array( 'bookly_customer_groups.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
609
- 'bookly_holidays.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
610
- 'bookly_mailing_campaigns.mailing_list_id' => array( 'bookly_mailing_lists.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
611
- 'bookly_mailing_list_recipients.mailing_list_id' => array( 'bookly_mailing_lists.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
612
- 'bookly_packages.customer_id' => array( 'bookly_customers.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
613
- 'bookly_packages.payment_id' => array( 'bookly_payments.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
614
- 'bookly_packages.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
615
- 'bookly_packages.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
616
- 'bookly_payments.coupon_id' => array( 'bookly_coupons.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
617
- 'bookly_schedule_item_breaks.staff_schedule_item_id' => array( 'bookly_staff_schedule_items.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
618
- 'bookly_sent_notifications.notification_id' => array( 'bookly_notifications.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
619
- 'bookly_service_discounts.discount_id' => array( 'bookly_discounts.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
620
- 'bookly_service_discounts.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
621
- 'bookly_service_extras.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
622
- 'bookly_service_schedule_breaks.service_schedule_day_id' => array( 'bookly_service_schedule_days.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
623
- 'bookly_service_schedule_days.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
624
- 'bookly_service_special_days.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
625
- 'bookly_service_special_days_breaks.service_special_day_id' => array( 'bookly_service_special_days.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
626
- 'bookly_service_taxes.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
627
- 'bookly_service_taxes.tax_id' => array( 'bookly_taxes.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
628
- 'bookly_services.category_id' => array( 'bookly_categories.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
629
- 'bookly_special_days_breaks.staff_special_day_id' => array( 'bookly_staff_special_days.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
630
- 'bookly_staff.category_id' => array( 'bookly_staff_categories.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
631
- 'bookly_staff_locations.location_id' => array( 'bookly_locations.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
632
- 'bookly_staff_locations.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
633
- 'bookly_staff_preference_orders.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
634
- 'bookly_staff_preference_orders.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
635
- 'bookly_staff_schedule_items.location_id' => array( 'bookly_locations.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
636
- 'bookly_staff_schedule_items.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
637
- 'bookly_staff_services.location_id' => array( 'bookly_locations.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
638
- 'bookly_staff_services.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
639
- 'bookly_staff_services.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
640
- 'bookly_staff_special_days.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
641
- 'bookly_staff_special_hours.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
642
- 'bookly_staff_special_hours.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
643
- 'bookly_sub_services.sub_service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
644
- 'bookly_sub_services.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
645
- );
646
-
647
- /** @global \wpdb */
648
- global $wpdb;
649
-
650
- $prefix_len = strlen( $wpdb->prefix );
651
- $key = substr( $table, $prefix_len ) . '.' . $column;
652
- $ref = substr( $ref_table, $prefix_len ) . '.' . $ref_column;
653
- if ( isset( $rules[ $key ][ $ref ] ) ) {
654
- return $rules[ $key ][ $ref ];
655
- } else {
656
- return array( 'UPDATE_RULE' => null, 'DELETE_RULE' => null );
657
- }
658
- }
659
-
660
- /**
661
- * @param array $data
662
- * @return string
663
- */
664
- private static function getColumnDataType( array $data )
665
- {
666
- return sprintf( '%s %s %s',
667
- $data['type'],
668
- $data['is_nullabe']
669
- ? 'null'
670
- : 'not null',
671
- $data['extra'] === 'auto_increment'
672
- ? ( 'auto_increment' . ( $data['key'] === 'PRI' ? ' primary key' : '' ) )
673
- : ( $data['default'] === null
674
- ? ( $data['is_nullabe'] ? 'default null' : '' )
675
- : 'default \'' . $data['default'] . '\''
676
- )
677
- );
678
- }
679
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/modules/debug/lib/tests/Base.php DELETED
@@ -1,66 +0,0 @@
1
- <?php
2
- namespace Bookly\Backend\Modules\Debug\Lib\Tests;
3
-
4
- /**
5
- * Class Base
6
- * @package Bookly\Backend\Modules\Debug\Lib\Tests
7
- */
8
- abstract class Base
9
- {
10
- /** @var array */
11
- protected $errors = array();
12
- /** @var mixed */
13
- protected $data;
14
- /** @var string */
15
- protected $name;
16
-
17
- /**
18
- * Base constructor.
19
- *
20
- * @param array|string|null $data
21
- */
22
- public function __construct( $data = null )
23
- {
24
- $this->data = $data;
25
- }
26
-
27
- /**
28
- * Execute test
29
- *
30
- * @return bool
31
- */
32
- public function execute()
33
- {
34
- return true;
35
- }
36
-
37
- /**
38
- * Get test error.
39
- *
40
- * @return string
41
- */
42
- public function error()
43
- {
44
- return implode( '<br>', $this->errors );
45
- }
46
-
47
- /**
48
- * Add error.
49
- *
50
- * @param string $error
51
- */
52
- public function addError($error)
53
- {
54
- $this->errors[] = $error;
55
- }
56
-
57
- /**
58
- * Get test name.
59
- *
60
- * @return string
61
- */
62
- public function getName()
63
- {
64
- return $this->name;
65
- }
66
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/modules/debug/lib/tests/Session.php DELETED
@@ -1,57 +0,0 @@
1
- <?php
2
- namespace Bookly\Backend\Modules\Debug\Lib\Tests;
3
-
4
- /**
5
- * Class Session
6
- * @package Bookly\Backend\Modules\Debug\Lib\Tests
7
- */
8
- class Session extends Base
9
- {
10
- protected $name = 'Check php session';
11
-
12
- /**
13
- * @inheritDoc
14
- */
15
- public function execute()
16
- {
17
- if ( $this->data === null ) {
18
- $params = array(
19
- 'action' => 'bookly_run_test',
20
- 'test_name' => 'Session',
21
- 'test_data' => 'init',
22
- );
23
-
24
- $url = add_query_arg( $params, admin_url( 'admin-ajax.php' ) );
25
- $response = wp_remote_get( $url, array(
26
- 'timeout' => 60,
27
- ) );
28
- $json = json_decode( wp_remote_retrieve_body( $response ), true );
29
- if ( isset( $json['success'] ) && $json['success'] ) {
30
- $params['test_data'] = 'check';
31
- $url = add_query_arg( $params, admin_url( 'admin-ajax.php' ) );
32
- $response = wp_remote_get( $url, array(
33
- 'timeout' => 60,
34
- 'cookies' => wp_remote_retrieve_cookies( $response ),
35
- ) );
36
- $json = json_decode( wp_remote_retrieve_body( $response ), true );
37
- if ( isset( $json['success'] ) && $json['success'] ) {
38
- return true;
39
- }
40
- }
41
- $this->addError( 'Failed' );
42
- return false;
43
- } elseif ( $this->data === 'init' ) {
44
- @session_start();
45
- $_SESSION['bookly-test-session'] = 2;
46
- wp_send_json_success();
47
- } elseif ( $this->data === 'check' ) {
48
- @session_start();
49
- $_SESSION['bookly-test-session'] === 2
50
- ? wp_send_json_success()
51
- : wp_send_json_error();
52
- }
53
-
54
- return false;
55
- }
56
-
57
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/modules/debug/lib/tests/Slug.php DELETED
@@ -1,37 +0,0 @@
1
- <?php
2
- namespace Bookly\Backend\Modules\Debug\Lib\Tests;
3
-
4
- use Bookly\Lib;
5
-
6
- /**
7
- * Class Slug
8
- * @package Bookly\Backend\Modules\Debug\Lib\Tests
9
- */
10
- class Slug extends Base
11
- {
12
- protected $name = 'Check plugins directories';
13
-
14
- /**
15
- * @inheritDoc
16
- */
17
- public function execute()
18
- {
19
- /**
20
- * @var Lib\Base\Plugin $plugin
21
- */
22
- foreach ( apply_filters( 'bookly_plugins', array() ) as $slug => $plugin ) {
23
- $slug = strtolower( preg_replace( '([A-Z\d])', '-$0', $plugin::getRootNamespace() ) );
24
- if ( $slug === '-bookly' ) {
25
- $slug = 'bookly-responsive-appointment-booking-tool';
26
- } else {
27
- $slug = str_replace( '-bookly-', 'bookly-addon-', $slug );
28
- }
29
-
30
- if ( $slug !== $plugin::getSlug() ) {
31
- $this->addError( $plugin::getTitle() . ' incorrect slug<br>expected=' . $slug . '<br> real=' . $plugin::getSlug() );
32
- }
33
- }
34
-
35
- return empty( $this->errors );
36
- }
37
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/modules/debug/lib/tests/Socket.php DELETED
@@ -1,48 +0,0 @@
1
- <?php
2
- namespace Bookly\Backend\Modules\Debug\Lib\Tests;
3
-
4
- use Bookly\Lib\API;
5
- use Bookly\Lib\Cloud\API as CloudAPI;
6
- use Bookly\Lib\Config;
7
-
8
- /**
9
- * Class Socket
10
- * @package Bookly\Backend\Modules\Debug\Lib\Tests
11
- */
12
- class Socket extends Base
13
- {
14
- protected $name = 'Check API servers availability';
15
-
16
- /**
17
- * @inheritDoc
18
- */
19
- public function execute()
20
- {
21
- $port = 443;
22
- $timeout = 1;
23
- $hosts = array( parse_url( API::API_URL, PHP_URL_HOST ), parse_url( CloudAPI::API_URL, PHP_URL_HOST ) );
24
- if ( Config::mailchimpActive() ) {
25
- $hosts[] = 'mailchimp.com';
26
- }
27
- $available = true;
28
- foreach ( $hosts as $host ) {
29
- $fp = fsockopen( $host, $port, $errno, $errstr, $timeout );
30
- if ( ! $fp ) {
31
- $available = false;
32
- $this->addError( $host . ' ' . $errstr );
33
- }
34
- }
35
-
36
- if ( $available ) {
37
- return true;
38
- } else {
39
- foreach ( array( 'www.google.com', 'www.amazon.com' ) as $host ) {
40
- $time = microtime( true );
41
- fsockopen( $host, $port, $errno, $errstr, $timeout );
42
- $this->addError( $host . "\t time=" . round( ( ( microtime( true ) - $time ) * 1000 ), 0 ) . ' ms' );
43
- }
44
- }
45
- return false;
46
- }
47
-
48
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/modules/debug/lib/tools/Base.php DELETED
@@ -1,109 +0,0 @@
1
- <?php
2
- namespace Bookly\Backend\Modules\Debug\Lib\Tools;
3
-
4
- /**
5
- * Class Base
6
- * @package Bookly\Backend\Modules\Debug\Lib\Tools
7
- */
8
- abstract class Base
9
- {
10
- /** @var mixed */
11
- protected $data;
12
- /** @var string */
13
- protected $name;
14
- /** @var string */
15
- protected $tool;
16
- /** @var array */
17
- protected $alerts = array( 'success' => array(), 'error' => array() );
18
- /** @var string */
19
- protected $type;
20
- /** @var mixed */
21
- protected $result;
22
-
23
- /**
24
- * Base constructor.
25
- * @param string $data
26
- */
27
- public function __construct( $data = null )
28
- {
29
- $this->data = $data;
30
- $path = explode('\\', get_called_class());
31
- $this->tool = array_pop($path);
32
- }
33
-
34
- /**
35
- * Execute tool.
36
- *
37
- * @return bool
38
- */
39
- public function execute()
40
- {
41
- return true;
42
- }
43
-
44
- /**
45
- * Get alerts.
46
- *
47
- * @return array
48
- */
49
- public function alerts()
50
- {
51
- return $this->alerts;
52
- }
53
-
54
- /**
55
- * Add error.
56
- *
57
- * @param string $error
58
- */
59
- public function addError( $error )
60
- {
61
- $this->alerts['error'][] = $error;
62
- }
63
-
64
- /**
65
- * Add success info.
66
- *
67
- * @param string $info
68
- */
69
- public function addInfo( $info )
70
- {
71
- $this->alerts['success'][] = $info;
72
- }
73
-
74
- /**
75
- * Get tool name.
76
- *
77
- * @return string
78
- */
79
- public function getName()
80
- {
81
- return $this->name;
82
- }
83
-
84
- /**
85
- * Get menu
86
- *
87
- * @return string
88
- */
89
- public function getMenu()
90
- {
91
- return '';
92
- }
93
-
94
- public function getType()
95
- {
96
- return $this->type;
97
- }
98
-
99
- /**
100
- * Gets result
101
- *
102
- * @return mixed
103
- */
104
- public function getResult()
105
- {
106
- return $this->result;
107
- }
108
-
109
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/modules/debug/lib/tools/Cloud.php DELETED
@@ -1,70 +0,0 @@
1
- <?php
2
- namespace Bookly\Backend\Modules\Debug\Lib\Tools;
3
-
4
- use Bookly\Lib;
5
-
6
- /**
7
- * Class Cloud
8
- * @package Bookly\Backend\Modules\Debug\Lib\Tools
9
- */
10
- class Cloud extends Base
11
- {
12
- protected $name = 'Cloud feedback';
13
- protected $type = 'tools';
14
-
15
- /**
16
- * @inheritDoc
17
- */
18
- public function getMenu()
19
- {
20
- return sprintf( '<a href="#" data-tool="%s" data-action="%s" class="dropdown-item">%s</a>', $this->tool, 'request_a_cloud', $this->name );
21
- }
22
-
23
- /**
24
- * @inheritDoc
25
- */
26
- public function execute()
27
- {
28
- $option = 'bookly_installation_time';
29
- if ( $this->data['action'] === 'request_a_cloud' ) {
30
- $cloud = Lib\Cloud\API::getInstance();
31
- $data = array(
32
- 'feedback' => array(
33
- 'tool' => array(
34
- 'action' => 'get_data_from_bookly',
35
- 'tool' => 'Cloud',
36
- ),
37
- ),
38
- 'endpoint' => add_query_arg( array( 'action' => 'bookly_run_tool' ), admin_url( 'admin-ajax.php' ) ),
39
- );
40
- $response = $cloud->sendPostRequest( '/1.0/test/feedback-request', $data );
41
-
42
- $post = $get = false;
43
- if ( isset( $response['data'] ) ) {
44
- if ( isset( $response['data']['POST'][ $option ] ) && $response['data']['POST'][ $option ] == get_option( $option ) ) {
45
- $post = true;
46
- }
47
- if ( isset( $response['data']['GET'][ $option ] ) && $response['data']['GET'][ $option ] == get_option( $option ) ) {
48
- $get = true;
49
- }
50
- if ( $get && $post ) {
51
- $this->addInfo( 'Connection between Bookly and Bookly Cloud is confirmed' );
52
- } elseif ( ! $get && ! $post ) {
53
- $this->addError( 'Connection between Bookly and Bookly Cloud is failed' );
54
- } elseif ( $get ) {
55
- $this->addError( 'GET and POST requests from Bookly Cloud: POST failed' );
56
- } elseif ( $post ) {
57
- $this->addError( 'GET and POST requests from Bookly Cloud: GET failed' );
58
- }
59
- return $get && $post;
60
- } else {
61
- $this->addError( 'Bookly Cloud is failed' );
62
- }
63
- } elseif ( $this->data['action'] === 'get_data_from_bookly' ) {
64
- // Response for Cloud
65
- wp_send_json_success( array( $option => get_option( $option ) ) );
66
- }
67
-
68
- return false;
69
- }
70
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/modules/debug/lib/tools/FormsData.php DELETED
@@ -1,66 +0,0 @@
1
- <?php
2
- namespace Bookly\Backend\Modules\Debug\Lib\Tools;
3
-
4
- use Bookly\Lib\Session;
5
-
6
- /**
7
- * Class FormsData
8
- *
9
- * @package Bookly\Backend\Modules\Debug\Lib\Tools
10
- */
11
- class FormsData extends Base
12
- {
13
- protected $name = 'Forms data';
14
- protected $type = 'tools';
15
-
16
- /**
17
- * @inheritDoc
18
- */
19
- public function getMenu()
20
- {
21
- return sprintf( '<a href="#" data-tool="%s" data-action="%s" class="dropdown-item">%s</a>', $this->tool, 'render', $this->name );
22
- }
23
-
24
- /**
25
- * @inheritDoc
26
- */
27
- public function execute()
28
- {
29
- switch ( $this->data['action'] ) {
30
- case 'render':
31
- $li = '';
32
- $all_forms_data = Session::getAllFormsData();
33
- $last_touched_form_id = 0;
34
- $last_touched = 0;
35
- foreach ( $all_forms_data as $form_id => $data ) {
36
- if ( isset( $data['last_touched'] ) && $last_touched < $data['last_touched'] ) {
37
- $last_touched = $data['last_touched'];
38
- $last_touched_form_id = $form_id;
39
- }
40
- }
41
-
42
- foreach ( $all_forms_data as $form_id => $data ) {
43
- $active = $last_touched_form_id == $form_id ? 'list-group-item-primary' : '';
44
- $li .= sprintf( '<li class="list-group-item list-group-item-action %1$s py-1 text-monospace" data-form_id="%2$s">%2$s<button class="btn btn-sm ml-2 p-0 my-0" data-action="copy"><i class="far fa-copy fa-fw"></i></button><div class="float-right"><button class="btn btn-sm p-0 m-0" data-action="destroy"><i class="fas fa-times fa-fw"></i></button></span></li>', $active, esc_attr( $form_id ) );
45
- }
46
- if ( $li == '' ) {
47
- $li = 'Data for [booking-form] is missing in the session';
48
- }
49
- $this->result = '<ul class="list-group" id="bookly-js-booking-forms">' . $li . '</ul>';
50
- break;
51
- case 'get_data':
52
- $form_id = $this->data['form_id'];
53
- $data = Session::getAllFormsData();
54
- if ( array_key_exists( $form_id, $data ) ) {
55
- $this->result = json_encode( $data[ $form_id ] );
56
- }
57
- break;
58
- case 'destroy':
59
- $form_id = $this->data['form_id'];
60
- Session::destroyFormData( $form_id );
61
- }
62
-
63
- return true;
64
- }
65
-
66
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/modules/debug/lib/tools/Phpinfo.php DELETED
@@ -1,34 +0,0 @@
1
- <?php
2
- namespace Bookly\Backend\Modules\Debug\Lib\Tools;
3
-
4
- /**
5
- * Class Phpinfo
6
- * @package Bookly\Backend\Modules\Debug\Lib\Tools
7
- */
8
- class Phpinfo extends Base
9
- {
10
- protected $name = 'Php info';
11
- protected $type = 'tools';
12
-
13
- /**
14
- * @inheritDoc
15
- */
16
- public function getMenu()
17
- {
18
- return sprintf( '<a href="#" data-tool="%s" data-action="%s" class="dropdown-item">%s</a>', $this->tool, 'php_info', $this->name );
19
- }
20
-
21
- /**
22
- * @inheritDoc
23
- */
24
- public function execute()
25
- {
26
- ob_start();
27
- phpinfo();
28
- $info = ob_get_clean();
29
-
30
- $this->result = $info;
31
- return true;
32
- }
33
-
34
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/modules/debug/lib/tools/Plugins.php DELETED
@@ -1,149 +0,0 @@
1
- <?php
2
- namespace Bookly\Backend\Modules\Debug\Lib\Tools;
3
-
4
- /**
5
- * Class Plugins
6
- * @package Bookly\Backend\Modules\Debug\Lib\Tools
7
- */
8
- class Plugins extends Base
9
- {
10
- protected $plugins = array(
11
- 'ari-adminer' => array(
12
- 'name' => 'ARI',
13
- 'source' => 'https://downloads.wordpress.org/plugin/ari-adminer.zip',
14
- 'basename' => 'ari-adminer/ari-adminer.php',
15
- ),
16
- 'wp-file-manager' => array(
17
- 'name' => 'File Manager',
18
- 'source' => 'wordpress',
19
- 'basename' => 'wp-file-manager/file_folder_manager.php',
20
- ),
21
- 'wp-mail-logging' => array(
22
- 'name' => 'WP Mail Logging',
23
- 'source' => 'wordpress',
24
- 'basename' => 'wp-mail-logging/wp-mail-logging.php',
25
- ),
26
- 'code-snippets' => array(
27
- 'name' => 'Code Snippets',
28
- 'source' => 'wordpress',
29
- 'basename' => 'code-snippets/code-snippets.php',
30
- ),
31
- 'pexlechris-adminer' => array(
32
- 'name' => 'WP Adminer',
33
- 'source' => 'wordpress',
34
- 'basename' => 'pexlechris-adminer/pexlechris-adminer.php',
35
- ),
36
- );
37
-
38
- protected $name = 'Plugin manager';
39
- protected $type = 'plugins';
40
-
41
- /**
42
- * @inheritDoc
43
- */
44
- public function getMenu()
45
- {
46
- $menu = '';
47
- foreach ( $this->plugins as $slug => $data ) {
48
- if ( is_plugin_active( $data['basename'] ) ) {
49
- $action = 'delete';
50
- } else {
51
- if ( file_exists( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $data['basename'] ) ) {
52
- $action = 'activate';
53
- } else {
54
- $action = 'install';
55
- }
56
- }
57
-
58
- $menu .= sprintf( '<a href="#" data-tool="%s" data-plugin="%s" data-action="%s" class="dropdown-item">%s (%s)</a>', $this->tool, $slug, $action, $data['name'], $action );
59
- }
60
-
61
- return $menu;
62
- }
63
-
64
- /**
65
- * @inheritDoc
66
- */
67
- public function execute()
68
- {
69
- $plugin = $this->data['plugin'];
70
- switch ( $this->data['action'] ) {
71
- case 'activate':
72
- $state = activate_plugin( $this->getBasename( $plugin ) );
73
- if ( $state === null ) {
74
- $this->addInfo( 'Plugin ' . $this->plugins[ $plugin ]['name'] . ' activated successfully' );
75
- } elseif ( $state instanceof \WP_Error ) {
76
- $this->addError( implode( '<br>', $state->get_error_messages() ) );
77
- } else {
78
- $this->addError( 'Plugin ' . $this->plugins[ $plugin ]['name'] . ' not activated' );
79
- }
80
- return $state === null;
81
- case 'delete':
82
- deactivate_plugins( array( $this->getBasename( $plugin ) ) );
83
- $state = delete_plugins( array( $this->getBasename( $plugin ) ) );
84
- if ( $state === true ) {
85
- $this->addInfo( 'Plugin ' . $this->plugins[ $plugin ]['name'] . ' deleted successfully' );
86
- } elseif ( $state instanceof \WP_Error ) {
87
- $this->addError( implode( '<br>', $state->get_error_messages() ) );
88
- } else {
89
- $this->addError( 'Plugin ' . $this->plugins[ $plugin ]['name'] . ' not deleted' );
90
- }
91
- return $state === null;
92
- case 'install':
93
- $version = '';
94
- if ( ! file_exists( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $this->getBasename( $plugin ) ) ) {
95
- if ( ! class_exists( 'Plugin_Upgrader', false ) ) {
96
- require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
97
- }
98
- $upgrader = new \Plugin_Upgrader( new \Automatic_Upgrader_Skin() );
99
- if ( $this->plugins[ $plugin ]['source'] == 'wordpress' ) {
100
- if ( ! function_exists( 'plugins_api' ) ) {
101
- require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
102
- }
103
- $response = plugins_api(
104
- 'plugin_information',
105
- array(
106
- 'slug' => $plugin,
107
- )
108
- );
109
- if ( $response instanceof \WP_Error ) {
110
- $this->addError( implode( '<br>', $response->get_error_messages() ) );
111
-
112
- return false;
113
- }
114
- $source = $response->download_link;
115
- $version = ' v' . $response->version;
116
- } else {
117
- $source = $this->plugins[ $plugin ]['source'];
118
- }
119
-
120
- $state = $upgrader->install( $source );
121
- } else {
122
- $state = true;
123
- }
124
-
125
- if ( $state === true ) {
126
- activate_plugin( $this->getBasename( $plugin ) );
127
- $this->addInfo( 'Plugin ' . $this->plugins[ $plugin ]['name'] . $version . ' installed successfully' );
128
- } elseif ( $state instanceof \WP_Error ) {
129
- $this->addError( implode( '<br>', $state->get_error_messages() ) );
130
- } else {
131
- $this->addError( 'Plugin ' . $this->plugins[ $plugin ]['name'] . ' not installed' );
132
- }
133
- return $state === true;
134
- }
135
-
136
- $this->addError( 'Unknown action' );
137
- return false;
138
- }
139
-
140
- /**
141
- * @param string $slug
142
- * @return mixed
143
- */
144
- private function getBasename( $slug )
145
- {
146
- return $this->plugins[ $slug ]['basename'];
147
- }
148
-
149
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/modules/debug/lib/tools/ShortCodes.php DELETED
@@ -1,73 +0,0 @@
1
- <?php
2
- namespace Bookly\Backend\Modules\Debug\Lib\Tools;
3
-
4
- /**
5
- * Class ShortCodes
6
- * @package Bookly\Backend\Modules\Debug\Lib\Tools
7
- */
8
- class ShortCodes extends Base
9
- {
10
- protected $name = 'Shortcodes';
11
- protected $type = 'tools';
12
-
13
- /**
14
- * @inheritDoc
15
- */
16
- public function getMenu()
17
- {
18
- return sprintf( '<a href="#" data-tool="%s" data-action="%s" class="dropdown-item">%s</a>', $this->tool, 'render', $this->name );
19
- }
20
-
21
- /**
22
- * @inheritDoc
23
- */
24
- public function execute()
25
- {
26
- global $wpdb;
27
-
28
- switch ( $this->data['action'] ) {
29
- case 'render':
30
- $shortcodes = array(
31
- array( 'name' => 'Booking form', 'code' => '[bookly-form' ),
32
- array( 'name' => 'Appointments list', 'code' => '[bookly-appointments-list' ),
33
- array( 'name' => 'Calendar', 'code' => '[bookly-calendar' ),
34
- array( 'name' => 'Cancellation confirmation', 'code' => '[bookly-cancellation-confirmation' ),
35
- array( 'name' => 'Customer Cabinet', 'code' => '[bookly-customer-cabinet' ),
36
- array( 'name' => 'Packages list', 'code' => '[bookly-packages-list' ),
37
- array( 'name' => 'Search form', 'code' => '[bookly-search-form' ),
38
- array( 'name' => 'Staff Cabinet - Advanced', 'code' => '[bookly-staff-advanced' ),
39
- array( 'name' => 'Staff Cabinet - Calendar', 'code' => '[bookly-staff-calendar' ),
40
- array( 'name' => 'Staff Cabinet - Days off', 'code' => '[bookly-staff-days-off' ),
41
- array( 'name' => 'Staff Cabinet - Details', 'code' => '[bookly-staff-details' ),
42
- array( 'name' => 'Staff Cabinet - Schedule', 'code' => '[bookly-staff-schedule' ),
43
- array( 'name' => 'Staff Cabinet - Services', 'code' => '[bookly-staff-services' ),
44
- array( 'name' => 'Staff Cabinet - Special days', 'code' => '[bookly-staff-special-days' ),
45
- array( 'name' => 'Staff ratings', 'code' => '[bookly-staff-rating' ),
46
- );
47
-
48
- $options = '';
49
- foreach ( $shortcodes as $item ) {
50
- $options .= '<option value="' . esc_attr( $item['code'] ) . '">' . esc_html( $item['name'] ) . '</option>';
51
- }
52
- $this->result = '<div class="input-group">
53
- <select id="bookly_shortcode" class="form-control custom-select">' . $options . '</select>
54
- <div class="input-group-append">
55
- <button class="btn btn-outline-secondary ladda-button" id="bookly-js-find-shortcode-and-open" data-spinner-size="40" data-style="zoom-in" data-spinner-color="rgb(62, 66, 74)"><span class="ladda-label"><i class="fas fa-external-link-alt fa-sm"></i></span></button>
56
- </div>
57
- </div><small class="form-text text-muted mt-0">Open page with shortcode</small>';
58
- break;
59
- case 'find_shortcode':
60
- $row = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->posts . ' WHERE post_content LIKE \'%%%s%\' AND post_type IN (\'page\',\'post\') AND post_status = \'publish\' ORDER BY ID DESC LIMIT 1', $this->data['shortcode'] ) );
61
- if ( $row ) {
62
- $this->result = get_permalink( $row );
63
- } else {
64
- $this->addInfo( 'Shortcode not found' );
65
-
66
- return false;
67
- }
68
- }
69
-
70
- return true;
71
- }
72
-
73
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/modules/debug/resources/js/schema.js DELETED
@@ -1,469 +0,0 @@
1
- jQuery(function($) {
2
- let $addConstraintModal = $('#bookly-js-add-constraint'),
3
- $dropConstraintModal = $('#bookly-js-drop-constraint'),
4
- $dropColumnModal = $('#bookly-js-drop-column'),
5
- $columnModal = $('#bookly-js-add-field'),
6
- $tableModal = $('#bookly-js-create-table'),
7
- $status,
8
- $buttonAction
9
- ;
10
-
11
- $('.collapse').collapse('hide');
12
-
13
- $('#bookly_import_file').change(function() {
14
- if($(this).val()) {
15
- $('#bookly_import').submit();
16
- }
17
- });
18
- $('#bookly-fix-all-silent').on('click', function () {
19
- booklyModal('Confirmation', 'Execute automatic fixing issues found in database schema?', 'Cancel', 'Fix')
20
- .on('bs.click.main.button', function (event, modal, mainButton) {
21
- let ladda = Ladda.create(mainButton);
22
- ladda.start();
23
- $.ajax({
24
- url: ajaxurl,
25
- type: 'POST',
26
- data: {
27
- action: 'bookly_fix_data_base_schema',
28
- csrf_token: BooklyL10nGlobal.csrf_token
29
- },
30
- dataType: 'json',
31
- success: function (response) {
32
- booklyAlert({success: [response.data.message]});
33
- if (!response.success) {
34
- booklyAlert({error: response.data.errors});
35
- }
36
- ladda.stop();
37
- },
38
- error: function () {
39
- booklyAlert({error: ['Error: in query execution.']});
40
- ladda.stop();
41
- },
42
- }).always(function () {
43
- modal.booklyModal('hide');
44
- setTimeout(function () {
45
- let $modal = booklyModal('Are you sure you want to reload this page?', null, 'No', 'Reload')
46
- .on('bs.click.main.button', function (event, modal, mainButton) {
47
- location.reload();
48
- });
49
- setTimeout(function () {
50
- $('.modal-footer .btn-success', $modal).focus();
51
- }, 500);
52
- }, 3000);
53
- });
54
- });
55
- });
56
-
57
- $('[data-action=fix-constraint]')
58
- .on('click', function (e) {
59
- e.preventDefault();
60
- $status = $(this).closest('td');
61
- let $tr = $(this).closest('tr'),
62
- table = $tr.closest('.card').find('.bookly-js-table').attr('id'),
63
- column = $tr.find('td:eq(0)').html(),
64
- ref_table = $tr.find('td:eq(1)').html(),
65
- ref_column = $tr.find('td:eq(2)').html()
66
- ;
67
- $('.bookly-js-loading:first-child', $addConstraintModal).addClass('bookly-loading').removeClass('collapse');
68
- $('.bookly-js-loading:last-child', $addConstraintModal).addClass('collapse');
69
- $('.bookly-js-fix-consistency', $addConstraintModal).hide();
70
- $addConstraintModal.booklyModal();
71
- $.ajax({
72
- url: ajaxurl,
73
- type: 'POST',
74
- data: {
75
- action: 'bookly_get_constraint_data',
76
- table: table,
77
- column: column,
78
- ref_table: ref_table,
79
- ref_column: ref_column,
80
- csrf_token: BooklyL10nGlobal.csrf_token
81
- },
82
- dataType: 'json',
83
- success: function (response) {
84
- if (response.success) {
85
- $('#bookly-js-table, .bookly-js-table', $addConstraintModal).html(table);
86
- $('#bookly-js-column, .bookly-js-column', $addConstraintModal).html(column);
87
- $('#bookly-js-ref_table, .bookly-js-ref_table', $addConstraintModal).html(ref_table);
88
- $('#bookly-js-ref_column, .bookly-js-ref_column', $addConstraintModal).html(ref_column);
89
- $('#bookly-js-DELETE_RULE', $addConstraintModal).val(response.data.DELETE_RULE);
90
- $('#bookly-js-UPDATE_RULE', $addConstraintModal).val(response.data.UPDATE_RULE);
91
- } else {
92
- $('#bookly-js-DELETE_RULE', $addConstraintModal).val('');
93
- $('#bookly-js-DELETE_RULE', $addConstraintModal).val('');
94
- }
95
- $('.bookly-js-loading', $addConstraintModal).toggleClass('collapse');
96
- }
97
- });
98
- });
99
-
100
- $('[data-action=drop-constraint]')
101
- .on('click', function (e) {
102
- e.preventDefault();
103
- $buttonAction = $(this);
104
- $status = $(this).closest('td');
105
- let $tr = $(this).closest('tr'),
106
- table = $tr.closest('.card').find('.bookly-js-table').attr('id'),
107
- constrain = $tr.find('td:eq(2)').html()
108
- ;
109
- $dropConstraintModal.booklyModal();
110
- $('#bookly-js-table', $dropConstraintModal).html(table);
111
- $('#bookly-js-constraint', $dropConstraintModal).html(constrain);
112
- });
113
-
114
- $('[data-action=drop-column]')
115
- .on('click', function (e) {
116
- e.preventDefault();
117
- $buttonAction = $(this);
118
- $status = $(this).closest('td');
119
- let $tr = $(this).closest('tr'),
120
- table = $tr.closest('.card').find('.bookly-js-table').attr('id'),
121
- $field = $('span.field', $tr)
122
- ;
123
- $dropColumnModal.booklyModal();
124
- $('#bookly-js-table', $dropColumnModal).html(table);
125
- $('#bookly-js-column', $dropColumnModal).html($field.html());
126
- $('#bookly-js-entity', $dropColumnModal).html($field.data('entity'));
127
- });
128
-
129
- $dropColumnModal
130
- .on('click', '.bookly-js-save', function () {
131
- let ladda = Ladda.create(this),
132
- entity = $('#bookly-js-entity', $dropColumnModal).html(),
133
- column = $('#bookly-js-column', $dropColumnModal).html();
134
- ladda.start();
135
- $.ajax({
136
- url: ajaxurl,
137
- type: 'POST',
138
- data: {
139
- action: 'bookly_drop_column',
140
- entity: entity,
141
- column: column,
142
- csrf_token: BooklyL10nGlobal.csrf_token
143
- },
144
- dataType: 'json',
145
- success: function (response) {
146
- if (response.success) {
147
- booklyAlert({success: [response.data.message]});
148
- $dropColumnModal.booklyModal('hide');
149
- $buttonAction.closest('tr').remove();
150
- } else {
151
- booklyAlert({error: [response.data.message]});
152
- }
153
- ladda.stop();
154
- },
155
- error: function () {
156
- booklyAlert({error: ['Error: in query execution.']});
157
- ladda.stop();
158
- }
159
- });
160
- });
161
-
162
- $addConstraintModal
163
- .on('click', '.bookly-js-save', function () {
164
- let ladda = Ladda.create(this);
165
- ladda.start();
166
- $.ajax({
167
- url: ajaxurl,
168
- type: 'POST',
169
- data: {
170
- action: 'bookly_add_constraint',
171
- table: $('#bookly-js-table', $addConstraintModal).html(),
172
- column: $('#bookly-js-column', $addConstraintModal).html(),
173
- ref_table: $('#bookly-js-ref_table', $addConstraintModal).html(),
174
- ref_column: $('#bookly-js-ref_column', $addConstraintModal).html(),
175
- delete_rule: $('#bookly-js-DELETE_RULE', $addConstraintModal).val(),
176
- update_rule: $('#bookly-js-UPDATE_RULE', $addConstraintModal).val(),
177
- csrf_token: BooklyL10nGlobal.csrf_token
178
- },
179
- dataType: 'json',
180
- success: function (response) {
181
- if (response.success) {
182
- booklyAlert({success: [response.data.message]});
183
- $addConstraintModal.booklyModal('hide');
184
- $status.html('OK');
185
- } else {
186
- booklyAlert({error: [response.data.message]});
187
- $('.bookly-js-fix-consistency', $addConstraintModal).show();
188
- }
189
- ladda.stop();
190
- },
191
- error: function () {
192
- booklyAlert({error: ['Error: Constraint not created.']});
193
- ladda.stop();
194
- }
195
- });
196
- })
197
- .on('click', '[data-action=fix-consistency]', function (e) {
198
- e.preventDefault();
199
- let $button = $(this),
200
- table = $('#bookly-js-table', $addConstraintModal).html(),
201
- column = $('#bookly-js-column', $addConstraintModal).html(),
202
- ref_table = $('#bookly-js-ref_table', $addConstraintModal).html(),
203
- ref_column = $('#bookly-js-ref_column', $addConstraintModal).html(),
204
- data = {
205
- action: 'bookly_fix_consistency',
206
- table: $('#bookly-js-table', $addConstraintModal).html(),
207
- column: $('#bookly-js-column', $addConstraintModal).html(),
208
- ref_table: $('#bookly-js-ref_table', $addConstraintModal).html(),
209
- ref_column: $('#bookly-js-ref_column', $addConstraintModal).html(),
210
- csrf_token: BooklyL10nGlobal.csrf_token,
211
- rule: ''
212
- },
213
- query = '',
214
- ladda = ''
215
- ;
216
- if ($button.hasClass('bookly-js-auto')) {
217
- data.rule = $('#bookly-js-DELETE_RULE', $addConstraintModal).val();
218
- ladda = Ladda.create(this);
219
- } else {
220
- if ($button.hasClass('bookly-js-delete')) {
221
- data.rule = 'CASCADE';
222
- } else if ($button.hasClass('bookly-js-update')) {
223
- data.rule = 'SET NULL';
224
- }
225
- ladda = Ladda.create($('button[data-action=fix-consistency]')[0]);
226
- }
227
-
228
- switch (data.rule) {
229
- case 'NO ACTIONS':
230
- case 'RESTRICT':
231
- booklyAlert({success: ['No manipulation actions were performed']});
232
- return false;
233
- case 'CASCADE':
234
- query = 'DELETE FROM `' + table + "`\n" + ' WHERE `' + column + '` NOT IN ( SELECT `' + ref_column + '` FROM `' + ref_table + '` )';
235
- break;
236
- case 'SET NULL':
237
- query = 'UPDATE TABLE `' + table + "`\n" + ' SET `' + column + '` = NULL' + "\n" + ' WHERE `' + column + '` NOT IN ( SELECT `' + ref_column + '` FROM `' + ref_table + '` )';
238
- break;
239
- }
240
-
241
- if (confirm('IF YOU DON\'T KNOW WHAT WILL HAPPEN AFTER THIS QUERY EXECUTION? Click cancel.' + "\n\n---------------------------------------------------------------------------------------------------------------------------------\n\n" + query + "\n\n")) {
242
- ladda.start();
243
- $.ajax({
244
- url: ajaxurl,
245
- type: 'POST',
246
- data: data,
247
- dataType: 'json',
248
- success: function (response) {
249
- if (response.success) {
250
- booklyAlert({success: [response.data.message]});
251
- $('.bookly-js-fix-consistency', $addConstraintModal).hide();
252
- } else {
253
- booklyAlert({error: [response.data.message]});
254
- }
255
- ladda.stop();
256
- }
257
- });
258
- }
259
- });
260
-
261
- $('[data-action=fix-column]')
262
- .on('click', function (e) {
263
- e.preventDefault();
264
- $status = $(this).closest('td');
265
- let $tr = $(this).closest('tr'),
266
- table = $tr.closest('.card').find('.bookly-js-table').attr('id'),
267
- column = $tr.find('td:eq(0)').html().trim()
268
- ;
269
- $('.bookly-js-loading:first-child', $columnModal).addClass('bookly-loading').removeClass('collapse');
270
- $('.bookly-js-loading:last-child', $columnModal).addClass('collapse');
271
- $('.bookly-js-fix-consistency', $columnModal).hide();
272
- $columnModal.booklyModal();
273
- $.ajax({
274
- url: ajaxurl,
275
- type: 'POST',
276
- data: {
277
- action: 'bookly_get_field_data',
278
- table: table,
279
- column: column,
280
- csrf_token: BooklyL10nGlobal.csrf_token
281
- },
282
- dataType: 'json',
283
- success: function (response) {
284
- if (response.success) {
285
- let sql = 'ALTER TABLE `' + table + '`' +
286
- '\n ADD COLUMN `' + column + '` ' + response.data;
287
- $('pre', $columnModal).html(sql);
288
- } else {
289
- $('pre', $columnModal).html('');
290
- }
291
- $('.bookly-js-loading', $columnModal).toggleClass('collapse');
292
- }
293
- });
294
- });
295
-
296
- $columnModal
297
- .on('click', '.bookly-js-save', function () {
298
- let ladda = Ladda.create(this);
299
- ladda.start();
300
- $.ajax({
301
- url: ajaxurl,
302
- type: 'POST',
303
- data: {
304
- action: 'bookly_execute_query',
305
- query: $('pre', $columnModal).html(),
306
- csrf_token: BooklyL10nGlobal.csrf_token
307
- },
308
- dataType: 'json',
309
- success: function (response) {
310
- if (response.success) {
311
- booklyAlert({success: [response.data.message]});
312
- $columnModal.booklyModal('hide');
313
- $status.html('OK');
314
- $status.closest('tr').removeClass('bg-danger');
315
- } else {
316
- booklyAlert({error: [response.data.message]});
317
- }
318
- ladda.stop();
319
- },
320
- error: function () {
321
- booklyAlert({error: ['Error: in query execution.']});
322
- ladda.stop();
323
- }
324
- });
325
- });
326
-
327
- $('[data-action=fix-create-table]')
328
- .on('click', function (e) {
329
- e.preventDefault();
330
- $buttonAction = $(this);
331
- let table = $buttonAction.parent().attr('id');
332
- $('.bookly-js-loading:first-child', $tableModal).addClass('bookly-loading').removeClass('collapse');
333
- $('.bookly-js-loading:last-child', $tableModal).addClass('collapse');
334
- $tableModal.booklyModal();
335
- $.ajax({
336
- url: ajaxurl,
337
- type: 'POST',
338
- data: {
339
- action: 'bookly_get_field_data',
340
- table: table,
341
- column: 'id',
342
- csrf_token: BooklyL10nGlobal.csrf_token
343
- },
344
- dataType: 'json',
345
- success: function (response) {
346
- if (response.success) {
347
- let field = response.data.replace(' primary key', ','),
348
- sql = 'CREATE TABLE `' + table + '` (' +
349
- "\n `id` " + field +
350
- "\nPRIMARY KEY (`id`))" +
351
- "\nENGINE = INNODB" +
352
- "\n" + BooklyL10n.charsetCollate + ';';
353
- $('pre', $tableModal).html(sql);
354
- } else {
355
- $('pre', $tableModal).html('');
356
- }
357
- $('.bookly-js-loading', $tableModal).toggleClass('collapse');
358
- }
359
- });
360
- });
361
-
362
- $tableModal
363
- .on('click', '.bookly-js-save', function () {
364
- let ladda = Ladda.create(this);
365
- ladda.start();
366
- $.ajax({
367
- url: ajaxurl,
368
- type: 'POST',
369
- data: {
370
- action: 'bookly_execute_query',
371
- query: $('pre', $tableModal).html(),
372
- csrf_token: BooklyL10nGlobal.csrf_token
373
- },
374
- dataType: 'json',
375
- success: function (response) {
376
- if (response.success) {
377
- booklyAlert({success: [response.data.message]});
378
- $tableModal.booklyModal('hide');
379
- $buttonAction.closest('.panel').find('.panel-body').html('Refresh the current page');
380
- $buttonAction.remove();
381
- } else {
382
- booklyAlert({error: [response.data.message]});
383
- }
384
- ladda.stop();
385
- },
386
- error: function () {
387
- booklyAlert({error: ['Error: in query execution.']});
388
- ladda.stop();
389
- }
390
- });
391
- });
392
-
393
- $dropConstraintModal
394
- .on('click', '.bookly-js-save', function () {
395
- let ladda = Ladda.create(this),
396
- table = $('#bookly-js-table', $dropConstraintModal).html(),
397
- constrain = $('#bookly-js-constraint', $dropConstraintModal).html();
398
- ladda.start();
399
- $.ajax({
400
- url: ajaxurl,
401
- type: 'POST',
402
- data: {
403
- action: 'bookly_execute_query',
404
- query: 'ALTER TABLE `' + table + '` DROP FOREIGN KEY `' + constrain + '`',
405
- csrf_token: BooklyL10nGlobal.csrf_token
406
- },
407
- dataType: 'json',
408
- success: function (response) {
409
- if (response.success) {
410
- booklyAlert({success: [response.data.message]});
411
- $dropConstraintModal.booklyModal('hide');
412
- $buttonAction.closest('tr').remove();
413
- } else {
414
- booklyAlert({error: [response.data.message]});
415
- }
416
- ladda.stop();
417
- },
418
- error: function () {
419
- booklyAlert({error: ['Error: in query execution.']});
420
- ladda.stop();
421
- }
422
- });
423
- });
424
-
425
- $('[data-action=fix-charset_collate-table]')
426
- .on('click', function (e) {
427
- e.preventDefault();
428
- let $button = $(this),
429
- table = $button.closest('.bookly-js-table').attr('id'),
430
- query = 'ALTER TABLE `' + table + '`\n',
431
- title
432
- ;
433
-
434
- switch ($button.attr('data-fix')) {
435
- case '["character_set","collate"]':
436
- title = 'Fix CHARACTER SET and COLLATION'
437
- query += ' CHARACTER SET ' + BooklyL10n.character_set + '\n COLLATE ' + BooklyL10n.collate + ';'
438
- break;
439
- case '["character_set"]':
440
- title = 'Fix CHARACTER SET'
441
- query += ' CHARACTER SET ' + BooklyL10n.character_set + ';'
442
- break;
443
- }
444
-
445
- booklyModal(title, $('<pre>').html(query), 'Cancel', 'Fix')
446
- .on('bs.click.main.button', function (event, modal) {
447
- $.ajax({
448
- url: ajaxurl,
449
- type: 'POST',
450
- data: {
451
- action: 'bookly_fix_charset_collate',
452
- table: table,
453
- fix: $button.data('fix'),
454
- csrf_token: BooklyL10nGlobal.csrf_token
455
- },
456
- dataType: 'json',
457
- success: function (response) {
458
- if (response.success) {
459
- $button.remove()
460
- booklyAlert({success: [response.data.message]});
461
- modal.booklyModal('hide');
462
- } else {
463
- booklyAlert({error: [response.data.message]});
464
- }
465
- }
466
- });
467
- });
468
- });
469
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/modules/debug/resources/js/tools.js DELETED
@@ -1,177 +0,0 @@
1
- jQuery(function($) {
2
- let $tools = $('.bookly-js-tools'),
3
- $toolsResponseModal = $('#bookly-tool-response-dialog'),
4
- toolClass
5
- ;
6
-
7
- $tools.on('click', '[data-action]', function (e) {
8
- e.preventDefault();
9
- let $btn = $(this),
10
- ladda = Ladda.create($('a', $btn.closest('.dropdown'))[0]),
11
- data = $btn.data();
12
- ladda.start();
13
- $.ajax({
14
- url: ajaxurl,
15
- type: 'POST',
16
- data: {
17
- action: 'bookly_run_tool',
18
- tool: data,
19
- csrf_token: BooklyL10nGlobal.csrf_token
20
- },
21
- dataType: 'json',
22
- error: function () {
23
- booklyAlert({error: [data.tool + ' error: in query execution.']});
24
- }
25
- }).then(function (response) {
26
- booklyAlert(response.data.alerts);
27
- ladda.stop();
28
- $(document.body).trigger('bookly.tools.completed', [response.data, data.tool]);
29
- });
30
- });
31
-
32
- $('#bookly-all-test').on('click', function () {
33
- let ladda = Ladda.create(this),
34
- count = BooklyL10n.tests.length,
35
- error_count = 0,
36
- errors = []
37
- ladda.start();
38
- ladda.setProgress(0.03);
39
-
40
- BooklyL10n.tests.forEach(function(test) {
41
- $.ajax({
42
- url: ajaxurl,
43
- type: 'POST',
44
- data: {
45
- action: 'bookly_run_test',
46
- test_name: test
47
- },
48
- dataType: 'json',
49
- error: function () {
50
- booklyAlert({error: [test + ' error: in query execution.']});
51
- }
52
- }).then(function(response) {
53
- if (!response.success) {
54
- error_count += 1;
55
- booklyAlert({error: ['Test: ' + response.data.test_name + '<p><pre>' + response.data.error + '</pre></p>']});
56
- }
57
-
58
- count -= 1;
59
- ladda.setProgress(1 - count / BooklyL10n.tests.length);
60
- if (count <= 0) {
61
- ladda.stop();
62
- booklyAlert({success: [(BooklyL10n.tests.length - error_count) + '/' + BooklyL10n.tests.length + ' tests complete successfully']});
63
- }
64
- });
65
- })
66
- }).trigger('click');
67
-
68
- $(document.body).on('bookly.tools.completed', {},
69
- function (event, data, tool) {
70
- toolClass = tool;
71
- if (data.hasOwnProperty('result') && data.result && data.result.length > 0) {
72
- $toolsResponseModal.booklyModal('show');
73
- $('.modal-dialog', $toolsResponseModal).addClass('modal-xl');
74
- $('.modal-title', $toolsResponseModal).html(data.name);
75
- $('.modal-body', $toolsResponseModal).html(data.result);
76
- if (tool == 'Phpinfo') {
77
- $('.modal-dialog', $toolsResponseModal).addClass('modal-xl');
78
- } else {
79
- $('.modal-dialog', $toolsResponseModal).removeClass('modal-xl');
80
- }
81
- }
82
- }
83
- );
84
-
85
- $toolsResponseModal
86
- .on('hidden.bs.modal', function(){
87
- $('.modal-body', $toolsResponseModal).html('');
88
- })
89
-
90
- // Actions for tool ShortCodes
91
- .on('click', '#bookly-js-find-shortcode-and-open', function () {
92
- let ladda = Ladda.create(this);
93
- ladda.start();
94
-
95
- $.ajax({
96
- url: ajaxurl,
97
- type: 'POST',
98
- data: {
99
- action: 'bookly_run_tool',
100
- tool: {
101
- action: 'find_shortcode',
102
- tool: toolClass,
103
- shortcode: $('#bookly_shortcode', $toolsResponseModal).val(),
104
- },
105
- csrf_token: BooklyL10nGlobal.csrf_token
106
- },
107
- dataType: 'json',
108
- success: function (response) {
109
- if (response.success) {
110
- window.location.href = response.data.result;
111
- }
112
- booklyAlert(response.data.alerts);
113
- ladda.stop();
114
- }
115
- });
116
- })
117
-
118
- // Actions for tool FormsData
119
- .on('click', '#bookly-js-booking-forms button[data-action=copy]', function (e) {
120
- let $button = $(this),
121
- form_id = $button.closest('.list-group-item-action').data('form_id');
122
- $.ajax({
123
- url: ajaxurl,
124
- type: 'POST',
125
- data: {
126
- action: 'bookly_run_tool',
127
- tool: {
128
- action: 'get_data',
129
- tool: toolClass,
130
- form_id: form_id,
131
- },
132
- csrf_token: BooklyL10nGlobal.csrf_token
133
- },
134
- dataType: 'json',
135
- success: function (response) {
136
- let $copied = $('<small>', {
137
- class :'ml-2',
138
- text: 'copied'
139
- });
140
- $button.before($copied);
141
- $button.hide();
142
- const $temp = $('<input/>');
143
- $toolsResponseModal.append($temp);
144
- $temp.val(response.data.result).select();
145
- document.execCommand('copy');
146
- $temp.remove();
147
- console.group(form_id);
148
- console.dir(JSON.parse(response.data.result));
149
- console.groupEnd();
150
- setTimeout(function () {
151
- $copied.remove();
152
- $button.show();
153
- }, 1000);
154
- }
155
- });
156
- })
157
- .on('click', '#bookly-js-booking-forms button[data-action=destroy]', function (e) {
158
- let $li = $(this).closest('.list-group-item-action');
159
- $.ajax({
160
- url: ajaxurl,
161
- type: 'POST',
162
- data: {
163
- action: 'bookly_run_tool',
164
- tool: {
165
- action: 'destroy',
166
- tool: toolClass,
167
- form_id: $li.data('form_id'),
168
- },
169
- csrf_token: BooklyL10nGlobal.csrf_token
170
- },
171
- dataType: 'json',
172
- success: function (response) {
173
- $li.remove();
174
- }
175
- });
176
- });
177
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/modules/debug/templates/index.php DELETED
@@ -1,354 +0,0 @@
1
- <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
- use Bookly\Backend\Components\Controls\Inputs;
3
- use Bookly\Backend\Components\Controls\Buttons;
4
- use Bookly\Lib;
5
- ?>
6
- <div id="bookly-tbs" class="wrap">
7
- <div class="form-row align-items-center mb-3">
8
- <h4 class="col m-0">Data management</h4> <span class="text-muted">php: <?php echo PHP_VERSION ?> | db: <?php echo esc_html( $db['version'] ) ?></span>
9
- </div>
10
-
11
- <div class="form-row">
12
- <div class="col-12 col-sm-auto mb-3">
13
- <form action="<?php echo admin_url( 'admin-ajax.php?action=bookly_export_data' ) ?>" method="POST">
14
- <?php Inputs::renderCsrf() ?>
15
- <button id="bookly-export" type="submit" class="btn btn-success">
16
- <span class="ladda-label">Export data</span>
17
- </button>
18
- </form>
19
- </div>
20
- <div class="col-12 col-sm-auto mb-3">
21
- <form id="bookly_import" action="<?php echo admin_url( 'admin-ajax.php?action=bookly_import_data' ) ?>" method="POST" enctype="multipart/form-data">
22
- <?php Inputs::renderCsrf() ?>
23
- <div id="bookly-import" class="btn btn-primary btn-file">
24
- <span class="ladda-label">Import data</span>
25
- <input type="file" id="bookly_import_file" name="import" class="w-100">
26
- </div>
27
- </form>
28
- </div>
29
- <div class="col-12 col-sm-auto ml-auto mb-3">
30
- <div class="dropdown">
31
- <a class="btn btn-default dropdown-toggle ladda-button" href="#" data-spinner-size="40" data-style="zoom-in" data-spinner-color="rgb(62, 66, 74)" data-toggle="dropdown" aria-haspopup="true"
32
- aria-expanded="true">
33
- <span class="ladda-label">Tools</span>
34
- <span class="caret"></span>
35
- </a>
36
- <div class="dropdown-menu bookly-js-tools">
37
- <?php echo Lib\Utils\Common::stripScripts( $tools ) ?>
38
- </div>
39
- </div>
40
- </div>
41
- <div class='col-12 col-sm-auto mb-3'>
42
- <div class="dropdown">
43
- <a class="btn btn-default dropdown-toggle ladda-button" href="#" type="button" data-spinner-size="40" data-style="zoom-in" data-spinner-color="rgb(62, 66, 74)" data-toggle="dropdown" aria-haspopup="true"
44
- aria-expanded="true">
45
- <span class="ladda-label">Plugins</span>
46
- <span class="caret"></span>
47
- </a>
48
- <div class="dropdown-menu bookly-js-tools">
49
- <?php echo Lib\Utils\Common::stripScripts( $plugins ) ?>
50
- </div>
51
- </div>
52
- </div>
53
- <div class="col-12 col-sm-auto mb-3">
54
- <?php Bookly\Backend\Components\Controls\Buttons::render( 'bookly-all-test', 'btn-default', 'Tests', array( 'data-spinner-color' => 'rgb(62, 66, 74)' ) ) ?>
55
- </div>
56
- <div class="col-12 col-sm-auto mb-3">
57
- <?php Bookly\Backend\Components\Controls\Buttons::render( 'bookly-fix-all-silent', $trouble ? 'btn-success' : 'btn-default', 'Fix database schema…' ) ?>
58
- </div>
59
- </div>
60
-
61
- <div class="card">
62
- <div class="card-body" id="accordion" role="tablist" aria-multiselectable="true">
63
- <?php foreach ( $debug as $tableName => $table ) : ?>
64
- <div class="card bookly-collapse my-1">
65
- <div class="card-header py-1 d-flex align-items-center bookly-js-table <?php echo esc_attr( $table['status'] == 1 ? '' : ( $table['status'] == 2 ? 'bg-danger' : 'bg-info' ) ) ?>" role="tab" id="<?php echo esc_attr( $tableName ) ?>">
66
- <a role="button" class="collapsed" role="button" data-toggle="collapse" href="#table-<?php echo esc_attr( $tableName ) ?>" aria-expanded="true" aria-controls="<?php echo esc_attr( $tableName ) ?>">
67
- <?php echo esc_html( $tableName ) ?>
68
- </a>
69
- <?php if ( ! $table['status'] ) : ?>
70
- <button class="btn btn-success btn-sm py-0 ml-auto" type="button" data-action="fix-create-table">create</button>
71
- <?php else: ?>
72
- <?php if ( ! $table['valid']['character_set'] && ! $table['valid']['collation'] ) : ?>
73
- <button class="btn btn-success btn-sm py-0 ml-auto" type="button" data-action="fix-charset_collate-table" data-fix='["character_set","collate"]'>fix character set and collation</button>
74
- <?php else: ?>
75
- <?php if ( ! $table['valid']['character_set'] ) : ?>
76
- <button class="btn btn-success btn-sm py-0 ml-auto" type="button" data-action="fix-charset_collate-table" data-fix='["character_set"]'>fix character set</button>
77
- <?php endif ?>
78
- <?php endif ?>
79
- <?php endif ?>
80
- </div>
81
- <div class="card-body collapse" id="table-<?php echo esc_attr( $tableName ) ?>">
82
- <?php if ( $table['status'] ) : ?>
83
- <h5>Columns</h5>
84
- <table class="table table-condensed table-striped table-sm">
85
- <thead>
86
- <tr>
87
- <th>Column name</th>
88
- <th width="50">Status</th>
89
- </tr>
90
- </thead>
91
- <tbody>
92
- <?php foreach ( $table['fields'] as $field => $status ) : ?>
93
- <tr class="<?php echo esc_attr( $status ? 'bg-default' : 'bg-danger' ) ?>">
94
- <td><?php echo esc_html( $field ) ?>
95
- <?php if ( isset( $table['info'][ $field ] ) ) : ?>
96
- <div class="float-right">
97
- <?php foreach ( $table['info'][ $field ] as $key ) : ?>
98
- <span class="badge badge-warning" style="margin: 0 5px;"><?php echo esc_html( $key ) ?></span>
99
- <?php endforeach ?>
100
- </div>
101
- <?php endif ?>
102
- </td>
103
- <td><?php if ( $status ) : ?>
104
- OK
105
- <?php else : ?>
106
- <button class="btn btn-success btn-sm py-0" type="button" data-action="fix-column">FIX…</button>
107
- <?php endif ?>
108
- </td>
109
- </tr>
110
- <?php endforeach ?>
111
- <?php if ( isset( $table['fields_3d'] ) ) : ?>
112
- <tr>
113
- <th>Unknown columns</th>
114
- <th width="50">Action</th>
115
- </tr>
116
- <?php foreach ( $table['fields_3d'] as $field => $data ) : ?>
117
- <tr class="bg-warning">
118
- <td><span class="field" data-entity="<?php echo esc_attr( $data['class'] ) ?>"><?php echo esc_html( $field ) ?></span>
119
- <div class="float-right">
120
- <span class="badge badge-light" style="margin: 0 5px;">type: <?php echo esc_html( $data['type'] ) ?></span>
121
- <?php if ( $data['is_nullabe'] == '0' ) : ?>
122
- <span class="badge badge-light" style="margin: 0 5px;">not null</span>
123
- <?php endif ?>
124
- <?php if ( $data['default'] ) : ?>
125
- <span class="badge badge-light" style="margin: 0 5px;">default: <?php echo esc_html( $data['default'] ) ?></span>
126
- <?php endif ?>
127
- </div>
128
- </td>
129
- <td>
130
- <button class="btn btn-success btn-sm py-0" type="button" data-action="drop-column">DROP…</button>
131
- </td>
132
- </tr>
133
- <?php endforeach ?>
134
- <?php endif ?>
135
- </tbody>
136
- </table>
137
- <?php if ( $table['constraints'] ) : ?>
138
- <h5>Constraints</h5>
139
- <table class="table table-condensed table-striped table-sm">
140
- <thead>
141
- <tr>
142
- <th>Column name</th>
143
- <th>Referenced table name</th>
144
- <th>Referenced column name</th>
145
- <th width="50">Status</th>
146
- </tr>
147
- </thead>
148
- <tbody>
149
- <?php foreach ( $table['constraints'] as $key => $constraint ) : ?>
150
- <tr class="<?php echo esc_attr( $constraint['status'] ? 'bg-default' : 'bg-danger' ) ?>">
151
- <td><?php echo esc_html( $constraint['column_name'] ) ?></td>
152
- <td><?php echo esc_html( $constraint['referenced_table_name'] ) ?></td>
153
- <td><?php echo esc_html( $constraint['referenced_column_name'] ) ?></td>
154
- <td><?php if ( $constraint['status'] ) : ?>
155
- OK
156
- <?php else : ?>
157
- <button class="btn btn-success btn-sm py-0" type="button" data-action="fix-constraint">FIX…</button>
158
- <?php endif ?>
159
- </td>
160
- </tr>
161
- <?php endforeach ?>
162
- </tbody>
163
- </table>
164
- <?php endif ?>
165
- <?php if ( $table['constraints_3d'] ) : ?>
166
- <h5>Third-party constraints</h5>
167
- <table class="table table-condensed table-sm">
168
- <thead>
169
- <tr>
170
- <th>Column name</th>
171
- <th>Reference</th>
172
- <th>Name</th>
173
- <th width="50">Status</th>
174
- </tr>
175
- </thead>
176
- <tbody>
177
- <?php foreach ( $table['constraints_3d'] as $key => $constraint ) : ?>
178
- <tr class="<?php echo esc_attr( $constraint['status'] ? 'default' : 'danger' ) ?>">
179
- <td><?php echo esc_html( $constraint['column_name'] ) ?></td>
180
- <td><?php echo esc_html( $constraint['referenced_table_name'] . '.' . $constraint['referenced_column_name'] ) ?>
181
- <?php if ( ! $constraint['reference_exists'] ) : ?>
182
- <div class="float-right"><span class="badge badge-warning" style="margin: 0 5px;">not exist</span><?php endif ?></div>
183
- </td>
184
- <td><?php echo esc_html( $constraint['constraint_name'] ) ?></td>
185
- <td><?php if ( $constraint['status'] ) : ?>
186
- OK
187
- <?php else : ?>
188
- <button class="btn btn-sm py-0 <?php echo esc_attr( $constraint['reference_exists'] ? 'btn-danger' : 'btn-success' ) ?>" type="button" data-action="drop-constraint">DROP…</button>
189
- <?php endif ?>
190
- </td>
191
- </tr>
192
- <?php endforeach ?>
193
- </tbody>
194
- </table>
195
- <?php endif ?>
196
- <?php else : ?>
197
- Table does not exist
198
- <?php endif ?>
199
- </div>
200
- </div>
201
- <?php endforeach ?>
202
- </div>
203
- </div>
204
- <div id="bookly-js-add-constraint" class="bookly-modal bookly-fade" tabindex="-1" role="dialog">
205
- <div class="modal-dialog" role="document">
206
- <div class="modal-content">
207
- <div class="modal-header">
208
- <h5 class="modal-title">Add constraint</h5>
209
- <button type="button" class="close" data-dismiss="bookly-modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
210
- </div>
211
- <div class="modal-body">
212
- <div class="bookly-js-loading" style="height: 120px;"></div>
213
- <div class="bookly-js-loading">
214
- <pre>
215
- ALTER TABLE `<span id="bookly-js-table"></span>`
216
- ADD CONSTRAINT
217
- FOREIGN KEY (`<span id="bookly-js-column"></span>`)
218
- REFERENCES `<span id="bookly-js-ref_table"></span>` (`<span id="bookly-js-ref_column"></span>`)
219
- ON DELETE <select id="bookly-js-DELETE_RULE">
220
- <option></option>
221
- <option value="RESTRICT">RESTRICT</option>
222
- <option value="CASCADE">CASCADE</option>
223
- <option value="SET NULL">SET NULL</option>
224
- <option value="NO ACTIONS">NO ACTIONS</option>
225
- </select>
226
- ON UPDATE <select id="bookly-js-UPDATE_RULE">
227
- <option></option>
228
- <option value="RESTRICT">RESTRICT</option>
229
- <option value="CASCADE">CASCADE</option>
230
- <option value="SET NULL">SET NULL</option>
231
- <option value="NO ACTIONS">NO ACTIONS</option>
232
- </select></pre>
233
- </div>
234
- </div>
235
- <div class="modal-footer">
236
- <div class="pull-left">
237
- <div class="btn-group bookly-js-fix-consistency">
238
- <button type="button" class="btn btn-danger bookly-js-auto ladda-button" data-spinner-size="40" data-style="zoom-in" data-action="fix-consistency"><span class="ladda-label">Consistency…</span></button>
239
- <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
240
- <span class="caret"></span>
241
- <span class="sr-only">Toggle Dropdown</span>
242
- </button>
243
- <div class="dropdown-menu">
244
- <a class="bookly-js-update dropdown-item" href="#" data-action="fix-consistency">UPDATE `<span class="bookly-js-table"></span>` SET `<span class="bookly-js-ref_column"></span>` = NULL WHERE `<span class="bookly-js-ref_column"></span>` NOT IN (…)</a>
245
- <a class="bookly-js-delete dropdown-item" href="#" data-action="fix-consistency">DELETE FROM `<span class="bookly-js-table"></span>` WHERE `<span class="bookly-js-ref_column"></span>` NOT IN (…)</a>
246
- </div>
247
- </div>
248
- </div>
249
- <?php Buttons::render( null, 'bookly-js-delete btn-danger pull-left', 'Delete rows…', array( 'style' => 'display:none' ) ) ?>
250
- <?php Buttons::render( null, 'bookly-js-save btn-success', 'Add constraint' ) ?>
251
- <?php Buttons::renderCancel( 'Close' ) ?>
252
- </div>
253
- </div>
254
- </div>
255
- </div>
256
- <div id="bookly-js-add-field" class="bookly-modal bookly-fade" tabindex="-1" role="dialog">
257
- <div class="modal-dialog modal-lg" role="document">
258
- <div class="modal-content">
259
- <div class="modal-header">
260
- <h5 class="modal-title">Add column</h5>
261
- <button type="button" class="close" data-dismiss="bookly-modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
262
- </div>
263
- <div class="modal-body">
264
- <div class="bookly-js-loading" style="height: 120px;"></div>
265
- <div class="bookly-js-loading">
266
- <pre></pre>
267
- </div>
268
- </div>
269
- <div class="modal-footer">
270
- <?php Buttons::render( null, 'bookly-js-save btn-success', 'Add column' ) ?>
271
- <?php Buttons::renderCancel( 'Close' ) ?>
272
- </div>
273
- </div>
274
- </div>
275
- </div>
276
- <div id="bookly-js-create-table" class="bookly-modal bookly-fade" tabindex="-1" role="dialog">
277
- <div class="modal-dialog modal-lg" role="document">
278
- <div class="modal-content">
279
- <div class="modal-header">
280
- <h5 class="modal-title">Create table</h5>
281
- <button type="button" class="close" data-dismiss="bookly-modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
282
- </div>
283
- <div class="modal-body">
284
- <div class="bookly-js-loading" style="height: 120px;"></div>
285
- <div class="bookly-js-loading">
286
- <pre></pre>
287
- </div>
288
- </div>
289
- <div class="modal-footer">
290
- <?php Buttons::render( null, 'bookly-js-save btn-success', 'Create table' ) ?>
291
- <?php Buttons::renderCancel( 'Close' ) ?>
292
- </div>
293
- </div>
294
- </div>
295
- </div>
296
- <div id="bookly-js-drop-constraint" class="bookly-modal bookly-fade" tabindex="-1" role="dialog">
297
- <div class="modal-dialog" role="document">
298
- <div class="modal-content">
299
- <div class="modal-header">
300
- <h5 class="modal-title">Drop foreign key</h5>
301
- <button type="button" class="close" data-dismiss="bookly-modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
302
- </div>
303
- <div class="modal-body">
304
- <div class="bookly-js-loading"><pre>
305
- ALTER TABLE `<span id="bookly-js-table"></span>`
306
- DROP FOREIGN KEY `<span id="bookly-js-constraint"></span>`</pre>
307
- </div>
308
- </div>
309
- <div class="modal-footer">
310
- <?php Buttons::render( null, 'bookly-js-save btn-success', 'Drop' ) ?>
311
- <?php Buttons::renderCancel( 'Close' ) ?>
312
- </div>
313
- </div>
314
- </div>
315
- </div>
316
- <div id="bookly-js-drop-column" class="bookly-modal bookly-fade" tabindex="-1" role="dialog">
317
- <div class="modal-dialog" role="document">
318
- <div class="modal-content">
319
- <div class="modal-header">
320
- <h5 class="modal-title">Drop column with foreign keys</h5>
321
- <button type="button" class="close" data-dismiss="bookly-modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
322
- </div>
323
- <div class="modal-body">
324
- <div class="mb-4 h6">If there are foreign keys for <b id="bookly-js-column"></b>, they will be dropped with the column.</div>
325
- <pre>
326
- ALTER TABLE `<span id="bookly-js-table"></span>`
327
- DROP COLUMN `<span id="bookly-js-column"></span>`</pre>
328
- </div>
329
- <div class="modal-footer">
330
- <input type="hidden" id="bookly-js-entity">
331
- <?php Buttons::render( null, 'bookly-js-save btn-success', 'Drop' ) ?>
332
- <?php Buttons::renderCancel( 'Close' ) ?>
333
- </div>
334
- </div>
335
- </div>
336
- </div>
337
-
338
- <div id="bookly-tool-response-dialog" class="bookly-modal bookly-fade" tabindex=-1 role="dialog">
339
- <div class="modal-dialog">
340
- <div class="modal-content">
341
- <div class="modal-header">
342
- <h5 class="modal-title">Tools</h5>
343
- <button type="button" class="close" data-dismiss="bookly-modal" aria-label="Close"><span>&times;</span></button>
344
- </div>
345
- <div class="modal-body">
346
-
347
- </div>
348
- <div class="modal-footer">
349
- <?php Buttons::renderCancel( __( 'Close', 'bookly' ) ) ?>
350
- </div>
351
- </div>
352
- </div>
353
- </div>
354
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
backend/modules/diagnostics/Ajax.php ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics;
4
+
5
+ use Bookly\Backend\Modules\Diagnostics\Tests\Test;
6
+ use Bookly\Backend\Modules\Diagnostics\Tools\Tool;
7
+ use Bookly\Lib;
8
+
9
+
10
+ /**
11
+ * Class Ajax
12
+ *
13
+ * @package Bookly\Backend\Modules\Diagnostics
14
+ */
15
+ class Ajax extends Lib\Base\Ajax
16
+ {
17
+ protected static function permissions()
18
+ {
19
+ return array( 'diagnosticsAjax' => 'anonymous' );
20
+ }
21
+
22
+ /**
23
+ * Export database data.
24
+ */
25
+ public static function diagnosticsTestRun()
26
+ {
27
+ $test_name = self::parameter( 'test' );
28
+ $class = '\Bookly\Backend\Modules\Diagnostics\Tests\\' . $test_name;
29
+ if ( class_exists( $class ) ) {
30
+ /** @var Test $test */
31
+ $test = new $class();
32
+ if ( $test->execute() ) {
33
+ wp_send_json_success();
34
+ } else {
35
+ wp_send_json_error( array( 'test' => $test->getSlug(), 'errors' => $test->getErrors() ) );
36
+ }
37
+ }
38
+ }
39
+
40
+ /**
41
+ * Diagnostics ajax call: action=bookly_diagnostics_ajax&test=TestClassName&ajax=method
42
+ */
43
+ public static function diagnosticsAjax()
44
+ {
45
+ $ajax = self::parameter( 'ajax' );
46
+ if ( $test_name = self::parameter( 'test' ) ) {
47
+ $class = '\Bookly\Backend\Modules\Diagnostics\Tests\\' . $test_name;
48
+ if ( class_exists( $class ) ) {
49
+ /** @var Test $test */
50
+ $test = new $class();
51
+ if ( is_callable( array( $test, $ajax ) ) && method_exists( $test, $ajax ) && ! in_array( $ajax, array( 'execute', 'run' ) ) ) {
52
+ if ( in_array( $ajax, $test->ignore_csrf, false ) || parent::csrfTokenValid( __FUNCTION__ ) ) {
53
+ $test->$ajax( self::parameters() );
54
+ }
55
+ }
56
+ }
57
+ } elseif ( ( $tool_name = self::parameter( 'tool' ) ) && Lib\Utils\Common::isCurrentUserAdmin() ) {
58
+ $class = '\Bookly\Backend\Modules\Diagnostics\Tools\\' . $tool_name;
59
+ if ( class_exists( $class ) ) {
60
+ /** @var Tool $tool */
61
+ $tool = new $class();
62
+ if ( $ajax !== 'render' && is_callable( array( $tool, $ajax ) ) && method_exists( $tool, $ajax ) ) {
63
+ if ( parent::csrfTokenValid( __FUNCTION__ ) ) {
64
+ $tool->$ajax( self::parameters() );
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }
70
+
71
+
72
+ /**
73
+ * Export database data.
74
+ */
75
+ public static function exportData()
76
+ {
77
+ /** @global \wpdb $wpdb */
78
+ global $wpdb;
79
+
80
+ $result = array();
81
+ $schema = new Schema();
82
+ foreach ( apply_filters( 'bookly_plugins', array() ) as $plugin ) {
83
+ /** @var Lib\Base\Plugin $plugin */
84
+ $installer_class = $plugin::getRootNamespace() . '\Lib\Installer';
85
+ /** @var Lib\Base\Installer $installer */
86
+ $installer = new $installer_class();
87
+ $result['plugins'][ $plugin::getBasename() ] = $plugin::getVersion();
88
+
89
+ foreach ( $plugin::getEntityClasses() as $entity_class ) {
90
+ $table_name = $entity_class::getTableName();
91
+ $result['entities'][ $entity_class ] = array(
92
+ 'fields' => array_keys( $schema->getTableStructure( $table_name ) ),
93
+ 'values' => $wpdb->get_results( 'SELECT * FROM ' . $table_name, ARRAY_N ),
94
+ );
95
+ }
96
+ $plugin_prefix = $plugin::getPrefix();
97
+ $options_postfix = array( 'data_loaded', 'grace_start', 'db_version', 'installation_time' );
98
+ foreach ( $options_postfix as $option ) {
99
+ $option_name = $plugin_prefix . $option;
100
+ $result['options'][ $option_name ] = get_option( $option_name );
101
+ }
102
+
103
+ $result['options'][ $plugin::getPurchaseCodeOption() ] = $plugin::getPurchaseCode();
104
+ foreach ( $installer->getOptions() as $option_name => $option_value ) {
105
+ $result['options'][ $option_name ] = get_option( $option_name );
106
+ }
107
+ }
108
+
109
+ header( 'Content-type: application/json' );
110
+ header( 'Content-Disposition: attachment; filename=bookly_db_export_' . date( 'YmdHis' ) . '.json' );
111
+ echo json_encode( $result );
112
+
113
+ exit ( 0 );
114
+ }
115
+
116
+ /**
117
+ * Import database data.
118
+ */
119
+ public static function importData()
120
+ {
121
+ /** @global \wpdb $wpdb */
122
+ global $wpdb;
123
+ $fs = Lib\Utils\Common::getFilesystem();
124
+
125
+ if ( $_FILES['import']['name'] ) {
126
+ $json = $fs->get_contents( $_FILES['import']['tmp_name'] );
127
+ if ( $json !== false ) {
128
+ $wpdb->query( 'SET FOREIGN_KEY_CHECKS = 0' );
129
+
130
+ $data = json_decode( $json, true );
131
+ /** @var Lib\Base\Plugin[] $bookly_plugins */
132
+ $bookly_plugins = apply_filters( 'bookly_plugins', array() );
133
+ /** @since Bookly 17.7 */
134
+ if ( isset( $data['plugins'] ) ) {
135
+ foreach ( $bookly_plugins as $plugin ) {
136
+ if ( ! array_key_exists( $plugin::getBasename(), $data['plugins'] ) ) {
137
+ deactivate_plugins( $plugin::getBasename(), true, is_network_admin() );
138
+ }
139
+ }
140
+ }
141
+ foreach ( array_merge( array( 'bookly-responsive-appointment-booking-tool', 'bookly-addon-pro' ), array_keys( $bookly_plugins ) ) as $slug ) {
142
+ if ( ! array_key_exists( $slug, $bookly_plugins ) ) {
143
+ continue;
144
+ }
145
+ /** @var Lib\Base\Plugin $plugin */
146
+ $plugin = $bookly_plugins[ $slug ];
147
+ unset( $bookly_plugins[ $slug ] );
148
+ $installer_class = $plugin::getRootNamespace() . '\Lib\Installer';
149
+ /** @var Lib\Base\Installer $installer */
150
+ $installer = new $installer_class();
151
+
152
+ // Drop all data and options.
153
+ $installer->removeData();
154
+ $installer->dropTables();
155
+ $installer->createTables();
156
+
157
+ // Insert tables data.
158
+ foreach ( $plugin::getEntityClasses() as $entity_class ) {
159
+ if ( isset ( $data['entities'][ $entity_class ]['values'][0] ) ) {
160
+ $table_name = $entity_class::getTableName();
161
+ $query = sprintf(
162
+ 'INSERT INTO `%s` (`%s`) VALUES (%%s)',
163
+ $table_name,
164
+ implode( '`,`', $data['entities'][ $entity_class ]['fields'] )
165
+ );
166
+ $placeholders = array();
167
+ $values = array();
168
+ $counter = 0;
169
+ foreach ( $data['entities'][ $entity_class ]['values'] as $row ) {
170
+ $params = array();
171
+ foreach ( $row as $value ) {
172
+ if ( $value === null ) {
173
+ $params[] = 'NULL';
174
+ } else {
175
+ $params[] = '%s';
176
+ $values[] = $value;
177
+ }
178
+ }
179
+ $placeholders[] = implode( ',', $params );
180
+ if ( ++$counter > 50 ) {
181
+ // Flush.
182
+ $wpdb->query( $wpdb->prepare( sprintf( $query, implode( '),(', $placeholders ) ), $values ) );
183
+ $placeholders = array();
184
+ $values = array();
185
+ $counter = 0;
186
+ }
187
+ }
188
+ if ( ! empty ( $placeholders ) ) {
189
+ $wpdb->query( $wpdb->prepare( sprintf( $query, implode( '),(', $placeholders ) ), $values ) );
190
+ }
191
+ }
192
+ }
193
+
194
+ // Insert options data.
195
+ foreach ( $installer->getOptions() as $option_name => $option_value ) {
196
+ add_option( $option_name, $data['options'][ $option_name ] );
197
+ }
198
+
199
+ $plugin_prefix = $plugin::getPrefix();
200
+ $options_postfix = array( 'data_loaded', 'grace_start', 'db_version' );
201
+ foreach ( $options_postfix as $option ) {
202
+ $option_name = $plugin_prefix . $option;
203
+ add_option( $option_name, $data['options'][ $option_name ] );
204
+ }
205
+ }
206
+ }
207
+ }
208
+
209
+ header( 'Location: ' . admin_url( 'admin.php?page=bookly-diagnostics&debug' ) );
210
+
211
+ exit ( 0 );
212
+ }
213
+
214
+ protected static function csrfTokenValid( $action = null )
215
+ {
216
+ $excluded_actions = array(
217
+ 'diagnosticsAjax',
218
+ );
219
+
220
+ return in_array( $action, $excluded_actions ) || parent::csrfTokenValid( $action );
221
+ }
222
+ }
backend/modules/diagnostics/Page.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics;
4
+
5
+ use Bookly\Lib;
6
+
7
+ /**
8
+ * Class Diagnostics
9
+ *
10
+ * @package Bookly\Backend\Modules\Diagnostics
11
+ */
12
+ class Page extends Lib\Base\Component
13
+ {
14
+ /**
15
+ * Render page.
16
+ */
17
+ public static function render()
18
+ {
19
+ self::enqueueStyles( array(
20
+ 'backend' => array( 'css/fontawesome-all.min.css' => array( 'bookly-backend-globals' ) ),
21
+ 'module' => array( 'css/style.css' ),
22
+ ) );
23
+
24
+ self::enqueueScripts( array(
25
+ 'module' => array(
26
+ 'js/diagnostics.js' => array( 'bookly-backend-globals' ),
27
+ 'js/database.js' => array( 'bookly-backend-globals' ),
28
+ ),
29
+ ) );
30
+
31
+ $tools = array();
32
+ foreach ( glob( __DIR__ . '/tools/*.php' ) as $path ) {
33
+ $test = basename( $path, '.php' );
34
+ if ( $test !== 'Tool' ) {
35
+ $class_name = '\Bookly\Backend\Modules\Diagnostics\Tools\\' . $test;
36
+ if ( class_exists( $class_name, true ) ) {
37
+ $class = new $class_name;
38
+ if ( ! $class->isHidden() || self::hasParameter( 'debug' ) ) {
39
+ $tools[] = new $class;
40
+ }
41
+ }
42
+ }
43
+ }
44
+
45
+ $tests = array();
46
+ foreach ( glob( __DIR__ . '/tests/*.php' ) as $path ) {
47
+ $test = basename( $path, '.php' );
48
+ if ( $test !== 'Test' ) {
49
+ $class_name = '\Bookly\Backend\Modules\Diagnostics\Tests\\' . $test;
50
+ if ( class_exists( $class_name, true ) ) {
51
+ $class = new $class_name;
52
+ if ( ! $class->isHidden() || self::hasParameter( 'debug' ) ) {
53
+ $tests[] = new $class;
54
+ }
55
+ }
56
+ }
57
+ }
58
+
59
+ self::renderTemplate( 'index', compact( 'tests', 'tools' ) );
60
+ }
61
+
62
+ /**
63
+ * Show 'Diagnostics' submenu inside Bookly main menu
64
+ */
65
+ public static function addBooklyMenuItem()
66
+ {
67
+ $title = __( 'Diagnostics', 'bookly' );
68
+ add_submenu_page(
69
+ 'bookly-menu', $title, $title, Lib\Utils\Common::getRequiredCapability(),
70
+ self::pageSlug(), function () { Page::render(); }
71
+ );
72
+ }
73
+ }
backend/modules/diagnostics/QueryBuilder.php ADDED
@@ -0,0 +1,685 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics;
4
+
5
+ /**
6
+ * Class QueryBuilder
7
+ *
8
+ * @package Bookly\Backend\Modules\Diagnostics
9
+ */
10
+ class QueryBuilder
11
+ {
12
+ /**
13
+ * Get add column query
14
+ *
15
+ * @param string $table
16
+ * @param string $column
17
+ * @return string
18
+ */
19
+ public static function getAddColumn( $table, $column )
20
+ {
21
+ $data = self::getColumnData( $table, $column );
22
+ if ( $data ) {
23
+ return sprintf(
24
+ 'ALTER TABLE `%s` ADD COLUMN `%s` %s',
25
+ $table,
26
+ $column,
27
+ self::getColumnDataType( $data )
28
+ );
29
+ }
30
+
31
+ return '';
32
+ }
33
+
34
+ /**
35
+ * Get drop foreign key query
36
+ *
37
+ * @param string $table
38
+ * @param string $constraint_name
39
+ * @return string
40
+ */
41
+ public static function getDropForeignKey( $table, $constraint_name )
42
+ {
43
+ return sprintf(
44
+ 'ALTER TABLE `%s` DROP FOREIGN KEY `%s`',
45
+ $table,
46
+ $constraint_name
47
+ );
48
+ }
49
+
50
+ /**
51
+ * Get change column query
52
+ *
53
+ * @param string $table
54
+ * @param string $column
55
+ * @return string
56
+ */
57
+ public static function getChangeColumn( $table, $column )
58
+ {
59
+ $data = self::getColumnData( $table, $column );
60
+ if ( $data ) {
61
+ return sprintf(
62
+ 'ALTER TABLE `%1$s` CHANGE COLUMN `%2$s` `%2$s` %3$s',
63
+ $table,
64
+ $column,
65
+ self::getColumnDataType( $data )
66
+ );
67
+ }
68
+
69
+ return '';
70
+ }
71
+
72
+ /**
73
+ * Get add constraint query
74
+ *
75
+ * @param string $table
76
+ * @param string $column
77
+ * @param string $ref_table
78
+ * @param string $ref_column
79
+ * @return bool|string
80
+ */
81
+ public static function getAddConstraint( $table, $column, $ref_table, $ref_column )
82
+ {
83
+ $rules = self::getConstraintRules( $table, $column, $ref_table, $ref_column );
84
+ $sql = sprintf( 'ALTER TABLE `%s` ADD CONSTRAINT FOREIGN KEY (`%s`) REFERENCES `%s` (`%s`)', $table, $column, $ref_table, $ref_column );
85
+ $delete_rule = $rules['DELETE_RULE'];
86
+ switch ( $delete_rule ) {
87
+ case 'RESTRICT':
88
+ case 'CASCADE':
89
+ case 'SET NULL':
90
+ case 'NO ACTIONS':
91
+ $sql .= ' ON DELETE ' . $delete_rule;
92
+ break;
93
+ default:
94
+ return false;
95
+ }
96
+ $update_rule = $rules['UPDATE_RULE'];
97
+ switch ( $update_rule ) {
98
+ case 'RESTRICT':
99
+ case 'CASCADE':
100
+ case 'SET NULL':
101
+ case 'NO ACTIONS':
102
+ $sql .= ' ON UPDATE ' . $update_rule;
103
+ break;
104
+ default:
105
+ return false;
106
+ }
107
+
108
+ return $sql;
109
+ }
110
+
111
+ /**
112
+ * Get create table query
113
+ *
114
+ * @param string $table
115
+ * @return string
116
+ */
117
+ public static function getCreateTable( $table )
118
+ {
119
+ /** @global \wpdb */
120
+ global $wpdb;
121
+
122
+ return sprintf(
123
+ 'CREATE TABLE `%s` ( `id` %s, PRIMARY KEY (`id`)) ENGINE = INNODB %s',
124
+ $table,
125
+ str_replace( ' primary key', '', self::getColumnDataType( self::getColumnData( $table, 'id' ) ) ),
126
+ $wpdb->has_cap( 'collation' )
127
+ ? $wpdb->get_charset_collate()
128
+ : 'DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci'
129
+ );
130
+ }
131
+
132
+ /**
133
+ * Get column data type array
134
+ *
135
+ * @param string $table
136
+ * @param string $column
137
+ * @return array
138
+ */
139
+ public static function getColumnData( $table, $column )
140
+ {
141
+ /*
142
+ SELECT CONCAT ( '\'', CONCAT_WS( '.', SUBSTR(TABLE_NAME,4), COLUMN_NAME ), '\' => array( \'type\' => "', COLUMN_TYPE, '", \'is_nullabe\' => ', IF(IS_NULLABLE = 'NO', '0', '1' ), ', \'extra\' => "', EXTRA, '", \'default\' => ', CONCAT (
143
+ IF (COLUMN_DEFAULT is NULL, IF( IS_NULLABLE = 'NO', COALESCE(COLUMN_DEFAULT,'null'), 'null' ), CONCAT('"',COALESCE(COLUMN_DEFAULT,''), '"'))), ', \'key\' => "' , COLUMN_KEY ,'" ),'
144
+ ) as l
145
+ FROM INFORMATION_SCHEMA.COLUMNS
146
+ WHERE TABLE_SCHEMA = SCHEMA()
147
+ AND TABLE_NAME LIKE 'wp_bookly_%'
148
+ ORDER BY TABLE_NAME, ORDINAL_POSITION
149
+ */
150
+
151
+ $data = array(
152
+ 'bookly_appointments.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
153
+ 'bookly_appointments.location_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
154
+ 'bookly_appointments.staff_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
155
+ 'bookly_appointments.staff_any' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
156
+ 'bookly_appointments.service_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
157
+ 'bookly_appointments.custom_service_name' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
158
+ 'bookly_appointments.custom_service_price' => array( 'type' => "decimal(10,2)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
159
+ 'bookly_appointments.start_date' => array( 'type' => "datetime", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
160
+ 'bookly_appointments.end_date' => array( 'type' => "datetime", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
161
+ 'bookly_appointments.extras_duration' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
162
+ 'bookly_appointments.internal_note' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
163
+ 'bookly_appointments.google_event_id' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
164
+ 'bookly_appointments.google_event_etag' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
165
+ 'bookly_appointments.outlook_event_id' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
166
+ 'bookly_appointments.outlook_event_change_key' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
167
+ 'bookly_appointments.outlook_event_series_id' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
168
+ 'bookly_appointments.online_meeting_provider' => array( 'type' => "enum('zoom','google_meet','jitsi','bbb')", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
169
+ 'bookly_appointments.online_meeting_id' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
170
+ 'bookly_appointments.online_meeting_data' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
171
+ 'bookly_appointments.created_from' => array( 'type' => "enum('bookly','google','outlook')", 'is_nullabe' => 0, 'extra' => "", 'default' => "bookly", 'key' => "" ),
172
+ 'bookly_appointments.created_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
173
+ 'bookly_appointments.updated_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
174
+ 'bookly_categories.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
175
+ 'bookly_categories.name' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
176
+ 'bookly_categories.attachment_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
177
+ 'bookly_categories.info' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
178
+ 'bookly_categories.position' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "9999", 'key' => "" ),
179
+ 'bookly_coupon_customers.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
180
+ 'bookly_coupon_customers.coupon_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
181
+ 'bookly_coupon_customers.customer_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
182
+ 'bookly_coupon_services.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
183
+ 'bookly_coupon_services.coupon_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
184
+ 'bookly_coupon_services.service_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
185
+ 'bookly_coupon_staff.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
186
+ 'bookly_coupon_staff.coupon_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
187
+ 'bookly_coupon_staff.staff_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
188
+ 'bookly_coupons.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
189
+ 'bookly_coupons.code' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "", 'key' => "" ),
190
+ 'bookly_coupons.discount' => array( 'type' => "decimal(5,2)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0.00", 'key' => "" ),
191
+ 'bookly_coupons.deduction' => array( 'type' => "decimal(10,2)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0.00", 'key' => "" ),
192
+ 'bookly_coupons.usage_limit' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => "1", 'key' => "" ),
193
+ 'bookly_coupons.used' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
194
+ 'bookly_coupons.once_per_customer' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
195
+ 'bookly_coupons.date_limit_start' => array( 'type' => "date", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
196
+ 'bookly_coupons.date_limit_end' => array( 'type' => "date", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
197
+ 'bookly_coupons.min_appointments' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => "1", 'key' => "" ),
198
+ 'bookly_coupons.max_appointments' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
199
+ 'bookly_custom_statuses.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
200
+ 'bookly_custom_statuses.slug' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "UNI" ),
201
+ 'bookly_custom_statuses.name' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
202
+ 'bookly_custom_statuses.busy' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "1", 'key' => "" ),
203
+ 'bookly_custom_statuses.color' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "#dddddd", 'key' => "" ),
204
+ 'bookly_custom_statuses.position' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "9999", 'key' => "" ),
205
+ 'bookly_customer_appointment_files.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
206
+ 'bookly_customer_appointment_files.customer_appointment_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
207
+ 'bookly_customer_appointment_files.file_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
208
+ 'bookly_customer_appointments.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
209
+ 'bookly_customer_appointments.series_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
210
+ 'bookly_customer_appointments.package_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
211
+ 'bookly_customer_appointments.customer_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
212
+ 'bookly_customer_appointments.appointment_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
213
+ 'bookly_customer_appointments.payment_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
214
+ 'bookly_customer_appointments.order_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
215
+ 'bookly_customer_appointments.number_of_persons' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => "1", 'key' => "" ),
216
+ 'bookly_customer_appointments.units' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => "1", 'key' => "" ),
217
+ 'bookly_customer_appointments.notes' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
218
+ 'bookly_customer_appointments.extras' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
219
+ 'bookly_customer_appointments.extras_multiply_nop' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "1", 'key' => "" ),
220
+ 'bookly_customer_appointments.custom_fields' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
221
+ 'bookly_customer_appointments.status' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "approved", 'key' => "" ),
222
+ 'bookly_customer_appointments.status_changed_at' => array( 'type' => "datetime", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
223
+ 'bookly_customer_appointments.token' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
224
+ 'bookly_customer_appointments.time_zone' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
225
+ 'bookly_customer_appointments.time_zone_offset' => array( 'type' => "int", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
226
+ 'bookly_customer_appointments.rating' => array( 'type' => "int", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
227
+ 'bookly_customer_appointments.rating_comment' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
228
+ 'bookly_customer_appointments.locale' => array( 'type' => "varchar(8)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
229
+ 'bookly_customer_appointments.collaborative_service_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
230
+ 'bookly_customer_appointments.collaborative_token' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
231
+ 'bookly_customer_appointments.compound_service_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
232
+ 'bookly_customer_appointments.compound_token' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
233
+ 'bookly_customer_appointments.created_from' => array( 'type' => "enum('frontend','backend')", 'is_nullabe' => 0, 'extra' => "", 'default' => "frontend", 'key' => "" ),
234
+ 'bookly_customer_appointments.created_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
235
+ 'bookly_customer_appointments.updated_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
236
+ 'bookly_customer_groups.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
237
+ 'bookly_customer_groups.name' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
238
+ 'bookly_customer_groups.description' => array( 'type' => "text", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
239
+ 'bookly_customer_groups.appointment_status' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "", 'key' => "" ),
240
+ 'bookly_customer_groups.discount' => array( 'type' => "varchar(100)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
241
+ 'bookly_customer_groups.skip_payment' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
242
+ 'bookly_customer_groups.gateways' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
243
+ 'bookly_customer_groups_services.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
244
+ 'bookly_customer_groups_services.group_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
245
+ 'bookly_customer_groups_services.service_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
246
+ 'bookly_customers.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
247
+ 'bookly_customers.wp_user_id' => array( 'type' => "bigint unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
248
+ 'bookly_customers.facebook_id' => array( 'type' => "bigint unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
249
+ 'bookly_customers.group_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
250
+ 'bookly_customers.full_name' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "", 'key' => "" ),
251
+ 'bookly_customers.first_name' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "", 'key' => "" ),
252
+ 'bookly_customers.last_name' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "", 'key' => "" ),
253
+ 'bookly_customers.phone' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "", 'key' => "" ),
254
+ 'bookly_customers.email' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "", 'key' => "" ),
255
+ 'bookly_customers.birthday' => array( 'type' => "date", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
256
+ 'bookly_customers.country' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
257
+ 'bookly_customers.state' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
258
+ 'bookly_customers.postcode' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
259
+ 'bookly_customers.city' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
260
+ 'bookly_customers.street' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
261
+ 'bookly_customers.street_number' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
262
+ 'bookly_customers.additional_address' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
263
+ 'bookly_customers.notes' => array( 'type' => "text", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
264
+ 'bookly_customers.info_fields' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
265
+ 'bookly_customers.stripe_account' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
266
+ 'bookly_customers.created_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
267
+ 'bookly_discounts.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
268
+ 'bookly_discounts.title' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => "", 'key' => "" ),
269
+ 'bookly_discounts.type' => array( 'type' => "enum('nop','appointments')", 'is_nullabe' => 0, 'extra' => "", 'default' => "nop", 'key' => "" ),
270
+ 'bookly_discounts.threshold' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
271
+ 'bookly_discounts.discount' => array( 'type' => "decimal(5,2)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0.00", 'key' => "" ),
272
+ 'bookly_discounts.deduction' => array( 'type' => "decimal(10,2)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0.00", 'key' => "" ),
273
+ 'bookly_discounts.date_start' => array( 'type' => "date", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
274
+ 'bookly_discounts.date_end' => array( 'type' => "date", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
275
+ 'bookly_discounts.enabled' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
276
+ 'bookly_email_log.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
277
+ 'bookly_email_log.to' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
278
+ 'bookly_email_log.subject' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
279
+ 'bookly_email_log.body' => array( 'type' => "text", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
280
+ 'bookly_email_log.headers' => array( 'type' => "text", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
281
+ 'bookly_email_log.attach' => array( 'type' => "text", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
282
+ 'bookly_email_log.type' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "", 'key' => "" ),
283
+ 'bookly_email_log.created_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
284
+ 'bookly_files.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
285
+ 'bookly_files.name' => array( 'type' => "text", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
286
+ 'bookly_files.slug' => array( 'type' => "varchar(32)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
287
+ 'bookly_files.path' => array( 'type' => "text", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
288
+ 'bookly_files.custom_field_id' => array( 'type' => "int", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
289
+ 'bookly_holidays.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
290
+ 'bookly_holidays.staff_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
291
+ 'bookly_holidays.parent_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
292
+ 'bookly_holidays.date' => array( 'type' => "date", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
293
+ 'bookly_holidays.repeat_event' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
294
+ 'bookly_locations.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
295
+ 'bookly_locations.name' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => "", 'key' => "" ),
296
+ 'bookly_locations.info' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
297
+ 'bookly_locations.position' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "9999", 'key' => "" ),
298
+ 'bookly_log.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
299
+ 'bookly_log.action' => array( 'type' => "enum('create','update','delete','error')", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
300
+ 'bookly_log.target' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
301
+ 'bookly_log.target_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
302
+ 'bookly_log.author' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
303
+ 'bookly_log.details' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
304
+ 'bookly_log.ref' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
305
+ 'bookly_log.comment' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
306
+ 'bookly_log.created_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
307
+ 'bookly_mailing_campaigns.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
308
+ 'bookly_mailing_campaigns.mailing_list_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
309
+ 'bookly_mailing_campaigns.name' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
310
+ 'bookly_mailing_campaigns.text' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
311
+ 'bookly_mailing_campaigns.state' => array( 'type' => "enum('pending','in-progress','completed','canceled')", 'is_nullabe' => 0, 'extra' => "", 'default' => "pending", 'key' => "" ),
312
+ 'bookly_mailing_campaigns.send_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
313
+ 'bookly_mailing_campaigns.created_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
314
+ 'bookly_mailing_list_recipients.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
315
+ 'bookly_mailing_list_recipients.mailing_list_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
316
+ 'bookly_mailing_list_recipients.name' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
317
+ 'bookly_mailing_list_recipients.phone' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
318
+ 'bookly_mailing_list_recipients.created_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
319
+ 'bookly_mailing_lists.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
320
+ 'bookly_mailing_lists.name' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
321
+ 'bookly_mailing_queue.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
322
+ 'bookly_mailing_queue.phone' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
323
+ 'bookly_mailing_queue.text' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
324
+ 'bookly_mailing_queue.sent' => array( 'type' => "tinyint(1)", 'is_nullabe' => 1, 'extra' => "", 'default' => "0", 'key' => "" ),
325
+ 'bookly_mailing_queue.campaign_id' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
326
+ 'bookly_mailing_queue.created_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
327
+ 'bookly_news.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
328
+ 'bookly_news.news_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
329
+ 'bookly_news.title' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
330
+ 'bookly_news.media_type' => array( 'type' => "enum('image','youtube')", 'is_nullabe' => 0, 'extra' => "", 'default' => "image", 'key' => "" ),
331
+ 'bookly_news.media_url' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
332
+ 'bookly_news.text' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
333
+ 'bookly_news.button_url' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
334
+ 'bookly_news.button_text' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
335
+ 'bookly_news.seen' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
336
+ 'bookly_news.updated_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
337
+ 'bookly_news.created_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
338
+ 'bookly_notifications.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
339
+ 'bookly_notifications.gateway' => array( 'type' => "enum('email','sms')", 'is_nullabe' => 0, 'extra' => "", 'default' => "email", 'key' => "" ),
340
+ 'bookly_notifications.type' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "", 'key' => "" ),
341
+ 'bookly_notifications.active' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
342
+ 'bookly_notifications.name' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "", 'key' => "" ),
343
+ 'bookly_notifications.subject' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "", 'key' => "" ),
344
+ 'bookly_notifications.message' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
345
+ 'bookly_notifications.to_staff' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
346
+ 'bookly_notifications.to_customer' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
347
+ 'bookly_notifications.to_admin' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
348
+ 'bookly_notifications.to_custom' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
349
+ 'bookly_notifications.custom_recipients' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
350
+ 'bookly_notifications.attach_ics' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
351
+ 'bookly_notifications.attach_invoice' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
352
+ 'bookly_notifications.settings' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
353
+ 'bookly_orders.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
354
+ 'bookly_orders.token' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
355
+ 'bookly_packages.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
356
+ 'bookly_packages.location_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
357
+ 'bookly_packages.staff_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
358
+ 'bookly_packages.service_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
359
+ 'bookly_packages.customer_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
360
+ 'bookly_packages.internal_note' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
361
+ 'bookly_packages.payment_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
362
+ 'bookly_packages.created_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
363
+ 'bookly_payments.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
364
+ 'bookly_payments.target' => array( 'type' => "enum('appointments','packages')", 'is_nullabe' => 0, 'extra' => "", 'default' => "appointments", 'key' => "" ),
365
+ 'bookly_payments.coupon_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
366
+ 'bookly_payments.type' => array( 'type' => "enum('local','free','paypal','authorize_net','stripe','2checkout','payu_biz','payu_latam','payson','mollie','woocommerce','cloud_stripe','square')", 'is_nullabe' => 0, 'extra' => "", 'default' => "local", 'key' => "", ),
367
+ 'bookly_payments.total' => array( 'type' => "decimal(10,2)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0.00", 'key' => "" ),
368
+ 'bookly_payments.tax' => array( 'type' => "decimal(10,2)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0.00", 'key' => "" ),
369
+ 'bookly_payments.paid' => array( 'type' => "decimal(10,2)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0.00", 'key' => "" ),
370
+ 'bookly_payments.paid_type' => array( 'type' => "enum('in_full','deposit')", 'is_nullabe' => 0, 'extra' => "", 'default' => "in_full", 'key' => "" ),
371
+ 'bookly_payments.gateway_price_correction' => array( 'type' => "decimal(10,2)", 'is_nullabe' => 1, 'extra' => "", 'default' => "0.00", 'key' => "" ),
372
+ 'bookly_payments.status' => array( 'type' => "enum('pending','completed','rejected','refunded')", 'is_nullabe' => 0, 'extra' => "", 'default' => "completed", 'key' => "" ),
373
+ 'bookly_payments.token' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
374
+ 'bookly_payments.details' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
375
+ 'bookly_payments.ref_id' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
376
+ 'bookly_payments.created_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
377
+ 'bookly_payments.updated_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
378
+ 'bookly_schedule_item_breaks.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
379
+ 'bookly_schedule_item_breaks.staff_schedule_item_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
380
+ 'bookly_schedule_item_breaks.start_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
381
+ 'bookly_schedule_item_breaks.end_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
382
+ 'bookly_sent_notifications.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
383
+ 'bookly_sent_notifications.ref_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
384
+ 'bookly_sent_notifications.notification_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
385
+ 'bookly_sent_notifications.created_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
386
+ 'bookly_series.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
387
+ 'bookly_series.repeat' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
388
+ 'bookly_series.token' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
389
+ 'bookly_service_discounts.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
390
+ 'bookly_service_discounts.service_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
391
+ 'bookly_service_discounts.discount_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
392
+ 'bookly_service_extras.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
393
+ 'bookly_service_extras.service_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
394
+ 'bookly_service_extras.attachment_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
395
+ 'bookly_service_extras.title' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => "", 'key' => "" ),
396
+ 'bookly_service_extras.duration' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
397
+ 'bookly_service_extras.price' => array( 'type' => "decimal(10,2)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0.00", 'key' => "" ),
398
+ 'bookly_service_extras.min_quantity' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
399
+ 'bookly_service_extras.max_quantity' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "1", 'key' => "" ),
400
+ 'bookly_service_extras.position' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "9999", 'key' => "" ),
401
+ 'bookly_service_schedule_breaks.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
402
+ 'bookly_service_schedule_breaks.service_schedule_day_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
403
+ 'bookly_service_schedule_breaks.start_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
404
+ 'bookly_service_schedule_breaks.end_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
405
+ 'bookly_service_schedule_days.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
406
+ 'bookly_service_schedule_days.service_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
407
+ 'bookly_service_schedule_days.day_index' => array( 'type' => "smallint", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
408
+ 'bookly_service_schedule_days.start_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
409
+ 'bookly_service_schedule_days.end_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
410
+ 'bookly_service_special_days.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
411
+ 'bookly_service_special_days.service_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
412
+ 'bookly_service_special_days.date' => array( 'type' => "date", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
413
+ 'bookly_service_special_days.start_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
414
+ 'bookly_service_special_days.end_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
415
+ 'bookly_service_special_days_breaks.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
416
+ 'bookly_service_special_days_breaks.service_special_day_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
417
+ 'bookly_service_special_days_breaks.start_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
418
+ 'bookly_service_special_days_breaks.end_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
419
+ 'bookly_service_taxes.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
420
+ 'bookly_service_taxes.service_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
421
+ 'bookly_service_taxes.tax_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
422
+ 'bookly_services.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
423
+ 'bookly_services.category_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
424
+ 'bookly_services.type' => array( 'type' => "enum('simple','collaborative','compound','package')", 'is_nullabe' => 0, 'extra' => "", 'default' => "simple", 'key' => "" ),
425
+ 'bookly_services.title' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => "", 'key' => "" ),
426
+ 'bookly_services.attachment_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
427
+ 'bookly_services.duration' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "900", 'key' => "" ),
428
+ 'bookly_services.slot_length' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "default", 'key' => "" ),
429
+ 'bookly_services.price' => array( 'type' => "decimal(10,2)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0.00", 'key' => "" ),
430
+ 'bookly_services.color' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "#FFFFFF", 'key' => "" ),
431
+ 'bookly_services.deposit' => array( 'type' => "varchar(100)", 'is_nullabe' => 0, 'extra' => "", 'default' => "100%", 'key' => "" ),
432
+ 'bookly_services.capacity_min' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "1", 'key' => "" ),
433
+ 'bookly_services.capacity_max' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "1", 'key' => "" ),
434
+ 'bookly_services.one_booking_per_slot' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
435
+ 'bookly_services.padding_left' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
436
+ 'bookly_services.padding_right' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
437
+ 'bookly_services.info' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
438
+ 'bookly_services.start_time_info' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => "", 'key' => "" ),
439
+ 'bookly_services.end_time_info' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => "", 'key' => "" ),
440
+ 'bookly_services.same_staff_for_subservices' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
441
+ 'bookly_services.units_min' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => "1", 'key' => "" ),
442
+ 'bookly_services.units_max' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => "1", 'key' => "" ),
443
+ 'bookly_services.package_life_time' => array( 'type' => "int", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
444
+ 'bookly_services.package_size' => array( 'type' => "int", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
445
+ 'bookly_services.package_unassigned' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
446
+ 'bookly_services.appointments_limit' => array( 'type' => "int", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
447
+ 'bookly_services.limit_period' => array( 'type' => "enum('off','day','week','month','year','upcoming','calendar_day','calendar_week','calendar_month','calendar_year')", 'is_nullabe' => 0, 'extra' => "", 'default' => "off", 'key' => "", ),
448
+ 'bookly_services.staff_preference' => array( 'type' => "enum('order','least_occupied','most_occupied','least_occupied_for_period','most_occupied_for_period','least_expensive','most_expensive')", 'is_nullabe' => 0, 'extra' => "", 'default' => "most_expensive", 'key' => "", ),
449
+ 'bookly_services.staff_preference_settings' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
450
+ 'bookly_services.recurrence_enabled' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "1", 'key' => "" ),
451
+ 'bookly_services.recurrence_frequencies' => array( 'type' => "set('daily','weekly','biweekly','monthly')", 'is_nullabe' => 0, 'extra' => "", 'default' => "daily,weekly,biweekly,monthly", 'key' => "" ),
452
+ 'bookly_services.time_requirements' => array( 'type' => "enum('required','optional','off')", 'is_nullabe' => 0, 'extra' => "", 'default' => "required", 'key' => "" ),
453
+ 'bookly_services.collaborative_equal_duration' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
454
+ 'bookly_services.online_meetings' => array( 'type' => "enum('off','zoom','google_meet','jitsi','bbb')", 'is_nullabe' => 0, 'extra' => "", 'default' => "off", 'key' => "" ),
455
+ 'bookly_services.final_step_url' => array( 'type' => "varchar(512)", 'is_nullabe' => 0, 'extra' => "", 'default' => "", 'key' => "" ),
456
+ 'bookly_services.wc_product_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
457
+ 'bookly_services.wc_cart_info_name' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
458
+ 'bookly_services.wc_cart_info' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
459
+ 'bookly_services.min_time_prior_booking' => array( 'type' => "int", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
460
+ 'bookly_services.min_time_prior_cancel' => array( 'type' => "int", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
461
+ 'bookly_services.visibility' => array( 'type' => "enum('public','private','group')", 'is_nullabe' => 0, 'extra' => "", 'default' => "public", 'key' => "" ),
462
+ 'bookly_services.position' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "9999", 'key' => "" ),
463
+ 'bookly_shop.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
464
+ 'bookly_shop.plugin_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
465
+ 'bookly_shop.type' => array( 'type' => "enum('plugin','bundle')", 'is_nullabe' => 0, 'extra' => "", 'default' => "plugin", 'key' => "" ),
466
+ 'bookly_shop.highlighted' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
467
+ 'bookly_shop.priority' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => "0", 'key' => "" ),
468
+ 'bookly_shop.demo_url' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
469
+ 'bookly_shop.title' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
470
+ 'bookly_shop.slug' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
471
+ 'bookly_shop.description' => array( 'type' => "text", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
472
+ 'bookly_shop.url' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
473
+ 'bookly_shop.icon' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
474
+ 'bookly_shop.price' => array( 'type' => "decimal(10,2)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
475
+ 'bookly_shop.sales' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
476
+ 'bookly_shop.rating' => array( 'type' => "decimal(10,2)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
477
+ 'bookly_shop.reviews' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
478
+ 'bookly_shop.published' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
479
+ 'bookly_shop.seen' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
480
+ 'bookly_shop.created_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
481
+ 'bookly_special_days_breaks.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
482
+ 'bookly_special_days_breaks.staff_special_day_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
483
+ 'bookly_special_days_breaks.start_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
484
+ 'bookly_special_days_breaks.end_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
485
+ 'bookly_staff.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
486
+ 'bookly_staff.category_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
487
+ 'bookly_staff.wp_user_id' => array( 'type' => "bigint unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
488
+ 'bookly_staff.attachment_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
489
+ 'bookly_staff.full_name' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
490
+ 'bookly_staff.email' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
491
+ 'bookly_staff.phone' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
492
+ 'bookly_staff.time_zone' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
493
+ 'bookly_staff.info' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
494
+ 'bookly_staff.working_time_limit' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
495
+ 'bookly_staff.visibility' => array( 'type' => "enum('public','private','archive')", 'is_nullabe' => 0, 'extra' => "", 'default' => "public", 'key' => "" ),
496
+ 'bookly_staff.position' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "9999", 'key' => "" ),
497
+ 'bookly_staff.google_data' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
498
+ 'bookly_staff.outlook_data' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
499
+ 'bookly_staff.zoom_authentication' => array( 'type' => "enum('default','jwt','oauth')", 'is_nullabe' => 0, 'extra' => "", 'default' => "default", 'key' => "" ),
500
+ 'bookly_staff.zoom_jwt_api_key' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
501
+ 'bookly_staff.zoom_jwt_api_secret' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
502
+ 'bookly_staff.zoom_oauth_token' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
503
+ 'bookly_staff.icalendar' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
504
+ 'bookly_staff.icalendar_token' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
505
+ 'bookly_staff.icalendar_days_before' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "365", 'key' => "" ),
506
+ 'bookly_staff.icalendar_days_after' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "365", 'key' => "" ),
507
+ 'bookly_staff.color' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "#dddddd", 'key' => "" ),
508
+ 'bookly_staff.gateways' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
509
+ 'bookly_staff_categories.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
510
+ 'bookly_staff_categories.name' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
511
+ 'bookly_staff_categories.position' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "9999", 'key' => "" ),
512
+ 'bookly_staff_locations.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
513
+ 'bookly_staff_locations.staff_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
514
+ 'bookly_staff_locations.location_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
515
+ 'bookly_staff_locations.custom_services' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
516
+ 'bookly_staff_locations.custom_schedule' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
517
+ 'bookly_staff_locations.custom_special_days' => array( 'type' => "tinyint(1)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0", 'key' => "" ),
518
+ 'bookly_staff_preference_orders.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
519
+ 'bookly_staff_preference_orders.service_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
520
+ 'bookly_staff_preference_orders.staff_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
521
+ 'bookly_staff_preference_orders.position' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "9999", 'key' => "" ),
522
+ 'bookly_staff_schedule_items.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
523
+ 'bookly_staff_schedule_items.staff_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
524
+ 'bookly_staff_schedule_items.location_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
525
+ 'bookly_staff_schedule_items.day_index' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
526
+ 'bookly_staff_schedule_items.start_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
527
+ 'bookly_staff_schedule_items.end_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
528
+ 'bookly_staff_services.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
529
+ 'bookly_staff_services.staff_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
530
+ 'bookly_staff_services.service_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
531
+ 'bookly_staff_services.location_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
532
+ 'bookly_staff_services.price' => array( 'type' => "decimal(10,2)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0.00", 'key' => "" ),
533
+ 'bookly_staff_services.deposit' => array( 'type' => "varchar(100)", 'is_nullabe' => 0, 'extra' => "", 'default' => "100%", 'key' => "" ),
534
+ 'bookly_staff_services.capacity_min' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "1", 'key' => "" ),
535
+ 'bookly_staff_services.capacity_max' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "1", 'key' => "" ),
536
+ 'bookly_staff_special_days.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
537
+ 'bookly_staff_special_days.staff_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
538
+ 'bookly_staff_special_days.location_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
539
+ 'bookly_staff_special_days.date' => array( 'type' => "date", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
540
+ 'bookly_staff_special_days.start_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
541
+ 'bookly_staff_special_days.end_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
542
+ 'bookly_staff_special_hours.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
543
+ 'bookly_staff_special_hours.staff_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
544
+ 'bookly_staff_special_hours.service_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
545
+ 'bookly_staff_special_hours.location_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
546
+ 'bookly_staff_special_hours.start_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
547
+ 'bookly_staff_special_hours.end_time' => array( 'type' => "time", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
548
+ 'bookly_staff_special_hours.days' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => "1,2,3,4,5,6,7", 'key' => "" ),
549
+ 'bookly_staff_special_hours.price' => array( 'type' => "decimal(10,2)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0.00", 'key' => "" ),
550
+ 'bookly_stats.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
551
+ 'bookly_stats.name' => array( 'type' => "varchar(255)", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
552
+ 'bookly_stats.value' => array( 'type' => "text", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
553
+ 'bookly_stats.created_at' => array( 'type' => "datetime", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "" ),
554
+ 'bookly_sub_services.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
555
+ 'bookly_sub_services.type' => array( 'type' => "enum('service','spare_time')", 'is_nullabe' => 0, 'extra' => "", 'default' => "service", 'key' => "" ),
556
+ 'bookly_sub_services.service_id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "", 'default' => null, 'key' => "MUL" ),
557
+ 'bookly_sub_services.sub_service_id' => array( 'type' => "int unsigned", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "MUL" ),
558
+ 'bookly_sub_services.duration' => array( 'type' => "int", 'is_nullabe' => 1, 'extra' => "", 'default' => null, 'key' => "" ),
559
+ 'bookly_sub_services.position' => array( 'type' => "int", 'is_nullabe' => 0, 'extra' => "", 'default' => "9999", 'key' => "" ),
560
+ 'bookly_taxes.id' => array( 'type' => "int unsigned", 'is_nullabe' => 0, 'extra' => "auto_increment", 'default' => null, 'key' => "PRI" ),
561
+ 'bookly_taxes.title' => array( 'type' => "varchar(255)", 'is_nullabe' => 1, 'extra' => "", 'default' => "", 'key' => "" ),
562
+ 'bookly_taxes.rate' => array( 'type' => "decimal(10,3)", 'is_nullabe' => 0, 'extra' => "", 'default' => "0.000", 'key' => "" ),
563
+ );
564
+
565
+ /** @global \wpdb */
566
+ global $wpdb;
567
+
568
+ $prefix_len = strlen( $wpdb->prefix );
569
+ $key = substr( $table, $prefix_len ) . '.' . $column;
570
+
571
+ return array_key_exists( $key, $data )
572
+ ? $data[ $key ]
573
+ : array();
574
+ }
575
+
576
+ /**
577
+ * Get constraint rules
578
+ *
579
+ * @param string $table
580
+ * @param string $column
581
+ * @param string $ref_table
582
+ * @param string $ref_column
583
+ * @return array
584
+ */
585
+ public static function getConstraintRules( $table, $column, $ref_table, $ref_column )
586
+ {
587
+ /*
588
+ SELECT CONCAT( '\'', SUBSTR(kcu.TABLE_NAME,4), '.', kcu.COLUMN_NAME , '\' => array( \'', SUBSTR(kcu.REFERENCED_TABLE_NAME,4), '.', kcu.REFERENCED_COLUMN_NAME, '\' => array( \'UPDATE_RULE\' => \'', rc.UPDATE_RULE, '\', \'DELETE_RULE\' => \'', rc.DELETE_RULE, '\', ), ),' ) AS c
589
+ FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS AS rc
590
+ LEFT JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS kcu ON ( rc.CONSTRAINT_NAME = kcu.CONSTRAINT_NAME )
591
+ WHERE rc.UNIQUE_CONSTRAINT_SCHEMA = SCHEMA()
592
+ AND kcu.CONSTRAINT_NAME LIKE 'wp_bookly_%'
593
+ ORDER BY kcu.TABLE_NAME,kcu.REFERENCED_TABLE_NAME,kcu.REFERENCED_COLUMN_NAME
594
+ */
595
+
596
+ $rules = array(
597
+ 'bookly_appointments.location_id' => array( 'bookly_locations.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
598
+ 'bookly_appointments.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
599
+ 'bookly_appointments.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
600
+ 'bookly_coupon_customers.coupon_id' => array( 'bookly_coupons.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
601
+ 'bookly_coupon_customers.customer_id' => array( 'bookly_customers.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
602
+ 'bookly_coupon_services.coupon_id' => array( 'bookly_coupons.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
603
+ 'bookly_coupon_services.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
604
+ 'bookly_coupon_staff.coupon_id' => array( 'bookly_coupons.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
605
+ 'bookly_coupon_staff.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
606
+ 'bookly_customer_appointment_files.customer_appointment_id' => array( 'bookly_customer_appointments.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
607
+ 'bookly_customer_appointment_files.file_id' => array( 'bookly_files.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
608
+ 'bookly_customer_appointments.appointment_id' => array( 'bookly_appointments.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
609
+ 'bookly_customer_appointments.customer_id' => array( 'bookly_customers.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
610
+ 'bookly_customer_appointments.order_id' => array( 'bookly_orders.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
611
+ 'bookly_customer_appointments.package_id' => array( 'bookly_packages.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
612
+ 'bookly_customer_appointments.payment_id' => array( 'bookly_payments.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
613
+ 'bookly_customer_appointments.series_id' => array( 'bookly_series.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
614
+ 'bookly_customer_groups_services.group_id' => array( 'bookly_customer_groups.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
615
+ 'bookly_customer_groups_services.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
616
+ 'bookly_customers.group_id' => array( 'bookly_customer_groups.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
617
+ 'bookly_holidays.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
618
+ 'bookly_mailing_campaigns.mailing_list_id' => array( 'bookly_mailing_lists.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
619
+ 'bookly_mailing_list_recipients.mailing_list_id' => array( 'bookly_mailing_lists.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
620
+ 'bookly_packages.customer_id' => array( 'bookly_customers.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
621
+ 'bookly_packages.payment_id' => array( 'bookly_payments.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
622
+ 'bookly_packages.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
623
+ 'bookly_packages.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
624
+ 'bookly_payments.coupon_id' => array( 'bookly_coupons.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
625
+ 'bookly_schedule_item_breaks.staff_schedule_item_id' => array( 'bookly_staff_schedule_items.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
626
+ 'bookly_sent_notifications.notification_id' => array( 'bookly_notifications.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
627
+ 'bookly_service_discounts.discount_id' => array( 'bookly_discounts.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
628
+ 'bookly_service_discounts.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
629
+ 'bookly_service_extras.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
630
+ 'bookly_service_schedule_breaks.service_schedule_day_id' => array( 'bookly_service_schedule_days.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
631
+ 'bookly_service_schedule_days.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
632
+ 'bookly_service_special_days.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
633
+ 'bookly_service_special_days_breaks.service_special_day_id' => array( 'bookly_service_special_days.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
634
+ 'bookly_service_taxes.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
635
+ 'bookly_service_taxes.tax_id' => array( 'bookly_taxes.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
636
+ 'bookly_services.category_id' => array( 'bookly_categories.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
637
+ 'bookly_special_days_breaks.staff_special_day_id' => array( 'bookly_staff_special_days.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
638
+ 'bookly_staff.category_id' => array( 'bookly_staff_categories.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'SET NULL', ), ),
639
+ 'bookly_staff_locations.location_id' => array( 'bookly_locations.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
640
+ 'bookly_staff_locations.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
641
+ 'bookly_staff_preference_orders.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
642
+ 'bookly_staff_preference_orders.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
643
+ 'bookly_staff_schedule_items.location_id' => array( 'bookly_locations.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
644
+ 'bookly_staff_schedule_items.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
645
+ 'bookly_staff_services.location_id' => array( 'bookly_locations.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
646
+ 'bookly_staff_services.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
647
+ 'bookly_staff_services.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
648
+ 'bookly_staff_special_days.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
649
+ 'bookly_staff_special_hours.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
650
+ 'bookly_staff_special_hours.staff_id' => array( 'bookly_staff.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
651
+ 'bookly_sub_services.sub_service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
652
+ 'bookly_sub_services.service_id' => array( 'bookly_services.id' => array( 'UPDATE_RULE' => 'CASCADE', 'DELETE_RULE' => 'CASCADE', ), ),
653
+ );
654
+
655
+ /** @global \wpdb */
656
+ global $wpdb;
657
+
658
+ $prefix_len = strlen( $wpdb->prefix );
659
+ $key = substr( $table, $prefix_len ) . '.' . $column;
660
+ $ref = substr( $ref_table, $prefix_len ) . '.' . $ref_column;
661
+ if ( isset( $rules[ $key ][ $ref ] ) ) {
662
+ return $rules[ $key ][ $ref ];
663
+ } else {
664
+ return array( 'UPDATE_RULE' => null, 'DELETE_RULE' => null );
665
+ }
666
+ }
667
+
668
+ /**
669
+ * @param array $data
670
+ * @return string
671
+ */
672
+ private static function getColumnDataType( array $data )
673
+ {
674
+ return sprintf(
675
+ '%s %s %s',
676
+ $data['type'],
677
+ $data['is_nullabe']
678
+ ? 'null'
679
+ : 'not null',
680
+ $data['extra'] === 'auto_increment'
681
+ ? ( 'auto_increment' . ( $data['key'] === 'PRI' ? ' primary key' : '' ) )
682
+ : ( $data['default'] === null ? ( $data['is_nullabe'] ? 'default null' : '' ) : 'default \'' . $data['default'] . '\'' )
683
+ );
684
+ }
685
+ }
backend/modules/{debug/lib → diagnostics}/Schema.php RENAMED
@@ -1,9 +1,11 @@
1
  <?php
2
- namespace Bookly\Backend\Modules\Debug\Lib;
 
3
 
4
  /**
5
  * Class Schema
6
- * @package Bookly\Backend\Modules\Debug\Lib
 
7
  */
8
  class Schema
9
  {
@@ -64,33 +66,37 @@ class Schema
64
  {
65
  global $wpdb;
66
 
67
- return (bool) $wpdb->query( $wpdb->prepare(
68
- 'SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = %s AND TABLE_SCHEMA = SCHEMA() LIMIT 1',
69
- $table
70
- ) );
 
 
71
  }
72
 
73
  /**
74
  * Get table structure
75
  *
76
  * @param string $table
 
77
  * @return array
78
  */
79
- public function getTableStructure( $table )
80
  {
81
  global $wpdb;
82
 
83
  static $tableStructure = array();
84
- if ( empty( $tableStructure ) ) {
85
- $results = $wpdb->get_results( 'SELECT TABLE_NAME, COLUMN_NAME,
86
  CASE
87
- WHEN DATA_TYPE IN( \'smallint\', \'int\', \'bigint\' ) THEN CONCAT( DATA_TYPE, IF(COLUMN_TYPE LIKE \'%unsigned\', \' unsigned\', \'\'))
88
  ELSE COLUMN_TYPE
89
  END AS DATA_TYPE,
90
  IS_NULLABLE, COLUMN_KEY, COLUMN_DEFAULT, EXTRA, CHARACTER_SET_NAME, COLLATION_NAME
91
  FROM INFORMATION_SCHEMA.COLUMNS
92
  WHERE TABLE_SCHEMA = SCHEMA()
93
- ORDER BY TABLE_NAME, ORDINAL_POSITION', ARRAY_A );
 
94
  if ( $results ) {
95
  foreach ( $results as $row ) {
96
  $tableStructure[ $row['TABLE_NAME'] ][ $row['COLUMN_NAME'] ] = $this->getColumnStructure( $row );
@@ -168,10 +174,13 @@ class Schema
168
  {
169
  global $wpdb;
170
 
171
- return (bool) $wpdb->query( $wpdb->prepare( 'SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS
 
 
172
  WHERE TABLE_NAME = %s AND COLUMN_NAME = %s AND TABLE_SCHEMA = SCHEMA() LIMIT 1',
173
- $table,
174
- $column_name
175
- ) );
 
176
  }
177
  }
1
  <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics;
4
 
5
  /**
6
  * Class Schema
7
+ *
8
+ * @package Bookly\Backend\Modules\Diagnostics\Lib
9
  */
10
  class Schema
11
  {
66
  {
67
  global $wpdb;
68
 
69
+ return (bool) $wpdb->query(
70
+ $wpdb->prepare(
71
+ 'SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = %s AND TABLE_SCHEMA = SCHEMA() LIMIT 1',
72
+ $table
73
+ )
74
+ );
75
  }
76
 
77
  /**
78
  * Get table structure
79
  *
80
  * @param string $table
81
+ * @param bool $use_cache
82
  * @return array
83
  */
84
+ public function getTableStructure( $table, $use_cache = true )
85
  {
86
  global $wpdb;
87
 
88
  static $tableStructure = array();
89
+ if ( empty( $tableStructure ) || ! $use_cache ) {
90
+ $results = $wpdb->get_results( $wpdb->prepare( 'SELECT TABLE_NAME, COLUMN_NAME,
91
  CASE
92
+ WHEN DATA_TYPE IN( \'smallint\', \'int\', \'bigint\' ) THEN CONCAT( DATA_TYPE, IF(COLUMN_TYPE LIKE \'%%unsigned\', \' unsigned\', \'\'))
93
  ELSE COLUMN_TYPE
94
  END AS DATA_TYPE,
95
  IS_NULLABLE, COLUMN_KEY, COLUMN_DEFAULT, EXTRA, CHARACTER_SET_NAME, COLLATION_NAME
96
  FROM INFORMATION_SCHEMA.COLUMNS
97
  WHERE TABLE_SCHEMA = SCHEMA()
98
+ AND TABLE_NAME LIKE %s
99
+ ORDER BY TABLE_NAME, ORDINAL_POSITION', str_replace( '_', '\_', $wpdb->prefix . 'bookly_%' ) ), ARRAY_A );
100
  if ( $results ) {
101
  foreach ( $results as $row ) {
102
  $tableStructure[ $row['TABLE_NAME'] ][ $row['COLUMN_NAME'] ] = $this->getColumnStructure( $row );
174
  {
175
  global $wpdb;
176
 
177
+ return (bool) $wpdb->query(
178
+ $wpdb->prepare(
179
+ 'SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS
180
  WHERE TABLE_NAME = %s AND COLUMN_NAME = %s AND TABLE_SCHEMA = SCHEMA() LIMIT 1',
181
+ $table,
182
+ $column_name
183
+ )
184
+ );
185
  }
186
  }
backend/modules/{debug → diagnostics}/resources/css/style.css RENAMED
File without changes
backend/modules/diagnostics/resources/js/database.js ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(function ($) {
2
+ "use strict"
3
+
4
+ function executeDatabaseJob(job) {
5
+ return $.ajax({
6
+ url: ajaxurl,
7
+ type: 'POST',
8
+ data: {
9
+ action: 'bookly_diagnostics_ajax',
10
+ tool: 'Database',
11
+ ajax: 'executeJob',
12
+ job: job,
13
+ csrf_token: BooklyL10nGlobal.csrf_token
14
+ },
15
+ dataType: 'json',
16
+ success: function (response) {
17
+ if (response.success) {
18
+ booklyAlert({success: [response.data.message]});
19
+ } else {
20
+ booklyAlert({error: [response.data.message]});
21
+ }
22
+ }
23
+ });
24
+ }
25
+
26
+ $('[data-action=drop-column]').on('click', function (e) {
27
+ e.preventDefault();
28
+ let $li = $(this).closest('li'),
29
+ table = $li.closest('.card').data('table'),
30
+ column = $li.data('column'),
31
+ job = $li.data('job'),
32
+ text = 'If there are foreign keys for <b>' + column + '</b>, they will be dropped with the column.<br><br>',
33
+ query = 'ALTER TABLE `' + table + '`\nDROP COLUMN `' + column + '`'
34
+ ;
35
+
36
+ booklyModal('Drop column: ' + column, text + $('<pre>').html(query).prop('outerHTML'), 'Cancel', 'Drop')
37
+ .on('bs.click.main.button', function (event, modal, mainButton) {
38
+ let ladda = Ladda.create(mainButton);
39
+ ladda.start();
40
+ executeDatabaseJob(job).then(function (response) {
41
+ if (response.success) {
42
+ modal.booklyModal('hide');
43
+ hideDatabaseItem($li);
44
+ }
45
+ }).always(function () {
46
+ ladda.stop();
47
+ });
48
+ });
49
+ });
50
+
51
+ $('[data-action=drop-constraint]').on('click', function (e) {
52
+ e.preventDefault();
53
+ let $li = $(this).closest('li'),
54
+ table = $li.closest('.card').data('table'),
55
+ key = $li.data('key'),
56
+ job = $li.data('job'),
57
+ query = ' ALTER TABLE `' + table + '`\nDROP FOREIGN KEY `' + key + '`'
58
+ ;
59
+
60
+ booklyModal('Drop foreign key', $('<pre>').html(query), 'Cancel', 'Drop')
61
+ .on('bs.click.main.button', function (event, modal, mainButton) {
62
+ let ladda = Ladda.create(mainButton);
63
+ ladda.start();
64
+ executeDatabaseJob(job).then(function (response) {
65
+ if (response.success) {
66
+ modal.booklyModal('hide');
67
+ hideDatabaseItem($li);
68
+ }
69
+ }).always(function () {
70
+ ladda.stop();
71
+ });
72
+ });
73
+ });
74
+
75
+ $('[data-action=add-constraint]').on('click', function (e) {
76
+ e.preventDefault();
77
+ let $li = $(this).closest('li'),
78
+ table = $li.closest('.card').data('table'),
79
+ data = $li.data('data'),
80
+ job = $li.data('job'),
81
+ query = ' ALTER TABLE `' + table + '`\nADD CONSTRAINT\n FOREIGN KEY (`' + data.column + '`)\n REFERENCES `' + data.ref_table_name + '` (`' + data.ref_column_name + '`)\n ON DELETE ' + data.rules.DELETE_RULE + '\n ON UPDATE ' + data.rules.UPDATE_RULE
82
+ ;
83
+
84
+ booklyModal('Add constraint', $('<pre>').html(query), 'Cancel', 'Add')
85
+ .on('bs.click.main.button', function (event, modal, mainButton) {
86
+ let ladda = Ladda.create(mainButton);
87
+ ladda.start();
88
+ executeDatabaseJob(job).then(function (response) {
89
+ if (response.success) {
90
+ modal.booklyModal('hide');
91
+ hideDatabaseItem($li);
92
+ } else {
93
+ let $updateBtn = $(mainButton).text('UPDATE…').attr( 'title', 'UPDATE ' + table + ' SET ' + data.column + ' = NULL' ),
94
+ $deleteBtn = jQuery('<button>', {class: 'btn ladda-button btn-danger', type: 'button', title: 'DELETE FROM ' + table, 'data-spinner-size': 40, 'data-style': 'zoom-in'})
95
+ .append('<span>', {class: 'ladda-label'}).text('DELETE…');
96
+ $deleteBtn.on('click', function (e) {
97
+ e.stopPropagation();
98
+ modal.trigger('bs.click.delete.button', [modal, $deleteBtn.get(0)]);
99
+ });
100
+ $updateBtn.off().on('click', function (e) {
101
+ e.stopPropagation();
102
+ modal.trigger('bs.click.update.button', [modal, $updateBtn.get(0)]);
103
+ });
104
+ $deleteBtn.insertBefore($updateBtn);
105
+ }
106
+ }).always(function () {
107
+ ladda.stop();
108
+ });
109
+ })
110
+ .on('bs.click.delete.button', function (event, modal, mainButton) {
111
+ modal.booklyModal('hide');
112
+ let info = 'If you don\'t know what will happen after this query execution? Click cancel.<br><br>',
113
+ query = 'DELETE FROM `' + table + "`\n" + ' WHERE `' + data.column + '`\n NOT IN ( SELECT `' + data.ref_column_name + '`\n FROM `' + data.ref_table_name + '`\n )';
114
+ booklyModal('Delete from: ' + table, info + $('<pre>').html(query).prop('outerHTML'), 'Cancel', 'Delete')
115
+ .on('bs.click.main.button', function (event, modal, mainButton) {
116
+ let ladda = Ladda.create(mainButton);
117
+ ladda.start();
118
+ executeDatabaseJob(job + '~delete').then(function (response) {
119
+ if (response.success) {
120
+ modal.booklyModal('hide');
121
+ hideDatabaseItem($li);
122
+ }
123
+ }).always(function () {
124
+ ladda.stop();
125
+ });
126
+ });
127
+ })
128
+ .on('bs.click.update.button', function (event, modal, mainButton) {
129
+ modal.booklyModal('hide');
130
+ let info = 'If you don\'t know what will happen after this query execution? Click cancel.<br><br>',
131
+ query = 'UPDATE `' + table + "`\n" + ' SET `' + data.column + '` = NULL' + "\n" + ' WHERE `' + data.column + '`\nNOT IN ( SELECT `' + data.ref_column_name + '`\n FROM `' + data.ref_table_name + '`\n )';
132
+ booklyModal('Update table: ' + table, info + $('<pre>').html(query).prop('outerHTML'), 'Cancel', 'Update')
133
+ .on('bs.click.main.button', function (event, modal, mainButton) {
134
+ let ladda = Ladda.create(mainButton);
135
+ ladda.start();
136
+ executeDatabaseJob(job + '~update').then(function (response) {
137
+ if (response.success) {
138
+ modal.booklyModal('hide');
139
+ hideDatabaseItem($li);
140
+ }
141
+ }).always(function () {
142
+ ladda.stop();
143
+ });
144
+ });
145
+ });
146
+ });
147
+
148
+ $('[data-action=fix-charset_collate-table]')
149
+ .on('click', function (e) {
150
+ e.preventDefault();
151
+ let $button = $(this),
152
+ table = $button.closest('.card').data('table'),
153
+ query = ' ALTER TABLE `' + table + '`\n',
154
+ job = $button.data('job'),
155
+ title
156
+ ;
157
+
158
+ switch ($button.attr('data-fix')) {
159
+ case '["character_set","collate"]':
160
+ title = 'Fix CHARACTER SET and COLLATION'
161
+ query += ' CHARACTER SET ' + $button.data('charset') + '\n COLLATE ' + $button.data('collate') + ';'
162
+ break;
163
+ case '["character_set"]':
164
+ title = 'Fix CHARACTER SET'
165
+ query += ' CHARACTER SET ' + $button.data('charset') + ';'
166
+ break;
167
+ }
168
+
169
+ booklyModal(title, $('<pre>').html(query), 'Cancel', 'Fix')
170
+ .on('bs.click.main.button', function (event, modal, mainButton) {
171
+ let ladda = Ladda.create(mainButton);
172
+ ladda.start();
173
+ executeDatabaseJob(job).then(function (response) {
174
+ if (response.success) {
175
+ modal.booklyModal('hide');
176
+ let $button_container = $button.closest('div');
177
+ $button_container.next('div').remove();
178
+ $button_container.remove();
179
+ }
180
+ }).always(function () {
181
+ ladda.stop();
182
+ });
183
+ });
184
+ });
185
+
186
+ $('#bookly-fix-all-silent').on('click', function () {
187
+ booklyModal('Confirmation', 'Execute automatic fixing issues found in database schema?', 'Cancel', 'Fix')
188
+ .on('bs.click.main.button', function (event, modal, mainButton) {
189
+ let ladda = Ladda.create(mainButton);
190
+ ladda.start();
191
+ $.ajax({
192
+ url: ajaxurl,
193
+ type: 'POST',
194
+ data: {
195
+ action: 'bookly_diagnostics_ajax',
196
+ tool: 'Database',
197
+ ajax: 'fixDatabaseSchema',
198
+ csrf_token: BooklyL10nGlobal.csrf_token
199
+ },
200
+ dataType: 'json',
201
+ success: function (response) {
202
+ booklyAlert({success: [response.data.message]});
203
+ if (!response.success) {
204
+ booklyAlert({error: response.data.errors});
205
+ }
206
+ ladda.stop();
207
+ },
208
+ error: function () {
209
+ booklyAlert({error: ['Error: in query execution.']});
210
+ ladda.stop();
211
+ },
212
+ }).always(function () {
213
+ modal.booklyModal('hide');
214
+ let $modal = booklyModal('Are you sure you want to reload this page?', null, 'No', 'Reload')
215
+ .on('bs.click.main.button', function (event, modal, mainButton) {
216
+ location.reload();
217
+ });
218
+ setTimeout(function () {
219
+ $('.modal-footer .btn-success', $modal).focus();
220
+ }, 500);
221
+ });
222
+ });
223
+ });
224
+
225
+ function hideDatabaseItem($item) {
226
+ if ($item.siblings('li').length === 0) {
227
+ let $tableCard = $item.closest('div[data-table]');
228
+ $item.closest('div').remove();
229
+ if ($('.list-group', $tableCard).length === 0) {
230
+ $tableCard.remove();
231
+ }
232
+ } else {
233
+ $item.remove();
234
+ }
235
+ }
236
+ });
backend/modules/diagnostics/resources/js/diagnostics.js ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(function ($) {
2
+ $('.bookly-js-reload-test').on('click', function (e) {
3
+ e.preventDefault();
4
+ e.stopPropagation();
5
+ let $test = $(this).closest('.bookly-js-test'),
6
+ $loading = $test.find('.bookly-js-loading-test'),
7
+ $reload = $test.find('.bookly-js-reload-test'),
8
+ $success = $test.find('.bookly-js-success-test'),
9
+ $failed = $test.find('.bookly-js-failed-test'),
10
+ $errors = $test.find('.bookly-js-test-errors')
11
+ ;
12
+ $loading.show();
13
+ $reload.hide();
14
+ $success.hide();
15
+ $failed.hide();
16
+ $errors.hide();
17
+ $.ajax({
18
+ url: ajaxurl,
19
+ type: 'POST',
20
+ data: {
21
+ action: 'bookly_diagnostics_test_run',
22
+ test: $test.data('class'),
23
+ csrf_token: BooklyL10nGlobal.csrf_token
24
+ },
25
+ dataType: 'json',
26
+ error: function () {
27
+ $loading.hide();
28
+ $reload.show();
29
+ $failed.show();
30
+ },
31
+ }).then(function (response) {
32
+ if ($test.data('test') !== 'check-sessions') {
33
+ $loading.hide();
34
+ $reload.show();
35
+ if (response.success) {
36
+ $success.show();
37
+ } else {
38
+ $failed.show();
39
+ if (response.data.errors.length > 0) {
40
+ $errors.html(response.data.errors.join('<br/>')).show();
41
+ }
42
+ }
43
+ } else {
44
+ // Sessions test ajax calls
45
+ $.ajax({
46
+ url: ajaxurl,
47
+ type: 'POST',
48
+ data: {
49
+ action: 'bookly_diagnostics_ajax',
50
+ test: $test.data('class'),
51
+ ajax: 'ajax1',
52
+ csrf_token: BooklyL10nGlobal.csrf_token
53
+ }
54
+ }).then(function (response) {
55
+ if (response.success) {
56
+ $.ajax({
57
+ url: ajaxurl,
58
+ type: 'POST',
59
+ data: {
60
+ action: 'bookly_diagnostics_ajax',
61
+ test: $test.data('class'),
62
+ ajax: 'ajax2',
63
+ csrf_token: BooklyL10nGlobal.csrf_token
64
+ }
65
+ }).then(function (response) {
66
+ $loading.hide();
67
+ $reload.show();
68
+ if (response.success) {
69
+ $success.show();
70
+ } else {
71
+ $failed.show();
72
+ $errors.html(response.data.errors.join('<br/>')).show();
73
+ }
74
+ });
75
+ } else {
76
+ $loading.hide();
77
+ $reload.show();
78
+ $failed.show();
79
+ $errors.html(response.data.errors.join('<br/>')).show();
80
+ }
81
+ })
82
+ }
83
+ });
84
+ });
85
+
86
+ $('.bookly-js-tests .bookly-js-reload-test').each(function () {
87
+ $(this).trigger('click');
88
+ });
89
+
90
+ // Tools
91
+ // Data Management
92
+ $('#bookly_import_file').change(function () {
93
+ if ($(this).val()) {
94
+ $('#bookly_import').submit();
95
+ }
96
+ });
97
+ // Forms Data
98
+ $('#forms-data button[data-action="copy"]').on('click', function () {
99
+ let $button = $(this),
100
+ form_id = $button.closest('.list-group-item-action').data('form_id'),
101
+ data = $button.closest('.list-group-item-action').data('form_data'),
102
+ $copied = $('<small>', {
103
+ class: 'ml-2',
104
+ text: 'copied'
105
+ });
106
+ $button.before($copied);
107
+ $button.hide();
108
+ const $temp = $('<input/>');
109
+ $('body').append($temp);
110
+ $temp.val(JSON.stringify(data)).select();
111
+ document.execCommand('copy');
112
+ $temp.remove();
113
+ console.group(form_id);
114
+ console.dir(data);
115
+ console.groupEnd();
116
+ setTimeout(function () {
117
+ $copied.remove();
118
+ $button.show();
119
+ }, 1000);
120
+ });
121
+ $('#forms-data button[data-action="destroy"]').on('click', function () {
122
+ let ladda = Ladda.create(this);
123
+ ladda.start();
124
+ let $li = $(this).closest('.list-group-item-action');
125
+ $.ajax({
126
+ url: ajaxurl,
127
+ type: 'POST',
128
+ data: {
129
+ action: 'bookly_diagnostics_ajax',
130
+ tool: 'FormsData',
131
+ ajax: 'destroy',
132
+ form_id: $li.data('form_id'),
133
+ csrf_token: BooklyL10nGlobal.csrf_token
134
+ },
135
+ dataType: 'json',
136
+ success: function (response) {
137
+ ladda.stop();
138
+ $li.remove();
139
+ }
140
+ });
141
+ });
142
+ // External plugins
143
+ $('#external-plugins button').on('click', function () {
144
+ let $plugin = $(this).closest('.list-group-item-action'),
145
+ action = $(this).data('action'),
146
+ ladda = Ladda.create(this);
147
+ ladda.start();
148
+ $.ajax({
149
+ url: ajaxurl,
150
+ type: 'POST',
151
+ data: {
152
+ action: 'bookly_diagnostics_ajax',
153
+ tool: 'ExternalPlugins',
154
+ ajax: action,
155
+ plugin: $plugin.data('plugin'),
156
+ csrf_token: BooklyL10nGlobal.csrf_token
157
+ },
158
+ dataType: 'json',
159
+ success: function (response) {
160
+ ladda.stop();
161
+ if (response.success) {
162
+ switch (action) {
163
+ case 'install':
164
+ case 'activate':
165
+ $plugin.find('button').hide();
166
+ $plugin.find('button[data-action="delete"]').show();
167
+ break;
168
+ case 'delete':
169
+ $plugin.find('button').hide();
170
+ $plugin.find('button[data-action="install"]').show();
171
+ break;
172
+ }
173
+ } else {
174
+ booklyAlert('Failed');
175
+ }
176
+ }
177
+ });
178
+ });
179
+ // Shortcodes
180
+ $('#bookly-find-shortcode-and-open').on('click', function () {
181
+ let ladda = Ladda.create(this);
182
+ ladda.start();
183
+ $.ajax({
184
+ url: ajaxurl,
185
+ type: 'POST',
186
+ data: {
187
+ action: 'bookly_diagnostics_ajax',
188
+ tool: 'ShortCodes',
189
+ ajax: 'find',
190
+ shortcode: $('#bookly_shortcode').val(),
191
+ csrf_token: BooklyL10nGlobal.csrf_token
192
+ },
193
+ dataType: 'json',
194
+ success: function (response) {
195
+ ladda.stop();
196
+ if (response.success) {
197
+ window.open(response.data.url, '_blank').focus();
198
+ }
199
+ }
200
+ });
201
+ });
202
+ })
backend/modules/diagnostics/templates/index.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+ use Bookly\Backend\Components;
3
+ use Bookly\Backend\Components\Support;
4
+ use Bookly\Backend\Modules\Diagnostics\Tests\Test;
5
+ use Bookly\Backend\Modules\Diagnostics\Tools\Tool;
6
+ use Bookly\Lib;
7
+
8
+ /** @var Test[] $tests */
9
+ /** @var array $tools */
10
+ ?>
11
+ <div id="bookly-tbs" class="wrap">
12
+ <div class="form-row align-items-center mb-3">
13
+ <h4 class="col m-0"><?php esc_html_e( 'Diagnostics', 'bookly' ) ?></h4>
14
+ <?php Support\Buttons::render( $self::pageSlug() ) ?>
15
+ </div>
16
+ <div class="card">
17
+ <div class="card-body bookly-js-tests pb-2">
18
+ <?php foreach ( $tools as $tool ) : ?>
19
+ <?php /** @var Tool $tool */ ?>
20
+ <div class="card bookly-collapse-with-arrow bookly-js-tool">
21
+ <div class="card-header bg-light d-flex align-items-center bookly-collapsed bookly-cursor-pointer" href="#<?php echo esc_attr( $tool->getSlug() ) ?>" data-toggle="bookly-collapse" style="min-height: 62px;">
22
+ <div class="d-flex w-100 align-items-center">
23
+ <div class="flex-fill bookly-collapse-title bookly-js-test-title"><?php echo esc_html( $tool->getTitle() ) ?></div>
24
+ <?php if ( $tool->hasError() ) : ?>
25
+ <button class="btn btn-danger bookly-cursor-default" type="button" disabled>
26
+ <?php esc_html_e( 'Error', 'bookly' ) ?>
27
+ </button>
28
+ <?php endif ?>
29
+ </div>
30
+ </div>
31
+ <div id="<?php echo esc_attr( $tool->getSlug() ) ?>" class="bookly-collapse">
32
+ <div class="card-body">
33
+ <?php echo Lib\Utils\Common::html( $tool->render() ) ?>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ <?php endforeach ?>
38
+ <?php foreach ( $tests as $test ) : ?>
39
+ <div class="card bookly-collapse-with-arrow bookly-js-test" data-test="<?php echo $test->getSlug() ?>" data-class="<?php echo esc_attr( basename( str_replace( '\\', '/', get_class( $test ) ) ) ) ?>">
40
+ <div class="card-header bg-white d-flex align-items-center bookly-collapsed bookly-cursor-pointer" href="#<?php echo esc_attr( $test->getSlug() ) ?>" data-toggle="bookly-collapse">
41
+ <div class="d-flex w-100 align-items-center">
42
+ <div class="flex-fill bookly-collapse-title bookly-js-test-title"><?php echo esc_html( $test->getTitle() ) ?></div>
43
+ <div class="bookly-js-status-test">
44
+ <button class="btn btn-success mr-2 bookly-js-success-test bookly-cursor-default" type="button" disabled style="display: none; width: 90px;">
45
+ <?php esc_html_e( 'Success', 'bookly' ) ?>
46
+ </button>
47
+ <button class="btn btn-danger mr-2 bookly-js-failed-test bookly-cursor-default" type="button" disabled style="display: none; width: 90px;">
48
+ <?php esc_html_e( 'Failed', 'bookly' ) ?>
49
+ </button>
50
+ </div>
51
+ <div class="bookly-js-button-test">
52
+ <button class="btn btn-default bookly-js-loading-test" type="button" disabled>
53
+ <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
54
+ </button>
55
+ <button class="btn btn-default bookly-js-reload-test" type="button" style="display: none;">
56
+ <i class="fas fa-sync-alt"></i>
57
+ </button>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ <div id="<?php echo esc_attr( $test->getSlug() ) ?>" class="bookly-collapse">
62
+ <div class="card-body">
63
+ <?php echo Lib\Utils\Common::html( $test->getDescription() ) ?>
64
+ <div class="bookly-js-test-errors text-danger w-100 mt-2"></div>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ <?php endforeach ?>
69
+ </div>
70
+ </div>
71
+ </div>
backend/modules/diagnostics/tests/Connections.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics\Tests;
4
+
5
+ use Bookly\Lib;
6
+ use Bookly\Lib\API;
7
+ use Bookly\Lib\Cloud\API as CloudAPI;
8
+ use Bookly\Lib\Config;
9
+
10
+ /**
11
+ * Class Connections
12
+ *
13
+ * @package Bookly\Backend\Modules\Diagnostics\Tests
14
+ */
15
+ class Connections extends Test
16
+ {
17
+ protected $slug = 'check-external-connections';
18
+ protected $query = 'query';
19
+ public $ignore_csrf = array( 'ajax' );
20
+
21
+ public function __construct()
22
+ {
23
+ $this->title = __( 'External connections', 'bookly' );
24
+ $this->description = __( 'This test checks the ability to establish a connection with the Bookly Cloud external server.', 'bookly' );
25
+ }
26
+
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ public function run()
31
+ {
32
+ $port = 443;
33
+ $timeout = 5;
34
+ $hosts = array( parse_url( API::API_URL, PHP_URL_HOST ), parse_url( CloudAPI::API_URL, PHP_URL_HOST ) );
35
+ if ( Config::mailchimpActive() ) {
36
+ $hosts[] = 'mailchimp.com';
37
+ }
38
+ foreach ( $hosts as $host ) {
39
+ $fp = fsockopen( $host, $port, $errno, $errstr, $timeout );
40
+ if ( ! $fp ) {
41
+ $this->addError( sprintf( '<b>%s</b><br/>%s', $host, $errstr ) );
42
+ }
43
+ }
44
+
45
+ // Test cloud callback access.
46
+ $cloud = Lib\Cloud\API::getInstance();
47
+ $data = array(
48
+ 'feedback' => array(
49
+ 'test' => 'Connections',
50
+ 'ajax' => 'ajax',
51
+ ),
52
+ 'endpoint' => add_query_arg( array( 'action' => 'bookly_diagnostics_ajax' ), admin_url( 'admin-ajax.php' ) ),
53
+ );
54
+
55
+ $response = $cloud->sendPostRequest( '/1.0/test/feedback-request', $data );
56
+
57
+ if ( ! ( isset( $response['data']['POST']['query'] ) && $response['data']['POST']['query'] === $this->query && isset( $response['data']['GET']['query'] ) && $response['data']['GET']['query'] === $this->query ) ) {
58
+ $this->addError( sprintf( '<b>%s</b><br/>%s', parse_url( CloudAPI::API_URL, PHP_URL_HOST ), __( 'For some reason, your server blocks Bookly Cloud requests. To fix the issue, please ask your hosting provider to whitelist the Bookly Cloud server.', 'bookly' ) ) );
59
+ }
60
+
61
+ return empty( $this->errors );
62
+ }
63
+
64
+ public function ajax()
65
+ {
66
+ wp_send_json_success( array( 'query' => $this->query ) );
67
+ }
68
+ }
backend/modules/diagnostics/tests/IncompatiblePlugins.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics\Tests;
4
+
5
+ /**
6
+ * Class IncompatiblePlugins
7
+ *
8
+ * @package Bookly\Backend\Modules\Diagnostics\Tests
9
+ */
10
+ class IncompatiblePlugins extends Test
11
+ {
12
+ protected $slug = 'check-incompatible-plugins';
13
+ protected $plugins = array(
14
+ 'autoptimize',
15
+ 'wp-optimize',
16
+ 'wp-fastest-cache',
17
+ 'litespeed-cache',
18
+ );
19
+
20
+ public function __construct()
21
+ {
22
+ $this->title = __( 'Incompatible plugins', 'bookly' );
23
+ $this->description = __( 'This test checks the plugins that may affect Bookly. For example, some caching and optimizing plugins may cause incorrect work of Bookly.', 'bookly' );
24
+ }
25
+
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ public function run()
30
+ {
31
+ $errors = array();
32
+ foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
33
+ foreach ( $this->plugins as $incompatible ) {
34
+ if ( strpos( $plugin, DIRECTORY_SEPARATOR . $incompatible . DIRECTORY_SEPARATOR ) !== false ) {
35
+ $data = get_plugin_data( $plugin );
36
+ $errors[] = sprintf( '<b>%s</b>', $data['Name'] );
37
+ }
38
+ }
39
+ }
40
+
41
+ if ( $errors ) {
42
+ $this->addError( __( 'One or several incompatible plugins were detected. Please add pages with Bookly shortcodes to cache exceptions and Javascript-code minification.', 'bookly' ) . '<br>' );
43
+ foreach ( $errors as $error ) {
44
+ $this->addError( $error );
45
+ }
46
+ }
47
+
48
+ return empty( $this->errors );
49
+ }
50
+ }
backend/modules/diagnostics/tests/LogErrors.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics\Tests;
4
+
5
+ use Bookly\Lib;
6
+
7
+ /**
8
+ * Class LogErrors
9
+ *
10
+ * @package Bookly\Backend\Modules\Diagnostics\Tests
11
+ */
12
+ class LogErrors extends Test
13
+ {
14
+ protected $slug = 'check-log-errors';
15
+
16
+ public function __construct()
17
+ {
18
+ $this->title = __( 'Critical errors', 'bookly' );
19
+ $this->description = __( 'This test checks for critical errors in Bookly.', 'bookly' );
20
+ }
21
+
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ public function run()
26
+ {
27
+ $errors = Lib\Entities\Log::query( 'l' )
28
+ ->where( 'action', Lib\Utils\Log::ACTION_ERROR )
29
+ ->whereGt( 'created_at', date_create( current_time( 'mysql' ) )->modify( '-1 day' )->format( 'Y-m-d H:i:s' ) )
30
+ ->count();
31
+
32
+ if ( $errors ) {
33
+ $this->addError( __( 'Some critical errors in Bookly were found recently. Please check Settings > Logs and contact Bookly support.', 'bookly' ) );
34
+ }
35
+
36
+ return empty( $this->errors );
37
+ }
38
+ }
backend/modules/diagnostics/tests/PluginUpdates.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics\Tests;
4
+
5
+ use Bookly\Lib;
6
+
7
+ /**
8
+ * Class PluginUpdates
9
+ *
10
+ * @package Bookly\Backend\Modules\Diagnostics\Tests
11
+ */
12
+ class PluginUpdates extends Test
13
+ {
14
+ protected $slug = 'bookly-plugin-updates';
15
+
16
+ public function __construct()
17
+ {
18
+ $this->title = __( 'Bookly updates', 'bookly' );
19
+ $this->description = __( 'Bookly updates bring new useful features and bugfixes. Make sure you are using the latest version of Bookly to get more possibilities and the highest quality.', 'bookly' );
20
+ }
21
+
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ public function run()
26
+ {
27
+ $plugins = get_site_transient( 'update_plugins' );
28
+ $errors = false;
29
+ foreach ( $plugins->response as $plugin => $data ) {
30
+ if ( strpos( $plugin, 'bookly-' ) === 0 ) {
31
+ if ( ! $errors ) {
32
+ $this->addError( __( 'Some Bookly items are outdated. Please update the following items:', 'bookly' ) );
33
+ $this->addError( '' );
34
+ $errors = true;
35
+ }
36
+ $plugin_data = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $plugin );
37
+ $this->addError( sprintf( '%s <b>(v%s - v%s)</b>', $plugin_data['Name'], $plugin_data['Version'], $data->new_version ) );
38
+ }
39
+ }
40
+
41
+ return empty( $this->errors );
42
+ }
43
+ }
backend/modules/diagnostics/tests/PluginsDirectories.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics\Tests;
4
+
5
+ use Bookly\Lib;
6
+
7
+ /**
8
+ * Class PluginsDirectories
9
+ *
10
+ * @package Bookly\Backend\Modules\Diagnostics\Tests
11
+ */
12
+ class PluginsDirectories extends Test
13
+ {
14
+ protected $slug = 'check-plugin-directories';
15
+
16
+ public function __construct()
17
+ {
18
+ $this->title = __( 'Add-ons directories', 'bookly' );
19
+ $this->description = __( 'Since Bookly has specific add-ons directories, their renaming may cause issues.', 'bookly' );
20
+ }
21
+
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ public function run()
26
+ {
27
+ $errors = array();
28
+ /**
29
+ * @var Lib\Base\Plugin $plugin
30
+ */
31
+ foreach ( apply_filters( 'bookly_plugins', array() ) as $plugin ) {
32
+ $slug = strtolower( preg_replace( '([A-Z\d])', '-$0', $plugin::getRootNamespace() ) );
33
+ if ( $slug === '-bookly' ) {
34
+ $slug = 'bookly-responsive-appointment-booking-tool';
35
+ } else {
36
+ $slug = str_replace( '-bookly-', 'bookly-addon-', $slug );
37
+ }
38
+
39
+ if ( $slug !== $plugin::getSlug() ) {
40
+ $errors[] = sprintf( '<br/><b>%s</b><br/>%s: <b>%s</b><br/>%s: <b>%s</b>', $plugin::getTitle(), __( 'Current directory name', 'bookly' ), $plugin::getSlug(), __( 'Expected directory name', 'bookly' ), $slug );
41
+ }
42
+ }
43
+
44
+ if ( $errors ) {
45
+ $this->addError( __( 'Some folders were renamed. Below you can find a list with current and correct names.', 'bookly' ) );
46
+ foreach ( $errors as $error ) {
47
+ $this->addError( $error );
48
+ }
49
+ }
50
+
51
+ return empty( $this->errors );
52
+ }
53
+ }
backend/modules/diagnostics/tests/SSL.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics\Tests;
4
+
5
+ use Bookly\Lib;
6
+
7
+ /**
8
+ * Class SSL
9
+ *
10
+ * @package Bookly\Backend\Modules\Diagnostics\Tests
11
+ */
12
+ class SSL extends Test
13
+ {
14
+ protected $slug = 'check-ssl';
15
+
16
+ public function __construct()
17
+ {
18
+ $this->title = __( 'Secure connection', 'bookly' );
19
+ $this->description = __( 'Some Bookly integrations require HTTPS connection and won\'t work with your website if there is no valid SSL certificate installed on your web server.', 'bookly' );
20
+ }
21
+
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ public function run()
26
+ {
27
+ if ( ! is_ssl() ) {
28
+ return false;
29
+ }
30
+
31
+ return empty( $this->errors );
32
+ }
33
+ }
backend/modules/diagnostics/tests/Sessions.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics\Tests;
4
+
5
+ use Bookly\Lib;
6
+
7
+ /**
8
+ * Class Sessions
9
+ *
10
+ * @package Bookly\Backend\Modules\Diagnostics\Tests
11
+ */
12
+ class Sessions extends Test
13
+ {
14
+ protected $slug = 'check-sessions';
15
+ protected $hidden = true;
16
+
17
+ protected $session_value1 = '0123456789';
18
+ protected $session_value2 = '9876543210';
19
+
20
+ public function __construct()
21
+ {
22
+ $this->title = __( 'PHP Sessions', 'bookly' );
23
+ $this->description = sprintf( __( 'This test checks if PHP sessions are enabled. Bookly needs PHP sessions to work correctly. For more information about PHP sessions, please check the official PHP documentation %s.', 'bookly' ), '<a href="https://www.php.net/manual/en/intro.session.php">php.net/manual/en/intro.session.php</a>' );
24
+ }
25
+
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ public function run()
30
+ {
31
+ Lib\Session::set( 'test-session-value', $this->session_value1 );
32
+
33
+ return true;
34
+ }
35
+
36
+ public function ajax1()
37
+ {
38
+ if ( Lib\Session::get( 'test-session-value' ) === $this->session_value1 ) {
39
+ Lib\Session::set( 'test-session-value', $this->session_value2 );
40
+ wp_send_json_success();
41
+ }
42
+ $error = 'To enable PHP sessions, please check the official PHP documentation';
43
+ wp_send_json_error( array( 'errors' => array( $error ) ) );
44
+ }
45
+
46
+ public function ajax2()
47
+ {
48
+ if ( Lib\Session::get( 'test-session-value' ) === $this->session_value2 ) {
49
+ Lib\Session::destroy( 'test-session-value' );
50
+ wp_send_json_success();
51
+ }
52
+
53
+ $error = 'To enable PHP sessions, please check the official PHP documentation';
54
+ wp_send_json_error( array( 'errors' => array( $error ) ) );
55
+ }
56
+ }
backend/modules/diagnostics/tests/Test.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics\Tests;
4
+
5
+ /**
6
+ * Class Test
7
+ *
8
+ * @package Bookly\Backend\Modules\Diagnostics\Tests
9
+ */
10
+ abstract class Test
11
+ {
12
+ /** @var bool */
13
+ protected $hidden = false;
14
+ /** @var array */
15
+ protected $errors = array();
16
+ /** @var string */
17
+ protected $slug;
18
+ /** @var string */
19
+ protected $title;
20
+ /** @var string */
21
+ protected $description;
22
+ /** @var array */
23
+ public $ignore_csrf = array();
24
+
25
+ /**
26
+ * Execute test
27
+ *
28
+ * @return bool
29
+ */
30
+ public function execute()
31
+ {
32
+ try {
33
+ return $this->run();
34
+ } catch ( \Exception $e ) {
35
+ return false;
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Execute test
41
+ *
42
+ * @return bool
43
+ */
44
+ public function run()
45
+ {
46
+ return true;
47
+ }
48
+
49
+ /**
50
+ * Get test errors.
51
+ *
52
+ * @return array
53
+ */
54
+ public function getErrors()
55
+ {
56
+ return $this->errors;
57
+ }
58
+
59
+ /**
60
+ * Add error.
61
+ *
62
+ * @param string $error
63
+ */
64
+ public function addError( $error )
65
+ {
66
+ $this->errors[] = $error;
67
+ }
68
+
69
+ /**
70
+ * Get test slug.
71
+ *
72
+ * @return string
73
+ */
74
+ public function getSlug()
75
+ {
76
+ return $this->slug;
77
+ }
78
+
79
+ /**
80
+ * Get test title.
81
+ *
82
+ * @return string
83
+ */
84
+ public function getTitle()
85
+ {
86
+ return $this->title;
87
+ }
88
+
89
+ /**
90
+ * Get test description.
91
+ *
92
+ * @return string
93
+ */
94
+ public function getDescription()
95
+ {
96
+ return $this->description;
97
+ }
98
+
99
+ /**
100
+ * Get test hidden.
101
+ *
102
+ * @return bool
103
+ */
104
+ public function isHidden()
105
+ {
106
+ return $this->hidden;
107
+ }
108
+ }
backend/modules/diagnostics/tests/TimeZone.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics\Tests;
4
+
5
+ use Bookly\Lib;
6
+
7
+ /**
8
+ * Class TimeZone
9
+ *
10
+ * @package Bookly\Backend\Modules\Diagnostics\Tests
11
+ */
12
+ class TimeZone extends Test
13
+ {
14
+ protected $slug = 'time-zone';
15
+
16
+ public function __construct()
17
+ {
18
+ $this->title = __( 'Timezone settings', 'bookly' );
19
+ $this->description = __( 'We recommend to use timezones with geographic names (e.g., "Europe/London") instead of "UTC +1". Using numerical representation may cause errors with daylight saving time. You can modify your timezone in WP Settings > General > Timezone.', 'bookly' );
20
+ }
21
+
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ public function run()
26
+ {
27
+ if ( 'UTC' !== date_default_timezone_get() ) {
28
+ $this->addError( 'РНР default timezone is incorrect' );
29
+ }
30
+
31
+ if ( in_array( substr( wp_timezone_string(), 0, 1 ), array( '+', '-' ) ) ) {
32
+ $this->addError( 'You\'re using numerical representation of timezone in WP settings. Please change it to geographic.' );
33
+ }
34
+
35
+ return empty( $this->errors );
36
+ }
37
+ }
backend/modules/diagnostics/tools/DataManagement.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics\Tools;
4
+
5
+ /**
6
+ * Class DataManagement
7
+ *
8
+ * @package Bookly\Backend\Modules\Diagnostics\Tools
9
+ */
10
+ class DataManagement extends Tool
11
+ {
12
+ protected $slug = 'data-management';
13
+ protected $hidden = true;
14
+
15
+ public function __construct()
16
+ {
17
+ $this->title = 'Data management';
18
+ }
19
+
20
+ public function render()
21
+ {
22
+ self::renderTemplate( '_data_management' );
23
+ }
24
+ }
backend/modules/diagnostics/tools/Database.php ADDED
@@ -0,0 +1,367 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics\Tools;
4
+
5
+ use Bookly\Lib;
6
+ use Bookly\Backend\Modules\Diagnostics\Schema;
7
+ use Bookly\Backend\Modules\Diagnostics\QueryBuilder;
8
+
9
+ /**
10
+ * Class DataManagement
11
+ *
12
+ * @package Bookly\Backend\Modules\Diagnostics\Tools
13
+ */
14
+ class Database extends Tool
15
+ {
16
+ protected $slug = 'database';
17
+ protected $hidden = true;
18
+
19
+ protected $troubles;
20
+ protected $fixable = false;
21
+
22
+ public function __construct()
23
+ {
24
+ $this->title = 'Database tools';
25
+ }
26
+
27
+ public function render()
28
+ {
29
+ $this->processDB();
30
+
31
+ self::renderTemplate( '_database', array( 'fixable' => $this->fixable, 'troubles' => $this->troubles ) );
32
+ }
33
+
34
+ public function hasError()
35
+ {
36
+ $this->processDB();
37
+
38
+ return ! empty( $this->troubles );
39
+ }
40
+
41
+ public function fixDatabaseSchema()
42
+ {
43
+ $errors = array();
44
+ $queries = 0;
45
+ $schema = new Schema();
46
+ /** @var Lib\Base\Plugin $plugin */
47
+ foreach ( apply_filters( 'bookly_plugins', array() ) as $plugin ) {
48
+ foreach ( $plugin::getEntityClasses() as $entity_class ) {
49
+ $table_name = $entity_class::getTableName();
50
+ $use_cache = true;
51
+ if ( ! $schema->existsTable( $table_name ) ) {
52
+ $queries ++;
53
+ $success = $this->executeSql( QueryBuilder::getCreateTable( $table_name ) );
54
+ if ( $success === true ) {
55
+ $use_cache = false;
56
+ } else {
57
+ $errors[] = sprintf( 'Can`t create table <b>%s</b>, Error:%s', $table_name, $success );
58
+ }
59
+ }
60
+ if ( $schema->existsTable( $table_name ) ) {
61
+ $table_structure = $schema->getTableStructure( $table_name, $use_cache );
62
+ $entity_schema = $entity_class::getSchema();
63
+
64
+ // Comparing model schema with real DB schema
65
+ foreach ( $entity_schema as $column => $data ) {
66
+ if ( array_key_exists( $column, $table_structure ) ) {
67
+ $expect = QueryBuilder::getColumnData( $table_name, $column );
68
+ $actual = $table_structure[ $column ];
69
+ unset( $expect['key'], $actual['key'], $actual['character_set'], $actual['collation'] );
70
+ if ( $expect && array_diff_assoc( $actual, $expect ) ) {
71
+ $sql = QueryBuilder::getChangeColumn( $table_name, $column );
72
+ if ( $table_structure[ $column ]['key'] == 'PRI' ) {
73
+ $sql = str_replace( ' primary key', '', $sql );
74
+ }
75
+ $queries ++;
76
+ $success = $this->executeSql( $sql );
77
+ if ( $success !== true ) {
78
+ $errors[] = sprintf( 'Can`t change column <b>%s.%s</b>, Error:%s', $table_name, $column, $success );
79
+ }
80
+ }
81
+ } else {
82
+ $queries ++;
83
+ $success = $this->executeSql( QueryBuilder::getAddColumn( $table_name, $column ) );
84
+ if ( $success !== true ) {
85
+ $errors[] = sprintf( 'Can`t add column <b>%s.%s</b>, Error:%s', $table_name, $column, $success );
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+
92
+ foreach ( $plugin::getEntityClasses() as $entity_class ) {
93
+ $table_name = $entity_class::getTableName();
94
+ if ( $schema->existsTable( $table_name ) ) {
95
+ $entity_constraints = $entity_class::getConstraints();
96
+ $table_constraints = $schema->getTableConstraints( $table_name );
97
+ // Comparing model constraints with real DB constraints
98
+ foreach ( $entity_constraints as $constraint ) {
99
+ $key = $constraint['column_name'] . $constraint['referenced_table_name'] . $constraint['referenced_column_name'];
100
+ if ( ! array_key_exists( $key, $table_constraints ) ) {
101
+ $query = QueryBuilder::getAddConstraint( $table_name, $constraint['column_name'], $constraint['referenced_table_name'], $constraint['referenced_column_name'] );
102
+ if ( $query !== '' ) {
103
+ $queries ++;
104
+ $success = $this->executeSql( $query );
105
+ if ( $success !== true ) {
106
+ $errors[] = sprintf( 'Can`t add constraint <b>%s.%s</b> REFERENCES `%s` (`%s`), Error:%s', $table_name, $constraint['column_name'], $constraint['referenced_table_name'], $constraint['referenced_column_name'], $success );
107
+ }
108
+ }
109
+ }
110
+ }
111
+
112
+ foreach ( $table_constraints as $constraint ) {
113
+ if ( $constraint['reference_exists'] === false ) {
114
+ $queries ++;
115
+ $success = $this->executeSql( QueryBuilder::getDropForeignKey( $table_name, $constraint['constraint_name'] ) );
116
+ if ( $success !== true ) {
117
+ $errors[] = sprintf( 'Can`t drop foreign key <b>%s</b>, Error:%s', $constraint['constraint_name'], $success );
118
+ }
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+
125
+ $message = ( $queries - count( $errors ) ) . ' queries completed successfully, with errors ' . count( $errors );
126
+ $errors
127
+ ? wp_send_json_error( compact( 'errors', 'message' ) )
128
+ : wp_send_json_success( compact( 'message' ) );
129
+ }
130
+
131
+ private function processDB()
132
+ {
133
+ if ( $this->troubles === null ) {
134
+ $troubles = array();
135
+ if ( ! self::hasParameter( 'x' ) ) {
136
+ /** @var Lib\Base\Plugin $plugin */
137
+ foreach ( apply_filters( 'bookly_plugins', array() ) as $plugin ) {
138
+ foreach ( $plugin::getEntityClasses() as $entity_class ) {
139
+ $trouble = $this->getTroubles( $entity_class );
140
+ if ( $trouble ) {
141
+ $troubles[ $entity_class::getTableName() ] = $trouble;
142
+ }
143
+ }
144
+ }
145
+ }
146
+ ksort( $troubles );
147
+
148
+ $this->troubles = $troubles;
149
+ }
150
+ }
151
+
152
+ /**
153
+ * @param Lib\Base\Entity $entity_class
154
+ * @return array
155
+ */
156
+ private function getTroubles( $entity_class )
157
+ {
158
+ $troubles = array();
159
+ if ( ! $entity_class ) {
160
+ return $troubles;
161
+ }
162
+
163
+ /** @var \wpdb $wpdb */
164
+ global $wpdb;
165
+ $schema = new Schema();
166
+ $table_name = $entity_class::getTableName();
167
+ if ( $schema->existsTable( $table_name ) ) {
168
+ $table_structure = $schema->getTableStructure( $table_name );
169
+ $table_constraints = $schema->getTableConstraints( $table_name );
170
+ $entity_schema = $entity_class::getSchema();
171
+ $entity_constraints = $entity_class::getConstraints();
172
+ $valid_character_set = true;
173
+ $valid_collation = true;
174
+ // Comparing model schema with real DB schema
175
+ foreach ( $entity_schema as $field => $data ) {
176
+ if ( array_key_exists( $field, $table_structure ) ) {
177
+ $expect = QueryBuilder::getColumnData( $table_name, $field );
178
+ $actual = $table_structure[ $field ];
179
+ if ( $valid_character_set
180
+ && isset( $actual['character_set'] )
181
+ && $actual['character_set'] !== $wpdb->charset ) {
182
+ $valid_character_set = false;
183
+ }
184
+ if ( $valid_collation
185
+ && isset( $actual['collation'] )
186
+ && $actual['collation'] !== $wpdb->collate ) {
187
+ $valid_collation = false;
188
+ }
189
+
190
+ if ( isset( $actual['character_set'] ) ) {
191
+ $expect['character_set'] = $wpdb->charset;
192
+ } else {
193
+ unset ( $actual['character_set'] );
194
+ }
195
+ if ( isset( $actual['collation'] ) ) {
196
+ $expect['collation'] = $wpdb->collate;
197
+ } else {
198
+ unset ( $actual['collation'] );
199
+ }
200
+ unset( $expect['key'], $actual['key'] );
201
+ $diff = array_diff_assoc( $actual, $expect );
202
+ if ( $expect && $diff ) {
203
+ $this->fixable = true;
204
+ $troubles['fields']['diff'][] = array( 'title' => $field , 'data' => array( 'diff' => array_keys( $diff ) ) );
205
+ }
206
+ } else {
207
+ $this->fixable = true;
208
+ $troubles['fields']['missing'][] = array( 'title' => $field );
209
+ }
210
+ unset( $table_structure[ $field ] );
211
+ }
212
+ foreach ( $table_structure as $field => $data ) {
213
+ $troubles['fields']['unknown'][] = array( 'title' => $field );
214
+ }
215
+ $exist_constraints = array();
216
+ // Comparing model constraints with real DB constraints
217
+ foreach ( $entity_constraints as $constraint ) {
218
+ $key = $constraint['column_name'] . $constraint['referenced_table_name'] . $constraint['referenced_column_name'];
219
+ if ( array_key_exists( $key, $table_constraints ) ) {
220
+ $exist_constraints[] = $key;
221
+ } else {
222
+ $this->fixable = true;
223
+ $troubles['constraints']['missing'][] = array(
224
+ 'title' => $constraint['column_name'] . ' - ' . $constraint['referenced_table_name'] . '.' . $constraint['referenced_column_name'],
225
+ 'data' => array(
226
+ 'column' => $constraint['column_name'],
227
+ 'ref_table_name' => $constraint['referenced_table_name'],
228
+ 'ref_column_name' => $constraint['referenced_column_name'],
229
+ 'rules' => QueryBuilder::getConstraintRules( $table_name, $constraint['column_name'], $constraint['referenced_table_name'], $constraint['referenced_column_name'] ),
230
+ ),
231
+ );
232
+ }
233
+ }
234
+ foreach ( $table_constraints as $constraint ) {
235
+ $key = $constraint['column_name'] . $constraint['referenced_table_name'] . $constraint['referenced_column_name'];
236
+ if ( ! in_array( $key, $exist_constraints ) ) {
237
+ $troubles['constraints']['unknown'][] = array(
238
+ 'title' => $constraint['column_name'] . ' - ' . $constraint['referenced_table_name'] . '.' . $constraint['referenced_column_name'],
239
+ 'data' => array(
240
+ 'key' => $constraint['constraint_name']
241
+ ),
242
+ );
243
+ }
244
+ }
245
+ if ( ! $valid_character_set ) {
246
+ $character = array( 'title' => 'character_set', 'data' => array( 'character_set' ) );
247
+ if ( ! $valid_collation ) {
248
+ $character['data'][] = 'collation';
249
+ $this->fixable = true;
250
+ }
251
+ $troubles['tables']['character'][] = $character;
252
+ }
253
+
254
+ } else {
255
+ $troubles['missing'] = true;
256
+ $this->fixable = true;
257
+ }
258
+
259
+ return $troubles;
260
+ }
261
+
262
+ public function executeJob()
263
+ {
264
+ global $wpdb;
265
+ $success = true;
266
+ $class = null;
267
+ list( $table_name, $fix, $trouble, $target ) = explode( '~', self::parameter( 'job' ) );
268
+ foreach ( apply_filters( 'bookly_plugins', array() ) as $plugin ) {
269
+ foreach ( $plugin::getEntityClasses() as $entity_class ) {
270
+ if ( $table_name == $entity_class::getTableName() ) {
271
+ $class = $entity_class;
272
+ break 2;
273
+ }
274
+ }
275
+ }
276
+ $troubles = $this->getTroubles( $class );
277
+ if ( isset( $troubles[ $fix ][ $trouble ] ) ) {
278
+ foreach ( $troubles[ $fix ][ $trouble ] as $value ) {
279
+ if ( $value['title'] == $target ) {
280
+ switch ( $trouble ) {
281
+ case 'unknown':
282
+ if ( $fix === 'fields' ) {
283
+ $success = $this->dropColumn( $table_name, $target );
284
+ } elseif ( $fix === 'constraints' ) {
285
+ $success = $this->executeSql( sprintf( 'ALTER TABLE `%s` DROP FOREIGN KEY `%s`', $table_name, $value['data']['key'] ) );
286
+ }
287
+ break 2;
288
+ case 'missing':
289
+ if ( $fix === 'constraints' ) {
290
+ $parts = explode( '~', self::parameter( 'job' ) );
291
+ if ( count( $parts ) == 5 ) {
292
+ switch ( $parts[4] ) {
293
+ case 'delete':
294
+ $this->executeSql( sprintf( 'DELETE FROM `%s` WHERE `%s` NOT IN ( SELECT `%s` FROM `%s` )',
295
+ $table_name, $value['data']['column'], $value['data']['ref_column_name'], $value['data']['ref_table_name']
296
+ ) );
297
+ break;
298
+ case 'update':
299
+ $this->executeSql( sprintf( 'UPDATE `%s` SET `%s` = NULL WHERE `%s` NOT IN ( SELECT `%s` FROM `%s` )',
300
+ $table_name, $value['data']['column'], $value['data']['column'], $value['data']['ref_column_name'], $value['data']['ref_table_name']
301
+ ) );
302
+ break;
303
+ }
304
+ }
305
+ $success = $this->executeSql( sprintf( 'ALTER TABLE `%s` ADD CONSTRAINT FOREIGN KEY (`%s`) REFERENCES `%s` (`%s`) ON DELETE %s ON UPDATE %s',
306
+ $table_name, $value['data']['column'], $value['data']['ref_table_name'], $value['data']['ref_column_name'], $value['data']['rules']['DELETE_RULE'], $value['data']['rules']['UPDATE_RULE']
307
+ ) );
308
+ }
309
+ break 2;
310
+ case 'character':
311
+ $query = 'ALTER TABLE `' . $table_name . '` ';
312
+ if ( in_array( 'character_set', $value['data'] ) ) {
313
+ $query .= ' CONVERT TO CHARACTER SET ' . $wpdb->charset;
314
+ }
315
+ if ( in_array( 'collation', $value['data'] ) ) {
316
+ $query .= ' COLLATE ' . $wpdb->collate;
317
+ }
318
+ $success = $this->executeSql( $query );
319
+ break 2;
320
+ }
321
+ }
322
+ }
323
+ }
324
+ if ( $success === true ) {
325
+ wp_send_json_success( array( 'message' => 'Query completed successfully' ) );
326
+ } else {
327
+ wp_send_json_error( array( 'message' => $success ) );
328
+ }
329
+ }
330
+
331
+ private function dropColumn($table,$column)
332
+ {
333
+ global $wpdb;
334
+
335
+ $get_foreign_keys = sprintf(
336
+ 'SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
337
+ WHERE TABLE_SCHEMA = SCHEMA() AND TABLE_NAME = "%s" AND COLUMN_NAME = "%s" AND REFERENCED_TABLE_NAME IS NOT NULL',
338
+ $table,
339
+ $column
340
+ );
341
+ $constraints = $wpdb->get_results( $wpdb->prepare( $get_foreign_keys, $column ) );
342
+ foreach ( $constraints as $foreign_key ) {
343
+ $wpdb->query( "ALTER TABLE `$table` DROP FOREIGN KEY `$foreign_key->CONSTRAINT_NAME`" );
344
+ }
345
+
346
+ $query = 'ALTER TABLE `' . $table . '` DROP COLUMN `' . $column . '`';
347
+
348
+ return $this->executeSql( $query );
349
+ }
350
+
351
+ /**
352
+ * @param string $sql
353
+ * @return bool|string
354
+ */
355
+ private function executeSql( $sql )
356
+ {
357
+ global $wpdb;
358
+
359
+ ob_start();
360
+ $result = $wpdb->query( $sql );
361
+ ob_end_clean();
362
+
363
+ return $result === false
364
+ ? $wpdb->last_error
365
+ : true;
366
+ }
367
+ }
backend/modules/diagnostics/tools/ExternalPlugins.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics\Tools;
4
+
5
+ /**
6
+ * Class ExternalPlugins
7
+ *
8
+ * @package Bookly\Backend\Modules\Diagnostics\Tools
9
+ */
10
+ class ExternalPlugins extends Tool
11
+ {
12
+ protected $slug = 'external-plugins';
13
+ protected $hidden = true;
14
+
15
+ protected $plugins = array(
16
+ 'ari-adminer' => array(
17
+ 'name' => 'ARI',
18
+ 'source' => 'https://downloads.wordpress.org/plugin/ari-adminer.zip',
19
+ 'basename' => 'ari-adminer/ari-adminer.php',
20
+ ),
21
+ 'wp-file-manager' => array(
22
+ 'name' => 'File Manager',
23
+ 'source' => 'wordpress',
24
+ 'basename' => 'wp-file-manager/file_folder_manager.php',
25
+ ),
26
+ 'wp-mail-logging' => array(
27
+ 'name' => 'WP Mail Logging',
28
+ 'source' => 'wordpress',
29
+ 'basename' => 'wp-mail-logging/wp-mail-logging.php',
30
+ ),
31
+ 'code-snippets' => array(
32
+ 'name' => 'Code Snippets',
33
+ 'source' => 'wordpress',
34
+ 'basename' => 'code-snippets/code-snippets.php',
35
+ ),
36
+ 'pexlechris-adminer' => array(
37
+ 'name' => 'WP Adminer',
38
+ 'source' => 'wordpress',
39
+ 'basename' => 'pexlechris-adminer/pexlechris-adminer.php',
40
+ ),
41
+ );
42
+
43
+ public function __construct()
44
+ {
45
+ $this->title = 'External Plugins';
46
+ }
47
+
48
+ public function render()
49
+ {
50
+ self::renderTemplate( '_external_plugins', array( 'plugins' => $this->plugins ) );
51
+ }
52
+
53
+ public function install()
54
+ {
55
+ $plugin = self::parameter( 'plugin' );
56
+ if ( array_key_exists( $plugin, $this->plugins ) ) {
57
+ if ( ! file_exists( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $this->plugins[ $plugin ]['basename'] ) ) {
58
+ if ( ! class_exists( 'Plugin_Upgrader', false ) ) {
59
+ require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
60
+ }
61
+ $upgrader = new \Plugin_Upgrader( new \Automatic_Upgrader_Skin() );
62
+ if ( $this->plugins[ $plugin ]['source'] === 'wordpress' ) {
63
+ if ( ! function_exists( 'plugins_api' ) ) {
64
+ require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
65
+ }
66
+ $response = plugins_api(
67
+ 'plugin_information',
68
+ array(
69
+ 'slug' => $plugin,
70
+ )
71
+ );
72
+ if ( $response instanceof \WP_Error ) {
73
+ wp_send_json_error();
74
+ }
75
+ $source = $response->download_link;
76
+ } else {
77
+ $source = $this->plugins[ $plugin ]['source'];
78
+ }
79
+
80
+ $state = $upgrader->install( $source );
81
+ } else {
82
+ $state = true;
83
+ }
84
+
85
+ if ( $state === true ) {
86
+ activate_plugin( $this->plugins[ $plugin ]['basename'] );
87
+ wp_send_json_success();
88
+ }
89
+ }
90
+
91
+ wp_send_json_error();
92
+ }
93
+
94
+ public function delete()
95
+ {
96
+ $plugin = self::parameter( 'plugin' );
97
+ if ( array_key_exists( $plugin, $this->plugins ) ) {
98
+ deactivate_plugins( array( $this->plugins[ $plugin ]['basename'] ) );
99
+ $state = delete_plugins( array( $this->plugins[ $plugin ]['basename'] ) );
100
+ if ( $state === true ) {
101
+ wp_send_json_success();
102
+ }
103
+ }
104
+
105
+ wp_send_json_error();
106
+ }
107
+
108
+ public function activate()
109
+ {
110
+ $plugin = self::parameter( 'plugin' );
111
+ if ( array_key_exists( $plugin, $this->plugins ) ) {
112
+ $state = activate_plugin( $this->plugins[ $plugin ]['basename'] );
113
+ if ( $state === null ) {
114
+ wp_send_json_success();
115
+ }
116
+ }
117
+
118
+ wp_send_json_error();
119
+ }
120
+ }
backend/modules/diagnostics/tools/FormsData.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics\Tools;
4
+
5
+ use Bookly\Lib\Session;
6
+
7
+ /**
8
+ * Class FormsData
9
+ *
10
+ * @package Bookly\Backend\Modules\Diagnostics\Tools
11
+ */
12
+ class FormsData extends Tool
13
+ {
14
+ protected $slug = 'forms-data';
15
+ protected $hidden = true;
16
+ protected $template = '_forms_data';
17
+
18
+
19
+ public function __construct()
20
+ {
21
+ $this->title = 'Forms data';
22
+ }
23
+
24
+ public function render()
25
+ {
26
+ $all_forms_data = Session::getAllFormsData();
27
+ $last_touched_form_id = 0;
28
+ $last_touched = 0;
29
+ foreach ( $all_forms_data as $form_id => $data ) {
30
+ if ( isset( $data['last_touched'] ) && $last_touched < $data['last_touched'] ) {
31
+ $last_touched = $data['last_touched'];
32
+ $last_touched_form_id = $form_id;
33
+ }
34
+ }
35
+
36
+ self::renderTemplate( '_forms_data', array( 'forms' => $all_forms_data, 'active' => $last_touched_form_id ) );
37
+ }
38
+
39
+ public function destroy()
40
+ {
41
+ $form_id = self::parameter( 'form_id' );
42
+ Session::destroyFormData( $form_id );
43
+
44
+ wp_send_json_error();
45
+ }
46
+ }
backend/modules/diagnostics/tools/Info.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics\Tools;
4
+
5
+ /**
6
+ * Class Info
7
+ *
8
+ * @package Bookly\Backend\Modules\Diagnostics\Tools
9
+ */
10
+ class Info extends Tool
11
+ {
12
+ protected $slug = 'info';
13
+ protected $hidden = true;
14
+
15
+ public function __construct()
16
+ {
17
+ $this->title = 'PHP Info';
18
+ }
19
+
20
+ public function render()
21
+ {
22
+ /** @var \wpdb $wpdb */
23
+ global $wpdb;
24
+
25
+ ob_start();
26
+ phpinfo();
27
+ $info = ob_get_clean();
28
+ ob_start();
29
+ ?>
30
+ <style type="text/css">
31
+ #info table {
32
+ border-collapse: collapse;
33
+ border: 0;
34
+ width: 934px;
35
+ box-shadow: 1px 2px 3px #ccc;
36
+ }
37
+
38
+ #info .center {
39
+ text-align: center;
40
+ }
41
+
42
+ #info .center table {
43
+ margin: 1em auto;
44
+ text-align: left;
45
+ }
46
+
47
+ #info .center th {
48
+ text-align: center !important;
49
+ }
50
+
51
+ #info td, #info th {
52
+ border: 1px solid #666;
53
+ font-size: 75%;
54
+ vertical-align: baseline;
55
+ padding: 4px 5px;
56
+ }
57
+
58
+ #info h1 {
59
+ font-size: 150%;
60
+ }
61
+
62
+ #info h2 {
63
+ font-size: 125%;
64
+ }
65
+
66
+ #info .p {
67
+ text-align: left;
68
+ }
69
+
70
+ #info .e {
71
+ background-color: #ccf;
72
+ width: 300px;
73
+ font-weight: bold;
74
+ }
75
+
76
+ #info .h {
77
+ background-color: #99c;
78
+ font-weight: bold;
79
+ }
80
+
81
+ #info .v {
82
+ background-color: #ddd;
83
+ max-width: 300px;
84
+ overflow-x: auto;
85
+ word-wrap: break-word;
86
+ }
87
+
88
+ #info .v i {
89
+ color: #999;
90
+ }
91
+
92
+ #info img {
93
+ float: right;
94
+ border: 0;
95
+ }
96
+
97
+ #info hr {
98
+ width: 934px;
99
+ background-color: #ccc;
100
+ border: 0;
101
+ height: 1px;
102
+ }
103
+
104
+ </style>
105
+ <?php
106
+ $styles = ob_get_clean();
107
+ $db = $wpdb->get_row( 'SELECT version() AS version', ARRAY_A );
108
+
109
+ self::renderTemplate( '_info', array( 'db' => $db, 'php_info' => $styles . preg_replace( '/(<(style)\b[^>]*>).*?(<\/\2>)/is', "$1$3", $info ) ) );
110
+ }
111
+ }
backend/modules/diagnostics/tools/ShortCodes.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics\Tools;
4
+
5
+ /**
6
+ * Class ShortCodes
7
+ *
8
+ * @package Bookly\Backend\Modules\Diagnostics\Tools
9
+ */
10
+ class ShortCodes extends Tool
11
+ {
12
+ protected $slug = 'short-codes';
13
+ protected $hidden = true;
14
+
15
+ public function __construct()
16
+ {
17
+ $this->title = 'Bookly shortcodes';
18
+ }
19
+
20
+ public function render()
21
+ {
22
+ $shortcodes = array(
23
+ array( 'name' => 'Booking form', 'code' => '[bookly-form' ),
24
+ array( 'name' => 'Appointments list', 'code' => '[bookly-appointments-list' ),
25
+ array( 'name' => 'Calendar', 'code' => '[bookly-calendar' ),
26
+ array( 'name' => 'Cancellation confirmation', 'code' => '[bookly-cancellation-confirmation' ),
27
+ array( 'name' => 'Customer Cabinet', 'code' => '[bookly-customer-cabinet' ),
28
+ array( 'name' => 'Packages list', 'code' => '[bookly-packages-list' ),
29
+ array( 'name' => 'Search form', 'code' => '[bookly-search-form' ),
30
+ array( 'name' => 'Services form', 'code' => '[bookly-services-form' ),
31
+ array( 'name' => 'Staff Cabinet - Advanced', 'code' => '[bookly-staff-advanced' ),
32
+ array( 'name' => 'Staff Cabinet - Calendar', 'code' => '[bookly-staff-calendar' ),
33
+ array( 'name' => 'Staff Cabinet - Days off', 'code' => '[bookly-staff-days-off' ),
34
+ array( 'name' => 'Staff Cabinet - Details', 'code' => '[bookly-staff-details' ),
35
+ array( 'name' => 'Staff Cabinet - Schedule', 'code' => '[bookly-staff-schedule' ),
36
+ array( 'name' => 'Staff Cabinet - Services', 'code' => '[bookly-staff-services' ),
37
+ array( 'name' => 'Staff Cabinet - Special days', 'code' => '[bookly-staff-special-days' ),
38
+ array( 'name' => 'Staff ratings', 'code' => '[bookly-staff-rating' ),
39
+ );
40
+
41
+ self::renderTemplate( '_short_codes', compact( 'shortcodes' ) );
42
+ }
43
+
44
+ public function find()
45
+ {
46
+ global $wpdb;
47
+
48
+ $shortcode = self::parameter( 'shortcode' );
49
+
50
+ $row = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->posts . ' WHERE post_content LIKE \'%%%s%\' AND post_type IN (\'page\',\'post\') AND post_status = \'publish\' ORDER BY ID DESC LIMIT 1', $shortcode ) );
51
+
52
+ if ( $row ) {
53
+ wp_send_json_success( array( 'url' => get_permalink( $row ) ) );
54
+ }
55
+
56
+ wp_send_json_error();
57
+ }
58
+ }
backend/modules/diagnostics/tools/Tool.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Bookly\Backend\Modules\Diagnostics\Tools;
4
+
5
+ use Bookly\Lib\Base\Component;
6
+
7
+ /**
8
+ * Class Tool
9
+ *
10
+ * @package Bookly\Backend\Modules\Diagnostics\Tools
11
+ */
12
+ abstract class Tool extends Component
13
+ {
14
+ /** @var bool */
15
+ protected $hidden = false;
16
+ /** @var string */
17
+ protected $slug;
18
+ /** @var string */
19
+ protected $title;
20
+
21
+ /**
22
+ * Render template
23
+ *
24
+ * @return void
25
+ */
26
+ public function render()
27
+ {
28
+ echo '';
29
+ }
30
+
31
+ /**
32
+ * Get tool slug.
33
+ *
34
+ * @return string
35
+ */
36
+ public function getSlug()
37
+ {
38
+ return $this->slug;
39
+ }
40
+
41
+ /**
42
+ * Get tool title.
43
+ *
44
+ * @return string
45
+ */
46
+ public function getTitle()
47
+ {
48
+ return $this->title;
49
+ }
50
+
51
+ /**
52
+ * Get tool broken.
53
+ *
54
+ * @return bool
55
+ */
56
+ public function hasError()
57
+ {
58
+ return false;
59
+ }
60
+
61
+ /**
62
+ * Get tool hidden.
63
+ *
64
+ * @return bool
65
+ */
66
+ public function isHidden()
67
+ {
68
+ return $this->hidden;
69
+ }
70
+ }
backend/modules/diagnostics/tools/templates/_data_management.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+ use Bookly\Backend\Components\Controls\Inputs;
3
+
4
+ ?>
5
+ <div class="form-row">
6
+ <div class="col-auto">
7
+ <form action="<?php echo admin_url( 'admin-ajax.php?action=bookly_export_data' ) ?>" method="POST">
8
+ <?php Inputs::renderCsrf() ?>
9
+ <button id="bookly-export" type="submit" class="btn btn-success">
10
+ <span class="ladda-label">Export data</span>
11
+ </button>
12
+ </form>
13
+ </div>
14
+ <div class="col-auto">
15
+ <form id="bookly_import" action="<?php echo admin_url( 'admin-ajax.php?action=bookly_import_data' ) ?>" method="POST" enctype="multipart/form-data">
16
+ <?php Inputs::renderCsrf() ?>
17
+ <div id="bookly-import" class="btn btn-primary btn-file">
18
+ <span class="ladda-label">Import data</span>
19
+ <input type="file" id="bookly_import_file" name="import" class="w-100">
20
+ </div>
21
+ </form>
22
+ </div>
23
+ </div>
backend/modules/diagnostics/tools/templates/_database.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+ use Bookly\Backend\Components\Controls\Buttons;
3
+
4
+ /** @var array $troubles */
5
+ /** @var bool $fixable */
6
+
7
+ global $wpdb;
8
+ $charset = $wpdb->charset;
9
+ $collate = $wpdb->collate;
10
+ $charset_collate = $wpdb->has_cap( 'collation' ) ? $wpdb->get_charset_collate() : 'DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci';
11
+ ?>
12
+ <?php if ( $fixable ) : ?>
13
+ <div class="text-right mb-3">
14
+ <?php Buttons::render( 'bookly-fix-all-silent', 'btn-success', 'Fix database schema…' ) ?>
15
+ </div>
16
+ <?php endif ?>
17
+ <div id="accordion" class="accordion" role="tablist" aria-multiselectable="true">
18
+ <?php if ( $troubles ) : ?>
19
+ <?php foreach ( $troubles as $table_name => $table ) : ?>
20
+ <div class="card bookly-collapse-with-arrow mb-0" data-table="<?php echo esc_attr( $table_name ) ?>">
21
+ <div class="card-header d-flex align-items-center bookly-js-table py-0 px-2" role="tab">
22
+ <button role="button" class="btn btn-link btn-block text-left text-danger py-3 shadow-none bookly-collapsed" data-toggle="bookly-collapse" href="#table-<?php echo esc_attr( $table_name ) ?>" aria-expanded="false" aria-controls="<?php echo esc_attr( $table_name ) ?>">
23
+ <div class="bookly-collapse-title">
24
+ <?php echo esc_html( $table_name ) ?>
25
+ </div>
26
+ </button>
27
+ </div>
28
+ <div class="card-body bookly-collapse pb-1" id="table-<?php echo esc_attr( $table_name ) ?>">
29
+ <?php if ( isset( $table['missing'] ) ) : ?>
30
+ <div class="mb-3">Table does not exist</div>
31
+ <?php else: ?>
32
+ <?php if ( isset( $table['tables']['character'] ) ) : ?>
33
+ <div class="text-right mb-3">
34
+ <?php if ( in_array( 'character_set', $table['tables']['character'][0]['data'] ) && in_array( 'collation', $table['tables']['character'][0]['data'] ) ) : ?>
35
+ <button class="btn btn-success ml-auto" type="button" data-charset="<?php echo esc_attr( $charset ) ?>" data-collate="<?php echo esc_attr( $collate ) ?>" data-action="fix-charset_collate-table" data-fix='["character_set","collate"]' data-job="<?php echo esc_attr( $table_name . '~tables~character~character_set' ) ?>">Fix character set and collation…</button>
36
+ <?php else : ?>
37
+ <button class="btn btn-success ml-auto" type="button" data-charset="<?php echo esc_attr( $charset ) ?>" data-action="fix-charset_collate-table" data-fix='["character_set"]' data-job="<?php echo esc_attr( $table_name . '~tables~character~character_set' ) ?>">Fix character set…</button>
38
+ <?php endif ?>
39
+ </div>
40
+ <?php endif ?>
41
+ <?php if ( isset( $table['fields']['missing'] ) ) : ?>
42
+ <div>Not found columns:
43
+ <ul class="list-group mb-3">
44
+ <?php foreach ( $table['fields']['missing'] as $field ) : ?>
45
+ <li class="list-group-item d-flex align-items-center">
46
+ <?php echo esc_html( $field['title'] ) ?>
47
+ </li>
48
+ <?php endforeach ?>
49
+ </ul>
50
+ </div>
51
+ <?php endif ?>
52
+ <?php if ( isset( $table['fields']['diff'] ) ) : ?>
53
+ <div>Incorrect columns:
54
+ <ul class="list-group mb-3">
55
+ <?php foreach ( $table['fields']['diff'] as $field ) : ?>
56
+ <li class="list-group-item d-flex align-items-center">
57
+ <div class="flex-fill">
58
+ <?php echo esc_html( $field['title'] ) ?>
59
+ </div>
60
+ <div>
61
+ <?php foreach ( $field['data']['diff'] as $key ) : ?>
62
+ <button class="btn btn-warning disabled" disabled><?php echo esc_html( $key ) ?></button>
63
+ <?php endforeach ?>
64
+ </div>
65
+ </li>
66
+ <?php endforeach ?>
67
+ </ul>
68
+ </div>
69
+ <?php endif ?>
70
+ <?php if ( isset( $table['fields']['unknown'] ) ) : ?>
71
+ <div>Unknown columns:
72
+ <ul class="list-group mb-3">
73
+ <?php foreach ( $table['fields']['unknown'] as $field ) : ?>
74
+ <li class="list-group-item d-flex align-items-center" data-column="<?php echo esc_html( $field['title'] ) ?>" data-job="<?php echo esc_attr( $table_name . '~fields~unknown~' . $field['title'] ) ?>">
75
+ <div class="flex-fill">
76
+ <?php echo esc_html( $field['title'] ) ?>
77
+ </div>
78
+ <div>
79
+ <button class="btn btn-success" type="button" data-action="drop-column">DROP…</button>
80
+ </div>
81
+ </li>
82
+ <?php endforeach ?>
83
+ </ul>
84
+ </div>
85
+ <?php endif ?>
86
+ <?php if ( isset( $table['constraints']['missing'] ) ) : ?>
87
+ <div>Not found constraints:
88
+ <ul class="list-group mb-3">
89
+ <?php foreach ( $table['constraints']['missing'] as $constraint ) : ?>
90
+ <li class="list-group-item d-flex align-items-center" data-data='<?php echo json_encode( $constraint['data'] ) ?>'
91
+ data-job="<?php echo esc_attr( $table_name . '~constraints~missing~' . $constraint['title'] ) ?>">
92
+ <div class="flex-fill">
93
+ <?php echo esc_html( $constraint['title'] ) ?>
94
+ </div>
95
+ <div>
96
+ <button class="btn btn-success" type="button" data-action="add-constraint">ADD…</button>
97
+ </div>
98
+ </li>
99
+ <?php endforeach ?>
100
+ </ul>
101
+ </div>
102
+ <?php endif ?>
103
+ <?php if ( isset( $table['constraints']['unknown'] ) ) : ?>
104
+ <div>Unknown constraints:
105
+ <ul class="list-group mb-3">
106
+ <?php foreach ( $table['constraints']['unknown'] as $constraint ) : ?>
107
+ <li class="list-group-item d-flex align-items-center" data-key="<?php echo esc_html( $constraint['data']['key'] ) ?>"
108
+ data-job="<?php echo esc_attr( $table_name . '~constraints~unknown~' . $constraint['title'] ) ?>">
109
+ <div class="flex-fill">
110
+ <?php echo esc_html( $constraint['title'] ) ?>
111
+ </div>
112
+ <div>
113
+ <button class="btn btn-success" type="button" data-action="drop-constraint">DROP…</button>
114
+ </div>
115
+ </li>
116
+ <?php endforeach ?>
117
+ </ul>
118
+ </div>
119
+ <?php endif ?>
120
+ <?php endif ?>
121
+ </div>
122
+ </div>
123
+ <?php endforeach ?>
124
+ <?php else: ?>
125
+ Database is ok
126
+ <?php endif ?>
127
+ </div>
backend/modules/diagnostics/tools/templates/_external_plugins.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+ /** @var array $plugins */
3
+ ?>
4
+ <ul class="list-group" id="bookly-js-booking-forms">
5
+ <?php foreach ( $plugins as $slug => $data ) : ?>
6
+ <?php $active = is_plugin_active( $data['basename'] ) ? 'delete' : ( file_exists( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $data['basename'] ) ? 'activate' : 'install' ) ?>
7
+ <li class="list-group-item list-group-item-action" data-plugin="<?php echo esc_attr( $slug ) ?>">
8
+ <div class="row align-items-center">
9
+ <div class="col">
10
+ <?php echo esc_html( $data['name'] ) ?>
11
+ </div>
12
+ <div class="col-auto" style="min-width:140px;">
13
+ <button class="btn btn-danger ladda-button w-100" data-plugin="<?php echo esc_attr( $slug ) ?>" data-action="delete" data-spinner-size="40" data-style="zoom-in" data-spinner-color="#666666"<?php if ( $active !== 'delete' ) : ?> style="display: none;"<?php endif ?>><span class="ladda-label">Delete</span></button>
14
+ <button class="btn btn-success ladda-button w-100" data-plugin="<?php echo esc_attr( $slug ) ?>" data-action="activate" data-spinner-size="40" data-style="zoom-in" data-spinner-color="#666666"<?php if ( $active !== 'activate' ) : ?> style="display: none;"<?php endif ?>><span class="ladda-label">Activate</span></button>
15
+ <button class="btn btn-default ladda-button w-100" data-plugin="<?php echo esc_attr( $slug ) ?>" data-action="install" data-spinner-size="40" data-style="zoom-in" data-spinner-color="#666666"<?php if ( $active !== 'install' ) : ?> style="display: none;"<?php endif ?>><span class="ladda-label">Install</span></button>
16
+ </div>
17
+ </div>
18
+ </li>
19
+ <?php endforeach ?>
20
+ </ul>
backend/modules/diagnostics/tools/templates/_forms_data.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+ /** @var array $forms */
3
+ /** @var string $active */
4
+ ?>
5
+ <?php if ( count( $forms ) > 0 ) : ?>
6
+ <ul class="list-group" id="bookly-js-booking-forms">
7
+ <?php foreach ( $forms as $id => $data ) : ?>
8
+ <li class="list-group-item list-group-item-action<?php if ( $id === $active ) : ?> list-group-item-primary<?php endif ?>" data-form_id="<?php echo esc_attr( $id ) ?>" data-form_data="<?php echo esc_attr( json_encode( $data ) ) ?>">
9
+ <div class="row align-items-center">
10
+ <div class="col">
11
+ <?php echo esc_html( $id ) ?>
12
+ </div>
13
+ <div class="col-auto">
14
+ <button class="btn btn-default ladda-button" data-action="copy"><i class="far fa-copy fa-fw"></i></button>
15
+ <button type="button" class="btn btn-danger ladda-button" data-action="destroy" data-spinner-size="40" data-style="zoom-in"><span class="ladda-label"><i class="far fa-trash-alt fa-fw"></i></span></button>
16
+ </div>
17
+ </div>
18
+ </li>
19
+ <?php endforeach ?>
20
+ </ul>
21
+ <?php else : ?>
22
+ Data for [booking-form] is missing in the session
23
+ <?php endif ?>
backend/modules/diagnostics/tools/templates/_info.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2
+ <div class="w-100 text-center">
3
+ Database version: <?php echo $db['version'] ?>
4
+ </div>
5
+ <?php echo \Bookly\Lib\Utils\Common::html( $php_info );
backend/modules/diagnostics/tools/templates/_short_codes.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
+ /** @var array $shortcodes */
3
+ ?>
4
+ <div class="input-group">
5
+ <select id="bookly_shortcode" class="form-control custom-select">
6
+ <?php foreach ( $shortcodes as $shortcode ) : ?>
7
+ <option value="<?php echo esc_attr( $shortcode['code'] ) ?>"><?php echo esc_html( $shortcode['name'] ) ?></option>
8
+ <?php endforeach ?>
9
+ </select>
10
+ <div class="input-group-append">
11
+ <button class="btn btn-outline-secondary ladda-button" id="bookly-find-shortcode-and-open" data-spinner-size="40" data-style="zoom-in" data-spinner-color="rgb(62, 66, 74)"><span class="ladda-label"><i class="fas fa-external-link-alt fa-sm"></i></span></button>
12
+ </div>
13
+ </div>
backend/modules/news/templates/index.php CHANGED
@@ -14,7 +14,7 @@ use Bookly\Backend\Components\Controls;
14
  <?php Controls\Buttons::render( 'bookly-more-news', 'btn-primary btn-lg', __( 'More news', 'bookly' ) ) ?>
15
  </div>
16
 
17
- <div class="collapse" id="bookly-news-template">
18
  <div class="card m-3 border rounded{{border}}" style="max-width: 476px; min-width: 476px;">
19
  {{media}}
20
  <div class="card-body">
14
  <?php Controls\Buttons::render( 'bookly-more-news', 'btn-primary btn-lg', __( 'More news', 'bookly' ) ) ?>
15
  </div>
16
 
17
+ <div class="bookly-collapse" id="bookly-news-template">
18
  <div class="card m-3 border rounded{{border}}" style="max-width: 476px; min-width: 476px;">
19
  {{media}}
20
  <div class="card-body">
backend/modules/notifications/lib/Codes.php CHANGED
@@ -27,6 +27,7 @@ class Codes
27
  $this->type = $type;
28
  $this->codes = array(
29
  'appointment' => array(
 
30
  'appointment_date' => array( 'description' => __( 'Date of appointment', 'bookly' ), 'if' => true ),
31
  'appointment_end_date' => array( 'description' => __( 'End date of appointment', 'bookly' ), 'if' => true ),
32
  'appointment_end_time' => array( 'description' => __( 'End time of appointment', 'bookly' ), 'if' => true ),
@@ -44,6 +45,7 @@ class Codes
44
  ),
45
  'category' => array(
46
  'category_name' => array( 'description' => __( 'Name of category', 'bookly' ), 'if' => true ),
 
47
  ),
48
  'company' => array(
49
  'company_address' => array( 'description' => __( 'Address of company', 'bookly' ), 'if' => true ),
@@ -124,10 +126,11 @@ class Codes
124
 
125
  if ( $type == 'email' ) {
126
  // Only email.
 
127
  $this->codes['company']['company_logo'] = array( 'description' => __( 'Company logo', 'bookly' ), 'if' => true );
128
  $this->codes['customer_appointment']['cancel_appointment'] = array( 'description' => __( 'Cancel appointment link', 'bookly' ) );
129
- $this->codes['staff']['staff_photo'] = array( 'description' => __( 'Photo of staff', 'bookly' ), 'if' => true );
130
  $this->codes['service']['service_image'] = array( 'description' => __( 'Image of service', 'bookly' ), 'if' => true );
 
131
  }
132
 
133
  // Add codes from add-ons.
27
  $this->type = $type;
28
  $this->codes = array(
29
  'appointment' => array(
30
+ 'appointment_id' => array( 'description' => __( 'Appointment ID', 'bookly' ) ),
31
  'appointment_date' => array( 'description' => __( 'Date of appointment', 'bookly' ), 'if' => true ),
32
  'appointment_end_date' => array( 'description' => __( 'End date of appointment', 'bookly' ), 'if' => true ),
33
  'appointment_end_time' => array( 'description' => __( 'End time of appointment', 'bookly' ), 'if' => true ),
45
  ),
46
  'category' => array(
47
  'category_name' => array( 'description' => __( 'Name of category', 'bookly' ), 'if' => true ),
48
+ 'category_info' => array( 'description' => __( 'Info of category', 'bookly' ), 'if' => true ),
49
  ),
50
  'company' => array(
51
  'company_address' => array( 'description' => __( 'Address of company', 'bookly' ), 'if' => true ),
126
 
127
  if ( $type == 'email' ) {
128
  // Only email.
129
+ $this->codes['category']['category_image'] = array( 'description' => __( 'Image of category', 'bookly' ), 'if' => true );
130
  $this->codes['company']['company_logo'] = array( 'description' => __( 'Company logo', 'bookly' ), 'if' => true );
131
  $this->codes['customer_appointment']['cancel_appointment'] = array( 'description' => __( 'Cancel appointment link', 'bookly' ) );
 
132
  $this->codes['service']['service_image'] = array( 'description' => __( 'Image of service', 'bookly' ), 'if' => true );
133
+ $this->codes['staff']['staff_photo'] = array( 'description' => __( 'Photo of staff', 'bookly' ), 'if' => true );
134
  }
135
 
136
  // Add codes from add-ons.
backend/modules/payments/Page.php CHANGED
@@ -52,6 +52,7 @@ class Page extends Lib\Base\Component
52
  Lib\Entities\Payment::TYPE_PAYULATAM,
53
  Lib\Entities\Payment::TYPE_PAYSON,
54
  Lib\Entities\Payment::TYPE_MOLLIE,
 
55
  Lib\Entities\Payment::TYPE_FREE,
56
  Lib\Entities\Payment::TYPE_WOOCOMMERCE,
57
  );
52
  Lib\Entities\Payment::TYPE_PAYULATAM,
53
  Lib\Entities\Payment::TYPE_PAYSON,
54
  Lib\Entities\Payment::TYPE_MOLLIE,
55
+ Lib\Entities\Payment::TYPE_SQUARE,
56
  Lib\Entities\Payment::TYPE_FREE,
57
  Lib\Entities\Payment::TYPE_WOOCOMMERCE,
58
  );
backend/modules/payments/resources/js/payments.js CHANGED
@@ -1,33 +1,33 @@
1
  jQuery(function($) {
2
 
3
  var
4
- $payments_list = $('#bookly-payments-list'),
5
  $check_all_button = $('#bookly-check-all'),
6
- $id_filter = $('#bookly-filter-id'),
7
  $creationDateFilter = $('#bookly-filter-date'),
8
- $type_filter = $('#bookly-filter-type'),
9
- $customer_filter = $('#bookly-filter-customer'),
10
- $staff_filter = $('#bookly-filter-staff'),
11
- $service_filter = $('#bookly-filter-service'),
12
- $status_filter = $('#bookly-filter-status'),
13
- $payment_total = $('#bookly-payment-total'),
14
- $delete_button = $('#bookly-delete'),
15
  $download_invoice = $('#bookly-download-invoices'),
16
- urlParts = document.URL.split('#'),
17
- columns = [],
18
- order = [],
19
  pickers = {
20
- dateFormat: 'YYYY-MM-DD',
21
  creationDate: {
22
  startDate: moment().subtract(30, 'days'),
23
- endDate : moment(),
24
  },
25
  };
26
 
27
  $('.bookly-js-select').val(null);
28
 
29
  if (urlParts.length > 1) {
30
- urlParts[1].split('&').forEach(function (part) {
31
  var params = part.split('=');
32
  if (params[0] == 'created-date') {
33
  pickers.creationDate.startDate = moment(params['1'].substring(0, 10));
@@ -41,7 +41,7 @@ jQuery(function($) {
41
  }
42
  });
43
  } else {
44
- $.each(BooklyL10n.datatables.payments.settings.filter, function (field, value) {
45
  if (value != '') {
46
  let $elem = $('#bookly-filter-' + field);
47
  if ($elem.is(':checkbox')) {
@@ -66,11 +66,11 @@ jQuery(function($) {
66
  theme: 'bootstrap4',
67
  dropdownParent: '#bookly-tbs',
68
  language: {
69
- noResults: function () {
70
  return BooklyL10n.noResultFound;
71
  }
72
  },
73
- matcher: function (params, data) {
74
  const term = $.trim(params.term).toLowerCase();
75
  if (term === '' || data.text.toLowerCase().indexOf(term) !== -1) {
76
  return data;
@@ -97,10 +97,10 @@ jQuery(function($) {
97
  allowClear: true,
98
  placeholder: '',
99
  language: {
100
- noResults: function () {
101
  return BooklyL10n.no_result_found;
102
  },
103
- searching: function () {
104
  return BooklyL10n.searching;
105
  }
106
  },
@@ -108,7 +108,7 @@ jQuery(function($) {
108
  url: ajaxurl,
109
  dataType: 'json',
110
  delay: 250,
111
- data: function (params) {
112
  params.page = params.page || 1;
113
  return {
114
  action: this.action === undefined ? $(this).data('ajax--action') : this.action,
@@ -123,19 +123,19 @@ jQuery(function($) {
123
  /**
124
  * Init Columns.
125
  */
126
- $.each(BooklyL10n.datatables.payments.settings.columns, function (column, show) {
127
  if (show) {
128
  switch (column) {
129
  case 'created_at':
130
  columns.push({
131
- data: column, render: function (data, type, row, meta) {
132
  return type === 'sort' ? data : row.created_format;
133
  }
134
  });
135
  break;
136
  case 'start_date':
137
  columns.push({
138
- data: column, render: function (data, type, row, meta) {
139
  return type === 'sort' ? data : row.start_date_format;
140
  }
141
  });
@@ -146,7 +146,7 @@ jQuery(function($) {
146
  case 'service':
147
  case 'provider':
148
  columns.push({
149
- data: column, render: function (data, type, row, meta) {
150
  return $.fn.dataTable.render.text().display(data) + (row.multiple ? '<i class="fas fa-shopping-cart ml-1" title="' + BooklyL10n.multiple + '"></i>' : '');
151
  }
152
  });
@@ -158,11 +158,12 @@ jQuery(function($) {
158
  }
159
  });
160
  columns.push({
 
161
  responsivePriority: 1,
162
  orderable: false,
163
  searchable: false,
164
  width: BooklyL10n.invoice.enabled ? 180 : 90,
165
- render: function (data, type, row, meta) {
166
  var buttons = '<div class="d-inline-flex">';
167
  if (BooklyL10n.invoice.enabled) {
168
  buttons += '<button type="button" class="btn btn-default mr-1" data-action="view-invoice" data-payment_id="' + row.id + '"><i class="far fa-fw fa-file-pdf mr-lg-1"></i><span class="d-none d-lg-inline">' + BooklyL10n.invoice.button + '</span></button>';
@@ -171,10 +172,11 @@ jQuery(function($) {
171
  }
172
  });
173
  columns.push({
 
174
  responsivePriority: 1,
175
  orderable: false,
176
  searchable: false,
177
- render: function (data, type, row, meta) {
178
  return '<div class="custom-control custom-checkbox">' +
179
  '<input value="' + row.id + '" id="bookly-dt-' + row.id + '" type="checkbox" class="custom-control-input">' +
180
  '<label for="bookly-dt-' + row.id + '" class="custom-control-label"></label>' +
@@ -184,8 +186,8 @@ jQuery(function($) {
184
 
185
  columns[0].responsivePriority = 0;
186
 
187
- $.each(BooklyL10n.datatables.payments.settings.order, function (_, value) {
188
- const index = columns.findIndex(function (c) { return c.data === value.column; });
189
  if (index !== -1) {
190
  order.push([index, value.order]);
191
  }
@@ -205,7 +207,7 @@ jQuery(function($) {
205
  ajax: {
206
  url: ajaxurl,
207
  type: 'POST',
208
- data: function (d) {
209
  return $.extend({}, d, {
210
  action: 'bookly_get_payments',
211
  csrf_token: BooklyL10nGlobal.csrf_token,
@@ -220,7 +222,7 @@ jQuery(function($) {
220
  }
221
  });
222
  },
223
- dataSrc: function (json) {
224
  $payment_total.html(json.total);
225
 
226
  return json.data;
@@ -232,7 +234,7 @@ jQuery(function($) {
232
  processing: BooklyL10n.processing
233
  }
234
  });
235
- dt.on( 'order', function () {
236
  let order = [];
237
  dt.order().forEach(function(data) {
238
  order.push({
@@ -256,24 +258,24 @@ jQuery(function($) {
256
  /**
257
  * Select all coupons.
258
  */
259
- $check_all_button.on('change', function () {
260
  $payments_list.find('tbody input:checkbox').prop('checked', this.checked);
261
  });
262
 
263
  $payments_list
264
  // On coupon select.
265
- .on('change', 'tbody input:checkbox', function () {
266
  $check_all_button.prop('checked', $payments_list.find('tbody input:not(:checked)').length == 0);
267
  })
268
  // Show invoice
269
- .on('click', '[data-action=view-invoice]', function () {
270
  window.location = $download_invoice.data('action') + '&invoices=' + $(this).data('payment_id');
271
  })
272
  // show payment details
273
- .on('click', '[data-action=show-payment]', function () {
274
  BooklyPaymentDetailsDialog.showDialog({
275
  payment_id: dt.row($(this).closest('td')).data().id,
276
- done: function (event) {
277
  dt.ajax.reload();
278
  }
279
  });
@@ -285,22 +287,22 @@ jQuery(function($) {
285
 
286
  var picker_ranges = {};
287
  picker_ranges[BooklyL10n.dateRange.yesterday] = [moment().subtract(1, 'days'), moment().subtract(1, 'days')];
288
- picker_ranges[BooklyL10n.dateRange.today] = [moment(), moment()];
289
- picker_ranges[BooklyL10n.dateRange.last_7] = [moment().subtract(7, 'days'), moment()];
290
- picker_ranges[BooklyL10n.dateRange.last_30] = [moment().subtract(30, 'days'), moment()];
291
  picker_ranges[BooklyL10n.dateRange.thisMonth] = [moment().startOf('month'), moment().endOf('month')];
292
  picker_ranges[BooklyL10n.dateRange.lastMonth] = [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')];
293
 
294
  $creationDateFilter.daterangepicker(
295
  {
296
- parentEl : $creationDateFilter.parent(),
297
  startDate: pickers.creationDate.startDate,
298
- endDate : pickers.creationDate.endDate,
299
- ranges : picker_ranges,
300
- showDropdowns : true,
301
  linkedCalendars: false,
302
  autoUpdateInput: false,
303
- locale: $.extend({},BooklyL10n.dateRange, BooklyL10n.datePicker)
304
  },
305
  function(start, end) {
306
  $creationDateFilter
@@ -310,25 +312,25 @@ jQuery(function($) {
310
  }
311
  );
312
 
313
- $id_filter.on('keyup', function () { dt.ajax.reload(); });
314
- $creationDateFilter.on('apply.daterangepicker', function () { dt.ajax.reload(); });
315
- $type_filter.on('change', function () { dt.ajax.reload(); });
316
- $customer_filter.on('change', function () { dt.ajax.reload(); });
317
- $staff_filter.on('change', function () { dt.ajax.reload(); });
318
- $service_filter.on('change', function () { dt.ajax.reload(); });
319
- $status_filter.on('change', function () { dt.ajax.reload(); });
320
 
321
  /**
322
  * Delete payments.
323
  */
324
- $delete_button.on('click', function () {
325
  if (confirm(BooklyL10n.areYouSure)) {
326
  var ladda = Ladda.create(this);
327
  ladda.start();
328
 
329
  var data = [];
330
  var $checkboxes = $payments_list.find('tbody input:checked');
331
- $checkboxes.each(function () {
332
  data.push(this.value);
333
  });
334
 
@@ -341,7 +343,7 @@ jQuery(function($) {
341
  data: data
342
  },
343
  dataType: 'json',
344
- success: function (response) {
345
  if (response.success) {
346
  dt.ajax.reload();
347
  } else {
@@ -353,9 +355,9 @@ jQuery(function($) {
353
  }
354
  });
355
 
356
- $download_invoice.on('click', function () {
357
  var invoices = [];
358
- $payments_list.find('tbody input:checked').each(function () {
359
  invoices.push(this.value);
360
  });
361
  if (invoices.length) {
1
  jQuery(function($) {
2
 
3
  var
4
+ $payments_list = $('#bookly-payments-list'),
5
  $check_all_button = $('#bookly-check-all'),
6
+ $id_filter = $('#bookly-filter-id'),
7
  $creationDateFilter = $('#bookly-filter-date'),
8
+ $type_filter = $('#bookly-filter-type'),
9
+ $customer_filter = $('#bookly-filter-customer'),
10
+ $staff_filter = $('#bookly-filter-staff'),
11
+ $service_filter = $('#bookly-filter-service'),
12
+ $status_filter = $('#bookly-filter-status'),
13
+ $payment_total = $('#bookly-payment-total'),
14
+ $delete_button = $('#bookly-delete'),
15
  $download_invoice = $('#bookly-download-invoices'),
16
+ urlParts = document.URL.split('#'),
17
+ columns = [],
18
+ order = [],
19
  pickers = {
20
+ dateFormat: 'YYYY-MM-DD',
21
  creationDate: {
22
  startDate: moment().subtract(30, 'days'),
23
+ endDate: moment(),
24
  },
25
  };
26
 
27
  $('.bookly-js-select').val(null);
28
 
29
  if (urlParts.length > 1) {
30
+ urlParts[1].split('&').forEach(function(part) {
31
  var params = part.split('=');
32
  if (params[0] == 'created-date') {
33
  pickers.creationDate.startDate = moment(params['1'].substring(0, 10));
41
  }
42
  });
43
  } else {
44
+ $.each(BooklyL10n.datatables.payments.settings.filter, function(field, value) {
45
  if (value != '') {
46
  let $elem = $('#bookly-filter-' + field);
47
  if ($elem.is(':checkbox')) {
66
  theme: 'bootstrap4',
67
  dropdownParent: '#bookly-tbs',
68
  language: {
69
+ noResults: function() {
70
  return BooklyL10n.noResultFound;
71
  }
72
  },
73
+ matcher: function(params, data) {
74
  const term = $.trim(params.term).toLowerCase();
75
  if (term === '' || data.text.toLowerCase().indexOf(term) !== -1) {
76
  return data;
97
  allowClear: true,
98
  placeholder: '',
99
  language: {
100
+ noResults: function() {
101
  return BooklyL10n.no_result_found;
102
  },
103
+ searching: function() {
104
  return BooklyL10n.searching;
105
  }
106
  },
108
  url: ajaxurl,
109
  dataType: 'json',
110
  delay: 250,
111
+ data: function(params) {
112
  params.page = params.page || 1;
113
  return {
114
  action: this.action === undefined ? $(this).data('ajax--action') : this.action,
123
  /**
124
  * Init Columns.
125
  */
126
+ $.each(BooklyL10n.datatables.payments.settings.columns, function(column, show) {
127
  if (show) {
128
  switch (column) {
129
  case 'created_at':
130
  columns.push({
131
+ data: column, render: function(data, type, row, meta) {
132
  return type === 'sort' ? data : row.created_format;
133
  }
134
  });
135
  break;
136
  case 'start_date':
137
  columns.push({
138
+ data: column, render: function(data, type, row, meta) {
139
  return type === 'sort' ? data : row.start_date_format;
140
  }
141
  });
146
  case 'service':
147
  case 'provider':
148
  columns.push({
149
+ data: column, render: function(data, type, row, meta) {
150
  return $.fn.dataTable.render.text().display(data) + (row.multiple ? '<i class="fas fa-shopping-cart ml-1" title="' + BooklyL10n.multiple + '"></i>' : '');
151
  }
152
  });
158
  }
159
  });
160
  columns.push({
161
+ data: null,
162
  responsivePriority: 1,
163
  orderable: false,
164
  searchable: false,
165
  width: BooklyL10n.invoice.enabled ? 180 : 90,
166
+ render: function(data, type, row, meta) {
167
  var buttons = '<div class="d-inline-flex">';
168
  if (BooklyL10n.invoice.enabled) {
169
  buttons += '<button type="button" class="btn btn-default mr-1" data-action="view-invoice" data-payment_id="' + row.id + '"><i class="far fa-fw fa-file-pdf mr-lg-1"></i><span class="d-none d-lg-inline">' + BooklyL10n.invoice.button + '</span></button>';
172
  }
173
  });
174
  columns.push({
175
+ data: null,
176
  responsivePriority: 1,
177
  orderable: false,
178
  searchable: false,
179
+ render: function(data, type, row, meta) {
180
  return '<div class="custom-control custom-checkbox">' +
181
  '<input value="' + row.id + '" id="bookly-dt-' + row.id + '" type="checkbox" class="custom-control-input">' +
182
  '<label for="bookly-dt-' + row.id + '" class="custom-control-label"></label>' +
186
 
187
  columns[0].responsivePriority = 0;
188
 
189
+ $.each(BooklyL10n.datatables.payments.settings.order, function(_, value) {
190
+ const index = columns.findIndex(function(c) { return c.data === value.column; });
191
  if (index !== -1) {
192
  order.push([index, value.order]);
193
  }
207
  ajax: {
208
  url: ajaxurl,
209
  type: 'POST',
210
+ data: function(d) {
211
  return $.extend({}, d, {
212
  action: 'bookly_get_payments',
213
  csrf_token: BooklyL10nGlobal.csrf_token,
222
  }
223
  });
224
  },
225
+ dataSrc: function(json) {
226
  $payment_total.html(json.total);
227
 
228
  return json.data;
234
  processing: BooklyL10n.processing
235
  }
236
  });
237
+ dt.on('order', function() {
238
  let order = [];
239
  dt.order().forEach(function(data) {
240
  order.push({
258
  /**
259
  * Select all coupons.
260
  */
261
+ $check_all_button.on('change', function() {
262
  $payments_list.find('tbody input:checkbox').prop('checked', this.checked);
263
  });
264
 
265
  $payments_list
266
  // On coupon select.
267
+ .on('change', 'tbody input:checkbox', function() {
268
  $check_all_button.prop('checked', $payments_list.find('tbody input:not(:checked)').length == 0);
269
  })
270
  // Show invoice
271
+ .on('click', '[data-action=view-invoice]', function() {
272
  window.location = $download_invoice.data('action') + '&invoices=' + $(this).data('payment_id');
273
  })
274
  // show payment details
275
+ .on('click', '[data-action=show-payment]', function() {
276
  BooklyPaymentDetailsDialog.showDialog({
277
  payment_id: dt.row($(this).closest('td')).data().id,
278
+ done: function(event) {
279
  dt.ajax.reload();
280
  }
281
  });
287
 
288
  var picker_ranges = {};
289
  picker_ranges[BooklyL10n.dateRange.yesterday] = [moment().subtract(1, 'days'), moment().subtract(1, 'days')];
290
+ picker_ranges[BooklyL10n.dateRange.today] = [moment(), moment()];
291
+ picker_ranges[BooklyL10n.dateRange.last_7] = [moment().subtract(7, 'days'), moment()];
292
+ picker_ranges[BooklyL10n.dateRange.last_30] = [moment().subtract(30, 'days'), moment()];
293
  picker_ranges[BooklyL10n.dateRange.thisMonth] = [moment().startOf('month'), moment().endOf('month')];
294
  picker_ranges[BooklyL10n.dateRange.lastMonth] = [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')];
295
 
296
  $creationDateFilter.daterangepicker(
297
  {
298
+ parentEl: $creationDateFilter.parent(),
299
  startDate: pickers.creationDate.startDate,
300
+ endDate: pickers.creationDate.endDate,
301
+ ranges: picker_ranges,
302
+ showDropdowns: true,
303
  linkedCalendars: false,
304
  autoUpdateInput: false,
305
+ locale: $.extend({}, BooklyL10n.dateRange, BooklyL10n.datePicker)
306
  },
307
  function(start, end) {
308
  $creationDateFilter
312
  }
313
  );
314
 
315
+ $id_filter.on('keyup', function() { dt.ajax.reload(); });
316
+ $creationDateFilter.on('apply.daterangepicker', function() { dt.ajax.reload(); });
317
+ $type_filter.on('change', function() { dt.ajax.reload(); });
318
+ $customer_filter.on('change', function() { dt.ajax.reload(); });
319
+ $staff_filter.on('change', function() { dt.ajax.reload(); });
320
+ $service_filter.on('change', function() { dt.ajax.reload(); });
321
+ $status_filter.on('change', function() { dt.ajax.reload(); });
322
 
323
  /**
324
  * Delete payments.
325
  */
326
+ $delete_button.on('click', function() {
327
  if (confirm(BooklyL10n.areYouSure)) {
328
  var ladda = Ladda.create(this);
329
  ladda.start();
330
 
331
  var data = [];
332
  var $checkboxes = $payments_list.find('tbody input:checked');
333
+ $checkboxes.each(function() {
334
  data.push(this.value);
335
  });
336
 
343
  data: data
344
  },
345
  dataType: 'json',
346
+ success: function(response) {
347
  if (response.success) {
348
  dt.ajax.reload();
349
  } else {
355
  }
356
  });
357
 
358
+ $download_invoice.on('click', function() {
359
  var invoices = [];
360
+ $payments_list.find('tbody input:checked').each(function() {
361
  invoices.push(this.value);
362
  });
363
  if (invoices.length) {
backend/modules/services/Ajax.php CHANGED
@@ -227,7 +227,7 @@ class Ajax extends Page
227
  */
228
  public static function updateServiceCategories()
229
  {
230
- $categories = self::parameter( 'categories', array() );
231
  $existing_categories = array();
232
  foreach ( $categories as $category ) {
233
  if ( strpos( $category['id'], 'new' ) === false ) {
@@ -235,20 +235,25 @@ class Ajax extends Page
235
  }
236
  }
237
  // Delete categories
238
- Lib\Entities\Category::query( 'c' )->delete()->whereNotIn( 'c.id', $existing_categories )->execute();
239
  foreach ( $categories as $position => $category_data ) {
240
- if ( strpos( $category_data['id'], 'new' ) === false ) {
241
- $category = Lib\Entities\Category::find( $category_data['id'] );
242
- } else {
243
  $category = new Lib\Entities\Category();
 
 
244
  }
245
  $category
246
  ->setPosition( $position )
247
  ->setName( $category_data['name'] )
 
 
248
  ->save();
249
  }
250
-
251
- wp_send_json_success( Lib\Entities\Category::query()->sortBy( 'position' )->fetchArray() );
 
 
 
252
  }
253
 
254
  /**
227
  */
228
  public static function updateServiceCategories()
229
  {
230
+ $categories = self::parameter( 'categories', array() );
231
  $existing_categories = array();
232
  foreach ( $categories as $category ) {
233
  if ( strpos( $category['id'], 'new' ) === false ) {
235
  }
236
  }
237
  // Delete categories
238
+ Lib\Entities\Category::query()->delete()->whereNotIn( 'id', $existing_categories )->execute();
239
  foreach ( $categories as $position => $category_data ) {
240
+ if ( strpos( $category_data['id'], 'new' ) !== false ) {
 
 
241
  $category = new Lib\Entities\Category();
242
+ } else {
243
+ $category = Lib\Entities\Category::find( $category_data['id'] );
244
  }
245
  $category
246
  ->setPosition( $position )
247
  ->setName( $category_data['name'] )
248
+ ->setAttachmentId( $category_data['attachment_id'] ?: null )
249
+ ->setInfo( $category_data['info'] )
250
  ->save();
251
  }
252
+ $categories = Lib\Entities\Category::query()->sortBy( 'position' )->fetchArray();
253
+ foreach ( $categories as &$category ) {
254
+ $category['attachment'] = Lib\Utils\Common::getAttachmentUrl( $category['attachment_id'], 'thumbnail' ) ?: null;
255
+ }
256
+ wp_send_json_success( $categories );
257
  }
258
 
259
  /**
backend/modules/services/Page.php CHANGED
@@ -42,24 +42,27 @@ class Page extends Lib\Base\Ajax
42
  ->sortBy( 'position' )
43
  ->fetchArray();
44
  $categories = Lib\Entities\Category::query()->sortBy( 'position' )->fetchArray();
 
 
 
45
 
46
  $datatables = Lib\Utils\Tables::getSettings( 'services' );
47
 
48
  wp_localize_script( 'bookly-services-list.js', 'BooklyL10n', array(
49
- 'are_you_sure' => esc_attr__( 'Are you sure?', 'bookly' ),
50
- 'private_warning' => esc_attr__( 'The service will be created with the visibility of Private.', 'bookly' ),
51
- 'edit' => esc_attr__( 'Edit', 'bookly' ),
52
- 'duplicate' => esc_attr__( 'Duplicate', 'bookly' ),
53
- 'reorder' => esc_attr__( 'Reorder', 'bookly' ),
54
- 'staff' => $staff,
55
- 'categories' => $categories,
56
- 'uncategorized' => esc_attr__( 'Uncategorized', 'bookly' ),
57
- 'services' => $services,
58
- 'noResultFound' => esc_attr__( 'No result found', 'bookly' ),
59
- 'zeroRecords' => esc_attr__( 'No records.', 'bookly' ),
60
- 'processing' => esc_attr__( 'Processing...', 'bookly' ),
61
- 'show_type' => count( Proxy\Shared::prepareServiceTypes( array() ) ) > 0,
62
- 'datatables' => $datatables,
63
  ) );
64
 
65
  foreach ( $services as &$service ) {
42
  ->sortBy( 'position' )
43
  ->fetchArray();
44
  $categories = Lib\Entities\Category::query()->sortBy( 'position' )->fetchArray();
45
+ foreach ( $categories as &$category ) {
46
+ $category['attachment'] = Lib\Utils\Common::getAttachmentUrl( $category['attachment_id'], 'thumbnail' ) ?: null;
47
+ }
48
 
49
  $datatables = Lib\Utils\Tables::getSettings( 'services' );
50
 
51
  wp_localize_script( 'bookly-services-list.js', 'BooklyL10n', array(
52
+ 'are_you_sure' => esc_attr__( 'Are you sure?', 'bookly' ),
53
+ 'private_warning' => esc_attr__( 'The service will be created with the visibility of Private.', 'bookly' ),
54
+ 'edit' => esc_attr__( 'Edit', 'bookly' ),
55
+ 'duplicate' => esc_attr__( 'Duplicate', 'bookly' ),
56
+ 'reorder' => esc_attr__( 'Reorder', 'bookly' ),
57
+ 'staff' => $staff,
58
+ 'categories' => $categories,
59
+ 'uncategorized' => esc_attr__( 'Uncategorized', 'bookly' ),
60
+ 'services' => $services,
61
+ 'noResultFound' => esc_attr__( 'No result found', 'bookly' ),
62
+ 'zeroRecords' => esc_attr__( 'No records.', 'bookly' ),
63
+ 'processing' => esc_attr__( 'Processing...', 'bookly' ),
64
+ 'show_type' => count( Proxy\Shared::prepareServiceTypes( array() ) ) > 0,
65
+ 'datatables' => $datatables,
66
  ) );
67
 
68
  foreach ( $services as &$service ) {
backend/modules/services/resources/js/services-list.js CHANGED
@@ -1,27 +1,27 @@
1
- jQuery(function ($) {
2
- let $servicesList = $('#services-list'),
3
  $checkAllButton = $('#bookly-check-all'),
4
  filters = {
5
  category: $('#bookly-filter-category'),
6
  search: $('#bookly-filter-search')
7
  },
8
- $deleteButton = $('#bookly-delete'),
9
- $deleteModal = $('.bookly-js-delete-cascade-confirm'),
10
- urlParts = document.URL.split('#'),
11
- columns = [],
12
- order = []
13
  ;
14
 
15
  $('.bookly-js-select').val(null);
16
 
17
  // Apply filter from anchor
18
  if (urlParts.length > 1) {
19
- urlParts[1].split('&').forEach(function (part) {
20
  var params = part.split('=');
21
  $('#bookly-filter-' + params[0]).val(params[1]);
22
  });
23
  } else {
24
- $.each(BooklyL10n.datatables.services.settings.filter, function (field, value) {
25
  if (value != '') {
26
  $('#bookly-filter-' + field).val(value);
27
  }
@@ -39,30 +39,32 @@ jQuery(function ($) {
39
  */
40
  if (BooklyL10n.show_type) {
41
  columns.push({
 
42
  responsivePriority: 1,
43
  orderable: false,
44
- render: function (data, type, row, meta) {
45
  return '<i class="' + row.type_icon + ' fa-fw" title="' + row.type + '"></i>';
46
  },
47
  });
48
  }
49
  columns.push({
 
50
  responsivePriority: 1,
51
  orderable: false,
52
- render: function (data, type, row, meta) {
53
  return '<i class="fas fa-fw fa-circle" style="color:' + row.colors[0] + ';">';
54
  }
55
  });
56
 
57
- $.each(BooklyL10n.datatables.services.settings.columns, function (column, show) {
58
  if (show) {
59
  switch (column) {
60
  case 'category_id':
61
  columns.push({
62
  data: column,
63
- render: function (data, type, row, meta) {
64
  if (row.category != null) {
65
- return BooklyL10n.categories.find(function (category) {
66
  return category.id === row.category;
67
  }).name;
68
  } else {
@@ -74,7 +76,7 @@ jQuery(function ($) {
74
  case 'online_meetings':
75
  columns.push({
76
  data: column,
77
- render: function (data, type, row, meta) {
78
  switch (data) {
79
  case 'zoom':
80
  return '<span class="badge badge-secondary"><i class="fas fa-video fa-fw"></i> Zoom</span>';
@@ -97,26 +99,28 @@ jQuery(function ($) {
97
  }
98
  });
99
  columns.push({
 
100
  responsivePriority: 2,
101
  orderable: false,
102
  searchable: false,
103
- render: function (data, type, row, meta) {
104
  return '<div class="d-inline-flex"><button type="button" class="btn btn-default mr-1" data-action="edit"><i class="far fa-fw fa-edit mr-lg-1"></i><span class="d-none d-lg-inline">' + BooklyL10n.edit + '…</span></button><button type="button" class="btn btn-default ladda-button" data-action="duplicate" data-spinner-size="40" data-style="zoom-in" data-spinner-color="#666666"><span class="ladda-label"><i class="far fa-fw fa-clone mr-lg-1"></i><span class="d-none d-lg-inline">' + BooklyL10n.duplicate + '…</span></span></button></div>';
105
  }
106
  });
107
  columns.push({
 
108
  responsivePriority: 1,
109
  orderable: false,
110
  searchable: false,
111
- render: function (data, type, row, meta) {
112
  return '<div class="custom-control custom-checkbox">' +
113
  '<input value="' + row.id + '" id="bookly-dt-' + row.id + '" type="checkbox" class="custom-control-input">' +
114
  '<label for="bookly-dt-' + row.id + '" class="custom-control-label"></label>' +
115
  '</div>';
116
  }
117
  });
118
- $.each(BooklyL10n.datatables.services.settings.order, function (_, value) {
119
- const index = columns.findIndex(function (c) { return c.data === value.column; });
120
  if (index !== -1) {
121
  order.push([index, value.order]);
122
  }
@@ -126,31 +130,31 @@ jQuery(function ($) {
126
  * Init DataTables.
127
  */
128
  var dt = $servicesList.DataTable({
129
- order : order,
130
- info : false,
131
- searching : false,
132
  lengthChange: false,
133
- processing : true,
134
- responsive : true,
135
- pageLength : 25,
136
- pagingType : 'numbers',
137
- serverSide : true,
138
- ajax : {
139
  url: ajaxurl,
140
  type: 'POST',
141
- data: function (d) {
142
  let data = $.extend({action: 'bookly_get_services', csrf_token: BooklyL10nGlobal.csrf_token, filter: {}}, d);
143
 
144
- Object.keys(filters).map(function (filter) {data.filter[filter] = filters[filter].val();});
145
 
146
  return data;
147
  }
148
  },
149
- columns : columns,
150
- dom : "<'row'<'col-sm-12'tr>><'row float-left mt-3'<'col-sm-12'p>>",
151
- language : {
152
  zeroRecords: BooklyL10n.zeroRecords,
153
- processing : BooklyL10n.processing
154
  }
155
  });
156
 
@@ -158,10 +162,10 @@ jQuery(function ($) {
158
  * On filter search change.
159
  */
160
  filters.search
161
- .on('keyup', function () {
162
  dt.ajax.reload();
163
  })
164
- .on('keydown', function (e) {
165
  if (e.keyCode == 13) {
166
  e.preventDefault();
167
  return false;
@@ -169,25 +173,25 @@ jQuery(function ($) {
169
  })
170
  ;
171
  filters.category
172
- .on('change', function () {
173
  dt.ajax.reload();
174
  });
175
 
176
  /**
177
  * Select all appointments.
178
  */
179
- $checkAllButton.on('change', function () {
180
  $servicesList.find('tbody input:checkbox').prop('checked', this.checked);
181
  });
182
 
183
  /**
184
  * On appointment select.
185
  */
186
- $servicesList.on('change', 'tbody input:checkbox', function () {
187
  $checkAllButton.prop('checked', $servicesList.find('tbody input:not(:checked)').length == 0);
188
  });
189
 
190
- $deleteButton.on('click', function (e) {
191
  e.preventDefault();
192
  let data = {
193
  action: 'bookly_remove_services',
@@ -196,27 +200,27 @@ jQuery(function ($) {
196
  services = [],
197
  button = this;
198
 
199
- var delete_services = function (ajaxurl, data) {
200
- var ladda = rangeTools.ladda(button),
201
  service_ids = [],
202
  $checkboxes = $servicesList.find('tbody input:checked');
203
 
204
- $checkboxes.each(function () {
205
  service_ids.push(dt.row($(this).closest('td')).data().id);
206
  });
207
  data['service_ids[]'] = service_ids;
208
 
209
- $.post(ajaxurl, data, function (response) {
210
  if (!response.success) {
211
  switch (response.data.action) {
212
  case 'show_modal':
213
  $deleteModal
214
  .booklyModal('show');
215
- $('.bookly-js-delete', $deleteModal).off().on('click', function () {
216
  delete_services(ajaxurl, $.extend(data, {force_delete: true}));
217
  $deleteModal.booklyModal('hide');
218
  });
219
- $('.bookly-js-edit', $deleteModal).off().on('click', function () {
220
  rangeTools.ladda(this);
221
  window.location.href = response.data.filter_url;
222
  });
@@ -238,7 +242,7 @@ jQuery(function ($) {
238
  delete_services(ajaxurl, data);
239
  });
240
 
241
- $servicesList.on('click', '[data-action="duplicate"]', function () {
242
  if (confirm(BooklyL10n.are_you_sure + "\n\n" + BooklyL10n.private_warning)) {
243
  let ladda = rangeTools.ladda(this),
244
  $tr = $(this).closest('tr'),
@@ -250,7 +254,7 @@ jQuery(function ($) {
250
  service_id: data.id,
251
  csrf_token: BooklyL10nGlobal.csrf_token,
252
  },
253
- function (response) {
254
  if (response.success) {
255
  dt.ajax.reload();
256
  BooklyServiceOrderDialogL10n.services.push({id: response.data.id, title: response.data.title});
@@ -271,7 +275,7 @@ jQuery(function ($) {
271
  allowClear: true,
272
  placeholder: '',
273
  language: {
274
- noResults: function () {
275
  return BooklyL10n.noResultFound;
276
  }
277
  }
1
+ jQuery(function($) {
2
+ let $servicesList = $('#services-list'),
3
  $checkAllButton = $('#bookly-check-all'),
4
  filters = {
5
  category: $('#bookly-filter-category'),
6
  search: $('#bookly-filter-search')
7
  },
8
+ $deleteButton = $('#bookly-delete'),
9
+ $deleteModal = $('.bookly-js-delete-cascade-confirm'),
10
+ urlParts = document.URL.split('#'),
11
+ columns = [],
12
+ order = []
13
  ;
14
 
15
  $('.bookly-js-select').val(null);
16
 
17
  // Apply filter from anchor
18
  if (urlParts.length > 1) {
19
+ urlParts[1].split('&').forEach(function(part) {
20
  var params = part.split('=');
21
  $('#bookly-filter-' + params[0]).val(params[1]);
22
  });
23
  } else {
24
+ $.each(BooklyL10n.datatables.services.settings.filter, function(field, value) {
25
  if (value != '') {
26
  $('#bookly-filter-' + field).val(value);
27
  }
39
  */
40
  if (BooklyL10n.show_type) {
41
  columns.push({
42
+ data: null,
43
  responsivePriority: 1,
44
  orderable: false,
45
+ render: function(data, type, row, meta) {
46
  return '<i class="' + row.type_icon + ' fa-fw" title="' + row.type + '"></i>';
47
  },
48
  });
49
  }
50
  columns.push({
51
+ data: null,
52
  responsivePriority: 1,
53
  orderable: false,
54
+ render: function(data, type, row, meta) {
55
  return '<i class="fas fa-fw fa-circle" style="color:' + row.colors[0] + ';">';
56
  }
57
  });
58
 
59
+ $.each(BooklyL10n.datatables.services.settings.columns, function(column, show) {
60
  if (show) {
61
  switch (column) {
62
  case 'category_id':
63
  columns.push({
64
  data: column,
65
+ render: function(data, type, row, meta) {
66
  if (row.category != null) {
67
+ return BooklyL10n.categories.find(function(category) {
68
  return category.id === row.category;
69
  }).name;
70
  } else {
76
  case 'online_meetings':
77
  columns.push({
78
  data: column,
79
+ render: function(data, type, row, meta) {
80
  switch (data) {
81
  case 'zoom':
82
  return '<span class="badge badge-secondary"><i class="fas fa-video fa-fw"></i> Zoom</span>';
99
  }
100
  });
101
  columns.push({
102
+ data: null,
103
  responsivePriority: 2,
104
  orderable: false,
105
  searchable: false,
106
+ render: function(data, type, row, meta) {
107
  return '<div class="d-inline-flex"><button type="button" class="btn btn-default mr-1" data-action="edit"><i class="far fa-fw fa-edit mr-lg-1"></i><span class="d-none d-lg-inline">' + BooklyL10n.edit + '…</span></button><button type="button" class="btn btn-default ladda-button" data-action="duplicate" data-spinner-size="40" data-style="zoom-in" data-spinner-color="#666666"><span class="ladda-label"><i class="far fa-fw fa-clone mr-lg-1"></i><span class="d-none d-lg-inline">' + BooklyL10n.duplicate + '…</span></span></button></div>';
108
  }
109
  });
110
  columns.push({
111
+ data: null,
112
  responsivePriority: 1,
113
  orderable: false,
114
  searchable: false,
115
+ render: function(data, type, row, meta) {
116
  return '<div class="custom-control custom-checkbox">' +
117
  '<input value="' + row.id + '" id="bookly-dt-' + row.id + '" type="checkbox" class="custom-control-input">' +
118
  '<label for="bookly-dt-' + row.id + '" class="custom-control-label"></label>' +
119
  '</div>';
120
  }
121
  });
122
+ $.each(BooklyL10n.datatables.services.settings.order, function(_, value) {
123
+ const index = columns.findIndex(function(c) { return c.data === value.column; });
124
  if (index !== -1) {
125
  order.push([index, value.order]);
126
  }
130
  * Init DataTables.
131
  */
132
  var dt = $servicesList.DataTable({
133
+ order: order,
134
+ info: false,
135
+ searching: false,
136
  lengthChange: false,
137
+ processing: true,
138
+ responsive: true,
139
+ pageLength: 25,
140
+ pagingType: 'numbers',
141
+ serverSide: true,
142
+ ajax: {
143
  url: ajaxurl,
144
  type: 'POST',
145
+ data: function(d) {
146
  let data = $.extend({action: 'bookly_get_services', csrf_token: BooklyL10nGlobal.csrf_token, filter: {}}, d);
147
 
148
+ Object.keys(filters).map(function(filter) {data.filter[filter] = filters[filter].val();});
149
 
150
  return data;
151
  }
152
  },
153
+ columns: columns,
154
+ dom: "<'row'<'col-sm-12'tr>><'row float-left mt-3'<'col-sm-12'p>>",
155
+ language: {
156
  zeroRecords: BooklyL10n.zeroRecords,
157
+ processing: BooklyL10n.processing
158
  }
159
  });
160
 
162
  * On filter search change.
163
  */
164
  filters.search
165
+ .on('keyup', function() {
166
  dt.ajax.reload();
167
  })
168
+ .on('keydown', function(e) {
169
  if (e.keyCode == 13) {
170
  e.preventDefault();
171
  return false;
173
  })
174
  ;
175
  filters.category
176
+ .on('change', function() {
177
  dt.ajax.reload();
178
  });
179
 
180
  /**
181
  * Select all appointments.
182
  */
183
+ $checkAllButton.on('change', function() {
184
  $servicesList.find('tbody input:checkbox').prop('checked', this.checked);
185
  });
186
 
187
  /**
188
  * On appointment select.
189
  */
190
+ $servicesList.on('change', 'tbody input:checkbox', function() {
191
  $checkAllButton.prop('checked', $servicesList.find('tbody input:not(:checked)').length == 0);
192
  });
193
 
194
+ $deleteButton.on('click', function(e) {
195
  e.preventDefault();
196
  let data = {
197
  action: 'bookly_remove_services',
200
  services = [],
201
  button = this;
202
 
203
+ var delete_services = function(ajaxurl, data) {
204
+ var ladda = rangeTools.ladda(button),
205
  service_ids = [],
206
  $checkboxes = $servicesList.find('tbody input:checked');
207
 
208
+ $checkboxes.each(function() {
209
  service_ids.push(dt.row($(this).closest('td')).data().id);
210
  });
211
  data['service_ids[]'] = service_ids;
212
 
213
+ $.post(ajaxurl, data, function(response) {
214
  if (!response.success) {
215
  switch (response.data.action) {
216
  case 'show_modal':
217
  $deleteModal
218
  .booklyModal('show');
219
+ $('.bookly-js-delete', $deleteModal).off().on('click', function() {
220
  delete_services(ajaxurl, $.extend(data, {force_delete: true}));
221
  $deleteModal.booklyModal('hide');
222
  });
223
+ $('.bookly-js-edit', $deleteModal).off().on('click', function() {
224
  rangeTools.ladda(this);
225
  window.location.href = response.data.filter_url;
226
  });
242
  delete_services(ajaxurl, data);
243
  });
244
 
245
+ $servicesList.on('click', '[data-action="duplicate"]', function() {
246
  if (confirm(BooklyL10n.are_you_sure + "\n\n" + BooklyL10n.private_warning)) {
247
  let ladda = rangeTools.ladda(this),
248
  $tr = $(this).closest('tr'),
254
  service_id: data.id,
255
  csrf_token: BooklyL10nGlobal.csrf_token,
256
  },
257
+ function(response) {
258
  if (response.success) {
259
  dt.ajax.reload();
260
  BooklyServiceOrderDialogL10n.services.push({id: response.data.id, title: response.data.title});
275
  allowClear: true,
276
  placeholder: '',
277
  language: {
278
+ noResults: function() {
279
  return BooklyL10n.noResultFound;
280
  }
281
  }
backend/modules/settings/Codes.php CHANGED
@@ -3,6 +3,7 @@ namespace Bookly\Backend\Modules\Settings;
3
 
4
  /**
5
  * Class Codes
 
6
  * @package Bookly\Backend\Modules\Settings
7
  */
8
  class Codes
@@ -15,59 +16,71 @@ class Codes
15
  */
16
  public static function getJson( $section )
17
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  switch ( $section ) {
19
  case 'calendar_one_participant' :
 
 
20
  case 'calendar_many_participants' :
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  $codes = array(
22
  'appointment_date' => array( 'description' => __( 'Date of appointment', 'bookly' ), 'if' => true ),
23
  'appointment_time' => array( 'description' => __( 'Time of appointment', 'bookly' ), 'if' => true ),
24
- 'booking_number' => array( 'description' => __( 'Booking number', 'bookly' ) ),
25
- 'category_name' => array( 'description' => __( 'Name of category', 'bookly' ), 'if' => true ),
26
- 'company_address' => array( 'description' => __( 'Address of company', 'bookly' ), 'if' => true ),
27
- 'company_name' => array( 'description' => __( 'Name of company', 'bookly' ), 'if' => true ),
28
- 'company_phone' => array( 'description' => __( 'Company phone', 'bookly' ), 'if' => true ),
29
- 'company_website' => array( 'description' => __( 'Company web-site address', 'bookly' ), 'if' => true ),
30
- 'internal_note' => array( 'description' => __( 'Internal note', 'bookly' ), 'if' => true ),
31
- 'service_capacity' => array( 'description' => __( 'Capacity of service', 'bookly' ) ),
32
- 'service_duration' => array( 'description' => __( 'Duration of service', 'bookly' ) ),
33
- 'service_info' => array( 'description' => __( 'Info of service', 'bookly' ), 'if' => true ),
34
  'service_name' => array( 'description' => __( 'Name of service', 'bookly' ) ),
35
  'service_price' => array( 'description' => __( 'Price of service', 'bookly' ), 'if' => true ),
36
- 'staff_email' => array( 'description' => __( 'Email of staff', 'bookly' ), 'if' => true ),
37
- 'staff_info' => array( 'description' => __( 'Info of staff', 'bookly' ), 'if' => true ),
38
  'staff_name' => array( 'description' => __( 'Name of staff', 'bookly' ) ),
39
- 'staff_phone' => array( 'description' => __( 'Phone of staff', 'bookly' ), 'if' => true ),
40
- );
41
- $client_codes = array(
42
- 'appointment_notes' => array( 'description' => __( 'Customer notes for appointment', 'bookly' ), 'if' => true ),
43
- 'booking_number' => array( 'description' => __( 'Booking number', 'bookly' ) ),
44
- 'client_email' => array( 'description' => __( 'Email of client', 'bookly' ), 'if' => true ),
45
- 'client_first_name' => array( 'description' => __( 'First name of client', 'bookly' ), 'if' => true ),
46
- 'client_last_name' => array( 'description' => __( 'Last name of client', 'bookly' ), 'if' => true ),
47
  'client_name' => array( 'description' => __( 'Full name of client', 'bookly' ) ),
48
- 'client_note' => array( 'description' => __( 'Note of client', 'bookly' ) ),
49
  'client_phone' => array( 'description' => __( 'Phone of client', 'bookly' ), 'if' => true ),
50
- 'payment_status' => array( 'description' => __( 'Status of payment', 'bookly' ) ),
51
- 'payment_type' => array( 'description' => __( 'Payment type', 'bookly' ) ),
52
- 'status' => array( 'description' => __( 'Status of appointment', 'bookly' ) ),
53
  );
54
- if ( $section == 'calendar_one_participant' ) {
55
- $codes = array_merge( $codes, $client_codes );
56
- }
57
- if ( $section == 'calendar_many_participants' ) {
58
- $codes = array_merge( $codes, array(
59
- 'participants' => array(
60
- 'description' => array(
61
- __( 'Loop over participants list', 'bookly' ),
62
- __( 'Loop over participants list with delimiter', 'bookly' ),
63
- ),
64
- 'loop' => array(
65
- 'item' => 'participant',
66
- 'codes' => $client_codes,
67
- ),
68
- ),
69
- ) );
70
- }
71
  break;
72
  default:
73
  $codes = array();
3
 
4
  /**
5
  * Class Codes
6
+ *
7
  * @package Bookly\Backend\Modules\Settings
8
  */
9
  class Codes
16
  */
17
  public static function getJson( $section )
18
  {
19
+ $appointment_codes = array(
20
+ 'appointment_id' => array( 'description' => __( 'Appointment ID', 'bookly' ) ),
21
+ 'appointment_date' => array( 'description' => __( 'Date of appointment', 'bookly' ), 'if' => true ),
22
+ 'appointment_time' => array( 'description' => __( 'Time of appointment', 'bookly' ), 'if' => true ),
23
+ 'booking_number' => array( 'description' => __( 'Booking number', 'bookly' ) ),
24
+ 'category_name' => array( 'description' => __( 'Name of category', 'bookly' ), 'if' => true ),
25
+ 'company_address' => array( 'description' => __( 'Address of company', 'bookly' ), 'if' => true ),
26
+ 'company_name' => array( 'description' => __( 'Name of company', 'bookly' ), 'if' => true ),
27
+ 'company_phone' => array( 'description' => __( 'Company phone', 'bookly' ), 'if' => true ),
28
+ 'company_website' => array( 'description' => __( 'Company web-site address', 'bookly' ), 'if' => true ),
29
+ 'internal_note' => array( 'description' => __( 'Internal note', 'bookly' ), 'if' => true ),
30
+ 'service_capacity' => array( 'description' => __( 'Capacity of service', 'bookly' ) ),
31
+ 'service_duration' => array( 'description' => __( 'Duration of service', 'bookly' ) ),
32
+ 'service_info' => array( 'description' => __( 'Info of service', 'bookly' ), 'if' => true ),
33
+ 'service_name' => array( 'description' => __( 'Name of service', 'bookly' ) ),
34
+ 'service_price' => array( 'description' => __( 'Price of service', 'bookly' ), 'if' => true ),
35
+ 'staff_email' => array( 'description' => __( 'Email of staff', 'bookly' ), 'if' => true ),
36
+ 'staff_info' => array( 'description' => __( 'Info of staff', 'bookly' ), 'if' => true ),
37
+ 'staff_name' => array( 'description' => __( 'Name of staff', 'bookly' ) ),
38
+ 'staff_phone' => array( 'description' => __( 'Phone of staff', 'bookly' ), 'if' => true ),
39
+ );
40
+ $client_codes = array(
41
+ 'appointment_id' => array( 'description' => __( 'Appointment ID', 'bookly' ) ),
42
+ 'appointment_notes' => array( 'description' => __( 'Customer notes for appointment', 'bookly' ), 'if' => true ),
43
+ 'booking_number' => array( 'description' => __( 'Booking number', 'bookly' ) ),
44
+ 'client_email' => array( 'description' => __( 'Email of client', 'bookly' ), 'if' => true ),
45
+ 'client_first_name' => array( 'description' => __( 'First name of client', 'bookly' ), 'if' => true ),
46
+ 'client_last_name' => array( 'description' => __( 'Last name of client', 'bookly' ), 'if' => true ),
47
+ 'client_name' => array( 'description' => __( 'Full name of client', 'bookly' ) ),
48
+ 'client_note' => array( 'description' => __( 'Note of client', 'bookly' ) ),
49
+ 'client_phone' => array( 'description' => __( 'Phone of client', 'bookly' ), 'if' => true ),
50
+ 'payment_status' => array( 'description' => __( 'Status of payment', 'bookly' ) ),
51
+ 'payment_type' => array( 'description' => __( 'Payment type', 'bookly' ) ),
52
+ 'status' => array( 'description' => __( 'Status of appointment', 'bookly' ) ),
53
+ );
54
  switch ( $section ) {
55
  case 'calendar_one_participant' :
56
+ $codes = array_merge( $appointment_codes, $client_codes );
57
+ break;
58
  case 'calendar_many_participants' :
59
+ $codes = array_merge( $appointment_codes, array(
60
+ 'participants' => array(
61
+ 'description' => array(
62
+ __( 'Loop over participants list', 'bookly' ),
63
+ __( 'Loop over participants list with delimiter', 'bookly' ),
64
+ ),
65
+ 'loop' => array(
66
+ 'item' => 'participant',
67
+ 'codes' => $client_codes,
68
+ ),
69
+ ),
70
+ ) );
71
+ break;
72
+ case 'ics_for_staff' :
73
+ case 'ics_for_customer' :
74
  $codes = array(
75
  'appointment_date' => array( 'description' => __( 'Date of appointment', 'bookly' ), 'if' => true ),
76
  'appointment_time' => array( 'description' => __( 'Time of appointment', 'bookly' ), 'if' => true ),
 
 
 
 
 
 
 
 
 
 
77
  'service_name' => array( 'description' => __( 'Name of service', 'bookly' ) ),
78
  'service_price' => array( 'description' => __( 'Price of service', 'bookly' ), 'if' => true ),
 
 
79
  'staff_name' => array( 'description' => __( 'Name of staff', 'bookly' ) ),
 
 
 
 
 
 
 
 
80
  'client_name' => array( 'description' => __( 'Full name of client', 'bookly' ) ),
81
+ 'client_email' => array( 'description' => __( 'Email of client', 'bookly' ), 'if' => true ),
82
  'client_phone' => array( 'description' => __( 'Phone of client', 'bookly' ), 'if' => true ),
 
 
 
83
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  break;
85
  default:
86
  $codes = array();
backend/modules/settings/Page.php CHANGED
@@ -98,6 +98,7 @@ class Page extends Lib\Base\Ajax
98
  if ( in_array( $bookly_gen_time_slot_length, array( 2, 4, 5, 10, 12, 15, 20, 30, 45, 60, 90, 120, 180, 240, 360 ) ) ) {
99
  update_option( 'bookly_gen_time_slot_length', $bookly_gen_time_slot_length );
100
  }
 
101
  update_option( 'bookly_gen_service_duration_as_slot_length', (int) self::parameter( 'bookly_gen_service_duration_as_slot_length' ) );
102
  update_option( 'bookly_gen_allow_staff_edit_profile', (int) self::parameter( 'bookly_gen_allow_staff_edit_profile' ) );
103
  update_option( 'bookly_gen_link_assets_method', self::parameter( 'bookly_gen_link_assets_method' ) );
98
  if ( in_array( $bookly_gen_time_slot_length, array( 2, 4, 5, 10, 12, 15, 20, 30, 45, 60, 90, 120, 180, 240, 360 ) ) ) {
99
  update_option( 'bookly_gen_time_slot_length', $bookly_gen_time_slot_length );
100
  }
101
+ update_option( 'bookly_gen_delete_data_on_uninstall', self::parameter( 'bookly_gen_delete_data_on_uninstall' ) );
102
  update_option( 'bookly_gen_service_duration_as_slot_length', (int) self::parameter( 'bookly_gen_service_duration_as_slot_length' ) );
103
  update_option( 'bookly_gen_allow_staff_edit_profile', (int) self::parameter( 'bookly_gen_allow_staff_edit_profile' ) );
104
  update_option( 'bookly_gen_link_assets_method', self::parameter( 'bookly_gen_link_assets_method' ) );
backend/modules/settings/resources/js/settings.js CHANGED
@@ -54,12 +54,12 @@ jQuery(function ($) {
54
  $defaultCountry.on('change', function () {
55
  $defaultCountryCode.val($defaultCountry.find('option:selected').data('code'));
56
  });
57
- let $sortableAddress = $('#bookly_cst_address_show_fields');
58
- if ($sortableAddress.length) {
59
- Sortable.create($sortableAddress[0], {
60
  handle: '.bookly-js-draghandle'
61
  });
62
- }
 
63
  $('#bookly-customer-reset').on('click', function (event) {
64
  $defaultCountry.val($defaultCountry.data('country'));
65
  });
@@ -201,13 +201,6 @@ jQuery(function ($) {
201
  $input.val($input.data('default'));
202
  });
203
 
204
- // Cart tab.
205
- let $sortableCart = $('#bookly_cart_show_columns');
206
- if ($sortableCart.length) {
207
- Sortable.create($sortableCart[0], {
208
- handle: '.bookly-js-draghandle'
209
- });
210
- }
211
  // Payments tab.
212
  Sortable.create($('#bookly-payment-systems')[0], {
213
  handle: '.bookly-js-draghandle',
@@ -242,54 +235,13 @@ jQuery(function ($) {
242
  }).trigger('change');
243
 
244
  $('#bookly_paypal_enabled').change(function () {
245
- $('.bookly-paypal-ec').toggle(this.value == 'ec');
246
  $('.bookly-paypal-ps').toggle(this.value == 'ps');
247
  $('.bookly-paypal-checkout').toggle(this.value == 'checkout');
248
  $('.bookly-paypal').toggle(this.value != '0');
249
  $('#bookly_paypal_timeout').closest('.form-group').toggle(this.value != 'ec');
250
  }).change();
251
 
252
- $('#bookly_authorize_net_enabled').change(function () {
253
- $('.bookly-authorize-net').toggle(this.value != '0');
254
- }).change();
255
-
256
- $('#bookly_stripe_enabled').change(function () {
257
- $('.bookly-stripe').toggle(this.value == 1);
258
- }).change();
259
-
260
- $('#bookly_2checkout_enabled').change(function () {
261
- $('.bookly-2checkout').toggle(this.value != '0');
262
- }).change();
263
-
264
- $('#bookly_payu_biz_enabled').change(function () {
265
- $('.bookly-payu_biz').toggle(this.value != '0');
266
- }).change();
267
-
268
- $('#bookly_payu_latam_enabled').change(function () {
269
- $('.bookly-payu_latam').toggle(this.value != '0');
270
- }).change();
271
-
272
- $('#bookly_payson_enabled').change(function () {
273
- $('.bookly-payson').toggle(this.value != '0');
274
- }).change();
275
-
276
- $('#bookly_mollie_enabled').change(function () {
277
- $('.bookly-mollie').toggle(this.value != '0');
278
- }).change();
279
-
280
- $('#bookly_payu_biz_sandbox').change(function () {
281
- var live = this.value != 1;
282
- $('.bookly-payu_biz > .form-group:eq(1)').toggle(live);
283
- $('.bookly-payu_biz > .form-group:eq(2)').toggle(live);
284
- }).change();
285
-
286
- $('#bookly_payu_latam_sandbox').change(function () {
287
- var live = this.value != 1;
288
- $('.bookly-payu_latam > .form-group:eq(1)').toggle(live);
289
- $('.bookly-payu_latam > .form-group:eq(2)').toggle(live);
290
- $('.bookly-payu_latam > .form-group:eq(3)').toggle(live);
291
- }).change();
292
-
293
  $('#bookly-payments-reset').on('click', function (event) {
294
  setTimeout(function () {
295
  $('#bookly_pmt_currency,#bookly_paypal_enabled,#bookly_authorize_net_enabled,#bookly_stripe_enabled,#bookly_2checkout_enabled,#bookly_payu_biz_enabled,#bookly_payu_latam_enabled,#bookly_payson_enabled,#bookly_mollie_enabled,#bookly_payu_biz_sandbox,#bookly_payu_latam_sandbox,#bookly_cloud_stripe_enabled').change();
@@ -385,15 +337,9 @@ jQuery(function ($) {
385
  $helpBtn.attr('href', help_link + e.target.getAttribute('href').substring(1).replace(/_/g, '-'));
386
  });
387
 
388
- // Activate tab.
389
- $('a[href="#bookly_settings_' + BooklyL10n.current_tab + '"]').booklyTab('show');
390
-
391
  // Logs
392
 
393
  $logsAction.booklyDropdown().booklyDropdown('selectAll');
394
- $('#bookly_logs_enabled').on('change', function () {
395
- $('#bookly-logs-table-wrap', container.$log).toggle($(this).find('option:selected').val() === '1');
396
- }).trigger('change');
397
 
398
  $('#bookly-delete-logs').on('click', function () {
399
  if (confirm(BooklyL10n.are_you_sure)) {
@@ -474,11 +420,21 @@ jQuery(function ($) {
474
  }
475
  },
476
  columns: [
477
- {data: 'created_at'},
478
- {data: 'action'},
479
- {data: 'target'},
480
- {data: 'target_id'},
481
- {data: 'author'},
 
 
 
 
 
 
 
 
 
 
482
  {
483
  data: 'details',
484
  render: function (data, type, row, meta) {
@@ -488,10 +444,11 @@ jQuery(function ($) {
488
  return data;
489
  }
490
  },
491
- className: 'none'
 
492
  },
493
- {data: 'comment'},
494
- {data: 'ref', className: 'none'},
495
  ],
496
  dom: "<'row'<'col-sm-12'tr>><'row float-left mt-3'<'col-sm-12'p>>",
497
  language: {
@@ -499,6 +456,9 @@ jQuery(function ($) {
499
  processing: BooklyL10n.processing
500
  }
501
  });
 
 
 
502
 
503
  $logsDateFilter.on('apply.daterangepicker', function () {
504
  dt.ajax.reload();
@@ -552,4 +512,7 @@ jQuery(function ($) {
552
  ? $(selector).show()
553
  : $(selector).hide();
554
  }).trigger('change');
 
 
 
555
  });
54
  $defaultCountry.on('change', function () {
55
  $defaultCountryCode.val($defaultCountry.find('option:selected').data('code'));
56
  });
57
+ $('.bookly-js-drag-container').each(function () {
58
+ Sortable.create(this, {
 
59
  handle: '.bookly-js-draghandle'
60
  });
61
+ });
62
+
63
  $('#bookly-customer-reset').on('click', function (event) {
64
  $defaultCountry.val($defaultCountry.data('country'));
65
  });
201
  $input.val($input.data('default'));
202
  });
203
 
 
 
 
 
 
 
 
204
  // Payments tab.
205
  Sortable.create($('#bookly-payment-systems')[0], {
206
  handle: '.bookly-js-draghandle',
235
  }).trigger('change');
236
 
237
  $('#bookly_paypal_enabled').change(function () {
238
+ $('.bookly-paypal-express-checkout').toggle(this.value == 'ec');
239
  $('.bookly-paypal-ps').toggle(this.value == 'ps');
240
  $('.bookly-paypal-checkout').toggle(this.value == 'checkout');
241
  $('.bookly-paypal').toggle(this.value != '0');
242
  $('#bookly_paypal_timeout').closest('.form-group').toggle(this.value != 'ec');
243
  }).change();
244
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  $('#bookly-payments-reset').on('click', function (event) {
246
  setTimeout(function () {
247
  $('#bookly_pmt_currency,#bookly_paypal_enabled,#bookly_authorize_net_enabled,#bookly_stripe_enabled,#bookly_2checkout_enabled,#bookly_payu_biz_enabled,#bookly_payu_latam_enabled,#bookly_payson_enabled,#bookly_mollie_enabled,#bookly_payu_biz_sandbox,#bookly_payu_latam_sandbox,#bookly_cloud_stripe_enabled').change();
337
  $helpBtn.attr('href', help_link + e.target.getAttribute('href').substring(1).replace(/_/g, '-'));
338
  });
339
 
 
 
 
340
  // Logs
341
 
342
  $logsAction.booklyDropdown().booklyDropdown('selectAll');
 
 
 
343
 
344
  $('#bookly-delete-logs').on('click', function () {
345
  if (confirm(BooklyL10n.are_you_sure)) {
420
  }
421
  },
422
  columns: [
423
+ {data: 'created_at', responsivePriority: 0},
424
+ {data: 'action', responsivePriority: 0,
425
+ render: function (data, type, row, meta) {
426
+ return data === 'error'
427
+ ? '<span class="text-danger">ERROR</span>'
428
+ : data;
429
+ },
430
+ },
431
+ {data: 'target', responsivePriority: 2,
432
+ render: function (data, type, row, meta) {
433
+ return $('<div>', {dir: 'rtl', class: 'text-truncate', text: data.slice(data.indexOf('bookly-'))}).prop('outerHTML');
434
+ },
435
+ },
436
+ {data: 'target_id', responsivePriority: 1},
437
+ {data: 'author', responsivePriority: 1},
438
  {
439
  data: 'details',
440
  render: function (data, type, row, meta) {
444
  return data;
445
  }
446
  },
447
+ className: 'none',
448
+ responsivePriority: 2
449
  },
450
+ {data: 'comment', responsivePriority: 2},
451
+ {data: 'ref', className: 'none', responsivePriority: 1},
452
  ],
453
  dom: "<'row'<'col-sm-12'tr>><'row float-left mt-3'<'col-sm-12'p>>",
454
  language: {
456
  processing: BooklyL10n.processing
457
  }
458
  });
459
+ $('#bookly-sidebar a[data-toggle="bookly-pill"][href="#bookly_settings_logs"]').on('shown.bs.tab', function (e) {
460
+ dt.columns.adjust().responsive.recalc();
461
+ });
462
 
463
  $logsDateFilter.on('apply.daterangepicker', function () {
464
  dt.ajax.reload();
512
  ? $(selector).show()
513
  : $(selector).hide();
514
  }).trigger('change');
515
+
516
+ // Activate tab.
517
+ $('a[href="#bookly_settings_' + BooklyL10n.current_tab + '"]').click();
518
  });
backend/modules/settings/templates/_appointmentsForm.php CHANGED
@@ -19,12 +19,12 @@ if ( Config::customerGroupsActive() ) {
19
  <?php Proxy\Pro::renderAppointmentsSettings() ?>
20
  <div class="form-group">
21
  <label for="bookly-ics-customer-editor"><?php esc_html_e( 'ICS description for customers', 'bookly' ) ?></label>
22
- <?php Ace\Editor::render( 'bookly-ics-customer', 'bookly-ics-customer-editor', Codes::getJson( 'calendar_one_participant' ), get_option( 'bookly_l10n_ics_customer_template', '' ), 'bookly-ace-editor-h80' ) ?>
23
  <input type="hidden" name="bookly_l10n_ics_customer_template" value="<?php echo esc_attr( get_option( 'bookly_l10n_ics_customer_template', '' ) ) ?>"/>
24
  </div>
25
  <div class="form-group">
26
  <label for="bookly-ics-staff-editor"><?php esc_html_e( 'ICS description for staff', 'bookly' ) ?></label>
27
- <?php Ace\Editor::render( 'bookly-ics-staff', 'bookly-ics-staff-editor', Codes::getJson( 'calendar_one_participant' ), get_option( 'bookly_ics_staff_template', '' ), 'bookly-ace-editor-h80' ) ?>
28
  <input type="hidden" name="bookly_ics_staff_template" value="<?php echo esc_attr( get_option( 'bookly_ics_staff_template', '' ) ) ?>"/>
29
  </div>
30
  </div>
19
  <?php Proxy\Pro::renderAppointmentsSettings() ?>
20
  <div class="form-group">
21
  <label for="bookly-ics-customer-editor"><?php esc_html_e( 'ICS description for customers', 'bookly' ) ?></label>
22
+ <?php Ace\Editor::render( 'bookly-placeholders', 'bookly-ics-customer-editor', Codes::getJson( 'ics_for_customer' ), get_option( 'bookly_l10n_ics_customer_template', '' ), 'bookly-ace-editor-h80' ) ?>
23
  <input type="hidden" name="bookly_l10n_ics_customer_template" value="<?php echo esc_attr( get_option( 'bookly_l10n_ics_customer_template', '' ) ) ?>"/>
24
  </div>
25
  <div class="form-group">
26
  <label for="bookly-ics-staff-editor"><?php esc_html_e( 'ICS description for staff', 'bookly' ) ?></label>
27
+ <?php Ace\Editor::render( 'bookly-placeholders', 'bookly-ics-staff-editor', Codes::getJson( 'ics_for_staff' ), get_option( 'bookly_ics_staff_template', '' ), 'bookly-ace-editor-h80' ) ?>
28
  <input type="hidden" name="bookly_ics_staff_template" value="<?php echo esc_attr( get_option( 'bookly_ics_staff_template', '' ) ) ?>"/>
29
  </div>
30
  </div>
backend/modules/settings/templates/_cloud_stripe_settings.php CHANGED
@@ -7,15 +7,15 @@ use Bookly\Backend\Components\Controls\Elements;
7
  use Bookly\Lib\Entities\Payment;
8
  use Bookly\Backend\Modules\Appearance\Codes;
9
  ?>
10
- <div class="card bookly-collapse" data-slug="cloud_stripe">
11
  <div class="card-header d-flex align-items-center">
12
  <?php Elements::renderReorder() ?>
13
- <a href="#bookly_pmt_cloud_stripe" class="ml-2" role="button" data-toggle="collapse">
14
  Stripe Cloud
15
  </a>
16
  <img class="ml-auto" src="<?php echo plugins_url( 'frontend/modules/stripe/resources/images/stripe.png', Plugin::getMainFile() ) ?>"/>
17
  </div>
18
- <div id="bookly_pmt_cloud_stripe" class="collapse show">
19
  <div class="card-body">
20
  <?php Selects::renderSingle( 'bookly_cloud_stripe_enabled', null, null, array(), array( 'data-expand' => '1' ) ) ?>
21
  <div class="bookly_cloud_stripe_enabled-expander">
7
  use Bookly\Lib\Entities\Payment;
8
  use Bookly\Backend\Modules\Appearance\Codes;
9
  ?>
10
+ <div class="card bookly-collapse-with-arrow" data-slug="cloud_stripe">
11
  <div class="card-header d-flex align-items-center">
12
  <?php Elements::renderReorder() ?>
13
+ <a href="#bookly_pmt_cloud_stripe" class="ml-2" role="button" data-toggle="bookly-collapse">
14
  Stripe Cloud
15
  </a>
16
  <img class="ml-auto" src="<?php echo plugins_url( 'frontend/modules/stripe/resources/images/stripe.png', Plugin::getMainFile() ) ?>"/>
17
  </div>
18
+ <div id="bookly_pmt_cloud_stripe" class="bookly-collapse bookly-show">
19
  <div class="card-body">
20
  <?php Selects::renderSingle( 'bookly_cloud_stripe_enabled', null, null, array(), array( 'data-expand' => '1' ) ) ?>
21
  <div class="bookly_cloud_stripe_enabled-expander">
backend/modules/settings/templates/_generalForm.php CHANGED
@@ -10,6 +10,7 @@ use Bookly\Backend\Modules\Settings\Proxy;
10
  <form method="post" action="<?php echo esc_url( add_query_arg( 'tab', 'general' ) ) ?>">
11
  <div class="card-body">
12
  <?php
 
13
  Selects::renderSingle( 'bookly_gen_time_slot_length', __( 'Time slot length', 'bookly' ), __( 'Select a time interval which will be used as a step when building all time slots in the system.', 'bookly' ), $bookly_gen_time_slot_length );
14
  Selects::renderSingle( 'bookly_gen_service_duration_as_slot_length', __( 'Set slot length as service duration', 'bookly' ), __( 'Enable this option to make slot length equal to service duration at the Time step of booking form.', 'bookly' ) );
15
  Proxy\Pro::renderMinimumTimeRequirement();
10
  <form method="post" action="<?php echo esc_url( add_query_arg( 'tab', 'general' ) ) ?>">
11
  <div class="card-body">
12
  <?php
13
+ Selects::renderSingle( 'bookly_gen_delete_data_on_uninstall', __( 'Bookly data upon deleting Bookly items', 'bookly' ), __( 'If you choose Delete, all data associated with Bookly will be permanently deleted when deleting Bookly items (Bookly, Bookly Pro, or any Bookly add-on)', 'bookly' ), array( array( 0, __( 'Don\'t delete', 'bookly' ) ), array( 1, __( 'Delete', 'bookly' ) ), ) );
14
  Selects::renderSingle( 'bookly_gen_time_slot_length', __( 'Time slot length', 'bookly' ), __( 'Select a time interval which will be used as a step when building all time slots in the system.', 'bookly' ), $bookly_gen_time_slot_length );
15
  Selects::renderSingle( 'bookly_gen_service_duration_as_slot_length', __( 'Set slot length as service duration', 'bookly' ), __( 'Enable this option to make slot length equal to service duration at the Time step of booking form.', 'bookly' ) );
16
  Proxy\Pro::renderMinimumTimeRequirement();
backend/modules/settings/templates/_logsForm.php CHANGED
@@ -28,7 +28,7 @@ use Bookly\Lib\Utils\Log;
28
  data-txt-nothing-selected="<?php esc_attr_e( 'Nothing selected', 'bookly' ) ?>"
29
  data-hide-icon
30
  >
31
- <?php foreach ( array( Log::ACTION_CREATE, Log::ACTION_DELETE, Log::ACTION_UPDATE ) as $action ): ?>
32
  <li data-value="<?php echo esc_attr( $action ) ?>">
33
  <?php echo ucfirst( $action ) ?>
34
  </li>
@@ -48,7 +48,7 @@ use Bookly\Lib\Utils\Log;
48
  </div>
49
  </div>
50
  <div class="table-responsive">
51
- <table id="bookly-logs-table" class="table table-striped table-hover nowrap w-100">
52
  <thead>
53
  <tr>
54
  <th><?php esc_html_e( 'Date', 'bookly' ) ?></th>
28
  data-txt-nothing-selected="<?php esc_attr_e( 'Nothing selected', 'bookly' ) ?>"
29
  data-hide-icon
30
  >
31
+ <?php foreach ( array( Log::ACTION_CREATE, Log::ACTION_DELETE, Log::ACTION_UPDATE, Log::ACTION_ERROR ) as $action ): ?>
32
  <li data-value="<?php echo esc_attr( $action ) ?>">
33
  <?php echo ucfirst( $action ) ?>
34
  </li>
48
  </div>
49
  </div>
50
  <div class="table-responsive">
51
+ <table id="bookly-logs-table" class="table table-striped table-hover nowrap w-100 bookly-table-wrap">
52
  <thead>
53
  <tr>
54
  <th><?php esc_html_e( 'Date', 'bookly' ) ?></th>
backend/modules/settings/templates/_payment_local.php CHANGED
@@ -2,14 +2,14 @@
2
  use Bookly\Backend\Components\Settings\Selects;
3
  use Bookly\Backend\Components\Controls\Elements;
4
  ?>
5
- <div class="card bookly-collapse" data-slug="local">
6
  <div class="card-header d-flex align-items-center">
7
  <?php Elements::renderReorder() ?>
8
- <a href="#bookly_pmt_locally" class="ml-2" role="button" data-toggle="collapse">
9
  <?php esc_html_e( 'Service paid locally', 'bookly' ) ?>
10
  </a>
11
  </div>
12
- <div id="bookly_pmt_locally" class="collapse show">
13
  <div class="card-body">
14
  <?php Selects::renderSingle( 'bookly_pmt_local' ) ?>
15
  </div>
2
  use Bookly\Backend\Components\Settings\Selects;
3
  use Bookly\Backend\Components\Controls\Elements;
4
  ?>
5
+ <div class="card bookly-collapse-with-arrow" data-slug="local">
6
  <div class="card-header d-flex align-items-center">
7
  <?php Elements::renderReorder() ?>
8
+ <a href="#bookly_pmt_locally" class="ml-2" role="button" data-toggle="bookly-collapse">
9
  <?php esc_html_e( 'Service paid locally', 'bookly' ) ?>
10
  </a>
11
  </div>
12
+ <div id="bookly_pmt_locally" class="bookly-collapse bookly-show">
13
  <div class="card-body">
14
  <?php Selects::renderSingle( 'bookly_pmt_local' ) ?>
15
  </div>
backend/modules/settings/templates/_paymentsForm.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
  use Bookly\Backend\Components\Controls\Inputs;
3
  use Bookly\Backend\Components\Controls\Buttons;
 
4
  use Bookly\Lib\Utils\Price;
5
  use Bookly\Backend\Modules\Settings\Proxy;
6
  use Bookly\Lib\Utils\Common;
@@ -13,7 +14,7 @@ use Bookly\Lib\Utils\Common;
13
  <label for="bookly_pmt_currency"><?php esc_html_e( 'Currency', 'bookly' ) ?></label>
14
  <select id="bookly_pmt_currency" class="form-control custom-select" name="bookly_pmt_currency">
15
  <?php foreach ( Price::getCurrencies() as $code => $currency ) : ?>
16
- <option value="<?php echo esc_attr( $code ) ?>" data-symbol="<?php esc_attr_e( $currency['symbol'] ) ?>" <?php selected( get_option( 'bookly_pmt_currency' ), $code ) ?> ><?php echo esc_html( $code ) ?> (<?php esc_html_e( $currency['symbol'] ) ?>)</option>
17
  <?php endforeach ?>
18
  </select>
19
  </div>
1
  <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
2
  use Bookly\Backend\Components\Controls\Inputs;
3
  use Bookly\Backend\Components\Controls\Buttons;
4
+ use Bookly\Lib\Config;
5
  use Bookly\Lib\Utils\Price;
6
  use Bookly\Backend\Modules\Settings\Proxy;
7
  use Bookly\Lib\Utils\Common;
14
  <label for="bookly_pmt_currency"><?php esc_html_e( 'Currency', 'bookly' ) ?></label>
15
  <select id="bookly_pmt_currency" class="form-control custom-select" name="bookly_pmt_currency">
16
  <?php foreach ( Price::getCurrencies() as $code => $currency ) : ?>
17
+ <option value="<?php echo esc_attr( $code ) ?>" data-symbol="<?php esc_attr_e( $currency['symbol'] ) ?>" <?php selected( Config::getCurrency(), $code ) ?> ><?php echo esc_html( $code ) ?> (<?php esc_html_e( $currency['symbol'] ) ?>)</option>
18
  <?php endforeach ?>
19
  </select>
20
  </div>
backend/modules/shop/Ajax.php CHANGED
@@ -68,14 +68,14 @@ class Ajax extends Lib\Base\Ajax
68
  $response['shop'][] = array(
69
  'plugin_class' => $plugin['highlighted'] ? 'bookly-card-highlighted border-danger' : ( $plugin['type'] == 'bundle' ? 'bg-warning' : 'bg-light' ),
70
  'title' => $plugin['title'],
71
- 'demo_url_class' => $plugin['demo_url'] === null ? 'collapse' : '',
72
  'demo_url' => $plugin['demo_url'],
73
  'description' => $plugin['description'],
74
  'icon' => '<img src="' . $plugin['icon'] . '"/>',
75
  'new' => ( $plugin['seen'] == 0 || ( strtotime( $plugin['published'] ) > strtotime( '-2 weeks' ) ) ) ? __( 'New', 'bookly' ) : '',
76
  'price' => '$' . $plugin['price'],
77
  'sales' => sprintf( _n( '%d sale', '%d sales', $plugin['sales'], 'bookly' ), $plugin['sales'] ),
78
- 'rating_class' => (int) $plugin['rating'] ? '' : 'collapse',
79
  'rating' => $plugin['rating'],
80
  'reviews' => sprintf( _n( '%d review', '%d reviews', $plugin['reviews'], 'bookly' ), $plugin['reviews'] ),
81
  'url_class' => $installed ? 'btn-default' : ( $plugin['slug'] == 'bookly-addon-pro' ? 'btn-success' : 'btn-success' . $disabled ),
68
  $response['shop'][] = array(
69
  'plugin_class' => $plugin['highlighted'] ? 'bookly-card-highlighted border-danger' : ( $plugin['type'] == 'bundle' ? 'bg-warning' : 'bg-light' ),
70
  'title' => $plugin['title'],
71
+ 'demo_url_class' => $plugin['demo_url'] === null ? 'bookly-collapse' : '',
72
  'demo_url' => $plugin['demo_url'],
73
  'description' => $plugin['description'],
74
  'icon' => '<img src="' . $plugin['icon'] . '"/>',
75
  'new' => ( $plugin['seen'] == 0 || ( strtotime( $plugin['published'] ) > strtotime( '-2 weeks' ) ) ) ? __( 'New', 'bookly' ) : '',
76
  'price' => '$' . $plugin['price'],
77
  'sales' => sprintf( _n( '%d sale', '%d sales', $plugin['sales'], 'bookly' ), $plugin['sales'] ),
78
+ 'rating_class' => (int) $plugin['rating'] ? '' : 'bookly-collapse',
79
  'rating' => $plugin['rating'],
80
  'reviews' => sprintf( _n( '%d review', '%d reviews', $plugin['reviews'], 'bookly' ), $plugin['reviews'] ),
81
  'url_class' => $installed ? 'btn-default' : ( $plugin['slug'] == 'bookly-addon-pro' ? 'btn-success' : 'btn-success' . $disabled ),
backend/modules/staff/proxy/Shared.php CHANGED
@@ -9,7 +9,7 @@ use Bookly\Lib;
9
  *
10
  * @method static void enqueueStaffProfileScripts() Enqueue scripts for page Staff.
11
  * @method static void enqueueStaffProfileStyles() Enqueue styles for page Staff.
12
- * @method static string getAffectedAppointmentsFilter( string $filter_url, int[] $staff_id ) Get link with filter for appointments page.
13
  * @method static Lib\Query prepareGetStaffQuery( Lib\Query $query ) Prepare get staff list query.
14
  * @method static array renderStaffPage( array $params ) Do stuff on staff page render.
15
  * @method static array searchStaff( array $fields, array $columns, Lib\Query $query ) Search staff, prepare query and fields.
9
  *
10
  * @method static void enqueueStaffProfileScripts() Enqueue scripts for page Staff.
11
  * @method static void enqueueStaffProfileStyles() Enqueue styles for page Staff.
12
+ * @method static string getAffectedAppointmentsFilter( string $filter_url, int[] $staff_ids ) Get link with filter for appointments page.
13
  * @method static Lib\Query prepareGetStaffQuery( Lib\Query $query ) Prepare get staff list query.
14
  * @method static array renderStaffPage( array $params ) Do stuff on staff page render.
15
  * @method static array searchStaff( array $fields, array $columns, Lib\Query $query ) Search staff, prepare query and fields.
backend/modules/staff/resources/js/staff-list.js CHANGED
@@ -1,4 +1,4 @@
1
- jQuery(function ($) {
2
  let $staffList = $('#bookly-staff-list'),
3
  $checkAllButton = $('#bookly-check-all'),
4
  $deleteButton = $('#bookly-delete'),
@@ -15,7 +15,7 @@ jQuery(function ($) {
15
 
16
  $('.bookly-js-select').val(null);
17
 
18
- $.each(BooklyL10n.datatables.staff_members.settings.filter, function (field, value) {
19
  if (value != '') {
20
  let $elem = $('#bookly-filter-' + field);
21
  if ($elem.is(':checkbox')) {
@@ -36,21 +36,22 @@ jQuery(function ($) {
36
  * Init Columns.
37
  */
38
  let columns = [{
 
39
  data: 'color',
40
  responsivePriority: 1,
41
  orderable: false,
42
  searchable: false,
43
- render: function (data, type, row, meta) {
44
  return '<i class="fas fa-fw fa-circle" style="color:' + data + ';">';
45
  }
46
  }];
47
 
48
- $.each(BooklyL10n.datatables.staff_members.settings.columns, function (column, show) {
49
  if (show) {
50
  switch (column) {
51
  case 'category_name':
52
  columns.push({
53
- data: column, render: function (data, type, row, meta) {
54
  return data !== null ? $.fn.dataTable.render.text().display(data) : BooklyL10n.uncategorized;
55
  }
56
  });
@@ -62,19 +63,21 @@ jQuery(function ($) {
62
  }
63
  });
64
  columns.push({
 
65
  responsivePriority: 1,
66
- orderable : false,
67
- searchable : false,
68
- width : 90,
69
- render : function (data, type, row, meta) {
70
  return '<button type="button" class="btn btn-default" data-action="edit"><i class="far fa-fw fa-edit mr-lg-1"></i><span class="d-none d-lg-inline">' + BooklyL10n.edit + '…</span></button>';
71
  }
72
  });
73
  columns.push({
 
74
  responsivePriority: 1,
75
- orderable : false,
76
- searchable : false,
77
- render: function (data, type, row, meta) {
78
  return '<div class="custom-control custom-checkbox mt-1">' +
79
  '<input value="' + row.id + '" id="bookly-dt-' + row.id + '" type="checkbox" class="custom-control-input">' +
80
  '<label for="bookly-dt-' + row.id + '" class="custom-control-label"></label>' +
@@ -85,8 +88,8 @@ jQuery(function ($) {
85
  columns[0].responsivePriority = 0;
86
 
87
  let order = [];
88
- $.each(BooklyL10n.datatables.staff_members.settings.order, function (key, value) {
89
- const index = columns.findIndex(function (c) { return c.data === value.column; });
90
  if (index !== -1) {
91
  order.push([index, value.order]);
92
  }
@@ -96,19 +99,19 @@ jQuery(function ($) {
96
  * Init DataTables.
97
  */
98
  var dt = $staffList.DataTable({
99
- order : order,
100
- info : false,
101
- searching : false,
102
  lengthChange: false,
103
- processing : true,
104
- responsive : true,
105
- pageLength : 25,
106
- pagingType : 'numbers',
107
- serverSide : true,
108
- ajax : {
109
- url : ajaxurl,
110
  type: 'POST',
111
- data: function (d) {
112
  let data = $.extend({action: 'bookly_get_staff_list', csrf_token: BooklyL10nGlobal.csrf_token, filter: {}}, d);
113
 
114
  Object.keys(filters).map(function(filter) {
@@ -121,40 +124,40 @@ jQuery(function ($) {
121
 
122
  return data;
123
  },
124
- dataSrc: function (json) {
125
  $staffCount.html(json.recordsFiltered);
126
  return json.data;
127
  }
128
  },
129
- columns : columns,
130
- rowCallback: function (row, data) {
131
- if ( data.visibility == 'archive' ) {
132
  $(row).addClass('text-muted');
133
  }
134
  },
135
- dom : "<'row'<'col-sm-12'tr>><'row float-left mt-3'<'col-sm-12'p>>",
136
- language : {
137
  zeroRecords: BooklyL10n.zeroRecords,
138
- processing : BooklyL10n.processing
139
  }
140
  });
141
 
142
  /**
143
  * Select all appointments.
144
  */
145
- $checkAllButton.on('change', function () {
146
  $staffList.find('tbody input:checkbox').prop('checked', this.checked);
147
  });
148
 
149
  /**
150
  * On appointment select.
151
  */
152
- $staffList.on('change', 'tbody input:checkbox', function () {
153
  $checkAllButton.prop('checked', $staffList.find('tbody input:not(:checked)').length == 0);
154
  });
155
 
156
  $deleteButton
157
- .on('click', function (e) {
158
  e.preventDefault();
159
  var data = {
160
  action: 'bookly_remove_staff',
@@ -163,27 +166,27 @@ jQuery(function ($) {
163
  staff = [],
164
  button = this;
165
 
166
- var delete_staff = function (ajaxurl, data) {
167
  var ladda = rangeTools.ladda(button),
168
  staff_ids = [],
169
  $checkboxes = $staffList.find('tbody input:checked');
170
 
171
- $checkboxes.each(function () {
172
  staff_ids.push(dt.row($(this).closest('td')).data().id);
173
  });
174
  data['staff_ids[]'] = staff_ids;
175
 
176
- $.post(ajaxurl, data, function (response) {
177
  if (!response.success) {
178
  switch (response.data.action) {
179
  case 'show_modal':
180
  $deleteModal
181
  .booklyModal('show');
182
- $('.bookly-js-delete', $deleteModal).off().on('click', function () {
183
 
1
+ jQuery(function($) {
2
  let $staffList = $('#bookly-staff-list'),
3
  $checkAllButton = $('#bookly-check-all'),
4
  $deleteButton = $('#bookly-delete'),
15
 
16
  $('.bookly-js-select').val(null);
17
 
18
+ $.each(BooklyL10n.datatables.staff_members.settings.filter, function(field, value) {
19
  if (value != '') {
20
  let $elem = $('#bookly-filter-' + field);
21
  if ($elem.is(':checkbox')) {
36
  * Init Columns.
37
  */
38
  let columns = [{
39
+ data: null,
40
  data: 'color',
41
  responsivePriority: 1,
42
  orderable: false,
43
  searchable: false,
44
+ render: function(data, type, row, meta) {
45
  return '<i class="fas fa-fw fa-circle" style="color:' + data + ';">';
46
  }
47
  }];
48
 
49
+ $.each(BooklyL10n.datatables.staff_members.settings.columns, function(column, show) {
50
  if (show) {
51
  switch (column) {
52
  case 'category_name':
53
  columns.push({
54
+ data: column, render: function(data, type, row, meta) {
55
  return data !== null ? $.fn.dataTable.render.text().display(data) : BooklyL10n.uncategorized;
56
  }
57
  });
63
  }
64
  });
65
  columns.push({
66
+ data: null,
67
  responsivePriority: 1,
68
+ orderable: false,
69
+ searchable: false,
70
+ width: 90,
71
+ render: function(data, type, row, meta) {
72
  return '<button type="button" class="btn btn-default" data-action="edit"><i class="far fa-fw fa-edit mr-lg-1"></i><span class="d-none d-lg-inline">' + BooklyL10n.edit + '…</span></button>';
73
  }
74
  });
75
  columns.push({
76
+ data: null,
77
  responsivePriority: 1,
78
+ orderable: false,
79
+ searchable: false,
80
+ render: function(data, type, row, meta) {
81
  return '<div class="custom-control custom-checkbox mt-1">' +
82
  '<input value="' + row.id + '" id="bookly-dt-' + row.id + '" type="checkbox" class="custom-control-input">' +
83
  '<label for="bookly-dt-' + row.id + '" class="custom-control-label"></label>' +
88
  columns[0].responsivePriority = 0;
89
 
90
  let order = [];
91
+ $.each(BooklyL10n.datatables.staff_members.settings.order, function(key, value) {
92
+ const index = columns.findIndex(function(c) { return c.data === value.column; });
93
  if (index !== -1) {
94
  order.push([index, value.order]);
95
  }
99
  * Init DataTables.
100
  */
101
  var dt = $staffList.DataTable({
102
+ order: order,
103
+ info: false,
104
+ searching: false,
105
  lengthChange: false,
106
+ processing: true,
107
+ responsive: true,
108
+ pageLength: 25,
109
+ pagingType: 'numbers',
110
+ serverSide: true,
111
+ ajax: {
112
+ url: ajaxurl,
113
  type: 'POST',
114
+ data: function(d) {
115
  let data = $.extend({action: 'bookly_get_staff_list', csrf_token: BooklyL10nGlobal.csrf_token, filter: {}}, d);
116
 
117
  Object.keys(filters).map(function(filter) {
124
 
125
  return data;
126
  },
127
+ dataSrc: function(json) {
128
  $staffCount.html(json.recordsFiltered);
129
  return json.data;
130
  }
131
  },
132
+ columns: columns,
133
+ rowCallback: function(row, data) {
134
+ if (data.visibility == 'archive') {
135
  $(row).addClass('text-muted');
136
  }
137
  },
138
+ dom: "<'row'<'col-sm-12'tr>><'row float-left mt-3'<'col-sm-12'p>>",
139
+ language: {
140
  zeroRecords: BooklyL10n.zeroRecords,
141
+ processing: BooklyL10n.processing
142
  }
143
  });
144
 
145
  /**
146
  * Select all appointments.
147
  */
148
+ $checkAllButton.on('change', function() {
149
  $staffList.find('tbody input:checkbox').prop('checked', this.checked);
150
  });
151
 
152
  /**
153
  * On appointment select.
154
  */
155
+ $staffList.on('change', 'tbody input:checkbox', function() {
156
  $checkAllButton.prop('checked', $staffList.find('tbody input:not(:checked)').length == 0);
157
  });
158
 
159
  $deleteButton
160
+ .on('click', function(e) {
161
  e.preventDefault();
162
  var data = {
163
  action: 'bookly_remove_staff',
166
  staff = [],
167
  button = this;
168
 
169
+ var delete_staff = function(ajaxurl, data) {
170
  var ladda = rangeTools.ladda(button),
171
  staff_ids = [],
172
  $checkboxes = $staffList.find('tbody input:checked');
173
 
174
+ $checkboxes.each(function() {
175
  staff_ids.push(dt.row($(this).closest('td')).data().id);
176
  });
177
  data['staff_ids[]'] = staff_ids;
178
 
179
+ $.post(ajaxurl, data, function(response) {
180
  if (!response.success) {
181
  switch (response.data.action) {
182
  case 'show_modal':
183
  $deleteModal
184
  .booklyModal('show');
185
+ $('.bookly-js-delete', $deleteModal).off().on('click', function() {
186