| 1 | <?php |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | function zeroBSCRM_scriptStyles_initStyleRegister() { |
| 20 | |
| 21 | global $zbs; |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | wp_register_style( 'jpcrm-semanticui-lib', plugins_url( '/build/lib/semantic-ui-css/semantic.min.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 28 | wp_register_style( 'zbs-wp-semanticui', plugins_url( '/css/ZeroBSCRM.admin.semantic-ui' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array( 'jpcrm-semanticui-lib' ), $zbs::VERSION ); |
| 29 | wp_register_script( 'semanticuijs', plugins_url( '/build/lib/semantic-ui-css/semantic.min.js', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 30 | |
| 31 | |
| 32 | wp_register_style( 'zerobscrmadmcss', plugins_url( '/css/ZeroBSCRM.admin.global' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array( 'zbs-wp-semanticui' ), $zbs::VERSION ); |
| 33 | wp_enqueue_script( 'zerobscrmadmjs', plugins_url( '/js/ZeroBSCRM.admin.global' . wp_scripts_get_suffix() . '.js', ZBS_ROOTFILE ), array( 'jquery' ), $zbs::VERSION ); |
| 34 | |
| 35 | |
| 36 | wp_register_style( 'jpcrm-emerald', plugins_url( '/css/jpcrm-emerald' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | wp_register_style( 'zerobscrmlistview', plugins_url( '/css/ZeroBSCRM.admin.listview' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 46 | wp_register_script( 'zerobscrmlistviewjs', plugins_url( '/js/ZeroBSCRM.admin.listview' . wp_scripts_get_suffix() . '.js', ZBS_ROOTFILE ), array( 'jquery' ), $zbs::VERSION ); |
| 47 | |
| 48 | |
| 49 | |
| 50 | $zbs_translation_array = array( |
| 51 | 'zbs_edit' => __( 'Edit', 'zero-bs-crm' ), |
| 52 | 'zbs_view' => __( 'View', 'zero-bs-crm' ), |
| 53 | ); |
| 54 | wp_localize_script( 'zerobscrmlistviewjs', 'zbs_lang', $zbs_translation_array ); |
| 55 | |
| 56 | |
| 57 | wp_register_style( 'zerobscrmsingleview', plugins_url( '/css/ZeroBSCRM.admin.singleview' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 58 | wp_register_script( 'zerobscrmsingleview', plugins_url( '/js/ZeroBSCRM.admin.singleview' . wp_scripts_get_suffix() . '.js', ZBS_ROOTFILE ), array( 'jquery' ), $zbs::VERSION ); |
| 59 | |
| 60 | |
| 61 | wp_register_style( 'zerobscrmeditview', plugins_url( '/css/ZeroBSCRM.admin.editview' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 62 | wp_register_script( 'zerobscrmeditviewjs', plugins_url( '/js/ZeroBSCRM.admin.editview' . wp_scripts_get_suffix() . '.js', ZBS_ROOTFILE ), array( 'jquery' ), $zbs::VERSION ); |
| 63 | wp_register_script( 'zerobscrmtagmetaboxjs', plugins_url( '/js/ZeroBSCRM.admin.tags.metabox' . wp_scripts_get_suffix() . '.js', ZBS_ROOTFILE ), array( 'jquery' ), $zbs::VERSION ); |
| 64 | |
| 65 | |
| 66 | wp_register_script( 'zerobscrmmm', plugins_url( '/js/ZeroBSCRM.admin.metabox.manager' . wp_scripts_get_suffix() . '.js', ZBS_ROOTFILE ), array( 'jquery' ), $zbs::VERSION ); |
| 67 | |
| 68 | |
| 69 | wp_register_style( 'zbs-segmentedit-css', plugins_url( '/css/ZeroBSCRM.admin.segmentedit' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 70 | wp_register_script( 'zbs-segmentedit-js', ZEROBSCRM_URL . '/js/ZeroBSCRM.admin.segmentedit' . wp_scripts_get_suffix() . '.js', array( 'jquery' ), $zbs::VERSION ); |
| 71 | |
| 72 | |
| 73 | wp_register_style( 'zerobscrmhomedash', plugins_url( '/css/ZeroBSCRM.admin.homedash' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array( 'zbs-wp-semanticui' ), $zbs::VERSION ); |
| 74 | |
| 75 | |
| 76 | wp_register_style( 'zerobscrmsettings', plugins_url( '/css/ZeroBSCRM.admin.settings' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 77 | |
| 78 | |
| 79 | wp_register_style( 'zerobscrmmaildeliverywizard', plugins_url( '/css/ZeroBSCRM.admin.maildeliverywizard' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 80 | |
| 81 | |
| 82 | wp_register_script( 'jpcrmadminsystem', plugins_url( '/js/jpcrm-admin-system' . wp_scripts_get_suffix() . '.js', ZBS_ROOTFILE ), array( 'jquery' ), $zbs::VERSION ); |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | wp_register_script( 'zerobscrmadmjqui', plugins_url( '/js/lib/jquery-ui.min.js', ZBS_ROOTFILE ), array( 'jquery' ), $zbs::VERSION ); |
| 92 | |
| 93 | |
| 94 | wp_register_script( 'zerobscrmadmjquidraggable', plugins_url( '/js/lib/jquery-ui.1.12.1.dragdrop.listview.min.js', ZBS_ROOTFILE ), array( 'jquery' ), $zbs::VERSION ); |
| 95 | |
| 96 | |
| 97 | wp_register_style( 'jpcrm-jquery-modal', plugins_url( '/build/lib/jquery-modal/jquery.modal.min.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 98 | wp_register_script( 'jpcrm-jquery-modal', plugins_url( '/build/lib/jquery-modal/jquery.modal.min.js', ZBS_ROOTFILE ), array( 'jquery' ), $zbs::VERSION ); |
| 99 | |
| 100 | |
| 101 | wp_register_style( 'jpcrm-fontawesome', plugins_url( '/build/lib/font-awesome/css/font-awesome.min.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 102 | |
| 103 | |
| 104 | wp_register_script( 'jpcrm-chartjs', plugins_url( '/build/lib/chart.js/chart.umd.min.js', ZBS_ROOTFILE ), array( 'jquery' ), $zbs::VERSION, true ); |
| 105 | |
| 106 | |
| 107 | wp_register_style( 'zerobscrmswa', plugins_url( '/build/lib/sweetalert2/sweetalert2.min.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 108 | wp_enqueue_script( 'zerobscrmswa', plugins_url( '/build/lib/sweetalert2/sweetalert2.min.js', ZBS_ROOTFILE ), array( 'jquery' ), $zbs::VERSION ); |
| 109 | |
| 110 | |
| 111 | wp_enqueue_script( 'jpcrm-typeahead', plugins_url( '/build/lib/typeahead.js/typeahead.bundle.min.js', ZBS_ROOTFILE ), array( 'jquery' ), $zbs::VERSION ); |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | if ( file_exists( dirname( ZBS_ROOTFILE ) . '/css/wl.adm.override.css' ) ) { |
| 122 | wp_enqueue_style( 'zbswladmcss', plugins_url( '/css/wl.adm.override.css', ZBS_ROOTFILE ), array( 'zerobscrmadmcss', 'zerobscrmlistview', 'zerobscrmeditview' ), $zbs::VERSION ); |
| 123 | } |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | if ( zeroBSCRM_isAdminPage() ) { |
| 130 | zeroBSCRM_global_admin_styles(); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | |
| 135 | function zeroBSCRM_scriptStyles_enqueueJSRoot() { |
| 136 | |
| 137 | global $zbs; |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | $zbscrm_currency_position = $zbs->settings->get( 'currency_position' ); |
| 150 | $zbscrm_currency_format_thousand_separator = $zbs->settings->get( 'currency_format_thousand_separator' ); |
| 151 | $zbscrm_currency_format_decimal_separator = $zbs->settings->get( 'currency_format_decimal_separator' ); |
| 152 | $zbscrm_currency_format_number_of_decimals = $zbs->settings->get( 'currency_format_number_of_decimals' ); |
| 153 | |
| 154 | $jpcrm_root = array( |
| 155 | 'crmname' => 'Jetpack CRM', |
| 156 | 'root' => ZEROBSCRM_URL, |
| 157 | 'localeOptions' => zeroBSCRM_date_localeForDaterangePicker(), |
| 158 | 'locale' => get_locale(), |
| 159 | 'locale_short' => zeroBSCRM_getLocale( false ), |
| 160 | 'currencyOptions' => array( |
| 161 | 'symbol' => zeroBSCRM_getCurrencyChr(), |
| 162 | 'currencyStr' => zeroBSCRM_getCurrencyStr(), |
| 163 | 'position' => $zbscrm_currency_position, |
| 164 | 'thousandSeparator' => $zbscrm_currency_format_thousand_separator, |
| 165 | 'decimalSeparator' => $zbscrm_currency_format_decimal_separator, |
| 166 | 'noOfDecimals' => $zbscrm_currency_format_number_of_decimals, |
| 167 | ), |
| 168 | 'timezone_offset' => (int) get_option( 'gmt_offset' ), |
| 169 | 'timezone_offset_mins' => ( (int) get_option( 'gmt_offset' ) * 60 ), |
| 170 | 'wl' => ( zeroBSCRM_isWL() ? 1 : -1 ), |
| 171 | 'dal' => 3, |
| 172 | ); |
| 173 | |
| 174 | |
| 175 | $jpcrm_root['crmlogo'] = 'i/icon-32.png'; |
| 176 | |
| 177 | |
| 178 | $lang_array = array( |
| 179 | |
| 180 | 'send' => __( 'Send', 'zero-bs-crm' ), |
| 181 | 'sent' => __( 'Sent', 'zero-bs-crm' ), |
| 182 | 'notsent' => __( 'Not Sent', 'zero-bs-crm' ), |
| 183 | 'cancel' => __( 'Cancel', 'zero-bs-crm' ), |
| 184 | 'contact' => __( 'Contact', 'zero-bs-crm' ), |
| 185 | 'company' => __( 'Company', 'zero-bs-crm' ), |
| 186 | 'viewall' => __( 'View all', 'zero-bs-crm' ), |
| 187 | |
| 188 | |
| 189 | 'sendstatement' => __( 'Send Statement', 'zero-bs-crm' ), |
| 190 | 'sendstatementaddr' => __( 'Send Statement to Email:', 'zero-bs-crm' ), |
| 191 | 'enteremail' => __( 'Enter an Email Address..', 'zero-bs-crm' ), |
| 192 | 'statementsent' => __( 'Statement was successfully sent', 'zero-bs-crm' ), |
| 193 | 'statementnotsent' => __( 'Statement could not be sent at this time', 'zero-bs-crm' ), |
| 194 | |
| 195 | |
| 196 | 'total' => __( 'Total', 'zero-bs-crm' ), |
| 197 | 'totals' => __( 'Totals', 'zero-bs-crm' ), |
| 198 | 'quote' => __( 'Quote', 'zero-bs-crm' ), |
| 199 | 'quotes' => __( 'Quotes', 'zero-bs-crm' ), |
| 200 | 'invoice' => __( 'Invoice', 'zero-bs-crm' ), |
| 201 | 'invoices' => __( 'Invoices', 'zero-bs-crm' ), |
| 202 | 'transaction' => __( 'Transaction', 'zero-bs-crm' ), |
| 203 | 'transactions' => __( 'Transactions', 'zero-bs-crm' ), |
| 204 | |
| 205 | |
| 206 | 'today' => __( 'Today', 'zero-bs-crm' ), |
| 207 | 'yesterday' => __( 'Yesterday', 'zero-bs-crm' ), |
| 208 | 'last_7_days' => __( 'Last 7 days', 'zero-bs-crm' ), |
| 209 | 'last_30_days' => __( 'Last 30 days', 'zero-bs-crm' ), |
| 210 | 'this_month' => __( 'This month', 'zero-bs-crm' ), |
| 211 | 'last_month' => __( 'Last month', 'zero-bs-crm' ), |
| 212 | ); |
| 213 | |
| 214 | $lang_array = apply_filters( 'zbs_globaljs_lang', $lang_array ); |
| 215 | |
| 216 | if ( is_array( $lang_array ) && count( $lang_array ) > 0 ) { |
| 217 | $jpcrm_root['lang'] = $lang_array; |
| 218 | } |
| 219 | |
| 220 | $jpcrm_root['zbsnonce'] = wp_create_nonce( 'zbscrmjs-glob-ajax-nonce' ); |
| 221 | |
| 222 | |
| 223 | |
| 224 | |
| 225 | $generic_view_link = str_replace( 'contact', '_TYPE_', jpcrm_esc_link( 'view', -1, 'zerobs_customer', true ) ); |
| 226 | |
| 227 | $generic_edit_link = str_replace( 'contact', '_TYPE_', jpcrm_esc_link( 'edit', -1, 'zerobs_customer', true ) ); |
| 228 | |
| 229 | $jpcrm_root['links'] = array( |
| 230 | 'generic_view' => $generic_view_link, |
| 231 | 'generic_edit' => $generic_edit_link, |
| 232 | ); |
| 233 | |
| 234 | |
| 235 | unset( $jpcrm_root['crmlogo'] ); |
| 236 | |
| 237 | |
| 238 | $jpcrm_root['jp_green'] = jpcrm_get_jp_green(); |
| 239 | |
| 240 | |
| 241 | $jpcrm_root = apply_filters( 'zbs_globaljs_vars', $jpcrm_root ); |
| 242 | |
| 243 | wp_localize_script( 'zerobscrmadmjs', 'zbs_root', $jpcrm_root ); |
| 244 | } |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | function jpcrm_get_jp_green() { |
| 250 | $jp_green = array( |
| 251 | '0' => '#f0f2eb', |
| 252 | '5' => '#d0e6b8', |
| 253 | '10' => '#9dd977', |
| 254 | '20' => '#64ca43', |
| 255 | '30' => '#2fb41f', |
| 256 | '40' => '#069e08', |
| 257 | '50' => '#008710', |
| 258 | '60' => '#007117', |
| 259 | '70' => '#005b18', |
| 260 | '80' => '#004515', |
| 261 | '90' => '#003010', |
| 262 | '100' => '#001c09', |
| 263 | ); |
| 264 | |
| 265 | return $jp_green; |
| 266 | } |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | |
| 272 | |
| 273 | |
| 274 | |
| 275 | |
| 276 | |
| 277 | function zeroBSCRM_scriptStyles_admin_quoteBuilder() { |
| 278 | |
| 279 | global $zbs; |
| 280 | wp_enqueue_style( 'zerobscrm-quotebuilder', plugins_url( '/css/ZeroBSCRM.admin.quotebuilder' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 281 | wp_enqueue_script( 'zerobscrm-quotebuilderjs', plugins_url( '/js/ZeroBSCRM.admin.quotebuilder' . wp_scripts_get_suffix() . '.js', ZBS_ROOTFILE ), array( 'jquery' ), $zbs::VERSION ); |
| 282 | } |
| 283 | |
| 284 | |
| 285 | |
| 286 | function zeroBSCRM_scriptStyles_admin_invoiceBuilder() { |
| 287 | |
| 288 | global $zbs; |
| 289 | |
| 290 | |
| 291 | wp_enqueue_style( 'zerobscrm-invoicebuilder', plugins_url( '/css/ZeroBSCRM.admin.invoicebuilder' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 292 | wp_enqueue_script( 'zerobscrm-invoicebuilderjs', plugins_url( '/js/ZeroBSCRM.admin.invoicebuilder' . wp_scripts_get_suffix() . '.js', ZBS_ROOTFILE ), array( 'jquery', 'semanticuijs' ), $zbs::VERSION ); |
| 293 | |
| 294 | |
| 295 | $zbs_invtranslation_array = array( |
| 296 | 'zbs_item_name' => __( 'Item Name', 'zero-bs-crm' ), |
| 297 | 'zbs_item_desc' => __( 'Enter a detailed description (optional)', 'zero-bs-crm' ), |
| 298 | 'zbs_add_row' => __( 'Add Row', 'zero-bs-crm' ), |
| 299 | 'zbs_remove_row' => __( 'Remove Row', 'zero-bs-crm' ), |
| 300 | ); |
| 301 | |
| 302 | $zbs_links = array( |
| 303 | 'admin_url' => admin_url(), |
| 304 | ); |
| 305 | |
| 306 | wp_localize_script( 'zerobscrm-invoicebuilderjs', 'zbs_lang', $zbs_invtranslation_array ); |
| 307 | wp_localize_script( 'zerobscrm-invoicebuilderjs', 'zbs_links', $zbs_links ); |
| 308 | } |
| 309 | |
| 310 | |
| 311 | function zeroBSCRM_scriptStyles_admin_transactionBuilder() { |
| 312 | |
| 313 | global $zbs; |
| 314 | wp_enqueue_style( 'zerobscrmtranscss', plugins_url( '/css/ZeroBSCRM.admin.transactionedit' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 315 | wp_enqueue_script( 'zerobscrm-transedit-js', ZEROBSCRM_URL . 'js/ZeroBSCRM.admin.transactioneditor' . wp_scripts_get_suffix() . '.js', array( 'jquery' ), $zbs::VERSION ); |
| 316 | } |
| 317 | |
| 318 | |
| 319 | function zeroBSCRM_scriptStyles_admin_formBuilder() { |
| 320 | |
| 321 | global $zbs; |
| 322 | wp_enqueue_style( 'zerobscrmformcss', plugins_url( '/css/ZeroBSCRM.admin.frontendforms' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 323 | } |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 | |
| 330 | |
| 331 | |
| 332 | function zeroBSCRM_global_admin_styles() { |
| 333 | |
| 334 | global $zbs; |
| 335 | |
| 336 | |
| 337 | |
| 338 | if ( ! defined( 'ZBS_GAS' ) ) { |
| 339 | |
| 340 | |
| 341 | |
| 342 | |
| 343 | wp_enqueue_style( 'zerobscrmadmcss' ); |
| 344 | wp_enqueue_style( 'jpcrm-jquery-modal' ); |
| 345 | wp_enqueue_style( 'jpcrm-fontawesome' ); |
| 346 | wp_enqueue_style( 'zerobscrmswa' ); |
| 347 | wp_enqueue_script( 'jpcrm-jquery-modal' ); |
| 348 | |
| 349 | |
| 350 | wp_enqueue_style( 'jpcrm-emerald' ); |
| 351 | |
| 352 | |
| 353 | wp_enqueue_script( 'jpcrm-moment', ZEROBSCRM_URL . 'build/lib/moment/moment-with-locales.min.js', array( 'jquery' ), $zbs::VERSION, false ); |
| 354 | |
| 355 | |
| 356 | wp_enqueue_style( 'zbs-wp-semanticui' ); |
| 357 | wp_enqueue_script( 'semanticuijs' ); |
| 358 | |
| 359 | do_action( 'zbs-global-admin-styles' ); |
| 360 | |
| 361 | |
| 362 | if ( ! defined( 'ZBS_PAGE' ) ) { |
| 363 | define( 'ZBS_PAGE', true ); |
| 364 | } |
| 365 | |
| 366 | |
| 367 | if ( ! defined( 'ZBS_GAS' ) ) { |
| 368 | define( 'ZBS_GAS', true ); |
| 369 | } |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | |
| 374 | |
| 375 | function zeroBSCRM_extension_admin_styles() { |
| 376 | global $zbs; |
| 377 | wp_register_style( 'zerobscrmexts', ZEROBSCRM_URL . 'css/ZeroBSCRM.admin.extensions-page' . wp_scripts_get_suffix() . '.css', array(), $zbs::VERSION ); |
| 378 | wp_enqueue_style( 'zerobscrmexts' ); |
| 379 | } |
| 380 | |
| 381 | |
| 382 | function zeroBSCRM_intro_admin_styles() { |
| 383 | global $zbs; |
| 384 | wp_register_style( 'zerobscrmintro', ZEROBSCRM_URL . 'css/ZeroBSCRM.admin.intro' . wp_scripts_get_suffix() . '.css', array(), $zbs::VERSION ); |
| 385 | wp_enqueue_style( 'zerobscrmintro' ); |
| 386 | } |
| 387 | |
| 388 | function zeroBSCRM_email_styles() { |
| 389 | global $zbs; |
| 390 | wp_register_style( 'zerobscrmemails', ZEROBSCRM_URL . 'css/ZeroBSCRM.admin.email' . wp_scripts_get_suffix() . '.css', array(), $zbs::VERSION ); |
| 391 | wp_enqueue_style( 'zerobscrmemails' ); |
| 392 | wp_register_script( 'zerobsjsemail', ZEROBSCRM_URL . 'js/ZeroBSCRM.admin.email' . wp_scripts_get_suffix() . '.js', array( 'jquery' ), $zbs::VERSION ); |
| 393 | wp_enqueue_script( 'zerobsjsemail' ); |
| 394 | do_action( 'zbs_extra_email_script_styles' ); |
| 395 | } |
| 396 | function zeroBSCRM_admin_styles_ui2_listview() { |
| 397 | |
| 398 | wp_enqueue_style( 'zerobscrmlistview' ); |
| 399 | wp_enqueue_script( 'semanticuijs' ); |
| 400 | |
| 401 | wp_enqueue_script( 'jquery-ui-sortable' ); |
| 402 | |
| 403 | |
| 404 | wp_enqueue_script( 'zerobscrmlistviewjs' ); |
| 405 | |
| 406 | zeroBSCRM_enqueue_libs_js_momentdatepicker(); |
| 407 | |
| 408 | |
| 409 | do_action( 'jpcrm_enqueue_styles_listview' ); |
| 410 | } |
| 411 | function zeroBSCRM_admin_styles_ui2_editview() { |
| 412 | |
| 413 | |
| 414 | |
| 415 | |
| 416 | wp_enqueue_script( 'jquery-ui-sortable' ); |
| 417 | wp_enqueue_style( 'zerobscrmeditview' ); |
| 418 | wp_enqueue_script( 'semanticuijs' ); |
| 419 | wp_enqueue_script( 'zerobscrmeditviewjs' ); |
| 420 | wp_enqueue_script( 'zerobscrmtagmetaboxjs' ); |
| 421 | wp_enqueue_script( 'zerobscrmmm' ); |
| 422 | |
| 423 | |
| 424 | zeroBSCRM_enqueue_libs_js_momentdatepicker(); |
| 425 | |
| 426 | |
| 427 | if ( isset( $_GET['zbstype'] ) && ! empty( $_GET['zbstype'] ) ) { |
| 428 | |
| 429 | switch ( $_GET['zbstype'] ) { |
| 430 | |
| 431 | case 'quote': |
| 432 | zeroBSCRM_scriptStyles_admin_quoteBuilder(); |
| 433 | break; |
| 434 | |
| 435 | case 'invoice': |
| 436 | zeroBSCRM_scriptStyles_admin_invoiceBuilder(); |
| 437 | break; |
| 438 | |
| 439 | case 'transaction': |
| 440 | zeroBSCRM_scriptStyles_admin_transactionBuilder(); |
| 441 | break; |
| 442 | |
| 443 | case 'form': |
| 444 | zeroBSCRM_scriptStyles_admin_formBuilder(); |
| 445 | break; |
| 446 | |
| 447 | case 'event': |
| 448 | zeroBSCRM_calendar_admin_styles(); |
| 449 | break; |
| 450 | |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | |
| 455 | do_action( 'zbs_postenqueue_editview' ); |
| 456 | } |
| 457 | function zeroBSCRM_settingspage_admin_styles() { |
| 458 | |
| 459 | global $zbs; |
| 460 | |
| 461 | |
| 462 | wp_enqueue_script( 'jpcrm-daterangepicker', ZEROBSCRM_URL . 'build/lib/daterangepicker/daterangepicker.js', array( 'jquery' ), $zbs::VERSION ); |
| 463 | |
| 464 | wp_enqueue_style( 'zerobscrmsettings' ); |
| 465 | wp_register_script( 'zerobscrm-settingspage-js', ZEROBSCRM_URL . 'js/ZeroBSCRM.admin.settings' . wp_scripts_get_suffix() . '.js', array( 'jquery' ), $zbs::VERSION ); |
| 466 | wp_enqueue_script( 'zerobscrm-settingspage-js' ); |
| 467 | |
| 468 | |
| 469 | if ( isset( $_GET['tab'] ) && $_GET['tab'] == 'fieldsorts' ) { |
| 470 | wp_enqueue_script( 'zerobscrmadmjqui' ); |
| 471 | |
| 472 | |
| 473 | wp_enqueue_style( 'zerobscrmsortscss', plugins_url( '/css/ZeroBSCRM.admin.sortables' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | |
| 478 | function zeroBSCRM_admin_styles_ui2_semantic() {} |
| 479 | |
| 480 | function zeroBSCRM_admin_styles_ui2_semantic_settingspage() { |
| 481 | wp_enqueue_style( 'zerobscrmmaildeliverywizard' ); |
| 482 | wp_enqueue_style( 'zerobscrmsettings' ); |
| 483 | } |
| 484 | |
| 485 | function zeroBSCRM_admin_styles_singleview() { |
| 486 | |
| 487 | |
| 488 | wp_enqueue_style( 'zerobscrmsingleview' ); |
| 489 | wp_enqueue_script( 'zerobscrmsingleview' ); |
| 490 | } |
| 491 | |
| 492 | function jpcrm_admin_scripts_systems_page() { |
| 493 | |
| 494 | wp_enqueue_script( 'jpcrmadminsystem' ); |
| 495 | } |
| 496 | |
| 497 | function zeroBSCRM_admin_styles_homedash() { |
| 498 | global $zbs; |
| 499 | |
| 500 | wp_enqueue_style( 'zerobscrmhomedash' ); |
| 501 | wp_enqueue_style( 'jpcrm-funnel', ZEROBSCRM_URL . 'css/jpcrm-admin-funnel' . wp_scripts_get_suffix() . '.css', array(), $zbs::VERSION ); |
| 502 | wp_enqueue_script( 'jpcrm-funnel', ZEROBSCRM_URL . 'js/jpcrm-admin-funnel' . wp_scripts_get_suffix() . '.js', array(), $zbs::VERSION, true ); |
| 503 | wp_enqueue_script( 'jpcrm-chartjs' ); |
| 504 | zeroBSCRM_enqueue_libs_js_momentdatepicker(); |
| 505 | wp_enqueue_script( 'jpcrm-dash', ZEROBSCRM_URL . 'js/ZeroBSCRM.admin.dash' . wp_scripts_get_suffix() . '.js', array( 'jquery' ), $zbs::VERSION, true ); |
| 506 | } |
| 507 | |
| 508 | function zeroBSCRM_admin_scripts_editcust() { |
| 509 | |
| 510 | zeroBSCRM_dequeueJSModal(); |
| 511 | |
| 512 | |
| 513 | wp_enqueue_script( 'zerobscrmcustjs' ); |
| 514 | } |
| 515 | |
| 516 | function zeroBSCRM_calendar_admin_styles() { |
| 517 | global $zbs; |
| 518 | zeroBSCRM_enqueue_libs_js_momentdatepicker(); |
| 519 | wp_enqueue_script( 'jpcrm-fullcalendar', ZEROBSCRM_URL . 'build/lib/fullcalendar/index.global.min.js', array(), $zbs::VERSION, true ); |
| 520 | wp_enqueue_script( 'jpcrm-tasks', ZEROBSCRM_URL . 'js/jpcrm-admin-tasks' . wp_scripts_get_suffix() . '.js', array( 'jpcrm-fullcalendar' ), $zbs::VERSION, true ); |
| 521 | wp_enqueue_style( 'jpcrm-tasks', ZEROBSCRM_URL . 'css/jpcrm-admin-tasks' . wp_scripts_get_suffix() . '.css', array(), $zbs::VERSION ); |
| 522 | } |
| 523 | |
| 524 | function zeroBSCRM_dequeueJSModal() { |
| 525 | wp_dequeue_style( 'jpcrm-jquery-modal' ); |
| 526 | wp_dequeue_script( 'jpcrm-jquery-modal' ); |
| 527 | } |
| 528 | |
| 529 | function zeroBSCRM_add_admin_styles( $hook ) { |
| 530 | |
| 531 | global $post; |
| 532 | $zeroBSCRM_custom_slug = ''; |
| 533 | if ( isset( $_GET['zbsslug'] ) ) { |
| 534 | $zeroBSCRM_custom_slug = sanitize_text_field( $_GET['zbsslug'] ); |
| 535 | } |
| 536 | |
| 537 | if ( $hook == 'post-new.php' || $hook == 'post.php' || $hook == 'edit-tags.php' || 'edit.php' ) { |
| 538 | if ( is_object( $post ) ) { |
| 539 | if ( 'zerobs_customer' === $post->post_type || 'zerobs_quote' === $post->post_type || 'zerobs_company' === $post->post_type || 'zerobs_invoice' === $post->post_type || 'zerobs_transaction' === $post->post_type || 'zerobs_form' === $post->post_type || 'zerobs_mailcampaign' === $post->post_type || 'zerobs_event' === $post->post_type || 'zerobs_quo_template' === $post->post_type ) { |
| 540 | zeroBSCRM_global_admin_styles(); |
| 541 | |
| 542 | if ( 'zerobs_customer' === $post->post_type || 'zerobs_quo_template' === $post->post_type || 'zerobs_transaction' === $post->post_type || 'zerobs_quote' === $post->post_type || 'zerobs_invoice' === $post->post_type || 'zerobs_form' === $post->post_type || 'zerobs_company' === $post->post_type || 'zerobs_event' === $post->post_type ) { |
| 543 | |
| 544 | |
| 545 | |
| 546 | |
| 547 | zeroBSCRM_admin_scripts_editcust(); |
| 548 | |
| 549 | do_action( 'zbs_extra_custeditscripts' ); |
| 550 | } |
| 551 | |
| 552 | if ( 'zerobs_event' === $post->post_type ) { |
| 553 | zeroBSCRM_calendar_admin_styles(); |
| 554 | } |
| 555 | } |
| 556 | } elseif ( isset( $_GET['post_type'] ) && ( $_GET['post_type'] == 'zerobs_customer' || $_GET['post_type'] == 'zerobs_quo_template' || $_GET['post_type'] == 'zerobs_event' || $_GET['post_type'] == 'zerobs_transaction' || $_GET['post_type'] == 'zerobs_company' ) ) { |
| 557 | zeroBSCRM_global_admin_styles(); |
| 558 | |
| 559 | } elseif ( isset( $_GET['post_type'] ) && ( $_GET['post_type'] == 'zerobs_form' || $_GET['post_type'] == 'zerobs_event' ) ) { |
| 560 | zeroBSCRM_global_admin_styles(); |
| 561 | |
| 562 | } elseif ( $zeroBSCRM_custom_slug == 'zbs-add-user' || $zeroBSCRM_custom_slug == 'zbs-edit-user' ) { |
| 563 | zeroBSCRM_global_admin_styles(); |
| 564 | |
| 565 | } |
| 566 | |
| 567 | |
| 568 | if ( isset( $_GET['page'] ) && $_GET['page'] == 'zbs-add-edit' ) { |
| 569 | |
| 570 | zeroBSCRM_admin_styles_singleview(); |
| 571 | } |
| 572 | } |
| 573 | } |
| 574 | add_action( 'admin_enqueue_scripts', 'zeroBSCRM_add_admin_styles', 10, 1 ); |
| 575 | |
| 576 | |
| 577 | function zeroBSCRM_load_libs_js_momentdatepicker() { |
| 578 | add_action( 'admin_enqueue_scripts', 'zeroBSCRM_enqueue_libs_js_momentdatepicker' ); |
| 579 | } |
| 580 | |
| 581 | function zeroBSCRM_enqueue_libs_js_momentdatepicker() { |
| 582 | |
| 583 | global $zbs; |
| 584 | wp_enqueue_script( 'jpcrm-daterangepicker', ZEROBSCRM_URL . 'build/lib/daterangepicker/daterangepicker.js', array( 'jquery' ), $zbs::VERSION ); |
| 585 | |
| 586 | } |
| 587 | |
| 588 | |
| 589 | function zeroBSCRM_load_libs_js_customerfilters() { |
| 590 | add_action( 'admin_enqueue_scripts', 'zeroBSCRM_enqueue_libs_js_customerfilters' ); |
| 591 | } |
| 592 | function zeroBSCRM_enqueue_libs_js_customerfilters() { |
| 593 | |
| 594 | global $zbs; |
| 595 | |
| 596 | wp_enqueue_script( 'zbs-js-customerfilters-v1', ZEROBSCRM_URL . '/js/ZeroBSCRM.admin.customerfilters' . wp_scripts_get_suffix() . '.js', array( 'jquery' ), $zbs::VERSION ); |
| 597 | } |
| 598 | |
| 599 | |
| 600 | function zeroBSCRM_enqueue_media_manager() { |
| 601 | wp_enqueue_media(); |
| 602 | wp_enqueue_script( 'custom-header' ); |
| 603 | } |
| 604 | add_action( 'admin_enqueue_scripts', 'zeroBSCRM_enqueue_media_manager' ); |
| 605 | |
| 606 | function zeroBSCRM_add_admin_segmenteditor_scripts( $hook ) { |
| 607 | |
| 608 | global $zbs; |
| 609 | |
| 610 | |
| 611 | if ( isset( $_GET['page'] ) && $_GET['page'] == $zbs->slugs['addedit'] && isset( $_GET['zbstype'] ) && $_GET['zbstype'] == 'segment' ) { |
| 612 | |
| 613 | |
| 614 | wp_enqueue_script( 'zbs-segmentedit-js' ); |
| 615 | wp_enqueue_style( 'zbs-segmentedit-css' ); |
| 616 | zeroBSCRM_enqueue_libs_js_momentdatepicker(); |
| 617 | } |
| 618 | } |
| 619 | add_action( 'admin_enqueue_scripts', 'zeroBSCRM_add_admin_segmenteditor_scripts' ); |
| 620 | |
| 621 | |
| 622 | |
| 623 | function zeroBSCRM_mailTemplatesEnqueue() { |
| 624 | global $zbs, $pagenow; |
| 625 | |
| 626 | $slug = ''; |
| 627 | if ( isset( $_GET['page'] ) ) { |
| 628 | $slug = sanitize_text_field( $_GET['page'] ); |
| 629 | } |
| 630 | if ( $slug != $zbs->slugs['email-templates'] ) { |
| 631 | return; |
| 632 | } |
| 633 | |
| 634 | if ( isset( $_GET['zbs_template_editor'] ) && ! empty( $_GET['zbs_template_editor'] ) ) { |
| 635 | if ( $_GET['zbs_template_editor'] != 1 ) { |
| 636 | return; |
| 637 | } |
| 638 | } |
| 639 | |
| 640 | if ( ! isset( $_GET['zbs_template_editor'] ) ) { |
| 641 | return; |
| 642 | } |
| 643 | |
| 644 | |
| 645 | $settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) ); |
| 646 | |
| 647 | |
| 648 | if ( false === $settings ) { |
| 649 | return; |
| 650 | } |
| 651 | |
| 652 | |
| 653 | if ( ! isset( $settings['codemirror'] ) ) { |
| 654 | $settings['codemirror'] = array(); |
| 655 | } |
| 656 | $settings['codemirror']['readOnly'] = true; |
| 657 | |
| 658 | wp_add_inline_script( |
| 659 | 'code-editor', |
| 660 | sprintf( |
| 661 | 'jQuery( function() { wp.codeEditor.initialize( "zbstemplatehtml", %s ); } );', |
| 662 | wp_json_encode( $settings ) |
| 663 | ) |
| 664 | ); |
| 665 | } |
| 666 | add_action( 'admin_enqueue_scripts', 'zeroBSCRM_mailTemplatesEnqueue' ); |
| 667 | |
| 668 | |
| 669 | |
| 670 | |
| 671 | |
| 672 | function zeroBSCRM_admin_styles_exportTools() { |
| 673 | |
| 674 | global $zbs; |
| 675 | |
| 676 | wp_register_style( 'zbs-adm-css-export', plugins_url( '/css/ZeroBSCRM.admin.export' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array( 'zbs-wp-semanticui' ), $zbs::VERSION ); |
| 677 | |
| 678 | wp_enqueue_style( 'zbs-adm-css-export' ); |
| 679 | } |
| 680 | |
| 681 | |
| 682 | |
| 683 | |
| 684 | function jpcrm_crm_resources_page_styles_scripts() { |
| 685 | |
| 686 | global $zbs; |
| 687 | wp_enqueue_style( 'jpcrm-crm-sync-resources-page', plugins_url( '/css/JetpackCRM.admin.resources-page' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ) ); |
| 688 | } |
| 689 | |
| 690 | |
| 691 | |
| 692 | |
| 693 | function jpcrm_support_page_styles_scripts() { |
| 694 | |
| 695 | global $zbs; |
| 696 | |
| 697 | wp_enqueue_style( 'jpcrm-support-page', plugins_url( 'css/jpcrm.admin.support-page' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 698 | } |
| 699 | |
| 700 | |
| 701 | |
| 702 | function zeroBSCRM_forms_scriptsStylesRegister() { |
| 703 | |
| 704 | global $zbs; |
| 705 | |
| 706 | |
| 707 | wp_register_script( 'zbsfrontendformsjs', plugins_url( '/js/ZeroBSCRM.public.leadform' . wp_scripts_get_suffix() . '.js', ZBS_ROOTFILE ), array( 'jquery' ), $zbs::VERSION ); |
| 708 | |
| 709 | |
| 710 | wp_register_style( 'zbsfrontendformscss', plugins_url( '/css/ZeroBSCRM.public.frontendforms' . wp_scripts_get_suffix() . '.css', ZBS_ROOTFILE ), array(), $zbs::VERSION ); |
| 711 | } |
| 712 | add_action( 'wp_enqueue_scripts', 'zeroBSCRM_forms_scriptsStylesRegister' ); |