<?php
// This script and data application were generated by AppGini 5.81
// Download AppGini for free from https://bigprof.com/appgini/download/

	$currDir = dirname(__FILE__);
	include("$currDir/defaultLang.php");
	include("$currDir/language.php");
	include("$currDir/lib.php");

	handle_maintenance();

	header('Content-type: text/javascript; charset=' . datalist_db_encoding);

	$table_perms = getTablePermissions('pointages');
	if(!$table_perms[0]) { die('// Access denied!'); }

	$mfk = $_GET['mfk'];
	$id = makeSafe($_GET['id']);
	$rnd1 = intval($_GET['rnd1']); if(!$rnd1) $rnd1 = '';

	if(!$mfk) {
		die('// No js code available!');
	}

	switch($mfk) {

		case 'nom_prenom':
			if(!$id) {
				?>
				$j('#agence<?php echo $rnd1; ?>').html('&nbsp;');
				$j('#fonction<?php echo $rnd1; ?>').html('&nbsp;');
				<?php
				break;
			}
			$res = sql("SELECT `personnels`.`idpersonnel` as 'idpersonnel', `personnels`.`matricule` as 'matricule', if(`personnels`.`date_recrutement`,date_format(`personnels`.`date_recrutement`,'%d/%m/%Y'),'') as 'date_recrutement', `personnels`.`nom` as 'nom', `personnels`.`prenom` as 'prenom', IF(    CHAR_LENGTH(`pays1`.`pays`), CONCAT_WS('',   `pays1`.`pays`), '') as 'nationalite', `personnels`.`cin` as 'cin', `personnels`.`adresse` as 'adresse', `personnels`.`telephone` as 'telephone', `personnels`.`whatsapp` as 'whatsapp', `personnels`.`email` as 'email', IF(    CHAR_LENGTH(`agences1`.`agence`), CONCAT_WS('',   `agences1`.`agence`), '') as 'agence', IF(    CHAR_LENGTH(`fonctions1`.`fonction`), CONCAT_WS('',   `fonctions1`.`fonction`), '') as 'fonction', IF(    CHAR_LENGTH(`produits_services1`.`produit_service`), CONCAT_WS('',   `produits_services1`.`produit_service`), '') as 'service', IF(    CHAR_LENGTH(`postes1`.`poste`), CONCAT_WS('',   `postes1`.`poste`), '') as 'poste', `personnels`.`photo` as 'photo', `personnels`.`cv` as 'cv', `personnels`.`dossier` as 'dossier', `personnels`.`observations` as 'observations', `personnels`.`groupe` as 'groupe', `personnels`.`agent` as 'agent' FROM `personnels` LEFT JOIN `pays` as pays1 ON `pays1`.`idpays`=`personnels`.`nationalite` LEFT JOIN `agences` as agences1 ON `agences1`.`idagence`=`personnels`.`agence` LEFT JOIN `fonctions` as fonctions1 ON `fonctions1`.`idfonction`=`personnels`.`fonction` LEFT JOIN `produits_services` as produits_services1 ON `produits_services1`.`idps`=`personnels`.`service` LEFT JOIN `postes` as postes1 ON `postes1`.`idposte`=`personnels`.`poste`  WHERE `personnels`.`idpersonnel`='{$id}' limit 1", $eo);
			$row = db_fetch_assoc($res);
			?>
			$j('#agence<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['agence']))); ?>&nbsp;');
			$j('#fonction<?php echo $rnd1; ?>').html('<?php echo addslashes(str_replace(array("\r", "\n"), '', nl2br($row['fonction']))); ?>&nbsp;');
			<?php
			break;


	}

?>