

<?php
	include_once(__DIR__."/../../core.php");
	include($docroot."/config.inc.php");
	
	
	$module_name = 'Prospect';
	$iddocumento = $html->form('idrecord');

	$filtra_art = $html->form('filtra_art');
	
	
	
	$idriga = $html->form('idriga');


	
	$query = "SELECT * FROM `mg_articoli_prospect` WHERE id='".$idriga."'";
	$rsr = $dbo->fetchArray( $query );
	

		
	$query = "SELECT * FROM mg_articoli WHERE attivo=1 ORDER BY id_categoria ASC, id_sottocategoria ASC";
	$rs = $dbo->fetchArray( $query );
	$n = sizeof($rs);
	
	echo "<label>Inserimento interesse Prospect</label><br><br>\n";
	echo "<form id=\"link_form\" action=\"".$rootdir."/editor.php?id_module=".$modules_info[$module_name]['id']."&id_record=".$iddocumento."\" method=\"post\">\n";
	echo "	<input type='hidden' name='op' value='add_interesse'>\n";
	echo "	<input type='hidden' name='dir' value='".$dir."'>\n";
	echo "	<input type='hidden' name='iddocumento' value='".$iddocumento."'>\n";
	echo "	<input type='hidden' name='backto' value='record-edit'>\n";
	
	
	echo "<script type=\"text/javascript\" charset=\"utf-8\" src=\"".$rootdir."/lib/ckeditor/ckeditor.js\"></script>\n";
	
	//Descrizione
	echo "	<div class='row'>\n";
	echo "		<div class='col-md-12'>\n";
	echo "			<label>Descrizione</label>\n";
	echo "			<textarea placeholder=\"\" rows='30' name='descrizione'  id='descrizione_art'  class='form-control'>".$rsr[0]['descrizione']."</textarea>\n";
	echo "		</div>\n";
	echo "	</div>\n";
	

	echo "<br>";

		
	echo "	<a onclick=\"aggiorna();\" class=\"btn btn-primary pull-right\"><i class=\"fa fa-plus\"></i> Aggiorna</a>\n";
	echo "</form>\n";
	
	
	echo "	<form action='".$rootdir."/editor.php?id_module=".$modules_info[$module_name]['id']."&id_record=".$iddocumento."' method='post' id='delete-form-".$iddocumento."' role='form'>\n";
		echo "		<input type='hidden' name='backto' value='record-edit'>\n";
		echo "		<input type='hidden' name='idriga' value='".$idriga."'>\n";
		echo "		<input type='hidden' name='op' value='unlink_articolo'>\n";
		echo "		<div class='input-group-btn'>\n";			
		echo "			<a class='btn btn-danger pull-left' title='Rimuovi interesse...' onclick=\"if( confirm('Rimuovere questo interesse?') ){ $('#delete-form-".$iddocumento."').submit(); }\"><i class='fa fa-trash-o'></i> Elimina</a>\n";
		echo "		</div>\n";
	echo "	</form>\n";
	
	
	
	
?>
	
	
	<script type="text/javascript">
	
		dir = '<?php echo $dir ?>';
		
		$('#idcategoria').change( function(){ 						
			$.get('<?php echo $rootdir ?>/ajax_autocomplete.php?module=FiltroCat&idcategoria='+this.value+'&idmodulo='+id_module , function(data,response){ 				
				start_jquerychosen();
				start_inputmask();		
			});	
		});			
		
		function aggiorna(){
			$("#link_form").submit();
		}
		

		
		$(document).ready( function(){
			
			CKEDITOR.replace( 'descrizione_art', {
			toolbar: [
				{ name: 'document', items: [ 'NewPage', 'Preview', '-', 'Templates' ] },	
				['Bold','Italic','Underline','Superscript','-','NumberedList','BulletedList','Outdent','Indent','Blockquote','-','Format',], 	// Defines toolbar group without name.
				
			]
		});
			
			
		});
			

	</script>
	<script src="<?php echo $rootdir; ?>/lib/init.js"></script>

	
	<div class="clearfix"></div>


