id, 'cleannetic' ) !== false ); if ( ! $is_cleannetic_app ) { return; } $user = wp_get_current_user(); $user_role = ! empty( $user->roles ) ? ucfirst( $user->roles[0] ) : 'Administrator'; $currency_names = Settings::currency_names(); $currencies = []; foreach ( Settings::currencies() as $code => $symbol ) { $currencies[ $code ] = [ 'symbol' => $symbol, 'name' => $currency_names[ $code ] ?? $code, ]; } $localized = [ 'rest_url' => esc_url_raw( rest_url( 'cleannetic/v1/' ) ), 'nonce' => wp_create_nonce( 'wp_rest' ), 'pro_url' => Plugin::pro_url(), 'currency' => Formatter::currency_config(), 'services' => ServicePostType::get_active_services(), 'categories' => ServicePostType::get_active_categories(), 'staff' => StaffManager::get_staff_members(), 'ajax_url' => admin_url( 'admin-ajax.php' ), 'export_url' => wp_nonce_url( admin_url( 'admin.php?page=cleannetic-bookings&action=export_csv' ), 'cleannetic_export_csv' ), 'admin_nonce' => wp_create_nonce( 'cleannetic_admin_nonce' ), 'plugin_url' => CLEANNETIC_URL, 'site_url' => site_url(), 'site_title' => get_bloginfo( 'name' ), 'admin_email' => get_option( 'admin_email' ), 'user_display' => $user ? $user->display_name : 'Admin', 'user_role' => $user_role, 'user_can_manage' => current_user_can( 'manage_options' ), 'settings' => Settings::all(), 'currencies' => $currencies, 'i18n' => [ 'confirm_delete' => __( 'Are you sure you want to delete this booking? This action cannot be undone.', 'cleannetic' ), 'status_updated' => __( 'Booking status updated successfully.', 'cleannetic' ), 'staff_assigned' => __( 'Staff assignment updated.', 'cleannetic' ), 'saving' => __( 'Saving changes...', 'cleannetic' ), 'saved' => __( 'Changes saved successfully!', 'cleannetic' ), 'importing' => __( 'Importing sample demo data...', 'cleannetic' ), 'imported' => __( 'Sample demo data imported! Reloading...', 'cleannetic' ), 'error' => __( 'An error occurred. Please try again.', 'cleannetic' ), 'print_confirmation_kicker' => __( 'Booking confirmation', 'cleannetic' ), 'print_confirmation_title' => __( 'You are all set!', 'cleannetic' ), 'print_confirmation_intro' => __( 'Keep this confirmation for your records. We have also emailed these details.', 'cleannetic' ), 'print_quote_kicker' => __( 'Quote request', 'cleannetic' ), 'print_job_kicker' => __( 'Job sheet', 'cleannetic' ), 'print_job_title' => __( 'Cleaning job sheet', 'cleannetic' ), 'print_job_intro' => __( 'Give this sheet to the assigned cleaner. It includes the customer, address and job details.', 'cleannetic' ), 'print_booking_ref' => __( 'Booking reference', 'cleannetic' ), 'print_service' => __( 'Service', 'cleannetic' ), 'print_datetime' => __( 'Date & time', 'cleannetic' ), 'print_preferred_datetime' => __( 'Preferred date & time', 'cleannetic' ), 'print_location' => __( 'Service location', 'cleannetic' ), 'print_customer' => __( 'Customer', 'cleannetic' ), 'print_phone' => __( 'Phone', 'cleannetic' ), 'print_email' => __( 'Email', 'cleannetic' ), 'print_total' => __( 'Total amount', 'cleannetic' ), 'print_payment' => __( 'Payment status', 'cleannetic' ), 'print_payment_method' => __( 'Payment', 'cleannetic' ), 'print_notes' => __( 'Special instructions', 'cleannetic' ), 'print_staff' => __( 'Assigned staff', 'cleannetic' ), 'print_status' => __( 'Status', 'cleannetic' ), 'print_gate' => __( 'Gate / access code', 'cleannetic' ), 'print_printed' => __( 'Printed', 'cleannetic' ), 'print_thank_you' => __( 'Thank you for booking with', 'cleannetic' ), 'print_pricing' => __( 'Pricing', 'cleannetic' ), 'print_amount' => __( 'Amount', 'cleannetic' ), 'print_unassigned' => __( 'Unassigned', 'cleannetic' ), 'quote_title' => __( 'Thanks — we will be in touch!', 'cleannetic' ), 'quote_estimate' => __( 'Estimated amount', 'cleannetic' ), ], 'icons' => Icons::svg_map( [ 'check', 'x', 'trash', 'calendar', 'user', 'map-pin', 'credit-card', 'eye', 'sparkles', 'crown', 'lock' ] ), ]; $print_js = CLEANNETIC_DIR . 'assets/js/print.js'; wp_enqueue_script( 'cleannetic-print', CLEANNETIC_URL . 'assets/js/print.js', [], file_exists( $print_js ) ? filemtime( $print_js ) : CLEANNETIC_VERSION, true ); // Vue SPA app assets $dist_js = CLEANNETIC_DIR . 'assets/dist/cln-admin.js'; $dist_css = CLEANNETIC_DIR . 'assets/dist/cln-admin.css'; if ( file_exists( $dist_js ) ) { wp_enqueue_script( 'cleannetic-admin', CLEANNETIC_URL . 'assets/dist/cln-admin.js', [ 'cleannetic-print' ], filemtime( $dist_js ), true ); wp_add_inline_script( 'cleannetic-admin', 'window.process = { env: { NODE_ENV: "production" } };', 'before' ); wp_localize_script( 'cleannetic-admin', 'cleannetic_data', $localized ); wp_localize_script( 'cleannetic-admin', 'cleannetic_admin', $localized ); /** * Fires after the admin app script is enqueued, so extensions can enqueue * scripts that depend on the 'cleannetic-admin' handle and register their * components through window.CleanneticAdmin.registerExtension(). */ do_action( 'cleannetic_admin_app_enqueued', 'cleannetic-admin' ); } if ( file_exists( $dist_css ) ) { wp_enqueue_style( 'cleannetic-admin', CLEANNETIC_URL . 'assets/dist/cln-admin.css', [], filemtime( $dist_css ) ); wp_add_inline_style( 'cleannetic-admin', '#wpbody-content #cleannetic-app :is(h1,h2,h3,h4,h5,h6){color:inherit;}' . '#wpbody-content #cleannetic-app .text-white,' . '#wpbody #cleannetic-app .text-white,' . '#cleannetic-app .text-white{color:#ffffff!important;}' . '#wpbody-content #cleannetic-app .text-white :is(h1,h2,h3,h4,h5,h6):not([class*="text-"]):not([class*="!text-"]){color:#ffffff!important;}' ); } else { wp_enqueue_style( 'cleannetic-admin-css', CLEANNETIC_URL . 'assets/css/admin.css', [], CLEANNETIC_VERSION ); } wp_enqueue_media(); } }