Repository 'machine' fonctionne avec ORM
This commit is contained in:
parent
55535a2299
commit
0dc67f1fc7
|
@ -691,7 +691,7 @@ article.check-table{
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
|
|
||||||
/* (1) Gestion du checkbox HACK */
|
/* (1) Gestion du checkbox hack */
|
||||||
input[type='checkbox']{ display: none; }
|
input[type='checkbox']{ display: none; }
|
||||||
|
|
||||||
input[type='checkbox'] + label[for]{
|
input[type='checkbox'] + label[for]{
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,4 @@
|
||||||
|
// TODO: Attendre que API soit chargée, sinon erreur, le CONTAINER prend comme contenu la dépendance JS
|
||||||
DOM = {
|
DOM = {
|
||||||
WRAPPER: $('WRAPPER'),
|
WRAPPER: $('WRAPPER'),
|
||||||
HEADER: $('HEADER'),
|
HEADER: $('HEADER'),
|
||||||
|
|
|
@ -5,10 +5,6 @@
|
||||||
use \manager\Database;
|
use \manager\Database;
|
||||||
|
|
||||||
|
|
||||||
// TODO: Suppression (avec prise en compte des jointures (sur le modèle de 'edit')
|
|
||||||
// TODO: Insertion
|
|
||||||
|
|
||||||
|
|
||||||
class Rows{
|
class Rows{
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
namespace manager\repo;
|
namespace manager\repo;
|
||||||
use \manager\Database;
|
use \manager\Database;
|
||||||
use \manager\sessionManager;
|
use \manager\sessionManager;
|
||||||
|
use \manager\ORM\Table;
|
||||||
|
use \manager\ORM\Rows;
|
||||||
use \manager\Checker;
|
use \manager\Checker;
|
||||||
use \manager\repo\cluster as clusterRepo;
|
use \manager\repo\cluster as clusterRepo;
|
||||||
|
|
||||||
|
@ -20,27 +22,20 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function create($id_warehouse, $name){
|
public static function create($id_warehouse, $name){
|
||||||
/* [1] Verification de l'unicite de name
|
/* [1] Creation de la machine
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$check_unique = self::getByName($id_warehouse, $name) === false;
|
$inserted = Table::get('machine')->insert([
|
||||||
|
'id_machine' => Rows::DEFAULT,
|
||||||
// Si une machine a deja ce nom, on renvoie une erreur
|
'id_warehouse' => $id_warehouse,
|
||||||
if( !$check_unique ){
|
'name' => $name,
|
||||||
return false;
|
'token' => sessionManager::secure_hash( uniqid() )
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* [2] Creation de la machine
|
|
||||||
=========================================================*/
|
|
||||||
$insert_machine = Database::getPDO()->prepare("INSERT INTO machine(id_machine, id_warehouse, name, token)
|
|
||||||
VALUES(DEFAULT, :id_warehouse, :name, :token)");
|
|
||||||
$insert_machine->execute([
|
|
||||||
':id_warehouse' => $id_warehouse,
|
|
||||||
':name' => $name,
|
|
||||||
':token' => sessionManager::secure_hash( uniqid() )
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/* [3] On retourne l'id_machine ou FALSE si erreur
|
// Si erreur (car name doit être unique)
|
||||||
|
if( !$inserted )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/* [2] On retourne l'id_machine ou FALSE si erreur
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$check_machine = self::getByName($id_warehouse, $name);
|
$check_machine = self::getByName($id_warehouse, $name);
|
||||||
|
|
||||||
|
@ -67,15 +62,13 @@
|
||||||
*/
|
*/
|
||||||
public static function search($id_warehouse, $keyword){
|
public static function search($id_warehouse, $keyword){
|
||||||
// On recupere les donnees
|
// On recupere les donnees
|
||||||
$searchmachines = Database::getPDO()->prepare("SELECT id_machine, name FROM machine
|
$search = Table::get('machine')
|
||||||
WHERE id_warehouse = :id_warehouse
|
->whereIdWarehouse($id_warehouse)
|
||||||
AND name LIKE '%".$keyword."%'");
|
->whereName(["%$keyword%", Rows::COND_LIKE])
|
||||||
|
->select('id_machine')
|
||||||
|
->select('name');
|
||||||
|
|
||||||
$searchmachines->execute([
|
return $search->fetch();
|
||||||
':id_warehouse' => $id_warehouse
|
|
||||||
]);
|
|
||||||
|
|
||||||
return Database::delNumeric( $searchmachines->fetchAll() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,22 +87,16 @@
|
||||||
public static function getClusters($id_warehouse, $id_machine){
|
public static function getClusters($id_warehouse, $id_machine){
|
||||||
/* [1] On redige/execute la requete
|
/* [1] On redige/execute la requete
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$get_clusters = Database::getPDO()->prepare("SELECT c.*
|
$cluster = Table::get('machine_cluster')
|
||||||
FROM machine_cluster as c, machine_cluster_merge as cm, machine as m
|
->whereIdWarehouse($id_warehouse)
|
||||||
WHERE cm.id_machine_cluster = c.id_machine_cluster
|
->select('*');
|
||||||
AND cm.id_machine = m.id_machine
|
$cluster_merge = Table::get('machine_cluster_merge')
|
||||||
AND cm.id_machine = :id_machine
|
->whereIdMachine($id_machine)
|
||||||
AND c.id_warehouse = m.id_warehouse
|
->join('id_machine_cluster', $cluster);
|
||||||
AND m.id_warehouse = :id_warehouse
|
|
||||||
ORDER BY c.name");
|
|
||||||
$get_clusters->execute([
|
|
||||||
':id_warehouse' => $id_warehouse,
|
|
||||||
':id_machine' => $id_machine
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* [2] On retourne la liste des groupes
|
/* [2] On retourne la liste des groupes
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
return Database::delNumeric( $get_clusters->fetchAll() );
|
return $cluster_merge->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,40 +116,16 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static function edit($id_warehouse, $id_machine=null, $name=null){
|
public static function edit($id_warehouse, $id_machine=null, $name=null){
|
||||||
/* [1] Verification de l'unicite de name (si differents)
|
/* [1] Modification de la machine
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
// On recupere les machine ayant le meme name (si existent)
|
|
||||||
$getbyname = self::getByName($id_warehouse, $name);
|
|
||||||
|
|
||||||
$check_unique = is_array($getbyname) && $getbyname['id_machine'] == $id_machine || !is_array($getbyname);
|
$edited = Table::get('machine')
|
||||||
|
->whereId($id_machine)
|
||||||
// Si un utilisateur a deja ce name (sauf lui), on renvoie une erreur
|
->whereIdWarehouse($id_warehouse)
|
||||||
if( !$check_unique )
|
->edit([ 'name' => $name ]);
|
||||||
return false;
|
|
||||||
|
|
||||||
/* [2] Modification de la machine
|
|
||||||
=========================================================*/
|
|
||||||
$edit_machine = Database::getPDO()->prepare("UPDATE machine
|
|
||||||
SET name = :name
|
|
||||||
WHERE id_machine = :id_machine
|
|
||||||
AND id_warehouse = :id_warehouse");
|
|
||||||
$edit_machine->execute([
|
|
||||||
':name' => $name,
|
|
||||||
':id_machine' => $id_machine,
|
|
||||||
':id_warehouse' => $id_warehouse
|
|
||||||
]);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* [3] On retourne si tout a ete modifie, si erreur
|
|
||||||
=========================================================*/
|
|
||||||
$check_machine = self::getById($id_warehouse, $id_machine);
|
|
||||||
|
|
||||||
$checker = $check_machine['id_machine'] == $id_machine;
|
|
||||||
$checker = $checker && $check_machine['name'] == $name;
|
|
||||||
|
|
||||||
// On retourne l'etat de la modification
|
// On retourne l'etat de la modification
|
||||||
return $checker;
|
return $edited;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,18 +146,14 @@
|
||||||
public static function delete($id_warehouse, $id_machine){
|
public static function delete($id_warehouse, $id_machine){
|
||||||
/* [1] On redige/execute la requete
|
/* [1] On redige/execute la requete
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$delete_machine = Database::getPDO()->prepare("DELETE FROM machine
|
$deleted = Table::get('machine')
|
||||||
WHERE id_machine = :id_machine
|
->whereId($id_machine)
|
||||||
AND id_warehouse = :id_warehouse");
|
->whereIdWarehouse($id_warehouse);
|
||||||
$delete_machine->execute([
|
|
||||||
':id_machine' => $id_machine,
|
|
||||||
':id_warehouse' => $id_warehouse
|
|
||||||
]);
|
|
||||||
|
|
||||||
|
|
||||||
/* [2] On verifie que la machine n'existe plus
|
/* [2] On verifie que la machine est bien supprimée
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
return ( self::getById($id_warehouse, $id_machine) === false );
|
return $delete->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -217,24 +176,13 @@
|
||||||
public static function getById($id_warehouse, $id_machine){
|
public static function getById($id_warehouse, $id_machine){
|
||||||
/* [1] On rédige/execute la requête
|
/* [1] On rédige/execute la requête
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$get = Database::getPDO()->prepare("SELECT m.id_machine, m.name
|
$machine = Table::get('machine')
|
||||||
FROM machine as m
|
->whereId($id_machine)
|
||||||
WHERE m.id_warehouse = :id_warehouse
|
->whereIdWarehouse($id_warehouse)
|
||||||
AND m.id_machine = :id_machine");
|
->select(['id_machine', 'name'])
|
||||||
$get->execute([
|
->unique();
|
||||||
':id_warehouse' => $id_warehouse,
|
|
||||||
':id_machine' => $id_machine
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* [2] Gestion des données
|
return $machine->fetch();
|
||||||
=========================================================*/
|
|
||||||
$found = $get->fetch();
|
|
||||||
|
|
||||||
// Si aucun résultat
|
|
||||||
if( $found === false )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return Database::delNumeric( $found, true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -257,24 +205,13 @@
|
||||||
public static function getByName($id_warehouse, $name){
|
public static function getByName($id_warehouse, $name){
|
||||||
/* [1] On rédige/execute la requête
|
/* [1] On rédige/execute la requête
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$get = Database::getPDO()->prepare("SELECT m.id_machine, m.name
|
$machine = Table::get('machine')
|
||||||
FROM machine as m
|
->whereName($name)
|
||||||
WHERE m.id_warehouse = :id_warehouse
|
->whereIdWarehouse($id_warehouse)
|
||||||
AND m.name = :name");
|
->select(['id_machine', 'name'])
|
||||||
$get->execute([
|
->unique();
|
||||||
':id_warehouse' => $id_warehouse,
|
|
||||||
':name' => $name
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* [2] Gestion des données
|
return $machine->fetch();
|
||||||
=========================================================*/
|
|
||||||
$found = $get->fetch();
|
|
||||||
|
|
||||||
// Si aucun résultat
|
|
||||||
if( $found === false )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return Database::delNumeric( $found, true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -297,24 +234,13 @@
|
||||||
public static function getByToken($id_warehouse, $token){
|
public static function getByToken($id_warehouse, $token){
|
||||||
/* [1] On rédige/execute la requête
|
/* [1] On rédige/execute la requête
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$get = Database::getPDO()->prepare("SELECT m.id_machine, m.name
|
$machine = Table::get('machine')
|
||||||
FROM machine as m
|
->whereToken($token)
|
||||||
WHERE m.id_warehouse = :id_warehouse
|
->whereIdWarehouse($id_warehouse)
|
||||||
AND m.token = :token");
|
->select(['id_machine', 'name'])
|
||||||
$get->execute([
|
->unique();
|
||||||
':id_warehouse' => $id_warehouse,
|
|
||||||
':token' => $token
|
|
||||||
]);
|
|
||||||
|
|
||||||
/* [2] Gestion des données
|
return $machine->fetch();
|
||||||
=========================================================*/
|
|
||||||
$found = $get->fetch();
|
|
||||||
|
|
||||||
// Si aucun résultat
|
|
||||||
if( $found === false )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return Database::delNumeric( $found, true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -335,14 +261,12 @@
|
||||||
public static function getAll($id_warehouse){
|
public static function getAll($id_warehouse){
|
||||||
/* [1] On rédige/execute la requête
|
/* [1] On rédige/execute la requête
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$get = Database::getPDO()->prepare("SELECT m.id_machine, m.name
|
$machine = Table::get('machine')
|
||||||
FROM machine as m
|
->whereIdWarehouse($id_warehouse)
|
||||||
WHERE m.id_warehouse = :id_warehouse");
|
->select(['id_machine', 'name'])
|
||||||
$get->execute([
|
->unique();
|
||||||
':id_warehouse' => $id_warehouse
|
|
||||||
]);
|
|
||||||
|
|
||||||
return Database::delNumeric( $get->fetchAll() );
|
return $machine->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -373,18 +297,17 @@
|
||||||
|
|
||||||
/* [2] On met à jour le token
|
/* [2] On met à jour le token
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$updateToken = Database::getPDO()->prepare("UPDATE machine
|
$updated = Table::get('machine')
|
||||||
SET token = :token
|
->whereId($id_machine)
|
||||||
WHERE id_machine = :id_machine");
|
->edit([
|
||||||
$updateToken->execute([
|
'token' => Checker::run('hash', $newToken) ? $newToken : $token,
|
||||||
':token' => Checker::run('hash', $newToken) ? $newToken : $token,
|
'id_machine' => $byToken[0]['id_machine']
|
||||||
':id_machine' => $byToken[0]['id_machine']
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
/* [3] On retourne que tout s'est bien déroulé
|
/* [3] On retourne que tout s'est bien déroulé
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
return true;
|
return $updated;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -410,22 +410,40 @@
|
||||||
|
|
||||||
/* [4] Suppression
|
/* [4] Suppression
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
$warehouse =
|
// $warehouse =
|
||||||
Table::get('warehouse') // Access to table 'warehouse'
|
// Table::get('warehouse') // Access to table 'warehouse'
|
||||||
->whereName('stef-montauban'); // condition : name = 'my-warehouse'
|
// ->whereName('stef-montauban'); // condition : name = 'my-warehouse'
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// $myUser =
|
||||||
|
// Table::get('user') // Access to table 'user'
|
||||||
|
// ->whereId([100, Rows::COND_INF]) // PRIMARY KEY (other condition on same field)
|
||||||
|
// ->whereUsername(['no%', Rows::COND_LIKE]) // Dynamic getter 'getByMySuperColumn' -> 'my_super_column'
|
||||||
|
// ->select(['mail', 'username', 'firstname']) // Select clause
|
||||||
|
// ->select('id_user') // Select clause (added)
|
||||||
|
// ->join('id_warehouse', $warehouse) // joins warehouse (with name 'my-warehouse') to column 'id_warehouse'
|
||||||
|
// // ->unique() // unique result
|
||||||
|
//
|
||||||
|
// ->delete();
|
||||||
|
|
||||||
|
|
||||||
$myUser =
|
$keyword = 'h%s';
|
||||||
Table::get('user') // Access to table 'user'
|
|
||||||
->whereId([100, Rows::COND_INF]) // PRIMARY KEY (other condition on same field)
|
|
||||||
->whereUsername(['no%', Rows::COND_LIKE]) // Dynamic getter 'getByMySuperColumn' -> 'my_super_column'
|
|
||||||
->select(['mail', 'username', 'firstname']) // Select clause
|
|
||||||
->select('id_user') // Select clause (added)
|
|
||||||
->join('id_warehouse', $warehouse) // joins warehouse (with name 'my-warehouse') to column 'id_warehouse'
|
|
||||||
// ->unique() // unique result
|
|
||||||
|
|
||||||
->fetch();
|
$searchmachines = Database::getPDO()->prepare("SELECT id_machine, name FROM machine
|
||||||
|
WHERE id_warehouse = :id_warehouse
|
||||||
|
AND name LIKE '%".$keyword."%'");
|
||||||
|
|
||||||
var_dump($myUser);
|
$searchmachines->execute([
|
||||||
|
':id_warehouse' => 7
|
||||||
|
]);
|
||||||
|
|
||||||
|
var_dump($searchmachines->fetchAll());
|
||||||
|
|
||||||
|
|
||||||
|
var_dump( Table::get('machine')
|
||||||
|
->whereIdWarehouse(7)
|
||||||
|
->whereName(["%$keyword%", Rows::COND_LIKE])
|
||||||
|
->select('id_machine')
|
||||||
|
->select('name')->fetch() );
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// TODO: Supprimer les retours vers la cible lors de 'création'/'modification'
|
||||||
|
|
||||||
// On referencie toutes les sections
|
// On referencie toutes les sections
|
||||||
var section = {
|
var section = {
|
||||||
view: {
|
view: {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
var section={view:{text:'#CONTAINER > section[data-sublink="view"] ',element:document.querySelector('#CONTAINER > section[data-sublink="view"]'),searchbar:document.querySelector('#CONTAINER > section[data-sublink="view"] > .searchbar')},create:{text:'#CONTAINER > section[data-sublink="create"] ',element:document.querySelector('#CONTAINER > section[data-sublink="create"]')},remove:{text:'#CONTAINER > section[data-sublink="remove"] ',element:document.querySelector('#CONTAINER > section[data-sublink="remove"]')},
|
var section={view:{text:'#CONTAINER > section[data-sublink="view"] ',element:document.querySelector('#CONTAINER > section[data-sublink="view"]'),searchbar:document.querySelector('#CONTAINER > section[data-sublink="view"] > .searchbar')},create:{text:'#CONTAINER > section[data-sublink="create"] ',element:document.querySelector('#CONTAINER > section[data-sublink="create"]')},remove:{text:'#CONTAINER > section[data-sublink="remove"] ',element:document.querySelector('#CONTAINER > section[data-sublink="remove"]')},
|
||||||
edit:{text:'#CONTAINER > section[data-sublink="edit"] ',element:document.querySelector('#CONTAINER > section[data-sublink="edit"]')},groups:{text:'#CONTAINER > section[data-sublink="groups"] ',element:document.querySelector('#CONTAINER > section[data-sublink="groups"]'),searchbar:document.querySelector('#CONTAINER > section[data-sublink="groups"] > .searchbar')}};
|
edit:{text:'#CONTAINER > section[data-sublink="edit"] ',element:document.querySelector('#CONTAINER > section[data-sublink="edit"]')},groups:{text:'#CONTAINER > section[data-sublink="groups"] ',element:document.querySelector('#CONTAINER > section[data-sublink="groups"]'),searchbar:document.querySelector('#CONTAINER > section[data-sublink="groups"] > .searchbar')}};
|
||||||
if(null!=section.view.element){1<pageManager.vars.length&&!isNaN(pageManager.vars[1])&&(document.location="#"+pageManager.vars[1],document.getElementById(pageManager.vars[1]).addClass("selected"));section.view.link={edit:document.querySelectorAll(section.view.text+".link_edit[data-machine]"),remove:document.querySelectorAll(section.view.text+".link_remove[data-machine]")};section.view.group={rem:document.querySelectorAll(section.view.text+".rem-group[data-machine][data-group]"),add:document.querySelectorAll(section.view.text+
|
if(null!=section.view.element){1<pageManager.vars.length&&!isNaN(pageManager.vars[1])&&(document.location="#"+pageManager.vars[1],document.getElementById(pageManager.vars[1]).addClass("selected"));section.view.link={edit:document.querySelectorAll(section.view.text+".link_edit[data-machine]"),remove:document.querySelectorAll(section.view.text+".link_remove[data-machine]")};section.view.group={rem:document.querySelectorAll(section.view.text+".rem-group[data-machine][data-group]"),add:document.querySelectorAll(section.view.text+
|
||||||
".add-group[data-machine]")};section.view.searchbar.addEventListener("keyup",function(a){api.send({path:"machineDefault/search",keywords:section.view.searchbar.value},function(a){if(0==a.ModuleError){for(var d=[],c=0;c<a.machines.length;c++)d.push(a.machines[c].id_machine);a=document.querySelectorAll(section.view.text+"> article.inline-box[id]");for(c=0;c<a.length;c++)-1<d.indexOf(a[c].id)?a[c].remClass("hidden"):a[c].addClass("hidden")}})},!1);for(var i=0;i<section.view.link.edit.length;i++)section.view.link.edit[i].addEventListener("click",
|
".add-group[data-machine]")};section.view.searchbar.addEventListener("keyup",function(a){api.send({path:"machineDefault/search",keywords:section.view.searchbar.value},function(a){if(0==a.ModuleError){for(var d=[],c=0;c<a.machines.length;c++)d.push(a.machines[c].id_machine);a=document.querySelectorAll(section.view.text+"> article.inline-box[id]");for(c=0;c<a.length;c++)-1<d.indexOf(parseInt(a[c].id))?a[c].remClass("hidden"):a[c].addClass("hidden")}})},!1);for(var i=0;i<section.view.link.edit.length;i++)section.view.link.edit[i].addEventListener("click",
|
||||||
function(a){pageManager.vars[1]=a.target.getData("machine");navSubMenu("edit");document.location=""},!1);for(i=0;i<section.view.link.remove.length;i++)section.view.link.remove[i].addEventListener("click",function(a){pageManager.vars[1]=a.target.getData("machine");navSubMenu("remove");document.location=""},!1);for(i=0;i<section.view.group.rem.length;i++)section.view.group.rem[i].addEventListener("click",function(a){var b={path:"machineDefault/unlink",id_machine:a.target.getData("machine"),id_cluster:a.target.getData("group")};
|
function(a){pageManager.vars[1]=a.target.getData("machine");navSubMenu("edit");document.location=""},!1);for(i=0;i<section.view.link.remove.length;i++)section.view.link.remove[i].addEventListener("click",function(a){pageManager.vars[1]=a.target.getData("machine");navSubMenu("remove");document.location=""},!1);for(i=0;i<section.view.group.rem.length;i++)section.view.group.rem[i].addEventListener("click",function(a){var b={path:"machineDefault/unlink",id_machine:a.target.getData("machine"),id_cluster:a.target.getData("group")};
|
||||||
api.send(b,function(b){if(0!=b.ModuleError)return!1;a.target.parentNode.parentNode.removeChild(a.target.parentNode)})},!1)}
|
api.send(b,function(b){if(0!=b.ModuleError)return!1;a.target.parentNode.parentNode.removeChild(a.target.parentNode)})},!1)}
|
||||||
null!=section.create.element&&(section.create.input={name:document.querySelector(section.create.text+"#create_name"),submit:document.querySelector(section.create.text+"#create_submit")},section.create.input.submit.addEventListener("click",function(a){a.preventDefault();api.send({path:"machineDefault/create",name:section.create.input.name.value},function(a){0==a.ModuleError&&(console.log("Machine cree!"),pageManager.vars=["view",a.id_machine],pageManager.refresh(),document.location="",section.create.input.submit.anim("active",
|
null!=section.create.element&&(section.create.input={name:document.querySelector(section.create.text+"#create_name"),submit:document.querySelector(section.create.text+"#create_submit")},section.create.input.submit.addEventListener("click",function(a){a.preventDefault();api.send({path:"machineDefault/create",name:section.create.input.name.value},function(a){0==a.ModuleError&&(console.log("Machine cree!"),pageManager.vars=["view",a.id_machine],pageManager.refresh(),document.location="",section.create.input.submit.anim("active",
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// TODO: Supprimer les retours vers la cible lors de 'création'/'modification'
|
||||||
|
|
||||||
// On referencie toutes les sections
|
// On referencie toutes les sections
|
||||||
var section = {
|
var section = {
|
||||||
view: {
|
view: {
|
||||||
|
@ -77,7 +79,7 @@ if( section.view.element != null ){
|
||||||
// Pour chaque machine
|
// Pour chaque machine
|
||||||
for( var i = 0 ; i < machine_list.length ; i++ ){
|
for( var i = 0 ; i < machine_list.length ; i++ ){
|
||||||
// Si doit etre visible
|
// Si doit etre visible
|
||||||
if( uid_list.indexOf(machine_list[i].id) > -1 )
|
if( uid_list.indexOf(parseInt(machine_list[i].id)) > -1 )
|
||||||
machine_list[i].remClass('hidden');
|
machine_list[i].remClass('hidden');
|
||||||
// Si ne doit pas etre visible
|
// Si ne doit pas etre visible
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// TODO: Supprimer les retours vers la cible lors de 'création'/'modification'
|
||||||
|
|
||||||
// On referencie toutes les sections
|
// On referencie toutes les sections
|
||||||
var section = {
|
var section = {
|
||||||
view: {
|
view: {
|
||||||
|
|
Loading…
Reference in New Issue