Refonte JS
This commit is contained in:
parent
74981fc92a
commit
2e463acc45
|
|
@ -32,6 +32,12 @@ define('PANIERS_TYPES_TABLE_STRUCT', array(
|
|||
"del" => array( "type" => "bool", "default" => 0 )
|
||||
));
|
||||
|
||||
function getCountPaniersTypesListSelectBaseSQL() {
|
||||
return "SELECT count(*) as nb"
|
||||
." FROM ".PANIERS_TYPES_TABLE
|
||||
." LEFT JOIN ".PANIERS_GROUPES_TABLE." ON ".PANIERS_TYPES_TABLE.".`groupe`=".PANIERS_GROUPES_TABLE.".`ref`";
|
||||
}
|
||||
|
||||
function getPaniersTypesSelectBaseSQL() {
|
||||
return "SELECT "
|
||||
.PANIERS_TYPES_TABLE.".`ref`,"
|
||||
|
|
@ -63,6 +69,10 @@ define('CLIENTS_TABLE_STRUCT', array(
|
|||
"del" => array( "type" => "bool", "default" => 0 )
|
||||
));
|
||||
|
||||
function getCountClientsListSelectBaseSQL() {
|
||||
return "SELECT count(*) as nb FROM ".CLIENTS_TABLE;
|
||||
}
|
||||
|
||||
function getClientsTableSelectBaseSQL() {
|
||||
return "SELECT "
|
||||
.CLIENTS_TABLE.".`ref`,"
|
||||
|
|
@ -138,6 +148,17 @@ define('CONTRATS_TABLE_STRUCT', array(
|
|||
|
||||
define('CONTRATS_PANIERS_STATUT',"contrats_paniers_statut");
|
||||
|
||||
function getCountContratsListSelectBaseSQL() {
|
||||
return "SELECT count(*) as nb"
|
||||
." FROM ".CONTRATS_TABLE
|
||||
." LEFT JOIN ".CLIENTS_TABLE." ON ".CONTRATS_TABLE.".`client`=".CLIENTS_TABLE.".`ref`"
|
||||
." LEFT JOIN ".CONTRATS_TYPES_TABLE." ON ".CONTRATS_TABLE.".`type`=".CONTRATS_TYPES_TABLE.".`ref`"
|
||||
." LEFT JOIN ".PANIERS_GROUPES_TABLE." ON ".CONTRATS_TABLE.".`groupe`=".PANIERS_GROUPES_TABLE.".`ref`"
|
||||
." LEFT JOIN ".PANIERS_TYPES_TABLE." ON ".CONTRATS_TABLE.".`panier_type`=".PANIERS_TYPES_TABLE.".`ref`"
|
||||
." LEFT JOIN ".LIEUX_TABLE." ON ".CONTRATS_TABLE.".`lieu_depot`=".LIEUX_TABLE.".`ref`"
|
||||
." LEFT JOIN ".CONTRATS_PANIERS_STATUT." ON ".CONTRATS_TABLE.".`ref`=".CONTRATS_PANIERS_STATUT.".`ref`";
|
||||
}
|
||||
|
||||
function getContratsTableSelectBaseSQL() {
|
||||
return "SELECT "
|
||||
.CONTRATS_TABLE.".`ref`,"
|
||||
|
|
@ -183,6 +204,23 @@ function buildContratsListSearchSQL($search) {
|
|||
return $sql;
|
||||
}
|
||||
|
||||
function buildContratsListFiltresSQL($sql, $filtres) {
|
||||
if(array_key_exists('client', $filtres) && (int)$filtres['client']>0) $sql.=" AND ".CONTRATS_TABLE.".`client`=".intval($filtres['client']);
|
||||
if(array_key_exists('groupe', $filtres) && (int)$filtres['groupe']>0) $sql.=" AND ".CONTRATS_TABLE.".`groupe`=".intval($filtres['groupe']);
|
||||
if(array_key_exists('frequence', $filtres) && $filtres['frequence']!="") {
|
||||
switch($filtres['frequence']) {
|
||||
case 'hebdo' : $sql.=" AND ".CONTRATS_TABLE.".`frequence`='hebdo'"; break;
|
||||
case 'quinz' : $sql.=" AND ".CONTRATS_TABLE.".`frequence`='quinz'"; break;
|
||||
case 'quinz_A' : $sql.=" AND ".CONTRATS_TABLE.".`frequence`='quinz' AND ".CONTRATS_TABLE.".`quinz_groupe`='A'"; break;
|
||||
case 'quinz_B' : $sql.=" AND ".CONTRATS_TABLE.".`frequence`='quinz' AND ".CONTRATS_TABLE.".`quinz_groupe`='B'"; break;
|
||||
}
|
||||
}
|
||||
if(array_key_exists('panier', $filtres) && (int)$filtres['panier']>0) $sql.=" AND ".CONTRATS_TABLE.".`panier_type`=".intval($filtres['panier']);
|
||||
if(array_key_exists('lieu', $filtres) && (int)$filtres['lieu']>0) $sql.=" AND ".CONTRATS_TABLE.".`lieu_depot`=".intval($filtres['lieu']);
|
||||
if(array_key_exists('archive', $filtres) && (int)$filtres['archive']>=0) $sql.=" AND ".CONTRATS_TABLE.".`archive`=".intval($filtres['archive']);
|
||||
return $sql;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// CONTRATS - TYPES ////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -230,6 +268,10 @@ define('LEGUMES_TABLE_STRUCT', array(
|
|||
"del" => array( "type" => "bool", "default" => 0 )
|
||||
));
|
||||
|
||||
function getCountLegumesListSelectBaseSQL() {
|
||||
return "SELECT count(*) as nb FROM ".LEGUMES_TABLE;
|
||||
}
|
||||
|
||||
function getLegumesTableSelectBaseSQL() {
|
||||
return "SELECT "
|
||||
.LEGUMES_TABLE.".`ref`,"
|
||||
|
|
@ -254,9 +296,11 @@ define('LEGUMES_TARIFS_UNITES_ACRONYMES',array( 'kg' => 'kg', 'pièce' => 'pc',
|
|||
define('LEGUMES_TARIFS_TABLE',"legumes_tarifs");
|
||||
define('LEGUMES_TARIFS_TABLE_STRUCT', array(
|
||||
"legume" => array( "type" => "int", "min" => 1, "max" => NULL, "default" => NULL, "force_default_under_min" => true ),
|
||||
"groupe" => array( "type" => "int", "min" => 1, "max" => NULL, "default" => NULL, "force_default_under_min" => true ),
|
||||
"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 )
|
||||
));
|
||||
|
||||
|
|
@ -265,12 +309,15 @@ function getLegumesTarifsTableSelectBaseSQL() {
|
|||
.LEGUMES_TARIFS_TABLE.".`ref`,"
|
||||
.LEGUMES_TARIFS_TABLE.".`legume` as 'legume_ref',"
|
||||
.LEGUMES_TABLE.".`nom` as 'legume_nom',"
|
||||
.LEGUMES_TARIFS_TABLE.".`ref` as 'tarif_ref',"
|
||||
.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.".`date` as 'tarif_date',"
|
||||
.LEGUMES_TARIFS_TABLE.".`archive`"
|
||||
." FROM ".LEGUMES_TARIFS_TABLE
|
||||
." LEFT JOIN ".LEGUMES_TABLE." ON ".LEGUMES_TARIFS_TABLE.".`legume`=".LEGUMES_TABLE.".`ref`";
|
||||
." 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`";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -303,12 +350,19 @@ define('LIVRAISONS_TABLE',"livraisons");
|
|||
define('LIVRAISONS_TABLE_STRUCT', array(
|
||||
"paniers_groupe" => array( "type" => "int", "min" => 1, "max" => NULL, "default" => NULL, "force_default_under_min" => true ),
|
||||
"date" => array( "type" => "date", "default" => "today" ),
|
||||
"quinz_groupe" => array( "type" => "set", "values" => ['A', 'B'], "default" => NULL ),
|
||||
"quinz_groupe" => array( "type" => "set", "values" => ['A', 'B'], "default" => NULL ),
|
||||
"archive" => array( "type" => "bool", "default" => 0 ),
|
||||
"force_not_archive" => array( "type" => "bool", "default" => 0 ),
|
||||
"del" => array( "type" => "bool", "default" => 0 )
|
||||
));
|
||||
|
||||
function getCountLivraisonsListSelectBaseSQL() {
|
||||
return "SELECT count(*) as nb"
|
||||
." FROM ".LIVRAISONS_TABLE
|
||||
." LEFT JOIN ".PANIERS_GROUPES_TABLE." ON ".LIVRAISONS_TABLE.".`paniers_groupe`=".PANIERS_GROUPES_TABLE.".`ref`"
|
||||
." LEFT JOIN ".LIVRAISONS_NB_PANIERS_VIEW." ON ".LIVRAISONS_TABLE.".`ref`=".LIVRAISONS_NB_PANIERS_VIEW.".`ref`";
|
||||
}
|
||||
|
||||
function getLivraisonsTableSelectBaseSQL() {
|
||||
return "SELECT "
|
||||
.LIVRAISONS_TABLE.".`ref`,"
|
||||
|
|
|
|||
|
|
@ -67,6 +67,12 @@ $GLOBALS['db_admin'] = array(
|
|||
define('AUTO_ARCHIVE_OLD_LIVRAISONS_DELAY',5); // NB DE JOURS
|
||||
define('AUTO_ARCHIVE_OLD_CONTRATS_DELAY',5); // NB DE JOURS (après le dernier panier livré)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// LISTES - NB DE LIGNE PAR PAGE ///////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
define('LIST_NB_LIGNES_PAR_PAGE',30);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// WARNINGS CONTRATS ///////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -2462,6 +2462,23 @@ function getRequestTableDatas($table_structure, $force_default_values=false) {
|
|||
return $ret;
|
||||
}
|
||||
|
||||
function buildSqlSearch($sql, $search, $partBuilderFct) {
|
||||
if($search && $search!="" && is_callable($partBuilderFct)) {
|
||||
$parts = explode(" ", $search);
|
||||
if(is_array($parts) && count($parts>0)) {
|
||||
$search_sql = "";
|
||||
foreach($parts as $p) {
|
||||
if($p!="") $search_sql .= (($search_sql!="") ? " OR " : "").$partBuilderFct($p);
|
||||
}
|
||||
if($search_sql!="") {
|
||||
if(strpos($sql, "WHERE")>0) $sql .= " AND (".$search_sql.")";
|
||||
else $sql .= " WHERE (".$search_sql.")";
|
||||
}
|
||||
}
|
||||
}
|
||||
return $sql;
|
||||
}
|
||||
|
||||
function buildTableDatas($table_structure, $datas, $force_default_values=false) {
|
||||
$ret = array();
|
||||
foreach($table_structure as $key => $infos) {
|
||||
|
|
|
|||
|
|
@ -14,22 +14,24 @@ $allowClientsListOrder = array(
|
|||
'email' => "email"
|
||||
);
|
||||
|
||||
function getClientsList($order='nom',$sens='ASC',$simple=false,$search=false) {
|
||||
function getNbClientsInList($search=false) {
|
||||
$sql = getCountClientsListSelectBaseSQL()." WHERE ".CLIENTS_TABLE.".`del`=0";
|
||||
$sql = buildSqlSearch($sql, $search, buildClientsListSearchSQL);
|
||||
$r = $GLOBALS['db_admin']['man']->select($sql, 1);
|
||||
if(!$r['erreur']) return intval($r['datas']['nb']);
|
||||
else {
|
||||
$er = "</br>sql: ".$sql."</br>error: ".getReadableVar($r['erreur']);
|
||||
return "Une erreur est survenue durant du nombre d'item dans la liste !".$er;
|
||||
}
|
||||
}
|
||||
|
||||
function getClientsList($order='nom',$sens='ASC',$simple=false,$search=false,$limits=false) {
|
||||
$list = array();
|
||||
|
||||
$sql = getClientsTableSelectBaseSQL()." WHERE ".CLIENTS_TABLE.".`del`=0";
|
||||
|
||||
// SEARCH
|
||||
if($search && $search!="") {
|
||||
$parts = explode(" ", $search);
|
||||
if(is_array($parts) && count($parts>0)) {
|
||||
$search_sql = "";
|
||||
foreach($parts as $p) {
|
||||
if($p!="") $search_sql .= (($search_sql!="") ? " OR " : "").buildClientsListSearchSQL($p);
|
||||
}
|
||||
if($search_sql!="") $sql .= " AND (".$search_sql.")";
|
||||
}
|
||||
}
|
||||
$sql = buildSqlSearch($sql, $search, buildClientsListSearchSQL);
|
||||
|
||||
// ORDRE
|
||||
$sql.=" ORDER BY ";
|
||||
|
|
@ -45,6 +47,9 @@ function getClientsList($order='nom',$sens='ASC',$simple=false,$search=false) {
|
|||
if($sens=='DESC') $sql .= ' DESC';
|
||||
else $sql .= ' ASC';
|
||||
|
||||
// LIMITS
|
||||
if(is_array($limits)) $sql .= " LIMIT ".$limits['start'].", ".$limits['nbItemsByPage'];
|
||||
|
||||
$r = $GLOBALS['db_admin']['man']->select($sql);
|
||||
|
||||
if(!$r['erreur']) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,19 @@ $allowContratsListOrder = array(
|
|||
'lieu_depot' => "lieu de dépôt"
|
||||
);
|
||||
|
||||
function getContratsList($order='id',$sens='ASC', $filtres=array(), $search=false) {
|
||||
function getNbContratsInList($filtres=array(), $search=false) {
|
||||
$sql = getCountContratsListSelectBaseSQL()." WHERE ".CONTRATS_TABLE.".`del`=0";
|
||||
$sql = buildContratsListFiltresSQL($sql, $filtres);
|
||||
$sql = buildSqlSearch($sql, $search, buildContratsListSearchSQL);
|
||||
$r = $GLOBALS['db_admin']['man']->select($sql, 1);
|
||||
if(!$r['erreur']) return intval($r['datas']['nb']);
|
||||
else {
|
||||
$er = "</br>sql: ".$sql."</br>error: ".getReadableVar($r['erreur']);
|
||||
return "Une erreur est survenue durant du nombre d'item dans la liste !".$er;
|
||||
}
|
||||
}
|
||||
|
||||
function getContratsList($order='id', $sens='ASC', $filtres=array(), $search=false, $limits=false) {
|
||||
// ARCHIVES OLD CONTRATS
|
||||
archiveOldContrat();
|
||||
|
||||
|
|
@ -30,31 +42,10 @@ function getContratsList($order='id',$sens='ASC', $filtres=array(), $search=fals
|
|||
$sql = getContratsTableSelectBaseSQL()." WHERE ".CONTRATS_TABLE.".`del`=0";
|
||||
|
||||
// FILTRES
|
||||
if(array_key_exists('client', $filtres) && (int)$filtres['client']>0) $sql.=" AND ".CONTRATS_TABLE.".`client`=".intval($filtres['client']);
|
||||
if(array_key_exists('groupe', $filtres) && (int)$filtres['groupe']>0) $sql.=" AND ".CONTRATS_TABLE.".`groupe`=".intval($filtres['groupe']);
|
||||
if(array_key_exists('frequence', $filtres) && $filtres['frequence']!="") {
|
||||
switch($filtres['frequence']) {
|
||||
case 'hebdo' : $sql.=" AND ".CONTRATS_TABLE.".`frequence`='hebdo'"; break;
|
||||
case 'quinz' : $sql.=" AND ".CONTRATS_TABLE.".`frequence`='quinz'"; break;
|
||||
case 'quinz_A' : $sql.=" AND ".CONTRATS_TABLE.".`frequence`='quinz' AND ".CONTRATS_TABLE.".`quinz_groupe`='A'"; break;
|
||||
case 'quinz_B' : $sql.=" AND ".CONTRATS_TABLE.".`frequence`='quinz' AND ".CONTRATS_TABLE.".`quinz_groupe`='B'"; break;
|
||||
}
|
||||
}
|
||||
if(array_key_exists('panier', $filtres) && (int)$filtres['panier']>0) $sql.=" AND ".CONTRATS_TABLE.".`panier_type`=".intval($filtres['panier']);
|
||||
if(array_key_exists('lieu', $filtres) && (int)$filtres['lieu']>0) $sql.=" AND ".CONTRATS_TABLE.".`lieu_depot`=".intval($filtres['lieu']);
|
||||
if(array_key_exists('archive', $filtres) && (int)$filtres['archive']>=0) $sql.=" AND ".CONTRATS_TABLE.".`archive`=".intval($filtres['archive']);
|
||||
$sql = buildContratsListFiltresSQL($sql, $filtres);
|
||||
|
||||
// SEARCH
|
||||
if($search && $search!="") {
|
||||
$parts = explode(" ", $search);
|
||||
if(is_array($parts) && count($parts>0)) {
|
||||
$search_sql = "";
|
||||
foreach($parts as $p) {
|
||||
if($p!="") $search_sql .= (($search_sql!="") ? " OR " : "").buildContratsListSearchSQL($p);
|
||||
}
|
||||
if($search_sql!="") $sql .= " AND (".$search_sql.")";
|
||||
}
|
||||
}
|
||||
$sql = buildSqlSearch($sql, $search, buildContratsListSearchSQL);
|
||||
|
||||
// ORDRE
|
||||
$sql.=" ORDER BY ";
|
||||
|
|
@ -76,6 +67,9 @@ function getContratsList($order='id',$sens='ASC', $filtres=array(), $search=fals
|
|||
if($sens=='DESC') $sql .= ' DESC';
|
||||
else $sql .= ' ASC';
|
||||
|
||||
// LIMITS
|
||||
if(is_array($limits)) $sql .= " LIMIT ".$limits['start'].", ".$limits['nbItemsByPage'];
|
||||
|
||||
$r = $GLOBALS['db_admin']['man']->select($sql);
|
||||
|
||||
if(!$r['erreur']) {
|
||||
|
|
|
|||
|
|
@ -13,22 +13,24 @@ $allowLegumesListOrder = array(
|
|||
'date' => "date"
|
||||
);
|
||||
|
||||
function getLegumesList($order='nom',$sens='ASC', $search=false) {
|
||||
function getNbLegumesInList($search=false) {
|
||||
$sql = getCountLegumesListSelectBaseSQL()." WHERE ".LEGUMES_TABLE.".`del`=0";
|
||||
$sql = buildSqlSearch($sql, $search, buildLegumesListSearchSQL);
|
||||
$r = $GLOBALS['db_admin']['man']->select($sql, 1);
|
||||
if(!$r['erreur']) return intval($r['datas']['nb']);
|
||||
else {
|
||||
$er = "</br>sql: ".$sql."</br>error: ".getReadableVar($r['erreur']);
|
||||
return "Une erreur est survenue durant du nombre d'item dans la liste !".$er;
|
||||
}
|
||||
}
|
||||
|
||||
function getLegumesList($order='nom',$sens='ASC', $search=false, $limits=false) {
|
||||
$list = array();
|
||||
|
||||
$sql = getLegumesTableSelectBaseSQL()." WHERE ".LEGUMES_TABLE.".`del`=0";
|
||||
|
||||
// SEARCH
|
||||
if($search && $search!="") {
|
||||
$parts = explode(" ", $search);
|
||||
if(is_array($parts) && count($parts>0)) {
|
||||
$search_sql = "";
|
||||
foreach($parts as $p) {
|
||||
if($p!="") $search_sql .= (($search_sql!="") ? " OR " : "").buildLegumesListSearchSQL($p);
|
||||
}
|
||||
if($search_sql!="") $sql .= " AND (".$search_sql.")";
|
||||
}
|
||||
}
|
||||
$sql = buildSqlSearch($sql, $search, buildLegumesListSearchSQL);
|
||||
|
||||
// ORDRE
|
||||
$sql.=" ORDER BY ";
|
||||
|
|
@ -43,6 +45,9 @@ function getLegumesList($order='nom',$sens='ASC', $search=false) {
|
|||
if($sens=='DESC') $sql .= ' DESC';
|
||||
else $sql .= ' ASC';
|
||||
|
||||
// LIMITS
|
||||
if(is_array($limits)) $sql .= " LIMIT ".$limits['start'].", ".$limits['nbItemsByPage'];
|
||||
|
||||
$r = $GLOBALS['db_admin']['man']->select($sql);
|
||||
|
||||
if(!$r['erreur']) {
|
||||
|
|
@ -185,6 +190,40 @@ function eraseLegume($id) {
|
|||
// LEGUMES - TARIFS ////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function getLegumeTarifs($legume) {
|
||||
$list = array();
|
||||
|
||||
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
function getLegumeTarif($legume, $groupe) {
|
||||
$i = array();
|
||||
|
||||
$sql = getLegumesTarifsTableSelectBaseSQL()
|
||||
." WHERE ".LEGUMES_TARIFS_TABLE.".`legume`=".intval($legume);
|
||||
|
||||
if($groupe>0) $sql .= " AND ".LEGUMES_TARIFS_TABLE.".`groupe`=".intval($groupe);
|
||||
else $sql .= " AND ".LEGUMES_TARIFS_TABLE.".`groupe` IS NULL";
|
||||
|
||||
$r = $GLOBALS['db_admin']['man']->select($sql,1);
|
||||
|
||||
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");
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
return $i;
|
||||
|
||||
}
|
||||
|
||||
function addLegumeTarif($datas) {
|
||||
return addDatasInTable(
|
||||
$GLOBALS['db_admin']['man'], // DB MANAGER
|
||||
|
|
|
|||
|
|
@ -14,7 +14,19 @@ $allowLivraisonsListOrder = array(
|
|||
'nb_paniers' => "nb. de paniers"
|
||||
);
|
||||
|
||||
function getLivraisonsList($order='id',$sens='ASC', $groupe=0, $archive=0) {
|
||||
function getNbLivraisonsInList($groupe=0, $archive=0) {
|
||||
$sql = getCountLivraisonsListSelectBaseSQL()." WHERE ".LIVRAISONS_TABLE.".`del`=0";
|
||||
if((int)$groupe>0) $sql.=" AND ".LIVRAISONS_TABLE.".`paniers_groupe`=".intval($groupe);
|
||||
if((int)$archive>=0) $sql.=" AND ".LIVRAISONS_TABLE.".`archive`=".intval($archive);
|
||||
$r = $GLOBALS['db_admin']['man']->select($sql, 1);
|
||||
if(!$r['erreur']) return intval($r['datas']['nb']);
|
||||
else {
|
||||
$er = "</br>sql: ".$sql."</br>error: ".getReadableVar($r['erreur']);
|
||||
return "Une erreur est survenue durant du nombre d'item dans la liste !".$er;
|
||||
}
|
||||
}
|
||||
|
||||
function getLivraisonsList($order='id',$sens='ASC', $groupe=0, $archive=0, $limits=false) {
|
||||
// ARCHIVES OLD LIVRAISONS
|
||||
archiveOldLivraison();
|
||||
|
||||
|
|
@ -41,6 +53,9 @@ function getLivraisonsList($order='id',$sens='ASC', $groupe=0, $archive=0) {
|
|||
if($sens=='DESC') $sql .= ' DESC';
|
||||
else $sql .= ' ASC';
|
||||
|
||||
// LIMITS
|
||||
if(is_array($limits)) $sql .= " LIMIT ".$limits['start'].", ".$limits['nbItemsByPage'];
|
||||
|
||||
$r = $GLOBALS['db_admin']['man']->select($sql);
|
||||
|
||||
if(!$r['erreur']) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ $allowPaniersGroupesListOrder = array(
|
|||
function getPaniersGroupesList($order='nom',$sens='ASC', $search=false) {
|
||||
$list = array();
|
||||
|
||||
$sql = getPaniersGroupesSelectBaseSQL()." WHERE ".PANIERS_GROUPES_TABLE.".`ref`>0";
|
||||
$sql = getPaniersGroupesSelectBaseSQL()." WHERE ".PANIERS_GROUPES_TABLE.".`del`=0";
|
||||
|
||||
// SEARCH
|
||||
if($search && $search!="") {
|
||||
|
|
|
|||
|
|
@ -13,22 +13,25 @@ $allowPaniersTypesListOrder = array(
|
|||
'valeur' => 'valeur'
|
||||
);
|
||||
|
||||
function getPaniersTypesList($order='nom',$sens='ASC', $search=false, $groupe=0) {
|
||||
function getNbPaniersInList($search=false, $groupe=0) {
|
||||
$sql = getCountPaniersTypesListSelectBaseSQL()." WHERE ".PANIERS_TYPES_TABLE.".`del`=0";
|
||||
$sql = buildSqlSearch($sql, $search, buildPaniersTypesListSearchSQL);
|
||||
if($groupe>0) $sql .= " AND ".PANIERS_TYPES_TABLE.".`groupe`=".intval($groupe);
|
||||
$r = $GLOBALS['db_admin']['man']->select($sql, 1);
|
||||
if(!$r['erreur']) return intval($r['datas']['nb']);
|
||||
else {
|
||||
$er = "</br>sql: ".$sql."</br>error: ".getReadableVar($r['erreur']);
|
||||
return "Une erreur est survenue durant du nombre d'item dans la liste !".$er;
|
||||
}
|
||||
}
|
||||
|
||||
function getPaniersTypesList($order='nom',$sens='ASC', $search=false, $groupe=0, $limits=false) {
|
||||
$list = array();
|
||||
|
||||
$sql = getPaniersTypesSelectBaseSQL()." WHERE ".PANIERS_TYPES_TABLE.".`ref`>0";
|
||||
$sql = getPaniersTypesSelectBaseSQL()." WHERE ".PANIERS_TYPES_TABLE.".`del`=0";
|
||||
|
||||
// SEARCH
|
||||
if($search && $search!="") {
|
||||
$parts = explode(" ", $search);
|
||||
if(is_array($parts) && count($parts>0)) {
|
||||
$search_sql = "";
|
||||
foreach($parts as $p) {
|
||||
if($p!="") $search_sql .= (($search_sql!="") ? " OR " : "").buildPaniersTypesListSearchSQL($p);
|
||||
}
|
||||
if($search_sql!="") $sql .= " AND (".$search_sql.")";
|
||||
}
|
||||
}
|
||||
$sql = buildSqlSearch($sql, $search, buildPaniersTypesListSearchSQL);
|
||||
|
||||
// GROUPE
|
||||
if($groupe>0) $sql .= " AND ".PANIERS_TYPES_TABLE.".`groupe`=".intval($groupe);
|
||||
|
|
@ -46,6 +49,9 @@ function getPaniersTypesList($order='nom',$sens='ASC', $search=false, $groupe=0)
|
|||
if($sens=='DESC') $sql .= ' DESC';
|
||||
else $sql .= ' ASC';
|
||||
|
||||
// LIMITS
|
||||
if(is_array($limits)) $sql .= " LIMIT ".$limits['start'].", ".$limits['nbItemsByPage'];
|
||||
|
||||
$r = $GLOBALS['db_admin']['man']->select($sql);
|
||||
|
||||
if(!$r['erreur']) {
|
||||
|
|
|
|||
|
|
@ -163,12 +163,16 @@ DEFAULT CHARSET=utf8;
|
|||
CREATE TABLE `legumes_tarifs` (
|
||||
`ref` smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`legume` smallint(5) UNSIGNED NOT NULL,
|
||||
`groupe` smallint(5) UNSIGNED NULL DEFAULT NULL,
|
||||
`prix` float(5,2) UNSIGNED NOT NULL,
|
||||
`unite` set('kg','pièce','botte') NOT NULL DEFAULT 'kg',
|
||||
`date` date NOT NULL,
|
||||
`archive` tinyint(1) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`del` tinyint(1) UNSIGNED NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`ref`),
|
||||
CONSTRAINT `legumes_tarifs_legume_fk` FOREIGN KEY (`legume`) REFERENCES `legumes`(`ref`) ON DELETE RESTRICT ON UPDATE RESTRICT,
|
||||
CONSTRAINT `legumes_tarifs_legume_fk` FOREIGN KEY (`legume`) REFERENCES `legumes`(`ref`) ON DELETE RESTRICT ON UPDATE RESTRICT,
|
||||
CONSTRAINT `legumes_tarifs_groupe_fk` FOREIGN KEY (`groupe`) REFERENCES `paniers_groupes`(`ref`) ON DELETE RESTRICT ON UPDATE RESTRICT,
|
||||
INDEX (`archive`),
|
||||
INDEX (`del`)
|
||||
)
|
||||
ENGINE=InnoDB
|
||||
|
|
|
|||
|
|
@ -95,12 +95,30 @@ switch($action) {
|
|||
case "autocomplete_list": die( json_encode( getClientsAutocompleteList() ) ); break;
|
||||
// DEFAULT - LIST
|
||||
default: {
|
||||
// LIST
|
||||
// SEARCH
|
||||
$search = getSearch("clients_search");
|
||||
|
||||
// LIMITS
|
||||
$limits = array("start" => 0, "end" => LIST_NB_LIGNES_PAR_PAGE, "nbItemsByPage" => LIST_NB_LIGNES_PAR_PAGE, "max" => getNbClientsInList($search));
|
||||
if(isset($_REQUEST['startListAt']) && (int)$_REQUEST['startListAt']>0) {
|
||||
$limits['start'] = intval($_REQUEST['startListAt']);
|
||||
$limits['end'] = $limits['start'] + $limits['nbItemsByPage'];
|
||||
if($limits['end'] > $limits['max']) $limits['end'] = $limits['max'];
|
||||
}
|
||||
$limits['rest'] = $limits['max'] - $limits['end'];
|
||||
$GLOBALS['smarty'] -> assign('list_limits',$limits);
|
||||
|
||||
// LIST
|
||||
$order = getListOrder('clients_list_order', 'clients_list_sens', $allowClientsListOrder, 'prenom');
|
||||
$list = getClientsList($order["order"], $order["sens"], false, $search);
|
||||
$list = getClientsList($order["order"], $order["sens"], false, $search, $limits);
|
||||
$GLOBALS['smarty'] -> assign('list',$list);
|
||||
|
||||
// LIST PART
|
||||
if(isset($_REQUEST['startListAt']) && (int)$_REQUEST['startListAt']>0) {
|
||||
$limits["list"] = $GLOBALS['smarty']->fetch("clients/clients_list_builder.tpl");
|
||||
die(json_encode($limits));
|
||||
}
|
||||
|
||||
// TEMPLATE
|
||||
$GLOBALS['template'] = 'clients/clients_list.tpl';
|
||||
$jsFiles[] = PUBLIC_HTML_ADMIN.'js/clients.js';
|
||||
|
|
|
|||
|
|
@ -140,12 +140,30 @@ switch($action) {
|
|||
"archive" => getRequestAndSessionSave("archive", "livraisons_filtre_archive", "archive", "int", 0, array(-1,0,1))
|
||||
);
|
||||
|
||||
// LIST
|
||||
// SEARCH
|
||||
$search = getSearch("contrats_search");
|
||||
|
||||
// LIMITS
|
||||
$limits = array("start" => 0, "end" => LIST_NB_LIGNES_PAR_PAGE, "nbItemsByPage" => LIST_NB_LIGNES_PAR_PAGE, "max" => getNbContratsInList($filtres, $search));
|
||||
if(isset($_REQUEST['startListAt']) && (int)$_REQUEST['startListAt']>0) {
|
||||
$limits['start'] = intval($_REQUEST['startListAt']);
|
||||
$limits['end'] = $limits['start'] + $limits['nbItemsByPage'];
|
||||
if($limits['end'] > $limits['max']) $limits['end'] = $limits['max'];
|
||||
}
|
||||
$limits['rest'] = $limits['max'] - $limits['end'];
|
||||
$GLOBALS['smarty'] -> assign('list_limits',$limits);
|
||||
|
||||
// LIST
|
||||
$order = getListOrder('contrats_list_order', 'contrats_list_sens', $allowContratsListOrder, 'prenom');
|
||||
$list = getContratsList($order["order"], $order["sens"], $filtres, $search);
|
||||
$list = getContratsList($order["order"], $order["sens"], $filtres, $search, $limits);
|
||||
$GLOBALS['smarty'] -> assign('list',$list);
|
||||
|
||||
// LIST PART
|
||||
if(isset($_REQUEST['startListAt']) && (int)$_REQUEST['startListAt']>0) {
|
||||
$limits["list"] = $GLOBALS['smarty']->fetch("contrats/contrats_list_builder.tpl");
|
||||
die(json_encode($limits));
|
||||
}
|
||||
|
||||
// TEMPLATE
|
||||
$GLOBALS['template'] = 'contrats/contrats_list.tpl';
|
||||
$jsFiles[] = PUBLIC_HTML_ADMIN.'js/contrats.js';
|
||||
|
|
|
|||
|
|
@ -117,6 +117,59 @@ div.intl-tel-input { display: block; }
|
|||
font-style: italic;
|
||||
}
|
||||
|
||||
/* LIST */
|
||||
|
||||
table.scrollingTableList { margin: 0; }
|
||||
|
||||
table.scrollingTableList ::-webkit-scrollbar {
|
||||
-webkit-appearance: none;
|
||||
width: 16px;
|
||||
background-color: rgba(51, 122, 183, .2);
|
||||
}
|
||||
|
||||
table.scrollingTableList ::-webkit-scrollbar-thumb {
|
||||
border-radius: 4px;
|
||||
background-color: rgba(51, 122, 183, .5);
|
||||
box-shadow: 0 0 1px rgba(51, 122, 183, .5);
|
||||
}
|
||||
|
||||
table.scrollingTableList tbody { display: block; overflow: auto; margin: 0; }
|
||||
|
||||
table.scrollingTableList tbody tr:first-child td { border: none; }
|
||||
|
||||
table.scrollingTableList thead, table.scrollingTableList tbody tr {
|
||||
display: table;
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
table.scrollingTableList:not(.no-scroll) thead { width: calc( 100% - 16px ); }
|
||||
|
||||
table.scrollingTableList th.id, table.scrollingTableList td.id { width: 45px; }
|
||||
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; }
|
||||
table.scrollingTableList th.email, table.scrollingTableList td.email { width: 300px; }
|
||||
table.scrollingTableList th.contrat_type, table.scrollingTableList td.contrat_type { width: 300px; }
|
||||
table.scrollingTableList th.panier_type, table.scrollingTableList td.panier_type { width: 160px; }
|
||||
table.scrollingTableList th.date, table.scrollingTableList td.date { width: 140px; }
|
||||
table.scrollingTableList th.freq, table.scrollingTableList td.freq { width: 160px; }
|
||||
table.scrollingTableList th.lieu, table.scrollingTableList td.lieu { width: 200px; }
|
||||
table.scrollingTableList th.items_long, table.scrollingTableList td.items_long { width: 120px; }
|
||||
table.scrollingTableList th.items, table.scrollingTableList td.items { width: 55px; }
|
||||
table.scrollingTableList th.btn_action, table.scrollingTableList td.td_btn_action { width: 30px; }
|
||||
table.scrollingTableList th.btn_action[colspan="2"] { width: 60px; }
|
||||
table.scrollingTableList th.btn_action[colspan="3"] { width: 90px; }
|
||||
|
||||
table.scrollingTableList td.loader {
|
||||
background-color: rgba(161, 95, 150, .1);
|
||||
height: 100px;
|
||||
background-image: url('../img/wait.svg');
|
||||
background-position: center;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
/* FEEDBACKS */
|
||||
|
||||
span.form-control-feedback { position: absolute; }
|
||||
|
|
@ -448,6 +501,22 @@ table.modal-body tr:last-child td:first-child { border-bottom-left-radius: 6px;
|
|||
table.modal-body tr:last-child th:first-child { border-bottom-left-radius: 6px; }
|
||||
table.modal-body tr:last-child td:last-child { border-bottom-right-radius: 6px; }
|
||||
|
||||
/* INLINE SELECT MANAGER */
|
||||
|
||||
.btnSecondAction {
|
||||
border-radius: 0;
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
/* FORM TABS */
|
||||
|
||||
div.formTabs div.tab:not(.active) { display: none; }
|
||||
|
||||
div.formTabs div.tab { overflow-y: scroll; }
|
||||
|
||||
div.formTabs table.modal-body tr:first-child th,
|
||||
div.formTabs table.modal-body tr:first-child td { border-top: none; }
|
||||
|
||||
/* PANIER FORM */
|
||||
|
||||
.formPanier .btnGroupeSecondAction {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#modalViewContrat .formContrat { margin: -15px; }
|
||||
|
||||
#modalViewContrat div.tabPaniers table { margin-bottom: 0!important; }
|
||||
|
||||
/* NAV TABS */
|
||||
|
||||
.formContrat ul.nav.nav-tabs { padding-left: 10px; }
|
||||
|
|
|
|||
|
|
@ -12,28 +12,28 @@
|
|||
|
||||
.formLivraison ul.nav.nav-tabs { padding-left: 10px; }
|
||||
|
||||
div.formLivraisonTabs > div.tab {
|
||||
.formLivraison div.formTabs > div.tab {
|
||||
display: none;
|
||||
border-bottom-left-radius: 6px;
|
||||
border-bottom-right-radius: 6px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
div.formLivraisonTabs > div.tab.active { display: block; }
|
||||
.formLivraison div.formTabs > div.tab.active { display: block; }
|
||||
|
||||
div.formLivraisonTabs > div.tab span.nullChild { display: block; padding: 10px; }
|
||||
.formLivraison div.formTabs > div.tab span.nullChild { display: block; padding: 10px; }
|
||||
|
||||
/* TAB GENERAL */
|
||||
|
||||
#modalAddLivraison div.formLivraisonTabs > div.tabGeneral,
|
||||
#modalEditLivraison div.formLivraisonTabs > div.tabGeneral { padding: 15px; }
|
||||
#modalAddLivraison div.formTabs > div.tabGeneral,
|
||||
#modalEditLivraison div.formTabs > div.tabGeneral { padding: 15px; }
|
||||
|
||||
div.formLivraisonTabs > div.tabGeneral table,
|
||||
div.formLivraisonTabs > div.tabGeneral div.form-group:last-child { margin-bottom: 0; }
|
||||
.formLivraison div.formTabs > div.tabGeneral table,
|
||||
.formLivraison div.formTabs > div.tabGeneral div.form-group:last-child { margin-bottom: 0; }
|
||||
|
||||
div.formLivraisonTabs > div.tabGeneral table tr:first-child > th,
|
||||
div.formLivraisonTabs > div.tabGeneral table tr:first-child > td { border-top: none; }
|
||||
.formLivraison div.formTabs > div.tabGeneral table tr:first-child > th,
|
||||
.formLivraison div.formTabs > div.tabGeneral table tr:first-child > td { border-top: none; }
|
||||
|
||||
div.formLivraisonTabs > div.tabGeneral table th { width: 160px; }
|
||||
.formLivraison div.formTabs > div.tabGeneral table th { width: 160px; }
|
||||
|
||||
/* TABLE PANIER */
|
||||
|
||||
|
|
@ -71,7 +71,8 @@ div.formLivraisonTabs > div.tabGeneral table th { width: 160px; }
|
|||
.formLivraison table.panier th.titre small { font-size: 0.75em; font-weight: 400; font-style: italic; }
|
||||
.formLivraison table.panier th.total { text-align: right; vertical-align: bottom; }
|
||||
.formLivraison table.panier th.total.unite { text-align: left; }
|
||||
.formLivraison table.panier th.action { padding-top: 0!important; }
|
||||
.formLivraison table.panier th.action { padding-top: 0!important; text-align: center; }
|
||||
.formLivraison table.panier th.action .btnCopyCompo { margin-top: -3px; }
|
||||
|
||||
.formLivraison table.panier tr.head > th {
|
||||
background-color: #3296c8;
|
||||
|
|
@ -105,26 +106,26 @@ div.formLivraisonTabs > div.tabGeneral table th { width: 160px; }
|
|||
|
||||
/* TAB PANIERS */
|
||||
|
||||
div.formLivraisonTabs > div.tabPaniers input[type=checkbox] { cursor: pointer; }
|
||||
.formLivraison div.formTabs > div.tabPaniers input[type=checkbox] { cursor: pointer; }
|
||||
|
||||
div.formLivraisonTabs > div.tabPaniers table.panier tbody div.tooltip { max-width: 170px; }
|
||||
.formLivraison div.formTabs > div.tabPaniers table.panier tbody div.tooltip { max-width: 170px; }
|
||||
|
||||
div.formLivraisonTabs > div.tabPaniers tr.panier { cursor: pointer; }
|
||||
div.formLivraisonTabs > div.tabPaniers tr.panier.absent,
|
||||
div.formLivraisonTabs > div.tabPaniers tr.panier.absent input[type=checkbox] { cursor: not-allowed; }
|
||||
.formLivraison div.formTabs > div.tabPaniers tr.panier { cursor: pointer; }
|
||||
.formLivraison div.formTabs > div.tabPaniers tr.panier.absent,
|
||||
.formLivraison div.formTabs > div.tabPaniers tr.panier.absent input[type=checkbox] { cursor: not-allowed; }
|
||||
|
||||
/* TAB COMPO */
|
||||
|
||||
div.formLivraisonTabs > div.tabCompo table.panier { margin: 10px 0; }
|
||||
.formLivraison div.formTabs > div.tabCompo table.panier { margin: 10px 0; }
|
||||
|
||||
div.formLivraisonTabs > div.tabCompo table.panier tr.legume.editable td.nom,
|
||||
div.formLivraisonTabs > div.tabCompo table.panier tr.legume.editable td.quantite { cursor: pointer; }
|
||||
.formLivraison div.formTabs > div.tabCompo table.panier tr.legume.editable td.nom,
|
||||
.formLivraison div.formTabs > div.tabCompo table.panier tr.legume.editable td.quantite { cursor: pointer; }
|
||||
|
||||
/* TAB LEGUMES */
|
||||
|
||||
div.formLivraisonTabs > div.tabLegumes table.panier { margin-top: 10px; }
|
||||
div.formLivraisonTabs > div.tabLegumes table.panier th.total.montant { font-size: 1.5em; }
|
||||
div.formLivraisonTabs > div.tabLegumes table.panier th.total.unite { font-size: 1.5em; }
|
||||
.formLivraison div.formTabs > div.tabLegumes table.panier { margin-top: 10px; }
|
||||
.formLivraison div.formTabs > div.tabLegumes table.panier th.total.montant { font-size: 1.5em; }
|
||||
.formLivraison div.formTabs > div.tabLegumes table.panier th.total.unite { font-size: 1.5em; }
|
||||
|
||||
/* PRINT */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,121 +1,80 @@
|
|||
// SEARCH
|
||||
var clientsSearch = false;
|
||||
// SETTINGS
|
||||
var clientsConf = {
|
||||
type : "client",
|
||||
baseURL : "clients.php",
|
||||
// LIST
|
||||
list_selector : "#clientsList",
|
||||
// SEARCH
|
||||
search_selector : "#clientsSearch .searchGrp",
|
||||
// VIEW
|
||||
view_modalSelector : "#modalViewClient",
|
||||
view_btnSelector : ".btnViewClient",
|
||||
// ADD
|
||||
add_modalSelector : "#modalAddClient",
|
||||
add_btnSelector : "#btnAddClient",
|
||||
// EDIT
|
||||
edit_modalSelector : "#modalEditClient",
|
||||
edit_btnSelector : ".btnEditClient",
|
||||
// DELETE
|
||||
delete_modalSelector : "#modalDeleteClient",
|
||||
delete_btnSelector : ".btnDeleteClient",
|
||||
}
|
||||
|
||||
// VIEW
|
||||
var modalViewClient = false;
|
||||
var btnViewClient = false;
|
||||
var currentViewClient = 0;
|
||||
|
||||
var clientsBaseURL = "clients.php";
|
||||
|
||||
// ADD
|
||||
var modalAddClient = false;
|
||||
var formAddClient = false;
|
||||
var btnAddClient = false;
|
||||
|
||||
// EDIT
|
||||
var modalEditClient = false;
|
||||
var formEditClient = false;
|
||||
var btnEditClient = false;
|
||||
var currentEditClient = 0;
|
||||
|
||||
// DELETE
|
||||
var modalDeleteClient = false;
|
||||
var btnDeleteClient = false;
|
||||
var currentDeleteClient = 0;
|
||||
// MODALS
|
||||
var modalViewClient = false;
|
||||
var modalAddClient = false;
|
||||
var modalEditClient = false;
|
||||
var modalDeleteClient = false;
|
||||
|
||||
$(document).ready( function() {
|
||||
// INIT SEARCH
|
||||
clientsSearch = $("#clientsSearch");
|
||||
if(clientsSearch.length>0) initSearchClients();
|
||||
// LIST LOADER
|
||||
initListProgressLoad($(clientsConf.list_selector), clientsConf.baseURL, clientsConf.type+" list");
|
||||
|
||||
// INIT VIEW CLIENT
|
||||
modalViewClient = $("#modalViewClient");
|
||||
btnViewClient = $(".btnViewClient");
|
||||
if(modalViewClient.length>0 && btnViewClient.length>0) {
|
||||
// SEARCH
|
||||
$(clientsConf.search_selector).initSearchGroup();
|
||||
|
||||
// VIEW
|
||||
modalViewClient = $(clientsConf.view_modalSelector);
|
||||
if(modalViewClient.length>0) {
|
||||
initViewClient();
|
||||
// VIEW REQUEST
|
||||
var id = getUrlParameter("id");
|
||||
if(id!==false && parseInt(id)>0) loadDatasInViewClientModal(id);
|
||||
var id = getUrlParameter("ref");
|
||||
if(id!==false && parseInt(id)>0 && current_page == "clients") {
|
||||
modalViewClient_clear(modalViewClient);
|
||||
modalViewClient_loadDatas(modalViewClient, id);
|
||||
}
|
||||
}
|
||||
|
||||
// INIT ADD CLIENT
|
||||
modalAddClient = $("#modalAddClient");
|
||||
formAddClient = $("#formAddClient");
|
||||
btnAddClient = $("#btnAddClient");
|
||||
if(modalAddClient.length>0 && formAddClient.length>0 && btnAddClient.length>0) initAddClient();
|
||||
// ADD
|
||||
modalAddClient = $(clientsConf.add_modalSelector);
|
||||
if(modalAddClient.length>0) initAddClient();
|
||||
|
||||
// INIT EDIT CLIENT
|
||||
modalEditClient = $("#modalEditClient");
|
||||
formEditClient = $("#formEditClient");
|
||||
btnEditClient = $(".btnEditClient");
|
||||
if(modalEditClient.length>0 && formEditClient.length>0 && btnEditClient.length>0) initEditClient();
|
||||
// EDIT
|
||||
modalEditClient = $(clientsConf.edit_modalSelector);
|
||||
if(modalEditClient.length>0) initEditClient();
|
||||
|
||||
// INIT DELETE CLIENT
|
||||
modalDeleteClient = $("#modalDeleteClient");
|
||||
btnDeleteClient = $(".btnDeleteClient");
|
||||
if(modalDeleteClient.length>0 && btnDeleteClient.length>0) initDeleteClient();
|
||||
// DELETE
|
||||
modalDeleteClient = $(clientsConf.delete_modalSelector);
|
||||
if(modalDeleteClient.length>0) initDeleteClient();
|
||||
});
|
||||
|
||||
/***** SEARCH CLIENTS *****/
|
||||
function initSearchClients() {
|
||||
clientsSearch.find("input[name=search]").unbind('keypress').keypress( function(event) {
|
||||
if(event.keyCode==13) searchClient(false);
|
||||
});
|
||||
clientsSearch.find(".btnClearSearch").unbind('click').click( function(event) {
|
||||
searchClient(true);
|
||||
});
|
||||
}
|
||||
|
||||
function searchClient(clear) {
|
||||
clientsSearch.find("input[name=search]").blur();
|
||||
clientsSearch.find(".btnClearSearch").blur();
|
||||
if(clear) document.location = "?clearSearch";
|
||||
else document.location = "?search="+clientsSearch.find("input[name=search]").val();
|
||||
}
|
||||
|
||||
/***** VIEW CLIENT *****/
|
||||
/***** MODAL VIEW *****/
|
||||
function initViewClient() {
|
||||
// BTN VIEW
|
||||
btnViewClient.unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
id = parseInt($(this).attr('ref'));
|
||||
if(!id>0) return;
|
||||
clearViewClientModal();
|
||||
currentViewClient = id;
|
||||
loadDatasInViewClientModal(id);
|
||||
});
|
||||
|
||||
// INIT FORM VIEW
|
||||
var form = modalViewClient.find("div.formClient");
|
||||
// INIT VIEW BTNs
|
||||
var initBtnFct = function() { modalForm_initBtnView(
|
||||
$(clientsConf.view_btnSelector), // BTNs
|
||||
modalViewClient, // MODAL
|
||||
modalViewClient_clear, // CLEAR FUNCTION
|
||||
modalViewClient_loadDatas // LOAD DATAS FUNCTION
|
||||
)};
|
||||
registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct );
|
||||
initBtnFct();
|
||||
|
||||
// TABS
|
||||
form.find("a.formClientTabBtn").click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// BTN
|
||||
if(!$(this).parent().hasClass("active")) {
|
||||
form.find("ul.formClientTabs > 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.formClientTabs > div.tab").removeClass("active");
|
||||
tab.addClass("active");
|
||||
}
|
||||
});
|
||||
resizeFormClient(form);
|
||||
$( window ).on( "resize", function() { resizeFormClient(form) });
|
||||
modalForm_initTabs(modalViewClient);
|
||||
|
||||
// CANCEL
|
||||
modalViewClient.on('hidden.bs.modal', function (e) {
|
||||
clearViewClientModal();
|
||||
currentViewClient = 0;
|
||||
});
|
||||
modalViewClient.on('hidden.bs.modal', function() { modalViewClient_clear(modalViewClient); });
|
||||
|
||||
// EMPECHE LA FERMETURE SI ON EST ENTRAIN D'EDITER UNE LIGNE D'ABSENCE
|
||||
modalViewClient.on('hide.bs.modal', function(e) {
|
||||
|
|
@ -123,58 +82,55 @@ function initViewClient() {
|
|||
});
|
||||
}
|
||||
|
||||
function resizeFormClient(form) {
|
||||
var wh = window.innerHeight;
|
||||
form.find("div.formClientTabs div.tab").css("max-height", (wh-180)+"px");
|
||||
}
|
||||
function modalViewClient_loadDatas(modal, id) {
|
||||
$.post(clientsConf.baseURL, { 'ref' : id, 'action' : 'getDatas' }, function(jsonTxt) {
|
||||
var datas = JSON.parse(jsonTxt);
|
||||
|
||||
function loadDatasInViewClientModal(id) {
|
||||
datas = {
|
||||
'ref' : id,
|
||||
'action' : 'getDatas'
|
||||
};
|
||||
$.post( clientsBaseURL, datas, function( result ) {
|
||||
var datas = JSON.parse(result);
|
||||
modal.find("small.db_ref > span").html(datas.ref);
|
||||
|
||||
currentViewClient = parseInt(datas.ref);
|
||||
modalViewClient.find("small.db_ref > span").html(datas.ref);
|
||||
|
||||
modalViewClient.find("td.nom").html(datas.prenom+" "+datas.nom);
|
||||
modalViewClient.find("td.tel").html( (datas.tel!="" && datas.tel!=null) ? '<a href="tel:'+datas.tel+'">'+datas.tel+'</a>' : "." );
|
||||
modalViewClient.find("td.email").html( (datas.email!="" && datas.email!=null) ? '<a href="mailto:'+datas.email+'">'+datas.email+'</a>' : ".");
|
||||
modal.find("td.nom").html(datas.prenom+" "+datas.nom);
|
||||
modal.find("td.tel").html( (datas.tel!="" && datas.tel!=null) ? '<a href="tel:'+datas.tel+'">'+datas.tel+'</a>' : "." );
|
||||
modal.find("td.email").html( (datas.email!="" && datas.email!=null) ? '<a href="mailto:'+datas.email+'">'+datas.email+'</a>' : ".");
|
||||
|
||||
// CONTRATS
|
||||
$.post(clientsBaseURL, { 'ref' : id, 'action' : 'modalView_getTab', 'tab' : 'contrats' }, function(result) {
|
||||
modalViewClient.find("div.tabContrats").html(result);
|
||||
}).fail(function() { alert(srvErrorMsg+" (load modal view client - tab contrats)"); });
|
||||
$.post(clientsConf.baseURL, { 'ref' : id, 'action' : 'modalView_getTab', 'tab' : 'contrats' }, function(result) {
|
||||
modal.find("div.tabContrats").html(result);
|
||||
}).fail(function() { alert("ERREUR SERVEUR ! (client modal view - load tab contrats)"); });
|
||||
// ABSENCES
|
||||
loadModalViewTabAbsences();
|
||||
modalViewClient_loadTabAbsences();
|
||||
|
||||
modalViewClient.modal('show');
|
||||
}).fail(function() { alert(srvErrorMsg+" (load modal view client)"); });
|
||||
modal.modal('show');
|
||||
}).fail(function() { alert("("+clientsConf.type+" - load modal view)"); });
|
||||
}
|
||||
|
||||
function clearViewClientModal() {
|
||||
modalViewClient.find("small.db_ref > span").html("");
|
||||
function modalViewClient_clear(modal) {
|
||||
modal.removeAttr("view_id");
|
||||
|
||||
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");
|
||||
modal.find("small.db_ref > span").html("");
|
||||
|
||||
modalViewClient.find("td.nom").html("");
|
||||
modalViewClient.find("td.tel").html("");
|
||||
modalViewClient.find("td.email").html("");
|
||||
modalForm_resetTabs(modal);
|
||||
|
||||
modalViewClient.find("div.tabContrats").html("");
|
||||
modalViewClient.find("div.tabAbsences").html("");
|
||||
modal.find("td.nom").html("");
|
||||
modal.find("td.tel").html("");
|
||||
modal.find("td.email").html("");
|
||||
|
||||
modal.find("div.tabContrats").html("");
|
||||
modal.find("div.tabAbsences").html("");
|
||||
|
||||
modal.find("table.modal-body tfoot").addClass("hide").find("tr:not(.header)").remove();
|
||||
}
|
||||
|
||||
function initModalViewClientTabAbsences() {
|
||||
function modalViewClient_loadTabAbsences() {
|
||||
$.post(clientsConf.baseURL, { 'ref' : modalViewClient.attr("view_id"), 'action' : 'modalView_getTab', 'tab' : 'absences' }, function(result) {
|
||||
modalViewClient.find("div.tabAbsences").html(result);
|
||||
modalViewClient_initTabAbsences();
|
||||
}).fail(function() { alert(srvErrorMsg+" (load modal view client - tab absences)"); });
|
||||
}
|
||||
|
||||
function modalViewClient_initTabAbsences() {
|
||||
// BTN ADD ABSENCES
|
||||
modalViewClient.find("#btnAddAbsence").click(function(e) {
|
||||
e.preventDefault();
|
||||
$(this).blur();
|
||||
e.preventDefault(); $(this).blur();
|
||||
|
||||
var tr = $("<tr ref='new'></tr>").html( modalViewClient.find("tr.absenceNewRowTemplate").html() );
|
||||
modalViewClient.find("div.tabAbsences table tbody").append(tr);
|
||||
|
|
@ -182,14 +138,14 @@ function initModalViewClientTabAbsences() {
|
|||
nullChild = modalViewClient.find("div.tabAbsences table tbody tr.nullChild");
|
||||
if(nullChild.length>0) nullChild.remove();
|
||||
|
||||
initModalViewClientAbsenceRow(tr);
|
||||
modalViewClient_initAbsenceRow(tr);
|
||||
});
|
||||
|
||||
// INIT ROWS
|
||||
modalViewClient.find("div.tabAbsences table tbody tr.absence").each(function(n,e) { initModalViewClientAbsenceRow($(this)); })
|
||||
modalViewClient.find("div.tabAbsences table tbody tr.absence").each(function(n,e) { modalViewClient_initAbsenceRow($(this)); })
|
||||
}
|
||||
|
||||
function initModalViewClientAbsenceRow(row) {
|
||||
function modalViewClient_initAbsenceRow(row) {
|
||||
var ref = row.attr("ref"); if(parseInt(ref)>0) ref = parseInt(ref);
|
||||
|
||||
var tdDebut = row.find("td.debut"); var tdFin = row.find("td.fin"); var tdRmq = row.find("td.remarque");
|
||||
|
|
@ -229,24 +185,25 @@ function initModalViewClientAbsenceRow(row) {
|
|||
var btnDel = row.find("button.btnDeleteAbsence");
|
||||
|
||||
btnEdit.click(function(e) {
|
||||
e.preventDefault();
|
||||
$(this).blur();
|
||||
e.preventDefault(); $(this).blur();
|
||||
if(modalViewClient.find("tr.editable").length>0 && !row.hasClass("editable")) return;
|
||||
|
||||
// SAVE
|
||||
if(row.hasClass("editable")) {
|
||||
iptDebut.blur(); iptFin.blur(); iptRmq.blur();
|
||||
datas = { 'client' : currentViewClient, 'debut' : debut, 'fin' : fin, 'remarque' : rmq };
|
||||
datas = {
|
||||
'client' : modalViewClient.attr("view_id"),
|
||||
'debut' : debut,
|
||||
'fin' : fin,
|
||||
'remarque' : rmq
|
||||
};
|
||||
if(ref=='new') datas.action = "add_client_absence";
|
||||
else { datas.action = "edit_client_absence"; datas.absence_ref = ref; }
|
||||
|
||||
$.post(clientsBaseURL, datas, function(result) {
|
||||
if(parseInt(result)>0) loadModalViewTabAbsences();
|
||||
else {
|
||||
console.error(result);
|
||||
alert(result);
|
||||
}
|
||||
}).fail(function() { alert(srvErrorMsg+" (modal view client - save absence)"); });
|
||||
$.post(clientsConf.baseURL, datas, function(result) {
|
||||
if(parseInt(result)>0) modalViewClient_loadTabAbsences();
|
||||
else { console.error(result); alert(result); }
|
||||
}).fail(function() { alert("ERREUR SERVEUR ! (modal view client - save absence)"); });
|
||||
}
|
||||
// EDIT
|
||||
else {
|
||||
|
|
@ -263,8 +220,7 @@ function initModalViewClientAbsenceRow(row) {
|
|||
});
|
||||
|
||||
btnDel.click(function(e) {
|
||||
e.preventDefault();
|
||||
$(this).blur();
|
||||
e.preventDefault(); $(this).blur();
|
||||
if(modalViewClient.find("tr.editable").length>0 && !row.hasClass("editable")) return;
|
||||
|
||||
// CANCEL
|
||||
|
|
@ -286,13 +242,10 @@ function initModalViewClientAbsenceRow(row) {
|
|||
else {
|
||||
if(!ref>0) return;
|
||||
if(confirm("Êtes-vous sur de vouloir supprimer cette absence ?")) {
|
||||
$.post(clientsBaseURL, { 'action': "delete_client_absence", 'absence_ref': ref }, function(result) {
|
||||
if(parseInt(result)>0) loadModalViewTabAbsences();
|
||||
else {
|
||||
console.error(result);
|
||||
alert(result);
|
||||
}
|
||||
}).fail(function() { alert(srvErrorMsg+" (modal view client - delete absence)"); });
|
||||
$.post(clientsConf.baseURL, { 'action': "delete_client_absence", 'absence_ref': ref }, function(result) {
|
||||
if(parseInt(result)>0) modalViewClient_loadTabAbsences();
|
||||
else { console.error(result); alert(result); }
|
||||
}).fail(function() { alert("ERREUR SERVEUR ! (modal view client - delete absence)"); });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -300,220 +253,148 @@ function initModalViewClientAbsenceRow(row) {
|
|||
if(ref == "new") row.find("button.btnEditAbsence").click();
|
||||
}
|
||||
|
||||
function loadModalViewTabAbsences() {
|
||||
$.post(clientsBaseURL, { 'ref' : currentViewClient, 'action' : 'modalView_getTab', 'tab' : 'absences' }, function(result) {
|
||||
modalViewClient.find("div.tabAbsences").html(result);
|
||||
initModalViewClientTabAbsences();
|
||||
}).fail(function() { alert(srvErrorMsg+" (load modal view client - tab absences)"); });
|
||||
}
|
||||
|
||||
/***** FORM CLIENT *****/
|
||||
function initFormClient(form) {
|
||||
form.on("submit", function(e) { e.preventDefault(); });
|
||||
/***** MODAL FORM ADD/EDIT *****/
|
||||
function modalFormClient_init(modal) {
|
||||
modal.find("form").on("submit", function(e) { e.preventDefault(); });
|
||||
|
||||
// NOM
|
||||
initUpperCaseInput(form.find("input[name=nom]"), null, function() { $(this).blur(); });
|
||||
initUpperCaseInput(modal.find("input[name=nom]"), null, function() { $(this).blur(); });
|
||||
// PRENOM
|
||||
initFirstUpperCaseInput(form.find("input[name=prenom]"), null, function() { $(this).blur(); });
|
||||
initFirstUpperCaseInput(modal.find("input[name=prenom]"), null, function() { $(this).blur(); });
|
||||
// TEL
|
||||
initTelInput(form.find("input[name=tel]"), true, "libs/intl-tel-input-15.0.0/build/js/utils.js");
|
||||
initTelInput(modal.find("input[name=tel]"), true, "libs/intl-tel-input-15.0.0/build/js/utils.js");
|
||||
// EMAIL
|
||||
initEmailInput(form.find("input[name=email]"));
|
||||
initEmailInput(modal.find("input[name=email]"));
|
||||
}
|
||||
|
||||
function loadDatasInFormClientDatas(modal,form,id) {
|
||||
datas = {
|
||||
'ref' : id,
|
||||
'action' : 'getDatas'
|
||||
};
|
||||
$.post( clientsBaseURL, datas, function( result ) {
|
||||
var datas = JSON.parse(result);
|
||||
function modalFormClient_loadDatas(modal,id) {
|
||||
$.post(clientsConf.baseURL, { 'ref' : id, 'action' : 'getDatas' }, function(jsonTxt) {
|
||||
var datas = JSON.parse(jsonTxt);
|
||||
|
||||
form.find("input[name=nom]").val(datas.nom);
|
||||
form.find("input[name=prenom]").val(datas.prenom);
|
||||
form.find("input[name=tel]").val(datas.tel);
|
||||
form.find("input[name=email]").val(datas.email);
|
||||
modal.find("input[name=nom]").val(datas.nom);
|
||||
modal.find("input[name=prenom]").val(datas.prenom);
|
||||
modal.find("input[name=tel]").val(datas.tel);
|
||||
modal.find("input[name=email]").val(datas.email);
|
||||
|
||||
if(modal) modal.modal('show');
|
||||
}).fail(function() { alert(srvErrorMsg+" (form client - load datas)"); });
|
||||
}).fail(function() { alert("("+clientsConf.type+" - load datas in modal form)"); });
|
||||
}
|
||||
|
||||
function clearFormClientDatas(form) {
|
||||
form.find("input[name=nom]").val("");
|
||||
form.find("input[name=prenom]").val("");
|
||||
form.find("input[name=tel]").val("");
|
||||
form.find("input[name=email]").val("");
|
||||
function modalFormClient_clear(modal) {
|
||||
modal.removeAttr("edit_id");
|
||||
modal.find("div.modaLoader").removeClass("show");
|
||||
|
||||
// MODALOADER
|
||||
form.find("div.modaLoader").removeClass("show");
|
||||
modal.find("input[name=nom]").val("");
|
||||
modal.find("input[name=prenom]").val("");
|
||||
modal.find("input[name=tel]").val("");
|
||||
modal.find("input[name=email]").val("");
|
||||
}
|
||||
|
||||
// GET FORM DATAS
|
||||
|
||||
function getClientFormDatas(form) {
|
||||
function modalFormClient_getDatas(modal) {
|
||||
var datas = {
|
||||
'nom' : form.find("input[name=nom]").val(),
|
||||
'prenom' : form.find("input[name=prenom]").val(),
|
||||
'tel' : form.find("input[name=tel]").intlTelInput("isValidNumber") ? form.find("input[name=tel]").val() : "",
|
||||
'email' : validateEmail(form.find("input[name=email]").val()) ? form.find("input[name=email]").val() : "",
|
||||
'nom' : modal.find("input[name=nom]").val(),
|
||||
'prenom' : modal.find("input[name=prenom]").val(),
|
||||
'tel' : modal.find("input[name=tel]").intlTelInput("isValidNumber") ? modal.find("input[name=tel]").val() : "",
|
||||
'email' : validateEmail(modal.find("input[name=email]").val()) ? modal.find("input[name=email]").val() : ""
|
||||
};
|
||||
return datas;
|
||||
}
|
||||
|
||||
/***** ADD CLIENT *****/
|
||||
function modalFormClient_checkDatas(datas) {
|
||||
if(datas.nom=="" || datas.prenom=="") {
|
||||
alert("ERREUR : au minimum, un nom et un prénom doivent être renseigné !");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/***** ADD *****/
|
||||
function initAddClient() {
|
||||
// BTN ADD
|
||||
btnAddClient.unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
clearFormClientDatas(formAddClient);
|
||||
modalAddClient.modal('show');
|
||||
});
|
||||
// INIT FORM
|
||||
modalFormClient_init(modalAddClient);
|
||||
|
||||
// INIT FORM ADD
|
||||
initFormClient(formAddClient);
|
||||
// INIT ADD BTN
|
||||
modalForm_initBtnAdd(
|
||||
$(clientsConf.add_btnSelector), // BTN ADD
|
||||
modalAddClient, // MODAL
|
||||
modalFormClient_clear // CLEAR FORM FUNCTION
|
||||
);
|
||||
|
||||
// SAVE CLIENT
|
||||
$(".btnSaveAddClient").unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var datas = getClientFormDatas(formAddClient);
|
||||
if(datas.nom=="" || datas.prenom=="") {
|
||||
alert("ERREUR : au minimum, un nom et un prénom doivent être renseigné !");
|
||||
return;
|
||||
}
|
||||
|
||||
datas.action = 'add';
|
||||
|
||||
formAddClient.find("div.modaLoader").addClass("show");
|
||||
$(".btnSaveAddClient").prop("disabled", true);
|
||||
|
||||
$.post( clientsBaseURL, datas, function( result ) {
|
||||
if(parseInt(result)>0) {
|
||||
modalAddClient.modal('hide');
|
||||
setTimeout(function() {
|
||||
document.location.reload();
|
||||
},200);
|
||||
}
|
||||
else {
|
||||
console.error(result);
|
||||
alert(result);
|
||||
formAddClient.find("div.modaLoader").removeClass("show");
|
||||
$(".btnSaveAddClient").prop("disabled", false);
|
||||
}
|
||||
}).fail(function() {
|
||||
alert(srvErrorMsg+" (add client)");
|
||||
formAddClient.find("div.modaLoader").removeClass("show");
|
||||
$(".btnSaveAddClient").prop("disabled", false);
|
||||
});
|
||||
});
|
||||
// INIT SAVE BTN
|
||||
modalForm_initBtnSaveAdd(
|
||||
modalAddClient.find(".btnSave"), // BTN SAVE
|
||||
clientsConf.type, // ADD TYPE
|
||||
modalAddClient, // MODAL
|
||||
modalFormClient_getDatas, // GET FORM DATAS FUNCTION
|
||||
modalFormClient_checkDatas, // CHECK FORM DATAS FUNCTION
|
||||
clientsConf.baseURL // SAVE URL
|
||||
);
|
||||
|
||||
// CANCEL
|
||||
modalAddClient.on('hidden.bs.modal', function (e) { clearFormClientDatas(formAddClient); });
|
||||
modalAddClient.on('hidden.bs.modal', function (e) { modalFormClient_clear(modalAddClient); });
|
||||
}
|
||||
|
||||
/***** EDIT CLIENT *****/
|
||||
/***** EDIT *****/
|
||||
function initEditClient() {
|
||||
// BTN EDIT
|
||||
btnEditClient.unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
id = parseInt($(this).attr('ref'));
|
||||
if(!id>0) return;
|
||||
currentEditClient = id;
|
||||
clearFormClientDatas(formEditClient);
|
||||
loadDatasInFormClientDatas(modalEditClient,formEditClient,id);
|
||||
});
|
||||
// INIT FORM
|
||||
modalFormClient_init(modalEditClient);
|
||||
|
||||
// INIT FORM EDIT
|
||||
initFormClient(formEditClient);
|
||||
// INIT EDIT BTNs
|
||||
var initBtnFct = function() { modalForm_initBtnEdit(
|
||||
$(clientsConf.edit_btnSelector), // BTNs
|
||||
modalEditClient, // MODAL
|
||||
modalFormClient_clear, // CLEAR FUNCTION
|
||||
modalFormClient_loadDatas // LOAD DATAS FUNCTION
|
||||
)};
|
||||
registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct );
|
||||
initBtnFct();
|
||||
|
||||
// SAVE CLIENT
|
||||
$(".btnSaveEditClient").unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
if(!currentEditClient>0) return;
|
||||
|
||||
var datas = getClientFormDatas(formEditClient);
|
||||
if(datas.nom=="" || datas.prenom=="") {
|
||||
alert("ERREUR : au minimum, un nom et un prénom doivent être renseigné !");
|
||||
return;
|
||||
}
|
||||
|
||||
datas.action = 'edit';
|
||||
datas.ref = currentEditClient;
|
||||
|
||||
formEditClient.find("div.modaLoader").addClass("show");
|
||||
$(".btnSaveEditClient").prop("disabled", true);
|
||||
|
||||
$.post( clientsBaseURL, datas, function( result ) {
|
||||
if(parseInt(result)>0) {
|
||||
modalEditClient.modal('hide');
|
||||
setTimeout(function() {
|
||||
document.location.reload();
|
||||
},200);
|
||||
}
|
||||
else {
|
||||
console.error(result);
|
||||
alert(result);
|
||||
formEditClient.find("div.modaLoader").removeClass("show");
|
||||
$(".btnSaveEditClient").prop("disabled", false);
|
||||
}
|
||||
}).fail(function() {
|
||||
alert(srvErrorMsg+" (edit client)");
|
||||
formEditClient.find("div.modaLoader").removeClass("show");
|
||||
$(".btnSaveEditClient").prop("disabled", false);
|
||||
});
|
||||
});
|
||||
// INIT SAVE EDIT BTN
|
||||
modalForm_initBtnSaveEdit(
|
||||
modalEditClient.find(".btnSave"), // BTN SAVE
|
||||
clientsConf.type, // EDIT TYPE
|
||||
modalEditClient, // MODAL
|
||||
modalFormClient_getDatas, // GET FORM DATAS FUNCTION
|
||||
modalFormClient_checkDatas, // CHECK FORM DATAS FUNCTION
|
||||
clientsConf.baseURL // SAVE URL
|
||||
);
|
||||
|
||||
// CANCEL
|
||||
modalEditClient.on('hidden.bs.modal', function (e) {
|
||||
clearFormClientDatas(formEditClient);
|
||||
currentEditClient = 0;
|
||||
});
|
||||
modalEditClient.on('hidden.bs.modal', function (e) { modalFormClient_clear(modalEditClient); });
|
||||
}
|
||||
|
||||
/***** DELETE CLIENT *****/
|
||||
/***** DELETE *****/
|
||||
function initDeleteClient() {
|
||||
// BTN DELETE
|
||||
btnDeleteClient.unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
id = parseInt($(this).attr('ref'));
|
||||
if(!id>0) return;
|
||||
currentDeleteClient = id;
|
||||
// INIT DELETE BTNs
|
||||
var initBtnFct = function() { modalForm_initBtnDelete(
|
||||
$(clientsConf.delete_btnSelector), // BTNs
|
||||
modalDeleteClient, // MODAL
|
||||
modalDeleteClient_clear, // CLEAR MODAL FUNCTION
|
||||
modalDeleteClient_loadDatas // LOAD DATAS FUNCTION
|
||||
)};
|
||||
registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct );
|
||||
initBtnFct();
|
||||
|
||||
modalDeleteClient.find('b.name').html( $(this).attr('nom') );
|
||||
|
||||
modalDeleteClient.modal('show');
|
||||
});
|
||||
|
||||
// DELETE
|
||||
$("#btnDeleteClient").unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
$(this).blur();
|
||||
|
||||
if(!currentDeleteClient>0) return;
|
||||
|
||||
var datas = {
|
||||
action : 'delete',
|
||||
ref : currentDeleteClient
|
||||
};
|
||||
|
||||
$.post( clientsBaseURL, datas, function( result ) {
|
||||
if(parseInt(result)>0) {
|
||||
modalEditClient.modal('hide');
|
||||
setTimeout(function() {
|
||||
document.location.reload();
|
||||
},200);
|
||||
}
|
||||
else {
|
||||
console.error(result);
|
||||
alert(result);
|
||||
}
|
||||
}).fail(function() { alert(srvErrorMsg+" (delete client)"); });
|
||||
});
|
||||
// INIT SAVE DELETE BTN
|
||||
modalForm_initBtnSaveDelete(
|
||||
modalDeleteClient.find(".btnSave"), // BTN SAVE
|
||||
clientsConf.type, // DELETE TYPE
|
||||
modalDeleteClient, // MODAL
|
||||
false, // GET FORM DATAS FUNCTION
|
||||
false, // CHECK FORM DATAS FUNCTION
|
||||
clientsConf.baseURL // SAVE URL
|
||||
);
|
||||
|
||||
// CANCEL
|
||||
modalDeleteClient.on('hidden.bs.modal', function (e) {
|
||||
modalDeleteClient.find('b.name').html("");
|
||||
currentDeleteClient = 0;
|
||||
});
|
||||
modalDeleteClient.on('hidden.bs.modal', function (e) { modalDeleteClient_clear(); });
|
||||
}
|
||||
|
||||
function modalDeleteClient_loadDatas(btn, id) {
|
||||
modalDeleteClient.find('b.name').html( btn.attr('nom') );
|
||||
modalDeleteClient.modal('show');
|
||||
}
|
||||
|
||||
function modalDeleteClient_clear() {
|
||||
modalDeleteClient.removeAttr("delete_id");
|
||||
modalDeleteClient.find('b.name').html("");
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -5,6 +5,632 @@ var array_keys_ponctuations = ['.','-','_','#','@'];
|
|||
var array_keys_minuscules = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
|
||||
var array_keys_majuscules = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
|
||||
|
||||
function isDefined(val){
|
||||
return (val === undefined || val == null || val.length <= 0) ? false : true;
|
||||
}
|
||||
|
||||
/* MODAL FORM UTIL */
|
||||
|
||||
function modalForm_initBtnView(btn, modal, clearFormFct, loadFormDatasFct) {
|
||||
btn.unbind('click').click( function(e) {
|
||||
e.preventDefault(); $(this).blur();
|
||||
id = parseInt($(this).attr('ref'));
|
||||
if(!id>0) return;
|
||||
clearFormFct(modal);
|
||||
modal.attr("view_id", id);
|
||||
loadFormDatasFct(modal, id);
|
||||
});
|
||||
}
|
||||
|
||||
function modalForm_initBtnAdd(btn, modal, clearFormFct) {
|
||||
btn.unbind('click').click( function(e) {
|
||||
e.preventDefault(); $(this).blur();
|
||||
clearFormFct(modal);
|
||||
modal.modal('show');
|
||||
});
|
||||
}
|
||||
|
||||
function modalForm_initBtnCopy(btn, modal, clearFormFct, loadFormDatasFct) {
|
||||
btn.unbind('click').click( function(e) {
|
||||
e.preventDefault(); $(this).blur();
|
||||
id = parseInt($(this).attr('ref'));
|
||||
if(!id>0) return;
|
||||
clearFormFct(modal);
|
||||
loadFormDatasFct(modal,id, true);
|
||||
});
|
||||
}
|
||||
|
||||
function modalForm_initBtnSaveAdd(btn, addType, modal, getModalFormDataFct, checkModalFormDataFct, saveURL) {
|
||||
btn.unbind('click').click( function(e) {
|
||||
e.preventDefault(); $(this).blur();
|
||||
|
||||
// GET & CHECK DATAS
|
||||
var datas = getModalFormDataFct(modal);
|
||||
console.log("modalForm_btnSaveAdd", datas);
|
||||
if( !checkModalFormDataFct(datas) ) return;
|
||||
datas.action = 'add';
|
||||
|
||||
// RUN REQUEST
|
||||
modalForm_runFormRequest( saveURL, datas, ("add "+addType) , modal, $(this) );
|
||||
});
|
||||
}
|
||||
|
||||
function modalForm_initBtnEdit(btn, modal, clearFormFct, loadFormDatasFct) {
|
||||
btn.unbind('click').click( function(e) {
|
||||
e.preventDefault(); $(this).blur();
|
||||
id = parseInt($(this).attr('ref'));
|
||||
if(!id>0) return;
|
||||
clearFormFct(modal);
|
||||
modal.attr("edit_id", id);
|
||||
loadFormDatasFct(modal,id);
|
||||
});
|
||||
}
|
||||
|
||||
function modalForm_initBtnSaveEdit(btn, editType, modal, getModalFormDataFct, checkModalFormDataFct, saveURL) {
|
||||
btn.unbind('click').click( function(e) {
|
||||
e.preventDefault(); $(this).blur();
|
||||
|
||||
// GET MODAL EDIT ID
|
||||
var id = parseInt( modal.attr("edit_id") );
|
||||
if(!id>0) return;
|
||||
|
||||
// GET & CHECK DATAS
|
||||
var datas = getModalFormDataFct(modal);
|
||||
console.log("modalForm_btnSaveEdit", datas);
|
||||
if( !checkModalFormDataFct(datas) ) return;
|
||||
datas.action = 'edit';
|
||||
datas.ref = id;
|
||||
|
||||
// RUN REQUEST
|
||||
modalForm_runFormRequest( saveURL, datas, ("edit "+editType) , modal, $(this) );
|
||||
});
|
||||
}
|
||||
|
||||
function modalForm_initBtnArchive(btn, modal, clearFormFct, loadFormDatasFct) {
|
||||
btn.unbind('click').click( function(e) {
|
||||
e.preventDefault(); $(this).blur();
|
||||
id = parseInt($(this).attr('ref'));
|
||||
if(!id>0) return;
|
||||
clearFormFct(modal);
|
||||
modal.attr("archive_id", id);
|
||||
loadFormDatasFct($(this),id);
|
||||
});
|
||||
}
|
||||
|
||||
function modalForm_initBtnSaveArchive(btn, archiveType, modal, saveURL) {
|
||||
btn.unbind('click').click( function(e) {
|
||||
e.preventDefault(); $(this).blur();
|
||||
|
||||
// GET MODAL DELETE ID
|
||||
var id = parseInt( modal.attr("archive_id") );
|
||||
if(!id>0) return;
|
||||
|
||||
// GET DATAS
|
||||
var datas = {
|
||||
'action' : 'archive',
|
||||
'ref' : id
|
||||
};
|
||||
console.log("ARCHIVE", id, datas );
|
||||
|
||||
// RUN REQUEST
|
||||
modalForm_runFormRequest( saveURL, datas, ("archive "+archiveType) , modal, $(this) );
|
||||
});
|
||||
}
|
||||
|
||||
function modalForm_initBtnUnarchive(btn, archiveType, modal, saveURL) {
|
||||
btn.unbind('click').click( function(e) {
|
||||
e.preventDefault(); $(this).blur();
|
||||
id = parseInt($(this).attr('ref'));
|
||||
if(!id>0) return;
|
||||
|
||||
var datas = {
|
||||
'action' : 'unarchive',
|
||||
'ref' : id
|
||||
};
|
||||
console.log("UNARCHIVE", id, datas );
|
||||
|
||||
// RUN REQUEST
|
||||
$.post( saveURL, datas, function( result ) {
|
||||
if(parseInt(result)>0) document.location.reload();
|
||||
else {
|
||||
console.error(result); alert(result);
|
||||
}
|
||||
}).fail(function(xhr) {
|
||||
var errMsg = "SERVER ERROR (unarchive "+archiveType+")";
|
||||
if( xhr['responseText']!="" ) errMsg += " : " + xhr['responseText'];
|
||||
console.error(errMsg); alert(errMsg);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function modalForm_initBtnDelete(btn, modal, clearFormFct, loadFormDatasFct) {
|
||||
btn.unbind('click').click( function(e) {
|
||||
e.preventDefault(); $(this).blur();
|
||||
id = parseInt($(this).attr('ref'));
|
||||
if(!id>0) return;
|
||||
clearFormFct(modal);
|
||||
modal.attr("delete_id", id);
|
||||
loadFormDatasFct($(this),id);
|
||||
});
|
||||
}
|
||||
|
||||
function modalForm_initBtnSaveDelete(btn, deleteType, modal, getModalFormDataFct, checkModalFormDataFct, saveURL) {
|
||||
btn.unbind('click').click( function(e) {
|
||||
e.preventDefault(); $(this).blur();
|
||||
|
||||
// GET MODAL DELETE ID
|
||||
var id = parseInt( modal.attr("delete_id") );
|
||||
if(!id>0) return;
|
||||
|
||||
// GET & CHECK DATAS
|
||||
var datas = {};
|
||||
if(typeof getModalFormDataFct === 'function') datas = getModalFormDataFct(modal);
|
||||
console.log("DELETE", id, datas );
|
||||
if(typeof checkModalFormDataFct === 'function') { if( !checkModalFormDataFct(datas) ) return; }
|
||||
datas.action = 'delete';
|
||||
datas.ref = id;
|
||||
|
||||
// RUN REQUEST
|
||||
modalForm_runFormRequest( saveURL, datas, ("delete "+deleteType) , modal, $(this) );
|
||||
});
|
||||
}
|
||||
|
||||
function modalForm_runFormRequest(url, datas, srvErrorAction, modal, btnRun) {
|
||||
modalForm_runFormRequest_lockModal(modal, btnRun);
|
||||
$.post( url, datas, function( result ) {
|
||||
if(parseInt(result)>0) {
|
||||
if(modal && modal.length>0) {
|
||||
modal.modal('hide');
|
||||
setTimeout(function() { document.location.reload(); },200);
|
||||
}
|
||||
else document.location.reload();
|
||||
}
|
||||
else {
|
||||
console.error(result); alert(result);
|
||||
modalForm_runFormRequest_unlockModal(modal, btnRun);
|
||||
}
|
||||
}).fail(function(xhr) {
|
||||
var errMsg = "SERVER ERROR";
|
||||
if( isDefined( srvErrorAction ) ) errMsg += " ("+srvErrorAction+")";
|
||||
if( xhr['responseText']!="" ) errMsg += " : " + xhr['responseText'];
|
||||
console.error(errMsg); alert(errMsg);
|
||||
modalForm_runFormRequest_unlockModal(modal, btnRun);
|
||||
});
|
||||
}
|
||||
|
||||
function modalForm_runFormRequest_lockModal(modal, btnRun) {
|
||||
if( isDefined( modal ) && modal.find("div.modaLoader").length>0) modal.find("div.modaLoader").addClass("show");
|
||||
if( isDefined( btnRun ) ) btnRun.prop("disabled", true);
|
||||
}
|
||||
|
||||
function modalForm_runFormRequest_unlockModal(modal, btnRun) {
|
||||
if( isDefined( modal ) && modal.find("div.modaLoader").length>0) modal.find("div.modaLoader").removeClass("show");
|
||||
if( isDefined( btnRun ) ) btnRun.prop("disabled", false);
|
||||
}
|
||||
|
||||
function modalForm_initTabs(modal) {
|
||||
// TABS
|
||||
modal.find("a.formTabBtn").click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// BTN
|
||||
if(!$(this).parent().hasClass("active")) {
|
||||
modal.find("ul.formTabsBtns > li").removeClass('active');
|
||||
$(this).parent().addClass("active");
|
||||
}
|
||||
|
||||
// TAB
|
||||
var tab = modal.find("div.tab."+$(this).attr("tab"));
|
||||
if(tab.length>0) {
|
||||
if(tab.hasClass("active")) return;
|
||||
|
||||
modal.find("div.formTabs > div.tab").removeClass("active");
|
||||
tab.addClass("active");
|
||||
}
|
||||
});
|
||||
|
||||
// RESIZE TABS
|
||||
var resizeFct = function resizeFormClient(modal) {
|
||||
var wh = window.innerHeight;
|
||||
modal.find("div.formTabs div.tab").css("max-height", (wh-180)+"px");
|
||||
}
|
||||
resizeFct(modal);
|
||||
$( window ).on( "resize", function() { resizeFct(modal) });
|
||||
}
|
||||
|
||||
function modalForm_resetTabs(modal) {
|
||||
modal.find("ul.formTabsBtns > li").removeClass('active hide');
|
||||
modal.find("ul.formTabsBtns > li:first-child").addClass('active');
|
||||
modal.find("div.formTabs > div.tab").removeClass("active");
|
||||
modal.find("div.formTabs > div.tab:first-child").addClass("active");
|
||||
}
|
||||
|
||||
/* INLINE SELECT MANAGER */
|
||||
|
||||
function inlineSelectManager_init(
|
||||
modal,
|
||||
modal_form_name,
|
||||
grp,
|
||||
value_name,
|
||||
url,
|
||||
ref_attr,
|
||||
add_action,
|
||||
edit_action,
|
||||
delete_action,
|
||||
refresh_list_action,
|
||||
selectClbkFct,
|
||||
addClbkFct,
|
||||
editClbkFct,
|
||||
cancelClbkFct,
|
||||
getDatasFct,
|
||||
checkDatasFct,
|
||||
saveClbkFct
|
||||
) {
|
||||
grp.attr("modal_form_name", modal_form_name)
|
||||
.attr("value_name", value_name)
|
||||
.attr("ref_attr", ref_attr)
|
||||
.attr("add_action", add_action)
|
||||
.attr("edit_action", edit_action)
|
||||
.attr("delete_action", delete_action)
|
||||
.attr("refresh_list_action", refresh_list_action);
|
||||
|
||||
// SELECT CHANGE => SWITCH ACTION
|
||||
grp.find("select").change(function(e) {
|
||||
$(this).blur();
|
||||
// EXISTING
|
||||
if(parseInt($(this).val())>0) {
|
||||
inlineSelectManager_switchBtnAction(grp, "delete");
|
||||
inlineSelectManager_switchBtnSecondAction(grp, "edit");
|
||||
}
|
||||
// CHOISIR...
|
||||
else {
|
||||
inlineSelectManager_switchBtnAction(grp, "add");
|
||||
inlineSelectManager_switchBtnSecondAction(grp, "hide");
|
||||
}
|
||||
|
||||
if(typeof selectClbkFct === 'function') selectClbkFct(modal, grp, $(this));
|
||||
});
|
||||
|
||||
// BTN ACTION
|
||||
grp.find("button.btnAction").click(function(e) {
|
||||
e.preventDefault(); $(this).blur();
|
||||
// ADD / SAVE NEW
|
||||
if($(this).hasClass("add") || $(this).hasClass("save_new")) {
|
||||
inlineSelectManager_addInputName(grp, "add");
|
||||
inlineSelectManager_switchBtnAction(grp, "save");
|
||||
inlineSelectManager_switchBtnSecondAction(grp, "cancel");
|
||||
if(typeof addClbkFct === 'function') addClbkFct(modal, grp);
|
||||
}
|
||||
// SAVE
|
||||
else if($(this).hasClass("save")) inlineSelectManager_save(modal, grp, url, getDatasFct, checkDatasFct, saveClbkFct);
|
||||
// DELETE
|
||||
else if($(this).hasClass("delete")) inlineSelectManager_delete(modal, grp, url);
|
||||
});
|
||||
|
||||
// BTN SECOND ACTION
|
||||
grp.find("button.btnSecondAction").click(function(e) {
|
||||
e.preventDefault(); $(this).blur();
|
||||
// EDIT
|
||||
if($(this).hasClass("edit")) {
|
||||
inlineSelectManager_addInputName(grp, "edit");
|
||||
inlineSelectManager_switchBtnAction(grp, "save");
|
||||
inlineSelectManager_switchBtnSecondAction(grp, "cancel");
|
||||
if(typeof editClbkFct === 'function') editClbkFct(modal, grp);
|
||||
}
|
||||
// CANCEL
|
||||
else if($(this).hasClass("cancel")) {
|
||||
inlineSelectManager_removeInputName(grp);
|
||||
// EDIT
|
||||
if(parseInt(grp.find("select").val())>0) {
|
||||
inlineSelectManager_switchBtnAction(grp, "delete");
|
||||
inlineSelectManager_switchBtnSecondAction(grp, "edit");
|
||||
}
|
||||
// ADD
|
||||
else {
|
||||
inlineSelectManager_switchBtnAction(grp, "add");
|
||||
inlineSelectManager_switchBtnSecondAction(grp, "hide");
|
||||
}
|
||||
|
||||
if(typeof cancelClbkFct === 'function') cancelClbkFct(modal, grp);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function inlineSelectManager_setValue(grp, val) {
|
||||
if(isDefined(val) && parseInt(val) > 0) {
|
||||
grp.find("select").val(val);
|
||||
inlineSelectManager_switchBtnAction(grp, "delete");
|
||||
inlineSelectManager_switchBtnSecondAction(grp, "edit");
|
||||
}
|
||||
else {
|
||||
grp.find("select").val("0");
|
||||
inlineSelectManager_switchBtnAction(grp, "add");
|
||||
inlineSelectManager_switchBtnSecondAction(grp, "hide");
|
||||
}
|
||||
}
|
||||
|
||||
function inlineSelectManager_switchBtnAction(grp, action) {
|
||||
var btn = grp.find("button.btnAction");
|
||||
|
||||
if(action == "add") {
|
||||
btn.removeClass("save save_new delete").addClass("add").removeClass("btn-danger btn-primary").addClass("btn-default")
|
||||
.find("i").removeClass("glyphicon-floppy-saved glyphicon-floppy-disk glyphicon-trash").addClass("glyphicon-plus");
|
||||
}
|
||||
else if(action == "save") {
|
||||
btn.removeClass("add save_new delete").addClass("save").removeClass("btn-danger btn-default").addClass("btn-primary")
|
||||
.find("i").removeClass("glyphicon-plus glyphicon-floppy-disk glyphicon-trash").addClass("glyphicon-floppy-saved");
|
||||
}
|
||||
else if(action == "save_new") {
|
||||
btn.removeClass("add save delete").addClass("save_new").removeClass("btn-danger btn-primary").addClass("btn-default")
|
||||
.find("i").removeClass("glyphicon-plus glyphicon-floppy-saved glyphicon-trash").addClass("glyphicon-floppy-disk");
|
||||
}
|
||||
else if(action == "delete") {
|
||||
btn.removeClass("add save_new save").addClass("delete").removeClass("btn-default btn-primary").addClass("btn-danger")
|
||||
.find("i").removeClass("glyphicon-plus glyphicon-floppy-saved glyphicon-floppy-disk").addClass("glyphicon-trash");
|
||||
}
|
||||
}
|
||||
|
||||
function inlineSelectManager_switchBtnSecondAction(grp, action) {
|
||||
var btn = grp.find("button.btnSecondAction");
|
||||
|
||||
if(action == "cancel") {
|
||||
btn.removeClass("edit").addClass("cancel").removeClass("btn-default").addClass("btn-danger")
|
||||
.find("i").removeClass("glyphicon-edit").addClass("glyphicon-floppy-remove");
|
||||
btn.parent().removeClass("hide");
|
||||
}
|
||||
else if(action == "edit") {
|
||||
btn.removeClass("cancel").addClass("edit").removeClass("btn-danger").addClass("btn-default")
|
||||
.find("i").removeClass("glyphicon-floppy-remove").addClass("glyphicon-edit");
|
||||
btn.parent().removeClass("hide");
|
||||
}
|
||||
else if(action == "hide") {
|
||||
btn.parent().addClass("hide");
|
||||
}
|
||||
}
|
||||
|
||||
function inlineSelectManager_addInputName(grp, action) {
|
||||
var select = grp.find("select");
|
||||
select.addClass("hide");
|
||||
|
||||
var ipt = $('<input type="text" class="form-control" name="name" placeholder="nom">').attr("action", action);
|
||||
ipt.insertBefore(select);
|
||||
|
||||
if(action=="edit") {
|
||||
ipt.attr("ref", select.val());
|
||||
ipt.val( select.find("option:selected").html() );
|
||||
}
|
||||
else ipt.attr("ref", "new");
|
||||
ipt.focus();
|
||||
|
||||
ipt.keypress(function(e) {
|
||||
if(e.keyCode==13) {
|
||||
e.preventDefault();
|
||||
$(this).parent().find("button.btnAction").click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function inlineSelectManager_removeInputName(grp) {
|
||||
var ipt = grp.find("input[name=name]");
|
||||
if(ipt.length>0) ipt.remove();
|
||||
grp.find("select").removeClass("hide");
|
||||
}
|
||||
|
||||
function inlineSelectManager_save(modal, grp, url, getDatasFct, checkDatasFct, saveClbkFct) {
|
||||
// GET DATAS
|
||||
var datas = (typeof getDatasFct === 'function') ? getDatasFct(modal, grp) : inlineSelectManager_getDatas(grp);
|
||||
|
||||
// CHECK DATAS
|
||||
if(typeof checkDatasFct === 'function') { if( !checkDatasFct(datas) ) return; }
|
||||
else { if( !inlineSelectManager_checkDatas(datas) ) return; }
|
||||
|
||||
var ref = grp.find("input[name=name]").attr("ref");
|
||||
|
||||
// ADD
|
||||
if(ref == "new") datas.action = grp.attr("add_action");
|
||||
// EDIT
|
||||
else if(parseInt(ref)>0) {
|
||||
ref = parseInt(ref);
|
||||
datas.action = grp.attr("edit_action");
|
||||
datas[grp.attr("ref_attr")] = ref;
|
||||
}
|
||||
|
||||
// LOCK
|
||||
modal.find("div.modaLoader").addClass("show");
|
||||
modal.find("button.btnAction").prop("disabled", true);
|
||||
|
||||
$.post( url, datas, function( result ) {
|
||||
if(parseInt(result)>0) {
|
||||
inlineSelectManager_switchBtnAction(grp, "delete");
|
||||
inlineSelectManager_switchBtnSecondAction(grp, "edit");
|
||||
inlineSelectManager_removeInputName(grp);
|
||||
|
||||
if(ref == "new") ref = parseInt(result);
|
||||
|
||||
if(typeof saveClbkFct === 'function') saveClbkFct(modal, grp, ref);
|
||||
|
||||
// REFRESH LIST
|
||||
$.post( url, { action: grp.attr("refresh_list_action") }, function( result ) {
|
||||
grp.find("select").html(result).val(ref);
|
||||
}).fail(function() {
|
||||
alert("ERREUR SERVEUR ! (modal form "+grp.attr("modal_form_name")+" - add/edit "+grp.find("select").attr("name")+" - refresh list after)");
|
||||
});
|
||||
}
|
||||
else { console.error(result); alert(result); }
|
||||
}).fail(function() {
|
||||
alert("ERREUR SERVEUR ! (modal form "+grp.attr("modal_form_name")+" - add/edit "+grp.find("select").attr("name")+")");
|
||||
}).always(function() {
|
||||
// UNLOCK
|
||||
modal.find("div.modaLoader").removeClass("show");
|
||||
modal.find("button.btnAction").prop("disabled", false);
|
||||
});
|
||||
}
|
||||
|
||||
function inlineSelectManager_delete(modal, grp, url) {
|
||||
var ref = parseInt(grp.find("select").val());
|
||||
var nom = grp.find("select option:selected").html();
|
||||
|
||||
if(confirm('Etês vous sûr de vouloir supprimer '+grp.attr('value_name')+' "'+nom+'" ?')) {
|
||||
// LOCK
|
||||
modal.find("div.modaLoader").addClass("show");
|
||||
modal.find("button.btnGroupeAction").prop("disabled", false);
|
||||
|
||||
var datas = { action : grp.attr("delete_action") };
|
||||
datas[grp.attr("ref_attr")] = ref;
|
||||
|
||||
$.post( url, datas, function( result ) {
|
||||
if(parseInt(result)>0) {
|
||||
// REFRESH LIST
|
||||
$.post( url, { action: grp.attr("refresh_list_action") }, function( result ) {
|
||||
grp.find("select").html(result).val("0");
|
||||
}).fail(function() {
|
||||
alert("ERREUR SERVEUR ! (modal form "+grp.attr("modal_form_name")+" - delete "+grp.find("select").attr("name")+" - refresh list after)");
|
||||
});
|
||||
}
|
||||
else { console.error(result); alert(result); }
|
||||
}).fail(function() {
|
||||
alert("ERREUR SERVEUR ! (modal form "+grp.attr("modal_form_name")+" - delete "+grp.find("select").attr("name")+")");
|
||||
}).always(function() {
|
||||
// UNLOCK
|
||||
modal.find("div.modaLoader").removeClass("show");
|
||||
modal.find("button.btnAction").prop("disabled", false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function inlineSelectManager_getDatas(grp) {
|
||||
var datas = { 'nom' : grp.find("input[name=name]").val() };
|
||||
return datas;
|
||||
}
|
||||
|
||||
function inlineSelectManager_checkDatas(datas) {
|
||||
if(datas.nom=="") {
|
||||
alert("Merci de renseigner un nom !");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* AUTOCOMPLETE INPUT */
|
||||
|
||||
function initAutocompleteInput(form, ipt, url, action, errContext, requestDataFct, selectFct, clearFct, blurFct) {
|
||||
ipt.autocomplete({
|
||||
html: true,
|
||||
delay: 200,
|
||||
source: function(requete, reponse) {
|
||||
datas = {
|
||||
'action' : action,
|
||||
'search' : ipt.val(),
|
||||
'nohist' : true
|
||||
};
|
||||
if(typeof requestDataFct === 'function') datas = requestDataFct(form, ipt, datas);
|
||||
$.post(url, datas, function(jsonTxt) {
|
||||
datas = JSON.parse(jsonTxt);
|
||||
reponse(datas);
|
||||
}).fail(function() { alert("ERREUR SERVEUR !"+( (isDefined(errContext)) ? " "+errContext : "" )); });
|
||||
},
|
||||
focus: function(event, ui) { event.preventDefault(); },
|
||||
select: function(event, ui) {
|
||||
event.preventDefault();
|
||||
if(typeof selectFct === 'function') selectFct(form, ipt, ui.item);
|
||||
else ipt.val( ui.item.value ).attr('ref', ui.item.ref).blur();
|
||||
}
|
||||
});
|
||||
ipt.keydown(function(e) {
|
||||
if(e.keyCode==13) { e.preventDefault(); $(this).blur(); }
|
||||
else if(parseInt($(this).attr('ref'))>0) {
|
||||
if(typeof clearFct === 'function') clearFct(form, $(this));
|
||||
else $(this).val("").removeAttr('ref');
|
||||
}
|
||||
});
|
||||
ipt.on("blur", function(e) {
|
||||
if(typeof blurFct === 'function') blurFct(form, $(this));
|
||||
else if(!parseInt($(this).attr('ref'))>0) $(this).val("").removeAttr('ref');
|
||||
});
|
||||
}
|
||||
|
||||
/* LIST PROGRESS LOAD */
|
||||
|
||||
function initListProgressLoad(list, url, listName) {
|
||||
if(isDefined(list)) {
|
||||
var contentH = list.innerHeight();
|
||||
|
||||
list.listProgressLoad_resize();
|
||||
$(window).resize( function() { list.listProgressLoad_resize(); } );
|
||||
|
||||
list.scroll(function(e) {
|
||||
var rest = list.prop("scrollHeight") - list.innerHeight() - list.scrollTop();
|
||||
if(rest<300 && list.find("td.loader").length==0 && parseInt(list.attr('rest'))>0) {
|
||||
// APPEND LOADER
|
||||
var tr = $("<tr class='loader'><td class='loader' colspan='17'></td></tr>");
|
||||
list.append(tr);
|
||||
|
||||
// LOAD
|
||||
$.post(url, { 'startListAt' : parseInt(list.attr('end')) }, function(jsonTxt) {
|
||||
datas = JSON.parse(jsonTxt);
|
||||
|
||||
list.attr("start", datas.start);
|
||||
list.attr("end", datas.end);
|
||||
list.attr("rest", datas.rest);
|
||||
list.append($(datas.list));
|
||||
|
||||
list.trigger( "loaded" );
|
||||
|
||||
tr.remove();
|
||||
}).fail(function(xhr) {
|
||||
errMsg = "SERVER ERROR ("+(( isDefined( listName ) && listName != "" ) ? listName : "list")+" - load items)";
|
||||
if( xhr['responseText']!="" ) errMsg += " : " + xhr['responseText'];
|
||||
console.error(errMsg); alert(errMsg);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// FORCE LOAD IF WINDOWS NOT FULL
|
||||
h = $(window).innerHeight() - list.position().top;
|
||||
if(parseInt(list.attr("rest"))>0 && contentH<h) list.trigger("scroll");
|
||||
}
|
||||
}
|
||||
|
||||
function registerListProgressLoadCbkFct(list, clbFct) { if( isDefined(list) && (typeof clbFct === 'function')) list.on("loaded", clbFct); }
|
||||
|
||||
$.fn.listProgressLoad_resize = function() {
|
||||
var h = $(window).innerHeight() - $(this).position().top;
|
||||
$(this).removeAttr("style");
|
||||
if($(this).prop("scrollHeight") < h) $(this).parent().addClass("no-scroll");
|
||||
else $(this).parent().removeClass("no-scroll");
|
||||
$(this).css("height", h);
|
||||
};
|
||||
|
||||
/* SEARCH */
|
||||
|
||||
$.fn.initSearchGroup = function() {
|
||||
$(this).find("input[search]").unbind('keypress').keypress( function(event) {
|
||||
if(event.keyCode==13) {
|
||||
$(this).blur();
|
||||
document.location = "?search="+$(this).val();
|
||||
}
|
||||
});
|
||||
$(this).find(".btnClearSearch").unbind('click').click( function(event) {
|
||||
event.preventDefault(); $(this).blur();
|
||||
document.location = "?clearSearch";
|
||||
});
|
||||
}
|
||||
|
||||
$.fn.initFiltreSelect = function() {
|
||||
// LOAD VALUE
|
||||
$(this).each(function(n,e) {
|
||||
if(isDefined($(this).attr("load_value"))) $(this).val($(this).attr("load_value"));
|
||||
});
|
||||
|
||||
// SELECT
|
||||
$(this).change(function(e) {
|
||||
if( !isDefined( $(this).attr("filtre_request") ) ) return;
|
||||
$(this).blur();
|
||||
document.location = "?"+$(this).attr("filtre_request")+"="+$(this).val();
|
||||
});
|
||||
}
|
||||
|
||||
/* FONCTIONS */
|
||||
|
||||
function getUrlParameters() {
|
||||
|
|
|
|||
|
|
@ -1,376 +1,284 @@
|
|||
// SEARCH
|
||||
var legumesSearch = false;
|
||||
// SETTINGS
|
||||
var legumesConf = {
|
||||
type : "legume",
|
||||
baseURL : "legumes.php",
|
||||
// LIST
|
||||
list_selector : "#legumesList",
|
||||
// SEARCH
|
||||
search_selector : "#legumesSearch .searchGrp",
|
||||
filtres_selector : "#legumesSearch select",
|
||||
// VIEW
|
||||
view_modalSelector : "#modalViewLegume",
|
||||
view_btnSelector : ".btnViewLegume",
|
||||
// ADD
|
||||
add_modalSelector : "#modalAddLegume",
|
||||
add_btnSelector : "#btnAddLegume",
|
||||
// EDIT
|
||||
edit_modalSelector : "#modalEditLegume",
|
||||
edit_btnSelector : ".btnEditLegume",
|
||||
// DELETE
|
||||
delete_modalSelector : "#modalDeleteLegume",
|
||||
delete_btnSelector : ".btnDeleteLegume",
|
||||
}
|
||||
|
||||
// VIEW
|
||||
var modalViewLegume = false;
|
||||
var btnViewLegume = false;
|
||||
var currentViewLegume = 0;
|
||||
|
||||
var legumesBaseURL = "legumes.php";
|
||||
|
||||
// ADD
|
||||
var modalAddLegume = false;
|
||||
var formAddLegume = false;
|
||||
var btnAddLegume = false;
|
||||
|
||||
// EDIT
|
||||
var modalEditLegume = false;
|
||||
var formEditLegume = false;
|
||||
var btnEditLegume = false;
|
||||
var currentEditLegume = 0;
|
||||
|
||||
// DELETE
|
||||
var modalDeleteLegume = false;
|
||||
var btnDeleteLegume = false;
|
||||
var currentDeleteLegume = 0;
|
||||
// MODALS
|
||||
var modalViewLegume = false;
|
||||
var modalAddLegume = false;
|
||||
var modalEditLegume = false;
|
||||
var modalDeleteLegume = false;
|
||||
|
||||
$(document).ready( function() {
|
||||
// INIT SEARCH
|
||||
legumesSearch = $("#legumesSearch");
|
||||
if(legumesSearch.length>0) initSearchLegumes();
|
||||
// LIST LOADER
|
||||
initListProgressLoad($(legumesConf.list_selector), legumesConf.baseURL, legumesConf.type+" list");
|
||||
|
||||
// INIT VIEW LEGUME
|
||||
modalViewLegume = $("#modalViewLegume");
|
||||
btnViewLegume = $(".btnViewLegume");
|
||||
if(modalViewLegume.length>0 && btnViewLegume.length>0) {
|
||||
// SEARCH
|
||||
$(legumesConf.search_selector).initSearchGroup();
|
||||
|
||||
// VIEW
|
||||
modalViewLegume = $(legumesConf.view_modalSelector);
|
||||
if(modalViewLegume.length>0) {
|
||||
initViewLegume();
|
||||
// VIEW REQUEST
|
||||
var id = getUrlParameter("id");
|
||||
if(id!==false && parseInt(id)>0) loadDatasInViewLegumeModal(id);
|
||||
var id = getUrlParameter("ref");
|
||||
if(id!==false && parseInt(id)>0 && current_page == "legumes") {
|
||||
modalViewLegume_clear(modalViewLegume);
|
||||
modalViewLegume_loadDatas(modalViewLegume, id);
|
||||
}
|
||||
}
|
||||
|
||||
// INIT ADD LEGUME
|
||||
modalAddLegume = $("#modalAddLegume");
|
||||
formAddLegume = $("#formAddLegume");
|
||||
btnAddLegume = $("#btnAddLegume");
|
||||
if(modalAddLegume.length>0 && formAddLegume.length>0 && btnAddLegume.length>0) initAddLegume();
|
||||
// ADD
|
||||
modalAddLegume = $(legumesConf.add_modalSelector);
|
||||
if(modalAddLegume.length>0) initAddLegume();
|
||||
|
||||
// INIT EDIT LEGUME
|
||||
modalEditLegume = $("#modalEditLegume");
|
||||
formEditLegume = $("#formEditLegume");
|
||||
btnEditLegume = $(".btnEditLegume");
|
||||
if(modalEditLegume.length>0 && formEditLegume.length>0 && btnEditLegume.length>0) initEditLegume();
|
||||
// EDIT
|
||||
modalEditLegume = $(legumesConf.edit_modalSelector);
|
||||
if(modalEditLegume.length>0) initEditLegume();
|
||||
|
||||
// INIT DELETE LEGUME
|
||||
modalDeleteLegume = $("#modalDeleteLegume");
|
||||
btnDeleteLegume = $(".btnDeleteLegume");
|
||||
if(modalDeleteLegume.length>0 && btnDeleteLegume.length>0) initDeleteLegume();
|
||||
// DELETE
|
||||
modalDeleteLegume = $(legumesConf.delete_modalSelector);
|
||||
if(modalDeleteLegume.length>0) initDeleteLegume();
|
||||
});
|
||||
|
||||
/***** SEARCH LEGUMES *****/
|
||||
function initSearchLegumes() {
|
||||
legumesSearch.find("input[name=search]").unbind('keypress').keypress( function(event) {
|
||||
if(event.keyCode==13) searchLegume(false);
|
||||
});
|
||||
legumesSearch.find(".btnClearSearch").unbind('click').click( function(event) {
|
||||
searchLegume(true);
|
||||
});
|
||||
}
|
||||
|
||||
function searchLegume(clear) {
|
||||
legumesSearch.find("input[name=search]").blur();
|
||||
legumesSearch.find(".btnClearSearch").blur();
|
||||
if(clear) document.location = "?clearSearch";
|
||||
else document.location = "?search="+legumesSearch.find("input[name=search]").val();
|
||||
}
|
||||
|
||||
/***** VIEW LEGUME *****/
|
||||
/***** MODAL VIEW *****/
|
||||
function initViewLegume() {
|
||||
// BTN VIEW
|
||||
btnViewLegume.unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
id = parseInt($(this).attr('ref'));
|
||||
if(!id>0) return;
|
||||
clearViewLegumeModal();
|
||||
currentViewLegume = id;
|
||||
loadDatasInViewLegumeModal(id);
|
||||
});
|
||||
// INIT VIEW BTNs
|
||||
var initBtnFct = function() { modalForm_initBtnView(
|
||||
$(legumesConf.view_btnSelector), // BTNs
|
||||
modalViewLegume, // MODAL
|
||||
modalViewLegume_clear, // CLEAR FUNCTION
|
||||
modalViewLegume_loadDatas // LOAD DATAS FUNCTION
|
||||
)};
|
||||
registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct );
|
||||
initBtnFct();
|
||||
|
||||
// CANCEL
|
||||
modalViewLegume.on('hidden.bs.modal', function (e) {
|
||||
clearViewLegumeModal();
|
||||
currentViewLegume = 0;
|
||||
});
|
||||
modalViewLegume.on('hidden.bs.modal', function() { modalViewLegume_clear(modalViewLegume); });
|
||||
}
|
||||
|
||||
function loadDatasInViewLegumeModal(id) {
|
||||
datas = {
|
||||
'ref' : id,
|
||||
'action' : 'getDatas'
|
||||
};
|
||||
$.post( legumesBaseURL, datas, function( result ) {
|
||||
var datas = JSON.parse(result);
|
||||
function modalViewLegume_loadDatas(modal, id) {
|
||||
$.post(legumesConf.baseURL, { 'ref' : id, 'action' : 'getDatas' }, function(jsonTxt) {
|
||||
var datas = JSON.parse(jsonTxt);
|
||||
|
||||
modalViewLegume.find("small.db_ref > span").html(datas.ref);
|
||||
modal.find("small.db_ref > span").html(datas.ref);
|
||||
|
||||
modalViewLegume.find("td.nom").html(datas.nom);
|
||||
modalViewLegume.find("td.tarif").html(datas.tarif_print+" <small>(depuis le "+datas.tarif_date_print+")</small>");
|
||||
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) {
|
||||
modalViewLegume.find("table.modal-body tfoot").removeClass("hide");
|
||||
modal.find("table.modal-body tfoot").removeClass("hide");
|
||||
$.each(datas.historique_tarif, function(n,e) { addTarifLegumeHist(e); });
|
||||
}
|
||||
|
||||
modalViewLegume.modal('show');
|
||||
}).fail(function() { alert(srvErrorMsg+" (load modal view legume)"); });
|
||||
modal.modal('show');
|
||||
}).fail(function() { alert("("+legumesConf.type+" - load modal view)"); });
|
||||
}
|
||||
|
||||
function addTarifLegumeHist(datas) {
|
||||
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 tfoot").addClass("hide").find("tr:not(.header)").remove();
|
||||
}
|
||||
|
||||
function modalViewLegume_addTarifLegumeHist(modal, datas) {
|
||||
var tr = $("<tr></tr>").attr("ref", datas.ref);
|
||||
tr.append($("<td></td>").html(datas.tarif_print));
|
||||
tr.append($("<td></td>").html(datas.tarif_periode));
|
||||
btnDel = $('<button class="btn btn-xs btn-link glyphicon glyphicon-trash btnDeleteTarifLegume"></button>').attr('ref', datas.ref).attr('tarif', datas.tarif_print).attr('periode', datas.tarif_periode);
|
||||
tr.append($("<td class='td_btn_action td_btn_delete'></td>").append(btnDel));
|
||||
modalViewLegume.find("table.modal-body tfoot").append(tr);
|
||||
modal.find("table.modal-body tfoot").append(tr);
|
||||
|
||||
btnDel.click(function(e) {
|
||||
e.preventDefault(); $(this).blur();
|
||||
tr = $(this).parent().parent();
|
||||
e.preventDefault();
|
||||
$(this).blur();
|
||||
id = parseInt( $(this).attr("ref") );
|
||||
if(!id>0) return;
|
||||
msg = "Êtes vous sûr de vouloir supprimer le tarif de "+$(this).attr("tarif")+" en application "+$(this).attr("periode")+" ?";
|
||||
if(confirm(msg)) {
|
||||
datas = {
|
||||
'action' : 'deleteTarif',
|
||||
'tarif' : id
|
||||
};
|
||||
$.post( legumesBaseURL, datas, function( result ) {
|
||||
datas = { 'action' : 'deleteTarif', 'tarif' : id };
|
||||
$.post( legumesConf.baseURL, datas, function( result ) {
|
||||
if(parseInt(result)>0) {
|
||||
tr.remove();
|
||||
if(modalViewLegume.find("table.modal-body tfoot tr:not(.header)").length == 0) modalViewLegume.find("table.modal-body tfoot").addClass("hide");
|
||||
if(modal.find("table.modal-body tfoot tr:not(.header)").length == 0) modal.find("table.modal-body tfoot").addClass("hide");
|
||||
}
|
||||
else {
|
||||
console.error(result);
|
||||
alert(result);
|
||||
}
|
||||
}).fail(function() { alert(srvErrorMsg+" (form legume - delete tarif)"); });
|
||||
else { console.error(result); alert(result); }
|
||||
}).fail(function() { alert("("+legumesConf.type+" - delete tarif)"); });
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function clearViewLegumeModal() {
|
||||
modalViewLegume.find("small.db_ref > span").html("");
|
||||
/***** MODAL FORM ADD/EDIT *****/
|
||||
function modalFormLegume_init(modal) {
|
||||
modal.find("form").on("submit", function(e) { e.preventDefault(); });
|
||||
|
||||
modalViewLegume.find("td.nom").html("");
|
||||
modalViewLegume.find("td.tarif").html("");
|
||||
|
||||
modalViewLegume.find("table.modal-body tfoot").addClass("hide").find("tr:not(.header)").remove();
|
||||
}
|
||||
|
||||
/***** FORM LEGUME *****/
|
||||
function initFormLegume(form) {
|
||||
form.on("submit", function(e) { e.preventDefault(); });
|
||||
|
||||
form.find("button.btnEditTarif").click(function(e) {
|
||||
// BTN EDIT TARIF
|
||||
modal.find("button.btnEditTarif").click(function(e) {
|
||||
e.preventDefault();
|
||||
$(this).blur().addClass('hide');
|
||||
form.find("input[name=prix]").attr('ref', 'new').prop('disabled', false);
|
||||
form.find("select[name=unite]").prop('disabled', false);
|
||||
form.find("input[name=date]").prop('disabled', false).val(getTodayDate("yyyy-mm-dd"));
|
||||
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"));
|
||||
});
|
||||
initFloatInput(form.find("input[name=prix]"));
|
||||
|
||||
// PRIX
|
||||
initFloatInput(modal.find("input[name=prix]"));
|
||||
}
|
||||
|
||||
function loadDatasInFormLegumeDatas(modal,form,id) {
|
||||
datas = {
|
||||
'ref' : id,
|
||||
'action' : 'getDatas'
|
||||
};
|
||||
$.post( legumesBaseURL, datas, function( result ) {
|
||||
var datas = JSON.parse(result);
|
||||
function modalFormLegume_loadDatas(modal,id) {
|
||||
$.post(legumesConf.baseURL, { 'ref' : id, 'action' : 'getDatas' }, function(jsonTxt) {
|
||||
var datas = JSON.parse(jsonTxt);
|
||||
|
||||
form.find("input[name=nom]").val(datas.nom);
|
||||
form.find("input[name=prix]").val(datas.tarif_prix).attr('ref', datas.tarif_ref);
|
||||
form.find("select[name=unite]").val(datas.tarif_unite);
|
||||
form.find("input[name=date]").val(datas.tarif_date);
|
||||
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);
|
||||
|
||||
if(modal) modal.modal('show');
|
||||
}).fail(function() { alert(srvErrorMsg+" (form legume - load datas)"); });
|
||||
}).fail(function() { alert("("+legumesConf.type+" - load datas in modal form)"); });
|
||||
}
|
||||
|
||||
function clearFormLegumeDatas(form) {
|
||||
add = (form.attr('id') == "formAddLegume");
|
||||
function modalFormLegume_clear(modal) {
|
||||
modal.removeAttr("edit_id");
|
||||
modal.find("div.modaLoader").removeClass("show");
|
||||
|
||||
form.find("input[name=nom]").val("");
|
||||
if(add) form.find("button.btnEditTarif").addClass('hide');
|
||||
else form.find("button.btnEditTarif").removeClass('hide');
|
||||
form.find("input[name=prix]").val("").attr('ref', "new").prop('disabled', !add);
|
||||
form.find("select[name=unite]").val("kg").prop('disabled', !add);
|
||||
form.find("input[name=date]").val(getTodayDate("yyyy-mm-dd")).prop('disabled', !add);
|
||||
add = modal.hasClass("add");
|
||||
|
||||
// MODALOADER
|
||||
form.find("div.modaLoader").removeClass("show");
|
||||
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);
|
||||
}
|
||||
|
||||
// GET FORM DATAS
|
||||
|
||||
function getLegumeFormDatas(form) {
|
||||
function modalFormLegume_getDatas(modal) {
|
||||
var datas = {
|
||||
'nom' : form.find("input[name=nom]").val(),
|
||||
'tarif_ref' : (form.find("input[name=prix]").attr('ref')=="new") ? "new" : parseInt(form.find("input[name=prix]").attr('ref')),
|
||||
'tarif_prix' : parseFloat( form.find("input[name=prix]").val() ),
|
||||
'tarif_unite' : form.find("select[name=unite]").val(),
|
||||
'tarif_date' : form.find("input[name=date]").val()
|
||||
'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()
|
||||
};
|
||||
return datas;
|
||||
}
|
||||
|
||||
/***** ADD LEGUME *****/
|
||||
function modalFormLegume_checkDatas(datas) {
|
||||
if(datas.nom=="") {
|
||||
alert("ERREUR : au minimum, un nom doit être renseigné !");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/***** ADD *****/
|
||||
function initAddLegume() {
|
||||
// BTN ADD
|
||||
btnAddLegume.unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
clearFormLegumeDatas(formAddLegume);
|
||||
modalAddLegume.modal('show');
|
||||
});
|
||||
// INIT FORM
|
||||
modalFormLegume_init(modalAddLegume);
|
||||
|
||||
// INIT FORM ADD
|
||||
initFormLegume(formAddLegume);
|
||||
// INIT ADD BTN
|
||||
modalForm_initBtnAdd(
|
||||
$(legumesConf.add_btnSelector), // BTN ADD
|
||||
modalAddLegume, // MODAL
|
||||
modalFormLegume_clear // CLEAR FORM FUNCTION
|
||||
);
|
||||
|
||||
// SAVE LEGUME
|
||||
$(".btnSaveAddLegume").unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var datas = getLegumeFormDatas(formAddLegume);
|
||||
|
||||
if(datas.nom=="") {
|
||||
alert("ERREUR : au minimum un nom doit être renseigné !");
|
||||
return;
|
||||
}
|
||||
|
||||
datas.action = 'add';
|
||||
|
||||
formAddLegume.find("div.modaLoader").addClass("show");
|
||||
$(".btnSaveAddLegume").prop("disabled", true);
|
||||
|
||||
$.post( legumesBaseURL, datas, function( result ) {
|
||||
if(parseInt(result)>0) {
|
||||
modalAddLegume.modal('hide');
|
||||
setTimeout(function() {
|
||||
document.location.reload();
|
||||
},200);
|
||||
}
|
||||
else {
|
||||
console.error(result);
|
||||
alert(result);
|
||||
formAddLegume.find("div.modaLoader").removeClass("show");
|
||||
$(".btnSaveAddLegume").prop("disabled", false);
|
||||
}
|
||||
}).fail(function() {
|
||||
alert(srvErrorMsg+" (add legume)");
|
||||
formAddLegume.find("div.modaLoader").removeClass("show");
|
||||
$(".btnSaveAddLegume").prop("disabled", false);
|
||||
});
|
||||
});
|
||||
// INIT SAVE BTN
|
||||
modalForm_initBtnSaveAdd(
|
||||
modalAddLegume.find(".btnSave"), // BTN SAVE
|
||||
legumesConf.type, // ADD TYPE
|
||||
modalAddLegume, // MODAL
|
||||
modalFormLegume_getDatas, // GET FORM DATAS FUNCTION
|
||||
modalFormLegume_checkDatas, // CHECK FORM DATAS FUNCTION
|
||||
legumesConf.baseURL // SAVE URL
|
||||
);
|
||||
|
||||
// CANCEL
|
||||
modalAddLegume.on('hidden.bs.modal', function (e) { clearFormLegumeDatas(formAddLegume); });
|
||||
modalAddLegume.on('hidden.bs.modal', function (e) { modalFormLegume_clear(modalAddLegume); });
|
||||
}
|
||||
|
||||
/***** EDIT LEGUME *****/
|
||||
/***** EDIT *****/
|
||||
function initEditLegume() {
|
||||
// BTN EDIT
|
||||
btnEditLegume.unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
id = parseInt($(this).attr('ref'));
|
||||
if(!id>0) return;
|
||||
currentEditLegume = id;
|
||||
clearFormLegumeDatas(formEditLegume);
|
||||
loadDatasInFormLegumeDatas(modalEditLegume,formEditLegume,id);
|
||||
});
|
||||
// INIT FORM
|
||||
modalFormLegume_init(modalEditLegume);
|
||||
|
||||
// INIT FORM EDIT
|
||||
initFormLegume(formEditLegume);
|
||||
// INIT EDIT BTNs
|
||||
var initBtnFct = function() { modalForm_initBtnEdit(
|
||||
$(legumesConf.edit_btnSelector), // BTNs
|
||||
modalEditLegume, // MODAL
|
||||
modalFormLegume_clear, // CLEAR FUNCTION
|
||||
modalFormLegume_loadDatas // LOAD DATAS FUNCTION
|
||||
)};
|
||||
registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct );
|
||||
initBtnFct();
|
||||
|
||||
// SAVE LEGUME
|
||||
$(".btnSaveEditLegume").unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
if(!currentEditLegume>0) return;
|
||||
|
||||
var datas = getLegumeFormDatas(formEditLegume);
|
||||
if(datas.nom=="") {
|
||||
alert("ERREUR : au minimum un nom doit être renseigné !");
|
||||
return;
|
||||
}
|
||||
|
||||
datas.action = 'edit';
|
||||
datas.ref = currentEditLegume;
|
||||
|
||||
formEditLegume.find("div.modaLoader").addClass("show");
|
||||
$(".btnSaveEditLegume").prop("disabled", true);
|
||||
|
||||
$.post( legumesBaseURL, datas, function( result ) {
|
||||
if(parseInt(result)>0) {
|
||||
modalEditLegume.modal('hide');
|
||||
setTimeout(function() {
|
||||
document.location.reload();
|
||||
},200);
|
||||
}
|
||||
else {
|
||||
console.error(result);
|
||||
alert(result);
|
||||
formEditLegume.find("div.modaLoader").removeClass("show");
|
||||
$(".btnSaveEditLegume").prop("disabled", false);
|
||||
}
|
||||
}).fail(function() {
|
||||
alert(srvErrorMsg+" (edit legume)");
|
||||
formEditLegume.find("div.modaLoader").removeClass("show");
|
||||
$(".btnSaveEditLegume").prop("disabled", false);
|
||||
});
|
||||
});
|
||||
// INIT SAVE EDIT BTN
|
||||
modalForm_initBtnSaveEdit(
|
||||
modalEditLegume.find(".btnSave"), // BTN SAVE
|
||||
legumesConf.type, // EDIT TYPE
|
||||
modalEditLegume, // MODAL
|
||||
modalFormLegume_getDatas, // GET FORM DATAS FUNCTION
|
||||
modalFormLegume_checkDatas, // CHECK FORM DATAS FUNCTION
|
||||
legumesConf.baseURL // SAVE URL
|
||||
);
|
||||
|
||||
// CANCEL
|
||||
modalEditLegume.on('hidden.bs.modal', function (e) {
|
||||
clearFormLegumeDatas(formEditLegume);
|
||||
currentEditLegume = 0;
|
||||
});
|
||||
modalEditLegume.on('hidden.bs.modal', function (e) { modalFormLegume_clear(modalEditLegume); });
|
||||
}
|
||||
|
||||
/***** DELETE LEGUME *****/
|
||||
/***** DELETE *****/
|
||||
function initDeleteLegume() {
|
||||
// BTN DELETE
|
||||
btnDeleteLegume.unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
id = parseInt($(this).attr('ref'));
|
||||
if(!id>0) return;
|
||||
currentDeleteLegume = id;
|
||||
// INIT DELETE BTNs
|
||||
var initBtnFct = function() { modalForm_initBtnDelete(
|
||||
$(legumesConf.delete_btnSelector), // BTNs
|
||||
modalDeleteLegume, // MODAL
|
||||
modalDeleteLegume_clear, // CLEAR MODAL FUNCTION
|
||||
modalDeleteLegume_loadDatas // LOAD DATAS FUNCTION
|
||||
)};
|
||||
registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct );
|
||||
initBtnFct();
|
||||
|
||||
modalDeleteLegume.find('b.name').html( $(this).attr('nom') );
|
||||
|
||||
modalDeleteLegume.modal('show');
|
||||
});
|
||||
|
||||
// DELETE
|
||||
$("#btnDeleteLegume").unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
$(this).blur();
|
||||
|
||||
if(!currentDeleteLegume>0) return;
|
||||
|
||||
var datas = {
|
||||
action : 'delete',
|
||||
ref : currentDeleteLegume
|
||||
};
|
||||
|
||||
$.post( legumesBaseURL, datas, function( result ) {
|
||||
if(parseInt(result)>0) {
|
||||
modalEditLegume.modal('hide');
|
||||
setTimeout(function() {
|
||||
document.location.reload();
|
||||
},200);
|
||||
}
|
||||
else {
|
||||
console.error(result);
|
||||
alert(result);
|
||||
}
|
||||
}).fail(function() { alert(srvErrorMsg+" (delete legume)"); });
|
||||
});
|
||||
// INIT SAVE DELETE BTN
|
||||
modalForm_initBtnSaveDelete(
|
||||
modalDeleteLegume.find(".btnSave"), // BTN SAVE
|
||||
legumesConf.type, // DELETE TYPE
|
||||
modalDeleteLegume, // MODAL
|
||||
false, // GET FORM DATAS FUNCTION
|
||||
false, // CHECK FORM DATAS FUNCTION
|
||||
legumesConf.baseURL // SAVE URL
|
||||
);
|
||||
|
||||
// CANCEL
|
||||
modalDeleteLegume.on('hidden.bs.modal', function (e) {
|
||||
modalDeleteLegume.find('b.name').html("");
|
||||
currentDeleteLegume = 0;
|
||||
});
|
||||
modalDeleteLegume.on('hidden.bs.modal', function (e) { modalDeleteLegume_clear(); });
|
||||
}
|
||||
|
||||
function modalDeleteLegume_loadDatas(btn, id) {
|
||||
modalDeleteLegume.find('b.name').html( btn.attr('nom') );
|
||||
modalDeleteLegume.modal('show');
|
||||
}
|
||||
|
||||
function modalDeleteLegume_clear() {
|
||||
modalDeleteLegume.removeAttr("delete_id");
|
||||
modalDeleteLegume.find('b.name').html("");
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,544 +1,265 @@
|
|||
// SEARCH
|
||||
var paniersSearch = false;
|
||||
// SETTINGS
|
||||
var paniersConf = {
|
||||
type : "panier",
|
||||
baseURL : "paniers.php",
|
||||
// LIST
|
||||
list_selector : "#paniersList",
|
||||
// SEARCH / FILTRES
|
||||
search_selector : "#paniersSearch .searchGrp",
|
||||
filtres_selector : "#paniersSearch select",
|
||||
// VIEW
|
||||
view_modalSelector : "#modalViewPanier",
|
||||
view_btnSelector : ".btnViewPanier",
|
||||
// ADD
|
||||
add_modalSelector : "#modalAddPanier",
|
||||
add_btnSelector : "#btnAddPanier",
|
||||
// EDIT
|
||||
edit_modalSelector : "#modalEditPanier",
|
||||
edit_btnSelector : ".btnEditPanier",
|
||||
// DELETE
|
||||
delete_modalSelector : "#modalDeletePanier",
|
||||
delete_btnSelector : ".btnDeletePanier",
|
||||
}
|
||||
|
||||
// VIEW
|
||||
var modalViewPanier = false;
|
||||
var btnViewPanier = false;
|
||||
var currentViewPanier = 0;
|
||||
|
||||
var paniersBaseURL = "paniers.php";
|
||||
|
||||
// ADD
|
||||
var modalAddPanier = false;
|
||||
var formAddPanier = false;
|
||||
var btnAddPanier = false;
|
||||
|
||||
// EDIT
|
||||
var modalEditPanier = false;
|
||||
var formEditPanier = false;
|
||||
var btnEditPanier = false;
|
||||
var currentEditPanier = 0;
|
||||
|
||||
// DELETE
|
||||
var modalDeletePanier = false;
|
||||
var btnDeletePanier = false;
|
||||
var currentDeletePanier = 0;
|
||||
// MODALS
|
||||
var modalViewPanier = false;
|
||||
var modalAddPanier = false;
|
||||
var modalEditPanier = false;
|
||||
var modalDeletePanier = false;
|
||||
|
||||
$(document).ready( function() {
|
||||
// INIT SEARCH
|
||||
paniersSearch = $("#paniersSearch");
|
||||
if(paniersSearch.length>0) initSearchPaniers();
|
||||
// LIST LOADER
|
||||
initListProgressLoad($(paniersConf.list_selector), paniersConf.baseURL, paniersConf.type+" list");
|
||||
|
||||
// INIT VIEW PANIER
|
||||
modalViewPanier = $("#modalViewPanier");
|
||||
btnViewPanier = $(".btnViewPanier");
|
||||
if(modalViewPanier.length>0 && btnViewPanier.length>0) {
|
||||
// SEARCH / FILTRES
|
||||
$(paniersConf.search_selector).initSearchGroup();
|
||||
$(paniersConf.filtres_selector).initFiltreSelect();
|
||||
|
||||
// VIEW
|
||||
modalViewPanier = $(paniersConf.view_modalSelector);
|
||||
if(modalViewPanier.length>0) {
|
||||
initViewPanier();
|
||||
// VIEW REQUEST
|
||||
var id = getUrlParameter("id");
|
||||
if(id!==false && parseInt(id)>0) loadDatasInViewPanierModal(id);
|
||||
var id = getUrlParameter("ref");
|
||||
if(id!==false && parseInt(id)>0 && current_page == "paniers") {
|
||||
modalViewPanier_clear(modalViewPanier);
|
||||
modalViewPanier_loadDatas(modalViewPanier, id);
|
||||
}
|
||||
}
|
||||
|
||||
// INIT ADD PANIER
|
||||
modalAddPanier = $("#modalAddPanier");
|
||||
formAddPanier = $("#formAddPanier");
|
||||
btnAddPanier = $("#btnAddPanier");
|
||||
if(modalAddPanier.length>0 && formAddPanier.length>0 && btnAddPanier.length>0) initAddPanier();
|
||||
// ADD
|
||||
modalAddPanier = $(paniersConf.add_modalSelector);
|
||||
if(modalAddPanier.length>0) initAddPanier();
|
||||
|
||||
// INIT EDIT PANIER
|
||||
modalEditPanier = $("#modalEditPanier");
|
||||
formEditPanier = $("#formEditPanier");
|
||||
btnEditPanier = $(".btnEditPanier");
|
||||
if(modalEditPanier.length>0 && formEditPanier.length>0 && btnEditPanier.length>0) initEditPanier();
|
||||
// EDIT
|
||||
modalEditPanier = $(paniersConf.edit_modalSelector);
|
||||
if(modalEditPanier.length>0) initEditPanier();
|
||||
|
||||
// INIT DELETE PANIER
|
||||
modalDeletePanier = $("#modalDeletePanier");
|
||||
btnDeletePanier = $(".btnDeletePanier");
|
||||
if(modalDeletePanier.length>0 && btnDeletePanier.length>0) initDeletePanier();
|
||||
// DELETE
|
||||
modalDeletePanier = $(paniersConf.delete_modalSelector);
|
||||
if(modalDeletePanier.length>0) initDeletePanier();
|
||||
});
|
||||
|
||||
/***** SEARCH PANIERS *****/
|
||||
function initSearchPaniers() {
|
||||
// SEARCH
|
||||
paniersSearch.find("input[name=search]").unbind('keypress').keypress( function(event) {
|
||||
if(event.keyCode==13) searchPanier(false);
|
||||
});
|
||||
paniersSearch.find(".btnClearSearch").unbind('click').click( function(event) {
|
||||
searchPanier(true);
|
||||
});
|
||||
|
||||
// FILTRE GROUPE
|
||||
loadValue = paniersSearch.find("select[name=groupe]").attr("load_value");
|
||||
paniersSearch.find("select[name=groupe]").change(function(e) {
|
||||
$(this).blur();
|
||||
document.location = "?groupe="+parseInt($(this).val());
|
||||
}).val(loadValue);
|
||||
}
|
||||
|
||||
function searchPanier(clear) {
|
||||
paniersSearch.find("input[name=search]").blur();
|
||||
paniersSearch.find(".btnClearSearch").blur();
|
||||
if(clear) document.location = "?clearSearch";
|
||||
else document.location = "?search="+paniersSearch.find("input[name=search]").val();
|
||||
}
|
||||
|
||||
/***** VIEW PANIER *****/
|
||||
/***** MODAL VIEW *****/
|
||||
function initViewPanier() {
|
||||
// BTN VIEW
|
||||
btnViewPanier.unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
id = parseInt($(this).attr('ref'));
|
||||
if(!id>0) return;
|
||||
clearViewPanierModal();
|
||||
currentViewPanier = id;
|
||||
loadDatasInViewPanierModal(id);
|
||||
});
|
||||
// INIT VIEW BTNs
|
||||
var initBtnFct = function() { modalForm_initBtnView(
|
||||
$(paniersConf.view_btnSelector), // BTNs
|
||||
modalViewPanier, // MODAL
|
||||
modalViewPanier_clear, // CLEAR FUNCTION
|
||||
modalViewPanier_loadDatas // LOAD DATAS FUNCTION
|
||||
)};
|
||||
registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct );
|
||||
initBtnFct();
|
||||
|
||||
// CANCEL
|
||||
modalViewPanier.on('hidden.bs.modal', function (e) {
|
||||
clearViewPanierModal();
|
||||
currentViewPanier = 0;
|
||||
});
|
||||
modalViewPanier.on('hidden.bs.modal', function() { modalViewPanier_clear(modalViewPanier); });
|
||||
}
|
||||
|
||||
function loadDatasInViewPanierModal(id) {
|
||||
datas = {
|
||||
'ref' : id,
|
||||
'action' : 'getDatas'
|
||||
};
|
||||
$.post(paniersBaseURL, datas, function(jsonTxt) {
|
||||
function modalViewPanier_loadDatas(modal, id) {
|
||||
$.post(paniersConf.baseURL, { 'ref' : id, 'action' : 'getDatas' }, function(jsonTxt) {
|
||||
var datas = JSON.parse(jsonTxt);
|
||||
|
||||
modalViewPanier.find("small.db_ref > span").html(datas.ref);
|
||||
modal.find("small.db_ref > span").html(datas.ref);
|
||||
|
||||
modalViewPanier.find("td.nom").html(datas.nom);
|
||||
modalViewPanier.find("td.groupe").html(datas.groupe_nom);
|
||||
modalViewPanier.find("td.valeur").html(number_format(datas.valeur,2)+" €");
|
||||
modal.find("td.nom").html(datas.nom);
|
||||
modal.find("td.groupe").html(datas.groupe_nom);
|
||||
modal.find("td.valeur").html(number_format(datas.valeur,2)+" €");
|
||||
|
||||
modalViewPanier.modal('show');
|
||||
}).fail(function() { alert(srvErrorMsg+" (load modal view panier)"); });;
|
||||
modal.modal('show');
|
||||
}).fail(function() { alert("("+paniersConf.type+" - load modal view)"); });
|
||||
}
|
||||
|
||||
function clearViewPanierModal() {
|
||||
modalViewPanier.find("small.db_ref > span").html("");
|
||||
function modalViewPanier_clear(modal) {
|
||||
modal.removeAttr("view_id");
|
||||
|
||||
modalViewPanier.find("td.nom").html("");
|
||||
modalViewPanier.find("td.groupe").html("");
|
||||
modalViewPanier.find("td.valeur").html("");
|
||||
modal.find("small.db_ref > span").html("");
|
||||
|
||||
modal.find("td.nom").html("");
|
||||
modal.find("td.groupe").html("");
|
||||
modal.find("td.valeur").html("");
|
||||
|
||||
modal.find("table.modal-body tfoot").addClass("hide").find("tr:not(.header)").remove();
|
||||
}
|
||||
|
||||
/***** FORM PANIER *****/
|
||||
function initFormPanier(form) {
|
||||
form.on("submit", function(e) { e.preventDefault(); });
|
||||
/***** MODAL FORM ADD/EDIT *****/
|
||||
function modalFormPanier_init(modal) {
|
||||
modal.find("form").on("submit", function(e) { e.preventDefault(); });
|
||||
|
||||
// NOM
|
||||
initFirstUpperCaseInput(form.find("input[name=nom]"), null, function() { $(this).blur(); });
|
||||
form.find("input[name=nom]").keydown(function(e) {
|
||||
initFirstUpperCaseInput(modal.find("input[name=nom]"), null, function() { $(this).blur(); });
|
||||
modal.find("input[name=nom]").keydown(function(e) {
|
||||
if(e.keyCode==13) { e.preventDefault(); $(this).blur(); }
|
||||
});
|
||||
|
||||
// GROUPE
|
||||
form.find("select[name=groupe]").change(function(e) {
|
||||
$(this).blur();
|
||||
// EXISTING
|
||||
if(parseInt($(this).val())>0) {
|
||||
switchBtnGroupeAction(form, "delete");
|
||||
switchBtnGroupeSecondAction(form, "edit");
|
||||
}
|
||||
// CHOISIR...
|
||||
else {
|
||||
switchBtnGroupeAction(form, "add");
|
||||
switchBtnGroupeSecondAction(form, "hide");
|
||||
}
|
||||
});
|
||||
|
||||
form.find("button.btnGroupeAction").click(function(e) {
|
||||
e.preventDefault();
|
||||
$(this).blur();
|
||||
// ADD / SAVE NEW
|
||||
if($(this).hasClass("add") || $(this).hasClass("save_new")) {
|
||||
addInputGroupeName(form, "add");
|
||||
|
||||
switchBtnGroupeAction(form, "save");
|
||||
switchBtnGroupeSecondAction(form, "cancel");
|
||||
}
|
||||
// SAVE
|
||||
else if($(this).hasClass("save")) {
|
||||
var ipt = form.find("input[name=groupeName]");
|
||||
if(ipt.length>0) {
|
||||
var ref = ipt.attr("ref");
|
||||
|
||||
var datas = { 'nom' : ipt.val() };
|
||||
|
||||
if(datas.nom=="") {
|
||||
alert("Merci de renseigner le nom du groupe !");
|
||||
return;
|
||||
}
|
||||
|
||||
// ADD GROUPE
|
||||
if(ref == "new") datas.action = "add_groupe";
|
||||
// EDIT GROUPE
|
||||
else if(parseInt(ref)>0) {
|
||||
ref = parseInt(ref);
|
||||
datas.action = "edit_groupe";
|
||||
datas.groupe_ref = ref;
|
||||
}
|
||||
|
||||
form.find("div.modaLoader").addClass("show");
|
||||
form.find("button.btnGroupeAction").prop("disabled", true);
|
||||
|
||||
$.post( paniersBaseURL, datas, function( result ) {
|
||||
if(parseInt(result)>0) {
|
||||
switchBtnGroupeAction(form, "delete");
|
||||
switchBtnGroupeSecondAction(form, "edit");
|
||||
removeInputGroupeName(form);
|
||||
|
||||
if(ref == "new") ref = parseInt(result);
|
||||
|
||||
// REFRESH GROUPES LIST
|
||||
$.post( paniersBaseURL, {action: "groupes_select_list"}, function( result ) {
|
||||
form.find("select[name=groupe]").html(result).val(ref);
|
||||
}).fail(function() { alert(srvErrorMsg+" (form panier - add/edit groupe - refresh list after)"); });
|
||||
}
|
||||
else {
|
||||
console.error(result);
|
||||
alert(result);
|
||||
}
|
||||
}).always(function() {
|
||||
form.find("div.modaLoader").removeClass("show");
|
||||
form.find("button.btnGroupeAction").prop("disabled", false);
|
||||
}).fail(function() { alert(srvErrorMsg+" (form panier - add/edit groupe)"); });
|
||||
}
|
||||
}
|
||||
// DELETE
|
||||
else if($(this).hasClass("delete")) {
|
||||
var ref = parseInt(form.find("select[name=groupe]").val());
|
||||
var nom = form.find("select[name=groupe] option:selected").html();
|
||||
if(confirm('Etês vous sûr de vouloir supprimer le groupe de panier "'+nom+'" ?')) {
|
||||
form.find("div.modaLoader").addClass("show");
|
||||
form.find("button.btnGroupeAction").prop("disabled", false);
|
||||
|
||||
var datas = { action : 'delete_groupe', groupe_ref : ref };
|
||||
$.post( paniersBaseURL, datas, function( result ) {
|
||||
if(parseInt(result)>0) {
|
||||
// REFRESH CONTRATS TYPES LIST
|
||||
$.post( paniersBaseURL, {action: "groupes_select_list"}, function( result ) {
|
||||
form.find("select[name=groupe]").html(result).val("0");
|
||||
}).fail(function() { alert(srvErrorMsg+" (form panier - delete groupe - refresh list after)"); });
|
||||
}
|
||||
else {
|
||||
console.error(result);
|
||||
alert(result);
|
||||
}
|
||||
}).always(function() {
|
||||
form.find("div.modaLoader").removeClass("show");
|
||||
form.find("button.btnGroupeAction").prop("disabled", false);
|
||||
}).fail(function() { alert(srvErrorMsg+" (form panier - delete groupe)"); });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
form.find("button.btnGroupeSecondAction").click(function(e) {
|
||||
e.preventDefault();
|
||||
$(this).blur();
|
||||
// EDIT
|
||||
if($(this).hasClass("edit")) {
|
||||
addInputGroupeName(form, "edit");
|
||||
switchBtnGroupeAction(form, "save");
|
||||
switchBtnGroupeSecondAction(form, "cancel");
|
||||
}
|
||||
// CANCEL
|
||||
else if($(this).hasClass("cancel")) {
|
||||
removeInputGroupeName(form);
|
||||
// EDIT
|
||||
if(parseInt(form.find("select[name=groupe]").val())>0) {
|
||||
switchBtnGroupeAction(form, "delete");
|
||||
switchBtnGroupeSecondAction(form, "edit");
|
||||
}
|
||||
// ADD
|
||||
else {
|
||||
switchBtnGroupeAction(form, "add");
|
||||
switchBtnGroupeSecondAction(form, "hide");
|
||||
}
|
||||
}
|
||||
});
|
||||
inlineSelectManager_init(
|
||||
modal, // MODAL
|
||||
"panier", // MODAL FORM NAME
|
||||
modal.find("select[name=groupe]").parent(), // SELECT GROUPE
|
||||
"le groupe de panier", // VALUE NAME
|
||||
paniersConf.baseURL, // URL
|
||||
"groupe_ref", // REF ATTR
|
||||
"add_groupe", // ADD ACTION
|
||||
"edit_groupe", // EDIT ACTION
|
||||
"delete_groupe", // DELETE ACTION
|
||||
"groupes_select_list" // REFRESH LIST ACTION
|
||||
);
|
||||
|
||||
// VALEUR
|
||||
initFloatInput(form.find("input[name=valeur]"));
|
||||
form.find("input[name=valeur]").keydown(function(e) {
|
||||
initFloatInput(modal.find("input[name=valeur]"));
|
||||
modal.find("input[name=valeur]").keydown(function(e) {
|
||||
if(e.keyCode==13) { e.preventDefault(); $(this).blur(); }
|
||||
});
|
||||
}
|
||||
|
||||
function loadDatasInFormPanierDatas(modal,form,id) {
|
||||
datas = {
|
||||
'ref' : id,
|
||||
'action' : 'getDatas'
|
||||
};
|
||||
$.post(paniersBaseURL, datas, function(jsonTxt) {
|
||||
function modalFormPanier_loadDatas(modal,id) {
|
||||
$.post(paniersConf.baseURL, { 'ref' : id, 'action' : 'getDatas' }, function(jsonTxt) {
|
||||
var datas = JSON.parse(jsonTxt);
|
||||
|
||||
form.find("input[name=nom]").val(datas.nom);
|
||||
modal.find("input[name=nom]").val(datas.nom);
|
||||
|
||||
if(parseInt(datas.groupe_ref) > 0) {
|
||||
form.find("select[name=groupe]").val(datas.groupe_ref);
|
||||
switchBtnGroupeAction(form, "delete");
|
||||
switchBtnGroupeSecondAction(form, "edit");
|
||||
}
|
||||
else {
|
||||
form.find("select[name=groupe]").val("0");
|
||||
switchBtnGroupeAction(form, "add");
|
||||
switchBtnGroupeSecondAction(form, "hide");
|
||||
}
|
||||
inlineSelectManager_setValue(modal.find("select[name=groupe]").parent(), datas.groupe_ref);
|
||||
|
||||
form.find("input[name=valeur]").val(datas.valeur);
|
||||
modal.find("input[name=valeur]").val(datas.valeur);
|
||||
|
||||
if(modal) modal.modal('show');
|
||||
}).fail(function() { alert(srvErrorMsg+" (form panier - load datas)"); });
|
||||
}).fail(function() { alert("("+paniersConf.type+" - load datas in modal form)"); });
|
||||
}
|
||||
|
||||
function clearFormPanierDatas(form) {
|
||||
form.find("input[name=nom]").val("");
|
||||
function modalFormPanier_clear(modal) {
|
||||
modal.removeAttr("edit_id");
|
||||
modal.find("div.modaLoader").removeClass("show");
|
||||
|
||||
form.find("select[name=groupe]").val("0");
|
||||
removeInputGroupeName(form);
|
||||
switchBtnGroupeAction(form, "add");
|
||||
switchBtnGroupeSecondAction(form, "hide");
|
||||
|
||||
form.find("input[name=valeur]").val("0");
|
||||
|
||||
// MODALOADER
|
||||
form.find("div.modaLoader").removeClass("show");
|
||||
modal.find("input[name=nom]").val("");
|
||||
inlineSelectManager_setValue(modal.find("select[name=groupe]").parent(), 0);
|
||||
modal.find("input[name=valeur]").val("0");
|
||||
}
|
||||
|
||||
// GROUPE
|
||||
|
||||
function switchBtnGroupeAction(form, action) { // ADD / SAVE / DELETE
|
||||
var btn = form.find("button.btnGroupeAction");
|
||||
|
||||
if(action == "add") {
|
||||
btn.removeClass("save delete").addClass("add").removeClass("btn-danger btn-primary").addClass("btn-default")
|
||||
.find("i").removeClass("glyphicon-floppy-saved glyphicon-trash").addClass("glyphicon-plus");
|
||||
}
|
||||
else if(action == "save") {
|
||||
btn.removeClass("add save_new delete").addClass("save").removeClass("btn-danger btn-default").addClass("btn-primary")
|
||||
.find("i").removeClass("glyphicon-plus glyphicon-trash").addClass("glyphicon-floppy-saved");
|
||||
}
|
||||
else if(action == "delete") {
|
||||
btn.removeClass("add save_new save").addClass("delete").removeClass("btn-default btn-primary").addClass("btn-danger")
|
||||
.find("i").removeClass("glyphicon-plus glyphicon-floppy-saved").addClass("glyphicon-trash");
|
||||
}
|
||||
}
|
||||
|
||||
function switchBtnGroupeSecondAction(form, action) { // CANCEL / EDIT
|
||||
var btn = form.find("button.btnGroupeSecondAction");
|
||||
|
||||
if(action == "cancel") {
|
||||
btn.removeClass("edit").addClass("cancel").removeClass("btn-default").addClass("btn-danger")
|
||||
.find("i").removeClass("glyphicon-edit").addClass("glyphicon-floppy-remove");
|
||||
btn.parent().removeClass("hide");
|
||||
}
|
||||
else if(action == "edit") {
|
||||
btn.removeClass("cancel").addClass("edit").removeClass("btn-danger").addClass("btn-default")
|
||||
.find("i").removeClass("glyphicon-floppy-remove").addClass("glyphicon-edit");
|
||||
btn.parent().removeClass("hide");
|
||||
}
|
||||
else if(action == "hide") {
|
||||
btn.parent().addClass("hide");
|
||||
}
|
||||
}
|
||||
|
||||
function addInputGroupeName(form, action) {
|
||||
var select = form.find("select[name=groupe]");
|
||||
var ipt = $('<input type="text" class="form-control" name="groupeName" placeholder="nom">').attr("action", action);
|
||||
select.addClass("hide");
|
||||
ipt.insertBefore(select);
|
||||
if(action=="edit") {
|
||||
ipt.attr("ref", select.val());
|
||||
ipt.val( select.find("option:selected").html() );
|
||||
}
|
||||
else ipt.attr("ref", "new");
|
||||
ipt.focus();
|
||||
|
||||
ipt.keypress(function(e) {
|
||||
if(e.keyCode==13) {
|
||||
e.preventDefault();
|
||||
form.find("button.btnGroupeAction").click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function removeInputGroupeName(form) {
|
||||
var ipt = form.find("input[name=groupeName]");
|
||||
if(ipt.length>0) ipt.remove();
|
||||
form.find("select[name=groupe]").removeClass("hide");
|
||||
}
|
||||
|
||||
// GET FORM DATAS
|
||||
|
||||
function getPanierFormDatas(form) {
|
||||
function modalFormPanier_getDatas(modal) {
|
||||
var datas = {
|
||||
'nom' : form.find("input[name=nom]").val(),
|
||||
'groupe' : parseInt(form.find("select[name=groupe]").val()),
|
||||
'valeur' : parseFloat(form.find("input[name=valeur]").val())
|
||||
'nom' : modal.find("input[name=nom]").val(),
|
||||
'groupe' : parseInt(modal.find("select[name=groupe]").val()),
|
||||
'valeur' : parseFloat(modal.find("input[name=valeur]").val())
|
||||
};
|
||||
return datas;
|
||||
}
|
||||
|
||||
/***** ADD PANIER *****/
|
||||
function modalFormPanier_checkDatas(datas) {
|
||||
if(datas.nom=="") {
|
||||
alert("ERREUR : au minimum, un nom doit être renseigné !");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/***** ADD *****/
|
||||
function initAddPanier() {
|
||||
// BTN ADD
|
||||
btnAddPanier.unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
clearFormPanierDatas(formAddPanier);
|
||||
modalAddPanier.modal('show');
|
||||
});
|
||||
// INIT FORM
|
||||
modalFormPanier_init(modalAddPanier);
|
||||
|
||||
// INIT FORM ADD
|
||||
initFormPanier(formAddPanier);
|
||||
// INIT ADD BTN
|
||||
modalForm_initBtnAdd(
|
||||
$(paniersConf.add_btnSelector), // BTN ADD
|
||||
modalAddPanier, // MODAL
|
||||
modalFormPanier_clear // CLEAR FORM FUNCTION
|
||||
);
|
||||
|
||||
// SAVE PANIER
|
||||
$(".btnSaveAddPanier").unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var datas = getPanierFormDatas(formAddPanier);
|
||||
if(datas.nom=="" || !datas.groupe>0) {
|
||||
alert("ERREUR : au minimum, un nom et un groupe doivent être renseigné !");
|
||||
return;
|
||||
}
|
||||
|
||||
datas.action = 'add';
|
||||
|
||||
formAddPanier.find("div.modaLoader").addClass("show");
|
||||
$(".btnSaveAddPanier").prop("disabled", true);
|
||||
|
||||
$.post( paniersBaseURL, datas, function( result ) {
|
||||
if(parseInt(result)>0) {
|
||||
modalAddPanier.modal('hide');
|
||||
setTimeout(function() {
|
||||
document.location.reload();
|
||||
},200);
|
||||
}
|
||||
else {
|
||||
console.error(result);
|
||||
alert(result);
|
||||
formAddPanier.find("div.modaLoader").removeClass("show");
|
||||
$(".btnSaveAddPanier").prop("disabled", false);
|
||||
}
|
||||
}).fail( function() {
|
||||
alert(srvErrorMsg+" (add panier)");
|
||||
formAddPanier.find("div.modaLoader").removeClass("show");
|
||||
$(".btnSaveAddPanier").prop("disabled", false);
|
||||
});
|
||||
});
|
||||
// INIT SAVE BTN
|
||||
modalForm_initBtnSaveAdd(
|
||||
modalAddPanier.find(".btnSave"), // BTN SAVE
|
||||
paniersConf.type, // ADD TYPE
|
||||
modalAddPanier, // MODAL
|
||||
modalFormPanier_getDatas, // GET FORM DATAS FUNCTION
|
||||
modalFormPanier_checkDatas, // CHECK FORM DATAS FUNCTION
|
||||
paniersConf.baseURL // SAVE URL
|
||||
);
|
||||
|
||||
// CANCEL
|
||||
modalAddPanier.on('hidden.bs.modal', function (e) { clearFormPanierDatas(formAddPanier); });
|
||||
modalAddPanier.on('hidden.bs.modal', function (e) { modalFormPanier_clear(modalAddPanier); });
|
||||
}
|
||||
|
||||
/***** EDIT PANIER *****/
|
||||
/***** EDIT *****/
|
||||
function initEditPanier() {
|
||||
// BTN EDIT
|
||||
btnEditPanier.unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
id = parseInt($(this).attr('ref'));
|
||||
if(!id>0) return;
|
||||
currentEditPanier = id;
|
||||
clearFormPanierDatas(formEditPanier);
|
||||
loadDatasInFormPanierDatas(modalEditPanier,formEditPanier,id);
|
||||
});
|
||||
// INIT FORM
|
||||
modalFormPanier_init(modalEditPanier);
|
||||
|
||||
// INIT FORM EDIT
|
||||
initFormPanier(formEditPanier);
|
||||
// INIT EDIT BTNs
|
||||
var initBtnFct = function() { modalForm_initBtnEdit(
|
||||
$(paniersConf.edit_btnSelector), // BTNs
|
||||
modalEditPanier, // MODAL
|
||||
modalFormPanier_clear, // CLEAR FUNCTION
|
||||
modalFormPanier_loadDatas // LOAD DATAS FUNCTION
|
||||
)};
|
||||
registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct );
|
||||
initBtnFct();
|
||||
|
||||
// SAVE PANIER
|
||||
$(".btnSaveEditPanier").unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
if(!currentEditPanier>0) return;
|
||||
|
||||
var datas = getPanierFormDatas(formEditPanier);
|
||||
if(datas.nom=="" || !datas.groupe>0) {
|
||||
alert("ERREUR : au minimum, un nom et un groupe doivent être renseigné !");
|
||||
return;
|
||||
}
|
||||
|
||||
datas.action = 'edit';
|
||||
datas.ref = currentEditPanier;
|
||||
|
||||
formEditPanier.find("div.modaLoader").addClass("show");
|
||||
$(".btnSaveEditPanier").prop("disabled", true);
|
||||
|
||||
$.post( paniersBaseURL, datas, function( result ) {
|
||||
if(parseInt(result)>0) {
|
||||
modalEditPanier.modal('hide');
|
||||
setTimeout(function() {
|
||||
document.location.reload();
|
||||
},200);
|
||||
}
|
||||
else {
|
||||
console.error(result);
|
||||
alert(result);
|
||||
formEditPanier.find("div.modaLoader").removeClass("show");
|
||||
$(".btnSaveEditPanier").prop("disabled", false);
|
||||
}
|
||||
}).fail( function() {
|
||||
alert(srvErrorMsg+" (edit panier)");
|
||||
formEditPanier.find("div.modaLoader").removeClass("show");
|
||||
$(".btnSaveEditPanier").prop("disabled", false);
|
||||
});
|
||||
});
|
||||
// INIT SAVE EDIT BTN
|
||||
modalForm_initBtnSaveEdit(
|
||||
modalEditPanier.find(".btnSave"), // BTN SAVE
|
||||
paniersConf.type, // EDIT TYPE
|
||||
modalEditPanier, // MODAL
|
||||
modalFormPanier_getDatas, // GET FORM DATAS FUNCTION
|
||||
modalFormPanier_checkDatas, // CHECK FORM DATAS FUNCTION
|
||||
paniersConf.baseURL // SAVE URL
|
||||
);
|
||||
|
||||
// CANCEL
|
||||
modalEditPanier.on('hidden.bs.modal', function (e) {
|
||||
clearFormPanierDatas(formEditPanier);
|
||||
currentEditPanier = 0;
|
||||
});
|
||||
modalEditPanier.on('hidden.bs.modal', function (e) { modalFormPanier_clear(modalEditPanier); });
|
||||
}
|
||||
|
||||
/***** DELETE PANIER *****/
|
||||
/***** DELETE *****/
|
||||
function initDeletePanier() {
|
||||
// BTN DELETE
|
||||
btnDeletePanier.unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
id = parseInt($(this).attr('ref'));
|
||||
if(!id>0) return;
|
||||
currentDeletePanier = id;
|
||||
// INIT DELETE BTNs
|
||||
var initBtnFct = function() { modalForm_initBtnDelete(
|
||||
$(paniersConf.delete_btnSelector), // BTNs
|
||||
modalDeletePanier, // MODAL
|
||||
modalDeletePanier_clear, // CLEAR MODAL FUNCTION
|
||||
modalDeletePanier_loadDatas // LOAD DATAS FUNCTION
|
||||
)};
|
||||
registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct );
|
||||
initBtnFct();
|
||||
|
||||
modalDeletePanier.find('b.name').html( $(this).attr('nom') );
|
||||
|
||||
modalDeletePanier.modal('show');
|
||||
});
|
||||
|
||||
// DELETE
|
||||
$("#btnDeletePanier").unbind('click').click( function(event) {
|
||||
event.preventDefault();
|
||||
$(this).blur();
|
||||
|
||||
if(!currentDeletePanier>0) return;
|
||||
|
||||
var datas = {
|
||||
action : 'delete',
|
||||
ref : currentDeletePanier
|
||||
};
|
||||
|
||||
$.post( paniersBaseURL, datas, function( result ) {
|
||||
if(parseInt(result)>0) {
|
||||
modalEditPanier.modal('hide');
|
||||
setTimeout(function() {
|
||||
document.location.reload();
|
||||
},200);
|
||||
}
|
||||
else {
|
||||
console.error(result);
|
||||
alert(result);
|
||||
}
|
||||
}).fail(function() { alert(srvErrorMsg+" (delete panier)"); });
|
||||
});
|
||||
// INIT SAVE DELETE BTN
|
||||
modalForm_initBtnSaveDelete(
|
||||
modalDeletePanier.find(".btnSave"), // BTN SAVE
|
||||
paniersConf.type, // DELETE TYPE
|
||||
modalDeletePanier, // MODAL
|
||||
false, // GET FORM DATAS FUNCTION
|
||||
false, // CHECK FORM DATAS FUNCTION
|
||||
paniersConf.baseURL // SAVE URL
|
||||
);
|
||||
|
||||
// CANCEL
|
||||
modalDeletePanier.on('hidden.bs.modal', function (e) {
|
||||
modalDeletePanier.find('b.name').html("");
|
||||
currentDeletePanier = 0;
|
||||
});
|
||||
modalDeletePanier.on('hidden.bs.modal', function (e) { modalDeletePanier_clear(); });
|
||||
}
|
||||
|
||||
function modalDeletePanier_loadDatas(btn, id) {
|
||||
modalDeletePanier.find('b.name').html( btn.attr('nom') );
|
||||
modalDeletePanier.modal('show');
|
||||
}
|
||||
|
||||
function modalDeletePanier_clear() {
|
||||
modalDeletePanier.removeAttr("delete_id");
|
||||
modalDeletePanier.find('b.name').html("");
|
||||
}
|
||||
|
|
@ -89,12 +89,30 @@ switch($action) {
|
|||
case "autocomplete_list": die( json_encode( getLegumesAutocompleteList() ) ); break;
|
||||
// DEFAULT - LIST
|
||||
default: {
|
||||
// LIST
|
||||
// SEARCH
|
||||
$search = getSearch("legumes_search");
|
||||
|
||||
// LIMITS
|
||||
$limits = array("start" => 0, "end" => LIST_NB_LIGNES_PAR_PAGE, "nbItemsByPage" => LIST_NB_LIGNES_PAR_PAGE, "max" => getNbLegumesInList($search));
|
||||
if(isset($_REQUEST['startListAt']) && (int)$_REQUEST['startListAt']>0) {
|
||||
$limits['start'] = intval($_REQUEST['startListAt']);
|
||||
$limits['end'] = $limits['start'] + $limits['nbItemsByPage'];
|
||||
if($limits['end'] > $limits['max']) $limits['end'] = $limits['max'];
|
||||
}
|
||||
$limits['rest'] = $limits['max'] - $limits['end'];
|
||||
$GLOBALS['smarty'] -> assign('list_limits',$limits);
|
||||
|
||||
// LIST
|
||||
$order = getListOrder('legumes_list_order', 'legumes_list_sens', $allowLegumesListOrder, 'prenom');
|
||||
$list = getLegumesList($order["order"], $order["sens"], $search);
|
||||
$list = getLegumesList($order["order"], $order["sens"], $search, $limits);
|
||||
$GLOBALS['smarty'] -> assign('list',$list);
|
||||
|
||||
// LIST PART
|
||||
if(isset($_REQUEST['startListAt']) && (int)$_REQUEST['startListAt']>0) {
|
||||
$limits["list"] = $GLOBALS['smarty']->fetch("legumes/legumes_list_builder.tpl");
|
||||
die(json_encode($limits));
|
||||
}
|
||||
|
||||
// TEMPLATE
|
||||
$GLOBALS['template'] = 'legumes/legumes_list.tpl';
|
||||
$jsFiles[] = PUBLIC_HTML_ADMIN.'js/legumes.js';
|
||||
|
|
|
|||
|
|
@ -173,14 +173,34 @@ switch($action) {
|
|||
} break;
|
||||
// DEFAULT - LIST
|
||||
default: {
|
||||
// LIST
|
||||
// GROUPE
|
||||
$groupesList = getPaniersGroupesList();
|
||||
$groupe = getRequestAndSessionSave("groupe", "livraisons_list_groupe", "groupe", "int", 0, $groupesList, true);
|
||||
|
||||
// ARCHIVE
|
||||
$archive = getRequestAndSessionSave("archive", "livraisons_list_archive", "archive", "int", 0);
|
||||
|
||||
// LIMITS
|
||||
$limits = array("start" => 0, "end" => LIST_NB_LIGNES_PAR_PAGE, "nbItemsByPage" => LIST_NB_LIGNES_PAR_PAGE, "max" => getNbLivraisonsInList($groupe, $archive));
|
||||
if(isset($_REQUEST['startListAt']) && (int)$_REQUEST['startListAt']>0) {
|
||||
$limits['start'] = intval($_REQUEST['startListAt']);
|
||||
$limits['end'] = $limits['start'] + $limits['nbItemsByPage'];
|
||||
if($limits['end'] > $limits['max']) $limits['end'] = $limits['max'];
|
||||
}
|
||||
$limits['rest'] = $limits['max'] - $limits['end'];
|
||||
$GLOBALS['smarty'] -> assign('list_limits',$limits);
|
||||
|
||||
// LIST
|
||||
$order = getListOrder('livraisons_list_order', 'livraisons_list_sens', $allowLivraisonsListOrder, "date", "DESC");
|
||||
$list = getLivraisonsList($order["order"], $order["sens"], $groupe, $archive);
|
||||
$list = getLivraisonsList($order["order"], $order["sens"], $groupe, $archive, $limits);
|
||||
$GLOBALS['smarty'] -> assign('list',$list);
|
||||
|
||||
// LIST PART
|
||||
if(isset($_REQUEST['startListAt']) && (int)$_REQUEST['startListAt']>0) {
|
||||
$limits["list"] = $GLOBALS['smarty']->fetch("livraisons/livraisons_list_builder.tpl");
|
||||
die(json_encode($limits));
|
||||
}
|
||||
|
||||
// TEMPLATE
|
||||
$GLOBALS['template'] = 'livraisons/livraisons_list.tpl';
|
||||
$jsFiles[] = PUBLIC_HTML_ADMIN.'js/livraisons.js';
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ switch($action) {
|
|||
$id = isset($_REQUEST['groupe_ref']) ? intval($_REQUEST['groupe_ref']) : 0;
|
||||
if($id>0) {
|
||||
$datas = getPaniersGroupeDatasFromRequest();
|
||||
die( strval( updatePaniersGroupe($datas) ) );
|
||||
die( strval( updatePaniersGroupe($id, $datas) ) );
|
||||
}
|
||||
else die("ERREUR : aucune référence de groupe transmis...");
|
||||
} break;
|
||||
|
|
@ -88,14 +88,34 @@ switch($action) {
|
|||
} break;
|
||||
// DEFAULT - LIST
|
||||
default: {
|
||||
// LIST
|
||||
// GROUPE
|
||||
$groupesList = getPaniersGroupesList();
|
||||
$groupe = getRequestAndSessionSave("groupe", "paniers_filtre_groupe", "groupe", "int", 0, $groupesList, true);
|
||||
|
||||
// SEARCH
|
||||
$search = getSearch("paniers_search");
|
||||
|
||||
// LIMITS
|
||||
$limits = array("start" => 0, "end" => LIST_NB_LIGNES_PAR_PAGE, "nbItemsByPage" => LIST_NB_LIGNES_PAR_PAGE, "max" => getNbPaniersInList($search, $groupe));
|
||||
if(isset($_REQUEST['startListAt']) && (int)$_REQUEST['startListAt']>0) {
|
||||
$limits['start'] = intval($_REQUEST['startListAt']);
|
||||
$limits['end'] = $limits['start'] + $limits['nbItemsByPage'];
|
||||
if($limits['end'] > $limits['max']) $limits['end'] = $limits['max'];
|
||||
}
|
||||
$limits['rest'] = $limits['max'] - $limits['end'];
|
||||
$GLOBALS['smarty'] -> assign('list_limits',$limits);
|
||||
|
||||
// LIST
|
||||
$order = getListOrder('paniers_list_order', 'paniers_list_sens', $allowPaniersTypesListOrder);
|
||||
$list = getPaniersTypesList($order["order"], $order["sens"], $search, $groupe);
|
||||
$list = getPaniersTypesList($order["order"], $order["sens"], $search, $groupe, $limits);
|
||||
$GLOBALS['smarty'] -> assign('list',$list);
|
||||
|
||||
// LIST PART
|
||||
if(isset($_REQUEST['startListAt']) && (int)$_REQUEST['startListAt']>0) {
|
||||
$limits["list"] = $GLOBALS['smarty']->fetch("paniers/paniers_list_builder.tpl");
|
||||
die(json_encode($limits));
|
||||
}
|
||||
|
||||
// TEMPLATE
|
||||
$GLOBALS['template'] = 'paniers/paniers_list.tpl';
|
||||
$jsFiles[] = PUBLIC_HTML_ADMIN.'js/paniers.js';
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@
|
|||
</h2>
|
||||
</div>
|
||||
<div class="modal-body formClient">
|
||||
<ul class="nav nav-tabs formClientTabs">
|
||||
<li role="presentation" class="active"><a href="#" class="formClientTabBtn" tab="tabInfos">Informations</a></li>
|
||||
<li role="presentation"><a href="#" class="formClientTabBtn" tab="tabContrats">Contrats</a></li>
|
||||
<li role="presentation"><a href="#" class="formClientTabBtn" tab="tabAbsences">Absences</a></li>
|
||||
<ul class="nav nav-tabs formTabsBtns">
|
||||
<li role="presentation" class="active"><a href="#" class="formTabBtn" tab="tabInfos">Informations</a></li>
|
||||
<li role="presentation"><a href="#" class="formTabBtn" tab="tabContrats">Contrats</a></li>
|
||||
<li role="presentation"><a href="#" class="formTabBtn" tab="tabAbsences">Absences</a></li>
|
||||
</ul>
|
||||
<div class="formClientTabs">
|
||||
<div class="formTabs">
|
||||
<div class="tab tabInfos active">
|
||||
<table class="table modal-body">
|
||||
<tr><th>nom :</th><td class="nom"></td></tr>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
{if !$frameDisplay}{include file='structure/top.tpl'}{/if}
|
||||
|
||||
<table class="table table-hover">
|
||||
<table class="table table-hover scrollingTableList">
|
||||
<thead>
|
||||
<th style="width:45px;" class="center visible-lg">
|
||||
<th class="center visible-lg id">
|
||||
<a href={if $order=="ref" && $sens=="ASC"}"?order=ref&sens=DESC"
|
||||
{else}"?order=ref&sens=ASC"{/if} style="text-decoration: none;">
|
||||
#{if $order=="ref"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<th class="name">
|
||||
<a href={if $order=="prenom" && $sens=="ASC"}"?order=prenom&sens=DESC"
|
||||
{else}"?order=prenom&sens=ASC"{/if} style="text-decoration: none;">
|
||||
{if $order=="prenom"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}prénom
|
||||
|
|
@ -18,36 +18,22 @@
|
|||
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">
|
||||
<th class="visible-md visible-lg tel">
|
||||
<a href={if $order=="tel" && $sens=="ASC"}"?order=tel&sens=DESC"
|
||||
{else}"?order=tel&sens=ASC"{/if} style="text-decoration: none;">
|
||||
téléphone{if $order=="tel"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th class="visible-md visible-lg">
|
||||
<th class="visible-md visible-lg email">
|
||||
<a href={if $order=="email" && $sens=="ASC"}"?order=email&sens=DESC"
|
||||
{else}"?order=email&sens=ASC"{/if} style="text-decoration: none;">
|
||||
email{if $order=="email"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th style="width: 30px;"></th>
|
||||
<th style="width: 30px;"><button class="btn btn-xs btn-info glyphicon glyphicon-plus" id="btnAddClient"></button></th>
|
||||
<th class="btn_action right" colspan="2"><button class="btn btn-xs btn-info glyphicon glyphicon-plus" id="btnAddClient"></button></th>
|
||||
</thead>
|
||||
<tbody class="table">
|
||||
{foreach from=$list item=i}
|
||||
<tr>
|
||||
<td class="center visible-lg">{$i.ref}</td>
|
||||
<td><a href="#" class="btnViewClient" ref={$i.ref}>{$i.prenom} {$i.nom}</a></td>
|
||||
<td class="visible-md visible-lg">{if $i.tel}<a href="tel:{$i.tel}">{$i.tel}</a>{else}.{/if}</td>
|
||||
<td class="visible-md visible-lg">{if $i.email}<a href="mailto:{$i.email}">{$i.email}</a>{else}.{/if}</td>
|
||||
<td class="td_btn_action"><button class="btn btn-xs btn-link glyphicon glyphicon-edit btnEditClient" ref="{$i.ref}"></button></td>
|
||||
<td class="td_btn_action td_btn_delete"><button class="btn btn-xs btn-link glyphicon glyphicon-trash btnDeleteClient" ref="{$i.ref}" nom="{$i.nom} {$i.prenom}"></button></td>
|
||||
</tr>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="6">aucun client</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
<tbody class="table progressLoadList" id="clientsList" start="{$list_limits.start}" end="{$list_limits.end}" rest="{$list_limits.rest}">
|
||||
{include file='clients/clients_list_builder.tpl'}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
|
@ -60,7 +46,7 @@
|
|||
<div class="modal-header">
|
||||
<div class="pull-right hidden-xs">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveAddClient">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
|
||||
<h2 class="modal-title">
|
||||
|
|
@ -69,14 +55,14 @@
|
|||
</h2>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="formAddClient" class="formClient">
|
||||
<form class="formClient">
|
||||
{include file='clients/client_form.tpl'}
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer visible-xs">
|
||||
<div class="pull-right">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveAddClient">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -91,7 +77,7 @@
|
|||
<div class="modal-header">
|
||||
<div class="pull-right hidden-xs">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveEditClient">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
|
||||
<h2 class="modal-title">
|
||||
|
|
@ -100,14 +86,14 @@
|
|||
</h2>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="formEditClient" class="formClient">
|
||||
<form class="formClient">
|
||||
{include file='clients/client_form.tpl'}
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer visible-xs">
|
||||
<div class="pull-right">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveEditClient">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -130,7 +116,7 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-danger" id="btnDeleteClient">Confirmer</button>
|
||||
<button type="button" class="btn btn-danger btnSave">Confirmer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
{foreach from=$list item=i}
|
||||
<tr>
|
||||
<td class="center visible-lg id">{$i.ref}</td>
|
||||
<td class="name"><a href="#" class="btnViewClient" ref={$i.ref}>{$i.prenom} {$i.nom}</a></td>
|
||||
<td class="visible-md visible-lg tel">{if $i.tel}<a href="tel:{$i.tel}">{$i.tel}</a>{else}.{/if}</td>
|
||||
<td class="visible-md visible-lg email">{if $i.email}<a href="mailto:{$i.email}">{$i.email}</a>{else}.{/if}</td>
|
||||
<td class="td_btn_action"><button class="btn btn-xs btn-link glyphicon glyphicon-edit btnEditClient" ref="{$i.ref}"></button></td>
|
||||
<td class="td_btn_action td_btn_delete"><button class="btn btn-xs btn-link glyphicon glyphicon-trash btnDeleteClient" ref="{$i.ref}" nom="{$i.nom} {$i.prenom}"></button></td>
|
||||
</tr>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="6">aucun client</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
<button type="button" class="navbar-toggle"><span class="glyphicon glyphicon-filter"></span></button>
|
||||
<a class="navbar-brand brand">
|
||||
<img src="img/clients.svg" class="hidden-xs">
|
||||
<span>{$list|@count} CLIENT{if $list|@count>1}S{/if}</span>
|
||||
<span>{$list_limits.max} CLIENT{if $list_limits.max>1}S{/if}</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@
|
|||
<div class="input-group">
|
||||
<select class="form-control" name="type">{include file='contrats/contrats_types_select_list.tpl'}</select>
|
||||
<span class="input-group-btn hide">
|
||||
<button class="btn btn-default btnContratTypeSecondAction">
|
||||
<button class="btn btn-default btnSecondAction">
|
||||
<i class="glyphicon glyphicon-remove"></i>
|
||||
</button>
|
||||
</span>
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default btnContratTypeAction add">
|
||||
<button class="btn btn-default btnAction add">
|
||||
<i class="glyphicon glyphicon-plus"></i>
|
||||
</button>
|
||||
</span>
|
||||
|
|
@ -54,12 +54,12 @@
|
|||
<div class="input-group">
|
||||
<select class="form-control" name="lieu_depot">{include file='contrats/lieux_select_list.tpl'}</select>
|
||||
<span class="input-group-btn hide">
|
||||
<button class="btn btn-default btnLieuSecondAction">
|
||||
<button class="btn btn-default btnSecondAction">
|
||||
<i class="glyphicon glyphicon-remove"></i>
|
||||
</button>
|
||||
</span>
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default btnLieuAction add">
|
||||
<button class="btn btn-default btnAction add">
|
||||
<i class="glyphicon glyphicon-plus"></i>
|
||||
</button>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@
|
|||
</h2>
|
||||
</div>
|
||||
<div class="modal-body formContrat">
|
||||
<ul class="nav nav-tabs formContratTabs">
|
||||
<li role="presentation" class="active"><a href="#" class="formContratTabBtn" tab="tabInfos">Informations</a></li>
|
||||
<li role="presentation"><a href="#" class="formContratTabBtn" tab="tabPaniers">Paniers Livrés</a></li>
|
||||
<ul class="nav nav-tabs formTabsBtns">
|
||||
<li role="presentation" class="active"><a href="#" class="formTabBtn" tab="tabInfos">Informations</a></li>
|
||||
<li role="presentation"><a href="#" class="formTabBtn" tab="tabPaniers">Paniers Livrés</a></li>
|
||||
</ul>
|
||||
<div class="formContratTabs">
|
||||
<div class="formTabs">
|
||||
<div class="tab tabInfos active">
|
||||
<table class="table">
|
||||
<table class="table modal-body">
|
||||
<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>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
{if !$frameDisplay}{include file='structure/top.tpl'}{/if}
|
||||
|
||||
<table class="table table-hover">
|
||||
<table class="table table-hover scrollingTableList">
|
||||
<thead>
|
||||
<th style="width:45px;" class="center visible-lg">
|
||||
<th class="center visible-lg id">
|
||||
<a href={if $order=="ref" && $sens=="ASC"}"?order=ref&sens=DESC"
|
||||
{else}"?order=ref&sens=ASC"{/if} style="text-decoration: none;">
|
||||
#{if $order=="ref"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<th class="name">
|
||||
<a href={if $order=="prenom" && $sens=="ASC"}"?order=prenom&sens=DESC"
|
||||
{else}"?order=prenom&sens=ASC"{/if} style="text-decoration: none;">
|
||||
{if $order=="prenom"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}prénom
|
||||
|
|
@ -18,86 +18,58 @@
|
|||
nom{if $order=="nom"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th class="visible-lg">
|
||||
<th class="visible-lg groupe">
|
||||
<a href={if $order=="groupe" && $sens=="ASC"}"?order=groupe&sens=DESC"
|
||||
{else}"?order=groupe&sens=ASC"{/if} style="text-decoration: none;">
|
||||
groupe{if $order=="groupe"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th class="visible-lg">
|
||||
<th class="visible-lg contrat_type">
|
||||
<a href={if $order=="type" && $sens=="ASC"}"?order=type&sens=DESC"
|
||||
{else}"?order=type&sens=ASC"{/if} style="text-decoration: none;">
|
||||
type{if $order=="type"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th class="visible-md visible-lg center">
|
||||
<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;">
|
||||
début de contrat{if $order=="date"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th class="visible-md visible-lg center">
|
||||
<th class="visible-md visible-lg center freq">
|
||||
<a href={if $order=="frequence" && $sens=="ASC"}"?order=frequence&sens=DESC"
|
||||
{else}"?order=frequence&sens=ASC"{/if} style="text-decoration: none;">
|
||||
fréquence{if $order=="frequence"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th class="visible-md visible-lg center">
|
||||
<th class="visible-md visible-lg center panier_type">
|
||||
<a href={if $order=="panier_type" && $sens=="ASC"}"?order=panier_type&sens=DESC"
|
||||
{else}"?order=panier_type&sens=ASC"{/if} style="text-decoration: none;">
|
||||
type de panier{if $order=="panier_type"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th class="visible-md visible-lg center">
|
||||
<th class="visible-md visible-lg center items_long">
|
||||
<a href={if $order=="nb_paniers_livre" && $sens=="ASC"}"?order=nb_paniers_livre&sens=DESC"
|
||||
{else}"?order=nb_paniers_livre&sens=ASC"{/if} style="text-decoration: none;">
|
||||
nb. de paniers livrés{if $order=="nb_paniers_livres"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
livrés{if $order=="nb_paniers_livre"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th class="visible-lg center">
|
||||
<th class="visible-lg center items_long">
|
||||
<a href={if $order=="nb_paniers_restant" && $sens=="ASC"}"?order=nb_paniers_restant&sens=DESC"
|
||||
{else}"?order=nb_paniers_restant&sens=ASC"{/if} style="text-decoration: none;">
|
||||
nb. de paniers restants{if $order=="nb_paniers_restants"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
restants{if $order=="nb_paniers_restant"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th class="visible-md visible-lg center">
|
||||
<th class="visible-md visible-lg center lieu">
|
||||
<a href={if $order=="lieu_depot" && $sens=="ASC"}"?order=lieu_depot&sens=DESC"
|
||||
{else}"?order=lieu_depot&sens=ASC"{/if} style="text-decoration: none;">
|
||||
lieu de dépôt{if $order=="lieu_depot"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th style="width: 30px;"></th>
|
||||
<th style="width: 30px;"><button class="btn btn-xs btn-info glyphicon glyphicon-plus" id="btnAddContrat"></button></th>
|
||||
<th class="btn_action right" colspan="2"><button class="btn btn-xs btn-info glyphicon glyphicon-plus" id="btnAddContrat"></button></th>
|
||||
</thead>
|
||||
<tbody class="table">
|
||||
{foreach from=$list item=i}
|
||||
<tr class="{if $i.archive>0}archive{/if}{if $i.warning_nb_paniers} warning{/if}{if $i.nb_paniers_restants<=0} danger{/if}">
|
||||
<td class="center visible-lg">{$i.ref}</td>
|
||||
<td><a href="#" class="btnViewContrat" ref={$i.ref}>{$i.client_prenom} {$i.client_nom}</a></td>
|
||||
<td class="visible-lg">{$i.groupe_nom}</td>
|
||||
<td class="visible-lg">{$i.type_nom}</td>
|
||||
<td class="visible-md visible-lg center">{$i.date_print}</td>
|
||||
<td class="visible-md visible-lg center">{$i.frequence_print}</td>
|
||||
<td class="visible-md visible-lg center">{$i.panier_type_nom}</td>
|
||||
<td class="visible-md visible-lg center">{$i.nb_paniers_livres} / {$i.nb_paniers}</td>
|
||||
<td class="visible-lg center">{$i.nb_paniers_restants}{if $i.force_eligible>0} <i class="glyphicon glyphicon-star"></i>{/if}</td>
|
||||
<td class="visible-md visible-lg center">{$i.lieu_depot_nom}</td>
|
||||
<td class="td_btn_action"><button class="btn btn-xs btn-link glyphicon glyphicon-edit btnEditContrat" ref="{$i.ref}"></button></td>
|
||||
{if $i.nb_paniers_livres_absolute>0}
|
||||
{if $i.archive>0}
|
||||
<td class="td_btn_action td_btn_unarchive"><button class="btn btn-xs btn-link glyphicon glyphicon-folder-open btnUnarchiveContrat" ref="{$i.ref}" nom="{$i.client_prenom} {$i.client_nom}"></button></td>
|
||||
{else}
|
||||
<td class="td_btn_action td_btn_archive"><button class="btn btn-xs btn-link glyphicon glyphicon-folder-close btnArchiveContrat" ref="{$i.ref}" nom="{$i.client_prenom} {$i.client_nom}"></button></td>
|
||||
{/if}
|
||||
{else}
|
||||
<td class="td_btn_action td_btn_delete"><button class="btn btn-xs btn-link glyphicon glyphicon-trash btnDeleteContrat" ref="{$i.ref}" nom="{$i.client_prenom} {$i.client_nom}"></button></td>
|
||||
{/if}
|
||||
</tr>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="12">aucun contrat</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
<tbody class="table progressLoadList" id="contratsList" start="{$list_limits.start}" end="{$list_limits.end}" rest="{$list_limits.rest}">
|
||||
{include file='contrats/contrats_list_builder.tpl'}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
|
@ -110,23 +82,22 @@
|
|||
<div class="modal-header">
|
||||
<div class="pull-right hidden-xs">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveAddContrat">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
|
||||
<h2 class="modal-title">
|
||||
<img style="width:50px;" class="hidden-xs" src="img/contrat.svg">
|
||||
Ajouter un contrat
|
||||
</h2>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="formAddContrat" class="formContrat">
|
||||
<form class="formContrat">
|
||||
{include file='contrats/contrat_form.tpl'}
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer visible-xs">
|
||||
<div class="pull-right">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveAddContrat">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -141,23 +112,22 @@
|
|||
<div class="modal-header">
|
||||
<div class="pull-right hidden-xs">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveEditContrat">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
|
||||
<h2 class="modal-title">
|
||||
<img style="width:50px;" class="hidden-xs" src="img/contrat.svg">
|
||||
Modifier un contrat
|
||||
</h2>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="formEditContrat" class="formContrat">
|
||||
<form class="formContrat">
|
||||
{include file='contrats/contrat_form.tpl'}
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer visible-xs">
|
||||
<div class="pull-right">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveEditContrat">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -180,7 +150,7 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-danger" id="btnArchiveContrat">Confirmer</button>
|
||||
<button type="button" class="btn btn-danger btnSave">Confirmer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -202,7 +172,7 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-danger" id="btnDeleteContrat">Confirmer</button>
|
||||
<button type="button" class="btn btn-danger btnSave">Confirmer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
{foreach from=$list item=i}
|
||||
<tr class="{if $i.archive>0}archive{/if}{if $i.warning_nb_paniers} warning{/if}{if $i.nb_paniers_restants<=0} danger{/if}">
|
||||
<td class="center visible-lg id">{$i.ref}</td>
|
||||
<td class="name"><a href="#" class="btnViewContrat" ref={$i.ref}>{$i.client_prenom} {$i.client_nom}</a></td>
|
||||
<td class="visible-lg groupe">{$i.groupe_nom}</td>
|
||||
<td class="visible-lg contrat_type">{$i.type_nom}</td>
|
||||
<td class="visible-md visible-lg center date">{$i.date_print}</td>
|
||||
<td class="visible-md visible-lg center freq">{$i.frequence_print}</td>
|
||||
<td class="visible-md visible-lg center panier_type">{$i.panier_type_nom}</td>
|
||||
<td class="visible-md visible-lg center items_long">{$i.nb_paniers_livres} / {$i.nb_paniers}</td>
|
||||
<td class="visible-lg center items_long">{$i.nb_paniers_restants}{if $i.force_eligible>0} <i class="glyphicon glyphicon-star"></i>{/if}</td>
|
||||
<td class="visible-md visible-lg center lieu">{$i.lieu_depot_nom}</td>
|
||||
<td class="td_btn_action"><button class="btn btn-xs btn-link glyphicon glyphicon-edit btnEditContrat" ref="{$i.ref}"></button></td>
|
||||
{if $i.nb_paniers_livres_absolute>0}
|
||||
{if $i.archive>0}
|
||||
<td class="td_btn_action td_btn_unarchive"><button class="btn btn-xs btn-link glyphicon glyphicon-folder-open btnUnarchiveContrat" ref="{$i.ref}" nom="{$i.client_prenom} {$i.client_nom}"></button></td>
|
||||
{else}
|
||||
<td class="td_btn_action td_btn_archive"><button class="btn btn-xs btn-link glyphicon glyphicon-folder-close btnArchiveContrat" ref="{$i.ref}" nom="{$i.client_prenom} {$i.client_nom}"></button></td>
|
||||
{/if}
|
||||
{else}
|
||||
<td class="td_btn_action td_btn_delete"><button class="btn btn-xs btn-link glyphicon glyphicon-trash btnDeleteContrat" ref="{$i.ref}" nom="{$i.client_prenom} {$i.client_nom}"></button></td>
|
||||
{/if}
|
||||
</tr>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="12">aucun contrat</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
<button type="button" class="navbar-toggle"><span class="glyphicon glyphicon-filter"></span></button>
|
||||
<a class="navbar-brand brand">
|
||||
<img src="img/contrat.svg" class="hidden-xs">
|
||||
<span>{$list|@count} CONTRAT{if $list|@count>1}S{/if}</span>
|
||||
<span>{$list_limits.max} CONTRAT{if $list_limits.max>1}S{/if}</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
|
|
@ -12,12 +12,12 @@
|
|||
<!-- GROUPE -->
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon{if $groupe>0} active{/if}">groupe :</span>
|
||||
<select class="form-control" name="groupe" load_value="{$groupe}">{include file='paniers_groupes/paniers_groupes_select_list.tpl'}</select>
|
||||
<select class="form-control" name="groupe" load_value="{$groupe}" filtre_request="groupe">{include file='paniers_groupes/paniers_groupes_select_list.tpl'}</select>
|
||||
</div>
|
||||
<!-- FREQUENCE -->
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon{if $frequence!="0"} active{/if}">fréq. :</span>
|
||||
<select class="form-control" name="frequence" load_value="{$frequence}">
|
||||
<select class="form-control" name="frequence" load_value="{$frequence}" filtre_request="frequence">
|
||||
<option value="0">choisir...</option>
|
||||
<option value="hebdo">hebdo</option>
|
||||
<option value="quinz">quinz.</option>
|
||||
|
|
@ -28,26 +28,26 @@
|
|||
<!-- PANIER -->
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon{if $panier>0} active{/if}">panier :</span>
|
||||
<select class="form-control" name="panier" load_value="{$panier}">{include file='paniers/paniers_select_list.tpl'}</select>
|
||||
<select class="form-control" name="panier" load_value="{$panier}" filtre_request="panier">{include file='paniers/paniers_select_list.tpl'}</select>
|
||||
</div>
|
||||
<!-- LIEU -->
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon{if $lieu>0} active{/if}">lieu :</span>
|
||||
<select class="form-control" name="lieu" load_value="{$lieu}">
|
||||
<select class="form-control" name="lieu" load_value="{$lieu}" filtre_request="lieu">
|
||||
{include file='contrats/lieux_select_list.tpl'}
|
||||
</select>
|
||||
</div>
|
||||
<!-- ARCHIVE -->
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon{if $archive!=0} active{/if}">archive :</span>
|
||||
<select class="form-control" name="archive" load_value="{$archive}">
|
||||
<select class="form-control" name="archive" load_value="{$archive}" filtre_request="archive">
|
||||
<option value="-1">tous</option>
|
||||
<option value="0">non</option>
|
||||
<option value="1">oui</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- SEARCH -->
|
||||
<div class="input-group class">
|
||||
<div class="input-group class searchGrp">
|
||||
<span class="input-group-addon{if $search!=""} active{/if}"><i class="glyphicon glyphicon-search"></i></span>
|
||||
<input type="text" class="form-control" placeholder="rechercher..." name="search" value="{$search}">
|
||||
{if $search!=""}<span class="input-group-addon btn-danger btnClearSearch"><i class="glyphicon glyphicon-remove"></i></span>{/if}
|
||||
|
|
|
|||
|
|
@ -1,62 +1,48 @@
|
|||
{if !$frameDisplay}{include file='structure/top.tpl'}{/if}
|
||||
|
||||
<table class="table table-hover">
|
||||
<table class="table table-hover scrollingTableList">
|
||||
<thead>
|
||||
<th style="width:45px;" class="center visible-lg">
|
||||
<th class="center visible-lg id">
|
||||
<a href={if $order=="ref" && $sens=="ASC"}"?order=ref&sens=DESC"
|
||||
{else}"?order=ref&sens=ASC"{/if} style="text-decoration: none;">
|
||||
#{if $order=="ref"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<th class="nom">
|
||||
<a href={if $order=="nom" && $sens=="ASC"}"?order=nom&sens=DESC"
|
||||
{else}"?order=nom&sens=ASC"{/if} style="text-decoration: none;">
|
||||
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">
|
||||
<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}
|
||||
</a>
|
||||
</th>
|
||||
<th class="visible-md visible-lg">
|
||||
<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 d'application du tarif{if $order=="date"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
date{if $order=="date"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th style="width: 30px;"></th>
|
||||
<th style="width: 30px;"><button class="btn btn-xs btn-info glyphicon glyphicon-plus" id="btnAddLegume"></button></th>
|
||||
<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">
|
||||
{foreach from=$list item=i}
|
||||
<tr>
|
||||
<td class="center visible-lg">{$i.ref}</td>
|
||||
<td><a href="#" class="btnViewLegume" ref={$i.ref}>{$i.nom}</a></td>
|
||||
<td class="visible-md visible-lg">{if $i.tarif_print}{$i.tarif_print}{else}.{/if}</td>
|
||||
<td class="visible-md visible-lg">{$i.tarif_date_print}</td>
|
||||
<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>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="6">aucun légume</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
<tbody class="table progressLoadList" id="legumesList" start="{$list_limits.start}" end="{$list_limits.end}" rest="{$list_limits.rest}">
|
||||
{include file='legumes/legumes_list_builder.tpl'}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{include file='legumes/legume_modal_view.tpl'}
|
||||
|
||||
<!-- MODAL ADD LEGUME -->
|
||||
<div class="modal fade" id="modalAddLegume" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal fade add" id="modalAddLegume" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<div class="pull-right hidden-xs">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveAddLegume">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
|
||||
<h2 class="modal-title">
|
||||
|
|
@ -65,14 +51,14 @@
|
|||
</h2>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="formAddLegume" class="formLegume">
|
||||
<form class="formLegume">
|
||||
{include file='legumes/legume_form.tpl'}
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer visible-xs">
|
||||
<div class="pull-right">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveAddLegume">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -81,13 +67,13 @@
|
|||
<!-- end MODAL ADD LEGUME -->
|
||||
|
||||
<!-- MODAL EDIT LEGUME -->
|
||||
<div class="modal fade" id="modalEditLegume" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal fade edit" id="modalEditLegume" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<div class="pull-right hidden-xs">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveEditLegume">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
|
||||
<h2 class="modal-title">
|
||||
|
|
@ -96,14 +82,14 @@
|
|||
</h2>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="formEditLegume" class="formLegume">
|
||||
<form class="formLegume">
|
||||
{include file='legumes/legume_form.tpl'}
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer visible-xs">
|
||||
<div class="pull-right">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveEditLegume">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -112,7 +98,7 @@
|
|||
<!-- end MODAL EDIT LEGUME -->
|
||||
|
||||
<!-- MODAL DELETE LEGUME -->
|
||||
<div class="modal fade" id="modalDeleteLegume" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal fade delete" id="modalDeleteLegume" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
|
|
@ -126,7 +112,7 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-danger" id="btnDeleteLegume">Confirmer</button>
|
||||
<button type="button" class="btn btn-danger btnSave">Confirmer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
{foreach from=$list item=i}
|
||||
<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>
|
||||
<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>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="6">aucun légume</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
|
@ -4,12 +4,12 @@
|
|||
<button type="button" class="navbar-toggle"><span class="glyphicon glyphicon-filter"></span></button>
|
||||
<a class="navbar-brand brand">
|
||||
<img src="img/legumes.svg" class="hidden-xs">
|
||||
<span>{$list|@count} LÉGUME{if $list|@count>1}S{/if}</span>
|
||||
<span>{$list_limits.max} LÉGUME{if $list_limits.max>1}S{/if}</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
<form class="navbar-form navbar-right" role="search" id="legumesSearch">
|
||||
<div class="input-group class">
|
||||
<div class="input-group class searchGrp">
|
||||
<span class="input-group-addon{if $search!=""} active{/if}"><i class="glyphicon glyphicon-search"></i></span>
|
||||
<input type="text" class="form-control" placeholder="rechercher..." name="search" value="{$search}">
|
||||
{if $search!=""}<span class="input-group-addon btn-danger btnClearSearch"><i class="glyphicon glyphicon-remove"></i></span>{/if}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<div class="modaLoader"></div>
|
||||
<ul class="nav nav-tabs formLivraisonTabs">
|
||||
<li role="presentation" class="active"><a href="#" class="formLivraisonTabBtn" tab="tabGeneral">Général</a></li>
|
||||
<li role="presentation"><a href="#" class="formLivraisonTabBtn" tab="tabPaniers">Paniers</a></li>
|
||||
<li role="presentation"><a href="#" class="formLivraisonTabBtn" tab="tabCompo">Composition</a></li>
|
||||
<li role="presentation"><a href="#" class="formLivraisonTabBtn" tab="tabLegumes">Total Légumes</a></li>
|
||||
<ul class="nav nav-tabs formTabsBtns">
|
||||
<li role="presentation" class="active"><a href="#" class="formTabBtn" tab="tabGeneral">Général</a></li>
|
||||
<li role="presentation"><a href="#" class="formTabBtn" tab="tabPaniers">Paniers</a></li>
|
||||
<li role="presentation"><a href="#" class="formTabBtn" tab="tabCompo">Composition</a></li>
|
||||
<li role="presentation"><a href="#" class="formTabBtn" tab="tabLegumes">Total Légumes</a></li>
|
||||
</ul>
|
||||
<div class="formLivraisonTabs">
|
||||
<div class="formTabs">
|
||||
<div class="tab tabGeneral active">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
|
@ -76,6 +76,3 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,15 +21,15 @@
|
|||
<li print_type="full"><a href="#" target="_blank" print_type="full">Complet</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<ul class="nav nav-tabs formLivraisonTabs">
|
||||
<li tab="tabGeneral"><a href="#" class="formLivraisonTabBtn" tab="tabGeneral">Général</a></li>
|
||||
<li tab="tabPaniers"><a href="#" class="formLivraisonTabBtn" tab="tabPaniers">Paniers</a></li>
|
||||
<li tab="tabCompo"><a href="#" class="formLivraisonTabBtn" tab="tabCompo">Composition</a></li>
|
||||
<li tab="tabLegumes"><a href="#" class="formLivraisonTabBtn" tab="tabLegumes">Total Légumes</a></li>
|
||||
<ul class="nav nav-tabs formTabsBtns">
|
||||
<li tab="tabGeneral"><a href="#" class="formTabBtn" tab="tabGeneral">Général</a></li>
|
||||
<li tab="tabPaniers"><a href="#" class="formTabBtn" tab="tabPaniers">Paniers</a></li>
|
||||
<li tab="tabCompo"><a href="#" class="formTabBtn" tab="tabCompo">Composition</a></li>
|
||||
<li tab="tabLegumes"><a href="#" class="formTabBtn" tab="tabLegumes">Total Légumes</a></li>
|
||||
</ul>
|
||||
<div class="formLivraisonTabs">
|
||||
<div class="formTabs">
|
||||
<div class="tab tabGeneral active">
|
||||
<table class="table">
|
||||
<table class="table modal-body">
|
||||
<tr><th>groupe de paniers :</th><td class="groupe"></td></tr>
|
||||
<tr><th>date :</th><td class="date"></td></tr>
|
||||
<tr><th>groupe bi-hebdo :</th><td class="quinz_groupe"></td></tr>
|
||||
|
|
|
|||
|
|
@ -1,64 +1,41 @@
|
|||
{if !$frameDisplay}{include file='structure/top.tpl'}{/if}
|
||||
|
||||
<table class="table table-hover">
|
||||
<table class="table table-hover scrollingTableList">
|
||||
<thead>
|
||||
<th style="width:45px;" class="center visible-lg">
|
||||
<th class="center visible-lg id">
|
||||
<a href={if $order=="ref" && $sens=="ASC"}"?order=ref&sens=DESC"
|
||||
{else}"?order=ref&sens=ASC"{/if} style="text-decoration: none;">
|
||||
#{if $order=="ref"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<th class="visible-md visible-lg groupe center">
|
||||
<a href={if $order=="paniers_groupe" && $sens=="ASC"}"?order=paniers_groupe&sens=DESC"
|
||||
{else}"?order=paniers_groupe&sens=ASC"{/if} style="text-decoration: none;">
|
||||
groupe{if $order=="paniers_groupe"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th class="name">
|
||||
<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}
|
||||
</a>
|
||||
</th>
|
||||
<th class="visible-md visible-lg">
|
||||
<th class="visible-md visible-lg quinz_group">
|
||||
<a href={if $order=="quinz_groupe" && $sens=="ASC"}"?order=quinz_groupe&sens=DESC"
|
||||
{else}"?order=quinz_groupe&sens=ASC"{/if} style="text-decoration: none;">
|
||||
groupe quinzaine{if $order=="quinz_groupe"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th class="visible-md visible-lg">
|
||||
<a href={if $order=="paniers_groupe" && $sens=="ASC"}"?order=paniers_groupe&sens=DESC"
|
||||
{else}"?order=paniers_groupe&sens=ASC"{/if} style="text-decoration: none;">
|
||||
groupe de paniers{if $order=="paniers_groupe"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th class="visible-md visible-lg">
|
||||
<th class="visible-md visible-lg items_long center">
|
||||
<a href={if $order=="nb_paniers" && $sens=="ASC"}"?order=nb_paniers&sens=DESC"
|
||||
{else}"?order=nb_paniers&sens=ASC"{/if} style="text-decoration: none;">
|
||||
nb. de paniers{if $order=="nb_paniers"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th style="width: 30px;"></th>
|
||||
<th style="width: 30px;"><button class="btn btn-xs btn-info glyphicon glyphicon-plus" id="btnAddLivraison"></button></th>
|
||||
<th class="btn_action right" colspan="3"><button class="btn btn-xs btn-info glyphicon glyphicon-plus" id="btnAddLivraison"></button></th>
|
||||
</thead>
|
||||
<tbody class="table">
|
||||
{foreach from=$list item=i}
|
||||
<tr{if $i.archive>0} class="archive"{/if}>
|
||||
<td class="center visible-lg">{$i.ref}</td>
|
||||
<td><a href="#" class="btnViewLivraison" ref="{$i.ref}">{$i.date_print}</a></td>
|
||||
<td class="visible-md visible-lg">{if $i.quinz_groupe!=""}groupe {$i.quinz_groupe}{else}.{/if}</td>
|
||||
<td class="visible-md visible-lg">{$i.paniers_groupe_nom}</td>
|
||||
<td class="visible-md visible-lg">{$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>
|
||||
{if $i.nb_paniers>0}
|
||||
{if $i.archive>0}
|
||||
<td class="td_btn_action td_btn_unarchive"><button class="btn btn-xs btn-link glyphicon glyphicon-folder-open btnUnarchiveLivraison" ref="{$i.ref}" date="{$i.date_print}"></button></td>
|
||||
{else}
|
||||
<td class="td_btn_action td_btn_archive"><button class="btn btn-xs btn-link glyphicon glyphicon-folder-close btnArchiveLivraison" ref="{$i.ref}" date="{$i.date_print}"></button></td>
|
||||
{/if}
|
||||
{else}
|
||||
<td class="td_btn_action td_btn_delete"><button class="btn btn-xs btn-link glyphicon glyphicon-trash btnDeleteLivraison" ref="{$i.ref}" date="{$i.date_print}"></button></td>
|
||||
{/if}
|
||||
</tr>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="6">aucune livraison</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
<tbody class="table progressLoadList" id="livraisonsList" start="{$list_limits.start}" end="{$list_limits.end}" rest="{$list_limits.rest}">
|
||||
{include file='livraisons/livraisons_list_builder.tpl'}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
|
@ -71,7 +48,7 @@
|
|||
<div class="modal-header">
|
||||
<div class="pull-right hidden-xs">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveAddLivraison">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
|
||||
<h2 class="modal-title">
|
||||
|
|
@ -80,14 +57,14 @@
|
|||
</h2>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="formAddLivraison" class="formLivraison">
|
||||
<form class="formLivraison">
|
||||
{include file='livraisons/livraison_form.tpl'}
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer visible-xs">
|
||||
<div class="pull-right">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveAddLivraison">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -102,7 +79,7 @@
|
|||
<div class="modal-header">
|
||||
<div class="pull-right hidden-xs">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveEditLivraison">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
|
||||
<h2 class="modal-title">
|
||||
|
|
@ -111,14 +88,14 @@
|
|||
</h2>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="formEditLivraison" class="formLivraison">
|
||||
<form class="formLivraison">
|
||||
{include file='livraisons/livraison_form.tpl'}
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer visible-xs">
|
||||
<div class="pull-right">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveEditLivraison">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -126,6 +103,28 @@
|
|||
</div>
|
||||
<!-- end MODAL EDIT LIVRAISON -->
|
||||
|
||||
<!-- MODAL ARCHIVE LIVRAISON -->
|
||||
<div class="modal fade" id="modalArchiveLivraison" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2 class="modal-title">
|
||||
<img style="width:50px;" class="hidden-xs" src="img/livraison.svg">
|
||||
Archiver une livraison
|
||||
</h2>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Etes-vous sûr de vouloir archiver la livraison <b class="groupe">groupe</b> du <b class="date">date</b> ?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-warning btnSave">Confirmer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end MODAL ARCHIVE LIVRAISON -->
|
||||
|
||||
<!-- MODAL DELETE LIVRAISON -->
|
||||
<div class="modal fade" id="modalDeleteLivraison" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
|
|
@ -141,33 +140,11 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-danger" id="btnDeleteLivraison">Confirmer</button>
|
||||
<button type="button" class="btn btn-danger btnSave">Confirmer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end MODAL DELETE LIVRAISON -->
|
||||
|
||||
<!-- MODAL ARCHIVE LIVRAISON -->
|
||||
<div class="modal fade" id="modalArchiveLivraison" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2 class="modal-title">
|
||||
<img style="width:50px;" class="hidden-xs" src="img/livraison.svg">
|
||||
Archiver une livraison
|
||||
</h2>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Etes-vous sûr de vouloir archiver la livraison du <b class="date">date</b> ?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-danger" id="btnArchiveLivraison">Confirmer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end MODAL ARCHIVE LIVRAISON -->
|
||||
|
||||
{if !$frameDisplay}{include file='structure/bottom.tpl'}{/if}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
{foreach from=$list item=i}
|
||||
<tr{if $i.archive>0} class="archive"{/if}>
|
||||
<td class="center visible-lg id">{$i.ref}</td>
|
||||
<td class="visible-md visible-lg groupe center">{$i.paniers_groupe_nom}</td>
|
||||
<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"><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}
|
||||
<td class="td_btn_action td_btn_unarchive"><button class="btn btn-xs btn-link glyphicon glyphicon-folder-open btnUnarchiveLivraison" ref="{$i.ref}" groupe="{$i.paniers_groupe_nom}" date="{$i.date_print}"></button></td>
|
||||
{else}
|
||||
<td class="td_btn_action td_btn_archive"><button class="btn btn-xs btn-link glyphicon glyphicon-folder-close btnArchiveLivraison" ref="{$i.ref}" groupe="{$i.paniers_groupe_nom}" date="{$i.date_print}"></button></td>
|
||||
{/if}
|
||||
{else}
|
||||
<td class="td_btn_action td_btn_delete"><button class="btn btn-xs btn-link glyphicon glyphicon-trash btnDeleteLivraison" ref="{$i.ref}" groupe="{$i.paniers_groupe_nom}" date="{$i.date_print}"></button></td>
|
||||
{/if}
|
||||
</tr>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="6">aucune livraison</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
|
@ -4,18 +4,18 @@
|
|||
<button type="button" class="navbar-toggle"><span class="glyphicon glyphicon-filter"></span></button>
|
||||
<a class="navbar-brand brand">
|
||||
<img src="img/livraison.svg" class="hidden-xs">
|
||||
<span>{$list|@count} LIVRAISON{if $list|@count>1}S{/if}</span>
|
||||
<span>{$list_limits.max} LIVRAISON{if $list_limits.max>1}S{/if}</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
<form class="navbar-form navbar-right" role="search" id="livraisonsFiltre">
|
||||
<form class="navbar-form navbar-right" role="search" id="livraisonsSearch">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon{if $groupe>0} active{/if}">groupe :</span>
|
||||
<select class="form-control" name="groupe" load_value="{$groupe}">{include file='paniers_groupes/paniers_groupes_select_list.tpl'}</select>
|
||||
<select class="form-control" name="groupe" load_value="{$groupe}" filtre_request="groupe">{include file='paniers_groupes/paniers_groupes_select_list.tpl'}</select>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon{if $archive!=0} active{/if}">archive :</span>
|
||||
<select class="form-control" name="archive" load_value="{$archive}">
|
||||
<select class="form-control" name="archive" load_value="{$archive}" filtre_request="archive">
|
||||
<option value="-1">tous</option>
|
||||
<option value="0">non</option>
|
||||
<option value="1">oui</option>
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@
|
|||
<div class="input-group">
|
||||
<select class="form-control" name="groupe">{include file='paniers_groupes/paniers_groupes_select_list.tpl'}</select>
|
||||
<span class="input-group-btn hide">
|
||||
<button class="btn btn-default btnGroupeSecondAction">
|
||||
<button class="btn btn-default btnSecondAction">
|
||||
<i class="glyphicon glyphicon-remove"></i>
|
||||
</button>
|
||||
</span>
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default btnGroupeAction add">
|
||||
<button class="btn btn-default btnAction add">
|
||||
<i class="glyphicon glyphicon-plus"></i>
|
||||
</button>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -1,49 +1,35 @@
|
|||
{if !$frameDisplay}{include file='structure/top.tpl'}{/if}
|
||||
|
||||
<table class="table table-hover">
|
||||
<table class="table table-hover scrollingTableList">
|
||||
<thead>
|
||||
<th style="width:45px;" class="center visible-lg">
|
||||
<th class="center visible-lg id">
|
||||
<a href={if $order=="ref" && $sens=="ASC"}"?order=ref&sens=DESC"
|
||||
{else}"?order=ref&sens=ASC"{/if} style="text-decoration: none;">
|
||||
#{if $order=="ref"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<th class="name">
|
||||
<a href={if $order=="nom" && $sens=="ASC"}"?order=nom&sens=DESC"
|
||||
{else}"?order=nom&sens=ASC"{/if} style="text-decoration: none;">
|
||||
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">
|
||||
<th class="visible-md visible-lg groupe center">
|
||||
<a href={if $order=="groupe" && $sens=="ASC"}"?order=groupe&sens=DESC"
|
||||
{else}"?order=groupe&sens=ASC"{/if} style="text-decoration: none;">
|
||||
groupe{if $order=="groupe"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th class="visible-md visible-lg">
|
||||
<th class="visible-md visible-lg valeur center">
|
||||
<a href={if $order=="valeur" && $sens=="ASC"}"?order=valeur&sens=DESC"
|
||||
{else}"?order=valeur&sens=ASC"{/if} style="text-decoration: none;">
|
||||
valeur{if $order=="valeur"} <i class="glyphicon glyphicon-chevron-{if $sens=="ASC"}up{else}down{/if}"></i>{/if}
|
||||
</a>
|
||||
</th>
|
||||
<th style="width: 30px;"></th>
|
||||
<th style="width: 30px;"><button class="btn btn-xs btn-info glyphicon glyphicon-plus" id="btnAddPanier"></button></th>
|
||||
<th class="btn_action right" colspan="2"><button class="btn btn-xs btn-info glyphicon glyphicon-plus" id="btnAddPanier"></button></th>
|
||||
</thead>
|
||||
<tbody class="table">
|
||||
{foreach from=$list item=i}
|
||||
<tr>
|
||||
<td class="center visible-lg">{$i.ref}</td>
|
||||
<td><a href="#" class="btnViewPanier" ref={$i.ref}>{$i.nom}</a></td>
|
||||
<td class="visible-md visible-lg">{$i.groupe_nom}</td>
|
||||
<td class="visible-md visible-lg">{$i.valeur|string_format:"%.2f"} €</td>
|
||||
<td class="td_btn_action"><button class="btn btn-xs btn-link glyphicon glyphicon-edit btnEditPanier" ref="{$i.ref}"></button></td>
|
||||
<td class="td_btn_action td_btn_delete"><button class="btn btn-xs btn-link glyphicon glyphicon-trash btnDeletePanier" ref="{$i.ref}" nom="{$i.nom}"></button></td>
|
||||
</tr>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="6">aucun type de panier</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
<tbody class="table progressLoadList" id="paniersList" start="{$list_limits.start}" end="{$list_limits.end}" rest="{$list_limits.rest}">
|
||||
{include file='paniers/paniers_list_builder.tpl'}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
|
@ -56,7 +42,7 @@
|
|||
<div class="modal-header">
|
||||
<div class="pull-right hidden-xs">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveAddPanier">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
|
||||
<h2 class="modal-title">
|
||||
|
|
@ -65,14 +51,14 @@
|
|||
</h2>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="formAddPanier" class="formPanier">
|
||||
<form class="formPanier">
|
||||
{include file='paniers/panier_form.tpl'}
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer visible-xs">
|
||||
<div class="pull-right">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveAddPanier">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -87,7 +73,7 @@
|
|||
<div class="modal-header">
|
||||
<div class="pull-right hidden-xs">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveEditPanier">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
|
||||
<h2 class="modal-title">
|
||||
|
|
@ -96,14 +82,14 @@
|
|||
</h2>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="formEditPanier" class="formPanier">
|
||||
<form class="formPanier">
|
||||
{include file='paniers/panier_form.tpl'}
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer visible-xs">
|
||||
<div class="pull-right">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-custom btnSaveEditPanier">Enregistrer</button>
|
||||
<button type="button" class="btn btn-custom btnSave">Enregistrer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -126,7 +112,7 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-danger" id="btnDeletePanier">Confirmer</button>
|
||||
<button type="button" class="btn btn-danger btnSave">Confirmer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
{foreach from=$list item=i}
|
||||
<tr>
|
||||
<td class="center visible-lg id">{$i.ref}</td>
|
||||
<td class="name"><a href="#" class="btnViewPanier" ref={$i.ref}>{$i.nom}</a></td>
|
||||
<td class="visible-md visible-lg groupe center">{$i.groupe_nom}</td>
|
||||
<td class="visible-md visible-lg valeur center">{$i.valeur|string_format:"%.2f"} €</td>
|
||||
<td class="td_btn_action"><button class="btn btn-xs btn-link glyphicon glyphicon-edit btnEditPanier" ref="{$i.ref}"></button></td>
|
||||
<td class="td_btn_action td_btn_delete"><button class="btn btn-xs btn-link glyphicon glyphicon-trash btnDeletePanier" ref="{$i.ref}" nom="{$i.nom}"></button></td>
|
||||
</tr>
|
||||
{foreachelse}
|
||||
<tr>
|
||||
<td colspan="6">aucun type de panier</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
<button type="button" class="navbar-toggle"><span class="glyphicon glyphicon-filter"></span></button>
|
||||
<a class="navbar-brand brand">
|
||||
<img src="img/panier.svg" class="hidden-xs">
|
||||
<span>{$list|@count} PANIER{if $list|@count>1}S{/if}</span>
|
||||
<span>{$list_limits.max} PANIER{if $list_limits.max>1}S{/if}</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<!-- GROUPE -->
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon{if $groupe>0} active{/if}">groupe :</span>
|
||||
<select class="form-control" name="groupe" load_value="{$groupe}">{include file='paniers_groupes/paniers_groupes_select_list.tpl'}</select>
|
||||
<select class="form-control" name="groupe" load_value="{$groupe}" filtre_request="groupe">{include file='paniers_groupes/paniers_groupes_select_list.tpl'}</select>
|
||||
</div>
|
||||
<!-- SEARCH -->
|
||||
<div class="input-group class">
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
{foreach from=$jsFiles item=file}
|
||||
<script src="{$file}?gitVS={$gitVS.short}"></script>
|
||||
{/foreach}
|
||||
<script>var srvErrorMsg = "ERREUR SERVEUR ! Contacter Adrien..."; </script>
|
||||
<script>var current_page = "{$page}"; </script>
|
||||
</head>
|
||||
<body id="body" lang="{$lang}">
|
||||
{if !$noMenu}
|
||||
|
|
|
|||
Loading…
Reference in New Issue