diff --git a/conf/db_struct.php b/conf/db_struct.php index 0bd68ab..569675d 100644 --- a/conf/db_struct.php +++ b/conf/db_struct.php @@ -10,6 +10,11 @@ define('PANIERS_GROUPES_TABLE_STRUCT', array( "del" => array( "type" => "bool", "default" => 0 ) )); +function getCountPaniersGroupesListSelectBaseSQL() { + return "SELECT count(*) as nb" + ." FROM ".PANIERS_GROUPES_TABLE; +} + function getPaniersGroupesSelectBaseSQL() { return "SELECT " .PANIERS_GROUPES_TABLE.".`ref`," @@ -253,6 +258,11 @@ define('CONTRATS_TYPES_TABLE_STRUCT', array( "del" => array( "type" => "bool", "default" => 0 ) )); +function getCountContratsTypesListSelectBaseSQL() { + return "SELECT count(*) as nb" + ." FROM ".CONTRATS_TYPES_TABLE; +} + function getContratsTypesTableSelectBaseSQL() { return "SELECT " .CONTRATS_TYPES_TABLE.".`ref`," @@ -262,6 +272,7 @@ function getContratsTypesTableSelectBaseSQL() { .CONTRATS_TYPES_TABLE.".`frequence`," .CONTRATS_TYPES_TABLE.".`panier_type` as 'panier_type_ref'," .PANIERS_TYPES_TABLE.".`nom` as 'panier_type_nom'," + .PANIERS_TYPES_TABLE.".`valeur` as 'panier_type_valeur'," .CONTRATS_TYPES_TABLE.".`nb_paniers`," .CONTRATS_TYPES_TABLE.".`prix_total`" ." FROM ".CONTRATS_TYPES_TABLE @@ -269,6 +280,18 @@ function getContratsTypesTableSelectBaseSQL() { ." LEFT JOIN ".PANIERS_TYPES_TABLE." ON ".CONTRATS_TYPES_TABLE.".`panier_type`=".PANIERS_TYPES_TABLE.".`ref`"; } +function buildContratsTypesListFiltresSQL($sql, $filtres) { + if(array_key_exists('groupe', $filtres) && (int)$filtres['groupe']>0) $sql.=" AND ".CONTRATS_TYPES_TABLE.".`groupe`=".intval($filtres['groupe']); + if(array_key_exists('frequence', $filtres) && $filtres['frequence']!="") { + switch($filtres['frequence']) { + case 'hebdo' : $sql.=" AND ".CONTRATS_TYPES_TABLE.".`frequence`='hebdo'"; break; + case 'quinz' : $sql.=" AND ".CONTRATS_TYPES_TABLE.".`frequence`='quinz'"; break; + } + } + if(array_key_exists('panier', $filtres) && (int)$filtres['panier']>0) $sql.=" AND ".CONTRATS_TYPES_TABLE.".`panier_type`=".intval($filtres['panier']); + return $sql; +} + //////////////////////////////////////////////////////////////////////// // LEGUMES ///////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// @@ -334,6 +357,11 @@ define('LIEUX_TABLE_STRUCT', array( "del" => array( "type" => "bool", "default" => 0 ) )); +function getCountLieuxListSelectBaseSQL() { + return "SELECT count(*) as nb" + ." FROM ".LIEUX_TABLE; +} + function getLieuxTableSelectBaseSQL() { return "SELECT " .LIEUX_TABLE.".`ref`," diff --git a/functions/functions_contrats_types.php b/functions/functions_contrats_types.php index 11dccfb..ca14342 100644 --- a/functions/functions_contrats_types.php +++ b/functions/functions_contrats_types.php @@ -16,11 +16,25 @@ $allowContratsTypesListOrder = array( 'prix_total' => 'prix total' ); -function getContratsTypesList($order='id',$sens='ASC', $search=false) { +function getNbContratsTypesInList($filtres=array()) { + $sql = getCountContratsTypesListSelectBaseSQL()." WHERE ".CONTRATS_TYPES_TABLE.".`del`=0"; + $sql = buildContratsTypesListFiltresSQL($sql, $filtres); + $r = $GLOBALS['db_admin']['man']->select($sql, 1); + if(!$r['erreur']) return intval($r['datas']['nb']); + else { + $er = "
sql: ".$sql."
error: ".getReadableVar($r['erreur']); + return "Une erreur est survenue durant du nombre d'item dans la liste !".$er; + } +} + +function getContratsTypesList($order='id',$sens='ASC', $filtres=array(), $limits=false) { $list = array(); $sql = getContratsTypesTableSelectBaseSQL()." WHERE ".CONTRATS_TYPES_TABLE.".`del`=0"; + // FILTRES + $sql = buildContratsTypesListFiltresSQL($sql, $filtres); + // ORDRE $sql.=" ORDER BY "; @@ -37,10 +51,16 @@ function getContratsTypesList($order='id',$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']) { - foreach($r['datas'] as $i) $list[$i['ref']] = $i; + foreach($r['datas'] as $i) { + $i["frequence_print"] = CONTRATS_FREQUENCES[$i["frequence"]]; + $list[$i['ref']] = $i; + } } else { $er = "
sql: ".$sql."
error: ".getReadableVar($r['erreur']); @@ -61,6 +81,7 @@ function getContratsTypeDatas($id) { if(!$r['erreur']) { $i = $r['datas']; + $i["frequence_print"] = CONTRATS_FREQUENCES[$i["frequence"]]; } else { $er = "
sql: ".$sql."
error: ".getReadableVar($r['erreur']); @@ -112,4 +133,39 @@ function eraseContratsType($id) { $id, // ID "du type de contrat" // ERROR STRING ); +} + +// LINKED CONTRATS + +function updateContratsTypeLinks($id) { + $datas = getContratsTypeDatas($id); + if(!is_array($datas)) return $datas; + + // UNLINK CONTRATS + $sql = "UPDATE ".CONTRATS_TABLE." SET `type`=NULL WHERE `type`=".intval($id) + ." AND (`groupe`!=".$datas["groupe_ref"] + ." OR `frequence`!='".$datas["frequence"]."'" + ." OR `panier_type`!=".$datas["panier_type_ref"] + ." OR `nb_paniers`!=".$datas["nb_paniers"].")"; + + $r = $GLOBALS['db_admin']['man']->execSql($sql); + if(!$r || $r['erreur']!=false) { + $er = "
sql: ".$r['sql']."
result: ".getReadableVar($r['result'])."
error: ".getReadableVar($r['erreur']); + return "ERREUR : Une erreur est survenue durant la mise à jour des contrats liés dans la base de données ! ".$er; + } + + // LINK CUSTOM + $sql = "UPDATE ".CONTRATS_TABLE." SET `type`=".intval($id)." WHERE `type` IS NULL" + ." AND `groupe`=".$datas["groupe_ref"] + ." AND `frequence`='".$datas["frequence"]."'" + ." AND `panier_type`=".$datas["panier_type_ref"] + ." AND `nb_paniers`=".$datas["nb_paniers"]; + + $r = $GLOBALS['db_admin']['man']->execSql($sql); + if(!$r || $r['erreur']!=false) { + $er = "
sql: ".$r['sql']."
result: ".getReadableVar($r['result'])."
error: ".getReadableVar($r['erreur']); + return "ERREUR : Une erreur est survenue durant la mise à jour des contrats liés dans la base de données ! ".$er; + } + + return 1; } \ No newline at end of file diff --git a/functions/functions_lieux.php b/functions/functions_lieux.php index 5923ff2..7e7f6a9 100644 --- a/functions/functions_lieux.php +++ b/functions/functions_lieux.php @@ -11,22 +11,24 @@ $allowLieuxListOrder = array( 'nom' => "nom" ); -function getLieuxList($order='id',$sens='ASC', $search=false) { +function getNbLieuxInList($search=false) { + $sql = getCountLieuxListSelectBaseSQL()." WHERE ".LIEUX_TABLE.".`del`=0"; + $sql = buildSqlSearch($sql, $search, buildLieuxSearchSQL); + $r = $GLOBALS['db_admin']['man']->select($sql, 1); + if(!$r['erreur']) return intval($r['datas']['nb']); + else { + $er = "
sql: ".$sql."
error: ".getReadableVar($r['erreur']); + return "Une erreur est survenue durant du nombre d'item dans la liste !".$er; + } +} + +function getLieuxList($order='id',$sens='ASC', $search=false, $limits=false) { $list = array(); $sql = getLieuxTableSelectBaseSQL()." WHERE ".LIEUX_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 " : "").buildLieuxSearchSQL($p); - } - if($search_sql!="") $sql .= " AND (".$search_sql.")"; - } - } + $sql = buildSqlSearch($sql, $search, buildLieuxSearchSQL); // ORDRE $sql.=" ORDER BY "; @@ -39,6 +41,9 @@ function getLieuxList($order='id',$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']) { diff --git a/functions/functions_paniers_groupes.php b/functions/functions_paniers_groupes.php index 2c71b37..7380c97 100644 --- a/functions/functions_paniers_groupes.php +++ b/functions/functions_paniers_groupes.php @@ -11,22 +11,24 @@ $allowPaniersGroupesListOrder = array( 'nom' => "nom" ); -function getPaniersGroupesList($order='nom',$sens='ASC', $search=false) { +function getNbPaniersGroupesInList($search=false) { + $sql = getCountPaniersGroupesListSelectBaseSQL()." WHERE ".PANIERS_GROUPES_TABLE.".`del`=0"; + $sql = buildSqlSearch($sql, $search, buildPaniersGroupesListSearchSQL); + $r = $GLOBALS['db_admin']['man']->select($sql, 1); + if(!$r['erreur']) return intval($r['datas']['nb']); + else { + $er = "
sql: ".$sql."
error: ".getReadableVar($r['erreur']); + return "Une erreur est survenue durant du nombre d'item dans la liste !".$er; + } +} + +function getPaniersGroupesList($order='nom',$sens='ASC', $search=false, $limits=false) { $list = array(); $sql = getPaniersGroupesSelectBaseSQL()." WHERE ".PANIERS_GROUPES_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 " : "").buildPaniersGroupesListSearchSQL($p); - } - if($search_sql!="") $sql .= " AND (".$search_sql.")"; - } - } + $sql = buildSqlSearch($sql, $search, buildPaniersGroupesListSearchSQL); // ORDRE $sql.=" ORDER BY "; @@ -39,6 +41,9 @@ function getPaniersGroupesList($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']) { diff --git a/public_html_admin/contrats.php b/public_html_admin/contrats.php index d3feb11..ef97704 100644 --- a/public_html_admin/contrats.php +++ b/public_html_admin/contrats.php @@ -37,33 +37,6 @@ if($id>0 && $action) { } } switch($action) { - /****** CONTRATS TYPES ***********/ - // ADD CONTRATS TYPE - case "add_contrats_type": { - $datas = getContratsTypeDatasFromRequest(); - die( strval( addContratsType($datas) ) ); - } break; - // EDIT CONTRATS TYPE - case "edit_contrats_type": { - $id = isset($_REQUEST['type_ref']) ? intval($_REQUEST['type_ref']) : 0; - if($id>0) { - $datas = getContratsTypeDatasFromRequest(); - die( strval( updateContratsType($id, $datas) ) ); - } - else die("ERREUR : aucune référence de type de contrat transmis..."); - } break; - // DELETE CONTRATS TYPE - case "delete_contrats_type": { - $id = isset($_REQUEST['type_ref']) ? intval($_REQUEST['type_ref']) : 0; - if($id>0) die( strval( deleteContratsType($id) ) ); - else die("ERREUR : aucune référence de type de contrat transmis..."); - } break; - // CONTRATS TYPES SELECT LIST - case "contrats_types_select_list": { - $GLOBALS['smarty'] -> assign('contrats_types_list', getContratsTypesList()); - die( $GLOBALS['smarty']->fetch("contrats/contrats_types_select_list.tpl") ); - } break; - /****** LIEUX DE DEPOT ***********/ // ADD LIEU case "add_lieu": { @@ -88,7 +61,7 @@ switch($action) { // LIEUX SELECT LIST case "lieux_select_list": { $GLOBALS['smarty'] -> assign('lieux_list', getLieuxList()); - die( $GLOBALS['smarty']->fetch("contrats/lieux_select_list.tpl") ); + die( $GLOBALS['smarty']->fetch("lieux/lieux_select_list.tpl") ); } break; /****** CONTRAT ***********/ @@ -106,7 +79,7 @@ switch($action) { // REQUIRED LISTS & FILTRE $groupesList = getPaniersGroupesList(); - $groupe = getRequestAndSessionSave("groupe", "livraisons_filtre_groupe", "groupe", "int", 0, $groupesList, true); + $groupe = getRequestAndSessionSave("groupe", "contrats_filtre_groupe", "groupe", "int", 0, $groupesList, true); $paniersTypesList = getPaniersTypesList('nom','ASC', false, $groupe); $lieuxList = getLieuxList(); $filtres = array( diff --git a/public_html_admin/contrats_types.php b/public_html_admin/contrats_types.php new file mode 100644 index 0000000..f2d83da --- /dev/null +++ b/public_html_admin/contrats_types.php @@ -0,0 +1,79 @@ +assign('page','contrats_types'); +$GLOBALS['template'] = 'contrats_types/contrats_types_list.tpl'; +$GLOBALS['smarty']->assign('secondbar','contrats_types/contrats_types_secondbar.tpl'); +$jsFiles[] = PUBLIC_HTML_ADMIN.'js/contrats_types.js'; +$cssFiles[] = PUBLIC_HTML_ADMIN.'css/contrats.css'; + +if($id>0 && $action) { + $infos = getContratsTypeDatas($id); + switch($action) { + // AJAX GET DATAS + case "getDatas": die(json_encode($infos)); break; + // EDIT + case "edit": { + $datas = getContratsTypeDatasFromRequest(); + $r = updateContratsType($id,$datas); + if($r == 1) $r = updateContratsTypeLinks($id); + die( strval( $r ) ); + } break; + // DELETE + case "delete" : die( strval( deleteContratsType($id) ) ); break; + // DEFAULT + default: die("NO ACTION"); + } +} +switch($action) { + // ADD + case "add": { + $datas = getContratsTypeDatasFromRequest(); + die( strval( addContratsType($datas) ) ); + } break; + // SELECT LIST + case "select_list": { + $GLOBALS['smarty'] -> assign('contrats_types_list', getContratsTypesList()); + die( $GLOBALS['smarty']->fetch("contrats_types/contrats_types_select_list.tpl") ); + } break; + // DEFAULT - LIST + default: { + // REQUIRED LISTS & FILTRE + $groupesList = getPaniersGroupesList(); + $groupe = getRequestAndSessionSave("groupe", "contrats_types_filtre_groupe", "groupe", "int", 0, $groupesList, true); + $paniersTypesList = getPaniersTypesList('nom','ASC', false, $groupe); + $filtres = array( + "groupe" => $groupe, + "frequence" => getRequestAndSessionSave("frequence", "contrats_types_filtre_frequence", "frequence", "txt", 0, array("hebdo", "quinz", "quinz_A", "quinz_B")), + "panier" => getRequestAndSessionSave("panier", "contrats_types_filtre_panier", "panier", "int", 0, $paniersTypesList, true) + ); + + // LIMITS + $limits = array("start" => 0, "end" => LIST_NB_LIGNES_PAR_PAGE, "nbItemsByPage" => LIST_NB_LIGNES_PAR_PAGE, "max" => getNbContratsTypesInList($filtres)); + 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_types_list_order', 'contrats_types_list_sens', $allowContratsListOrder, 'nom'); + $list = getContratsTypesList($order["order"], $order["sens"], $filtres, $limits); + $GLOBALS['smarty'] -> assign('list',$list); + + // LIST PART + if(isset($_REQUEST['startListAt']) && (int)$_REQUEST['startListAt']>0) { + $limits["list"] = $GLOBALS['smarty']->fetch("contrats_types/contrats_types_list_builder.tpl"); + die(json_encode($limits)); + } + + // REQUIRED LISTS + $GLOBALS['smarty'] -> assign('paniers_groupes_list', $groupesList); + $GLOBALS['smarty'] -> assign('paniers_list', $paniersTypesList); + + // DISPLAY + display(); + } +} \ No newline at end of file diff --git a/public_html_admin/css/admin.css b/public_html_admin/css/admin.css index bf376f1..b37dbc3 100644 --- a/public_html_admin/css/admin.css +++ b/public_html_admin/css/admin.css @@ -49,6 +49,14 @@ div.main-navbar a.brand img { div.main-navbar button.navbar-toggle { margin-right: 5px; padding: 5px; } +div.main-navbar a.btnAdmin { + background-size: 24px; + background-position: 12px; + background-image: url(../img/gears.svg); + background-repeat: no-repeat; + padding-left: 42px; +} + /* SECOND BAR */ div.secondbar { @@ -86,11 +94,11 @@ div.secondbar ul.navbar-nav li.active > a { color: #3296C8; } -div.secondbar form.form-filtre-search { padding-right: 0; } +div.secondbar .form-filtre-search { padding-right: 0; } -div.secondbar form.form-filtre-search i.btnClearSearch { cursor: pointer; } +div.secondbar .form-filtre-search i.btnClearSearch { cursor: pointer; } -div.secondbar form.form-filtre-search span.separator { +div.secondbar .form-filtre-search span.separator { display: inline-table; vertical-align: middle; width: 0; height: 30px; @@ -98,7 +106,7 @@ div.secondbar form.form-filtre-search span.separator { border-left: 1px solid #CCCCCC; } -div.secondbar form.form-filtre-search button.btnPrint span.txt { display: none; } +div.secondbar .form-filtre-search button.btnPrint span.txt { display: none; } @media (max-width: 767px) { div.main-navbar a.brand img { height: 40px; } @@ -107,18 +115,18 @@ div.secondbar form.form-filtre-search button.btnPrint span.txt { display: none; div.secondbar a.brand { height: 40px; padding: 10px; } div.secondbar div.navbar-filtre-search { border-top: 1px solid #CCCCCC; padding: 0 5px; } - div.secondbar form.form-filtre-search { padding: 5px 0; margin: 0; } - div.secondbar form.form-filtre-search > *:not(:last-child) { padding-bottom: 7px; } + div.secondbar .form-filtre-search { padding: 5px 0; margin: 0; } + div.secondbar .form-filtre-search > *:not(:last-child) { padding-bottom: 7px; } - div.secondbar form.form-filtre-search span.separator { + div.secondbar .form-filtre-search span.separator { width: 100%; height: 0px; margin: 0; border-left: none; border-top: 1px solid #CCCCCC; } - div.secondbar form.form-filtre-search button.btnPrint { width: 100%; } - div.secondbar form.form-filtre-search button.btnPrint span.txt { display: inline; } + div.secondbar .form-filtre-search button.btnPrint { width: 100%; } + div.secondbar .form-filtre-search button.btnPrint span.txt { display: inline; } div.secondbar div.input-group.order { display: table!important; width: 100%; @@ -126,7 +134,7 @@ div.secondbar form.form-filtre-search button.btnPrint span.txt { display: none; padding: 7px 0 0 0; } - div.secondbar button.btnPrint { margin: -5px; } + div.secondbar button.btnPrint { margin-top: -5px; } } /* LIST */ diff --git a/public_html_admin/img/gears.svg b/public_html_admin/img/gears.svg new file mode 100644 index 0000000..030c066 --- /dev/null +++ b/public_html_admin/img/gears.svg @@ -0,0 +1,40 @@ + + + + + + + + + + \ No newline at end of file diff --git a/public_html_admin/img/groups.svg b/public_html_admin/img/groups.svg new file mode 100644 index 0000000..efeaabc --- /dev/null +++ b/public_html_admin/img/groups.svg @@ -0,0 +1,6 @@ + + + +layers + + \ No newline at end of file diff --git a/public_html_admin/img/lieux.svg b/public_html_admin/img/lieux.svg new file mode 100644 index 0000000..8bef8ad --- /dev/null +++ b/public_html_admin/img/lieux.svg @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public_html_admin/js/clients.js b/public_html_admin/js/clients.js index 1fe2eef..52fb392 100644 --- a/public_html_admin/js/clients.js +++ b/public_html_admin/js/clients.js @@ -269,7 +269,7 @@ function modalViewClient_initAbsenceRow(row) { /***** MODAL FORM ADD/EDIT *****/ function modalFormClient_init(modal) { - modal.find("form").on("submit", function(e) { e.preventDefault(); }); + modal.find("form").preventFormValidation(); // NOM initUpperCaseInput(modal.find("input[name=nom]"), null, function() { $(this).blur(); }); diff --git a/public_html_admin/js/contrats.js b/public_html_admin/js/contrats.js index 7079fc9..ea9b5be 100644 --- a/public_html_admin/js/contrats.js +++ b/public_html_admin/js/contrats.js @@ -168,7 +168,7 @@ function modalViewContrat_clear(modal) { /***** MODAL FORM ADD/EDIT *****/ function modalFormContrat_init(modal) { - modal.find("form").on("submit", function(e) { e.preventDefault(); }); + modal.find("form").preventFormValidation(); // CLIENT AUTOCOMPLETE initAutocompleteInput( @@ -185,12 +185,12 @@ function modalFormContrat_init(modal) { "contrat", // MODAL FORM NAME modal.find("select[name=type]").parent(), // SELECT GROUPE "le type de contrat", // VALUE NAME - contratsConf.baseURL, // URL - "type_ref", // REF ATTR - "add_contrats_type", // ADD ACTION - "edit_contrats_type", // EDIT ACTION - "delete_contrats_type", // DELETE ACTION - "contrats_types_select_list", // REFRESH LIST ACTION + "contrats_types.php", // URL + "ref", // REF ATTR + "add", // ADD ACTION + "edit", // EDIT ACTION + "delete", // DELETE ACTION + "select_list", // REFRESH LIST ACTION modalFormContrat_contratType_selectClbkFct, // SELECT CLBK FCT modalFormContrat_showCustomType, // ADD CKBK FCT modalFormContrat_showCustomType, // EDIT CKBK FCT @@ -219,12 +219,12 @@ function modalFormContrat_init(modal) { "contrat", // MODAL FORM NAME modal.find("select[name=lieu_depot]").parent(), // SELECT GROUPE "le lieu de dépôt", // VALUE NAME - contratsConf.baseURL, // URL - "lieu_ref", // REF ATTR - "add_lieu", // ADD ACTION - "edit_lieu", // EDIT ACTION - "delete_lieu", // DELETE ACTION - "lieux_select_list" // REFRESH LIST ACTION + "lieux.php", // URL + "ref", // REF ATTR + "add", // ADD ACTION + "edit", // EDIT ACTION + "delete", // DELETE ACTION + "select_list" // REFRESH LIST ACTION ); // NB PANIERS diff --git a/public_html_admin/js/contrats_types.js b/public_html_admin/js/contrats_types.js new file mode 100644 index 0000000..2772b82 --- /dev/null +++ b/public_html_admin/js/contrats_types.js @@ -0,0 +1,324 @@ +// SETTINGS +var contratsTypesConf = { + type : "contrats type", + baseURL : "contrats_types.php", + // LIST + list_selector : "#contratsTypesList", + // FILTRES + filtres_selector : "#contratsTypesSearch select", + // VIEW + view_modalSelector : "#modalViewContratsType", + view_btnSelector : ".btnViewContratsType", + // ADD + add_modalSelector : "#modalAddContratsType", + add_btnSelector : "#btnAddContratsType", + // EDIT + edit_modalSelector : "#modalEditContratsType", + edit_btnSelector : ".btnEditContratsType", + // DELETE + delete_modalSelector : "#modalDeleteContratsType", + delete_btnSelector : ".btnDeleteContratsType", +} + +// MODALS +var modalViewContratsType = false; +var modalAddContratsType = false; +var modalEditContratsType = false; +var modalDeleteContratsType = false; + +$(document).ready( function() { + // LIST LOADER + initListProgressLoad($(contratsTypesConf.list_selector), contratsTypesConf.baseURL, contratsTypesConf.type+" list"); + + // FILTRES + $(contratsTypesConf.filtres_selector).initFiltreSelect(); + + // VIEW + modalViewContratsType = $(contratsTypesConf.view_modalSelector); + if(modalViewContratsType.length>0) { + initViewContratsType(); + // VIEW REQUEST + var id = getUrlParameter("ref"); + if(id!==false && parseInt(id)>0 && current_page == "contratsTypes") { + modalViewContratsType_clear(modalViewContratsType); + modalViewContratsType_loadDatas(modalViewContratsType, id); + } + } + + // ADD + modalAddContratsType = $(contratsTypesConf.add_modalSelector); + if(modalAddContratsType.length>0) initAddContratsType(); + + // EDIT + modalEditContratsType = $(contratsTypesConf.edit_modalSelector); + if(modalEditContratsType.length>0) initEditContratsType(); + + // DELETE + modalDeleteContratsType = $(contratsTypesConf.delete_modalSelector); + if(modalDeleteContratsType.length>0) initDeleteContratsType(); +}); + +/***** MODAL VIEW *****/ +function initViewContratsType() { + // INIT VIEW BTNs + var initBtnFct = function() { modalForm_initBtnView( + $(contratsTypesConf.view_btnSelector), // BTNs + modalViewContratsType, // MODAL + modalViewContratsType_clear, // CLEAR FUNCTION + modalViewContratsType_loadDatas // LOAD DATAS FUNCTION + )}; + registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct ); + initBtnFct(); + + // CANCEL + modalViewContratsType.on('hidden.bs.modal', function() { modalViewContratsType_clear(modalViewContratsType); }); +} + +function modalViewContratsType_loadDatas(modal, id) { + $.post(contratsTypesConf.baseURL, { 'ref' : id, 'action' : 'getDatas' }, function(jsonTxt) { + var datas = JSON.parse(jsonTxt); + + modal.find("small.db_ref > span").html(datas.ref); + + modal.find("td.nom").html(datas.nom); + modal.find("td.groupe").html(datas.groupe_nom); + modal.find("td.frequence").html(datas.frequence_print); + modal.find("td.panier_type").html(datas.panier_type_nom); + modal.find("td.nb_paniers").html(datas.nb_paniers + " panier" + (datas.nb_paniers>1 ? "s" : "")); + modal.find("td.prix_total").html(datas.prix_total + " €"); + + modal.modal('show'); + }).fail(function() { alert("("+contratsTypesConf.type+" - load modal view)"); }); +} + +function modalViewContratsType_clear(modal) { + modal.removeAttr("view_id"); + + modal.find("small.db_ref > span").html(""); + + modal.find("td.nom").html(""); + modal.find("td.groupe").html(""); + modal.find("td.frequence").html(""); + modal.find("td.panier_type").html(""); + modal.find("td.nb_paniers").html(""); + modal.find("td.prix_total").html(""); +} + +/***** MODAL FORM ADD/EDIT *****/ +function modalFormContratsType_init(modal) { + modal.find("form").on("submit", function(e) { e.preventDefault(); }); + + // GROUPE + modal.find("select[name=groupe]").change(function(e) { modalFormContratsType_refreshPaniersTypesSelectList(modal, $(this).val()); }); + + // FREQUENCE + modal.find("select[name=frequence]").change(function(e) { $(this).blur(); }); + + // PANIERS TYPE + modal.find("select[name=panier_type]").change(function(e) { + $(this).blur(); + $(this).attr("old", $(this).attr("valeur")) + .attr("valeur", $(this).find("option:selected").attr("valeur")); + modalFormContratsType_calcPrixTotal(modal, false); + }).focus(function(e) { + $(this).attr("old", $(this).attr("valeur")); + }); + + // NB PANIERS + initIntInputWithLimits(modal.find("input[name=nb_paniers]"), 1, 99); + modal.find("input[name=nb_paniers]").focus(function(e) { + $(this).attr("old", $(this).val()); + }).change( function(e) { + modalFormContratsType_calcPrixTotal(modal, false); + }); + + // PRIX TOTAL + initFloatInput(modal.find("input[name=prix_total]")); + modal.find("button.btnCalcTotal").click(function(e) { + e.preventDefault(); + $(this).blur(); + modalFormContratsType_calcPrixTotal(modal, true); + }) +} + +function modalFormContratsType_loadDatas(modal,id) { + $.post(contratsTypesConf.baseURL, { 'ref' : id, 'action' : 'getDatas' }, function(jsonTxt) { + var datas = JSON.parse(jsonTxt); + + modal.find("input[name=nom]").val(datas.nom); + modal.find("select[name=groupe]").val(datas.groupe_ref); + modal.find("select[name=frequence]").val(datas.frequence); + modal.find("select[name=panier_type]").val(datas.panier_type_ref) + .attr("valeur", datas.panier_type_valeur) + .attr("old", datas.panier_type_valeur); + modal.find("input[name=nb_paniers]").val(datas.nb_paniers) + .attr("old", datas.nb_paniers); + modal.find("input[name=prix_total]").val(datas.prix_total); + + if(modal) modal.modal('show'); + }).fail(function() { alert("("+contratsTypesConf.type+" - load datas in modal form)"); }); +} + +function modalFormContratsType_refreshPaniersTypesSelectList(modal, groupe) { + datas = { + 'action' : 'select_list', + 'groupe' : groupe + }; + $.post("paniers.php", datas, function(result) { + var oldVal = parseInt( modal.find("select[name=panier_type]").val() ); + modal.find("select[name=panier_type]").html(result); + if(oldVal>0 && modal.find("select[name=panier_type] option[value="+oldVal+"]")) modal.find("select[name=panier_type]").val(oldVal); + }).fail(function() { alert("ERREUR SERVEUR ! (form contrats type - refresh paniers types select list)"); }); +} + +function modalFormContratsType_calcPrixTotal(modal, force) { + var panier_type = modal.find("select[name=panier_type]"); + var ipt_nb_paniers = modal.find("input[name=nb_paniers]"); + var ipt_total = modal.find("input[name=prix_total]"); + + var old_valeur_panier = parseFloat( panier_type.attr("old") ); + if(!old_valeur_panier>0) old_valeur_panier = 0.0; + var valeur_panier = parseFloat( panier_type.attr("valeur") ); + if(!valeur_panier>0) valeur_panier = 0.0; + var old_nb_paniers = parseFloat( ipt_nb_paniers.attr("old") ); + if(!nb_paniers>0) nb_paniers = 0.0; + var nb_paniers = parseFloat( ipt_nb_paniers.val() ); + if(!nb_paniers>0) nb_paniers = 0.0; + var total = parseFloat( ipt_total.val() ); + if(!total>0) total = 0.0; + + if(( + (old_valeur_panier != valeur_panier || old_nb_paniers != nb_paniers) + && total == (old_valeur_panier * old_nb_paniers) + ) || force) ipt_total.val(number_format(nb_paniers * valeur_panier, 2, ".", "")); + + panier_type.attr("old", panier_type.find("option:selected").attr("valeur")); + ipt_nb_paniers.attr("old", ipt_nb_paniers.val()); +} + +function modalFormContratsType_clear(modal) { + modal.removeAttr("edit_id"); + modal.find("div.modaLoader").removeClass("show"); + + modal.find("input[name=nom]").val(""); + modal.find("select[name=groupe]").val(0); + modal.find("select[name=frequence]").val(0); + modal.find("select[name=panier_type]").val(0).attr("valeur", 0).attr("old", 0); + modal.find("input[name=nb_paniers]").val(1).attr("old", 1); + modal.find("input[name=prix_total]").val(0); +} + +function modalFormContratsType_getDatas(modal) { + var datas = { + 'nom' : modal.find("input[name=nom]").val(), + 'groupe' : parseInt( modal.find("select[name=groupe]").val() ), + 'frequence' : modal.find("select[name=frequence]").val(), + 'panier_type' : parseInt( modal.find("select[name=panier_type]").val() ), + 'nb_paniers' : parseInt( modal.find("input[name=nb_paniers]").val() ), + 'prix_total' : parseFloat( modal.find("input[name=prix_total]").val() ) + }; + return datas; +} + +function modalFormContratsType_checkDatas(datas) { + if( datas.nom=="" + || !datas.groupe>0 + || !(datas.frequence=="hebdo" || datas.frequence=="quinz") + || !datas.panier_type>0 + || !datas.nb_paniers>1 ) { + alert("ERREUR : un nom et tous les crit!ères du type de contrat doivent être renseigné !"); + return false; + } + return true; +} + +/***** ADD *****/ +function initAddContratsType() { + // INIT FORM + modalFormContratsType_init(modalAddContratsType); + + // INIT ADD BTN + modalForm_initBtnAdd( + $(contratsTypesConf.add_btnSelector), // BTN ADD + modalAddContratsType, // MODAL + modalFormContratsType_clear // CLEAR FORM FUNCTION + ); + + // INIT SAVE BTN + modalForm_initBtnSaveAdd( + modalAddContratsType.find(".btnSave"), // BTN SAVE + contratsTypesConf.type, // ADD TYPE + modalAddContratsType, // MODAL + modalFormContratsType_getDatas, // GET FORM DATAS FUNCTION + modalFormContratsType_checkDatas, // CHECK FORM DATAS FUNCTION + contratsTypesConf.baseURL // SAVE URL + ); + + // CANCEL + modalAddContratsType.on('hidden.bs.modal', function (e) { modalFormContratsType_clear(modalAddContratsType); }); +} + +/***** EDIT *****/ +function initEditContratsType() { + // INIT FORM + modalFormContratsType_init(modalEditContratsType); + + // INIT EDIT BTNs + var initBtnFct = function() { modalForm_initBtnEdit( + $(contratsTypesConf.edit_btnSelector), // BTNs + modalEditContratsType, // MODAL + modalFormContratsType_clear, // CLEAR FUNCTION + modalFormContratsType_loadDatas // LOAD DATAS FUNCTION + )}; + registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct ); + initBtnFct(); + + // INIT SAVE EDIT BTN + modalForm_initBtnSaveEdit( + modalEditContratsType.find(".btnSave"), // BTN SAVE + contratsTypesConf.type, // EDIT TYPE + modalEditContratsType, // MODAL + modalFormContratsType_getDatas, // GET FORM DATAS FUNCTION + modalFormContratsType_checkDatas, // CHECK FORM DATAS FUNCTION + contratsTypesConf.baseURL // SAVE URL + ); + + // CANCEL + modalEditContratsType.on('hidden.bs.modal', function (e) { modalFormContratsType_clear(modalEditContratsType); }); +} + +/***** DELETE *****/ +function initDeleteContratsType() { + // INIT DELETE BTNs + var initBtnFct = function() { modalForm_initBtnDelete( + $(contratsTypesConf.delete_btnSelector), // BTNs + modalDeleteContratsType, // MODAL + modalDeleteContratsType_clear, // CLEAR MODAL FUNCTION + modalDeleteContratsType_loadDatas // LOAD DATAS FUNCTION + )}; + registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct ); + initBtnFct(); + + // INIT SAVE DELETE BTN + modalForm_initBtnSaveDelete( + modalDeleteContratsType.find(".btnSave"), // BTN SAVE + contratsTypesConf.type, // DELETE TYPE + modalDeleteContratsType, // MODAL + false, // GET FORM DATAS FUNCTION + false, // CHECK FORM DATAS FUNCTION + contratsTypesConf.baseURL // SAVE URL + ); + + // CANCEL + modalDeleteContratsType.on('hidden.bs.modal', function (e) { modalDeleteContratsType_clear(); }); +} + +function modalDeleteContratsType_loadDatas(btn, id) { + modalDeleteContratsType.find('b.name').html( btn.attr('nom') ); + modalDeleteContratsType.modal('show'); +} + +function modalDeleteContratsType_clear() { + modalDeleteContratsType.removeAttr("delete_id"); + modalDeleteContratsType.find('b.name').html(""); +} \ No newline at end of file diff --git a/public_html_admin/js/functions.js b/public_html_admin/js/functions.js index f217b08..b6620f4 100644 --- a/public_html_admin/js/functions.js +++ b/public_html_admin/js/functions.js @@ -605,9 +605,15 @@ $.fn.listProgressLoad_resize = function() { /* SEARCH */ +$.fn.preventFormValidation = function() { + $(this).on("submit", function(e) { e.preventDefault(); e.stopPropagation(); }); +} + $.fn.initSearchGroup = function() { - $(this).find("input[search]").unbind('keypress').keypress( function(event) { + $(this).find("input[name=search]").unbind('keypress').keypress( function(event) { if(event.keyCode==13) { + event.preventDefault(); + console.log("SEARCH", $(this).val()); $(this).blur(); document.location = "?search="+$(this).val(); } @@ -680,6 +686,14 @@ function beep(duration, frequency, volume, type, callback) { oscillator.stop(audioCtx.currentTime + ((duration || 500) / 1000)); } +function round_number(number, decimals) { + if(!decimals>0) return Math.round(number); + number = parseFloat(number); + mux = decimals * 10; + n = Math.round(number * mux); + return n / mux; +} + function number_format(number, decimals, dec_point, thousands_sep) { number = (number + '') .replace(/[^0-9+\-Ee.]/g, ''); @@ -1772,84 +1786,3 @@ function uploadTmpPhotoFile(div, file, oldFile, calbckURL) { } } -function getUrlParameters() { - var sPageURL = window.location.search.substring(1), - sURLVariables = sPageURL.split('&'), - sParameterName, - params = [], - i; - for (i = 0; i < sURLVariables.length; i++) { - sParameterName = sURLVariables[i].split('='); - params[sParameterName[0]] = (sParameterName[1] === undefined) ? true : decodeURIComponent(sParameterName[1]); - } - return params; -} - -function getUrlParameter(sParam) { - var sPageURL = window.location.search.substring(1), - sURLVariables = sPageURL.split('&'), - sParameterName, - i; - - for (i = 0; i < sURLVariables.length; i++) { - sParameterName = sURLVariables[i].split('='); - - if (sParameterName[0] === sParam) { - return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); - } - } - return false; -} - -function beep(duration, frequency, volume, type, callback) { - var audioCtx = new (window.AudioContext || window.webkitAudioContext || window.audioContext); - var oscillator = audioCtx.createOscillator(); - var gainNode = audioCtx.createGain(); - - oscillator.connect(gainNode); - gainNode.connect(audioCtx.destination); - - if(volume) gainNode.gain.value = volume; - if(frequency) oscillator.frequency.value = frequency; - if(type) oscillator.type = type; - if(callback) oscillator.onended = callback; - - oscillator.start(audioCtx.currentTime); - oscillator.stop(audioCtx.currentTime + ((duration || 500) / 1000)); -} - -function round_number(number, decimals) { - if(!decimals>0) return Math.round(number); - number = parseFloat(number); - mux = decimals * 10; - n = Math.round(number * mux); - return n / mux; -} - -function number_format(number, decimals, dec_point, thousands_sep) { - number = (number + '') - .replace(/[^0-9+\-Ee.]/g, ''); - var n = !isFinite(+number) ? 0 : +number, - prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), - sep = (typeof thousands_sep === 'undefined') ? '' : thousands_sep, - dec = (typeof dec_point === 'undefined') ? '.' : dec_point, - s = '', - toFixedFix = function(n, prec) { - var k = Math.pow(10, prec); - return '' + (Math.round(n * k) / k) - .toFixed(prec); - }; - // Fix for IE parseFloat(0.55).toFixed(0) = 0; - s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)) - .split('.'); - if (s[0].length > 3) { - s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); - } - if ((s[1] || '') - .length < prec) { - s[1] = s[1] || ''; - s[1] += new Array(prec - s[1].length + 1) - .join('0'); - } - return s.join(dec); -} diff --git a/public_html_admin/js/legumes.js b/public_html_admin/js/legumes.js index 20e14f7..ea2358c 100644 --- a/public_html_admin/js/legumes.js +++ b/public_html_admin/js/legumes.js @@ -6,8 +6,8 @@ var legumesConf = { list_selector : "#legumesList", btn_list_print_selector : "#btnPrintLegumesList", // SEARCH + search_form_selector : "#legumesSearch", search_selector : "#legumesSearch .searchGrp", - filtres_selector : "#legumesSearch select", // VIEW view_modalSelector : "#modalViewLegume", view_btnSelector : ".btnViewLegume", @@ -255,7 +255,7 @@ function modalViewLegume_addTarif(modal, datas, tarifs_courant) { /***** MODAL FORM ADD/EDIT *****/ function modalFormLegume_init(modal) { - modal.find("form").on("submit", function(e) { e.preventDefault(); }); + modal.find("form").preventFormValidation(); // BTN ADD TARIF modal.find("button.btnAddTarif").click(function(e) { diff --git a/public_html_admin/js/lieux.js b/public_html_admin/js/lieux.js new file mode 100644 index 0000000..f2aa1b9 --- /dev/null +++ b/public_html_admin/js/lieux.js @@ -0,0 +1,223 @@ +// SETTINGS +var lieuxConf = { + type : "lieu", + baseURL : "lieux.php", + // LIST + list_selector : "#lieuxList", + // SEARCH + search_selector : "#lieuxSearch .searchGrp", + // VIEW + view_modalSelector : "#modalViewLieu", + view_btnSelector : ".btnViewLieu", + // ADD + add_modalSelector : "#modalAddLieu", + add_btnSelector : "#btnAddLieu", + // EDIT + edit_modalSelector : "#modalEditLieu", + edit_btnSelector : ".btnEditLieu", + // DELETE + delete_modalSelector : "#modalDeleteLieu", + delete_btnSelector : ".btnDeleteLieu", +} + +// MODALS +var modalViewLieu = false; +var modalAddLieu = false; +var modalEditLieu = false; +var modalDeleteLieu = false; + +$(document).ready( function() { + // LIST LOADER + initListProgressLoad($(lieuxConf.list_selector), lieuxConf.baseURL, lieuxConf.type+" list"); + + // SEARCH + $(lieuxConf.search_selector).initSearchGroup(); + + // VIEW + modalViewLieu = $(lieuxConf.view_modalSelector); + if(modalViewLieu.length>0) { + initViewLieu(); + // VIEW REQUEST + var id = getUrlParameter("ref"); + if(id!==false && parseInt(id)>0 && current_page == "lieux") { + modalViewLieu_clear(modalViewLieu); + modalViewLieu_loadDatas(modalViewLieu, id); + } + } + + // ADD + modalAddLieu = $(lieuxConf.add_modalSelector); + if(modalAddLieu.length>0) initAddLieu(); + + // EDIT + modalEditLieu = $(lieuxConf.edit_modalSelector); + if(modalEditLieu.length>0) initEditLieu(); + + // DELETE + modalDeleteLieu = $(lieuxConf.delete_modalSelector); + if(modalDeleteLieu.length>0) initDeleteLieu(); +}); + +/***** MODAL VIEW *****/ +function initViewLieu() { + // INIT VIEW BTNs + var initBtnFct = function() { modalForm_initBtnView( + $(lieuxConf.view_btnSelector), // BTNs + modalViewLieu, // MODAL + modalViewLieu_clear, // CLEAR FUNCTION + modalViewLieu_loadDatas // LOAD DATAS FUNCTION + )}; + registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct ); + initBtnFct(); + + // CANCEL + modalViewLieu.on('hidden.bs.modal', function() { modalViewLieu_clear(modalViewLieu); }); +} + +function modalViewLieu_loadDatas(modal, id) { + $.post(lieuxConf.baseURL, { 'ref' : id, 'action' : 'getDatas' }, function(jsonTxt) { + var datas = JSON.parse(jsonTxt); + + modal.find("small.db_ref > span").html(datas.ref); + + modal.find("td.nom").html(datas.nom); + + modal.modal('show'); + }).fail(function() { alert("("+lieuxConf.type+" - load modal view)"); }); +} + +function modalViewLieu_clear(modal) { + modal.removeAttr("view_id"); + + modal.find("small.db_ref > span").html(""); + + modal.find("td.nom").html(""); +} + +/***** MODAL FORM ADD/EDIT *****/ +function modalFormLieu_init(modal) { + modal.find("form").preventFormValidation(); +} + +function modalFormLieu_loadDatas(modal,id) { + $.post(lieuxConf.baseURL, { 'ref' : id, 'action' : 'getDatas' }, function(jsonTxt) { + var datas = JSON.parse(jsonTxt); + + modal.find("input[name=nom]").val(datas.nom); + + if(modal) modal.modal('show'); + }).fail(function() { alert("("+lieuxConf.type+" - load datas in modal form)"); }); +} + +function modalFormLieu_clear(modal) { + modal.removeAttr("edit_id"); + modal.find("div.modaLoader").removeClass("show"); + + modal.find("input[name=nom]").val(""); +} + +function modalFormLieu_getDatas(modal) { + var datas = { + 'nom' : modal.find("input[name=nom]").val() + }; + return datas; +} + +function modalFormLieu_checkDatas(datas) { + if(datas.nom=="") { + alert("ERREUR : merci de donner un nom à ce lieu !"); + return false; + } + return true; +} + +/***** ADD *****/ +function initAddLieu() { + // INIT FORM + modalFormLieu_init(modalAddLieu); + + // INIT ADD BTN + modalForm_initBtnAdd( + $(lieuxConf.add_btnSelector), // BTN ADD + modalAddLieu, // MODAL + modalFormLieu_clear // CLEAR FORM FUNCTION + ); + + // INIT SAVE BTN + modalForm_initBtnSaveAdd( + modalAddLieu.find(".btnSave"), // BTN SAVE + lieuxConf.type, // ADD TYPE + modalAddLieu, // MODAL + modalFormLieu_getDatas, // GET FORM DATAS FUNCTION + modalFormLieu_checkDatas, // CHECK FORM DATAS FUNCTION + lieuxConf.baseURL // SAVE URL + ); + + // CANCEL + modalAddLieu.on('hidden.bs.modal', function (e) { modalFormLieu_clear(modalAddLieu); }); +} + +/***** EDIT *****/ +function initEditLieu() { + // INIT FORM + modalFormLieu_init(modalEditLieu); + + // INIT EDIT BTNs + var initBtnFct = function() { modalForm_initBtnEdit( + $(lieuxConf.edit_btnSelector), // BTNs + modalEditLieu, // MODAL + modalFormLieu_clear, // CLEAR FUNCTION + modalFormLieu_loadDatas // LOAD DATAS FUNCTION + )}; + registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct ); + initBtnFct(); + + // INIT SAVE EDIT BTN + modalForm_initBtnSaveEdit( + modalEditLieu.find(".btnSave"), // BTN SAVE + lieuxConf.type, // EDIT TYPE + modalEditLieu, // MODAL + modalFormLieu_getDatas, // GET FORM DATAS FUNCTION + modalFormLieu_checkDatas, // CHECK FORM DATAS FUNCTION + lieuxConf.baseURL // SAVE URL + ); + + // CANCEL + modalEditLieu.on('hidden.bs.modal', function (e) { modalFormLieu_clear(modalEditLieu); }); +} + +/***** DELETE *****/ +function initDeleteLieu() { + // INIT DELETE BTNs + var initBtnFct = function() { modalForm_initBtnDelete( + $(lieuxConf.delete_btnSelector), // BTNs + modalDeleteLieu, // MODAL + modalDeleteLieu_clear, // CLEAR MODAL FUNCTION + modalDeleteLieu_loadDatas // LOAD DATAS FUNCTION + )}; + registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct ); + initBtnFct(); + + // INIT SAVE DELETE BTN + modalForm_initBtnSaveDelete( + modalDeleteLieu.find(".btnSave"), // BTN SAVE + lieuxConf.type, // DELETE TYPE + modalDeleteLieu, // MODAL + false, // GET FORM DATAS FUNCTION + false, // CHECK FORM DATAS FUNCTION + lieuxConf.baseURL // SAVE URL + ); + + // CANCEL + modalDeleteLieu.on('hidden.bs.modal', function (e) { modalDeleteLieu_clear(); }); +} + +function modalDeleteLieu_loadDatas(btn, id) { + modalDeleteLieu.find('b.name').html( btn.attr('nom') ); + modalDeleteLieu.modal('show'); +} + +function modalDeleteLieu_clear() { + modalDeleteLieu.removeAttr("delete_id"); + modalDeleteLieu.find('b.name').html(""); +} \ No newline at end of file diff --git a/public_html_admin/js/livraisons.js b/public_html_admin/js/livraisons.js index a8d92c6..42e9459 100644 --- a/public_html_admin/js/livraisons.js +++ b/public_html_admin/js/livraisons.js @@ -259,7 +259,7 @@ function modalViewLivraison_initPrintBtn() { /***** MODAL FORM ADD/EDIT *****/ function modalFormLivraison_init(modal) { - modal.find("modal").on("submit", function(e) { e.preventDefault(); }); + modal.find("form").preventFormValidation(); modalForm_initTabs(modal); // TAB GENERAL diff --git a/public_html_admin/js/paniers.js b/public_html_admin/js/paniers.js index af74787..a7029bd 100644 --- a/public_html_admin/js/paniers.js +++ b/public_html_admin/js/paniers.js @@ -104,7 +104,7 @@ function modalViewPanier_clear(modal) { /***** MODAL FORM ADD/EDIT *****/ function modalFormPanier_init(modal) { - modal.find("form").on("submit", function(e) { e.preventDefault(); }); + modal.find("form").preventFormValidation(); // NOM initFirstUpperCaseInput(modal.find("input[name=nom]"), null, function() { $(this).blur(); }); diff --git a/public_html_admin/js/paniers_groupes.js b/public_html_admin/js/paniers_groupes.js new file mode 100644 index 0000000..68aa1a7 --- /dev/null +++ b/public_html_admin/js/paniers_groupes.js @@ -0,0 +1,223 @@ +// SETTINGS +var paniersGroupesConf = { + type : "groupe", + baseURL : "paniers_groupes.php", + // LIST + list_selector : "#paniersGroupesList", + // SEARCH + search_selector : "#paniersGroupesSearch .searchGrp", + // VIEW + view_modalSelector : "#modalViewPaniersGroupe", + view_btnSelector : ".btnViewPaniersGroupe", + // ADD + add_modalSelector : "#modalAddPaniersGroupe", + add_btnSelector : "#btnAddPaniersGroupe", + // EDIT + edit_modalSelector : "#modalEditPaniersGroupe", + edit_btnSelector : ".btnEditPaniersGroupe", + // DELETE + delete_modalSelector : "#modalDeletePaniersGroupe", + delete_btnSelector : ".btnDeletePaniersGroupe", +} + +// MODALS +var modalViewPaniersGroupe = false; +var modalAddPaniersGroupe = false; +var modalEditPaniersGroupe = false; +var modalDeletePaniersGroupe = false; + +$(document).ready( function() { + // LIST LOADER + initListProgressLoad($(paniersGroupesConf.list_selector), paniersGroupesConf.baseURL, paniersGroupesConf.type+" list"); + + // SEARCH + $(paniersGroupesConf.search_selector).initSearchGroup(); + + // VIEW + modalViewPaniersGroupe = $(paniersGroupesConf.view_modalSelector); + if(modalViewPaniersGroupe.length>0) { + initViewPaniersGroupe(); + // VIEW REQUEST + var id = getUrlParameter("ref"); + if(id!==false && parseInt(id)>0 && current_page == "paniersGroupes") { + modalViewPaniersGroupe_clear(modalViewPaniersGroupe); + modalViewPaniersGroupe_loadDatas(modalViewPaniersGroupe, id); + } + } + + // ADD + modalAddPaniersGroupe = $(paniersGroupesConf.add_modalSelector); + if(modalAddPaniersGroupe.length>0) initAddPaniersGroupe(); + + // EDIT + modalEditPaniersGroupe = $(paniersGroupesConf.edit_modalSelector); + if(modalEditPaniersGroupe.length>0) initEditPaniersGroupe(); + + // DELETE + modalDeletePaniersGroupe = $(paniersGroupesConf.delete_modalSelector); + if(modalDeletePaniersGroupe.length>0) initDeletePaniersGroupe(); +}); + +/***** MODAL VIEW *****/ +function initViewPaniersGroupe() { + // INIT VIEW BTNs + var initBtnFct = function() { modalForm_initBtnView( + $(paniersGroupesConf.view_btnSelector), // BTNs + modalViewPaniersGroupe, // MODAL + modalViewPaniersGroupe_clear, // CLEAR FUNCTION + modalViewPaniersGroupe_loadDatas // LOAD DATAS FUNCTION + )}; + registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct ); + initBtnFct(); + + // CANCEL + modalViewPaniersGroupe.on('hidden.bs.modal', function() { modalViewPaniersGroupe_clear(modalViewPaniersGroupe); }); +} + +function modalViewPaniersGroupe_loadDatas(modal, id) { + $.post(paniersGroupesConf.baseURL, { 'ref' : id, 'action' : 'getDatas' }, function(jsonTxt) { + var datas = JSON.parse(jsonTxt); + + modal.find("small.db_ref > span").html(datas.ref); + + modal.find("td.nom").html(datas.nom); + + modal.modal('show'); + }).fail(function() { alert("("+paniersGroupesConf.type+" - load modal view)"); }); +} + +function modalViewPaniersGroupe_clear(modal) { + modal.removeAttr("view_id"); + + modal.find("small.db_ref > span").html(""); + + modal.find("td.nom").html(""); +} + +/***** MODAL FORM ADD/EDIT *****/ +function modalFormPaniersGroupe_init(modal) { + modal.find("form").preventFormValidation(); +} + +function modalFormPaniersGroupe_loadDatas(modal,id) { + $.post(paniersGroupesConf.baseURL, { 'ref' : id, 'action' : 'getDatas' }, function(jsonTxt) { + var datas = JSON.parse(jsonTxt); + + modal.find("input[name=nom]").val(datas.nom); + + if(modal) modal.modal('show'); + }).fail(function() { alert("("+paniersGroupesConf.type+" - load datas in modal form)"); }); +} + +function modalFormPaniersGroupe_clear(modal) { + modal.removeAttr("edit_id"); + modal.find("div.modaLoader").removeClass("show"); + + modal.find("input[name=nom]").val(""); +} + +function modalFormPaniersGroupe_getDatas(modal) { + var datas = { + 'nom' : modal.find("input[name=nom]").val() + }; + return datas; +} + +function modalFormPaniersGroupe_checkDatas(datas) { + if(datas.nom=="") { + alert("ERREUR : merci de donner un nomà ce groupe !"); + return false; + } + return true; +} + +/***** ADD *****/ +function initAddPaniersGroupe() { + // INIT FORM + modalFormPaniersGroupe_init(modalAddPaniersGroupe); + + // INIT ADD BTN + modalForm_initBtnAdd( + $(paniersGroupesConf.add_btnSelector), // BTN ADD + modalAddPaniersGroupe, // MODAL + modalFormPaniersGroupe_clear // CLEAR FORM FUNCTION + ); + + // INIT SAVE BTN + modalForm_initBtnSaveAdd( + modalAddPaniersGroupe.find(".btnSave"), // BTN SAVE + paniersGroupesConf.type, // ADD TYPE + modalAddPaniersGroupe, // MODAL + modalFormPaniersGroupe_getDatas, // GET FORM DATAS FUNCTION + modalFormPaniersGroupe_checkDatas, // CHECK FORM DATAS FUNCTION + paniersGroupesConf.baseURL // SAVE URL + ); + + // CANCEL + modalAddPaniersGroupe.on('hidden.bs.modal', function (e) { modalFormPaniersGroupe_clear(modalAddPaniersGroupe); }); +} + +/***** EDIT *****/ +function initEditPaniersGroupe() { + // INIT FORM + modalFormPaniersGroupe_init(modalEditPaniersGroupe); + + // INIT EDIT BTNs + var initBtnFct = function() { modalForm_initBtnEdit( + $(paniersGroupesConf.edit_btnSelector), // BTNs + modalEditPaniersGroupe, // MODAL + modalFormPaniersGroupe_clear, // CLEAR FUNCTION + modalFormPaniersGroupe_loadDatas // LOAD DATAS FUNCTION + )}; + registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct ); + initBtnFct(); + + // INIT SAVE EDIT BTN + modalForm_initBtnSaveEdit( + modalEditPaniersGroupe.find(".btnSave"), // BTN SAVE + paniersGroupesConf.type, // EDIT TYPE + modalEditPaniersGroupe, // MODAL + modalFormPaniersGroupe_getDatas, // GET FORM DATAS FUNCTION + modalFormPaniersGroupe_checkDatas, // CHECK FORM DATAS FUNCTION + paniersGroupesConf.baseURL // SAVE URL + ); + + // CANCEL + modalEditPaniersGroupe.on('hidden.bs.modal', function (e) { modalFormPaniersGroupe_clear(modalEditPaniersGroupe); }); +} + +/***** DELETE *****/ +function initDeletePaniersGroupe() { + // INIT DELETE BTNs + var initBtnFct = function() { modalForm_initBtnDelete( + $(paniersGroupesConf.delete_btnSelector), // BTNs + modalDeletePaniersGroupe, // MODAL + modalDeletePaniersGroupe_clear, // CLEAR MODAL FUNCTION + modalDeletePaniersGroupe_loadDatas // LOAD DATAS FUNCTION + )}; + registerListProgressLoadCbkFct( $("tbody.progressLoadList"), initBtnFct ); + initBtnFct(); + + // INIT SAVE DELETE BTN + modalForm_initBtnSaveDelete( + modalDeletePaniersGroupe.find(".btnSave"), // BTN SAVE + paniersGroupesConf.type, // DELETE TYPE + modalDeletePaniersGroupe, // MODAL + false, // GET FORM DATAS FUNCTION + false, // CHECK FORM DATAS FUNCTION + paniersGroupesConf.baseURL // SAVE URL + ); + + // CANCEL + modalDeletePaniersGroupe.on('hidden.bs.modal', function (e) { modalDeletePaniersGroupe_clear(); }); +} + +function modalDeletePaniersGroupe_loadDatas(btn, id) { + modalDeletePaniersGroupe.find('b.name').html( btn.attr('nom') ); + modalDeletePaniersGroupe.modal('show'); +} + +function modalDeletePaniersGroupe_clear() { + modalDeletePaniersGroupe.removeAttr("delete_id"); + modalDeletePaniersGroupe.find('b.name').html(""); +} \ No newline at end of file diff --git a/public_html_admin/lieux.php b/public_html_admin/lieux.php new file mode 100644 index 0000000..2a069f8 --- /dev/null +++ b/public_html_admin/lieux.php @@ -0,0 +1,65 @@ +assign('page','lieux'); +$GLOBALS['template'] = 'lieux/lieux_list.tpl'; +$GLOBALS['smarty']->assign('secondbar','lieux/lieux_secondbar.tpl'); +$jsFiles[] = PUBLIC_HTML_ADMIN.'js/lieux.js'; + +if($id>0 && $action) { + $infos = getLieuDatas($id); + switch($action) { + // AJAX GET DATAS + case "getDatas": die(json_encode($infos)); break; + // EDIT + case "edit": { + $datas = getLieuDatasFromRequest(); + die( strval( updateLieu($id,$datas) ) ); + } break; + // DELETE + case "delete" : die( strval( deleteLieu($id) ) ); break; + // DEFAULT + default: die("NO ACTION"); + } +} +switch($action) { + // ADD + case "add": { + $datas = getLieuDatasFromRequest(); + die( strval( addLieu($datas) ) ); + } break; + // SELECT LIST + case "select_list": { + $GLOBALS['smarty'] -> assign('lieux_list', getLieuxList()); + die( $GLOBALS['smarty']->fetch("lieux/lieux_select_list.tpl") ); + } break; + // DEFAULT - LIST + default: { + // SEARCH + $search = getSearch("lieux_search"); + + // LIMITS + $limits = array("start" => 0, "end" => LIST_NB_LIGNES_PAR_PAGE, "nbItemsByPage" => LIST_NB_LIGNES_PAR_PAGE, "max" => getNbLieuxInList($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('lieux_list_order', 'lieux_list_sens', $allowLieuxListOrder, 'nom'); + $list = getLieuxList($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("lieux/lieux_list_builder.tpl"); + die(json_encode($limits)); + } + + // DISPLAY + display(); + } +} \ No newline at end of file diff --git a/public_html_admin/paniers_groupes.php b/public_html_admin/paniers_groupes.php new file mode 100644 index 0000000..a0f5142 --- /dev/null +++ b/public_html_admin/paniers_groupes.php @@ -0,0 +1,65 @@ +assign('page','paniers_groupes'); +$GLOBALS['template'] = 'paniers_groupes/paniers_groupes_list.tpl'; +$GLOBALS['smarty']->assign('secondbar','paniers_groupes/paniers_groupes_secondbar.tpl'); +$jsFiles[] = PUBLIC_HTML_ADMIN.'js/paniers_groupes.js'; + +if($id>0 && $action) { + $infos = getPaniersGroupeDatas($id); + switch($action) { + // AJAX GET DATAS + case "getDatas": die(json_encode($infos)); break; + // EDIT + case "edit": { + $datas = getPaniersGroupeDatasFromRequest(); + die( strval( updatePaniersGroupe($id,$datas) ) ); + } break; + // DELETE + case "delete" : die( strval( deletePaniersGroupe($id) ) ); break; + // DEFAULT + default: die("NO ACTION"); + } +} +switch($action) { + // ADD + case "add": { + $datas = getPaniersGroupeDatasFromRequest(); + die( strval( addPaniersGroupe($datas) ) ); + } break; + // SELECT LIST + case "select_list": { + $GLOBALS['smarty'] -> assign('paniers_groupes_list', getPaniersGroupesList()); + die( $GLOBALS['smarty']->fetch("paniers_groupes/paniers_groupes_select_list.tpl") ); + } break; + // DEFAULT - LIST + default: { + // SEARCH + $search = getSearch("paniers_groupes_search"); + + // LIMITS + $limits = array("start" => 0, "end" => LIST_NB_LIGNES_PAR_PAGE, "nbItemsByPage" => LIST_NB_LIGNES_PAR_PAGE, "max" => getNbPaniersGroupesInList($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('paniers_groupes_list_order', 'paniers_groupes_list_sens', $allowPaniersGroupesListOrder, "nom"); + $list = getPaniersGroupesList($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("paniers_groupes/paniers_groupes_list_builder.tpl"); + die(json_encode($limits)); + } + + // DISPLAY + display(); + } +} \ No newline at end of file diff --git a/public_html_admin/templates/clients/clients_secondbar.tpl b/public_html_admin/templates/clients/clients_secondbar.tpl index a154d5d..093dfc4 100644 --- a/public_html_admin/templates/clients/clients_secondbar.tpl +++ b/public_html_admin/templates/clients/clients_secondbar.tpl @@ -8,8 +8,8 @@ \ No newline at end of file diff --git a/public_html_admin/templates/contrats/contrat_form.tpl b/public_html_admin/templates/contrats/contrat_form.tpl index 9ab6d7a..23ed6da 100644 --- a/public_html_admin/templates/contrats/contrat_form.tpl +++ b/public_html_admin/templates/contrats/contrat_form.tpl @@ -1,5 +1,4 @@
-
@@ -9,7 +8,7 @@
- + @@ -48,7 +47,7 @@
- + diff --git a/public_html_admin/templates/contrats/contrats_secondbar.tpl b/public_html_admin/templates/contrats/contrats_secondbar.tpl index df11df8..e3a8e8b 100644 --- a/public_html_admin/templates/contrats/contrats_secondbar.tpl +++ b/public_html_admin/templates/contrats/contrats_secondbar.tpl @@ -8,7 +8,7 @@
\ No newline at end of file diff --git a/public_html_admin/templates/contrats_types/contrats_type_form.tpl b/public_html_admin/templates/contrats_types/contrats_type_form.tpl new file mode 100644 index 0000000..b5ca1cd --- /dev/null +++ b/public_html_admin/templates/contrats_types/contrats_type_form.tpl @@ -0,0 +1,39 @@ +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ + panier(s) +
+
+
+ +
+ + + +
+
+
+
\ No newline at end of file diff --git a/public_html_admin/templates/contrats_types/contrats_type_modal_view.tpl b/public_html_admin/templates/contrats_types/contrats_type_modal_view.tpl new file mode 100644 index 0000000..03d9a41 --- /dev/null +++ b/public_html_admin/templates/contrats_types/contrats_type_modal_view.tpl @@ -0,0 +1,24 @@ + + + \ No newline at end of file diff --git a/public_html_admin/templates/contrats_types/contrats_types_list.tpl b/public_html_admin/templates/contrats_types/contrats_types_list.tpl new file mode 100644 index 0000000..784b58f --- /dev/null +++ b/public_html_admin/templates/contrats_types/contrats_types_list.tpl @@ -0,0 +1,138 @@ +{include file='structure/top.tpl'} + + + + + + + + + + + + + + {include file='contrats_types/contrats_types_list_builder.tpl'} + +
+ + #{if $order=="ref"} {/if} + + + + nom{if $order=="nom"} {/if} + + + + groupe{if $order=="groupe"} {/if} + + + + fréquence{if $order=="frequence"} {/if} + + + + type de panier{if $order=="panier_type"} {/if} + + + + nb. de panier{if $order=="nb_paniers"} {/if} + + + + prix total{if $order=="prix_total"} {/if} + +
+ +{include file='contrats_types/contrats_type_modal_view.tpl'} + + + + + + + + + + + + + +{include file='structure/bottom.tpl'} \ No newline at end of file diff --git a/public_html_admin/templates/contrats_types/contrats_types_list_builder.tpl b/public_html_admin/templates/contrats_types/contrats_types_list_builder.tpl new file mode 100644 index 0000000..499abd4 --- /dev/null +++ b/public_html_admin/templates/contrats_types/contrats_types_list_builder.tpl @@ -0,0 +1,17 @@ +{foreach from=$list item=i} + + {$i.ref} + {$i.nom} + {$i.groupe_nom} + {$i.frequence_print} + {$i.panier_type_nom} + {$i.nb_paniers} + {$i.prix_total} € + + + +{foreachelse} + + aucun type de contrats + +{/foreach} \ No newline at end of file diff --git a/public_html_admin/templates/contrats_types/contrats_types_secondbar.tpl b/public_html_admin/templates/contrats_types/contrats_types_secondbar.tpl new file mode 100644 index 0000000..2e00b67 --- /dev/null +++ b/public_html_admin/templates/contrats_types/contrats_types_secondbar.tpl @@ -0,0 +1,46 @@ + \ No newline at end of file diff --git a/public_html_admin/templates/contrats_types/contrats_types_select_list.tpl b/public_html_admin/templates/contrats_types/contrats_types_select_list.tpl new file mode 100644 index 0000000..86fa530 --- /dev/null +++ b/public_html_admin/templates/contrats_types/contrats_types_select_list.tpl @@ -0,0 +1,3 @@ + +{foreach from=$contrats_types_list item=i}{/foreach} + \ No newline at end of file diff --git a/public_html_admin/templates/legumes/legumes_secondbar.tpl b/public_html_admin/templates/legumes/legumes_secondbar.tpl index 461f743..d57a776 100644 --- a/public_html_admin/templates/legumes/legumes_secondbar.tpl +++ b/public_html_admin/templates/legumes/legumes_secondbar.tpl @@ -8,7 +8,7 @@
\ No newline at end of file diff --git a/public_html_admin/templates/lieux/lieu_form.tpl b/public_html_admin/templates/lieux/lieu_form.tpl new file mode 100644 index 0000000..4530db2 --- /dev/null +++ b/public_html_admin/templates/lieux/lieu_form.tpl @@ -0,0 +1,9 @@ +
+
+
+
+ + +
+
+
\ No newline at end of file diff --git a/public_html_admin/templates/lieux/lieu_modal_view.tpl b/public_html_admin/templates/lieux/lieu_modal_view.tpl new file mode 100644 index 0000000..c2ea79f --- /dev/null +++ b/public_html_admin/templates/lieux/lieu_modal_view.tpl @@ -0,0 +1,19 @@ + + + \ No newline at end of file diff --git a/public_html_admin/templates/lieux/lieux_list.tpl b/public_html_admin/templates/lieux/lieux_list.tpl new file mode 100644 index 0000000..e906506 --- /dev/null +++ b/public_html_admin/templates/lieux/lieux_list.tpl @@ -0,0 +1,110 @@ +{include file='structure/top.tpl'} + + + + + + + + + {include file='lieux/lieux_list_builder.tpl'} + +
+ + #{if $order=="ref"} {/if} + + + + nom{if $order=="nom"} {/if} + +
+ +{include file='lieux/lieu_modal_view.tpl'} + + + + + + + + + + + + + +{include file='structure/bottom.tpl'} \ No newline at end of file diff --git a/public_html_admin/templates/lieux/lieux_list_builder.tpl b/public_html_admin/templates/lieux/lieux_list_builder.tpl new file mode 100644 index 0000000..e093cf5 --- /dev/null +++ b/public_html_admin/templates/lieux/lieux_list_builder.tpl @@ -0,0 +1,12 @@ +{foreach from=$list item=i} + + {$i.ref} + {$i.nom} + + + +{foreachelse} + + aucun lieu + +{/foreach} \ No newline at end of file diff --git a/public_html_admin/templates/lieux/lieux_secondbar.tpl b/public_html_admin/templates/lieux/lieux_secondbar.tpl new file mode 100644 index 0000000..d23ab99 --- /dev/null +++ b/public_html_admin/templates/lieux/lieux_secondbar.tpl @@ -0,0 +1,33 @@ + \ No newline at end of file diff --git a/public_html_admin/templates/contrats/lieux_select_list.tpl b/public_html_admin/templates/lieux/lieux_select_list.tpl similarity index 100% rename from public_html_admin/templates/contrats/lieux_select_list.tpl rename to public_html_admin/templates/lieux/lieux_select_list.tpl diff --git a/public_html_admin/templates/livraisons/livraisons_secondbar.tpl b/public_html_admin/templates/livraisons/livraisons_secondbar.tpl index 5de1e37..48a7444 100644 --- a/public_html_admin/templates/livraisons/livraisons_secondbar.tpl +++ b/public_html_admin/templates/livraisons/livraisons_secondbar.tpl @@ -8,7 +8,7 @@
\ No newline at end of file diff --git a/public_html_admin/templates/paniers/panier_form.tpl b/public_html_admin/templates/paniers/panier_form.tpl index 189a79f..b2a3992 100644 --- a/public_html_admin/templates/paniers/panier_form.tpl +++ b/public_html_admin/templates/paniers/panier_form.tpl @@ -1,5 +1,4 @@
-
diff --git a/public_html_admin/templates/paniers/paniers_secondbar.tpl b/public_html_admin/templates/paniers/paniers_secondbar.tpl index d23a3c8..685f5e1 100644 --- a/public_html_admin/templates/paniers/paniers_secondbar.tpl +++ b/public_html_admin/templates/paniers/paniers_secondbar.tpl @@ -8,14 +8,14 @@
\ No newline at end of file diff --git a/public_html_admin/templates/paniers_groupes/paniers_groupe_form.tpl b/public_html_admin/templates/paniers_groupes/paniers_groupe_form.tpl new file mode 100644 index 0000000..4530db2 --- /dev/null +++ b/public_html_admin/templates/paniers_groupes/paniers_groupe_form.tpl @@ -0,0 +1,9 @@ +
+
+
+
+ + +
+
+
\ No newline at end of file diff --git a/public_html_admin/templates/paniers_groupes/paniers_groupe_modal_view.tpl b/public_html_admin/templates/paniers_groupes/paniers_groupe_modal_view.tpl new file mode 100644 index 0000000..e451087 --- /dev/null +++ b/public_html_admin/templates/paniers_groupes/paniers_groupe_modal_view.tpl @@ -0,0 +1,19 @@ + + + \ No newline at end of file diff --git a/public_html_admin/templates/paniers_groupes/paniers_groupes_list.tpl b/public_html_admin/templates/paniers_groupes/paniers_groupes_list.tpl new file mode 100644 index 0000000..2b77a52 --- /dev/null +++ b/public_html_admin/templates/paniers_groupes/paniers_groupes_list.tpl @@ -0,0 +1,110 @@ +{include file='structure/top.tpl'} + + + + + + + + + {include file='paniers_groupes/paniers_groupes_list_builder.tpl'} + +
+ + #{if $order=="ref"} {/if} + + + + nom{if $order=="nom"} {/if} + +
+ +{include file='paniers_groupes/paniers_groupe_modal_view.tpl'} + + + + + + + + + + + + + +{include file='structure/bottom.tpl'} \ No newline at end of file diff --git a/public_html_admin/templates/paniers_groupes/paniers_groupes_list_builder.tpl b/public_html_admin/templates/paniers_groupes/paniers_groupes_list_builder.tpl new file mode 100644 index 0000000..f800a9a --- /dev/null +++ b/public_html_admin/templates/paniers_groupes/paniers_groupes_list_builder.tpl @@ -0,0 +1,12 @@ +{foreach from=$list item=i} + + {$i.ref} + {$i.nom} + + + +{foreachelse} + + aucun groupe + +{/foreach} \ No newline at end of file diff --git a/public_html_admin/templates/paniers_groupes/paniers_groupes_secondbar.tpl b/public_html_admin/templates/paniers_groupes/paniers_groupes_secondbar.tpl new file mode 100644 index 0000000..8841a4b --- /dev/null +++ b/public_html_admin/templates/paniers_groupes/paniers_groupes_secondbar.tpl @@ -0,0 +1,33 @@ + \ No newline at end of file diff --git a/public_html_admin/templates/structure/topBar.tpl b/public_html_admin/templates/structure/topBar.tpl index e9bef49..0d6a3f8 100644 --- a/public_html_admin/templates/structure/topBar.tpl +++ b/public_html_admin/templates/structure/topBar.tpl @@ -16,14 +16,32 @@