Commit 793787cb by Simon

Backend terminé

parent 70281c44
@import url('https://fonts.googleapis.com/css?family=Roboto:400,500'); @import url('https://fonts.googleapis.com/css?family=Roboto:400,500');
.doodle-table { .doodle-table {
border-collapse:collapse; border-collapse: collapse;
width: 100%; width: 100%;
font-family: 'Roboto', sans-serif; font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
margin-top: 150px;
}
.table-responsive {
overflow-x: visible;
} }
thead tr th { thead tr th {
...@@ -12,18 +18,17 @@ thead tr th { ...@@ -12,18 +18,17 @@ thead tr th {
.doodle-table thead tr th{ .doodle-table thead tr th{
padding: 15px; padding: 15px;
font-family: Roboto, sans-serif; height: 70px;
font-weight: 400; font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
font-weight: 700;
font-size: 14px; font-size: 14px;
border-bottom: 1px solid #f3f3f3 !important; border-bottom: 1px solid #e6e6e6 !important;
} vertical-align: middle;
cursor: default;
.doodle-table thead tr th:nth-child(2) {
border-right: none
} }
.doodle-table tr td:nth-child(2) { .doodle-table tr td:nth-child(2) {
border-right: 1px solid #f3f3f3; border-right: none;
border-left: none; border-left: none;
} }
...@@ -39,21 +44,32 @@ thead tr th { ...@@ -39,21 +44,32 @@ thead tr th {
.doodle-table thead tr th:last-child { .doodle-table thead tr th:last-child {
border-right: none; border-right: none;
min-width: 130px;
max-width: 145px;
background: #fafafa;
border-bottom: 1px dashed #e6e6e6 !important;
} }
.doodle-table tr td:last-child {
background: #fafafa;
border: 1px dashed #e6e6e6;
}
.doodle-table tr td:first-child { .doodle-table tr td:first-child {
border-left: none; border-left: none;
border-right: none; border-right: none;
min-width: 175px;
width: 230px;
position: relative;
cursor: default;
} }
.doodle-table thead tr th { .doodle-table thead tr th {
border-top: none !important; border-top: none !important;
border-left: none; border-left: none;
border-right: none; border-right: none;
} position: relative;
.doodle-table tbody tr td:first-child {
min-width: 90px;
} }
.doodle-table tbody tr td { .doodle-table tbody tr td {
...@@ -62,12 +78,21 @@ thead tr th { ...@@ -62,12 +78,21 @@ thead tr th {
line-height: 1.2; line-height: 1.2;
text-transform: uppercase; text-transform: uppercase;
font-size: 12px; font-size: 12px;
min-height: 50px; height: 70px;
min-width: 80px; min-width: 100px;
height: 50px; max-width: 200px;
vertical-align: middle !important; vertical-align: middle !important;
} }
.doodle-table tbody tr:last-child td {
border-bottom: none;
}
.doodle-table tbody tr td .date_format{
margin-left: 18px;
}
.doodle-table tbody tr td.purple-background { .doodle-table tbody tr td.purple-background {
background-color: #e2deef; background-color: #e2deef;
transition: background-color 100ms ease; transition: background-color 100ms ease;
...@@ -78,36 +103,130 @@ thead tr th { ...@@ -78,36 +103,130 @@ thead tr th {
border-right: none; border-right: none;
} }
.doodle-table tr td:last-child {
border-right: none;
}
.doodle-table td:nth-child(-n+2):hover {
background: none !important;
}
.doodle-table td:hover { .doodle-table td:hover {
background: #8a7dbe; background: #8a7dbe;
transition: background 200ms ease; transition: background 200ms ease;
} }
.doodle-table tr:last-child td:hover, .doodle-table tr:last-child td {
background: #fafafa;
}
.doodle-table td:hover .label_input span{ .doodle-table td:hover .label_input span{
border-color: #fff; border-color: #fff;
transition: border-color 100ms ease 100ms; transition: border-color 100ms ease 100ms;
} }
.doodle-table th, td { .doodle-table th, td {
border:1px solid #f3f3f3; border:1px solid #e6e6e6;
padding: 0; padding: 0;
} }
.doodle-table td, th { .doodle-table th {
text-align:center; text-align:center;
} }
.doodle-table .delete_row {
background: #fddddd;
position: absolute;
width: 70px;
height: 71px;
left: -70px;
top: -1px;
opacity: 0;
display: none;
justify-content: center;
align-items: center;
}
.doodle-table .delete_col{
background: #fddddd;
position: absolute;
width: 100%;
top: -74px;
height: 74px;
left: 0;
opacity: 0;
display: none;
justify-content: center;
align-items: center;
}
.doodle-table .delete_row button{
width: 16px;
height: 16px;
padding: 0;
font-weight: 200;
background: #f55753;
color: #fff;
border-radius: 2px;
border: none;
cursor: pointer;
}
.doodle-table .delete_col a{
width: 21px;
height: 21px;
padding: 0;
font-weight: 200;
background: #f55753;
color: #fff;
border-radius: 2px;
border: none;
text-decoration: none;
align-self: center;
}
.doodle-table .delete_row button:focus{
outline: none;
}
.doodle-table #date:hover {
background: #fdf2f2 !important;
color: #f55753;
transition: all .250s ease;
}
.doodle-table #heure:hover {
background: #fdf2f2 !important;
color: #f55753;
transition: all .500s ease;
}
/******************************************************* /*******************************************************
*************************INPUT************************* *************************INPUT*************************
*******************************************************/ *******************************************************/
#myDatepicker{
width: 80%;
margin-left: 18px;
}
#myDatepicker label, .timepicker label {
font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
text-transform: uppercase;
color: #2c2c2c !important;
font-size: 10px;
position: absolute;
z-index: 4;
margin-left: 0.75rem;
margin-top: 0.3rem;
font-weight: 400;
}
::-webkit-input-placeholder {
color: #bababa !important;
font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
font-size: 14px;
opacity: 1; /* Firefox */
vertical-align: bottom;
}
label.label_input{ label.label_input{
cursor: pointer; cursor: pointer;
position: relative; position: relative;
...@@ -118,6 +237,19 @@ label.label_input{ ...@@ -118,6 +237,19 @@ label.label_input{
margin-bottom: 0; margin-bottom: 0;
} }
.form-control {
border: 1px solid #f0f0f0;
border-radius: 2px;
padding: 1.15rem 0.75rem 0.25rem 0.75rem;
}
.input-group-addon {
background: #f0f0f0;
border: 1px solid #dfdfdf !important;
color: #adadad;
border-radius: 2px;
}
.label_input input { .label_input input {
display: none; display: none;
} }
...@@ -182,8 +314,9 @@ label.label_input{ ...@@ -182,8 +314,9 @@ label.label_input{
***********************END INPUT*********************** ***********************END INPUT***********************
*******************************************************/ *******************************************************/
/*
@media screen and (min-width: 768px){ @media screen and (min-width: 768px){
.doodle-table{ .doodle-table{
table-layout: fixed; table-layout: fixed;
} }
} }*/
\ No newline at end of file
...@@ -319,10 +319,13 @@ ...@@ -319,10 +319,13 @@
this.reinit = () => { this.reinit = () => {
this.createJSON(); this.createJSON();
$('.doodle').html(''); $('.doodle').html('');
/*$(document).off('click', 'input[type=checkbox]'); $(document).off('click', 'input[type=checkbox]');
$(document).off('click', 'td button');*/ $(document).off('click', 'td button');
$(document).off('changeDate', '#addDate'); $(document).off('changeDate', '#addDate');
$(document).off('hide.timepicker', '#timepicker'); $(document).off('hide.timepicker', '#timepicker');
$(document).off('mouseenter mouseleave', '#date');
$(document).off('mouseenter mouseleave', '#heure');
this.initLoad(); this.initLoad();
}; };
...@@ -351,9 +354,56 @@ ...@@ -351,9 +354,56 @@
$(document).on('click', 'input[type=checkbox]', this.eventCheckInput); $(document).on('click', 'input[type=checkbox]', this.eventCheckInput);
$(document).on('click', 'td button', this.eventRemoveDate); $(document).on('click', 'td button', this.eventRemoveDate);
$(document).on('click', 'th button', this.eventRemoveHour); $(document).on('click', 'th a', this.eventRemoveHour);
$(document).on('changeDate', '#myDatepicker', this.eventAddDate); $(document).on('changeDate', '#myDatepicker', this.eventAddDate);
$(document).on('hide.timepicker', '#timepicker',this.eventAddHour); $(document).on('hide.timepicker', '#timepicker',this.eventAddHour);
$(document).on('mouseenter mouseleave', '#date', function (e) {
if (e.type === 'mouseenter') {
$(e.target).find('div').css('display', 'flex');
$(e.target).find('div').animate({
opacity : 1,
display: 'flex'
}, 250, 'linear');
} else {
if ($(e.target).is('div.delete_row') ) {
$(e.target).css('display', 'none');
$(e.target).animate({
opacity : 0,
display: 'none'
}, 200);
} else {
$(e.target).find('div').css('display', 'none');
$(e.target).find('div').animate({
opacity : 0,
display: 'none'
}, 200);
}
}
});
$(document).on('mouseenter mouseleave', '#heure', function (e) {
if (e.type === 'mouseenter') {
$(e.target).find('div').css('display', 'flex');
$(e.target).find('div').animate({
opacity : 1,
display: 'flex'
}, 250, 'linear');
} else {
if ($(e.target).is('div.delete_col') ) {
$(e.target).css('display', 'none');
$(e.target).animate({
opacity : 0,
display: 'none'
}, 200);
} else {
$(e.target).find('div').css('display', 'none');
$(e.target).find('div').animate({
opacity : 0,
display: 'none'
}, 200);
}
}
});
}; };
/** /**
...@@ -361,7 +411,7 @@ ...@@ -361,7 +411,7 @@
*/ */
this.createTable = () => { this.createTable = () => {
this.item.append(` this.item.append(`
<table class="table doodle-table"> <table class="table doodle-table backend">
<thead> <thead>
${this.createHeaderTable()} ${this.createHeaderTable()}
</thead> </thead>
...@@ -371,6 +421,8 @@ ...@@ -371,6 +421,8 @@
</tbody> </tbody>
</table> </table>
`); `);
this.generateEmptyCell();
}; };
this.initCSS = () => { this.initCSS = () => {
...@@ -385,30 +437,48 @@ ...@@ -385,30 +437,48 @@
let $tbody = $('<tbody>'); let $tbody = $('<tbody>');
let html, tbodyFinal; let html, tbodyFinal;
for(let index in this.days) { if (!$.isEmptyObject(this.outputJson)) {
let $tr = $('<tr>'); for(let index in this.days) {
let $tr = $('<tr>');
let formatDateDay = moment(this.days[index], 'DD/MM/YYYY').locale('fr').format('dddd'); let formatDateDay = moment(this.days[index], 'DD/MM/YYYY').locale('fr').format('dddd DD');
let formatDateMonth = moment(this.days[index], 'DD/MM/YYYY').locale('fr').format('DD MMMM'); let formatDateMonth = moment(this.days[index], 'DD/MM/YYYY').locale('fr').format('MMMM');
let formatDate = moment(this.days[index], 'DD/MM/YYYY').format('DDMMYYYY'); let formatDate = moment(this.days[index], 'DD/MM/YYYY').format('DDMMYYYY');
html = $tr.append('<td id="date"><span class="date_format"><b>' + formatDateDay + '</b> ' + formatDateMonth + '</span><div class="delete_row"><button>x</button></div></td>')
.append(this.createBodyContent(formatDate))
.append('<td></td>');
html = $tr .append('<td><button>X</button></td>')
.append('<td><span>' + formatDateDay + ' ' + formatDateMonth + '</span></td>')
.append(this.createBodyContent(formatDate));
tbodyFinal = $tbody.append(html);
}
tbodyFinal = $tbody.append(html); tbodyFinal.append(`<td><div id="myDatepicker" class="input-group date" data-provide="datepicker">
<label>Date</label>
<input type="text" id="addDate" class="form-control" placeholder="jj / mm / aaaa">
<span class="input-group-addon">
<i class="fa fa-calendar"></i>
</span>
</div>
</td> `);
} }
else {
let $tr = $('<tr>');
tbodyFinal.append(`<th><div id="myDatepicker" class="input-group date" data-provide="datepicker"> html = $tr.append(`<td><div id="myDatepicker" class="input-group date" data-provide="datepicker">
<input type="text" id="addDate" class="form-control" placeholder="jj/mm/aaaa"> <label>Date</label>
<input type="text" id="addDate" class="form-control" placeholder="jj / mm / aaaa">
<span class="input-group-addon"> <span class="input-group-addon">
<i class="fa fa-calendar"></i> <i class="fa fa-calendar"></i>
</span> </span>
</div> </div>
</th> `); </td> `);
tbodyFinal = $tbody.append(html);
}
return tbodyFinal.html(); return tbodyFinal.html();
}; };
...@@ -461,7 +531,7 @@ ...@@ -461,7 +531,7 @@
let finalSortedTab = []; let finalSortedTab = [];
// Nombre de cases vide // Nombre de cases vide
let nbrCaseVide = 2; let nbrCaseVide = 1;
//Ajoute les cases vide //Ajoute les cases vide
for (let i = 0; i < nbrCaseVide; i++) { for (let i = 0; i < nbrCaseVide; i++) {
...@@ -481,10 +551,11 @@ ...@@ -481,10 +551,11 @@
//Ajoute les heures //Ajoute les heures
for(let index in finalSortedTab) { for(let index in finalSortedTab) {
thead = $tr.append('<th><button>X</button><span>' + finalSortedTab[index] + '</span></th>'); thead = $tr.append('<th id="heure"><span>' + finalSortedTab[index] + '</span><div class="delete_col"><a href="#">x</a></div></th>');
} }
thead = $tr.append(`<th><div class="input-group bootstrap-timepicker timepicker"> thead = $tr.append(`<th><div class="input-group bootstrap-timepicker timepicker">
<label>Horaire</label>
<input id="timepicker" type="text" class="form-control" data-provide="timepicker"> <input id="timepicker" type="text" class="form-control" data-provide="timepicker">
<span class="input-group-addon"> <span class="input-group-addon">
<i class="fa fa-clock-o"></i> <i class="fa fa-clock-o"></i>
...@@ -495,6 +566,19 @@ ...@@ -495,6 +566,19 @@
}; };
/** /**
* Generate empty cell
*/
this.generateEmptyCell = () => {
let colLength = $('table thead th#heure').length + 1;
let lastTR = $('.doodle-table tbody tr:last-child');
for (let i = 0; i < colLength; i++) {
$(lastTR).append('<td></td>')
}
};
/**
* Get Days * Get Days
*/ */
this.getDays = () => { this.getDays = () => {
...@@ -640,6 +724,7 @@ ...@@ -640,6 +724,7 @@
* @param e * @param e
*/ */
this.eventAddDate = (e) => { this.eventAddDate = (e) => {
e.stopImmediatePropagation();
//Force la fermeture du datePicker //Force la fermeture du datePicker
$('#myDatepicker').datepicker('hide'); $('#myDatepicker').datepicker('hide');
...@@ -664,6 +749,8 @@ ...@@ -664,6 +749,8 @@
* @param e * @param e
*/ */
this.eventAddHour = (e) => { this.eventAddHour = (e) => {
e.stopImmediatePropagation();
let splitHour = e.time.value.split(':'); let splitHour = e.time.value.split(':');
//Permet de mettre dans le bon format DD:mm, le timePicker retourne mauvais format //Permet de mettre dans le bon format DD:mm, le timePicker retourne mauvais format
...@@ -695,6 +782,8 @@ ...@@ -695,6 +782,8 @@
* @param e * @param e
*/ */
this.eventRemoveDate = (e) => { this.eventRemoveDate = (e) => {
e.stopImmediatePropagation();
let date = $(e.target).parent().parent().find('span').text(); let date = $(e.target).parent().parent().find('span').text();
let formatDateDay = moment(date, 'dddd DD MMMM').locale('fr').format('DDMMYYYY'); let formatDateDay = moment(date, 'dddd DD MMMM').locale('fr').format('DDMMYYYY');
...@@ -715,7 +804,10 @@ ...@@ -715,7 +804,10 @@
* @param e * @param e
*/ */
this.eventRemoveHour = (e) => { this.eventRemoveHour = (e) => {
let hour = $(e.target).parent().find('span').first().text(); e.stopImmediatePropagation();
e.preventDefault();
let hour = $(e.target).parent().parent().find('span').first().text();
hour = hour.replace('h', ':'); hour = hour.replace('h', ':');
if(hour.length < 5){ if(hour.length < 5){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment