Nouvelle feuille de style + gestion fournisseurs

This commit is contained in:
2017-10-27 00:41:13 +02:00
parent 1e1ead5888
commit a0b4516f98
13 changed files with 2219 additions and 538 deletions

View File

@@ -5,6 +5,10 @@ var light_green = "#D5FCD8";
var base_bg = "#FEFEFE";
var base_border = "#555555";
/* **************************************************************************************
* GLOBAL
* **************************************************************************************/
///////////////////////////////////////////
// Cookies
///////////////////////////////////////////
@@ -42,9 +46,11 @@ function valid_input(obj) {
, 2000);
}
///////////////////////////////////////////
/* **************************************************************************************
* COMPONTANTS
* **************************************************************************************/
// Update result
///////////////////////////////////////////
function update_componants() {
obj = document.getElementById('result_container');
var xhttp = new XMLHttpRequest();
@@ -70,9 +76,8 @@ function update_componants() {
xhttp.send();
}
///////////////////////////////////////////
// Result ordering
///////////////////////////////////////////
function update_componants_by_reference(order) {
setcookie('c_order', order, 30);
setcookie('c_sort', 'reference', 30);
@@ -101,19 +106,19 @@ function update_componants_by_place(order) {
update_componants();
}
function previous_page(prevhop) {
function c_previous_page(prevhop) {
setcookie('c_offset', prevhop, 30);
update_componants();
}
function next_page(nexthop) {
function c_next_page(nexthop) {
setcookie('c_offset', nexthop, 30);
update_componants();
}
///////////////////////////////////////////
// Search componants
///////////////////////////////////////////
function search_componants_by_reference(obj) {
setcookie('c_reference', obj.value, 30);
update_componants();
@@ -134,22 +139,20 @@ function search_componants_by_provider(obj) {
update_componants();
}
///////////////////////////////////////////
// Delete componant
///////////////////////////////////////////
function confirm_delete() {
function confirm_componant_delete() {
var msg="La suppression est définitive \net n'est pas autorisée si le \ncomposant fait partie d'un Kit.\n\nConfirmer ?";
return confirm(msg)
}
///////////////////////////////////////////
// New componant
///////////////////////////////////////////
function new_componant() {
var err = false;
var obj = {};
if (getcookie('c_count') > 0){
var errr = true;
var err = true;
obj[0] = document.getElementById('reference');
}
if (getcookie('c_designation').length < 1){
@@ -160,6 +163,9 @@ function new_componant() {
var err = true;
obj[2] = document.getElementById('place');
}
if (document.getElementById('provider_id').value == 1){
setcookie('c_provider', '2', 30);
}
if (err == true) {
for (i in obj){
invalid_input(obj[i]);
@@ -194,9 +200,8 @@ function create_componant() {
xhttp.send();
}
///////////////////////////////////////////
// Update componant
///////////////////////////////////////////
function update_componant(obj, componant_id, type) {
if (type == 'numeric') {
if (isNaN(obj.value)) {
@@ -226,3 +231,182 @@ function update_componant(obj, componant_id, type) {
xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhttp.send('field='+obj.id+'&value='+obj.value);
}
/* **************************************************************************************
* PROVIDERS
* **************************************************************************************/
// Update result
function update_providers() {
obj = document.getElementById('result_container');
var xhttp = new XMLHttpRequest();
xhttp.onerror = function(){
obj.innerHTML = "Erreur lors de la mise à jour de la liste (1)"
};
xhttp.onload = function(){
if (xhttp.status != 200) {
obj.innerHTML = "Erreur lors de la mise à jour de la liste (2)"
}
};
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
var response = xhttp.responseText;
obj.innerHTML = response;
return true;
}
};
xhttp.open('POST', '/providers/update', true);
xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhttp.send();
}
// Result ordering
function update_providers_by_name(order) {
setcookie('p_order', order, 30);
setcookie('p_sort', 'name', 30);
setcookie('p_order_refresh', '1', 30);
update_providers();
}
function update_providers_by_address(order) {
setcookie('p_order', order, 30);
setcookie('p_sort', 'address', 30);
setcookie('p_order_refresh', '1', 30);
update_providers();
}
function update_providers_by_mail(order) {
setcookie('p_order', order, 30);
setcookie('p_sort', 'mail', 30);
setcookie('p_order_refresh', '1', 30);
update_providers();
}
function update_providers_by_url(order) {
setcookie('p_order', order, 30);
setcookie('p_sort', 'url', 30);
setcookie('p_order_refresh', '1', 30);
update_providers();
}
function update_providers_by_commentl(order) {
setcookie('p_order', order, 30);
setcookie('p_sort', 'comment', 30);
setcookie('p_order_refresh', '1', 30);
update_providers();
}
function p_previous_page(prevhop) {
setcookie('p_offset', prevhop, 30);
update_providers();
}
function p_next_page(nexthop) {
setcookie('p_offset', nexthop, 30);
update_providers();
}
// Search providers
function search_providers_by_name(obj) {
setcookie('p_name', obj.value, 30);
update_providers();
}
function search_providers_by_address(obj) {
setcookie('p_address', obj.value, 30);
update_providers();
}
function search_providers_by_mail(obj) {
setcookie('p_mail', obj.value, 30);
update_providers();
}
function search_providers_by_url(obj) {
setcookie('p_url', obj.value, 30);
update_providers();
}
function search_providers_by_comment(obj) {
setcookie('p_comment', obj.value, 30);
update_providers();
}
// New provider
function new_provider() {
var err = false;
var obj = {};
if (getcookie('p_count') > 0){
var err = true;
obj[0] = document.getElementById('name');
}
if (err == true) {
for (i in obj){
invalid_input(obj[i]);
}
return;
}
create_provider();
update_providers();
}
function create_provider() {
var MSG='Erreur lors de la creation du fournisseur.';
var xhttp = new XMLHttpRequest();
xhttp.onerror = function(){
alert(MSG);
return false;
};
xhttp.onload = function(){
if (xhttp.readyState == 4 && xhttp.status == 200) {
var response = xhttp.responseText;
if (response == 'OK'){
return true;
}
alert(MSG);
return false;
}
};
xhttp.open('POST', '/providers/new', true);
xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhttp.send();
}
// Delete provider
function confirm_provider_delete() {
var msg="La suppression est définitive \net n'est pas autorisée si le \nfournisseur est référencé \npar un composant.\n\nConfirmer ?";
return confirm(msg)
}
// Update provider
function update_provider(obj, provider_id, type) {
var xhttp = new XMLHttpRequest();
xhttp.onerror = function(){
invalid_input(obj);
};
xhttp.onload = function(){
if (xhttp.readyState == 4 && xhttp.status == 200) {
var response = xhttp.responseText;
if (response == 'OK'){
valid_input(obj);
return;
}
obj.style.borderColor = red;
invalid_input(obj);
}
};
xhttp.open('POST', '/providers/update/'+provider_id, true);
xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhttp.send('field='+obj.id+'&value='+obj.value);
}

View File

@@ -140,8 +140,8 @@ div.content {
}
div.note {
font-size: 12px;
line-height: 12px;
font-size: 14px;
line-height: 14px;
}
div.error {
@@ -177,226 +177,6 @@ div.footer {
text-align: center;
}
/* ***********************************
* Résultats
*********************************** */
div.row_count {
padding: 5px;
}
div.result_container {
text-align: left;
}
.border_left {
border-left-width: 1px;
border-left-style: solid;
}
.border_right {
border-right-width: 1px;
border-right-style: solid;
}
div.block, div.noborder {
overflow: hidden;
border-top-style: solid;
border-top-width: 1px;
height: 20px;
}
div.noborder {
border-style: none;
}
div.inner{
overflow: hidden;
float: center;
height: 20px;
}
div.pages_nav_bar {
overflow: hidden;
width: 1000px;
border-top-style: solid;
border-top-width: 1px;
height: 20px;
text-align: right;
padding-top: 10px;
}
div.block text{
width: 200px;
float: left;
text-align: left;
padding: 0 4px 0 4px;
}
div.block text.num{
width: 200px;
float: left;
padding: 0 4px 0 4px;
text-align: right;
}
div.inner text.edit, div.block text.edit {
background: url(../images/edit.png);
margin: 2px 0px 0px 20px;
}
div.inner text.trash {
background: url(../images/trash.png);
margin: 2px 0px 0px 20px;
}
div.block text.refresh {
background: url(../images/refresh.png);
margin: 2px 0px 0px 20px;
}
div.block text.search {
background: url(../images/search.png);
margin-left: 255px;
}
div.block text.save {
background: url(../images/save.png);
margin-left: 32px;
}
div.inner text.edit:hover,
div.inner text.trash:hover,
div.block text.refresh:hover,
div.block text.search:hover,
div.block text.save:hover{
background-color: #FFB387;
cursor: pointer;
}
div.inner text.edit {
width: 16px;
float:left;
height: 16px;
margin: 2px 0px 0px 20px;
border-radius: 2px;
background-repeat: no-repeat;
}
div.inner text.trash,
div.inner text.edit,
div.block text.refresh,
div.block text.search,
div.block text.save {
width: 8px;
float:left;
height: 16px;
border-radius: 2px;
background-repeat: no-repeat;
}
div.even {
background-color: #E5E5E5;
}
div.odd {
background-color: #FFFFFF;
}
div.block label {
width: 200px;
display: block;
float: left;
text-align: center;
font-weight: bold;
background-color: #FF5D00;
}
div.block label:hover {
cursor: pointer;
}
div.block .input{
margin-left:4px;
float:left;
}
div.action_bar {
display: inline-block;
width: 50px;
height: 32px;
}
span.prev_page, span.next_page {
color: #FF5D00;
font-weight: bold;
font-size: 12px;
}
span.prev_page:hover, span.next_page:hover {
color: #FFFFFF;
background-color: #FF5D00;
cursor: pointer;
}
span.page_num {
font-size: 12px;
}
/* ***********************************
* Editables
*********************************** */
div.no_border {
border-style: none;
border-width: 0px;
}
div.margin_bottom {
margin-bottom: 4px;
}
div.block label.editable {
height: 20px;
text-align: left;
vertical-align: middle;
padding: 0 4px 0 4px;
}
div.block text.editable {
width: 200px;
float: left;
padding: 0 4px 0 4px;
margin-left: 4px;
text-align: right;
background-color: #FFFFFF;
border-style: solid;
border-width: 1px;
height: 20px;
}
div.block select, div.block input {
width: 310px;
float: left;
padding: 0 4px 0 4px;
margin-left: 4px;
text-align: right;
background-color: #FFFFFF;
border-style: solid;
border-width: 1px;
border-color: #555555;
color: #555555;
height: 20px;
}
div.block input {
height: 17px;
width: 300px;
}
/* ***********************************
* Classes génériques
*********************************** */
@@ -419,18 +199,184 @@ span.bold {
font-weight: bold;
}
table {
border-collapse: collapse;
width: 100%;
/* ***********************************
* Search
*********************************** */
div.main_block {
padding: 0;
margin: 0;
width: 1000px;
float: left;
}
th {
background-color: #FFB387;
div.main_block text {
display: block;
font-weight: bold;
margin-bottom: 4px;
}
th, td {
text-align: left;
padding: 8px;
div.button_block {
margin: 0 0 4px 0;
height: 20px;
width: 525px;
}
tr:nth-child(even){background-color: #f2f2f2}
div.button_block input {
position: relative;
width: 16px;
height: 16px;
border-radius: 2px;
margin-right: 32px;
left: 250px;
}
div.button_block input:hover {
cursor: pointer;
background-color: #FF5D00;
}
div.input_block {
margin: 0 0 4px 0;
height: 20px;
width: 525px;
}
div.input_block label {
display: block;
float: left;
width: 200px;
text-align: center;
font-weight: bold;
background-color: #FF5D00;
height: 20px;
text-align: left;
vertical-align: middle;
padding: 0 4px 0 4px;
}
div.input_block select, div.input_block input {
width: 310px;
float: right;
padding: 0 4px 0 4px;
margin-left: 4px;
text-align: right;
background-color: #FFFFFF;
border-style: solid;
border-width: 1px;
border-color: #555555;
color: #555555;
height: 20px;
}
div.input_block input {
float: right;
height: 17px;
width: 300px;
}
/* ***********************************
* Result
*********************************** */
.border_bottom {
border-bottom-style: solid;
border-bottom-width: 1px;
}
.border_top {
border-top-style: solid;
border-top-width: 1px;
}
.border_left {
border-left-width: 1px;
border-left-style: solid;
}
div.even {
background-color: #E5E5E5;
}
div.odd {
background-color: #FFFFFF;
}
span.prev_page, span.next_page {
color: #FF5D00;
font-weight: bold;
font-size: 12px;
}
span.prev_page:hover, span.next_page:hover {
color: #FFFFFF;
background-color: #FF5D00;
cursor: pointer;
}
span.page_num {
font-size: 12px;
}
div.row_block {
margin: 0 0 4px 0;
height: 20px;
width: 1000px;
}
div.nav_page_block {
text-align: right;
height: 20px;
width: 1000px;
}
div.action_bar_block {
overflow: hidden;
float: center;
height: 20px;
}
div.row_block label {
display: block;
float: left;
text-align: center;
font-weight: bold;
background-color: #FF5D00;
vertical-align: middle;
}
div.row_block label:hover {
cursor: pointer;
}
div.row_block label.border_left,
div.row_block text.border_left {
border-left-style: solid;
border-left-width: 1;
}
div.row_block text {
display: block;
float: left;
font-weight: normal;
text-align: left;
overflow: hidden;
vertical-align: middle;
padding: 0 5px 0 5px;
white-space: nowrap;
}
div.row_block text.num {
text-align: right;
}
div.nav_page_block text {
display: block;
white-space: nowrap;
}
div.action_bar_block input {
height: 17px;
width: 16px;
margin-left: 20px;
}