Debug last commit
This commit is contained in:
parent
79fcfc33bc
commit
269b6dd2b0
|
|
@ -119,6 +119,8 @@ function getContratDatas($id) {
|
||||||
|
|
||||||
$i["frequence_print"] = CONTRATS_FREQUENCES[$i["frequence"]];
|
$i["frequence_print"] = CONTRATS_FREQUENCES[$i["frequence"]];
|
||||||
if($i["frequence"] == "quinz") $i["frequence_print"] .= " (groupe ".$i["quinz_groupe"].')';
|
if($i["frequence"] == "quinz") $i["frequence_print"] .= " (groupe ".$i["quinz_groupe"].')';
|
||||||
|
|
||||||
|
$i["paniers_livres"] = getContratPaniersLivres($id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$er = "</br>sql: ".$sql."</br>error: ".getReadableVar($r['erreur']);
|
$er = "</br>sql: ".$sql."</br>error: ".getReadableVar($r['erreur']);
|
||||||
|
|
@ -128,6 +130,29 @@ function getContratDatas($id) {
|
||||||
return $i;
|
return $i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getContratPaniersLivres($id) {
|
||||||
|
$list = array();
|
||||||
|
|
||||||
|
$sql = getLivraisonsPaniersSelectBaseSQL()
|
||||||
|
." WHERE ".LIVRAISONS_PANIERS_TABLE.".`contrat`=".intval($id)
|
||||||
|
." ORDER BY ".LIVRAISONS_TABLE.".`date` ASC";
|
||||||
|
|
||||||
|
$r = $GLOBALS['db_admin']['man']->select($sql);
|
||||||
|
|
||||||
|
if(!$r['erreur']) {
|
||||||
|
foreach($r['datas'] as $i) {
|
||||||
|
$i["livraison_date_print"] = formatDate($i["livraison_date"], "mysql_date", "print_date");
|
||||||
|
$list[$i['livraison_ref']] = $i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$er = "</br>sql: ".$sql."</br>error: ".getReadableVar($r['erreur']);
|
||||||
|
$GLOBALS['errors'][] = "Une erreur est survenue durant la récupération de la liste des paniers livrés du contrat dans le base de données !".$er;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
function getContratLastPanier($id) {
|
function getContratLastPanier($id) {
|
||||||
$i = false;
|
$i = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,15 @@ if(isset($_REQUEST["ref"]) && (int)$_REQUEST["ref"]>0 && $action) {
|
||||||
switch($action) {
|
switch($action) {
|
||||||
// AJAX GET DATAS
|
// AJAX GET DATAS
|
||||||
case "getDatas": die(json_encode($infos)); break;
|
case "getDatas": die(json_encode($infos)); break;
|
||||||
|
// MODAL VIEW - GET TAB
|
||||||
|
case "modalView_getTab": {
|
||||||
|
$GLOBALS['smarty'] -> assign('infos', $infos);
|
||||||
|
$tabs = array(
|
||||||
|
"paniers" => "contrats/contrat_modal_view_tab_paniers.tpl"
|
||||||
|
);
|
||||||
|
if(isset($_REQUEST['tab']) && array_key_exists($_REQUEST['tab'], $tabs)) die( $GLOBALS['smarty']->fetch($tabs[$_REQUEST['tab']]) );
|
||||||
|
die("NO TAB");
|
||||||
|
} break;
|
||||||
// EDIT
|
// EDIT
|
||||||
case "edit": {
|
case "edit": {
|
||||||
$datas = getContratDatasFromRequest();
|
$datas = getContratDatasFromRequest();
|
||||||
|
|
@ -140,6 +149,7 @@ switch($action) {
|
||||||
// TEMPLATE
|
// TEMPLATE
|
||||||
$GLOBALS['template'] = 'contrats/contrats_list.tpl';
|
$GLOBALS['template'] = 'contrats/contrats_list.tpl';
|
||||||
$jsFiles[] = PUBLIC_HTML_ADMIN.'js/contrats.js';
|
$jsFiles[] = PUBLIC_HTML_ADMIN.'js/contrats.js';
|
||||||
|
$cssFiles[] = PUBLIC_HTML_ADMIN.'css/contrats.css';
|
||||||
|
|
||||||
// REQUIRED LISTS
|
// REQUIRED LISTS
|
||||||
$GLOBALS['smarty'] -> assign('paniers_groupes_list', $groupesList);
|
$GLOBALS['smarty'] -> assign('paniers_groupes_list', $groupesList);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
/* MODAL & FORM LIVRAISON */
|
||||||
|
|
||||||
|
#modalViewContrat { overflow: hidden; }
|
||||||
|
|
||||||
|
#modalViewContrat div.modal-header { border-bottom: none; padding-bottom: 5px; }
|
||||||
|
|
||||||
|
#modalViewContrat .formContrat { margin: -15px; }
|
||||||
|
|
||||||
|
/* NAV TABS */
|
||||||
|
|
||||||
|
.formContrat ul.nav.nav-tabs { padding-left: 10px; }
|
||||||
|
|
||||||
|
div.formContratTabs > div.tab {
|
||||||
|
display: none;
|
||||||
|
border-bottom-left-radius: 6px;
|
||||||
|
border-bottom-right-radius: 6px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.formContratTabs > div.tab.active { display: block; }
|
||||||
|
|
||||||
|
div.formContratTabs > div.tab span.nullChild { display: block; padding: 10px; }
|
||||||
|
|
||||||
|
div.formContratTabs > div.tab span.nullChild { display: block; padding: 10px; }
|
||||||
|
|
||||||
|
/* TAB INFOS */
|
||||||
|
|
||||||
|
div.formContratTabs > div.tabInfos table tr:first-child > th,
|
||||||
|
div.formContratTabs > div.tabInfos table tr:first-child > td { border-top: none; }
|
||||||
|
|
||||||
|
div.formContratTabs > div.tabInfos table { margin-bottom: 0; }
|
||||||
|
div.formContratTabs > div.tabInfos table th { width: 200px; }
|
||||||
|
|
||||||
|
/* TAB PANIERS */
|
||||||
|
|
||||||
|
div.formContratTabs > div.tabPaniers table { margin-bottom: 0; }
|
||||||
|
|
@ -160,9 +160,13 @@ function loadDatasInViewClientModal(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearViewClientModal() {
|
function clearViewClientModal() {
|
||||||
currentViewClient = 0;
|
|
||||||
modalViewClient.find("small.db_ref > span").html("");
|
modalViewClient.find("small.db_ref > span").html("");
|
||||||
|
|
||||||
|
modalViewClient.find("ul.formClientTabs > li").removeClass('active hide');
|
||||||
|
modalViewClient.find("ul.formClientTabs > li:first-child").addClass('active');
|
||||||
|
modalViewClient.find("div.formClientTabs > div.tab").removeClass("active");
|
||||||
|
modalViewClient.find("div.formClientTabs > div.tab:first-child").addClass("active");
|
||||||
|
|
||||||
modalViewClient.find("td.nom").html("");
|
modalViewClient.find("td.nom").html("");
|
||||||
modalViewClient.find("td.tel").html("");
|
modalViewClient.find("td.tel").html("");
|
||||||
modalViewClient.find("td.email").html("");
|
modalViewClient.find("td.email").html("");
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,31 @@ function initViewContrat() {
|
||||||
currentViewContrat = id;
|
currentViewContrat = id;
|
||||||
loadDatasInViewContratModal(id);
|
loadDatasInViewContratModal(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var form = modalViewContrat.find("div.formContrat");
|
||||||
|
|
||||||
|
// TABS
|
||||||
|
form.find("a.formContratTabBtn").click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
// BTN
|
||||||
|
if(!$(this).parent().hasClass("active")) {
|
||||||
|
form.find("ul.formContratTabs > li").removeClass('active');
|
||||||
|
$(this).parent().addClass("active");
|
||||||
|
}
|
||||||
|
|
||||||
|
// TAB
|
||||||
|
var tab = form.find("div.tab."+$(this).attr("tab"));
|
||||||
|
if(tab.length>0) {
|
||||||
|
if(tab.hasClass("active")) return;
|
||||||
|
|
||||||
|
form.find("div.formContratTabs > div.tab").removeClass("active");
|
||||||
|
tab.addClass("active");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
resizeFormContrat(form);
|
||||||
|
$( window ).on( "resize", function() { resizeFormContrat(form) });
|
||||||
|
|
||||||
|
|
||||||
// CANCEL
|
// CANCEL
|
||||||
modalViewContrat.on('hidden.bs.modal', function (e) {
|
modalViewContrat.on('hidden.bs.modal', function (e) {
|
||||||
|
|
@ -145,6 +170,11 @@ function initViewContrat() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resizeFormContrat(form) {
|
||||||
|
var wh = window.innerHeight;
|
||||||
|
form.find("div.formContratTabs div.tab").css("max-height", (wh-180)+"px");
|
||||||
|
}
|
||||||
|
|
||||||
function loadDatasInViewContratModal(id) {
|
function loadDatasInViewContratModal(id) {
|
||||||
datas = {
|
datas = {
|
||||||
'ref' : id,
|
'ref' : id,
|
||||||
|
|
@ -152,6 +182,7 @@ function loadDatasInViewContratModal(id) {
|
||||||
};
|
};
|
||||||
$.post( contratsBaseURL, datas, function( result ) {
|
$.post( contratsBaseURL, datas, function( result ) {
|
||||||
var datas = JSON.parse(result);
|
var datas = JSON.parse(result);
|
||||||
|
console.log(datas);
|
||||||
|
|
||||||
modalViewContrat.find("small.db_ref > span").html(datas.ref);
|
modalViewContrat.find("small.db_ref > span").html(datas.ref);
|
||||||
|
|
||||||
|
|
@ -187,6 +218,11 @@ function loadDatasInViewContratModal(id) {
|
||||||
modalViewContrat.find("td.nb_panier_livre").html(nb_panier_livre);
|
modalViewContrat.find("td.nb_panier_livre").html(nb_panier_livre);
|
||||||
modalViewContrat.find("td.nb_panier_restant").html(datas.nb_paniers_restants + " / " + datas.nb_paniers);
|
modalViewContrat.find("td.nb_panier_restant").html(datas.nb_paniers_restants + " / " + datas.nb_paniers);
|
||||||
|
|
||||||
|
// PANIERS
|
||||||
|
$.post(contratsBaseURL, { 'ref' : id, 'action' : 'modalView_getTab', 'tab' : 'paniers' }, function(result) {
|
||||||
|
modalViewContrat.find("div.tabPaniers").html(result);
|
||||||
|
}).fail(function() { alert(srvErrorMsg+" (load modal view client - tab paniers)"); });
|
||||||
|
|
||||||
modalViewContrat.modal('show');
|
modalViewContrat.modal('show');
|
||||||
}).fail(function() { alert(srvErrorMsg+" (load modal view contrat)"); });
|
}).fail(function() { alert(srvErrorMsg+" (load modal view contrat)"); });
|
||||||
}
|
}
|
||||||
|
|
@ -194,6 +230,11 @@ function loadDatasInViewContratModal(id) {
|
||||||
function clearViewContratModal() {
|
function clearViewContratModal() {
|
||||||
modalViewContrat.find("small.db_ref > span").html("");
|
modalViewContrat.find("small.db_ref > span").html("");
|
||||||
|
|
||||||
|
modalViewContrat.find("ul.formContratTabs > li").removeClass('active hide');
|
||||||
|
modalViewContrat.find("ul.formContratTabs > li:first-child").addClass('active');
|
||||||
|
modalViewContrat.find("div.formContratTabs > div.tab").removeClass("active");
|
||||||
|
modalViewContrat.find("div.formContratTabs > div.tab:first-child").addClass("active");
|
||||||
|
|
||||||
modalViewContrat.find("td.nom").html("");
|
modalViewContrat.find("td.nom").html("");
|
||||||
modalViewContrat.find("td.tel").html("");
|
modalViewContrat.find("td.tel").html("");
|
||||||
modalViewContrat.find("td.email").html("");
|
modalViewContrat.find("td.email").html("");
|
||||||
|
|
@ -207,6 +248,8 @@ function clearViewContratModal() {
|
||||||
|
|
||||||
modalViewContrat.find("td.nb_panier_livre").html("");
|
modalViewContrat.find("td.nb_panier_livre").html("");
|
||||||
modalViewContrat.find("td.nb_panier_restant").html("");
|
modalViewContrat.find("td.nb_panier_restant").html("");
|
||||||
|
|
||||||
|
modalViewContrat.find("div.tabPaniers").html("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** FORM CONTRAT *****/
|
/***** FORM CONTRAT *****/
|
||||||
|
|
|
||||||
|
|
@ -77,15 +77,17 @@ $(document).ready( function() {
|
||||||
function initFiltresLivraisons() {
|
function initFiltresLivraisons() {
|
||||||
// console.log("INIT FILTRES LIVRAISONS");
|
// console.log("INIT FILTRES LIVRAISONS");
|
||||||
|
|
||||||
|
loadValue = filtreLivraisonGroupe.attr("load_value");
|
||||||
filtreLivraisonGroupe.change(function(e) {
|
filtreLivraisonGroupe.change(function(e) {
|
||||||
$(this).blur();
|
$(this).blur();
|
||||||
document.location = "?groupe="+parseInt($(this).val());
|
document.location = "?groupe="+parseInt($(this).val());
|
||||||
});
|
}).val(loadValue);
|
||||||
|
|
||||||
|
loadValue = filtreLivraisonArchive.attr("load_value");
|
||||||
filtreLivraisonArchive.change(function(e) {
|
filtreLivraisonArchive.change(function(e) {
|
||||||
$(this).blur();
|
$(this).blur();
|
||||||
document.location = "?archive="+parseInt($(this).val());
|
document.location = "?archive="+parseInt($(this).val());
|
||||||
});
|
}).val(loadValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** VIEW LIVRAISON *****/
|
/***** VIEW LIVRAISON *****/
|
||||||
|
|
|
||||||
|
|
@ -10,15 +10,28 @@
|
||||||
Fiche contrat
|
Fiche contrat
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<table class="table modal-body">
|
<div class="modal-body formContrat">
|
||||||
<tr><th>type de contrat :</th><td class="type"></td></tr>
|
<ul class="nav nav-tabs formContratTabs">
|
||||||
<tr><th>client :</th><td class="client"></td></tr>
|
<li role="presentation" class="active"><a href="#" class="formContratTabBtn" tab="tabInfos">Informations</a></li>
|
||||||
<tr><th>date de début :</th><td class="date"></td></tr>
|
<li role="presentation"><a href="#" class="formContratTabBtn" tab="tabPaniers">Paniers Livrés</a></li>
|
||||||
<tr><th>lieu de dépôt :</th><td class="lieu_depot"></td></tr>
|
</ul>
|
||||||
<tr><th>nb. de chèque :</th><td class="nb_cheque"></td></tr>
|
<div class="formContratTabs">
|
||||||
<tr><th>nb. de panier(s) livré(s) :</th><td class="nb_panier_livre"></td></tr>
|
<div class="tab tabInfos active">
|
||||||
<tr><th>nb. de panier(s) restant(s) :</th><td class="nb_panier_restant"></td></tr>
|
<table class="table">
|
||||||
</table>
|
<tr><th>type de contrat :</th><td class="type"></td></tr>
|
||||||
|
<tr><th>client :</th><td class="client"></td></tr>
|
||||||
|
<tr><th>date de début :</th><td class="date"></td></tr>
|
||||||
|
<tr><th>lieu de dépôt :</th><td class="lieu_depot"></td></tr>
|
||||||
|
<tr><th>nb. de chèque :</th><td class="nb_cheque"></td></tr>
|
||||||
|
<tr><th>nb. de panier(s) livré(s) :</th><td class="nb_panier_livre"></td></tr>
|
||||||
|
<tr><th>nb. de panier(s) restant(s) :</th><td class="nb_panier_restant"></td></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="tab tabPaniers">
|
||||||
|
<span class="nullChild">aucun panier livré</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr class="head">
|
||||||
|
<th>date</th>
|
||||||
|
<th>panier</th>
|
||||||
|
<th>lieu</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{foreach from=$infos.paniers_livres item=i}
|
||||||
|
<tr>
|
||||||
|
<td>{$i.livraison_date_print}</td>
|
||||||
|
<td>{$i.panier_type_nom}</td>
|
||||||
|
<td>{$i.lieu_depot_nom}</td>
|
||||||
|
</tr>
|
||||||
|
{foreachelse}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3">aucun panier</td>
|
||||||
|
</tr>
|
||||||
|
{/foreach}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
@ -10,15 +10,15 @@
|
||||||
<div class="collapse navbar-collapse">
|
<div class="collapse navbar-collapse">
|
||||||
<form class="navbar-form navbar-right" role="search" id="livraisonsFiltre">
|
<form class="navbar-form navbar-right" role="search" id="livraisonsFiltre">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-addon">groupe :</span>
|
<span class="input-group-addon{if $groupe>0} active{/if}">groupe :</span>
|
||||||
<select class="form-control" name="groupe">{include file='paniers_groupes/paniers_groupes_select_list.tpl'}</select>
|
<select class="form-control" name="groupe" load_value="{$groupe}">{include file='paniers_groupes/paniers_groupes_select_list.tpl'}</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-addon">archive :</span>
|
<span class="input-group-addon{if $archive!=0} active{/if}">archive :</span>
|
||||||
<select class="form-control" name="archive">
|
<select class="form-control" name="archive" load_value="{$archive}">
|
||||||
<option value="-1"{if $archive==-1} selected{/if}>tous</option>
|
<option value="-1">tous</option>
|
||||||
<option value="0"{if $archive==0} selected{/if}>non</option>
|
<option value="0">non</option>
|
||||||
<option value="1"{if $archive==1} selected{/if}>oui</option>
|
<option value="1">oui</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue