extranet/includes/client/client.php
2011-01-18 11:13:08 +00:00

508 lines
17 KiB
PHP

<?php
$idClient = (isset($_REQUEST['idclient'])) ? $_REQUEST['idclient'] : 0 ;
$titre = 'CREATION NOUVEAU CLIENT';
$submitValue = 'Créer le client';
if ($idClient!=0){
$ws = new WsScores();
$reponse = $ws->getListeClients($idClient);
$InfosClient = $reponse->result->item;
FB::log($InfosClient,'InfosClient');
$titre = 'EDITION CLIENT';
$submitValue = 'Modifier le client';
}
$reponse = $ws->getListeDroits();
$wsdroits = $reponse->item;
?>
<style type="text/css">
.close {display:none;}
.open {display:block;}
.fieldgrp{clear:both; width:100%; margin-bottom:.5em; overflow:hidden;}
.fieldgrp:after{content:"."; display:block; clear:both; visibility:hidden; line-height:0; height:0; }
.fieldgrp label{font-weight:bold; margin-left:30px; width:180px; clear:both; padding:0 10px 0 0;line-height:22px;_padding-top:3px; float:left; display:block; font-size:108%;}
.field {width:320px; float:left; padding:0 10px 0 0; line-height:22px; _padding-top:3px;}
.field .longfield{width:215px;}
.field .longfield-select{width:220px;}
.field .smallfield{width:95px;}
.field .medfield{width:110px;}
.field input, .field select{ font-size:110%; margin:2px 0; }
.field input[type="radio"] { margin:0 5px 0 5px; }
</style>
<script type="text/javascript">
var droits = new Array();
droits = {<?php
foreach($wsdroits as $droit){
echo '"'.$droit->code.'": "'.$droit->desc.'", ';
}
?>}
$(document).ready(function(){
$('.menu-close').click(function(){
$('div.blockh2').css('display','none');
$(this).next('div.blockh2').css('display','block');
});
$('a#addIp').click(function(e){
e.preventDefault();
var text = $('div.formip').html();
var title = $(this).html();
var dialogOpts = {
bgiframe: true,
title: title,
width: 250,
height: 120,
modal: true,
open: function(event, ui) { $(this).html(text); },
buttons: {
'Ajouter' : function() {
var select = $('#formip input[name=ip0]').val()+'.'+
$('#formip input[name=ip1]').val()+'.'+
$('#formip input[name=ip2]').val()+'.'+
$('#formip input[name=ip3]').val();
var txt = $('input[name=filtres_ip]').val();
console.log(txt);
(txt.length>0) ? txt = txt+';'+select : txt = select;
var concat = '';
var liste = txt.split(';');
for (item in liste){
concat = concat+liste[item]+' <a href="#" class="deleteIP" id="'+liste[item]+'">Supp</a><br/>';
}
console.log(txt);
$('input[name=filtres_ip]').val(txt);
$('#listeip').html(concat);
$(this).dialog('close');
},
'Fermer': function() { $(this).dialog('close'); }
},
close: function() { $('div#formip').remove(); }
};
$('<div id="formip"></div>').dialog(dialogOpts);
return false;
});
$('select[name=selectdroit]').change(function(){
console.log('Selection');
var select = $(this).val();
if (select!=''){
var txt = $('input[name=droits]').val();
(txt.length>0) ? txt = txt+' '+select : txt = select;
var concat = '';
var liste = txt.split(' ');
console.log('Affichage');
for (item in liste){
concat = concat+droits[liste[item]]+' <a href="#" class="deleteDroit" id="'+liste[item]+'">Supp</a><br/>';
}
$('input[name=droits]').val(txt);
$('#listedroits').html(concat);
}
});
$('a.deleteDroit').live('click', function(){
console.log('Suppression');
var select = $(this).attr('id');
var txt = '';
var concat = '';
var liste = $('input[name=droits]').val().split(' ');
console.log(liste);
for (item in liste){
if (liste[item]!=select){
(txt.length>0) ? txt = txt+' '+liste[item] : txt = liste[item];
concat = concat+droits[liste[item]]+' <a href="#" class="deleteDroit" id="'+liste[item]+'">Supp</a><br/>';
}
}
$('input[name=droits]').val(txt);
$('#listedroits').html(concat);
});
$('.deleteIP').live('click', function(){
var select = $(this).attr('id');
var txt = '';
var concat = '';
var liste = $('input[name=filtres_ip]').val().split(';');
for (item in liste){
if (liste[item]!=select){
(txt.length>0) ? txt = txt+';'+liste[item] : txt = liste[item];
concat = concat+liste[item]+' <a href="#" class="deleteIP" id="'+liste[item]+'">Supp</a><br/>';
}
}
$('input[name=filtres_ip]').val(txt);
$('#listeip').html(concat);
});
});
</script>
<div id="center">
<h1><?php echo $titre?></h1>
<?php
if (isset($_REQUEST['submit'])){
$Infos = $_REQUEST;
echo "<pre>";
print_r($Infos);
echo "</pre>";
/*
$ws = new WsScores();
$reponse = $ws->setClient($Infos);
echo "<pre>";
print_r($reponse);
echo "</pre>";
*/
} else {
?>
<div class="formip" style="display:none;">
<input type="text" maxlength="3" size="3" name="ip0" />&nbsp;.&nbsp;
<input type="text" maxlength="3" size="3" name="ip1" />&nbsp;.&nbsp;
<input type="text" maxlength="3" size="3" name="ip2" />&nbsp;.&nbsp;
<input type="text" maxlength="3" size="3" name="ip3" />
</div>
<form name="client" method="post" action="./?page=administration_client">
<input type="hidden" name="action" value="client" />
<input type="hidden" name="idClient" value="<?php echo $idClient?>" />
<h2 class="menu-close">Identification</h2>
<div class="blockh2 close">
<div class="fieldgrp">
<label>Nom</label>
<div class="field"><input name="nom" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->nom : '';?>" /></div>
</div>
<div class="fieldgrp">
<label>Siren</label>
<div class="field"><input name="siren" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->siren : '';?>" />
<a href="#">Obtention Raison sociale</a>
</div>
</div>
<div class="fieldgrp">
<label>Nic du siège</label>
<div class="field"><input name="nic" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->nic : '';?>" /></div>
</div>
<div class="fieldgrp">
<label>Racine des identifiants</label>
<div class="field">
<input name="racineLogin" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->racineLogin: '';?>" /></div>
</div>
<div class="fieldgrp">
<label>Test</label>
<div class="field">
<select name="test">
<option value="Oui" <?php if ($InfosClient->test=='Oui') echo 'selected';?>>Oui</option>
<option value="Non" <?php if ($InfosClient->test=='Non') echo 'selected';?>>Non</option>
</select>
</div>
</div>
<div class="fieldgrp">
<label>Actif</label>
<div class="field">
<select name="actif">
<option value="Oui" <?php if ($InfosClient->actif=='Oui') echo 'selected';?>>Oui</option>
<option value="Non" <?php if ($InfosClient->actif=='Non') echo 'selected';?>>Non</option>
</select>
</div>
</div>
<div class="fieldgrp">
<label>Date de signature</label>
<div class="field">
<input name="dateSignature" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->dateSignature : '';?>" /> (AAAA-MM-YY)
</div>
</div>
<div class="fieldgrp">
<label>Type de contrat</label>
<div class="field">
<select name="typeContrat">
<option value="Contrat" <?php if ($InfosClient->typeContrat=='Contrat') echo 'selected';?>>Contrat</option>
<option value="Marché" <?php if ($InfosClient->typeContrat=='Marché') echo 'selected';?>>Marché</option>
</select>
</div>
</div>
<div class="fieldgrp">
<label>Commercial S&amp;D</label>
<div class="field"><input name="respComSD" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->respComSD : '';?>" disabled/></div>
</div>
<div class="fieldgrp">
<label>Nom de l'apporteur d'affaire</label>
<div class="field"><input name="apporteurAffaire" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->apporteurAffaire: '';?>" /></div>
</div>
<div class="fieldgrp">
<label>Type d'accès</label>
<div class="field">
<select name="typeAcces">
<option value="userPassword" <?php if ($InfosClient->typeAcces=='userPassword') echo 'selected';?>>userPassword</option>
<option value="userPasswordIP" <?php if ($InfosClient->typeAcces=='userPasswordIP') echo 'selected';?>>userPasswordIP</option>
<option value="IP" <?php if ($InfosClient->typeAcces=='IP') echo 'selected';?>>IP</option>
</select>
</div>
</div>
<div class="fieldgrp">
<label>Remarques / Observations</label>
<div class="field"><textarea name="remarque"><?php echo isset($InfosClient) ? $InfosClient->remarque : '';?></textarea></div>
</div>
</div>
<h2 class="menu-close">Facturation</h2>
<div class="blockh2 close">
<div class="fieldgrp">
<label>N° de TVA</label>
<div class="field"><input name="tva" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->tva : '';?>" /></div>
</div>
<div class="fieldgrp">
<label>Compte client rattaché</label>
<div class="field"><input name="xxxx" type="text" value="" /></div>
</div>
<div class="fieldgrp">
<label>Editer la facture automatiquement</label>
<div class="field">
<select name="editerFacture">
<option value="Oui" <?php if ($InfosClient->editerFacture=='Oui') echo 'selected';?>>Oui</option>
<option value="Non" <?php if ($InfosClient->editerFacture=='Non') echo 'selected';?>>Non</option>
</select>
</div>
</div>
<div class="fieldgrp">
<label>Editer le détail de la facture</label>
<div class="field">
<select name="fact_detail">
<option value="Oui" <?php if ($InfosClient->editerFacture=='Oui') echo 'selected';?>>Oui</option>
<option value="Non" <?php if ($InfosClient->fact_detail=='Non') echo 'selected';?>>Non</option>
</select>
</div>
</div>
<div class="fieldgrp">
<label>Nom du destinataire de la facture</label>
<div class="field"><input name="fac_dest" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->fac_dest : '';?>" /></div>
</div>
<div class="fieldgrp">
<label>Adresse1</label>
<div class="field"><input name="fac_adr1" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->fac_adr1 : '';?>" /></div>
</div>
<div class="fieldgrp">
<label>Adresse2</label>
<div class="field"><input name="fac_adr2" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->fac_adr2 : '';?>" /></div>
</div>
<div class="fieldgrp">
<label>Adresse3</label>
<div class="field"><input name="fac_adr3" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->fac_adr3 : '';?>" /></div>
</div>
<div class="fieldgrp">
<label>Email</label>
<div class="field"><input name="fac_email" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->fac_email : '';?>" /></div>
</div>
<div class="fieldgrp">
<label>Téléphone</label>
<div class="field"><input name="fac_tel" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->fac_tel : '';?>" /></div>
</div>
<div class="fieldgrp">
<label>RIB joint à la facture</label>
<div class="field">
<select name="fact_rib">
<option value="BPOSTALE" <?php if ($InfosClient->fact_rib=='BPOSTALE') echo 'selected';?>>BPOSTALE</option>
<option value="CCOOP" <?php if ($InfosClient->fact_rib=='CCOOP') echo 'selected';?>>CCOOP</option>
<option value="CDNORD" <?php if ($InfosClient->fact_rib=='CDNORD') echo 'selected';?>>CDNORD</option>
</select>
</div>
</div>
</div>
<h2 class="menu-close">Livraison : Informations sur le destinatire de la livraison</h2>
<div class="blockh2 close">
<div class="fieldgrp">
<label>Nom</label>
<div class="field"><input name="liv_dest" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->liv_dest : '';?>" /></div>
</div>
<div class="fieldgrp">
<label>Adresse1</label>
<div class="field"><input name="liv_adr1" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->liv_adr1 : '';?>" /></div>
</div>
<div class="fieldgrp">
<label>Adresse2</label>
<div class="field"><input name="liv_adr2" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->liv_adr2 : '';?>" /></div>
</div>
<div class="fieldgrp">
<label>Adresse3</label>
<div class="field"><input name="liv_adr3" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->liv_adr3 : '';?>" /></div>
</div>
<div class="fieldgrp">
<label>Email</label>
<div class="field"><input name="liv_email" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->liv_email : '';?>" /></div>
</div>
<div class="fieldgrp">
<label>Téléphone</label>
<div class="field"><input name="liv_tel" type="text" value="<?php echo isset($InfosClient) ? $InfosClient->liv_tel : '';?>" /></div>
</div>
</div>
<h2 class="menu-close">Paramétrage</h2>
<div class="blockh2 close">
<div class="fieldgrp">
<label>IndiScore</label>
<div class="field">
<select name="typeScore">
<option value="100" <?php if ($InfosClient->typeScore=='100') echo 'selected';?>>100</option>
<option value="20" <?php if ($InfosClient->typeScore=='20') echo 'selected';?>>20</option>
</select>
</div>
</div>
<div class="fieldgrp">
<label>Liste des adresses IP</label>
<div class="field">
<?php
$text_ip = '';
$filtres_ip = '';
if (isset($InfosClient) && !empty($InfosClient->filtres_ip)){
$ips = explode(';',$InfosClient->filtres_ip);
foreach ($ips as $ip){
$filtres_ip.= $ip.';';
$text_ip.= $ip.'<a href="#" class="deleteIP" id="'.$ip.'">Supp</a><br/>';
}
}
?>
<input type="hidden" name="filtres_ip" value="<?php echo $filtres_ip?>">
<span id="listeip">
<?php
if (!empty($texte_ip)){
echo $text_ip;
} else {
echo "Aucune IPs.";
}
?>
</span>
<br/>
<a href="#" id="addIp">Ajouter une adresse IP</a>
</div>
</div>
<div class="fieldgrp">
<label>Listes des Droits</label>
<div class="field">
<?php
$text_droit = '';
$joindroit = '';
if (isset($InfosClient) && !empty($InfosClient->droits) ){
$listedroits = explode(' ', $InfosClient->droits);
foreach ($listedroits as $item){
foreach($wsdroits as $droit){
if (strtolower($item)==strtolower($droit->code)){
$joindroit.= ' '.$droit->code;
$text_droit.= $droit->desc.'<a href="#" class="deleteDroit" id="'.$droit->code.'" >Supp</a><br/>';
break;
}
}
}
}
?>
<input type="hidden" name="droits" value="<?php echo $joindroit?>" />
<span id="listedroits">
<?php
if (!empty($text_droit)){
echo $text_droit;
} else {
echo "Aucun droits.";
}
?>
</span><br/>
<select name="selectdroit">
<option value="">-</option>
<?php
foreach($wsdroits as $droit){
$value = $droit->code;
$text = $droit->desc;
?>
<option value="<?php echo $value?>"><?php echo $text?></option>
<?php }?>
</select>
</div>
</div>
<div class="fieldgrp">
<label>Timeout</label>
<div class="field">
<input type="text" name="timeout" value="<?php echo isset($InfosClient) ? $InfosClient->timeout : '1600';?>"/>
</div>
</div>
</div>
<h2 class="menu-close">Tarification</h2>
<div class="blockh2 close">
<div class="fieldgrp">
<label>forfaitExtranetPeriode</label>
<div class="field">
<select name="forfaitExtranetPeriode">
<option value="Mensuel" <?php if ($InfosClient->forfaitExtranetPeriode=='Mensuel') echo 'selected';?>>Mensuel</option>
<option value="Trimestriel" <?php if ($InfosClient->forfaitExtranetPeriode=='Trimestriel') echo 'selected';?>>Trimestriel</option>
<option value="Semestriel" <?php if ($InfosClient->forfaitExtranetPeriode=='Semestriel') echo 'selected';?>>Semestriel</option>
<option value="Annuel" <?php if ($InfosClient->forfaitExtranetPeriode=='Annuel') echo 'selected';?>>Annuel</option>
</select>
</div>
</div>
<div class="fieldgrp">
<label>forfaitExtranetMontant</label>
<div class="field"><input type="text" name="forfaitExtranetMontant" value="<?php echo isset($InfosClient) ? $InfosClient->forfaitExtranetMontant : '';?>"/></div>
</div>
<div class="fieldgrp">
<label>reconductionAuto</label>
<div class="field">
<select name="reconductionAuto">
<option value="Oui" <?php if ($InfosClient->reconductionAuto=='Oui') echo 'selected';?>>Oui</option>
<option value="Non" <?php if ($InfosClient->reconductionAuto=='Non') echo 'selected';?>>Non</option>
</select>
</div>
</div>
<div class="fieldgrp">
<label>Nombre de pièces officielles inclues dans le forfait client</label>
<div class="field"><input type="text" name="forfaitPiecesNb" value="<?php echo isset($InfosClient) ? $InfosClient->forfaitPiecesNb : '';?>"/></div>
</div>
<div class="fieldgrp">
<label>Montant du forfait des pièces officielles</label>
<div class="field"><input type="text" name="forfaitPiecesMt" value="<?php echo isset($InfosClient) ? $InfosClient->forfaitPiecesMt : '';?>"/></div>
</div>
<div class="fieldgrp">
<label>Tarif unitaire en cas de dépassement</label>
<div class="field"><input type="text" name="forfaitPiecesDep" value="<?php echo isset($InfosClient) ? $InfosClient->forfaitPiecesDep : '';?>"/></div>
</div>
<div class="fieldgrp">
<label>Nombre d'investigations inclues dans le forfait client</label>
<div class="field"><input type="text" name="forfaitInvestigNb" value="<?php echo isset($InfosClient) ? $InfosClient->forfaitInvestigNb : '';?>"/></div>
</div>
<div class="fieldgrp">
<label>Montant du forfait des investigations</label>
<div class="field"><input type="text" name="forfaitInvestigMt" value="<?php echo isset($InfosClient) ? $InfosClient->forfaitInvestigMt : '';?>"/></div>
</div>
<div class="fieldgrp">
<label>Tarif unitaire pour les indiscore</label>
<div class="field"><input type="text" name="tarifIndiscore" value="<?php echo isset($InfosClient) ? $InfosClient->tarifIndiscore : '';?>"/></div>
</div>
</div>
<h2 class="menu-close">Divers</h2>
<div class="blockh2 close">
<div class="fieldgrp">
<label>Accès Webservice</label>
<div class="field"><input type="text" name="accesWS" value="<?php echo isset($InfosClient) ? $InfosClient->accesWS : '';?>"/></div>
</div>
<div class="fieldgrp">
<label>Intersud - Login</label>
<div class="field"><input type="text" name="InterSudLogin" value="<?php echo isset($InfosClient) ? $InfosClient->InterSudLogin : '';?>"/></div>
</div>
<div class="fieldgrp">
<label>Intersud - Mot de passe</label>
<div class="field"><input type="text" name="InterSudPass" value="<?php echo isset($InfosClient) ? $InfosClient->InterSudPass : '';?>"/></div>
</div>
</div>
<div class="submit">
<input class="button" type="submit" name="submit" value="<?php echo $submitValue?>" />
</div>
</form>
<?php
}
?>
</div>