Uname: Linux premium294.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
Software: LiteSpeed
PHP version: 8.1.32 [ PHP INFO ] PHP os: Linux
Server Ip: 104.21.80.1
Your Ip: 216.73.216.223
User: mjbynoyq (1574) | Group: mjbynoyq (1570)
Safe Mode: OFF
Disable Function:
NONE

name : admin.js
( function ( $ ) {
	$( function () {
		// Open Views Submenu

		// wp-has-current-submenu wp-menu-open

		// Create new popup
		$( document ).on( 'click', '.post-type-wpforms-views a.add_new_wpform_view', function ( e ) {
			e.preventDefault();
			var wpf_forms = JSON.parse( view_forms );
			var form_dropdown = '<select id="view_form_id">';
			form_dropdown += '<option value=""> Select Form</option>';
			Object.keys( wpf_forms ).forEach( ( form_id ) => {
				// console.log(form);
				form_dropdown += '<option value="' + form_id + '">' + wpf_forms[ form_id ] + '</option>';
			} );

			form_dropdown += '</select>';

			Swal.fire( {
				title: 'Create a new View',
				html: '<div class="create_view_popup"><input id="view_title" placeholder="Add New View Title...">' + form_dropdown + '</div>',
				showCancelButton: true,
				confirmButtonText: 'Create',
				showLoaderOnConfirm: true,
				preConfirm: () => {
					var title = document.getElementById( 'view_title' ).value;
					var form_id = document.getElementById( 'view_form_id' ).value;

					if ( form_id == '' ) {
						alert( 'Please select form.' );
						return false;
					}

					var data = {
						action: 'wpf_views_create_view',
						form_id: form_id,
						title: title,
						create_nonce: wpf_views_admin.create_nonce
					};
					return $.post( ajaxurl, data, function ( response ) {
						// var res = JSON.parse(response);
						// console.log(res.view_id);
						// return res.view_id;
					} );
				},
				allowOutsideClick: () => !Swal.isLoading(),
			} ).then( ( result ) => {
				if ( result.isConfirmed ) {
					var res = JSON.parse( result.value );
					window.location = wpf_views_admin.admin_url + 'admin.php?page=wpf-views&view_id=' + res.view_id;
				}
			} );
		} );
	} );
} )( jQuery );
© 2025 XylotrechusZ