From 4455daf9c1434b6357a21d87bb83ac2c471a98cd Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 16 Feb 2016 14:25:06 +0100 Subject: [PATCH] - [x] [view/js/users] Recherche instantanee - [x] [userDefault] Implementation de la recherche --- config/modules.json | 2 + config/repositories.json | 2 + css/constants.scss | 1 + css/container.css | 2 +- css/container.scss | 43 +++++++++++++++- manager/module/userDefault.php | 20 ++++++++ manager/repo/user.php | 24 +++++++++ todo.md | 9 ++-- view/js/users.js | 89 +++++++++++++++++++++++++++++----- view/users.php | 4 ++ 10 files changed, 179 insertions(+), 17 deletions(-) diff --git a/config/modules.json b/config/modules.json index e61ce52..0fe232f 100755 --- a/config/modules.json +++ b/config/modules.json @@ -5,6 +5,8 @@ "link", "unlink", + "search", + "getAll", "getById", "getByCode", diff --git a/config/repositories.json b/config/repositories.json index 0ec1141..3623dd2 100755 --- a/config/repositories.json +++ b/config/repositories.json @@ -2,6 +2,8 @@ "user" :[ "create", + "search", + "getAll", "getById", "getByCode", diff --git a/css/constants.scss b/css/constants.scss index 6738efc..8abdeeb 100755 --- a/css/constants.scss +++ b/css/constants.scss @@ -10,4 +10,5 @@ $error-color: #cc5857; /* FORMULAIRES */ $form-valid-color: #27a560; $form-neutral-color: #2193e6; +$form-search-color: #5630ed; $form-invalid-color: darken($theme-color, 5); diff --git a/css/container.css b/css/container.css index 6cae810..6dfc4e0 100755 --- a/css/container.css +++ b/css/container.css @@ -1,2 +1,2 @@ -#WRAPPER>#CONTAINER>section{display:none;flex-grow:1}#WRAPPER>#CONTAINER>section.active{display:block}#WRAPPER>#CONTAINER>section.active.list{display:flex;flex-direction:row;justify-content:space-around;flex-wrap:wrap}#WRAPPER>#CONTAINER>section.active.list .inline-box{flex:0 0 1}#WRAPPER>#CONTAINER>section.active.list .searchbar{display:inline-block;position:relative;width:calc( 100% - 2*1em - 2*1em );margin:1em;padding:.5em 1em;padding-left:2em;border-radius:3px;border:1px solid #b1b1b1;background:#fff url("/f/svg/search/st/sub-menu-side") 0.5em center no-repeat;background-size:1em;transition:border .4s ease-in-out}#WRAPPER>#CONTAINER>section.active.list .searchbar:hover,#WRAPPER>#CONTAINER>section.active.list .searchbar:focus{border-color:#5630ed}#WRAPPER>#CONTAINER>section.active.list .error{display:inline-block;position:relative;width:calc( 100% - 2*1em - 2*1em );height:1em;margin:1em;padding:1em;border-radius:3px;border:1px solid #d52918;background:#d52918;color:#fff;text-shadow:1px 1px #a82013}#WRAPPER>#CONTAINER>section>.inline-box{display:inline-block;position:relative;width:calc( 50% - 2*1em - 2*1em );margin:1em;padding:1em;border-radius:3px;box-shadow:0 0 1px #b7b7b7;background-color:#fff}#WRAPPER>#CONTAINER>section>.inline-box a{text-decoration:none;color:inherit}#WRAPPER>#CONTAINER>section>.inline-box .title{display:inline-block;font-size:1.15em;font-weight:bold;color:#bf2515}#WRAPPER>#CONTAINER>section>.inline-box .title>span{font-size:.8em;color:#333}#WRAPPER>#CONTAINER>section>.inline-box .code,#WRAPPER>#CONTAINER>section>.inline-box .mail{display:block;margin:1em;color:#333}#WRAPPER>#CONTAINER>section>.inline-box .code svg,#WRAPPER>#CONTAINER>section>.inline-box .mail svg{display:inline-block;position:relative;margin-left:.5em;margin-right:.5em;margin-bottom:-.6em;width:1.5em;height:2em;pointer-events:none}#WRAPPER>#CONTAINER>section>.inline-box .code svg path,#WRAPPER>#CONTAINER>section>.inline-box .mail svg path{fill:#333 !important;pointer-events:none}#WRAPPER>#CONTAINER>section>.inline-box .groups{display:block;margin:1em;color:#333}#WRAPPER>#CONTAINER>section>.inline-box .groups svg{display:inline-block;position:relative;margin-left:.5em;margin-right:.5em;margin-bottom:-.6em;width:1.5em;height:2em;pointer-events:none}#WRAPPER>#CONTAINER>section>.inline-box .groups svg path{fill:#333 !important;pointer-events:none}#WRAPPER>#CONTAINER>section>.inline-box .groups span{display:inline-block;padding:.1em .5em;margin-right:.2em;border-radius:3px;border:1px solid #bdbdbd;box-shadow:inset 0 0 2px #fafafa;background-color:#f9f9f9;color:#333;cursor:default}#WRAPPER>#CONTAINER>section>.inline-box .link_edit,#WRAPPER>#CONTAINER>section>.inline-box .link_remove{display:inline-block;position:relative;width:1em;height:1em;margin-left:1em;cursor:pointer}#WRAPPER>#CONTAINER>section>.inline-box .link_edit>svg,#WRAPPER>#CONTAINER>section>.inline-box .link_remove>svg{width:100%;height:100%;fill:#ddd !important;transition:fill .4s ease-in-out;pointer-events:none}#WRAPPER>#CONTAINER>section>.inline-box .link_edit:hover>svg,#WRAPPER>#CONTAINER>section>.inline-box .link_remove:hover>svg{fill:#2193e6 !important}#WRAPPER>#CONTAINER>section>.inline-box .link_remove:hover>svg{fill:#d52918 !important}#WRAPPER>#CONTAINER>section>form{display:inline-block;position:relative;left:50%;margin:.3em 0;padding:1em;border-radius:3px;border-color:#d52918;box-shadow:0 0 1px #b7b7b7;background-color:#fff;transform:translateX(-50%)}#WRAPPER>#CONTAINER>section>form.valid{border-color:#27a560}#WRAPPER>#CONTAINER>section>form.neutral{border-color:#2193e6}#WRAPPER>#CONTAINER>section>form input[type=text],#WRAPPER>#CONTAINER>section>form input[type=mail],#WRAPPER>#CONTAINER>section>form input[type=password],#WRAPPER>#CONTAINER>section>form.invalid>input[type=text],#WRAPPER>#CONTAINER>section>form.invalid>input[type=mail],#WRAPPER>#CONTAINER>section>form.invalid>input[type=password],#WRAPPER>#CONTAINER>section>form input.invalid[type=text],#WRAPPER>#CONTAINER>section>form input.invalid[type=mail],#WRAPPER>#CONTAINER>section>form input.invalid[type=password]{display:inline-block;margin:1em 0;padding:.7em 1em;border-radius:3px;border:1px solid #d7dde8;color:#2f3033;transition:border .4s ease-in-out}#WRAPPER>#CONTAINER>section>form input[type=text]:focus,#WRAPPER>#CONTAINER>section>form input[type=text]:hover,#WRAPPER>#CONTAINER>section>form input[type=mail]:focus,#WRAPPER>#CONTAINER>section>form input[type=mail]:hover,#WRAPPER>#CONTAINER>section>form input[type=password]:focus,#WRAPPER>#CONTAINER>section>form input[type=password]:hover,#WRAPPER>#CONTAINER>section>form.invalid>input[type=text]:focus,#WRAPPER>#CONTAINER>section>form.invalid>input[type=text]:hover,#WRAPPER>#CONTAINER>section>form.invalid>input[type=mail]:focus,#WRAPPER>#CONTAINER>section>form.invalid>input[type=mail]:hover,#WRAPPER>#CONTAINER>section>form.invalid>input[type=password]:focus,#WRAPPER>#CONTAINER>section>form.invalid>input[type=password]:hover,#WRAPPER>#CONTAINER>section>form input.invalid[type=text]:focus,#WRAPPER>#CONTAINER>section>form input.invalid[type=text]:hover,#WRAPPER>#CONTAINER>section>form input.invalid[type=mail]:focus,#WRAPPER>#CONTAINER>section>form input.invalid[type=mail]:hover,#WRAPPER>#CONTAINER>section>form input.invalid[type=password]:focus,#WRAPPER>#CONTAINER>section>form input.invalid[type=password]:hover{border-color:#d52918}#WRAPPER>#CONTAINER>section>form.valid>input[type=text]:focus,#WRAPPER>#CONTAINER>section>form.valid>input[type=text]:hover,#WRAPPER>#CONTAINER>section>form.valid>input[type=mail]:focus,#WRAPPER>#CONTAINER>section>form.valid>input[type=mail]:hover,#WRAPPER>#CONTAINER>section>form.valid>input[type=password]:focus,#WRAPPER>#CONTAINER>section>form.valid>input[type=password]:hover,#WRAPPER>#CONTAINER>section>form input.valid[type=text]:focus,#WRAPPER>#CONTAINER>section>form input.valid[type=text]:hover,#WRAPPER>#CONTAINER>section>form input.valid[type=mail]:focus,#WRAPPER>#CONTAINER>section>form input.valid[type=mail]:hover,#WRAPPER>#CONTAINER>section>form input.valid[type=password]:focus,#WRAPPER>#CONTAINER>section>form input.valid[type=password]:hover{border-color:#27a560}#WRAPPER>#CONTAINER>section>form.neutral>input[type=text]:focus,#WRAPPER>#CONTAINER>section>form.neutral>input[type=text]:hover,#WRAPPER>#CONTAINER>section>form.neutral>input[type=mail]:focus,#WRAPPER>#CONTAINER>section>form.neutral>input[type=mail]:hover,#WRAPPER>#CONTAINER>section>form.neutral>input[type=password]:focus,#WRAPPER>#CONTAINER>section>form.neutral>input[type=password]:hover,#WRAPPER>#CONTAINER>section>form input.neutral[type=text]:focus,#WRAPPER>#CONTAINER>section>form input.neutral[type=text]:hover,#WRAPPER>#CONTAINER>section>form input.neutral[type=mail]:focus,#WRAPPER>#CONTAINER>section>form input.neutral[type=mail]:hover,#WRAPPER>#CONTAINER>section>form input.neutral[type=password]:focus,#WRAPPER>#CONTAINER>section>form input.neutral[type=password]:hover{border-color:#2193e6}#WRAPPER>#CONTAINER>section>form button,#WRAPPER>#CONTAINER>section>form button.invalid,#WRAPPER>#CONTAINER>section>form.invalid>button{display:inline-block;position:relative;left:50%;padding:.7em 1em;border-radius:3px;border:1px solid #d52918;background-color:#d52918;color:#fff;transition:background .4s ease-in-out;transform:translateX(-50%)}#WRAPPER>#CONTAINER>section>form button:hover,#WRAPPER>#CONTAINER>section>form button:focus,#WRAPPER>#CONTAINER>section>form button.invalid:hover,#WRAPPER>#CONTAINER>section>form button.invalid:focus,#WRAPPER>#CONTAINER>section>form.invalid>button:hover,#WRAPPER>#CONTAINER>section>form.invalid>button:focus{background-color:#fff;color:#d52918}#WRAPPER>#CONTAINER>section>form button.valid,#WRAPPER>#CONTAINER>section>form.valid>button{border-color:#27a560;background-color:#27a560}#WRAPPER>#CONTAINER>section>form button.valid:hover,#WRAPPER>#CONTAINER>section>form button.valid:focus,#WRAPPER>#CONTAINER>section>form.valid>button:hover,#WRAPPER>#CONTAINER>section>form.valid>button:focus{background-color:#fff;color:#27a560}#WRAPPER>#CONTAINER>section>form button.neutral,#WRAPPER>#CONTAINER>section>form.neutral>button{border-color:#2193e6;background-color:#2193e6}#WRAPPER>#CONTAINER>section>form button.neutral:hover,#WRAPPER>#CONTAINER>section>form button.neutral:focus,#WRAPPER>#CONTAINER>section>form.neutral>button:hover,#WRAPPER>#CONTAINER>section>form.neutral>button:focus{background-color:#fff;color:#2193e6}#WRAPPER>#CONTAINER>section>form hr.OR{display:block;position:relative;width:100%;height:0;border:0;border-bottom:1px dashed #d52918}#WRAPPER>#CONTAINER>section>form hr.OR:before{content:'OU';display:inline-block;position:relative;top:50%;left:50%;padding:0 1em;background-color:#fff;color:#d52918;transform:translateX(-50%) translatey(-50%)}#WRAPPER>#CONTAINER>section>form .valid>hr.OR,#WRAPPER>#CONTAINER>section>form hr.OR.valid{border-bottom:1px dashed #27a560}#WRAPPER>#CONTAINER>section>form .valid>hr.OR:before,#WRAPPER>#CONTAINER>section>form hr.OR.valid:before{color:#27a560}#WRAPPER>#CONTAINER>section>form .neutral>hr.OR,#WRAPPER>#CONTAINER>section>form hr.OR.neutral{border-bottom:1px dashed #2193e6}#WRAPPER>#CONTAINER>section>form .neutral>hr.OR:before,#WRAPPER>#CONTAINER>section>form hr.OR.neutral:before{color:#2193e6} +#WRAPPER>#CONTAINER>section{display:none;flex-grow:1}#WRAPPER>#CONTAINER>section.active{display:block}#WRAPPER>#CONTAINER>section.active.list{display:flex;flex-direction:row;justify-content:space-around;flex-wrap:wrap}#WRAPPER>#CONTAINER>section.active.list .inline-box{flex:0 0 1}#WRAPPER>#CONTAINER>section.active.list .searchbar{display:inline-block;position:relative;width:calc( 100% - 2*1em - 2*1em );margin:1em;padding:.5em 1em;padding-left:2em;border-radius:3px;border:1px solid #b1b1b1;background:#fff url("/f/svg/search/st/sub-menu-side") 0.5em center no-repeat;background-size:1em;transition:border .4s ease-in-out}#WRAPPER>#CONTAINER>section.active.list .searchbar:hover,#WRAPPER>#CONTAINER>section.active.list .searchbar:focus{border-color:#5630ed}#WRAPPER>#CONTAINER>section.active.list .error{display:inline-block;position:relative;width:calc( 100% - 2*1em - 2*1em );height:1em;margin:1em;padding:1em;border-radius:3px;border:1px solid #d52918;background:#d52918;color:#fff;text-shadow:1px 1px #a82013}#WRAPPER>#CONTAINER>section>.inline-box{display:inline-block;position:relative;width:calc( 50% - 2*1em - 2*1em );margin:1em;padding:1em;border-radius:3px;box-shadow:0 0 1px #b7b7b7;background-color:#fff}#WRAPPER>#CONTAINER>section>.inline-box a{text-decoration:none;color:inherit}#WRAPPER>#CONTAINER>section>.inline-box .title{display:inline-block;font-size:1.15em;font-weight:bold;color:#bf2515}#WRAPPER>#CONTAINER>section>.inline-box .title>span{font-size:.8em;color:#333}#WRAPPER>#CONTAINER>section>.inline-box .code,#WRAPPER>#CONTAINER>section>.inline-box .mail{display:block;margin:1em;color:#333}#WRAPPER>#CONTAINER>section>.inline-box .code svg,#WRAPPER>#CONTAINER>section>.inline-box .mail svg{display:inline-block;position:relative;margin-left:.5em;margin-right:.5em;margin-bottom:-.6em;width:1.5em;height:2em;pointer-events:none}#WRAPPER>#CONTAINER>section>.inline-box .code svg path,#WRAPPER>#CONTAINER>section>.inline-box .mail svg path{fill:#333 !important;pointer-events:none}#WRAPPER>#CONTAINER>section>.inline-box .groups{display:block;margin:1em;color:#333}#WRAPPER>#CONTAINER>section>.inline-box .groups svg{display:inline-block;position:relative;margin-left:.5em;margin-right:.5em;margin-bottom:-.6em;width:1.5em;height:2em;pointer-events:none}#WRAPPER>#CONTAINER>section>.inline-box .groups svg path{fill:#333 !important;pointer-events:none}#WRAPPER>#CONTAINER>section>.inline-box .groups span{display:inline-block;padding:.1em .5em;margin-right:.2em;border-radius:3px;border:1px solid #bdbdbd;box-shadow:inset 0 0 2px #fafafa;background-color:#f9f9f9;color:#333;cursor:default}#WRAPPER>#CONTAINER>section>.inline-box .link_edit,#WRAPPER>#CONTAINER>section>.inline-box .link_remove{display:inline-block;position:relative;width:1em;height:1em;margin-left:1em;cursor:pointer}#WRAPPER>#CONTAINER>section>.inline-box .link_edit>svg,#WRAPPER>#CONTAINER>section>.inline-box .link_remove>svg{width:100%;height:100%;fill:#ddd !important;transition:fill .4s ease-in-out;pointer-events:none}#WRAPPER>#CONTAINER>section>.inline-box .link_edit:hover>svg,#WRAPPER>#CONTAINER>section>.inline-box .link_remove:hover>svg{fill:#2193e6 !important}#WRAPPER>#CONTAINER>section>.inline-box .link_remove:hover>svg{fill:#d52918 !important}#WRAPPER>#CONTAINER>section>form{display:inline-block;position:relative;left:50%;margin:.3em 0;padding:1em;border-radius:3px;border-color:#d52918;box-shadow:0 0 1px #b7b7b7;background-color:#fff;transform:translateX(-50%)}#WRAPPER>#CONTAINER>section>form.valid{border-color:#27a560}#WRAPPER>#CONTAINER>section>form.neutral{border-color:#2193e6}#WRAPPER>#CONTAINER>section>form.search{border-color:#2193e6}#WRAPPER>#CONTAINER>section>form input[type=text],#WRAPPER>#CONTAINER>section>form input[type=mail],#WRAPPER>#CONTAINER>section>form input[type=password],#WRAPPER>#CONTAINER>section>form.invalid>input[type=text],#WRAPPER>#CONTAINER>section>form.invalid>input[type=mail],#WRAPPER>#CONTAINER>section>form.invalid>input[type=password],#WRAPPER>#CONTAINER>section>form input.invalid[type=text],#WRAPPER>#CONTAINER>section>form input.invalid[type=mail],#WRAPPER>#CONTAINER>section>form input.invalid[type=password]{display:inline-block;margin:1em 0;padding:.7em 1em;border-radius:3px;border:1px solid #d7dde8;color:#2f3033;transition:border .4s ease-in-out}#WRAPPER>#CONTAINER>section>form input[type=text]:focus,#WRAPPER>#CONTAINER>section>form input[type=text]:hover,#WRAPPER>#CONTAINER>section>form input[type=mail]:focus,#WRAPPER>#CONTAINER>section>form input[type=mail]:hover,#WRAPPER>#CONTAINER>section>form input[type=password]:focus,#WRAPPER>#CONTAINER>section>form input[type=password]:hover,#WRAPPER>#CONTAINER>section>form.invalid>input[type=text]:focus,#WRAPPER>#CONTAINER>section>form.invalid>input[type=text]:hover,#WRAPPER>#CONTAINER>section>form.invalid>input[type=mail]:focus,#WRAPPER>#CONTAINER>section>form.invalid>input[type=mail]:hover,#WRAPPER>#CONTAINER>section>form.invalid>input[type=password]:focus,#WRAPPER>#CONTAINER>section>form.invalid>input[type=password]:hover,#WRAPPER>#CONTAINER>section>form input.invalid[type=text]:focus,#WRAPPER>#CONTAINER>section>form input.invalid[type=text]:hover,#WRAPPER>#CONTAINER>section>form input.invalid[type=mail]:focus,#WRAPPER>#CONTAINER>section>form input.invalid[type=mail]:hover,#WRAPPER>#CONTAINER>section>form input.invalid[type=password]:focus,#WRAPPER>#CONTAINER>section>form input.invalid[type=password]:hover{border-color:#d52918}#WRAPPER>#CONTAINER>section>form.valid>input[type=text]:focus,#WRAPPER>#CONTAINER>section>form.valid>input[type=text]:hover,#WRAPPER>#CONTAINER>section>form.valid>input[type=mail]:focus,#WRAPPER>#CONTAINER>section>form.valid>input[type=mail]:hover,#WRAPPER>#CONTAINER>section>form.valid>input[type=password]:focus,#WRAPPER>#CONTAINER>section>form.valid>input[type=password]:hover,#WRAPPER>#CONTAINER>section>form input.valid[type=text]:focus,#WRAPPER>#CONTAINER>section>form input.valid[type=text]:hover,#WRAPPER>#CONTAINER>section>form input.valid[type=mail]:focus,#WRAPPER>#CONTAINER>section>form input.valid[type=mail]:hover,#WRAPPER>#CONTAINER>section>form input.valid[type=password]:focus,#WRAPPER>#CONTAINER>section>form input.valid[type=password]:hover{border-color:#27a560}#WRAPPER>#CONTAINER>section>form.neutral>input[type=text]:focus,#WRAPPER>#CONTAINER>section>form.neutral>input[type=text]:hover,#WRAPPER>#CONTAINER>section>form.neutral>input[type=mail]:focus,#WRAPPER>#CONTAINER>section>form.neutral>input[type=mail]:hover,#WRAPPER>#CONTAINER>section>form.neutral>input[type=password]:focus,#WRAPPER>#CONTAINER>section>form.neutral>input[type=password]:hover,#WRAPPER>#CONTAINER>section>form input.neutral[type=text]:focus,#WRAPPER>#CONTAINER>section>form input.neutral[type=text]:hover,#WRAPPER>#CONTAINER>section>form input.neutral[type=mail]:focus,#WRAPPER>#CONTAINER>section>form input.neutral[type=mail]:hover,#WRAPPER>#CONTAINER>section>form input.neutral[type=password]:focus,#WRAPPER>#CONTAINER>section>form input.neutral[type=password]:hover{border-color:#2193e6}#WRAPPER>#CONTAINER>section>form.search>input[type=text]:focus,#WRAPPER>#CONTAINER>section>form.search>input[type=text]:hover,#WRAPPER>#CONTAINER>section>form.search>input[type=mail]:focus,#WRAPPER>#CONTAINER>section>form.search>input[type=mail]:hover,#WRAPPER>#CONTAINER>section>form.search>input[type=password]:focus,#WRAPPER>#CONTAINER>section>form.search>input[type=password]:hover,#WRAPPER>#CONTAINER>section>form input.search[type=text]:focus,#WRAPPER>#CONTAINER>section>form input.search[type=text]:hover,#WRAPPER>#CONTAINER>section>form input.search[type=mail]:focus,#WRAPPER>#CONTAINER>section>form input.search[type=mail]:hover,#WRAPPER>#CONTAINER>section>form input.search[type=password]:focus,#WRAPPER>#CONTAINER>section>form input.search[type=password]:hover{border-color:#5630ed}#WRAPPER>#CONTAINER>section>form button,#WRAPPER>#CONTAINER>section>form button.invalid,#WRAPPER>#CONTAINER>section>form.invalid>button{display:inline-block;position:relative;left:50%;padding:.7em 1em;border-radius:3px;border:1px solid #d52918;background-color:#d52918;color:#fff;transition:background .4s ease-in-out;transform:translateX(-50%)}#WRAPPER>#CONTAINER>section>form button:hover,#WRAPPER>#CONTAINER>section>form button:focus,#WRAPPER>#CONTAINER>section>form button.invalid:hover,#WRAPPER>#CONTAINER>section>form button.invalid:focus,#WRAPPER>#CONTAINER>section>form.invalid>button:hover,#WRAPPER>#CONTAINER>section>form.invalid>button:focus{background-color:#fff;color:#d52918}#WRAPPER>#CONTAINER>section>form button.valid,#WRAPPER>#CONTAINER>section>form.valid>button{border-color:#27a560;background-color:#27a560}#WRAPPER>#CONTAINER>section>form button.valid:hover,#WRAPPER>#CONTAINER>section>form button.valid:focus,#WRAPPER>#CONTAINER>section>form.valid>button:hover,#WRAPPER>#CONTAINER>section>form.valid>button:focus{background-color:#fff;color:#27a560}#WRAPPER>#CONTAINER>section>form button.neutral,#WRAPPER>#CONTAINER>section>form.neutral>button{border-color:#2193e6;background-color:#2193e6}#WRAPPER>#CONTAINER>section>form button.neutral:hover,#WRAPPER>#CONTAINER>section>form button.neutral:focus,#WRAPPER>#CONTAINER>section>form.neutral>button:hover,#WRAPPER>#CONTAINER>section>form.neutral>button:focus{background-color:#fff;color:#2193e6}#WRAPPER>#CONTAINER>section>form button.search,#WRAPPER>#CONTAINER>section>form.search>button{border-color:#5630ed;background-color:#5630ed}#WRAPPER>#CONTAINER>section>form button.search:hover,#WRAPPER>#CONTAINER>section>form button.search:focus,#WRAPPER>#CONTAINER>section>form.search>button:hover,#WRAPPER>#CONTAINER>section>form.search>button:focus{background-color:#fff;color:#5630ed}#WRAPPER>#CONTAINER>section>form hr.OR{display:block;position:relative;width:100%;height:0;border:0;border-bottom:1px dashed #d52918}#WRAPPER>#CONTAINER>section>form hr.OR:before{content:'OU';display:inline-block;position:relative;top:50%;left:50%;padding:0 1em;background-color:#fff;color:#d52918;transform:translateX(-50%) translatey(-50%)}#WRAPPER>#CONTAINER>section>form .valid>hr.OR,#WRAPPER>#CONTAINER>section>form hr.OR.valid{border-bottom:1px dashed #27a560}#WRAPPER>#CONTAINER>section>form .valid>hr.OR:before,#WRAPPER>#CONTAINER>section>form hr.OR.valid:before{color:#27a560}#WRAPPER>#CONTAINER>section>form .neutral>hr.OR,#WRAPPER>#CONTAINER>section>form hr.OR.neutral{border-bottom:1px dashed #2193e6}#WRAPPER>#CONTAINER>section>form .neutral>hr.OR:before,#WRAPPER>#CONTAINER>section>form hr.OR.neutral:before{color:#2193e6}#WRAPPER>#CONTAINER>section>form .search>hr.OR,#WRAPPER>#CONTAINER>section>form hr.OR.search{border-bottom:1px dashed #5630ed}#WRAPPER>#CONTAINER>section>form .search>hr.OR:before,#WRAPPER>#CONTAINER>section>form hr.OR.search:before{color:#5630ed} /*# sourceMappingURL=container.css.map */ diff --git a/css/container.scss b/css/container.scss index ed8bf7b..3ae6f7c 100755 --- a/css/container.scss +++ b/css/container.scss @@ -45,7 +45,7 @@ &:hover, &:focus{ - border-color: #5630ed; + border-color: $form-search-color; } } @@ -245,6 +245,10 @@ border-color: $form-neutral-color; } + &.search{ + border-color: $form-neutral-color; + } + /* (1) Champs de texte */ input[type=text], @@ -299,6 +303,19 @@ } } + // Champs neutres + &.search > input[type=text], + &.search > input[type=mail], + &.search > input[type=password], + input.search[type=text], + input.search[type=mail], + input.search[type=password]{ + &:focus, + &:hover{ + border-color: $form-search-color; + } + } + /* (2) Boutons */ @@ -358,6 +375,20 @@ } } + // Boutons recherche + button.search, + &.search > button{ + border-color: $form-search-color; + + background-color: $form-search-color; + + &:hover, + &:focus{ + background-color: #fff; + color: $form-search-color; + } + } + // "OU" separant les boutons hr.OR{ display: block; @@ -404,6 +435,16 @@ } } + + // "OU" recherche + .search > hr.OR, + hr.OR.search{ + border-bottom: 1px dashed $form-search-color; + &:before{ + color: $form-search-color; + } + + } } } \ No newline at end of file diff --git a/manager/module/userDefault.php b/manager/module/userDefault.php index d88355f..136193e 100755 --- a/manager/module/userDefault.php +++ b/manager/module/userDefault.php @@ -153,6 +153,26 @@ + /* RENVOIE UN UTILISATEUR EN FONCTION D'UN MOT CLE + * + * @keyword Element de recherche + * + * @return user Retourne la liste des utilisateurs trouves + * + */ + public static function search($keyword){ + // On recupere les donnees + $user = new Repo('user/search', array($keyword)); + + return array( + 'users' => $user->answer() + ); + } + + + + + /* RENVOIE LA LISTE EXHAUSTIVE DES UTILISATEURS * * @return utilisateurs Liste des utilisateurs diff --git a/manager/repo/user.php b/manager/repo/user.php index 37e3614..6cef87a 100755 --- a/manager/repo/user.php +++ b/manager/repo/user.php @@ -61,6 +61,30 @@ + /* RENVOIE UN UTILISATEUR EN FONCTION D'UN MOT CLE + * + * @keyword Element de recherche + * + * @return user Retourne l'utilisateur trouve ou FALSE si rien n'est trouve + * + */ + public static function search($keyword){ + // On recupere les donnees + $searchusers = Database::getPDO()->query("SELECT * FROM user + WHERE code LIKE '%".$keyword."%' + OR username LIKE '%".$keyword."%' + OR firstname LIKE '%".$keyword."%' + OR lastname LIKE '%".$keyword."%' + OR mail LIKE '%".$keyword."%' + "); + + return Database::delNumeric( $searchusers->fetchAll() ); + } + + + + + /* RENVOIE LA LISTE DE TOUS LES UTILISATEURS diff --git a/todo.md b/todo.md index 82fe6f7..64137db 100755 --- a/todo.md +++ b/todo.md @@ -7,12 +7,13 @@ ############ # EN COURS # ############ -- [ ] [view/js/users] Recherche instantanee + - [ ] [view/js/machines] Recherche instantanee +- [ ] [machineDefault] Implementation de la recherche - [x] [userDefault] Implementer la modification - - [ ] [userRepo] Gestion des parametres optionnels - + - [ ] [userRepo] Gestion des parametres optionnels + - [ ] [view/users] Gestion des parametres optionnels physiques -> separer la selection et modification - [ ] [machineDefault] Implementer la modification - [ ] [view/js/machines] Modification de machine @@ -21,6 +22,8 @@ ######## # FAIT # ######## +- [x] [view/js/users] Recherche instantanee +- [x] [userDefault] Implementation de la recherche - [x] [view/js/users] Modification d'utilisateur - [x] [userDefault] Implementer la modification - [x] [view/js/users+machines] Modification @value plutot que @placeholder diff --git a/view/js/users.js b/view/js/users.js index 72f0629..5911a7c 100644 --- a/view/js/users.js +++ b/view/js/users.js @@ -43,7 +43,7 @@ if( section.view.element != null ){ section.view.link.edit[i].addEventListener('click', function(e){ pageManager.vars[1] = e.target.getData('user'); - autofill_edit(); + autofill_edit(pageManager.vars[1]); navSubMenu('edit'); }, false); @@ -54,7 +54,7 @@ if( section.view.element != null ){ section.view.link.remove[i].addEventListener('click', function(e){ pageManager.vars[1] = e.target.getData('user'); - autofill_remove(); + autofill_remove(pageManager.vars[1]); navSubMenu('remove'); }, false); @@ -158,11 +158,11 @@ if( section.remove.element != null ){ /* (1) Gestion de l'auto-remplissage par url */ - function autofill_remove(){ if( pageManager.vars.length >= 2 && !isNaN(pageManager.vars[1]) ){ + function autofill_remove(id_user){ // On recupere le code + username de l'utilisateur selectionne var user_data = null; - api.send({path:'userDefault/getById', data: [pageManager.vars[1]]}, function(answer){ + api.send({path:'userDefault/getById', data: [id_user]}, function(answer){ if( answer.ModuleError == 0 ){ // Aucune erreur user_data = answer.user; @@ -171,7 +171,7 @@ if( section.remove.element != null ){ section.remove.input.username.value = user_data.username; } }); - }}autofill_remove(); + }if( pageManager.vars.length >= 2 && !isNaN(pageManager.vars[1]) ) autofill_remove(pageManager.vars[1]); @@ -237,6 +237,12 @@ if( section.edit.element != null ){ // Definition des champs section.edit.input = { + search: { + keyword: document.querySelector(section.edit.text + '#edit_search_keyword'), + id: document.querySelector(section.edit.text + '#edit_search_id'), + submit: document.querySelector(section.edit.text + '#edit_search_submit') + }, + code: document.querySelector(section.edit.text + '#edit_code'), username: document.querySelector(section.edit.text + '#edit_username'), firstname: document.querySelector(section.edit.text + '#edit_firstname'), @@ -250,14 +256,32 @@ if( section.edit.element != null ){ /* (1) Gestion de l'auto-remplissage par url */ - function autofill_edit(){ if( pageManager.vars.length >= 2 && !isNaN(pageManager.vars[1]) ){ + function autofill_edit(id_user){ // On recupere le code + username de l'utilisateur selectionne var user_data = null; - api.send({path:'userDefault/getById', data: [pageManager.vars[1]]}, function(answer){ - if( answer.ModuleError == 0 ){ // Aucune erreur - user_data = answer.user; + // SI @id_user est un entier + if( !isNaN(id_user) ){ + api.send({path:'userDefault/getById', data: [id_user]}, function(answer){ + if( answer.ModuleError == 0 ){ // Si aucune erreur + user_data = answer.user; + + }else{ // Si erreuron utilise un jeu de donnees vides + user_data = { + id_user: '', + code: '', + username: '', + firstname: '', + lastname: '', + mail: '', + status: '' + }; + } + + // On enregistre l'UID de l'utilisateur + section.edit.input.search.id.value = user_data.id_user; + // Auto-remplissage du formulaire section.edit.input.code.value = user_data.code; section.edit.input.username.value = user_data.username; @@ -266,9 +290,50 @@ if( section.edit.element != null ){ section.edit.input.mail.value = user_data.mail; section.edit.input.password.value = ''; section.edit.input.status.value = user_data.status; - } - }); - }}autofill_edit(); + }); + // Si @id_user est incoherent + } + + + }if( pageManager.vars.length >= 2 && !isNaN(pageManager.vars[1]) ) autofill_edit(pageManager.vars[1]); + + + + /* (2) Gestion de la recherche de l'utilisateur */ + var lastsearch = null; + var searchindex = 0; + section.edit.input.search.submit.addEventListener('click', function(e){ + // On annule l'envoi de base (PHP) + e.preventDefault(); + + // Si le champ n'est pas vide, on lance la recherche + if( section.edit.input.search.keyword.value != '' ){ + // Redaction de la requete + var getuid = { + path: 'userDefault/search', + data: [section.edit.input.search.keyword.value] + }; + + // On envoie la requete + api.send(getuid, function(uidanswer){ + if( uidanswer.ModuleError == 0 && uidanswer.users.length > 0 ){ // si on a trouve qqch + // Si on trouve le meme utilisateur que lors de la derniere recherche + if( lastsearch == uidanswer.users[searchindex].id_user ) + searchindex = (searchindex+1) % uidanswer.users.length; // on affiche le prochain (decalage cyclique) + + lastsearch = uidanswer.users[searchindex].id_user; + section.edit.input.search.id.value = lastsearch; + // on auto-remplit le formulaire + autofill_edit(lastsearch); + + }else{ + autofill_edit(null); + } + }); + } + + }, false); + diff --git a/view/users.php b/view/users.php index 7331c60..6fa8085 100755 --- a/view/users.php +++ b/view/users.php @@ -202,6 +202,10 @@ echo "
"; echo "
"; + echo "
"; + echo "
"; + echo "


"; + echo "
"; echo "
"; echo "
";