Gestion multi-tarifs légumes
Affichage absence dans la listes des paniers d'une livraison
This commit is contained in:
parent
2e463acc45
commit
ae14bfd662
|
|
@ -264,7 +264,6 @@ function getContratsTypesTableSelectBaseSQL() {
|
|||
define('LEGUMES_TABLE',"legumes");
|
||||
define('LEGUMES_TABLE_STRUCT', array(
|
||||
"nom" => array( "type" => "txt", "length" => 64, "default" => "" ),
|
||||
"tarif" => array( "type" => "int", "min" => 1, "max" => NULL, "default" => NULL, "force_default_under_min" => true ),
|
||||
"del" => array( "type" => "bool", "default" => 0 )
|
||||
));
|
||||
|
||||
|
|
@ -275,13 +274,8 @@ function getCountLegumesListSelectBaseSQL() {
|
|||
function getLegumesTableSelectBaseSQL() {
|
||||
return "SELECT "
|
||||
.LEGUMES_TABLE.".`ref`,"
|
||||
.LEGUMES_TABLE.".`nom`,"
|
||||
.LEGUMES_TABLE.".`tarif` as 'tarif_ref',"
|
||||
.LEGUMES_TARIFS_TABLE.".`prix` as 'tarif_prix',"
|
||||
.LEGUMES_TARIFS_TABLE.".`unite` as 'tarif_unite',"
|
||||
.LEGUMES_TARIFS_TABLE.".`date` as 'tarif_date'"
|
||||
." FROM ".LEGUMES_TABLE
|
||||
." LEFT JOIN ".LEGUMES_TARIFS_TABLE." ON ".LEGUMES_TABLE.".`tarif`=".LEGUMES_TARIFS_TABLE.".`ref`";
|
||||
.LEGUMES_TABLE.".`nom`"
|
||||
." FROM ".LEGUMES_TABLE;
|
||||
}
|
||||
|
||||
function buildLegumesListSearchSQL($search) { return LEGUMES_TABLE.".`nom` LIKE '%".$search."%'"; }
|
||||
|
|
@ -300,7 +294,6 @@ define('LEGUMES_TARIFS_TABLE_STRUCT', array(
|
|||
"prix" => array( "type" => "float", "min" => 0, "max" => 999.99, "default" => 0, "force_default_under_min" => true ),
|
||||
"unite" => array( "type" => "set", "values" => LEGUMES_TARIFS_UNITES, "default" => "poids" ),
|
||||
"date" => array( "type" => "date", "default" => "today" ),
|
||||
"archive" => array( "type" => "bool", "default" => 0 ),
|
||||
"del" => array( "type" => "bool", "default" => 0 )
|
||||
));
|
||||
|
||||
|
|
@ -311,10 +304,9 @@ function getLegumesTarifsTableSelectBaseSQL() {
|
|||
.LEGUMES_TABLE.".`nom` as 'legume_nom',"
|
||||
.LEGUMES_TARIFS_TABLE.".`groupe` as 'groupe_ref',"
|
||||
.PANIERS_GROUPES_TABLE.".`nom` as 'groupe_nom',"
|
||||
.LEGUMES_TARIFS_TABLE.".`prix` as 'tarif_prix',"
|
||||
.LEGUMES_TARIFS_TABLE.".`unite` as 'tarif_unite',"
|
||||
.LEGUMES_TARIFS_TABLE.".`date` as 'tarif_date',"
|
||||
.LEGUMES_TARIFS_TABLE.".`archive`"
|
||||
.LEGUMES_TARIFS_TABLE.".`prix` as 'prix',"
|
||||
.LEGUMES_TARIFS_TABLE.".`unite` as 'unite',"
|
||||
.LEGUMES_TARIFS_TABLE.".`date` as 'date'"
|
||||
." FROM ".LEGUMES_TARIFS_TABLE
|
||||
." LEFT JOIN ".LEGUMES_TABLE." ON ".LEGUMES_TARIFS_TABLE.".`legume`=".LEGUMES_TABLE.".`ref`"
|
||||
." LEFT JOIN ".PANIERS_GROUPES_TABLE." ON ".LEGUMES_TARIFS_TABLE.".`groupe`=".PANIERS_GROUPES_TABLE.".`ref`";
|
||||
|
|
|
|||
|
|
@ -468,6 +468,7 @@ function strtoupperFirstLetter($str) {
|
|||
if(strlen($str)==0) return $str;
|
||||
return strtoupper(substr($str,0,1)).substr($str,1);
|
||||
}
|
||||
|
||||
// DATE
|
||||
|
||||
function getTime($date,$moment='start',$format=DATE_FORMAT) { // Retourne un timestamp à partir d'une date jj/mm/aaaa
|
||||
|
|
@ -576,6 +577,7 @@ function checkDateFormat($date, $format = 'mysql_datetime', $default = NULL) {
|
|||
}
|
||||
|
||||
function isValidDate($date, $format = 'mysql_datetime') {
|
||||
if(!$date || is_null($date)) return false;
|
||||
$f = "Y-m-d";
|
||||
switch($format) {
|
||||
case 'date': $f = "d/m/Y"; break;
|
||||
|
|
|
|||
|
|
@ -8,9 +8,7 @@
|
|||
|
||||
$allowLegumesListOrder = array(
|
||||
'ref' => "réf.",
|
||||
'nom' => "nom",
|
||||
'tarif' => "tarif",
|
||||
'date' => "date"
|
||||
'nom' => "nom"
|
||||
);
|
||||
|
||||
function getNbLegumesInList($search=false) {
|
||||
|
|
@ -25,6 +23,11 @@ function getNbLegumesInList($search=false) {
|
|||
}
|
||||
|
||||
function getLegumesList($order='nom',$sens='ASC', $search=false, $limits=false) {
|
||||
// TARIF & DATE ORDRE
|
||||
$grps = getPaniersGroupesList();
|
||||
$tarif_date_orders = array();
|
||||
foreach($grps as $g) { $tarif_date_orders[] = "tarif_".$g["ref"]; $orders[] = "date_".$g["ref"]; }
|
||||
|
||||
$list = array();
|
||||
|
||||
$sql = getLegumesTableSelectBaseSQL()." WHERE ".LEGUMES_TABLE.".`del`=0";
|
||||
|
|
@ -37,8 +40,6 @@ function getLegumesList($order='nom',$sens='ASC', $search=false, $limits=false)
|
|||
|
||||
if($order=='ref') $sql .= LEGUMES_TABLE.".`ref`";
|
||||
else if($order=='nom') $sql .= LEGUMES_TABLE.".`nom`";
|
||||
else if($order=='tarif') $sql .= LEGUMES_TARIFS_TABLE.".`prix`";
|
||||
else if($order=='date') $sql .= LEGUMES_TARIFS_TABLE.".`date`";
|
||||
else $sql .= LEGUMES_TABLE.".`nom`";
|
||||
|
||||
// SENS
|
||||
|
|
@ -46,15 +47,24 @@ function getLegumesList($order='nom',$sens='ASC', $search=false, $limits=false)
|
|||
else $sql .= ' ASC';
|
||||
|
||||
// LIMITS
|
||||
if(is_array($limits)) $sql .= " LIMIT ".$limits['start'].", ".$limits['nbItemsByPage'];
|
||||
if(is_array($limits) && !in_array($order, $tarif_date_orders)) $sql .= " LIMIT ".$limits['start'].", ".$limits['nbItemsByPage'];
|
||||
|
||||
$r = $GLOBALS['db_admin']['man']->select($sql);
|
||||
|
||||
if(!$r['erreur']) {
|
||||
foreach($r['datas'] as $i) {
|
||||
$i["tarif_print"] = $i["tarif_prix"]." €/".$i["tarif_unite"];
|
||||
$i["tarif_date_print"] = formatDate($i["tarif_date"], "mysql_date", "print_date");
|
||||
|
||||
$i["tarifs"] = getLegumeTarifs($i['ref']);
|
||||
foreach($i["tarifs"] as $g => $t) {
|
||||
if($t["ref"] >0) {
|
||||
$i["tarif_".$g] = $t["prix"];
|
||||
$i["date_".$g] = $t["dateObj"];
|
||||
}
|
||||
else {
|
||||
$i["tarif_".$g] = false;
|
||||
$i["date_".$g] = false;
|
||||
}
|
||||
}
|
||||
$i["next_tarifs"] = getLegumeTarifs($i['ref'], 'next');
|
||||
$list[$i['ref']] = $i;
|
||||
}
|
||||
}
|
||||
|
|
@ -63,6 +73,11 @@ function getLegumesList($order='nom',$sens='ASC', $search=false, $limits=false)
|
|||
$GLOBALS['errors'][] = "Une erreur est survenue durant la récupération de la liste des légumes dans le base de données !".$er;
|
||||
}
|
||||
|
||||
if(in_array($order, $tarif_date_orders)) {
|
||||
$list = orderListByKey($list, $order, $sens);
|
||||
if(is_array($limits)) $list = array_slice($list, $limits['start'], $limits['nbItemsByPage']);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
|
@ -76,22 +91,31 @@ function getLegumesAutocompleteList() {
|
|||
$sql = getLegumesTableSelectBaseSQL()." WHERE ".LEGUMES_TABLE.".`del`=0";
|
||||
foreach($parts as $p) $sql .= " AND (".buildLegumesListSearchSQL($p).")";
|
||||
|
||||
$groupe = false;
|
||||
if(isset($_REQUEST['groupe']) && (int)$_REQUEST['groupe']>0) $groupe = intval($_REQUEST['groupe']);
|
||||
$date = false;
|
||||
if(isset($_REQUEST['date']) && isValidDate($_REQUEST['date'], "mysql_date")) $date = $_REQUEST['date'];
|
||||
|
||||
$r = $GLOBALS['db_admin']['man']->select($sql);
|
||||
|
||||
if(!$r['erreur']) {
|
||||
foreach($r['datas'] as $l) {
|
||||
// TARIF
|
||||
$t = getLegumeTarif($l['ref'], $groupe, $date, false);
|
||||
if($t) {
|
||||
$row = array(
|
||||
"id" => $l['ref'],
|
||||
"value" => $l['nom'],
|
||||
"label" => $l['nom'],
|
||||
|
||||
"ref" => $l['ref'],
|
||||
"tarif_ref" => $l['tarif_ref'],
|
||||
"tarif_prix" => $l['tarif_prix'],
|
||||
"tarif_unite" => $l['tarif_unite']
|
||||
"tarif_ref" => $t['ref'],
|
||||
"tarif_prix" => $t['prix'],
|
||||
"tarif_unite" => $t['unite']
|
||||
);
|
||||
array_push($list, $row);
|
||||
}
|
||||
}
|
||||
|
||||
$a_json = apply_highlight($list, $parts); // highlight search parts
|
||||
}
|
||||
|
|
@ -114,10 +138,9 @@ function getLegumeDatas($id) {
|
|||
if(!$r['erreur']) {
|
||||
$i = $r['datas'];
|
||||
|
||||
$i["tarif_print"] = $i["tarif_prix"]." €/".$i["tarif_unite"];
|
||||
$i["tarif_date_print"] = formatDate($i["tarif_date"], "mysql_date", "print_date");
|
||||
|
||||
$i["historique_tarif"] = getLegumeTarifHistorique($id, $i["tarif_ref"]);
|
||||
$i["tarifs_list"] = getLegumeTarifsList($i['ref']);
|
||||
$i["tarifs"] = getLegumeTarifs($i['ref']);
|
||||
$i["next_tarifs"] = getLegumeTarifs($i['ref'], 'next');
|
||||
}
|
||||
else {
|
||||
$er = "</br>sql: ".$sql."</br>error: ".getReadableVar($r['erreur']);
|
||||
|
|
@ -132,16 +155,9 @@ function getLegumeDatas($id) {
|
|||
function getLegumeDatasFromRequest() {
|
||||
$datas = getRequestTableDatas(LEGUMES_TABLE_STRUCT);
|
||||
|
||||
// NEW TARIF
|
||||
if(isset($_REQUEST["tarif_ref"]) && $_REQUEST["tarif_ref"] == "new" && isset($_REQUEST["tarif_prix"]) && isset($_REQUEST["tarif_unite"])) {
|
||||
$date = formatDate('', 'mysql_date');
|
||||
if(isset($_REQUEST["tarif_date"])) $date = checkDateFormat($_REQUEST["tarif_date"], 'mysql_date', "now");
|
||||
$datas["new_tarif"] = array(
|
||||
"prix" => floatval($_REQUEST["tarif_prix"]),
|
||||
"unite" => in_array($_REQUEST["tarif_unite"], LEGUMES_TARIFS_UNITES) ? $_REQUEST["tarif_unite"] : "kg",
|
||||
"date" => $date
|
||||
);
|
||||
}
|
||||
// TARIFS
|
||||
$datas["tarifs"] = array();
|
||||
if(isset($_REQUEST["tarifs"])) $datas["tarifs"] = json_decode($_REQUEST["tarifs"], true);
|
||||
|
||||
return $datas;
|
||||
}
|
||||
|
|
@ -190,38 +206,119 @@ function eraseLegume($id) {
|
|||
// LEGUMES - TARIFS ////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function getLegumeTarifs($legume) {
|
||||
function getLegumeTarifsList($legume) {
|
||||
$list = array();
|
||||
|
||||
$sql = getLegumesTarifsTableSelectBaseSQL()
|
||||
." WHERE ".LEGUMES_TARIFS_TABLE.".`legume`=".intval($legume)
|
||||
." AND ".LEGUMES_TARIFS_TABLE.".`del`=0"
|
||||
." ORDER BY ".LEGUMES_TARIFS_TABLE.".`date` DESC";
|
||||
|
||||
$r = $GLOBALS['db_admin']['man']->select($sql);
|
||||
|
||||
if(!$r['erreur']) {
|
||||
foreach($r['datas'] as $i) {
|
||||
$i["print"] = $i["prix"]." €/".$i["unite"];
|
||||
$i["date_print"] = formatDate($i["date"], "mysql_date", "print_date");
|
||||
$list[] = $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 tarifs du légume dans le base de données !".$er;
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
function getLegumeTarif($legume, $groupe) {
|
||||
$i = array();
|
||||
function getLegumeTarifs($legume, $date=false) {
|
||||
$groupes = getPaniersGroupesList();
|
||||
$list = [];
|
||||
|
||||
$tarifToutGrp = getLegumeTarif($legume, 0, $date);
|
||||
|
||||
foreach($groupes as $g) {
|
||||
$tarif = array(
|
||||
"groupe_ref" => $g['ref'],
|
||||
"groupe_nom" => $g['nom'],
|
||||
"ref" => 0
|
||||
);
|
||||
|
||||
// TARIF TOUT GROUPE
|
||||
if(is_array($tarifToutGrp)) {
|
||||
$tarif["ref"] = intval($tarifToutGrp["ref"]);
|
||||
$tarif["prix"] = $tarifToutGrp["prix"];
|
||||
$tarif["unite"] = $tarifToutGrp["unite"];
|
||||
$tarif["print"] = $tarifToutGrp["print"];
|
||||
$tarif["date"] = $tarifToutGrp["date"];
|
||||
$tarif["date_print"] = $tarifToutGrp["date_print"];
|
||||
$tarif["tarif_groupe"] = 0;
|
||||
}
|
||||
|
||||
// TARIF SPECIFIQUE
|
||||
$tarifGrp = getLegumeTarif($legume, $g['ref'], $date);
|
||||
if(is_array($tarifGrp)) {
|
||||
if(!is_array($tarifToutGrp) || (is_array($tarifToutGrp) && $tarifToutGrp["dateObj"] < $tarifGrp["dateObj"])) {
|
||||
$tarif["ref"] = intval($tarifGrp["ref"]);
|
||||
$tarif["prix"] = $tarifGrp["prix"];
|
||||
$tarif["unite"] = $tarifGrp["unite"];
|
||||
$tarif["print"] = $tarifGrp["print"];
|
||||
$tarif["date"] = $tarifGrp["date"];
|
||||
$tarif["date_print"] = $tarifGrp["date_print"];
|
||||
$tarif["tarif_groupe"] = $g['ref'];
|
||||
}
|
||||
}
|
||||
|
||||
$list[$g['ref']] = $tarif;
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
function getLegumeTarif($legume, $groupe, $date=false, $groupe_exclusif=true) {
|
||||
$i = false;
|
||||
|
||||
$sql = getLegumesTarifsTableSelectBaseSQL()
|
||||
." WHERE ".LEGUMES_TARIFS_TABLE.".`legume`=".intval($legume);
|
||||
." WHERE ".LEGUMES_TARIFS_TABLE.".`legume`=".intval($legume)
|
||||
." AND ".LEGUMES_TARIFS_TABLE.".`del`=0";
|
||||
|
||||
if($groupe>0) $sql .= " AND ".LEGUMES_TARIFS_TABLE.".`groupe`=".intval($groupe);
|
||||
else $sql .= " AND ".LEGUMES_TARIFS_TABLE.".`groupe` IS NULL";
|
||||
// GROUPE
|
||||
if($groupe>0) {
|
||||
if($groupe_exclusif) $sql .= " AND ".LEGUMES_TARIFS_TABLE.".`groupe`=".intval($groupe);
|
||||
else $sql .= " AND (".LEGUMES_TARIFS_TABLE.".`groupe`=".intval($groupe)
|
||||
." OR ".LEGUMES_TARIFS_TABLE.".`groupe`=0"
|
||||
." OR ".LEGUMES_TARIFS_TABLE.".`groupe` IS NULL)";
|
||||
}
|
||||
else $sql .= " AND (".LEGUMES_TARIFS_TABLE.".`groupe` IS NULL OR ".LEGUMES_TARIFS_TABLE.".`groupe`=0)";
|
||||
|
||||
$r = $GLOBALS['db_admin']['man']->select($sql,1);
|
||||
// DATE
|
||||
if($date == 'next') {
|
||||
$date = formatDate('', '', 'mysql_date');
|
||||
$sql .= " AND ".LEGUMES_TARIFS_TABLE.".`date`>'".$date."'";
|
||||
}
|
||||
else {
|
||||
if(!isValidDate($date, "mysql_date")) $date = formatDate('', '', 'mysql_date');
|
||||
$sql .= " AND ".LEGUMES_TARIFS_TABLE.".`date`<='".$date."'";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY ".LEGUMES_TARIFS_TABLE.".`date` DESC";
|
||||
|
||||
$r = $GLOBALS['db_admin']['man']->select($sql);
|
||||
|
||||
if(!$r['erreur']) {
|
||||
$i = $r['datas'];
|
||||
|
||||
$i["tarif_print"] = $i["tarif_prix"]." €/".$i["tarif_unite"];
|
||||
$i["tarif_date_print"] = formatDate($i["tarif_date"], "mysql_date", "print_date");
|
||||
if(count($r['datas'])>0) {
|
||||
$i = $r['datas'][0];
|
||||
$i["dateObj"] = new DateTime($i["date"]);
|
||||
$i["print"] = $i["prix"]." €/".$i["unite"];
|
||||
$i["date_print"] = formatDate($i["date"], "mysql_date", "print_date");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$er = "</br>sql: ".$sql."</br>error: ".getReadableVar($r['erreur']);
|
||||
$GLOBALS['errors'][] = "Une erreur est survenue durant la récupération des informations du légume dans le base de données !".$er;
|
||||
$GLOBALS['errors'][] = "Une erreur est survenue durant la récupération des informations du tarif du légume dans le base de données !".$er;
|
||||
}
|
||||
|
||||
return $i;
|
||||
|
||||
}
|
||||
|
||||
function addLegumeTarif($datas) {
|
||||
|
|
@ -243,6 +340,15 @@ function deleteLegumeTarif($id) {
|
|||
);
|
||||
}
|
||||
|
||||
function eraseLegumeTarif($id) {
|
||||
return eraseItemInTable(
|
||||
$GLOBALS['db_admin']['man'], // DB MANAGER
|
||||
LEGUMES_TARIFS_TABLE, // TABLE NAME
|
||||
$id, // ID
|
||||
"du tarif" // ERROR STRING
|
||||
);
|
||||
}
|
||||
|
||||
function getLegumeTarifHistorique($id, $current = 0) {
|
||||
$list = array();
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,8 @@ function getLivraisonDatas($id) {
|
|||
$i["nb_paniers"] = getLivraisonNbPaniers($id);
|
||||
$i["legumes"] = getLivraisonLegumes($id, $i["nb_paniers"]);
|
||||
$i["total_legumes"] = calcLivraisonTotalLegumes($i["legumes"]);
|
||||
|
||||
$i["paniers_eligibles"] = getLivraisonPaniersEligibles($i["paniers_groupe_ref"], $i["date"], $i["quinz_groupe"], $i["paniers_contrats"]);
|
||||
}
|
||||
else {
|
||||
$er = "</br>sql: ".$sql."</br>error: ".getReadableVar($r['erreur']);
|
||||
|
|
@ -259,7 +261,7 @@ function getLivraisonLieux($livraison) {
|
|||
// LIVRAISONS - PANIERS ////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function getLivraisonPaniersEligibles($paniers_groupe, $date, $quinz_groupe) {
|
||||
function getLivraisonPaniersEligibles($paniers_groupe, $date, $quinz_groupe, $contrats_presents=array()) {
|
||||
$list = array();
|
||||
|
||||
$sql = "SELECT "
|
||||
|
|
@ -316,12 +318,18 @@ function getLivraisonPaniersEligibles($paniers_groupe, $date, $quinz_groupe) {
|
|||
$list[$lieu]["paniers"][$pType] = array(
|
||||
"type_ref" => $pType,
|
||||
"type_nom" => $i['panier_type_nom'],
|
||||
"nb_paniers" => 0,
|
||||
"paniers" => array()
|
||||
);
|
||||
}
|
||||
|
||||
// AJOUT
|
||||
$i["present"] = in_array(intval($i["contrat_ref"]), $contrats_presents);
|
||||
$list[$lieu]["paniers"][$pType]["paniers"][] = $i;
|
||||
if($i["present"]) {
|
||||
$list[$lieu]["nb_paniers"]++;
|
||||
$list[$lieu]["paniers"][$pType]["nb_paniers"]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,15 @@
|
|||
div.mainPage {
|
||||
padding: 0;
|
||||
}
|
||||
div.mainPage { padding: 0; }
|
||||
|
||||
.icon {
|
||||
height: 16px;
|
||||
}
|
||||
.icon { height: 16px; }
|
||||
|
||||
th.icon,
|
||||
td.icon {
|
||||
width: 24px;
|
||||
}
|
||||
td.icon { width: 24px; }
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
.center { text-align: center; }
|
||||
.right { text-align: right; }
|
||||
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
.border-left { border-left: 1px solid #ddd; }
|
||||
.border-right { border-right: 1px solid #ddd; }
|
||||
|
||||
tr.subLine > td {
|
||||
padding-top: 3px !important;
|
||||
|
|
@ -135,7 +127,7 @@ table.scrollingTableList ::-webkit-scrollbar-thumb {
|
|||
|
||||
table.scrollingTableList tbody { display: block; overflow: auto; margin: 0; }
|
||||
|
||||
table.scrollingTableList tbody tr:first-child td { border: none; }
|
||||
table.scrollingTableList tbody tr:first-child td { border-top: none; }
|
||||
|
||||
table.scrollingTableList thead, table.scrollingTableList tbody tr {
|
||||
display: table;
|
||||
|
|
@ -143,9 +135,10 @@ table.scrollingTableList thead, table.scrollingTableList tbody tr {
|
|||
table-layout: fixed;
|
||||
}
|
||||
|
||||
table.scrollingTableList:not(.no-scroll) thead { width: calc( 100% - 16px ); }
|
||||
table.scrollingTableList:not(.no-scroll) thead { width: calc( 100% - 15px ); }
|
||||
|
||||
table.scrollingTableList th.id, table.scrollingTableList td.id { width: 45px; }
|
||||
table.scrollingTableList th.tarif, table.scrollingTableList td.tarif { width: 140px; }
|
||||
table.scrollingTableList th.groupe, table.scrollingTableList td.groupe { width: 100px; }
|
||||
table.scrollingTableList th.valeur, table.scrollingTableList td.valeur { width: 130px; }
|
||||
table.scrollingTableList th.tel, table.scrollingTableList td.tel { width: 150px; }
|
||||
|
|
@ -550,8 +543,29 @@ div.formTabs table.modal-body tr:first-child td { border-top: none; }
|
|||
|
||||
/* MODAL VIEW LEGUME */
|
||||
|
||||
#modalViewLegume table.modal-body tbody th { width: 100px; }
|
||||
#modalViewLegume table.modal-body tfoot { background-color: #f2f2f2; }
|
||||
.has-next-tarif { background-color: azure; }
|
||||
|
||||
#modalViewLegume tr.tarifs_titre { background-color: #f2f2f2; border-top: 3px solid #ddd; }
|
||||
#modalViewLegume tr.tarifs_titre th.groupe { border-left: 1px solid #999999; border-right: 1px solid #999999; }
|
||||
#modalViewLegume tr.tarif td { border: 1px solid #999999; }
|
||||
|
||||
#modalViewLegume td.tarif { text-align: center; }
|
||||
#modalViewLegume tr.tarif.courant td {
|
||||
background-color: rgba(51, 122, 183, .2);
|
||||
border-color: #999999;
|
||||
}
|
||||
#modalViewLegume td.tarif.groupe-null { background-color: #ddd!important; }
|
||||
|
||||
/* FORM LEGUME */
|
||||
.formLegume div.tarif { margin-bottom: 5px; }
|
||||
.formLegume div.tarifs:last-child { margin-bottom: 0; }
|
||||
|
||||
.formLegume div.input-group.deleted select.form-control,
|
||||
.formLegume div.input-group.deleted input.form-control,
|
||||
.formLegume div.input-group.deleted span.input-group-addon {
|
||||
text-decoration: line-through;
|
||||
color: #d9534f;
|
||||
}
|
||||
|
||||
/* MODAL ADMIN CONSOLE */
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@
|
|||
.formLivraison table.panier th,
|
||||
.formLivraison table.panier td { padding: 4px !important; }
|
||||
|
||||
.formLivraison table.panier tr.absent { background-color: #f3f3f3; }
|
||||
.formLivraison table.panier tr.absent { background-color: #f3f3f3; color: #8f8f8f; }
|
||||
.formLivraison table.panier tr.absent td.nom { text-decoration: line-through; }
|
||||
|
||||
.formLivraison table.panier tr.lieuTitre { cursor: pointer; }
|
||||
.formLivraison table.panier tr.lieuTitre th {
|
||||
|
|
|
|||
|
|
@ -143,7 +143,6 @@ function modalForm_initBtnUnarchive(btn, archiveType, modal, saveURL) {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
function modalForm_initBtnDelete(btn, modal, clearFormFct, loadFormDatasFct) {
|
||||
btn.unbind('click').click( function(e) {
|
||||
e.preventDefault(); $(this).blur();
|
||||
|
|
@ -1064,7 +1063,7 @@ function getTodayDate(format) {
|
|||
|
||||
function parseDate(dateStr, format) {
|
||||
date = false;
|
||||
if(dateStr == "") return date;
|
||||
if(dateStr == "" || dateStr.length<10) return date;
|
||||
switch(format) {
|
||||
case 'yyyy-mm-dd' : { d=dateStr.split("-"); if(d.length==3) date = new Date(d[0], d[1] - 1, d[2]); } break;
|
||||
case 'yyyy-dd-mm' : { d=dateStr.split("-"); if(d.length==3) date = new Date(d[0], d[2] - 1, d[1]); } break;
|
||||
|
|
|
|||
|
|
@ -82,11 +82,13 @@ function modalViewLegume_loadDatas(modal, id) {
|
|||
modal.find("small.db_ref > span").html(datas.ref);
|
||||
|
||||
modal.find("td.nom").html(datas.nom);
|
||||
modal.find("td.tarif").html(datas.tarif_print+" <small>(depuis le "+datas.tarif_date_print+")</small>");
|
||||
|
||||
if(datas.historique_tarif.length>0) {
|
||||
modal.find("table.modal-body tfoot").removeClass("hide");
|
||||
$.each(datas.historique_tarif, function(n,e) { addTarifLegumeHist(e); });
|
||||
// TARIFS
|
||||
if(Object.keys(datas.tarifs_list).length>0) {
|
||||
modal.find("table.modal-body tbody tr.nullchild").addClass("hide");
|
||||
var tarifs_courant = {};
|
||||
$.each(datas.tarifs, function(n,e) { tarifs_courant[e.ref] = e.print });
|
||||
$.each(datas.tarifs_list, function(n,e) { modalViewLegume_addTarif(modal, e, tarifs_courant); });
|
||||
}
|
||||
|
||||
modal.modal('show');
|
||||
|
|
@ -97,11 +99,34 @@ function modalViewLegume_clear(modal) {
|
|||
modal.find("small.db_ref > span").html("");
|
||||
|
||||
modal.find("td.nom").html("");
|
||||
modal.find("td.tarif").html("");
|
||||
modal.find("table.modal-body tbody tr.nullchild").removeClass("hide");
|
||||
modal.find("table.modal-body tbody tr.tarif").remove();
|
||||
|
||||
modal.find("table.modal-body tfoot").addClass("hide").find("tr:not(.header)").remove();
|
||||
}
|
||||
|
||||
function modalViewLegume_addTarif(modal, datas, tarifs_courant) {
|
||||
var tr = $("<tr class='tarif'></tr>")
|
||||
.append( $("<td></td>").html(datas.date_print) );
|
||||
|
||||
if(tarifs_courant.hasOwnProperty(datas.ref)) tr.addClass("courant");
|
||||
|
||||
var grps = modal.find("table.modal-body tbody th.titre.groupe");
|
||||
|
||||
if(parseInt(datas.groupe_ref)>0) {
|
||||
grps.each(function(n,e) {
|
||||
if(parseInt($(this).attr('ref')) == parseInt(datas.groupe_ref)) {
|
||||
tr.append( $("<td class='tarif'></td>").html(datas.print) );
|
||||
}
|
||||
else tr.append( $("<td class='tarif groupe-null'>.</td>") );
|
||||
});
|
||||
}
|
||||
else {
|
||||
tr.append( $("<td class='tarif'></td>").attr("colspan", grps.length).html(datas.print) );
|
||||
}
|
||||
modal.find("table.modal-body tbody").append(tr);
|
||||
}
|
||||
|
||||
function modalViewLegume_addTarifLegumeHist(modal, datas) {
|
||||
var tr = $("<tr></tr>").attr("ref", datas.ref);
|
||||
tr.append($("<td></td>").html(datas.tarif_print));
|
||||
|
|
@ -133,13 +158,11 @@ function modalViewLegume_addTarifLegumeHist(modal, datas) {
|
|||
function modalFormLegume_init(modal) {
|
||||
modal.find("form").on("submit", function(e) { e.preventDefault(); });
|
||||
|
||||
// BTN EDIT TARIF
|
||||
modal.find("button.btnEditTarif").click(function(e) {
|
||||
// BTN ADD TARIF
|
||||
modal.find("button.btnAddTarif").click(function(e) {
|
||||
e.preventDefault();
|
||||
$(this).blur().addClass('hide');
|
||||
modal.find("input[name=prix]").attr('ref', 'new').prop('disabled', false);
|
||||
modal.find("select[name=unite]").prop('disabled', false);
|
||||
modal.find("input[name=date]").prop('disabled', false).val(getTodayDate("yyyy-mm-dd"));
|
||||
iptGrp = modalFormLegume_addTarif(modal, false);
|
||||
iptGrp.find("input[name=prix]").focus();
|
||||
});
|
||||
|
||||
// PRIX
|
||||
|
|
@ -151,9 +174,18 @@ function modalFormLegume_loadDatas(modal,id) {
|
|||
var datas = JSON.parse(jsonTxt);
|
||||
|
||||
modal.find("input[name=nom]").val(datas.nom);
|
||||
modal.find("input[name=prix]").val(datas.tarif_prix).attr('ref', datas.tarif_ref);
|
||||
modal.find("select[name=unite]").val(datas.tarif_unite);
|
||||
modal.find("input[name=date]").val(datas.tarif_date);
|
||||
$.each(datas.tarifs, function(n,e) {
|
||||
if(e.ref>0) {
|
||||
e.is_next = false;
|
||||
modalFormLegume_addTarif(modal, e);
|
||||
}
|
||||
});
|
||||
$.each(datas.next_tarifs, function(n,e) {
|
||||
if(e.ref>0) {
|
||||
e.is_next = true;
|
||||
modalFormLegume_addTarif(modal, e);
|
||||
}
|
||||
});
|
||||
|
||||
if(modal) modal.modal('show');
|
||||
}).fail(function() { alert("("+legumesConf.type+" - load datas in modal form)"); });
|
||||
|
|
@ -163,30 +195,77 @@ function modalFormLegume_clear(modal) {
|
|||
modal.removeAttr("edit_id");
|
||||
modal.find("div.modaLoader").removeClass("show");
|
||||
|
||||
add = modal.hasClass("add");
|
||||
|
||||
modal.find("input[name=nom]").val("");
|
||||
if(add) modal.find("button.btnEditTarif").addClass('hide');
|
||||
else modal.find("button.btnEditTarif").removeClass('hide');
|
||||
modal.find("input[name=prix]").val("").attr('ref', "new").prop('disabled', !add);
|
||||
modal.find("select[name=unite]").val("kg").prop('disabled', !add);
|
||||
modal.find("input[name=date]").val(getTodayDate("yyyy-mm-dd")).prop('disabled', !add);
|
||||
modal.find("div.tarifs div.tarif").remove();
|
||||
}
|
||||
|
||||
function modalFormLegume_addTarif(modal, datas) {
|
||||
if(modal.find("div.tarifs div.tarif[ref="+datas.ref+"]").length>0) return;
|
||||
|
||||
var iptGrp = $( modal.find("div.tarif_template").html() ).addClass("tarif").attr('ref', 'new');
|
||||
|
||||
if(isDefined(datas) && typeof(datas)==="object") {
|
||||
iptGrp.attr('ref', datas.ref);
|
||||
iptGrp.find("select[name=groupe]").val(datas.tarif_groupe).prop("disabled", true);
|
||||
iptGrp.find("input[name=prix]").val(datas.prix).prop("disabled", true);
|
||||
iptGrp.find("select[name=unite]").val(datas.unite).prop("disabled", true);
|
||||
iptGrp.find("input[name=date]").val(datas.date).prop("disabled", true);
|
||||
if(datas.is_next) iptGrp.find("button.btnDel").prop("disabled", false);
|
||||
}
|
||||
else {
|
||||
iptGrp.find("input[name=date]").val(getTodayDate("yyyy-mm-dd"));
|
||||
iptGrp.find("button.btnDel").prop("disabled", false);
|
||||
}
|
||||
|
||||
modal.find("div.tarifs").append(iptGrp);
|
||||
|
||||
// INIT
|
||||
initFloatInput( iptGrp.find("input[name=prix]") );
|
||||
|
||||
iptGrp.find("button.btnDel").click(function(e) {
|
||||
e.preventDefault(); $(this).blur();
|
||||
if(parseInt(iptGrp.attr("ref"))>0) {
|
||||
if(iptGrp.hasClass("deleted")) {
|
||||
iptGrp.removeClass("deleted");
|
||||
$(this).removeClass("btn-info").addClass("btn-danger")
|
||||
.find("i").removeClass("glyphicon-refresh").addClass("glyphicon-trash");
|
||||
}
|
||||
else {
|
||||
iptGrp.addClass("deleted");
|
||||
$(this).removeClass("btn-danger").addClass("btn-info")
|
||||
.find("i").removeClass("glyphicon-trash").addClass("glyphicon-refresh");
|
||||
}
|
||||
}
|
||||
else iptGrp.remove();
|
||||
});
|
||||
|
||||
return iptGrp;
|
||||
}
|
||||
|
||||
function modalFormLegume_getDatas(modal) {
|
||||
var datas = {
|
||||
'nom' : modal.find("input[name=nom]").val(),
|
||||
'tarif_ref' : (modal.find("input[name=prix]").attr('ref')=="new") ? "new" : parseInt(modal.find("input[name=prix]").attr('ref')),
|
||||
'tarif_prix' : parseFloat( modal.find("input[name=prix]").val() ),
|
||||
'tarif_unite' : modal.find("select[name=unite]").val(),
|
||||
'tarif_date' : modal.find("input[name=date]").val()
|
||||
'nom' : modal.find("input[name=nom]").val()
|
||||
};
|
||||
|
||||
// TARIFS
|
||||
var tarifs = [];
|
||||
modal.find("div.tarifs div.input-group.tarif").each(function(n,e) {
|
||||
tarifs.push({
|
||||
'ref' : $(this).attr('ref'),
|
||||
'groupe' : parseInt( $(this).find("select[name=groupe]").val() ),
|
||||
'prix' : parseFloat( $(this).find("input[name=prix]").val() ),
|
||||
'unite' : $(this).find("select[name=unite]").val(),
|
||||
'date' : $(this).find("input[name=date]").val(),
|
||||
'del' : $(this).hasClass("deleted") ? 1 : 0
|
||||
});
|
||||
});
|
||||
datas.tarifs = JSON.stringify(tarifs);
|
||||
return datas;
|
||||
}
|
||||
|
||||
function modalFormLegume_checkDatas(datas) {
|
||||
if(datas.nom=="") {
|
||||
alert("ERREUR : au minimum, un nom doit être renseigné !");
|
||||
if(datas.nom=="" || JSON.parse(datas.tarifs).length==0) {
|
||||
alert("ERREUR : au minimum, un nom et un tarif doivent être renseigné !");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -107,7 +107,6 @@ function initViewLivraison() {
|
|||
function modalViewLivraison_loadDatas(modal, id) {
|
||||
$.post(livraisonsConf.baseURL, { 'ref' : id, 'action' : 'getDatas' }, function(jsonTxt) {
|
||||
var datas = JSON.parse(jsonTxt);
|
||||
|
||||
modal.find("small.db_ref > span").html(datas.ref);
|
||||
|
||||
modal.find("td.groupe").html(datas.paniers_groupe_nom);
|
||||
|
|
@ -271,7 +270,7 @@ function modalFormLivraison_loadPaniers(modal, paniers) {
|
|||
});
|
||||
|
||||
// INIT CHECKBOX
|
||||
modal.find("div.tabPaniers table.panier input[name=status]").click(function(e) { $(this).blur(); modalFormLivraison_updateNbPaniersType(modal); });
|
||||
modal.find("div.tabPaniers table.panier input[name=status]").click(function(e) { e.stopPropagation(); $(this).blur(); modalFormLivraison_updateNbPaniersType(modal); });
|
||||
|
||||
// INIT TR CLICK
|
||||
modal.find("div.tabPaniers table.panier tr.panier").click(function(e) { $(this).find("input[name=status]").click(); });
|
||||
|
|
@ -443,6 +442,8 @@ function modalFormLivraison_addPanierTypeCompoLegume(modal, panier, datas) {
|
|||
tdQunit.html(unite);
|
||||
|
||||
tdMontant.html(number_format(datas.tarif_prix * datas.quantite, 2));
|
||||
|
||||
modalFormLivraison_refreshPanierTypeCompoLegumeTarif(modal, panier, trL);
|
||||
}
|
||||
panier.find("tbody").append(trL);
|
||||
|
||||
|
|
@ -463,7 +464,8 @@ function modalFormLivraison_addPanierTypeCompoLegume(modal, panier, datas) {
|
|||
"(modal form livraison - compo legume autocomplete)", // ERROR CONTEXT
|
||||
// REQUEST DATAS
|
||||
function(modal, ipt, datas) {
|
||||
datas.paniers_groupe = modal.find("select[name=paniers_groupe]").val();
|
||||
datas.groupe = modal.find("select[name=paniers_groupe]").val();
|
||||
datas.date = modal.find("input[name=date]").val();
|
||||
return datas;
|
||||
},
|
||||
// SELECT
|
||||
|
|
@ -494,26 +496,9 @@ function modalFormLivraison_addPanierTypeCompoLegume(modal, panier, datas) {
|
|||
|
||||
if(ref>0 && tarif_ref>0) {
|
||||
var td = ipt.parent(); var tr = td.parent();
|
||||
|
||||
tr.attr("ref", ref);
|
||||
|
||||
td.html( val )
|
||||
.attr('ref', ref)
|
||||
.attr('tarif_ref', tarif_ref)
|
||||
.attr('tarif_prix', tarif_prix)
|
||||
.attr('tarif_unite', tarif_unite);
|
||||
|
||||
tr.find("td.tarif").html(number_format(tarif_prix,2)).attr("ref", tarif_ref);
|
||||
tr.find("td.tarif_unite").html("€/"+unite);
|
||||
|
||||
q = tr.find("td.quantite").attr('unite', tarif_unite).html();
|
||||
if(tarif_unite=="kg") tr.find("td.quantite").html( number_format(q,3) );
|
||||
else tr.find("td.quantite").html( parseInt(q) );
|
||||
|
||||
tr.find("td.quantite_unite").html(unite);
|
||||
|
||||
tr.updateCompoLegumeMontant();
|
||||
|
||||
td.html( val ).attr('ref', ref);
|
||||
modalFormLivraison_loadPanierTypeCompoLegumeTarif(tr, tarif_ref, tarif_prix, tarif_unite);
|
||||
tr.find("td.quantite").dblclick();
|
||||
}
|
||||
else {
|
||||
|
|
@ -552,6 +537,42 @@ function modalFormLivraison_addPanierTypeCompoLegume(modal, panier, datas) {
|
|||
if(datas == "new") tdNom.dblclick();
|
||||
}
|
||||
|
||||
function modalFormLivraison_loadPanierTypeCompoLegumeTarif(row, tarif_ref, tarif_prix, tarif_unite) {
|
||||
unite = legumeTarifUnitesAccronymes[tarif_unite];
|
||||
|
||||
row.find("td.nom").attr('tarif_ref', tarif_ref)
|
||||
.attr('tarif_prix', tarif_prix)
|
||||
.attr('tarif_unite', tarif_unite);
|
||||
|
||||
row.find("td.tarif").html(number_format(tarif_prix,2)).attr("ref", tarif_ref);
|
||||
row.find("td.tarif_unite").html("€/"+unite);
|
||||
|
||||
q = row.find("td.quantite").attr('unite', tarif_unite).html();
|
||||
if(tarif_unite=="kg") row.find("td.quantite").html( number_format(q,3) );
|
||||
else row.find("td.quantite").html( parseInt(q) );
|
||||
|
||||
row.find("td.quantite_unite").html(unite);
|
||||
|
||||
row.updateCompoLegumeMontant();
|
||||
}
|
||||
|
||||
function modalFormLivraison_refreshPanierTypeCompoLegumeTarif(modal, panier, row) {
|
||||
return;
|
||||
var datas = {
|
||||
ref : parseInt(row.attr('ref')),
|
||||
action : 'getTarif',
|
||||
groupe : modal.find("select[name=paniers_groupe]").val(),
|
||||
date : modal.find("input[name=date]").val()
|
||||
}
|
||||
$.post("legumes.php", datas, function(result) {
|
||||
tarif = JSON.parse(result);
|
||||
tdNom = row.find("td.nom");
|
||||
if(typeof(tarif)=== "object" && tdNom.length>0) {
|
||||
if(parseInt(tarif.ref) != parseInt(tdNom.attr('tarif_ref'))) modalFormLivraison_loadPanierTypeCompoLegumeTarif(row, tarif.ref, tarif.prix, tarif.unite);
|
||||
}
|
||||
}).fail(function() { alert("ERREUR SERVEUR (modal form livraison - get next groupe)"); });
|
||||
}
|
||||
|
||||
function modalFormLivraison_copyPanierTypeCompo(modal, panier, btn) {
|
||||
// COPY
|
||||
if(!modalFormLivraison_copyCompoOrigin>0) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ $GLOBALS['racine'] = 'legumes.php';
|
|||
$GLOBALS['smarty']->assign('page','legumes');
|
||||
$GLOBALS['smarty']->assign('secondbar','legumes/legumes_secondbar.tpl');
|
||||
|
||||
include_once(FUNCTIONS_DIR_PATH.'functions_paniers_groupes.php');
|
||||
include_once(FUNCTIONS_DIR_PATH.'functions_legumes.php');
|
||||
|
||||
$action = false;
|
||||
|
|
@ -33,16 +34,30 @@ if(isset($_REQUEST["ref"]) && (int)$_REQUEST["ref"]>0 && $action) {
|
|||
switch($action) {
|
||||
// AJAX GET DATAS
|
||||
case "getDatas": die(json_encode($infos)); break;
|
||||
// AJAX GET TARIF
|
||||
case "getTarif": {
|
||||
$groupe = false;
|
||||
if(isset($_REQUEST['groupe']) && (int)$_REQUEST['groupe']>0) $groupe = intval($_REQUEST['groupe']);
|
||||
$date = false;
|
||||
if(isset($_REQUEST['date']) && isValidDate($_REQUEST['date'], "mysql_date")) $date = $_REQUEST['date'];
|
||||
$t = getLegumeTarif($id, $groupe, $date, false);
|
||||
die(json_encode($t));
|
||||
} break;
|
||||
// EDIT
|
||||
case "edit": {
|
||||
$datas = getLegumeDatasFromRequest();
|
||||
|
||||
// TARIF
|
||||
if(isset($datas["new_tarif"])) {
|
||||
$datas["new_tarif"]['legume'] = $id;
|
||||
$r = addLegumeTarif($datas["new_tarif"]);
|
||||
if((int)$r>0) $datas["tarif"] = $r;
|
||||
else die("ERREUR : une errreur est survenue durant l'enregistrement du nouveau tarif du légume. ($r)");
|
||||
// TARIFS
|
||||
foreach($datas["tarifs"] as $t) {
|
||||
if($t['ref'] == "new") {
|
||||
$t['legume'] = $id;
|
||||
$r = addLegumeTarif($t);
|
||||
if(!(int)$r>0) die("ERREUR : une errreur est survenue durant l'enregistrement du nouveau tarif du légume. ($r)");
|
||||
}
|
||||
else if((int)$t['ref']>0 && (int)$t['del']>0) {
|
||||
$r = eraseLegumeTarif(intval($t['ref']));
|
||||
if(!(int)$r>0) die("ERREUR : une errreur est survenue durant la suppression du tarif du légume. ($r)");
|
||||
}
|
||||
}
|
||||
|
||||
die( strval( updateLegume($id,$datas) ) );
|
||||
|
|
@ -62,18 +77,13 @@ switch($action) {
|
|||
if((int)$r>0) {
|
||||
$id = $r;
|
||||
|
||||
// TARIF
|
||||
if(isset($datas["new_tarif"])) {
|
||||
$datas["new_tarif"]['legume'] = $id;
|
||||
$r = addLegumeTarif($datas["new_tarif"]);
|
||||
if((int)$r>0) {
|
||||
$tarif_id = $r;
|
||||
|
||||
// UPDATE CURRENT TARIF
|
||||
$r = updateLegume($id, array("tarif" => $tarif_id));
|
||||
if(!(int)$r>0) die("ERREUR : une errreur est survenue durant l'enregistrement du tarif dans la fiche légume. ($r)");
|
||||
// TARIFS
|
||||
foreach($datas["tarifs"] as $t) {
|
||||
if($t['ref'] == "new") {
|
||||
$t['legume'] = $id;
|
||||
$r = addLegumeTarif($t);
|
||||
if(!(int)$r>0) die("ERREUR : une errreur est survenue durant l'enregistrement du tarif du légume. ($r)");
|
||||
}
|
||||
else die("ERREUR : une errreur est survenue durant l'enregistrement du tarif du légume. ($r)");
|
||||
}
|
||||
|
||||
die( (string)$id );
|
||||
|
|
@ -103,6 +113,17 @@ switch($action) {
|
|||
$GLOBALS['smarty'] -> assign('list_limits',$limits);
|
||||
|
||||
// LIST
|
||||
$grps = getPaniersGroupesList();
|
||||
$groupes = array();
|
||||
foreach($grps as $g) {
|
||||
$g["tarif"] = "tarif_".$g['ref'];
|
||||
$g["date"] = "date_".$g['ref'];
|
||||
$groupes[] = $g;
|
||||
|
||||
$allowLegumesListOrder[ $g["tarif"] ] = "tarif ".$g['nom'];
|
||||
$allowLegumesListOrder[ $g["date"] ] = "date ".$g['nom'];
|
||||
}
|
||||
$GLOBALS['smarty'] -> assign('groupes',$groupes);
|
||||
$order = getListOrder('legumes_list_order', 'legumes_list_sens', $allowLegumesListOrder, 'prenom');
|
||||
$list = getLegumesList($order["order"], $order["sens"], $search, $limits);
|
||||
$GLOBALS['smarty'] -> assign('list',$list);
|
||||
|
|
|
|||
|
|
@ -5,19 +5,30 @@
|
|||
<label>nom :</label>
|
||||
<input type="text" class="form-control" name="nom" placeholder="nom">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button class="btn btn-xs btn-default pull-right glyphicon glyphicon-edit btnEditTarif"></button>
|
||||
<div class="form-group tarifs">
|
||||
<button class="btn btn-xs btn-default pull-right glyphicon glyphicon-plus btnAddTarif"></button>
|
||||
<label>tarif :</label>
|
||||
<div class="tarif_template hide">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="prix" placeholder="prix" ref="new" disabled>
|
||||
<span class="input-group-addon">groupe :</span>
|
||||
<select class="form-control" name="groupe">
|
||||
<option value="0" selected>tous</option>
|
||||
{foreach from=$groupes item=g}
|
||||
<option value="{$g.ref}">{$g.nom}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<span class="input-group-addon">prix :</span>
|
||||
<input type="text" class="form-control" name="prix" placeholder="prix" ref="new">
|
||||
<span class="input-group-addon">unité :</span>
|
||||
<select class="form-control" name="unite" disabled>
|
||||
<select class="form-control" name="unite">
|
||||
<option value="kg" selected>kg</option>
|
||||
<option value="pièce">pièce</option>
|
||||
<option value="botte">botte</option>
|
||||
</select>
|
||||
<span class="input-group-addon">date :</span>
|
||||
<input type="date" class="form-control" name="date" placeholder="date'" disabled>
|
||||
<input type="date" class="form-control" name="date" placeholder="date'">
|
||||
<span class="input-group-btn"> <button class="btn btn-danger btnDel" disabled><i class="glyphicon glyphicon-trash"></i></button> </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -13,19 +13,20 @@
|
|||
<table class="table modal-body">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>nom :</th>
|
||||
<td class="nom" colspan="2"></td>
|
||||
<th class="titre">nom :</th>
|
||||
<td class="nom" colspan="3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>tarif :</th>
|
||||
<td class="tarif" colspan="2"></td>
|
||||
<tr class="tarifs_titre">
|
||||
<th class="titre">tarifs :</th>
|
||||
{foreach from=$groupes item=g}
|
||||
<th class="titre groupe center" ref="{$g.ref}">{$g.nom}</th>
|
||||
{/foreach}
|
||||
</tr>
|
||||
<tr class="nullchild">
|
||||
<td></td>
|
||||
<td colspan="{$groupes|@count+1}">aucun tarif</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot class="hide">
|
||||
<tr class="header">
|
||||
<th colspan="3">Historique de tarif :</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -14,18 +14,20 @@
|
|||
nom{if $order=="nom"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th class="visible-md visible-lg tarif">
|
||||
<a href={if $order=="tarif" && $sens=="ASC"}"?order=tarif&sens=DESC"
|
||||
{else}"?order=tarif&sens=ASC"{/if} style="text-decoration: none;">
|
||||
tarif{if $order=="tarif"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
{foreach from=$groupes item=g}
|
||||
<th class="visible-md visible-lg center tarif border-left">
|
||||
<a href={if $order==$g.tarif && $sens=="ASC"}"?order={$g.tarif}&sens=DESC"
|
||||
{else}"?order={$g.tarif}&sens=ASC"{/if} style="text-decoration: none;">
|
||||
tarif {$g.nom}{if $order==$g.tarif} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th class="visible-md visible-lg center date">
|
||||
<a href={if $order=="date" && $sens=="ASC"}"?order=date&sens=DESC"
|
||||
{else}"?order=date&sens=ASC"{/if} style="text-decoration: none;">
|
||||
date{if $order=="date"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
<th class="visible-md visible-lg center date border-right">
|
||||
<a href={if $order==$g.date && $sens=="ASC"}"?order={$g.date}&sens=DESC"
|
||||
{else}"?order={$g.date}&sens=ASC"{/if} style="text-decoration: none;">
|
||||
date {$g.nom}{if $order==$g.date} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
{/foreach}
|
||||
<th class="btn_action right" colspan="2"><button class="btn btn-xs btn-info glyphicon glyphicon-plus" id="btnAddLegume"></button></th>
|
||||
</thead>
|
||||
<tbody class="table progressLoadList" id="legumesList" start="{$list_limits.start}" end="{$list_limits.end}" rest="{$list_limits.rest}">
|
||||
|
|
|
|||
|
|
@ -2,8 +2,10 @@
|
|||
<tr>
|
||||
<td class="center visible-lg id">{$i.ref}</td>
|
||||
<td><a href="#" class="btnViewLegume" ref={$i.ref}>{$i.nom}</a></td>
|
||||
<td class="visible-md visible-lg tarif">{if $i.tarif_print}{$i.tarif_print}{else}.{/if}</td>
|
||||
<td class="visible-md visible-lg date">{$i.tarif_date_print}</td>
|
||||
{foreach from=$groupes item=g}
|
||||
<td class="visible-md visible-lg center tarif border-left{if $i.next_tarifs[$g.ref].ref>0} has-next-tarif{/if}">{if $i.tarifs[$g.ref].ref>0}{$i.tarifs[$g.ref].print}{else}.{/if}</td>
|
||||
<td class="visible-md visible-lg center date border-right{if $i.next_tarifs[$g.ref].ref>0} has-next-tarif{/if}">{if $i.tarifs[$g.ref].ref>0}{$i.tarifs[$g.ref].date_print}{else}.{/if}</td>
|
||||
{/foreach}
|
||||
<td class="td_btn_action"><button class="btn btn-xs btn-link glyphicon glyphicon-edit btnEditLegume" ref="{$i.ref}"></button></td>
|
||||
<td class="td_btn_action td_btn_delete"><button class="btn btn-xs btn-link glyphicon glyphicon-trash btnDeleteLegume" ref="{$i.ref}" nom="{$i.nom} {$i.prenom}"></button></td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{foreach from=$infos.lieux item=lieu}
|
||||
{foreach from=$infos.paniers_eligibles item=lieu}
|
||||
<table class="table panier">
|
||||
<thead>
|
||||
<tr class="lieuTitre">
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
<tbody>
|
||||
{foreach from=$lieu.paniers item=pType}
|
||||
<tr class="panierTitre">
|
||||
<th colspan="4">{$pType.type_nom} <small>(x{$pType.paniers|@count})</small></th>
|
||||
<th colspan="4">{$pType.type_nom} <small>(x{$pType.nb_paniers})</small></th>
|
||||
</tr>
|
||||
{foreach from=$pType.paniers item=p}
|
||||
<tr>
|
||||
<tr{if !$p.present} class="absent"{/if}>
|
||||
<td class="nom">{$p.client_prenom} {$p.client_nom}</td>
|
||||
<td class="frequence">{$p.frequence_print}</td>
|
||||
<td class="frequence">{if $p.present}{$p.frequence_print}{else}absent{/if}</td>
|
||||
<td class="nb_paniers_restants">{$p.nb_paniers_restants}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<td class="name"><a href="#" class="btnViewLivraison" ref="{$i.ref}">{$i.date_print}</a></td>
|
||||
<td class="visible-md visible-lg quinz_groupe">{if $i.quinz_groupe!=""}groupe {$i.quinz_groupe}{else}.{/if}</td>
|
||||
<td class="visible-md visible-lg items_long center">{$i.nb_paniers} panier{if $i.nb_paniers>1}s{/if}</td>
|
||||
<td class="td_btn_action"><button class="btn btn-xs btn-link glyphicon glyphicon-edit btnEditLivraison" ref="{$i.ref}"></button></td>
|
||||
<td class="td_btn_action">{if $i.archive==0}<button class="btn btn-xs btn-link glyphicon glyphicon-edit btnEditLivraison" ref="{$i.ref}"></button>{/if}</td>
|
||||
<td class="td_btn_action"><button class="btn btn-xs btn-link glyphicon glyphicon-duplicate btnCopyLivraison" ref="{$i.ref}"></button></td>
|
||||
{if $i.nb_paniers>0}
|
||||
{if $i.archive>0}
|
||||
|
|
|
|||
Loading…
Reference in New Issue