From db4b667c576766f56abaef991df6b2063740494e Mon Sep 17 00:00:00 2001 From: Woo Date: Tue, 23 Apr 2024 18:19:15 +0000 Subject: [PATCH] Updates to 2.1.0 --- assets/css/wc-pre-orders-admin.css | 1 + assets/css/wc-pre-orders-admin.scss | 187 ++ assets/js/admin/wc-pre-orders-admin.js | 46 + assets/js/admin/wc-pre-orders-admin.min.js | 1 + .../jquery-ui-timepicker-addon.js | 1919 +++++++++++++++++ .../jquery-ui-timepicker-addon.min.js | 1 + .../jquery.countdown/jquery.countdown-ar.js | 13 + .../jquery.countdown-ar.min.js | 1 + .../jquery.countdown/jquery.countdown-bg.js | 13 + .../jquery.countdown-bg.min.js | 1 + .../jquery.countdown/jquery.countdown-bn.js | 14 + .../jquery.countdown-bn.min.js | 1 + .../jquery.countdown/jquery.countdown-bs.js | 16 + .../jquery.countdown-bs.min.js | 1 + .../jquery.countdown/jquery.countdown-ca.js | 13 + .../jquery.countdown-ca.min.js | 1 + .../jquery.countdown/jquery.countdown-cs.js | 16 + .../jquery.countdown-cs.min.js | 1 + .../jquery.countdown/jquery.countdown-cy.js | 1 + .../jquery.countdown-cy.min.js | 1 + .../jquery.countdown/jquery.countdown-da.js | 13 + .../jquery.countdown-da.min.js | 1 + .../jquery.countdown/jquery.countdown-de.js | 13 + .../jquery.countdown-de.min.js | 1 + .../jquery.countdown/jquery.countdown-el.js | 13 + .../jquery.countdown-el.min.js | 1 + .../jquery.countdown/jquery.countdown-es.js | 13 + .../jquery.countdown-es.min.js | 1 + .../jquery.countdown/jquery.countdown-et.js | 13 + .../jquery.countdown-et.min.js | 1 + .../jquery.countdown/jquery.countdown-fa.js | 13 + .../jquery.countdown-fa.min.js | 1 + .../jquery.countdown/jquery.countdown-fi.js | 13 + .../jquery.countdown-fi.min.js | 1 + .../jquery.countdown/jquery.countdown-fr.js | 15 + .../jquery.countdown-fr.min.js | 1 + .../jquery.countdown/jquery.countdown-gl.js | 13 + .../jquery.countdown-gl.min.js | 1 + .../jquery.countdown/jquery.countdown-gu.js | 13 + .../jquery.countdown-gu.min.js | 1 + .../jquery.countdown/jquery.countdown-he.js | 13 + .../jquery.countdown-he.min.js | 1 + .../jquery.countdown/jquery.countdown-hr.js | 16 + .../jquery.countdown-hr.min.js | 1 + .../jquery.countdown/jquery.countdown-hu.js | 13 + .../jquery.countdown-hu.min.js | 1 + .../jquery.countdown/jquery.countdown-hy.js | 13 + .../jquery.countdown-hy.min.js | 1 + .../jquery.countdown/jquery.countdown-id.js | 13 + .../jquery.countdown-id.min.js | 1 + .../jquery.countdown/jquery.countdown-it.js | 13 + .../jquery.countdown-it.min.js | 1 + .../jquery.countdown/jquery.countdown-ja.js | 13 + .../jquery.countdown-ja.min.js | 1 + .../jquery.countdown/jquery.countdown-kn.js | 13 + .../jquery.countdown-kn.min.js | 1 + .../jquery.countdown/jquery.countdown-ko.js | 14 + .../jquery.countdown-ko.min.js | 1 + .../jquery.countdown/jquery.countdown-lt.js | 13 + .../jquery.countdown-lt.min.js | 1 + .../jquery.countdown/jquery.countdown-lv.js | 13 + .../jquery.countdown-lv.min.js | 1 + .../jquery.countdown/jquery.countdown-ms.js | 13 + .../jquery.countdown-ms.min.js | 1 + .../jquery.countdown/jquery.countdown-my.js | 13 + .../jquery.countdown-my.min.js | 1 + .../jquery.countdown/jquery.countdown-nb.js | 13 + .../jquery.countdown-nb.min.js | 1 + .../jquery.countdown/jquery.countdown-nl.js | 13 + .../jquery.countdown-nl.min.js | 1 + .../jquery.countdown/jquery.countdown-pl.js | 18 + .../jquery.countdown-pl.min.js | 1 + .../jquery.countdown-pt-BR.js | 14 + .../jquery.countdown-pt-BR.min.js | 1 + .../jquery.countdown/jquery.countdown-ro.js | 13 + .../jquery.countdown-ro.min.js | 1 + .../jquery.countdown/jquery.countdown-ru.js | 19 + .../jquery.countdown-ru.min.js | 1 + .../jquery.countdown/jquery.countdown-sk.js | 16 + .../jquery.countdown-sk.min.js | 1 + .../jquery.countdown/jquery.countdown-sl.js | 13 + .../jquery.countdown-sl.min.js | 1 + .../jquery.countdown/jquery.countdown-sq.js | 13 + .../jquery.countdown-sq.min.js | 1 + .../jquery.countdown-sr-SR.js | 16 + .../jquery.countdown-sr-SR.min.js | 1 + .../jquery.countdown/jquery.countdown-sr.js | 16 + .../jquery.countdown-sr.min.js | 1 + .../jquery.countdown/jquery.countdown-sv.js | 13 + .../jquery.countdown-sv.min.js | 1 + .../jquery.countdown/jquery.countdown-th.js | 13 + .../jquery.countdown-th.min.js | 1 + .../jquery.countdown/jquery.countdown-tr.js | 13 + .../jquery.countdown-tr.min.js | 1 + .../jquery.countdown/jquery.countdown-uk.js | 16 + .../jquery.countdown-uk.min.js | 1 + .../jquery.countdown/jquery.countdown-uz.js | 13 + .../jquery.countdown-uz.min.js | 1 + .../jquery.countdown/jquery.countdown-vi.js | 13 + .../jquery.countdown-vi.min.js | 1 + .../jquery.countdown-zh-CN.js | 13 + .../jquery.countdown-zh-CN.min.js | 1 + .../jquery.countdown-zh-TW.js | 13 + .../jquery.countdown-zh-TW.min.js | 1 + .../js/jquery.countdown/jquery.countdown.js | 800 +++++++ .../jquery.countdown/jquery.countdown.min.js | 1 + .../admin/blocks/date-time-picker/block.json | 34 + .../blocks/date-time-picker/index.asset.php | 1 + build/admin/blocks/date-time-picker/index.js | 1 + build/admin/blocks/message-control/block.json | 22 + .../blocks/message-control/index.asset.php | 1 + build/admin/blocks/message-control/index.js | 1 + build/admin/blocks/select-control/block.json | 38 + .../blocks/select-control/index.asset.php | 1 + build/admin/blocks/select-control/index.js | 1 + build/gateway/index.asset.php | 1 + build/gateway/index.css | 1 + build/gateway/index.js | 3 + changelog.txt | 405 ++++ .../admin/class-wc-pre-orders-admin-ajax.php | 151 ++ .../class-wc-pre-orders-admin-orders.php | 277 +++ .../class-wc-pre-orders-admin-pre-orders.php | 833 +++++++ .../class-wc-pre-orders-admin-products.php | 182 ++ .../class-wc-pre-orders-admin-settings.php | 202 ++ includes/admin/class-wc-pre-orders-admin.php | 123 ++ ...re-orders-product-editor-compatibility.php | 293 +++ includes/admin/filters.php | 56 + .../admin/views/html-product-tab-options.php | 87 + .../class-wc-pre-orders-blocks-gateway.php | 140 ++ ...class-wc-pre-orders-blocks-integration.php | 119 + .../class-wc-pre-orders-extend-store-api.php | 107 + includes/class-wc-pre-orders-cart.php | 296 +++ includes/class-wc-pre-orders-checkout.php | 317 +++ includes/class-wc-pre-orders-cron.php | 78 + includes/class-wc-pre-orders-list-table.php | 856 ++++++++ includes/class-wc-pre-orders-manager.php | 1002 +++++++++ .../class-wc-pre-orders-my-pre-orders.php | 189 ++ includes/class-wc-pre-orders-order.php | 474 ++++ includes/class-wc-pre-orders-privacy.php | 24 + includes/class-wc-pre-orders-product.php | 589 +++++ includes/class-wc-pre-orders.php | 443 ++++ ...orders-email-admin-pre-order-cancelled.php | 130 ++ ...lass-wc-pre-orders-email-new-pre-order.php | 188 ++ ...c-pre-orders-email-pre-order-available.php | 140 ++ ...c-pre-orders-email-pre-order-cancelled.php | 138 ++ ...re-orders-email-pre-order-date-changed.php | 157 ++ .../class-wc-pre-orders-email-pre-ordered.php | 141 ++ .../class-wc-pre-orders-gateway-pay-later.php | 175 ++ ...lass-wc-pre-orders-shortcode-countdown.php | 229 ++ languages/woocommerce-pre-orders.pot | 1152 ++++++++++ src/admin/blocks/date-time-picker/block.json | 34 + src/admin/blocks/date-time-picker/edit.tsx | 98 + src/admin/blocks/date-time-picker/index.ts | 30 + src/admin/blocks/message-control/block.json | 22 + src/admin/blocks/message-control/edit.tsx | 27 + src/admin/blocks/message-control/index.ts | 30 + src/admin/blocks/select-control/block.json | 38 + src/admin/blocks/select-control/edit.tsx | 47 + src/admin/blocks/select-control/index.ts | 30 + src/preorder-gateway/gateway.js | 45 + src/preorder-gateway/index.js | 95 + src/preorder-gateway/index.scss | 1 + templates/emails/admin-new-pre-order.php | 35 + .../emails/admin-pre-order-cancelled.php | 76 + .../emails/customer-pre-order-available.php | 102 + .../emails/customer-pre-order-cancelled.php | 47 + .../customer-pre-order-date-changed.php | 55 + templates/emails/customer-pre-ordered.php | 63 + .../emails/plain/admin-new-pre-order.php | 57 + .../plain/admin-pre-order-cancelled.php | 70 + .../plain/customer-pre-order-available.php | 81 + .../plain/customer-pre-order-cancelled.php | 63 + .../plain/customer-pre-order-date-changed.php | 70 + .../emails/plain/customer-pre-ordered.php | 71 + templates/myaccount/my-pre-orders.php | 79 + woocommerce-pre-orders.php | 96 + 176 files changed, 14927 insertions(+) create mode 100644 assets/css/wc-pre-orders-admin.css create mode 100644 assets/css/wc-pre-orders-admin.scss create mode 100644 assets/js/admin/wc-pre-orders-admin.js create mode 100644 assets/js/admin/wc-pre-orders-admin.min.js create mode 100644 assets/js/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.js create mode 100644 assets/js/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-ar.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-ar.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-bg.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-bg.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-bn.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-bn.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-bs.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-bs.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-ca.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-ca.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-cs.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-cs.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-cy.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-cy.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-da.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-da.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-de.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-de.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-el.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-el.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-es.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-es.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-et.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-et.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-fa.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-fa.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-fi.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-fi.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-fr.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-fr.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-gl.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-gl.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-gu.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-gu.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-he.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-he.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-hr.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-hr.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-hu.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-hu.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-hy.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-hy.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-id.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-id.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-it.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-it.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-ja.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-ja.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-kn.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-kn.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-ko.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-ko.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-lt.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-lt.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-lv.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-lv.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-ms.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-ms.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-my.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-my.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-nb.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-nb.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-nl.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-nl.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-pl.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-pl.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-pt-BR.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-pt-BR.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-ro.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-ro.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-ru.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-ru.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-sk.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-sk.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-sl.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-sl.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-sq.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-sq.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-sr-SR.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-sr-SR.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-sr.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-sr.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-sv.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-sv.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-th.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-th.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-tr.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-tr.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-uk.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-uk.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-uz.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-uz.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-vi.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-vi.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-zh-CN.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-zh-CN.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown-zh-TW.js create mode 100644 assets/js/jquery.countdown/jquery.countdown-zh-TW.min.js create mode 100755 assets/js/jquery.countdown/jquery.countdown.js create mode 100644 assets/js/jquery.countdown/jquery.countdown.min.js create mode 100644 build/admin/blocks/date-time-picker/block.json create mode 100644 build/admin/blocks/date-time-picker/index.asset.php create mode 100644 build/admin/blocks/date-time-picker/index.js create mode 100644 build/admin/blocks/message-control/block.json create mode 100644 build/admin/blocks/message-control/index.asset.php create mode 100644 build/admin/blocks/message-control/index.js create mode 100644 build/admin/blocks/select-control/block.json create mode 100644 build/admin/blocks/select-control/index.asset.php create mode 100644 build/admin/blocks/select-control/index.js create mode 100644 build/gateway/index.asset.php create mode 100644 build/gateway/index.css create mode 100644 build/gateway/index.js create mode 100644 changelog.txt create mode 100644 includes/admin/class-wc-pre-orders-admin-ajax.php create mode 100644 includes/admin/class-wc-pre-orders-admin-orders.php create mode 100644 includes/admin/class-wc-pre-orders-admin-pre-orders.php create mode 100644 includes/admin/class-wc-pre-orders-admin-products.php create mode 100644 includes/admin/class-wc-pre-orders-admin-settings.php create mode 100644 includes/admin/class-wc-pre-orders-admin.php create mode 100644 includes/admin/class-wc-pre-orders-product-editor-compatibility.php create mode 100644 includes/admin/filters.php create mode 100644 includes/admin/views/html-product-tab-options.php create mode 100644 includes/blocks/class-wc-pre-orders-blocks-gateway.php create mode 100644 includes/blocks/class-wc-pre-orders-blocks-integration.php create mode 100644 includes/blocks/class-wc-pre-orders-extend-store-api.php create mode 100644 includes/class-wc-pre-orders-cart.php create mode 100644 includes/class-wc-pre-orders-checkout.php create mode 100644 includes/class-wc-pre-orders-cron.php create mode 100644 includes/class-wc-pre-orders-list-table.php create mode 100644 includes/class-wc-pre-orders-manager.php create mode 100644 includes/class-wc-pre-orders-my-pre-orders.php create mode 100644 includes/class-wc-pre-orders-order.php create mode 100644 includes/class-wc-pre-orders-privacy.php create mode 100644 includes/class-wc-pre-orders-product.php create mode 100644 includes/class-wc-pre-orders.php create mode 100644 includes/emails/class-wc-pre-orders-email-admin-pre-order-cancelled.php create mode 100644 includes/emails/class-wc-pre-orders-email-new-pre-order.php create mode 100644 includes/emails/class-wc-pre-orders-email-pre-order-available.php create mode 100644 includes/emails/class-wc-pre-orders-email-pre-order-cancelled.php create mode 100644 includes/emails/class-wc-pre-orders-email-pre-order-date-changed.php create mode 100644 includes/emails/class-wc-pre-orders-email-pre-ordered.php create mode 100644 includes/gateways/class-wc-pre-orders-gateway-pay-later.php create mode 100644 includes/shortcodes/class-wc-pre-orders-shortcode-countdown.php create mode 100644 languages/woocommerce-pre-orders.pot create mode 100644 src/admin/blocks/date-time-picker/block.json create mode 100644 src/admin/blocks/date-time-picker/edit.tsx create mode 100644 src/admin/blocks/date-time-picker/index.ts create mode 100644 src/admin/blocks/message-control/block.json create mode 100644 src/admin/blocks/message-control/edit.tsx create mode 100644 src/admin/blocks/message-control/index.ts create mode 100644 src/admin/blocks/select-control/block.json create mode 100644 src/admin/blocks/select-control/edit.tsx create mode 100644 src/admin/blocks/select-control/index.ts create mode 100644 src/preorder-gateway/gateway.js create mode 100644 src/preorder-gateway/index.js create mode 100644 src/preorder-gateway/index.scss create mode 100644 templates/emails/admin-new-pre-order.php create mode 100644 templates/emails/admin-pre-order-cancelled.php create mode 100644 templates/emails/customer-pre-order-available.php create mode 100644 templates/emails/customer-pre-order-cancelled.php create mode 100644 templates/emails/customer-pre-order-date-changed.php create mode 100644 templates/emails/customer-pre-ordered.php create mode 100644 templates/emails/plain/admin-new-pre-order.php create mode 100644 templates/emails/plain/admin-pre-order-cancelled.php create mode 100644 templates/emails/plain/customer-pre-order-available.php create mode 100644 templates/emails/plain/customer-pre-order-cancelled.php create mode 100644 templates/emails/plain/customer-pre-order-date-changed.php create mode 100644 templates/emails/plain/customer-pre-ordered.php create mode 100644 templates/myaccount/my-pre-orders.php create mode 100644 woocommerce-pre-orders.php diff --git a/assets/css/wc-pre-orders-admin.css b/assets/css/wc-pre-orders-admin.css new file mode 100644 index 0000000..663b277 --- /dev/null +++ b/assets/css/wc-pre-orders-admin.css @@ -0,0 +1 @@ +.widefat .column-order_status mark.pre-ordered{display:block;text-indent:-9999px;position:relative;height:1em;width:1em;background:0 0;font-size:1.4em;margin:0 auto}.widefat .column-order_status mark.pre-ordered:after{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;margin:0;text-indent:0;position:absolute;top:0;left:0;width:100%;height:100%;text-align:center;content:"";color:#7ad03a}.pre-orders .column-status{width:90px}#woocommerce-product-data ul.product_data_tabs li.wc_pre_orders_tab a:before{content:""}.ui-timepicker-div .ui-widget-header{margin-bottom:8px}.ui-timepicker-div dl{text-align:left}.ui-timepicker-div dl dt{height:25px;margin-bottom:-25px}.ui-timepicker-div dl dd{margin:0 10px 10px 65px}.ui-timepicker-div td{font-size:90%}.ui-tpicker-grid-label{background:0 0;border:none;margin:0;padding:0}.ui-timepicker-rtl{direction:rtl}.ui-timepicker-rtl dl{text-align:right}.ui-timepicker-rtl dl dd{margin:0 65px 10px 10px}.widefat.pre-orders td.column-status{padding:6px 7px}.widefat.pre-orders .column-status{text-align:left}.widefat.pre-orders .column-status mark.active,.widefat.pre-orders .column-status mark.cancelled,.widefat.pre-orders .column-status mark.completed{display:block;text-indent:-9999px;position:relative;height:1em;width:1em;background:0 0;font-size:1.4em;margin:0 auto}.widefat.pre-orders .column-status mark.active:after,.widefat.pre-orders .column-status mark.cancelled:after,.widefat.pre-orders .column-status mark.completed:after{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;margin:0;text-indent:0;position:absolute;top:0;left:0;width:100%;height:100%;text-align:center;content:""}.widefat.pre-orders .column-status mark.active:after{content:"\e012";color:#7ad03a}.widefat.pre-orders .column-status mark.completed:after{content:"\e015";color:#2ea2cc}.widefat.pre-orders .column-status mark.cancelled:after{content:"\e013";color:#a00}.widefat.pre-orders .column-customer{width:15%}.widefat.pre-orders .column-product{width:30%}.widefat.pre-orders .column-order{width:15%}.widefat.pre-orders .column-order_date{width:100px}.widefat.pre-orders .column-availability-date{width:100px}.wp-list-table.pre-orders .column-status .row-actions{text-align:center}.wp-list-table.pre-orders .column-status .row-actions .cancel a{color:#a00}.wp-list-table.pre-orders .column-status .row-actions .cancel a:hover{color:#e44} \ No newline at end of file diff --git a/assets/css/wc-pre-orders-admin.scss b/assets/css/wc-pre-orders-admin.scss new file mode 100644 index 0000000..20c3945 --- /dev/null +++ b/assets/css/wc-pre-orders-admin.scss @@ -0,0 +1,187 @@ +// WooCommerce Pre-Orders Admin. + +// Variables from woocommerce/assets/css/_variables.scss. +$green: #7ad03a; +$red: #a00; +$blue: #2ea2cc; + +// Mixins from woocommerce/assets/css/_mixins.scss. +@mixin ir() { + display: block; + text-indent: -9999px; + position: relative; + height: 1em; + width: 1em; +} + +@mixin icon( $glyph: '\e001' ) { + font-family: 'WooCommerce'; + speak: none; + font-weight: normal; + font-variant: normal; + text-transform: none; + line-height: 1; + margin: 0; + text-indent: 0; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + text-align: center; + content: $glyph; +} + +// Order status icon +.widefat .column-order_status { + mark.pre-ordered { + @include ir(); + background: none; + font-size: 1.4em; + margin: 0 auto; + + &:after { + @include icon( "\e012" ); + color: $green; + } + } +} +.pre-orders { + .column-status { + width: 90px; + } +} + +// Product tab +#woocommerce-product-data { + ul.product_data_tabs { + li.wc_pre_orders_tab a { + &:before { + content: ""; + } + } + } +} + +// jQuery UI timepicker +.ui-timepicker-div { + + .ui-widget-header { + margin-bottom: 8px; + } + + dl { + text-align: left; + dt { + height: 25px; margin-bottom: -25px; + } + dd { + margin: 0 10px 10px 65px; + } + } + + td { + font-size: 90%; + } +} + +.ui-tpicker-grid-label { + background: none; + border: none; + margin: 0; + padding: 0; +} + +.ui-timepicker-rtl { + direction: rtl; + dl { + text-align: right; + dd { + margin: 0 65px 10px 10px; + } + } +} + +// List Table +.widefat.pre-orders { + + td { + &.column-status { + padding: 6px 7px; + } + + } + + .column-status { + text-align: left; + + mark.active, mark.completed, mark.cancelled { + @include ir(); + background: none; + font-size: 1.4em; + margin: 0 auto; + + &:after { + @include icon(); + } + } + + mark { + &.active { + &:after { + content: "\e012"; + color: $green; + } + } + &.completed { + &:after { + content: "\e015"; + color: $blue; + } + } + &.cancelled { + &:after { + content: "\e013"; + color: $red; + } + } + } + } + + .column-customer { + width: 15%; + } + + .column-product { + width: 30%; + } + + .column-order { + width: 15%; + } + + .column-order_date { + width: 100px; + } + + .column-availability-date { + width: 100px; + } +} + +// List table row actions +.wp-list-table.pre-orders .column-status .row-actions { + text-align: center; + + .cancel { + a { + color: $red; + + &:hover { + color: $red + #444; + } + } + } +} + + diff --git a/assets/js/admin/wc-pre-orders-admin.js b/assets/js/admin/wc-pre-orders-admin.js new file mode 100644 index 0000000..bf0576e --- /dev/null +++ b/assets/js/admin/wc-pre-orders-admin.js @@ -0,0 +1,46 @@ +jQuery( document ).ready( function( $ ) { + 'use strict'; + + var $actionEmailMessage = $( 'textarea[name="wc_pre_orders_action_email_message"]' ), + $dateTimeField = null; + + // Get the proper datetime field (either on the edit product page or the pre-orders > actions tab + if ( $( 'input[name="_wc_pre_orders_availability_datetime"]' ).length ) { + $dateTimeField = $( 'input[name="_wc_pre_orders_availability_datetime"]' ); + } else if ( $( 'input[name="wc_pre_orders_action_new_availability_date"]').length ) { + $dateTimeField = $( 'input[name="wc_pre_orders_action_new_availability_date"]' ); + } + + // Add Pre-Order DateTimePicker (see http://trentrichardson.com/examples/timepicker/) + if ( null !== $dateTimeField ) { + $dateTimeField.datetimepicker({ + dateFormat: 'yy-mm-dd', + numberOfMonths: 1 + }); + } + + // Hide email notification message textarea when "send email notification" is disabled + if ( $actionEmailMessage.length ) { + $( 'input[name="wc_pre_orders_action_enable_email_notification"]').on( 'change', function() { + if ( ! $( this ).is( ':checked' ) ) { + $actionEmailMessage.removeAttr( 'required' ); + $actionEmailMessage.closest( 'tr' ).hide(); + } else { + $actionEmailMessage.closest( 'tr' ).show(); + $actionEmailMessage.attr( 'required', 'required' ); + } + }).trigger( 'change' ); + } + + /** + * Hide pre-orders options when product type is changed to variable-subscription. + * + * Read explanation about this change in WC_Pre_Orders_Admin_Products::product_data_tab function + * @since 2.0.2 + */ + $( 'body' ).on( 'woocommerce-product-type-change', function ( e, select_val ) { + if ( 'variable-subscription' === select_val ) { + $( 'li.pre_orders_options' ).hide(); + } + } ); +}); diff --git a/assets/js/admin/wc-pre-orders-admin.min.js b/assets/js/admin/wc-pre-orders-admin.min.js new file mode 100644 index 0000000..ae8da20 --- /dev/null +++ b/assets/js/admin/wc-pre-orders-admin.min.js @@ -0,0 +1 @@ +jQuery(document).ready(function(i){"use strict";var e=i('textarea[name="wc_pre_orders_action_email_message"]'),t=null;i('input[name="_wc_pre_orders_availability_datetime"]').length?t=i('input[name="_wc_pre_orders_availability_datetime"]'):i('input[name="wc_pre_orders_action_new_availability_date"]').length&&(t=i('input[name="wc_pre_orders_action_new_availability_date"]')),null!==t&&t.datetimepicker({dateFormat:"yy-mm-dd",numberOfMonths:1}),e.length&&i('input[name="wc_pre_orders_action_enable_email_notification"]').on("change",function(){i(this).is(":checked")?(e.closest("tr").show(),e.attr("required","required")):(e.removeAttr("required"),e.closest("tr").hide())}).trigger("change"),i("body").on("woocommerce-product-type-change",function(e,t){"variable-subscription"===t&&i("li.pre_orders_options").hide()})}); diff --git a/assets/js/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.js b/assets/js/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.js new file mode 100644 index 0000000..663195c --- /dev/null +++ b/assets/js/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.js @@ -0,0 +1,1919 @@ +/* + * jQuery timepicker addon + * By: Trent Richardson [http://trentrichardson.com] + * Version 1.2 + * Last Modified: 02/02/2013 + * + * Copyright 2013 Trent Richardson + * You may use this project under MIT or GPL licenses. + * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt + * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt + */ + +/*jslint evil: true, white: false, undef: false, nomen: false */ + +(function($) { + + /* + * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded" + */ + $.ui.timepicker = $.ui.timepicker || {}; + if ($.ui.timepicker.version) { + return; + } + + /* + * Extend jQueryUI, get it started with our version number + */ + $.extend($.ui, { + timepicker: { + version: "1.2" + } + }); + + /* + * Timepicker manager. + * Use the singleton instance of this class, $.timepicker, to interact with the time picker. + * Settings for (groups of) time pickers are maintained in an instance object, + * allowing multiple different settings on the same page. + */ + var Timepicker = function() { + this.regional = []; // Available regional settings, indexed by language code + this.regional[''] = { // Default regional settings + currentText: 'Now', + closeText: 'Done', + amNames: ['AM', 'A'], + pmNames: ['PM', 'P'], + timeFormat: 'HH:mm', + timeSuffix: '', + timeOnlyTitle: 'Choose Time', + timeText: 'Time', + hourText: 'Hour', + minuteText: 'Minute', + secondText: 'Second', + millisecText: 'Millisecond', + timezoneText: 'Time Zone', + isRTL: false + }; + this._defaults = { // Global defaults for all the datetime picker instances + showButtonPanel: true, + timeOnly: false, + showHour: true, + showMinute: true, + showSecond: false, + showMillisec: false, + showTimezone: false, + showTime: true, + stepHour: 1, + stepMinute: 1, + stepSecond: 1, + stepMillisec: 1, + hour: 0, + minute: 0, + second: 0, + millisec: 0, + timezone: null, + useLocalTimezone: false, + defaultTimezone: "+0000", + hourMin: 0, + minuteMin: 0, + secondMin: 0, + millisecMin: 0, + hourMax: 23, + minuteMax: 59, + secondMax: 59, + millisecMax: 999, + minDateTime: null, + maxDateTime: null, + onSelect: null, + hourGrid: 0, + minuteGrid: 0, + secondGrid: 0, + millisecGrid: 0, + alwaysSetTime: true, + separator: ' ', + altFieldTimeOnly: true, + altTimeFormat: null, + altSeparator: null, + altTimeSuffix: null, + pickerTimeFormat: null, + pickerTimeSuffix: null, + showTimepicker: true, + timezoneIso8601: false, + timezoneList: null, + addSliderAccess: false, + sliderAccessArgs: null, + controlType: 'slider', + defaultValue: null, + parse: 'strict' + }; + $.extend(this._defaults, this.regional['']); + }; + + $.extend(Timepicker.prototype, { + $input: null, + $altInput: null, + $timeObj: null, + inst: null, + hour_slider: null, + minute_slider: null, + second_slider: null, + millisec_slider: null, + timezone_select: null, + hour: 0, + minute: 0, + second: 0, + millisec: 0, + timezone: null, + defaultTimezone: "+0000", + hourMinOriginal: null, + minuteMinOriginal: null, + secondMinOriginal: null, + millisecMinOriginal: null, + hourMaxOriginal: null, + minuteMaxOriginal: null, + secondMaxOriginal: null, + millisecMaxOriginal: null, + ampm: '', + formattedDate: '', + formattedTime: '', + formattedDateTime: '', + timezoneList: null, + units: ['hour','minute','second','millisec'], + control: null, + + /* + * Override the default settings for all instances of the time picker. + * @param settings object - the new settings to use as defaults (anonymous object) + * @return the manager object + */ + setDefaults: function(settings) { + extendRemove(this._defaults, settings || {}); + return this; + }, + + /* + * Create a new Timepicker instance + */ + _newInst: function($input, o) { + var tp_inst = new Timepicker(), + inlineSettings = {}, + fns = {}, + overrides, i; + + for (var attrName in this._defaults) { + if(this._defaults.hasOwnProperty(attrName)){ + var attrValue = $input.attr('time:' + attrName); + if (attrValue) { + try { + inlineSettings[attrName] = eval(attrValue); + } catch (err) { + inlineSettings[attrName] = attrValue; + } + } + } + } + overrides = { + beforeShow: function (input, dp_inst) { + if (typeof tp_inst._defaults.evnts.beforeShow === 'function'){ + return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst); + } + }, + onChangeMonthYear: function (year, month, dp_inst) { + // Update the time as well : this prevents the time from disappearing from the $input field. + tp_inst._updateDateTime(dp_inst); + if (typeof tp_inst._defaults.evnts.onChangeMonthYear === 'function') { + tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst); + } + }, + onClose: function (dateText, dp_inst) { + if (tp_inst.timeDefined === true && $input.val() !== '') { + tp_inst._updateDateTime(dp_inst); + } + if (typeof tp_inst._defaults.evnts.onClose === 'function') { + tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst); + } + } + }; + for (i in overrides) { + if (overrides.hasOwnProperty(i)) { + fns[i] = o[i] || null; + } + } + tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, overrides, { + evnts:fns, + timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker'); + }); + tp_inst.amNames = $.map(tp_inst._defaults.amNames, function(val) { + return val.toUpperCase(); + }); + tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function(val) { + return val.toUpperCase(); + }); + + // controlType is string - key to our this._controls + if(typeof(tp_inst._defaults.controlType) === 'string'){ + if($.fn[tp_inst._defaults.controlType] === undefined){ + tp_inst._defaults.controlType = 'select'; + } + tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType]; + } + // controlType is an object and must implement create, options, value methods + else{ + tp_inst.control = tp_inst._defaults.controlType; + } + + if (tp_inst._defaults.timezoneList === null) { + var timezoneList = ['-1200', '-1100', '-1000', '-0930', '-0900', '-0800', '-0700', '-0600', '-0500', '-0430', '-0400', '-0330', '-0300', '-0200', '-0100', '+0000', + '+0100', '+0200', '+0300', '+0330', '+0400', '+0430', '+0500', '+0530', '+0545', '+0600', '+0630', '+0700', '+0800', '+0845', '+0900', '+0930', + '+1000', '+1030', '+1100', '+1130', '+1200', '+1245', '+1300', '+1400']; + + if (tp_inst._defaults.timezoneIso8601) { + timezoneList = $.map(timezoneList, function(val) { + return val == '+0000' ? 'Z' : (val.substring(0, 3) + ':' + val.substring(3)); + }); + } + tp_inst._defaults.timezoneList = timezoneList; + } + + tp_inst.timezone = tp_inst._defaults.timezone; + tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin? tp_inst._defaults.hourMin : + tp_inst._defaults.hour > tp_inst._defaults.hourMax? tp_inst._defaults.hourMax : tp_inst._defaults.hour; + tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin? tp_inst._defaults.minuteMin : + tp_inst._defaults.minute > tp_inst._defaults.minuteMax? tp_inst._defaults.minuteMax : tp_inst._defaults.minute; + tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin? tp_inst._defaults.secondMin : + tp_inst._defaults.second > tp_inst._defaults.secondMax? tp_inst._defaults.secondMax : tp_inst._defaults.second; + tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin? tp_inst._defaults.millisecMin : + tp_inst._defaults.millisec > tp_inst._defaults.millisecMax? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec; + tp_inst.ampm = ''; + tp_inst.$input = $input; + + if (o.altField) { + tp_inst.$altInput = $(o.altField).css({ + cursor: 'pointer' + }).on( 'focus', function() { + $input.trigger("focus"); + }); + } + + if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) { + tp_inst._defaults.minDate = new Date(); + } + if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) { + tp_inst._defaults.maxDate = new Date(); + } + + // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime.. + if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) { + tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime()); + } + if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) { + tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime()); + } + if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) { + tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime()); + } + if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) { + tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime()); + } + tp_inst.$input.on('focus', function() { + tp_inst._onFocus(); + }); + + return tp_inst; + }, + + /* + * add our sliders to the calendar + */ + _addTimePicker: function(dp_inst) { + var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val(); + + this.timeDefined = this._parseTime(currDT); + this._limitMinMaxDateTime(dp_inst, false); + this._injectTimePicker(); + }, + + /* + * parse the time string from input value or _setTime + */ + _parseTime: function(timeString, withDate) { + if (!this.inst) { + this.inst = $.datepicker._getInst(this.$input[0]); + } + + if (withDate || !this._defaults.timeOnly) { + var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat'); + try { + var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults); + if (!parseRes.timeObj) { + return false; + } + $.extend(this, parseRes.timeObj); + } catch (err) { + $.timepicker.log("Error parsing the date/time string: " + err + + "\ndate/time string = " + timeString + + "\ntimeFormat = " + this._defaults.timeFormat + + "\ndateFormat = " + dp_dateFormat); + return false; + } + return true; + } else { + var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults); + if (!timeObj) { + return false; + } + $.extend(this, timeObj); + return true; + } + }, + + /* + * generate and inject html for timepicker into ui datepicker + */ + _injectTimePicker: function() { + var $dp = this.inst.dpDiv, + o = this.inst.settings, + tp_inst = this, + litem = '', + uitem = '', + max = {}, + gridSize = {}, + size = null; + + // Prevent displaying twice + if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) { + var noDisplay = ' style="display:none;"', + html = '
' + '
' + o.timeText + '
' + + '
'; + + // Create the markup + for(var i=0,l=this.units.length; i' + o[litem +'Text'] + '' + + '
'; + + if (o['show'+uitem] && o[litem+'Grid'] > 0) { + html += '
'; + + if(litem == 'hour'){ + for (var h = o[litem+'Min']; h <= max[litem]; h += parseInt(o[litem+'Grid'], 10)) { + gridSize[litem]++; + var tmph = $.datepicker.formatTime(useAmpm(o.pickerTimeFormat || o.timeFormat)? 'hht':'HH', {hour:h}, o); + html += ''; + } + } + else{ + for (var m = o[litem+'Min']; m <= max[litem]; m += parseInt(o[litem+'Grid'], 10)) { + gridSize[litem]++; + html += ''; + } + } + + html += '
' + tmph + '' + ((m < 10) ? '0' : '') + m + '
'; + } + html += '
'; + } + + // Timezone + html += '
' + o.timezoneText + '
'; + html += '
'; + + // Create the elements from string + html += '
'; + var $tp = $(html); + + // if we only want time picker... + if (o.timeOnly === true) { + $tp.prepend('
' + '
' + o.timeOnlyTitle + '
' + '
'); + $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide(); + } + + // add sliders, adjust grids, add events + for(var i=0,l=tp_inst.units.length; i 0) { + size = 100 * gridSize[litem] * o[litem+'Grid'] / (max[litem] - o[litem+'Min']); + $tp.find('.ui_tpicker_'+litem+' table').css({ + width: size + "%", + marginLeft: o.isRTL? '0' : ((size / (-2 * gridSize[litem])) + "%"), + marginRight: o.isRTL? ((size / (-2 * gridSize[litem])) + "%") : '0', + borderCollapse: 'collapse' + }).find("td").on( 'click', function(e){ + var $t = $(this), + h = $t.html(), + n = parseInt(h.replace(/[^0-9]/g),10), + ap = h.replace(/[^apm]/ig), + f = $t.data('for'); // loses scope, so we use data-for + + if(f == 'hour'){ + if(ap.indexOf('p') !== -1 && n < 12){ + n += 12; + } + else{ + if(ap.indexOf('a') !== -1 && n === 12){ + n = 0; + } + } + } + + tp_inst.control.value(tp_inst, tp_inst[f+'_slider'], litem, n); + + tp_inst._onTimeChange(); + tp_inst._onSelectHandler(); + }) + .css({ + cursor: 'pointer', + width: (100 / gridSize[litem]) + '%', + textAlign: 'center', + overflow: 'hidden' + }); + } // end if grid > 0 + } // end for loop + + // Add timezone options + this.timezone_select = $tp.find('.ui_tpicker_timezone').append('').find("select"); + $.fn.append.apply(this.timezone_select, + $.map(o.timezoneList, function(val, idx) { + return $("