PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.3.8
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.3.8
2.4.0 2.4.1 2.3.8 2.3.7 2.3.6 2.3.5 2.3.4 2.3.3 2.3.2 2.3.1 2.2.0 2.1.21 2.1.20 2.1.19 2.1.18 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.2 All 57 releases
easy-invoice / includes / Admin / AdminAssets.php

AdminAssets.php in Easy Invoice – Invoice Generator, PDF Quotes & Payments 2.3.8, at includes/Admin/AdminAssets.php

502 lines 24.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Admin Assets Class
4 *
5 * @package Easy_Invoice
6 * @subpackage Admin
7 */
8
9 namespace EasyInvoice\Admin;
10
11 use EasyInvoice\Constants\PagesSlugs;
12
13 /**
14 * AdminAssets Class
15 *
16 * Handles registration and enqueuing of admin CSS and JS assets.
17 */
18 class AdminAssets {
19 /**
20 * Register hooks
21 */
22 public function register() {
23 add_action('admin_enqueue_scripts', array($this, 'enqueueAdminAssets'));
24 }
25
26 /**
27 * Enqueue admin assets
28 *
29 * @param string $hook The current admin page
30 */
31 public function enqueueAdminAssets($hook) {
32 // Only load on our plugin pages
33 if (empty($hook) || strpos($hook, 'easy-invoice') === false) {
34 return;
35 }
36
37 // Enqueue styles
38 $this->enqueueStyles();
39
40 // Enqueue scripts
41 $this->enqueueScripts($hook);
42
43 // Localize script data
44 $this->localizeScripts($hook);
45 }
46
47 /**
48 * Enqueue stylesheets
49 */
50 private function enqueueStyles() {
51
52 // Tailwind: opt-in switch between the unpurged 2.8 MB shipped file
53 // and a purged ~50 KB file that an admin has built via
54 // tools/tailwind-build/. The default is the unpurged file so
55 // merchants who haven't run the build see zero behavior change.
56 //
57 // To enable the win:
58 // 1. cd tools/tailwind-build && npm install && npm run build
59 // 2. Verify visually on a few representative pages
60 // 3. Set option `easy_invoice_tailwind_purged = '1'` OR add the
61 // filter below to your theme's functions.php:
62 // add_filter('easy_invoice_use_purged_tailwind', '__return_true');
63 //
64 // The fallback below also defensively checks the purged file exists,
65 // so flipping the option without actually building falls back to the
66 // shipped file rather than 404-ing the stylesheet.
67 $use_purged = apply_filters(
68 'easy_invoice_use_purged_tailwind',
69 (bool) get_option('easy_invoice_tailwind_purged', false)
70 );
71 $purged_rel = 'assets/lib/tailwind/tailwind.purged.min.css';
72 $shipped_rel = 'assets/lib/tailwind/tailwind.min.css';
73 $tailwind_rel = ($use_purged && file_exists(EASY_INVOICE_PLUGIN_DIR . $purged_rel))
74 ? $purged_rel
75 : $shipped_rel;
76
77 wp_enqueue_style(
78 'easy-invoice-tailwind',
79 EASY_INVOICE_PLUGIN_URL . $tailwind_rel,
80 array(),
81 EASY_INVOICE_VERSION
82 );
83
84 $page = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : '';
85
86 // Main plugin layout + header strip alignment (always on Easy Invoice admin screens).
87 wp_enqueue_style(
88 'easy-invoice-main',
89 EASY_INVOICE_PLUGIN_URL . 'assets/css/easy-invoice.css',
90 array(),
91 EASY_INVOICE_VERSION
92 );
93
94 if($page === 'easy-invoice-builder') {
95 // Main admin styles
96
97 wp_enqueue_style(
98 'easy-invoice-preview',
99 EASY_INVOICE_PLUGIN_URL . 'assets/css/invoice-preview.css',
100 array(),
101 EASY_INVOICE_VERSION
102 );
103 }
104
105 // Font Awesome (~87 KB) is used by the heavyweight templates
106 // (clients, settings, reports, invoices, quotes, payments) but
107 // NOT by the lightweight admin pages — Dashboard, Addons grid,
108 // License, Free-vs-Pro, Join Community, and every addon-settings
109 // sub-page (those use dashicons). Skip enqueueing FA on the
110 // deny-listed pages to save the bandwidth and the parse cost.
111 // Filterable so site-specific custom templates can opt back in.
112 $fa_deny = (array) apply_filters('easy_invoice_font_awesome_skip_pages', [
113 'easy-invoice-dashboard',
114 'easy-invoice-addons',
115 'easy-invoice-license',
116 'easy-invoice-free-vs-pro',
117 'easy-invoice-join-community',
118 ]);
119 $is_addon_subpage = ($page !== '' && strpos($page, 'easy-invoice-addon-') === 0);
120 if (!in_array($page, $fa_deny, true) && !$is_addon_subpage) {
121 wp_enqueue_style(
122 'font-awesome',
123 EASY_INVOICE_PLUGIN_URL . 'assets/lib/font-awesome/css/all.min.css',
124 array(),
125 EASY_INVOICE_VERSION
126 );
127 }
128
129
130 // RTL support.
131 //
132 // Strategy: 'append' (not 'replace') because Tailwind utility
133 // classes generated into easy-invoice.css remain valid LTR — only
134 // the small set of custom directional rules (sidebar borders,
135 // page-header negative margins, drawer offsets) need mirroring.
136 // WordPress loads assets/css/easy-invoice-rtl.css AFTER
137 // easy-invoice.css when is_rtl() is true; that file holds only the
138 // directional overrides.
139 //
140 // 'easy-invoice-main' is the handle of the file we want to extend
141 // (line 87 above). The previous handle 'easy-invoice-admin' did
142 // not exist and so the call was a no-op.
143 wp_style_add_data('easy-invoice-main', 'rtl', 'append');
144 }
145
146 /**
147 * Enqueue scripts
148 *
149 * @param string $hook The current admin page
150 */
151 private function enqueueScripts($hook) {
152 // Only load on Easy Invoice pages
153 if (empty($hook) || strpos($hook, 'easy-invoice') === false) {
154 return;
155 }
156
157 // Common admin scripts
158 wp_enqueue_script('jquery');
159 wp_enqueue_script('jquery-ui-core');
160 wp_enqueue_script('jquery-ui-datepicker');
161 wp_enqueue_script('wp-util');
162
163 // Add WordPress core dependencies that provide the 'wp' object
164 wp_enqueue_script('wp-api-fetch');
165 wp_enqueue_script('wp-i18n');
166 wp_enqueue_script('wp-a11y');
167 wp_enqueue_script('wp-hooks');
168
169 // Settings page script
170 if (isset($_GET['page']) && $_GET['page'] === 'easy-invoice-settings') {
171 // settings.js calls .sortable() and .disableSelection() on the
172 // payment-gateway list, so jQuery UI Sortable must be present and
173 // printed first. SettingsController::enqueueAdminScripts() also
174 // registers this same handle; WordPress keeps whichever call runs
175 // first and silently drops the other's dependency array, and this
176 // one runs first (AdminAssets is wired up during EasyInvoice::init,
177 // before SettingsController::init). Declaring the jQuery UI handles
178 // here lets wp_scripts resolve the order rather than leaving it to
179 // the sequence the two enqueue callbacks happen to fire in.
180 //
181 // Only core handles are listed. select2 / easy-invoice-toast are
182 // also used by settings.js but are registered by SettingsController
183 // later in the request; naming them here would mean settings.js is
184 // dropped entirely if that callback ever stops running, so they are
185 // deliberately left out.
186 wp_enqueue_script(
187 'easy-invoice-settings',
188 EASY_INVOICE_PLUGIN_URL . 'assets/js/settings.js',
189 array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'wp-util', 'wp-api-fetch', 'wp-i18n'),
190 EASY_INVOICE_VERSION,
191 true
192 );
193
194 // Localize the script with necessary data
195 wp_localize_script('easy-invoice-settings', 'easyInvoiceSettings', array(
196 'nonce' => wp_create_nonce('easy_invoice_settings'),
197 'ajaxurl' => admin_url('admin-ajax.php')
198 ));
199 return; // Don't load other scripts on settings page
200 }
201
202 // Load dependencies
203 wp_enqueue_script('jquery-ui-sortable');
204
205 // Main admin script
206 wp_enqueue_script('jquery');
207
208 // Register and enqueue our scripts
209 wp_register_script('easy-invoice-scripts', EASY_INVOICE_PLUGIN_URL . 'assets/js/easy-invoice.js', array('jquery', 'wp-api-fetch', 'wp-i18n', 'wp-a11y'), EASY_INVOICE_VERSION, true);
210 wp_enqueue_script('easy-invoice-scripts');
211
212 // Conditionally load client manager only on invoice pages (not quote pages or invoice builder)
213 if (!(isset($_GET['page']) && ($_GET['page'] === 'easy-invoice-quote-builder' || $_GET['page'] === 'easy-invoice-builder'))) {
214 wp_register_script('easy-invoice-client-manager', EASY_INVOICE_PLUGIN_URL . 'assets/js/client-manager.js', array('jquery', 'easy-invoice-scripts', 'wp-api-fetch', 'wp-i18n'), EASY_INVOICE_VERSION, true);
215 wp_enqueue_script('easy-invoice-client-manager');
216 }
217
218 // Load clients.js on the clients page
219 if (isset($_GET['page']) && $_GET['page'] === PagesSlugs::CLIENTS) {
220 wp_register_script('easy-invoice-clients', EASY_INVOICE_PLUGIN_URL . 'assets/js/clients.js', array('jquery', 'easy-invoice-scripts', 'easy-invoice-confirmation-modal', 'easy-invoice-toast', 'wp-api-fetch', 'wp-i18n'), EASY_INVOICE_VERSION, true);
221 wp_enqueue_script('easy-invoice-clients');
222 }
223
224 wp_register_script('easy-invoice-payment-manager', EASY_INVOICE_PLUGIN_URL . 'assets/js/payment-manager.js', array('jquery', 'easy-invoice-scripts', 'wp-api-fetch', 'wp-i18n'), EASY_INVOICE_VERSION, true);
225 wp_enqueue_script('easy-invoice-payment-manager');
226
227 // Tooltip manager - reusable across the plugin
228 wp_register_script('easy-invoice-tooltip', EASY_INVOICE_PLUGIN_URL . 'assets/js/tooltip-manager.js', array('jquery', 'wp-api-fetch', 'wp-i18n'), EASY_INVOICE_VERSION, true);
229 wp_enqueue_script('easy-invoice-tooltip');
230
231 // Confirmation modal - reusable across the plugin
232 wp_register_script('easy-invoice-confirmation-modal', EASY_INVOICE_PLUGIN_URL . 'assets/js/confirmation-modal.js', array('jquery', 'wp-api-fetch', 'wp-i18n'), EASY_INVOICE_VERSION, true);
233 wp_enqueue_script('easy-invoice-confirmation-modal');
234
235 // Toast notification system - global across the plugin
236 wp_register_script('easy-invoice-toast', EASY_INVOICE_PLUGIN_URL . 'assets/js/easy-invoice-toast.js', array('jquery', 'wp-api-fetch', 'wp-i18n'), EASY_INVOICE_VERSION, true);
237 wp_enqueue_script('easy-invoice-toast');
238
239 // Bulk "Send Email" teaser — only on the invoice / quote listings.
240 // Always injects the option (even without Pro) so users discover the
241 // feature; when Pro is inactive, clicking Apply opens the upgrade
242 // dialog instead of doing the work.
243 $current_page = isset($_GET['page']) ? sanitize_key($_GET['page']) : '';
244 if (in_array($current_page, ['easy-invoice-all', 'easy-quote-all'], true)) {
245 wp_register_script(
246 'easy-invoice-bulk-send-email-teaser',
247 EASY_INVOICE_PLUGIN_URL . 'assets/js/bulk-send-email-teaser.js',
248 array('jquery', 'easy-invoice-confirmation-modal', 'easy-invoice-toast'),
249 EASY_INVOICE_VERSION,
250 true
251 );
252 wp_localize_script('easy-invoice-bulk-send-email-teaser', 'easyInvoiceBulkSendTeaser', array(
253 'hasPro' => function_exists('easy_invoice_has_pro') && easy_invoice_has_pro(),
254 'upgradeUrl' => 'https://matrixaddons.com/plugins/easy-invoice/#pricing',
255 'i18n' => array(
256 // Send Email
257 'send_email_label' => __('Send Email (Pro)', 'easy-invoice'),
258 'send_email_feature_name' => __('Bulk Send Email', 'easy-invoice'),
259 'send_email_feature_description'=> __('Select multiple invoices or quotes and send the configured "Available" email to every selected document\'s client in a single click. Includes a per-row success / failure report so you can spot deliverability problems immediately.', 'easy-invoice'),
260 // Export
261 'export_feature_name' => __('Bulk Export Selected', 'easy-invoice'),
262 'export_feature_description' => __('Export your selected invoices or quotes to a clean, accounting-ready CSV — perfect for QuickBooks, Xero, audit trails, or migrating to a new system.', 'easy-invoice'),
263 // Generic
264 'upgrade_required' => __('This action requires Easy Invoice Pro.', 'easy-invoice'),
265 ),
266 ));
267 wp_enqueue_script('easy-invoice-bulk-send-email-teaser');
268 }
269
270 // jsPDF for PDF generation - available on all Easy Invoice pages
271 wp_register_script('jspdf', 'https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js', array(), '2.5.1', true);
272 wp_enqueue_script('jspdf');
273
274
275 // Conditionally load invoice-specific scripts only on invoice pages
276 if (isset($_GET['page']) && ($_GET['page'] === 'easy-invoice-new' || $_GET['page'] === 'easy-invoice-builder')) {
277 // Invoice builder scripts
278 wp_register_script('easy-invoice-builder', EASY_INVOICE_PLUGIN_URL . 'assets/js/invoice-builder.js', array('jquery', 'easy-invoice-scripts', 'easy-invoice-payment-manager', 'wp-api-fetch', 'wp-i18n'), EASY_INVOICE_VERSION, true);
279 wp_enqueue_script('easy-invoice-builder');
280
281 // Use invoice-save.js for comprehensive save functionality
282 wp_register_script('easy-invoice-save', EASY_INVOICE_PLUGIN_URL . 'assets/js/invoice-save.js', array('jquery', 'easy-invoice-scripts', 'easy-invoice-payment-manager', 'wp-api-fetch', 'wp-i18n'), EASY_INVOICE_VERSION, true);
283 wp_enqueue_script('easy-invoice-save');
284 }
285
286 // Quote builder (full-screen editor)
287 if (isset($_GET['page']) && $_GET['page'] === 'easy-invoice-quote-builder') {
288 wp_register_script(
289 'easy-quote-save',
290 EASY_INVOICE_PLUGIN_URL . 'assets/js/quote-save.js',
291 array('jquery', 'easy-invoice-scripts', 'easy-invoice-payment-manager', 'wp-api-fetch', 'wp-i18n'),
292 EASY_INVOICE_VERSION,
293 true
294 );
295 wp_enqueue_script('easy-quote-save');
296 }
297
298 if (isset($_GET['page']) && in_array($_GET['page'], array('easy-invoice-builder', 'easy-invoice-quote-builder'), true)) {
299 wp_enqueue_script(
300 'easy-invoice-builder-mobile-tabs',
301 EASY_INVOICE_PLUGIN_URL . 'assets/js/builder-mobile-tabs.js',
302 array('jquery'),
303 EASY_INVOICE_VERSION,
304 true
305 );
306 wp_enqueue_script(
307 'easy-invoice-builder-ux',
308 EASY_INVOICE_PLUGIN_URL . 'assets/js/builder-ux.js',
309 array('jquery', 'easy-invoice-scripts'),
310 EASY_INVOICE_VERSION,
311 true
312 );
313 }
314 }
315
316 /**
317 * Localize script data
318 *
319 * @param string $hook The current admin page
320 */
321 private function localizeScripts($hook) {
322 global $pagenow, $post;
323
324 // Get currency settings
325 $settings_controller = new \EasyInvoice\Controllers\SettingsController();
326 $settings = $settings_controller->getSettings();
327 $currency_code = $settings['easy_invoice_currency_code'] ?? 'USD';
328 $currency_position = $settings['easy_invoice_currency_position'] ?? 'left';
329 $currency_symbol = easy_invoice_get_currency_symbol();
330
331 $current_admin_page = isset($_GET['page']) ? sanitize_text_field(wp_unslash($_GET['page'])) : '';
332
333 // Default data
334 $script_data = array(
335 'ajaxUrl' => admin_url('admin-ajax.php'),
336 'nonce' => wp_create_nonce('easy_invoice_nonce'),
337 'i18n' => array(
338 'confirm_delete' => __('Are you sure you want to delete this invoice?', 'easy-invoice'),
339 'invoice_deleted' => __('Invoice deleted successfully', 'easy-invoice'),
340 'client_deleted' => __('Client deleted successfully', 'easy-invoice'),
341 'confirm_delete_client' => __('Are you sure you want to delete this client?', 'easy-invoice'),
342 'edit_invoice' => __('Edit Invoice', 'easy-invoice'),
343 'create_invoice' => __('Create Invoice', 'easy-invoice'),
344 'save' => __('Save', 'easy-invoice'),
345 'cancel' => __('Cancel', 'easy-invoice'),
346 'add_item' => __('Add Item', 'easy-invoice'),
347 'delete_item' => __('Delete Item', 'easy-invoice'),
348 'error' => __('An error occurred', 'easy-invoice'),
349 ),
350 );
351
352 if (in_array($current_admin_page, array('easy-invoice-builder', 'easy-invoice-quote-builder'), true)) {
353 $script_data['i18n'] = array_merge(
354 $script_data['i18n'],
355 array(
356 'saving' => __('Saving…', 'easy-invoice'),
357 'sending' => __('Sending…', 'easy-invoice'),
358 'save_invoice' => __('Save Invoice', 'easy-invoice'),
359 'update_invoice' => __('Update Invoice', 'easy-invoice'),
360 'save_quote' => __('Save Quote', 'easy-invoice'),
361 'update_quote' => __('Update Quote', 'easy-invoice'),
362 'send_invoice' => __('Send Invoice', 'easy-invoice'),
363 'send_quote' => __('Send Quote', 'easy-invoice'),
364 'save_first_invoice' => __('Please save the invoice before sending.', 'easy-invoice'),
365 'save_first_quote' => __('Please save the quote before sending.', 'easy-invoice'),
366 'email_sent_invoice' => __('Invoice email sent successfully.', 'easy-invoice'),
367 'email_sent_quote' => __('Quote email sent successfully.', 'easy-invoice'),
368 'email_error' => __('Error sending email.', 'easy-invoice'),
369 'network_error' => __('Error connecting to server.', 'easy-invoice'),
370 'tab_editor' => __('Editor', 'easy-invoice'),
371 'tab_preview' => __('Preview', 'easy-invoice'),
372 'confirm_send_invoice_title' => __('Send invoice by email?', 'easy-invoice'),
373 'confirm_send_invoice_message' => __('This will email the invoice to the client using your configured template.', 'easy-invoice'),
374 'confirm_send_quote_title' => __('Send quote by email?', 'easy-invoice'),
375 'confirm_send_quote_message' => __('This will email the quote to the client using your configured template.', 'easy-invoice'),
376 'confirm_send_confirm' => __('Send', 'easy-invoice'),
377 'confirm_cancel' => __('Cancel', 'easy-invoice'),
378 'builder_unsaved_warning' => __('You have unsaved changes. If you leave this page, your changes may be lost.', 'easy-invoice'),
379 'builder_title_hint' => __('The title above matches the document title field in the editor.', 'easy-invoice'),
380 'builder_shell_hint' => __('On smaller screens, use the tabs to switch between the editor and the live preview.', 'easy-invoice'),
381 'builder_shell_hint_dismiss' => __('Got it', 'easy-invoice'),
382 'send_invoice_confirm_browser' => __('Send this invoice by email?', 'easy-invoice'),
383 'send_quote_confirm_browser' => __('Send this quote by email?', 'easy-invoice'),
384 )
385 );
386 }
387
388 $script_data = array_merge(
389 $script_data,
390 array(
391 'urls' => array(
392 'preview' => admin_url('admin.php?action=easy_invoice_preview&invoice_id='),
393 'edit' => admin_url('admin.php?page=easy-invoice-new&id='),
394 ),
395 'settings' => array(
396 'currency_symbol' => $currency_symbol,
397 'currency_position' => $currency_position,
398 'currency_code' => $currency_code,
399 'decimal_separator' => $settings['easy_invoice_decimal_separator'] ?? '.',
400 'thousand_separator' => $settings['easy_invoice_thousands_separator'] ?? ',',
401 'decimal_places' => $settings['easy_invoice_decimal_precision'] ?? 2,
402 'date_format' => get_option('date_format', 'F j, Y'),
403 ),
404 'showAdjustField' => \EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField(),
405 )
406 );
407
408 // Localize common scripts
409 wp_localize_script('easy-invoice-scripts', 'easyInvoice', $script_data);
410
411 // Conditionally localize client manager only when it's loaded
412 if (!(isset($_GET['page']) && ($_GET['page'] === 'easy-invoice-quote-builder' || $_GET['page'] === 'easy-invoice-builder'))) {
413 wp_localize_script('easy-invoice-client-manager', 'easyInvoice', $script_data);
414 }
415
416 wp_localize_script('easy-invoice-payment-manager', 'easyInvoice', $script_data);
417 wp_localize_script('easy-invoice-tooltip', 'easyInvoice', $script_data);
418
419 // Conditionally localize invoice-specific scripts
420 if (isset($_GET['page']) && ($_GET['page'] === 'easy-invoice-new' || $_GET['page'] === 'easy-invoice-builder')) {
421 // Add invoice-specific field configuration
422 $form_manager = new \EasyInvoice\Forms\Invoice\InvoiceFormManager();
423 $script_data['fieldConfig'] = $form_manager->getFieldConfigForJavaScript();
424
425 // Add additional data for the invoice edit page
426 $invoice_id = isset($_GET['id']) ? intval($_GET['id']) : 0;
427 $invoice_items_json = '';
428
429 if ($invoice_id > 0) {
430 // Existing invoice - get its data
431 $repository = \EasyInvoice\Providers\InvoiceServiceProvider::getInvoiceRepository();
432 $invoice = $repository->find($invoice_id);
433
434 if ($invoice) {
435 $script_data['invoice_id'] = $invoice_id;
436 $script_data['editMode'] = true;
437
438 // Get invoice data for JavaScript
439 $invoice_data = $invoice->toArray();
440 $script_data['invoiceData'] = $invoice_data;
441
442 // Get invoice items
443 $items = $invoice->getItems();
444 $items_data = [];
445 foreach ($items as $item) {
446 $items_data[] = [
447 'id' => $item->getId(),
448 'name' => $item->getName(),
449 'description' => $item->getDescription(),
450 'quantity' => $item->getQuantity(),
451 'price' => $item->getPrice(),
452 'taxable' => $item->isTaxable(),
453 'total' => $item->getAmount()
454 ];
455 }
456 $script_data['invoiceItems'] = $items_data;
457
458 // Get client data if available
459 if ($invoice->getClientId()) {
460 $client_repository = \EasyInvoice\Providers\ClientServiceProvider::getClientRepository();
461 $client = $client_repository->find($invoice->getClientId());
462 if ($client) {
463 $script_data['clientData'] = [
464 'id' => $client->getId(),
465 'name' => $client->getBusinessClientName() ?: ($client->getFirstName() . ' ' . $client->getLastName()),
466 'email' => $client->getEmail(),
467 'phone' => $client->getExtraInfo(),
468 'address' => $client->getAddress(),
469 'company' => $client->getBusinessClientName()
470 ];
471 }
472 }
473 }
474 } else {
475 // New invoice - set default items
476 $script_data['editMode'] = false;
477 $script_data['invoice_id'] = 0;
478 $default_items = [
479 [
480 'name' => '',
481 'description' => '',
482 'quantity' => 0,
483 'price' => 0,
484 'taxable' => true
485 ]
486 ];
487 $script_data['default_items'] = $default_items;
488 }
489
490 // Localize invoice-specific scripts
491 wp_localize_script('easy-invoice-builder', 'easyInvoice', $script_data);
492 wp_localize_script('easy-invoice-save', 'easyInvoice', $script_data);
493 }
494
495 if (isset($_GET['page']) && $_GET['page'] === 'easy-invoice-quote-builder') {
496 // Override showAdjustField for quote pages
497 $script_data['showAdjustField'] = \EasyInvoice\Controllers\SettingsController::shouldShowQuoteAdjustField();
498 wp_localize_script('easy-quote-save', 'easyInvoice', $script_data);
499 }
500 }
501 }
502