PageSourceSearch

https://lawyersmutualnc.com/wp-content/plugins/woocommerce-request-a-quote/assets/js/afrfq_front.js?ver=1.3.2

js lawyersmutualnc.com collected 2026-10-02 04:38:52 UTC 12,911 bytes, 493 lines download raw bytes

1jQuery(document).ready(function () {
2
3	"use strict";
4	var ajaxUrl  = afrfq_phpvars.admin_url;
5	var nonce    = afrfq_phpvars.nonce;
6	var redirect = afrfq_phpvars.redirect;
7	var pageurl  = afrfq_phpvars.pageurl;
8
9
10	jQuery('#loader-wrapper').hide();
11	
12
13	// jQuery(document).on( 'click', '#addify_convert_to_order_customer', function () {
14	
15	// 	const ajaxUrl  = afrfq_phpvars.admin_url;
16	// 	const nonce    = afrfq_phpvars.nonce;
17	// 	const afrfq_account_qoute_id =jQuery(this).val();
18	// 	setTimeout(function() {
19	// 	jQuery.ajax({
20	// 		url: ajaxUrl,
21	// 		type: 'POST',
22	// 		data: {
23	// 			action     : 'afrfq_customer_convert_pdf',
24	// 			nonce      : nonce,
25	// 			post_id    : afrfq_account_qoute_id,
26	// 		},
27	// 		success: function (response) {
28				
29		
30	// 		},
31	// 		error: function (response) {
32	
33	// 			console.log( response );
34				
35	// 		}
36	// 	});
37	// }, 2000);
38	// });
39
40
41
42
43	jQuery(document).on( 'click', '#af_rfq_get_qoute_by_my_account_pdf', function (event) {
44	
45		"use strict";
46		event.preventDefault();
47
48		//alert("clicked");
49		
50		jQuery('#loader-wrapper').show();
51
52		const ajaxUrl  = afrfq_phpvars.admin_url;
53		const nonce    = afrfq_phpvars.nonce;
54		const afrfq_account_qoute_id =jQuery(this).val();
55		jQuery.ajax({
56			url: ajaxUrl,
57			type: 'POST',
58			data: {
59				action     : 'afrfq_my_account_download_quote_pdf',
60				nonce      : nonce,
61				post_id    : afrfq_account_qoute_id,
62			},
63			success: function (response) {
64				jQuery('#loader-wrapper').hide();
65				var link = document.createElement("a");
66				link.href = response.data.file_to_save;
67	
68				link.download = "Quotes.pdf";
69			    link.target = "_blank";
70			    link.click();
71				
72			},
73			error: function (response) {
74	
75				console.log( response );
76				
77			}
78		});
79		
80	});
81
82	
83
84
85	jQuery('div.menu ul').append( '<li>' + jQuery('li.quote-li a:eq(1)').text() + '</li>' );
86
87	jQuery(document).on( 'change', '.variation_id', function (e) {
88
89		jQuery(this).closest('form').find('button.afrfq_single_page_atc').remove();
90		jQuery( '.afrfqbt_single_page' ).addClass( 'disabled wc-variation-is-unavailable' );
91		jQuery( '.afrfqbt_single_page' ).show();
92
93		if ( !jQuery(this).val() ) {
94			return;
95		}
96
97		var variation_id   = parseInt( jQuery(this).val() );
98		var current_button = jQuery(this);
99
100		jQuery.ajax({
101			url: ajaxUrl,
102			type: 'POST',
103			data: {
104				action       : 'check_availability_of_quote',
105				nonce        : nonce,
106				variation_id : variation_id,
107			},
108			success: function ( response ) {
109
110				if ( 'disabled' == response['display'] ) {
111					jQuery( '.afrfqbt_single_page' ).addClass( 'disabled wc-variation-is-unavailable' );
112					jQuery( '.afrfqbt_single_page' ).show();
113
114					if ( jQuery('button.single_add_to_cart_button').length < 1 ) {
115						jQuery( '.afrfqbt_single_page' ).before( response['button'] );
116					}
117
118				} else if ( 'disabled_swap' == response['display'] ) {
119					jQuery( '.afrfqbt_single_page' ).addClass( 'disabled wc-variation-is-unavailable' );
120					jQuery( '.afrfqbt_single_page' ).show();
121					if ( jQuery('button.single_add_to_cart_button').length < 1  ) {
122						jQuery( '.afrfqbt_single_page' ).before( response['button'] );
123					}
124				} else if ( 'hide' == response['display'] ) {
125					jQuery( '.afrfqbt_single_page' ).addClass( 'disabled wc-variation-is-unavailable' );
126					jQuery( '.afrfqbt_single_page' ).hide();
127					if ( jQuery('button.single_add_to_cart_button').length < 1  ) {
128						jQuery( '.afrfqbt_single_page' ).before( response['button'] );
129					}
130				} else if ( 'hide_swap' == response['display'] ) {
131					jQuery( '.afrfqbt_single_page' ).addClass( 'disabled wc-variation-is-unavailable' );
132					jQuery( '.afrfqbt_single_page' ).hide();
133
134					console.log( jQuery('button.single_add_to_cart_button').length  );
135
136					if ( jQuery('button.single_add_to_cart_button').length < 1 ) {
137						jQuery( '.afrfqbt_single_page' ).before( response['button'] );
138					}
139				} else {
140					jQuery( '.afrfqbt_single_page' ).removeClass( 'disabled' );
141					jQuery( '.afrfqbt_single_page' ).show();
142					if ( jQuery('button.single_add_to_cart_button').length < 1  ) {
143						jQuery( '.afrfqbt_single_page' ).before( response['button'] );
144					}
145				}
146			},
147			error: function (response) {
148				current_button.removeClass('loading');
149				current_button.css('opacity', '1' );
150				current_button.css('border', '1px solid red' );
151			}
152		});
153
154	});
155	
156	jQuery('.addify_converty_to_order_button button').click( function (e) {
157		jQuery(this).addClass('loading');
158		jQuery('table.quote_details').css( 'opacity', '0.67' );
159	});
160
161	jQuery('div.af_quote_fields input:not([type="submit"]), div.af_quote_fields textarea, div.af_quote_fields select').each( function(){
162
163		var current_button = jQuery(this);
164
165		if ( !current_button.val() || current_button.val().length < 1 ) {
166
167			if ( 'required' === current_button.attr('required')  ) {
168				current_button.css('border-left', '2px solid #ca1010');
169			}
170		} else {
171			current_button.css('border-left', '2px solid green');
172		}
173	});
174
175	jQuery( document ).on( 'focusout', 'div.af_quote_fields input, div.af_quote_fields textarea, div.af_quote_fields select', function(ev) {
176
177		var current_button = jQuery(this);
178
179		if ( !current_button.val() || current_button.val().length < 1 ) {
180
181			if ( 'required' === current_button.attr('required')  ) {
182				current_button.css('border-left', '2px solid #ca1010');
183			}
184
185			return;
186		}
187
188		jQuery.ajax({
189			url: ajaxUrl,
190			type: 'POST',
191			data: {
192				action   : 'cache_quote_fields',
193				nonce    : nonce,
194				form_data : jQuery(this).closest('form').serialize(),
195			},
196			success: function (response) {
197				current_button.css('border-left', '2px solid green');
198			},
199			error: function (response) {
200				current_button.css('border-left', '2px solid #ca1010');
201			}
202		});
203	});
204
205	jQuery('.my_account_quotes a.download').click( function (e) {
206		e.preventDefault();
207		if ( jQuery(this).hasClass('disabled') ) {
208			return;
209		}
210		jQuery(this).addClass('loading');
211		jQuery(this).css('opacity', '0.7' );
212		var current_button = jQuery(this);
213		jQuery.ajax({
214			url: ajaxUrl,
215			type: 'POST',
216			data: {
217				action   : 'download_quote_in_pdf',
218				nonce    : nonce,
219				quote_id : current_button.data('quote_id'),
220			},
221			success: function (response) {
222				current_button.removeClass('loading');
223				current_button.addClass('loaded disabled');
224				current_button.css('border', '1px solid green' );
225				window.open( response );	
226			},
227			error: function (response) {
228				current_button.removeClass('loading');
229				current_button.css('opacity', '1' );
230				current_button.css('border', '1px solid red' );
231				
232			}
233		});
234	});
235
236	jQuery(document) .on('click', 'button.afrfq_update_quote_btn', function (e) {
237		e.preventDefault();
238		jQuery(this).addClass('loading');
239		var current_button = jQuery(this);
240		jQuery.ajax({
241
242			url: ajaxUrl,
243			type: 'POST',
244			dataType: 'JSON',
245			data: {
246				action   : 'update_quote_items',
247				nonce    : nonce,
248				form_data : jQuery('form.addify-quote-form').serialize(),
249				quote_id : current_button.data('quote_id'),
250			},
251
252			success: function (response) {
253				
254				current_button.removeClass('loading');
255				current_button.addClass('disabled');
256
257				if ( response['quote_empty'] ) {
258					location.reload();
259				}
260
261				jQuery('div.woocommerce-notices-wrapper').html(response['message'] );
262				jQuery('table.addify-quote-form__contents').replaceWith( response['quote-table'] );
263				jQuery('table.table_quote_totals').replaceWith( response['quote-totals'] );
264				jQuery('li.quote-li').replaceWith( response['mini-quote'] );
265				jQuery('body').animate({
266					scrollTop: jQuery('div.woocommerce-notices-wrapper').offset().top,
267					}, 500
268				);
269				
270			},
271
272			error: function (response) {
273				current_button.removeClass('loading');	
274				current_button.addClass('disabled');
275			}
276		});
277	});
278
279	jQuery(document).on('click', '.afrfqbt', function () {
280
281		jQuery(this).closest('li').find('a.added_to_quote').remove();
282
283		if (jQuery(this).is('.product_type_simple')) {
284
285			var productId = jQuery(this).attr('data-product_id');
286			var quantity  = 1;
287
288			jQuery(this).addClass('loading');
289			var current_button = jQuery(this);
290			jQuery.ajax({
291				url: ajaxUrl,
292				type: 'POST',
293				data: {
294					action: 'add_to_quote',
295					product_id: productId,
296					quantity: quantity,
297					nonce: nonce
298				},
299				success: function (response) {
300
301					if ( 'success' == jQuery.trim(response) ) {
302						if ( "yes" == redirect ) {
303
304							window.location.href = pageurl;
305						} else {
306
307							window.location = location.href;
308						}
309						
310					} else if ( 'failed' == jQuery.trim(response) ) {
311
312						window.location = location.href;
313						
314					} else {
315
316						current_button.removeClass('loading');
317						current_button.after( response['view_button'] );
318						jQuery('.quote-li').replaceWith(response['mini-quote']);
319
320					}	
321				}
322			});
323
324		}
325		return false;
326	});
327
328});
329
330
331
332jQuery(document).ready(function () {
333
334	"use strict";
335	var ajaxUrl  = afrfq_phpvars.admin_url;
336	var nonce    = afrfq_phpvars.nonce;
337	var redirect = afrfq_phpvars.redirect;
338	var pageurl  = afrfq_phpvars.pageurl;
339	var required = false;
340
341	jQuery(document).on('click', '.afrfqbt_single_page', function ($) {
342		var current_button = jQuery(this);
343
344		jQuery(this).closest('form').find('a.added_to_quote').remove();
345		if (jQuery(this).is('.product_type_variable')) {
346
347			if ( jQuery(this).hasClass('disabled') ) {
348				return;
349			}
350
351			jQuery(this).addClass('loading');
352
353			jQuery.ajax({
354				url: ajaxUrl,
355				type: 'POST',
356				data: {
357					action: 'add_to_quote_single_vari',
358					form_data: jQuery(this).closest('form').serialize(),
359					product_id: jQuery(this).data('product_id'),
360					nonce: nonce
361				},
362				success: function (response) {
363
364					if ('success' == jQuery.trim(response)) {
365						if ("yes" == redirect) {
366
367							window.location.href = pageurl;
368						} else {
369
370							window.location = location.href; 
371						}
372					} else if ( 'failed' == jQuery.trim(response) ) {
373
374						window.location = location.href;
375						
376					} else {
377
378						current_button.removeClass('loading');
379						current_button.after( response['view_button'] );
380						jQuery('.quote-li').replaceWith(response['mini-quote']);
381					}
382				}
383			});
384
385		} else {
386
387			var productId = jQuery(this).attr('data-product_id');
388			var quantity  = jQuery('.qty').val();
389
390			jQuery(this).addClass('loading');
391
392			jQuery.ajax({
393				url: ajaxUrl,
394				type: 'POST',
395				data: {
396					action: 'add_to_quote_single',
397					form_data : jQuery(this).closest('form').serialize(),
398					product_id: jQuery(this).data('product_id'),
399					nonce: nonce
400				},
401				success: function (response) {
402
403					if ( 'success' == jQuery.trim(response) ) {
404						if ( "yes" == redirect ) {
405
406							window.location.href = pageurl;
407						} else {
408
409							window.location = location.href;
410						}
411						
412					} else if ( 'failed' == jQuery.trim(response) ) {
413
414						window.location = location.href;
415						
416					} else {
417
418						current_button.removeClass('loading');
419						current_button.after( response['view_button'] );
420						jQuery('.quote-li').replaceWith(response['mini-quote']);
421
422					}
423				}
424			});
425
426		}
427		return false;
428	});
429
430});
431
432jQuery(document).on('click', '.remove-quote-item', function (e) {
433	"use strict";
434	e.preventDefault();
435	var quoteKey = jQuery(this).data('cart_item_key');
436	var ajaxUrl  = afrfq_phpvars.admin_url;
437	var nonce    = afrfq_phpvars.nonce;
438	
439	jQuery(this).closest('tr').css('opacity', '0.5' );
440
441	jQuery.ajax({
442		url: ajaxUrl,
443		type: 'POST',
444
445		data: {
446			action: 'remove_quote_item',
447			quote_key: jQuery(this).data('cart_item_key'),
448			nonce: nonce
449		},
450		success: function (response) {
451
452			if ( response['quote_empty'] ) {
453				location.reload();
454			}
455
456			jQuery('div.woocommerce-notices-wrapper').html(response['message'] );
457			jQuery('table.addify-quote-form__contents').replaceWith( response['quote-table'] );
458			jQuery('table.table_quote_totals').replaceWith( response['quote-totals'] );
459			jQuery('li.quote-li').replaceWith( response['mini-quote'] );
460			jQuery('body').animate({
461				scrollTop: jQuery('div.woocommerce-notices-wrapper').offset().top,
462				}, 500
463			);
464		}
465	});
466});
467
468jQuery(document).on('click', '.quote-remove', function (event) {
469	"use strict";
470	event.preventDefault();
471	var quoteKey = jQuery(this).data('cart_item_key');
472	var ajaxUrl  = afrfq_phpvars.admin_url;
473	var nonce    = afrfq_phpvars.nonce;
474	
475	jQuery(this).closest('li.mini_quote_item').css('opacity', '0.5' );
476
477	jQuery.ajax({
478		url: ajaxUrl,
479		type: 'POST',
480		data: {
481			action: 'remove_quote_item',
482			quote_key: jQuery(this).data('cart_item_key'),
483			nonce: nonce
484		},
485		success: function (response) {
486
487			jQuery('div.woocommerce-notices-wrapper').html(response['message'] );
488			jQuery('table.addify-quote-form__contents').replaceWith( response['quote-table'] );
489			jQuery('table.table_quote_totals').replaceWith( response['quote-totals'] );
490			jQuery('li.quote-li').replaceWith( response['mini-quote'] );
491		}
492	});
493});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.