jQuery( function( $ ) {
	var wp = window.wp;
	/**
	 * Variations Price Matrix actions
	 */
	var nbt_solutions_admin = {

		/**
		 * Initialize variations actions
		 */
		init: function() {
			this.call();

			$(document).on('submit', '#frm-solution-settings', this.save_settings)
		},

		call: function() {
			if( jQuery().wpColorPicker ) {
				$('.nbt-colorpicker' ).wpColorPicker();
			}
		},

		save_settings: function(event) {
			event.preventDefault();
			
			$.ajax({
				url: nbt_solutions.save_settings,
				data: $(this).serialize(),
				type: 'POST',
				datatype: 'json',
				success: function( response ) {
					alert(response.message);
				},
				error:function(){
					alert('There was an error when processing data, please try again !');
				}
			});

		}
	}
	
	nbt_solutions_admin.init();

});