1040 lines
17 KiB
PHP
1040 lines
17 KiB
PHP
<?php
|
|
|
|
|
|
|
|
use Glpi\Event;
|
|
|
|
|
|
|
|
use function Sabre\Uri\split;
|
|
|
|
|
|
|
|
include ('../model_controller/articles.list.immo.php');
|
|
|
|
|
|
|
|
Session::checkLoginUser();
|
|
|
|
if (Session::getCurrentInterface() == "helpdesk") {
|
|
|
|
Html::helpHeader("DRH", '', $_SESSION["glpiname"]);
|
|
|
|
} else {
|
|
|
|
Html::header("DRH", '', "", "");
|
|
|
|
}
|
|
|
|
if(isset($_POST['valid'])) {
|
|
|
|
$site = "";
|
|
|
|
$zone = "";
|
|
|
|
$lib = "";
|
|
|
|
$fam = "";
|
|
|
|
$sfam = "";
|
|
|
|
$famcode = "";
|
|
|
|
$sfamcode = "";
|
|
|
|
$state = "";
|
|
|
|
$responsable = "";
|
|
|
|
$imgpath = "";
|
|
|
|
$unite = "";
|
|
|
|
$codeart = "";
|
|
|
|
$observ = "";
|
|
|
|
$serial = "";
|
|
|
|
$hasinvchecked = isset($_POST['comptage1']) && $_POST['comptage1']!=0;
|
|
|
|
if(isset($_POST['siteadd']))
|
|
|
|
$site = $_POST['siteadd'];
|
|
|
|
if(isset($_POST['zoneadd']))
|
|
|
|
$zone = $_POST['zoneadd'];
|
|
|
|
if(isset($_POST['larticleadd']))
|
|
|
|
$lib = $_POST['larticleadd'];
|
|
|
|
if(isset($_POST['famadd'])){
|
|
|
|
$temp = explode("-", $_POST['famadd']);
|
|
|
|
$fam = $temp[0];
|
|
|
|
$famcode = $temp[1];
|
|
|
|
}
|
|
|
|
if(isset($_POST['sfamadd'])){
|
|
|
|
$temp = explode("-", $_POST['sfamadd']);
|
|
|
|
$sfam = $temp[0];
|
|
|
|
$sfamcode = $temp[1];
|
|
|
|
}
|
|
|
|
if(isset($_POST['stateadd']))
|
|
|
|
$state = $_POST['stateadd'];
|
|
|
|
|
|
|
|
if(isset($_POST['responsableadd']))
|
|
|
|
$responsable = $_POST['responsableadd'];
|
|
|
|
if(isset($_POST['unitadd']))
|
|
|
|
$unite = $_POST['unitadd'];
|
|
|
|
if(isset($_POST['obsadd']))
|
|
|
|
$observ = $_POST['obsadd'];
|
|
|
|
if(isset($_POST['serialnum']))
|
|
|
|
$serial = $_POST['serialnum'];
|
|
|
|
|
|
|
|
|
|
|
|
$codeart =$famcode."_".$sfamcode."_";
|
|
|
|
|
|
|
|
$temp = getCount($codeart);
|
|
|
|
$temp = intval($temp['c'])+1;
|
|
|
|
$codeart = $codeart.sprintf("%06d", $temp);
|
|
|
|
|
|
|
|
if(isset($_POST['imgpath']) && $_POST['imgpath']!=""){
|
|
|
|
list($type, $data) = explode(';', $_POST['imgpath']);
|
|
|
|
list(, $data) = explode(',', $data);
|
|
|
|
list(, $type) = explode('/', $type);
|
|
|
|
$data = base64_decode($data);
|
|
|
|
$filepath = '../pics/articles/'.$codeart.".".$type;
|
|
|
|
file_put_contents($filepath, $data);
|
|
|
|
$imgpath = $filepath;
|
|
|
|
}
|
|
|
|
|
|
|
|
$res = saveProduct($site,$codeart,$famcode,$sfamcode,$state,$zone,$lib,$responsable,$unite,$imgpath,$observ,$serial);
|
|
|
|
|
|
if($hasinvchecked){
|
|
|
|
$currentdate = date('Y-m-d h:i:s', time());
|
|
|
|
|
|
|
|
$qtcompt1 = '';
|
|
|
|
$qtcompt2 = '';
|
|
|
|
$qtcontrole = '';
|
|
|
|
$usercomp1 = '';
|
|
|
|
$datecomp1 = '';
|
|
|
|
$usercomp2 = '';
|
|
|
|
$datecomp2 = '';
|
|
|
|
$usercontrole = '';
|
|
|
|
$datecontrole = '';
|
|
|
|
if(isset($_POST['comptage1'])) {
|
|
|
|
$qtcompt1 = $_POST['comptage1'];
|
|
|
|
$usercomp1 = $_POST['usercmp1'];
|
|
|
|
$datecomp1 = $currentdate;
|
|
|
|
}
|
|
|
|
if(isset($_POST['comptage2'])) {
|
|
|
|
$qtcompt2 = $_POST['comptage2'];
|
|
|
|
$usercomp2 = $_POST['usercmp2'];
|
|
|
|
$datecomp2 = $currentdate;
|
|
|
|
}
|
|
|
|
|
|
|
|
saveInventaire($site, $codeart, $serial, $zone, '0', $qtcompt1, '', $qtcontrole, $usercomp1, $datecomp1, '', '', $usercontrole, $datecontrole);
|
|
|
|
saveInventaire($site, $codeart, $serial, $zone, '0', '', $qtcompt2, $qtcontrole, '', '', $usercomp2, $datecomp2, $usercontrole, $datecontrole);
|
|
|
|
}
|
|
|
|
echo "
|
|
|
|
<script type=\"text/javascript\">
|
|
|
|
alert(\"Article ".$lib." Créer Avec Succès\");
|
|
|
|
</script>
|
|
|
|
";
|
|
|
|
Html::redirect("article.add.php");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$sitesMap = getDepotsMap();
|
|
|
|
$unite = getWUnit();
|
|
|
|
$sites = getDepots();
|
|
|
|
$fam = getAllFamilles();
|
|
|
|
$fams = getSFamille();
|
|
|
|
$zones = getZONES();
|
|
|
|
$state = ['Ancien','Moyen','neuf','Réformée'];
|
|
|
|
|
|
|
|
echo"<div id='divPopup' tabindex='-10'></div><br>";
|
|
|
|
|
|
|
|
echo'
|
|
|
|
<form method="post" id="formulaire" name="formulaire">
|
|
|
|
<input type="hidden" id="_glpi_csrf_token" name="_glpi_csrf_token" value="'.Session::getNewCSRFToken().'">
|
|
|
|
|
|
|
|
<div>';
|
|
|
|
echo '
|
|
|
|
<label><b>Site </b></label>
|
|
|
|
<select id="siteadd" name="siteadd" required>';
|
|
|
|
echo '<option value="" selected>SELECTIONE SITE</option>';
|
|
|
|
foreach($sites as $row) {
|
|
|
|
echo '<option value="'.$row['DEP_CODE'].'">'.$row['DEP_NOM'].'</option>';
|
|
|
|
}
|
|
|
|
echo "</select><span style='color:#ff0000'>*</span>";
|
|
|
|
echo "</div><br>
|
|
|
|
<div>";
|
|
|
|
echo '
|
|
|
|
<label><b>Zone </b></label>
|
|
|
|
<select id="zoneadd" name="zoneadd" required>';
|
|
|
|
echo '<option value="" selected>SELECTIONE ZONE</option>';
|
|
|
|
foreach($zones as $row) {
|
|
|
|
echo '<option value="'.$row['ZONE'].'">'.$row['ZONE'].'</option>';
|
|
|
|
}
|
|
|
|
echo "</select><span style='color:#ff0000'>*</span>";
|
|
|
|
echo "</div><br>
|
|
|
|
<div> <label><b>Libelle Article </b></label><input class='center' type='text' name='larticleadd' placeholder='Libelle Article' id='larticleadd' autocomplete='' required><span style='color:#ff0000'>*</span></div><br>
|
|
|
|
<div>";
|
|
|
|
echo '
|
|
|
|
<label><b>Famille </b></label>
|
|
|
|
<select id="famadd" name="famadd" onchange="famchanged(this)" required>';
|
|
|
|
echo '<option value="" selected>SELECTIONE FAMILLE</option>';
|
|
|
|
foreach($fam as $row) {
|
|
|
|
echo '<option value="'.$row['FAR_LIB']."-".$row['FAR_CODE'].'">'.$row['FAR_LIB'].'</option>';
|
|
|
|
}
|
|
|
|
echo "</select><span style='color:#ff0000'>*</span>";
|
|
|
|
echo ' <a name="famplus" onclick="showPopUp(this)"><img src="../pics/plus.png" alt="Ajouter" title="Ajouter"></a>';
|
|
|
|
echo "</div><br>
|
|
|
|
<div>";
|
|
|
|
echo '
|
|
|
|
<label><b>Sous Famille </b></label>
|
|
|
|
<select id="sfamadd" name="sfamadd" required>';
|
|
|
|
echo '<option value="" selected>SELECTIONE SOUS FAMILLE</option>';
|
|
|
|
foreach($fams as $row) {
|
|
|
|
echo '<option value="'.$row['SFA_LIB']."-".$row['SFA_CODE'].'">'.$row['SFA_LIB'].'</option>';
|
|
|
|
}
|
|
|
|
echo "</select><span style='color:#ff0000'>*</span>";
|
|
|
|
|
|
|
|
echo ' <a name="sfamplus" onclick="showPopUp(this)"><img src="../pics/plus.png" alt="Ajouter" title="Ajouter"></a></div><br>';
|
|
|
|
|
|
|
|
echo '
|
|
|
|
<div>
|
|
|
|
<label><b>Etat </b></label>
|
|
|
|
<select id="stateadd" name="stateadd">';
|
|
|
|
echo '<option value="" selected>SELECTIONE ETAT</option>';
|
|
|
|
foreach($state as $st) {
|
|
|
|
echo '<option value="'.$st.'">'.$st.'</option>';
|
|
|
|
}
|
|
|
|
echo "</select>";
|
|
|
|
echo "</div><br>
|
|
|
|
|
|
|
|
<div> <label><b>Responsabilité </b></label><input class='center' type='text' name='responsableadd' placeholder='Responsabilité' id='responsableadd'></div><br>
|
|
|
|
<div>";
|
|
|
|
echo '
|
|
|
|
<label><b>Unité de mesure </b></label>
|
|
|
|
<select id="unitadd" name="unitadd">';
|
|
|
|
echo '<option value="" selected>SELECTIONE UNITE</option>';
|
|
|
|
foreach($unite as $row) {
|
|
|
|
echo '<option value="'.$row['UN'].'">'.$row['UN'].'</option>';
|
|
|
|
}
|
|
|
|
echo "</select>";
|
|
|
|
echo "</div><br>
|
|
|
|
<div> <label><b>Numéro de série </b></label><input class='center' type='text' name='serialnum' placeholder='N° série' id='serialnum'></div>
|
|
|
|
<div>";
|
|
|
|
echo "</div><br>
|
|
|
|
<div> <label><b>Observation </b></label><input class='center' type='text' name='obsadd' placeholder='Observation' id='obsadd'></div><br>
|
|
|
|
<div>";
|
|
|
|
echo '</div><br>';
|
|
|
|
echo "
|
|
|
|
<div><input class='center' type='checkbox' name='inventorier' value='Inventorier' id='inventorier' onchange='inventoriertoggle(this)'><label><b> Inventorier</b></label></div><br>";
|
|
|
|
echo "<div id='invQty'></div><br>";
|
|
|
|
echo"
|
|
|
|
</form>";
|
|
|
|
echo '<div>
|
|
|
|
<label><b>Image </b></label><a class="vsubmit" onclick="return showCamera()" id="addphoto">Ajouter Image</a>
|
|
|
|
</div><br>';
|
|
|
|
echo "<div id='divImage' tabindex='-1'></div><br>";
|
|
|
|
|
|
|
|
echo '<div><a name="valider" onclick="addArticle()" id="valider" class="vsubmit">Envoyer</a></div><br>';
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.modal {
|
|
|
|
display: none;
|
|
|
|
position: fixed;
|
|
|
|
padding-top: 50px;
|
|
|
|
left: 0;
|
|
|
|
top: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
background-color: rgb(0, 0, 0);
|
|
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
|
|
}.modal-content {
|
|
|
|
position: relative;
|
|
|
|
background-color: white;
|
|
|
|
padding: 20px;
|
|
|
|
margin: auto;
|
|
|
|
margin-top: 10%;
|
|
|
|
width: 50%;
|
|
|
|
box-shadow: 5px 10px;
|
|
|
|
border-radius: 10px;
|
|
|
|
-webkit-animation-name: animatetop;
|
|
|
|
-webkit-animation-duration: 0.4s;
|
|
|
|
animation-name: animatetop;
|
|
|
|
animation-duration: 0.4s
|
|
|
|
}.close-btn {
|
|
|
|
float: left;
|
|
|
|
color: lightgray;
|
|
|
|
font-size: 24px;
|
|
|
|
font-weight: bold;
|
|
|
|
}.close-btn:hover {
|
|
|
|
color: darkgray;
|
|
|
|
cursor: pointer;
|
|
|
|
}@-webkit-keyframes animatetop {
|
|
|
|
from {top:-300px; opacity:0}
|
|
|
|
to {top:0; opacity:1}
|
|
|
|
}@keyframes animatetop {
|
|
|
|
from {top:-300px; opacity:0}
|
|
|
|
to {top:0; opacity:1}
|
|
|
|
}
|
|
|
|
.center {
|
|
|
|
margin-left: auto;
|
|
|
|
margin-right: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.animated-div {
|
|
|
|
position: relative;
|
|
|
|
background-color: white;
|
|
|
|
padding: 20px;
|
|
|
|
margin: auto;
|
|
|
|
width: 320px;
|
|
|
|
-webkit-animation-name: animateleft;
|
|
|
|
-webkit-animation-duration: 0.4s;
|
|
|
|
animation-name: animateleft;
|
|
|
|
animation-duration: 0.4s
|
|
|
|
}@-webkit-keyframes animateleft {
|
|
|
|
from {left:-300px; opacity:0}
|
|
|
|
to {left:0; opacity:1}
|
|
|
|
}@keyframes animateleft {
|
|
|
|
from {left:-300px; opacity:0}
|
|
|
|
to {left:0; opacity:1}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
let image_data_url = "";
|
|
|
|
let token = getToken();
|
|
|
|
let qtyVisible = false;
|
|
|
|
let zones = <?php echo json_encode($zones); ?>;
|
|
|
|
let fams = <?php echo json_encode($fams); ?>;
|
|
|
|
|
|
|
|
function showPopUp(e){
|
|
|
|
let holder = '<div class="modal" id="contentHolder" tabindex="-1">'+
|
|
|
|
'<div class="modal-content" style="overflow-x:auto;">';
|
|
|
|
|
|
|
|
holder = holder + buildContent($(e).attr('name'))
|
|
|
|
$('#divPopup').empty();
|
|
|
|
$('#divPopup').append(holder+'</div></div>');
|
|
|
|
document.querySelector(".modal").style.display = "block";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function postData(e){
|
|
|
|
var artname = $(e).attr('name').substring(1);
|
|
|
|
var valeur = document.forms['plusform'].elements[artname].value;
|
|
|
|
var header = (artname == "famplus") ? "Famille" : "Sous Famille";
|
|
|
|
$.ajax({
|
|
|
|
url: 'article.existance.php',
|
|
|
|
type: 'GET',
|
|
|
|
data: {type: artname, art: valeur},
|
|
|
|
dataType: 'json',
|
|
|
|
success: function(data){
|
|
|
|
if(data['created'] !== undefined && data['created']){
|
|
|
|
if(!alert(valeur + " Crée avec success")){
|
|
|
|
window.location.reload();
|
|
|
|
closePopup();
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if(data['exists'])
|
|
|
|
alert(header +" " +valeur + " déjà existe");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function showCamera(){
|
|
|
|
let holder = '<div id="holder">'+
|
|
|
|
'<div class="animated-div" style="overflow-x:auto;">';
|
|
|
|
|
|
|
|
holder = holder + buildCamera()
|
|
|
|
$('#divImage').empty();
|
|
|
|
$('#divImage').append(holder+'</div></div>');
|
|
|
|
document.querySelector("#holder").style.display = "block";
|
|
|
|
startCamera()
|
|
|
|
}
|
|
|
|
|
|
|
|
function buildCamera(){
|
|
|
|
|
|
|
|
return '<table border="0" class="center">'+
|
|
|
|
'<div><tr id="vidholder">'+
|
|
|
|
'<td><video id="video" width="380" height="280" autoplay></video></td>'+
|
|
|
|
'</tr>'+
|
|
|
|
'<tr><td><canvas id="canvas" width="380" height="280"></canvas></td></tr>'+
|
|
|
|
'</div>'+
|
|
|
|
'<div><tr>'+
|
|
|
|
'<td><button id="click-photo">Prendre Photo</button></td>'+
|
|
|
|
'</tr>'+
|
|
|
|
'<tr><td><button id="save-photo">Sauvgarder</button></td></tr>'+
|
|
|
|
'</div>'+
|
|
|
|
'</table>'
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function getToken(){
|
|
|
|
return "<?php echo Session::getNewCSRFToken();?>";
|
|
|
|
}
|
|
|
|
|
|
|
|
async function startCamera(imgname) {
|
|
|
|
|
|
|
|
let click_button = document.querySelector("#click-photo");
|
|
|
|
let save_button = document.querySelector("#save-photo");
|
|
|
|
let videoholder = document.querySelector("#vidholder");
|
|
|
|
let stream = await navigator.mediaDevices.getUserMedia({ video: {facingMode: 'environment'}, audio: false });
|
|
|
|
|
|
|
|
document.querySelector("#video").srcObject = stream;
|
|
|
|
|
|
|
|
click_button.addEventListener('click', function() {
|
|
|
|
document.querySelector("#canvas").getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
|
|
image_data_url = canvas.toDataURL();
|
|
|
|
});
|
|
|
|
|
|
|
|
save_button.addEventListener('click', function() {
|
|
|
|
stream.getTracks().forEach(function(track) {
|
|
|
|
track.stop();
|
|
|
|
});
|
|
|
|
videoholder.style.display = "none";
|
|
|
|
click_button.style.display = "none";
|
|
|
|
save_button.style.display = "none";
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function buildContent(name){
|
|
|
|
let adding = "";
|
|
|
|
if (name == "famplus")
|
|
|
|
adding = "Famille"
|
|
|
|
else
|
|
|
|
adding = "Sous Famille"
|
|
|
|
return '<span class="close-btn" onclick="closePopup();">×</span>'+
|
|
|
|
'<div class="center">'+
|
|
|
|
'<form method="post" id="plusform" name="plusform"> '+
|
|
|
|
"<div><br><label><b>Créer "+adding+"</b></label><br><input class='center' type='text' name='"+name+"' placeholder='Nom "+adding+"' id='"+name+"' required></div><br>"+
|
|
|
|
'<input type="hidden" id="_glpi_csrf_token" name="_glpi_csrf_token" value="'+token+'"></form>'+
|
|
|
|
'<div><a name="b'+name+'" onclick="postData(this)" id="plus" class="vsubmit">Ajouter</a></div><br>'+
|
|
|
|
'</div>'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function closePopup(){
|
|
|
|
document.querySelector(".modal").style.display = "none";
|
|
|
|
}
|
|
|
|
|
|
|
|
function addArticle(){
|
|
|
|
var fam = $("#famadd").val();
|
|
|
|
var sfam = $("#sfamadd").val();
|
|
|
|
var lib = $("#larticleadd").val();
|
|
|
|
if(fam == "" || sfam == "" || lib == "")
|
|
|
|
alert("veuillez renseigner le libellé article la famille et la sous famille");
|
|
|
|
else{
|
|
|
|
$('#formulaire').submit(function(eventObj) {
|
|
$(this).append('<input type="hidden" name="valid" value="valid"/>');
|
|
return true;
|
|
|
|
});
|
|
|
|
$('#formulaire').submit();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*var fam = $("#famadd").val();
|
|
|
|
var sfam = $("#sfamadd").val();
|
|
|
|
var lib = $("#larticleadd").val();
|
|
|
|
var serial = $("#serialnum").val();
|
|
|
|
|
|
|
|
var user1 = $("#usercmp1").val();
|
|
|
|
var user2 = $("#usercmp2").val();
|
|
|
|
|
|
|
|
if(fam == "" || sfam == "" || lib == "")
|
|
|
|
alert("veuillez renseigner le libellé article la famille et la sous famille");
|
|
|
|
else{
|
|
|
|
if($("#inventorier").prop('checked', true)){
|
|
|
|
if(valideCharset(lib) && valideCharset(serial) && valideCharset(user1) && valideCharset(user2)){
|
|
|
|
if((qtyVisible && $("#comptage1").val() == 0) || qtyVisible && $("#comptage2").val() == 0 || qtyVisible && $("#usercmp1").val() == "" || qtyVisible && $("#usercmp2").val() == ""){
|
|
|
|
alert("veuillez renseigner les quantités et les responsables comptages ou découcher Inventorier");
|
|
|
|
}else{
|
|
|
|
$('#formulaire').submit(function(eventObj) {
|
|
|
|
$(this).append('<input type="hidden" name="valid" value="valid"/>'+'<input type="hidden" name="imgpath" value="'+image_data_url+'" /> ');
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
$('#formulaire').submit();
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if(valideCharset(lib) && valideCharset(serial)){
|
|
|
|
if((qtyVisible && $("#comptage1").val() == 0) || qtyVisible && $("#comptage2").val() == 0){
|
|
|
|
alert("veuillez renseigner les quantités et les responsables comptages ou découcher Inventorier");
|
|
|
|
}else{
|
|
|
|
$('#formulaire').submit(function(eventObj) {
|
|
|
|
$(this).append('<input type="hidden" name="valid" value="valid"/>'+'<input type="hidden" name="imgpath" value="'+image_data_url+'" /> ');
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
$('#formulaire').submit();
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
}
|
|
|
|
|
|
|
|
function inventoriertoggle(e){
|
|
|
|
if(e.checked){
|
|
|
|
$('#invQty').html(
|
|
|
|
"<div><label><b>Comptage 1 </b></label><input type='number' id='comptage1' name='comptage1' value='comptage1' required><span style='color:#ff0000'>*</span></div><br><br>"+
|
|
|
|
"<div><label><b>Comptage 2 </b></label><input type='number' id='comptage2' name='comptage2' value='comptage2' required><span style='color:#ff0000'>*</span></div><br><br>"+
|
|
|
|
"<div><label><b>Responsable comptage 1 </b></label><input type='text' id='usercmp1' name='usercmp1' required><span style='color:#ff0000'>*</span></div><br><br>"+
|
|
|
|
"<div><label><b>Responsable comptage 2 </b></label><input type='text' id='usercmp2' name='usercmp2' required><span style='color:#ff0000'>*</span></div><br><br>"
|
|
|
|
)
|
|
|
|
qtyVisible = true;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
$('#invQty').html(
|
|
|
|
""
|
|
|
|
)
|
|
|
|
qtyVisible = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function sitechanged(e){
|
|
|
|
var res = zones.filter(a => a.DEP_CODE.toUpperCase().includes(e.value.toUpperCase()));
|
|
|
|
let addhtml = "";
|
|
|
|
for(zone in res){
|
|
|
|
addhtml += '<option value="'+res[zone].ZONE+'">'+res[zone].ZONE+'</option>';
|
|
|
|
}
|
|
|
|
zonesHolder = $('#zoneadd').html(
|
|
|
|
'<option value="" selected>SELECTIONE ZONE</option>'+addhtml
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function famchanged(e){
|
|
|
|
let res = [];
|
|
|
|
if(e.value.split("-")[0].toUpperCase().includes("MOYENS"))
|
|
|
|
res = fams.filter(a => a.SFA_LIB.toUpperCase().includes("MGX") || a.SFA_LIB.toUpperCase().includes("DIVERS"));
|
|
|
|
else
|
|
|
|
res = fams.filter(a => !a.SFA_LIB.toUpperCase().includes("MGX"))
|
|
|
|
|
|
|
|
let addhtml = "";
|
|
|
|
for(fam in res){
|
|
|
|
addhtml += '<option value="'+res[fam].SFA_LIB+"-"+res[fam].SFA_CODE+'">'+res[fam].SFA_LIB+'</option>';
|
|
|
|
}
|
|
|
|
zonesHolder = $('#sfamadd').html(
|
|
|
|
'<option value="" selected>SELECTIONE SOUS FAMILLE</option>'+addhtml
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function valideCharset(string){
|
|
|
|
var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
|
|
|
|
|
|
|
|
for (var i = 0; i < string.length; i++) {
|
|
|
|
if (iChars.indexOf(string.charAt(i)) != -1) {
|
|
|
|
alert ("Caractères spéciaux ne sont pas autorisés.\n Veuillez modifier " + string);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function(){
|
|
|
|
|
|
|
|
$("#c_ssmenu2").html('<ul>'+
|
|
|
|
'<li class="breadcrumb_item"><a href="central.php" title="Accueil">Accueil</a></li>'+
|
|
|
|
'<li class="breadcrumb_item"><a href="articles.list.immo.php" title="">Articles</a></li>'+
|
|
|
|
'<li class="breadcrumb_item"><a href="" title="">Ajouter Article</a></li>'+
|
|
|
|
'</ul>');
|
|
|
|
|
|
|
|
});
|
|
|
|
</script>
|