Commit 1f71ca6a authored by Denis S. Valdenaire's avatar Denis S. Valdenaire

dinner time

parent 1f325555
......@@ -19,8 +19,8 @@ class Game {
// SQL SELECT games prets
$sql = "SELECT games.id, name, reference, maker, category, esar_category_id,
comments, maker_info, content_inventory, DATE_FORMAT(aquisition_date, '%m/%d/%Y') as aquisition_date,
prix, players_min, players_max,
age_min, age_max, type, loans.id_pret
price, players_min, players_max,
age_min, age_max, game_type, loans.id as loan_id
FROM games
LEFT OUTER JOIN loans ON (games.id = loans.id AND loans.is_back = 0)
WHERE games.id = ".$id;
......@@ -92,13 +92,13 @@ class Game {
public static function fetch_all(&$games) {
$games = array();
$sql = "SELECT games.id, nom,
CONCAT (esar_categories.label, ' - ', esar_categories.name) AS label,
loans.id as loan_status
FROM games
LEFT OUTER JOIN esar_categories ON games.esar_category_id = esar_categories.id
LEFT OUTER JOIN loans ON (games.id = loans.id AND end_date > curdate())
ORDER BY name";
$sql = "SELECT g.id, g.name,
CONCAT (ec.label, ' - ', ec.name) AS label,
l.id as loan_status
FROM games g
LEFT OUTER JOIN esar_categories ec ON g.esar_category_id = ec.id
LEFT OUTER JOIN loans l ON (g.id = l.id AND end_date > curdate())
ORDER BY g.name";
$GLOBALS["data"]->select($sql, $games, "Game");
return sizeof($games);
}
......
......@@ -15,19 +15,30 @@ class Loan {
}
public static function fetch_all(&$loans, $member_id) {
$subscriptions = array();
$loans = array();
// SQL SELECT loans games
$sql = " SELECT l.id, start_date, end_date, is_back, l.created_at, l.updated_at,
g.name as game_name
FROM loans l, games g
WHERE member_id = ".$member_id."
AND g.id = l.id
AND g.id = l.game_id
ORDER BY is_back ASC, start_date DESC
";
$GLOBALS["data"]->select($sql, $loans, "Loan", true);
return sizeof($loans);
}
public static function fetch($id) {
// SQL SELECT loans
$sql = " SELECT l.id, start_date, end_date, is_back, l.created_at, l.updated_at, member_id,
g.name as game_name
FROM loans l, games g
WHERE l.id = $id
AND g.id = l.game_id";
$GLOBALS["data"]->select($sql, $loan, "Loan");
return $loan;
}
public static function delete($id) {
// SQL SELECT loans
$sql = " SELECT id
......@@ -73,7 +84,7 @@ class Loan {
foreach(get_object_vars($this) as $var => $value) {
// check if there is a corresponding value in _REQUEST
// and the value has really changed
if(array_key_exists($var, $_REQUEST)) {
if(!is_array($this->$var) && array_key_exists($var, $_REQUEST)) {
if($var == "start_date" || $var == "end_date") {
$_REQUEST[$var] = date_format(date_create_from_format('d-m-Y', $_REQUEST[$var]),'m/d/Y');
}
......
......@@ -63,7 +63,7 @@ class Member {
foreach(get_object_vars($this) as $var => $value) {
// check if there is a corresponding value in _REQUEST
// and the value has really changed
if(array_key_exists($var, $_REQUEST)) {
if(!is_array($this->$var) && array_key_exists($var, $_REQUEST)) {
if($var == "birth_date" || $var == "date_inscription") {
$_REQUEST[$var] = date_format(date_create_from_format('d-m-Y', $_REQUEST[$var]),'m/d/Y');
}
......
......@@ -75,7 +75,7 @@ switch($_REQUEST["a"]) {
case "create_loan":
try {
$member = Member::fetch($data->db_escape_string($_REQUEST["i"]));
$member = Member::fetch($data->db_escape_string($_REQUEST["member_id"]));
if($member->id != 0) {
$member->create_loan();
$member->fetch_loans();
......
/* ========================================================================
* bootstrap-switch - v3.3.2
* http://www.bootstrap-switch.org
* ========================================================================
* Copyright 2012-2013 Mattia Larentis
*
* ========================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================================
*/
.bootstrap-switch{display:inline-block;direction:ltr;cursor:pointer;border-radius:4px;border:1px solid #ccc;position:relative;text-align:left;overflow:hidden;line-height:8px;z-index:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.bootstrap-switch .bootstrap-switch-container{display:inline-block;top:0;border-radius:4px;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.bootstrap-switch .bootstrap-switch-handle-off,.bootstrap-switch .bootstrap-switch-handle-on,.bootstrap-switch .bootstrap-switch-label{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;display:inline-block!important;height:100%;padding:6px 12px;font-size:14px;line-height:20px}.bootstrap-switch .bootstrap-switch-handle-off,.bootstrap-switch .bootstrap-switch-handle-on{text-align:center;z-index:1}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary{color:#fff;background:#337ab7}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info{color:#fff;background:#5bc0de}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success{color:#fff;background:#5cb85c}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning{background:#f0ad4e;color:#fff}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger{color:#fff;background:#d9534f}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default{color:#000;background:#eee}.bootstrap-switch .bootstrap-switch-label{text-align:center;margin-top:-1px;margin-bottom:-1px;z-index:100;color:#333;background:#fff}.bootstrap-switch .bootstrap-switch-handle-on{border-bottom-left-radius:3px;border-top-left-radius:3px}.bootstrap-switch .bootstrap-switch-handle-off{border-bottom-right-radius:3px;border-top-right-radius:3px}.bootstrap-switch input[type=radio],.bootstrap-switch input[type=checkbox]{position:absolute!important;top:0;left:0;margin:0;z-index:-1;opacity:0;filter:alpha(opacity=0)}.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-label{padding:1px 5px;font-size:12px;line-height:1.5}.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-label{padding:5px 10px;font-size:12px;line-height:1.5}.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-label{padding:6px 16px;font-size:18px;line-height:1.3333333}.bootstrap-switch.bootstrap-switch-disabled,.bootstrap-switch.bootstrap-switch-indeterminate,.bootstrap-switch.bootstrap-switch-readonly{cursor:default!important}.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label{opacity:.5;filter:alpha(opacity=50);cursor:default!important}.bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container{-webkit-transition:margin-left .5s;-o-transition:margin-left .5s;transition:margin-left .5s}.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on{border-radius:0 3px 3px 0}.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off{border-radius:3px 0 0 3px}.bootstrap-switch.bootstrap-switch-focused{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label{border-bottom-right-radius:3px;border-top-right-radius:3px}.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label{border-bottom-left-radius:3px;border-top-left-radius:3px}
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
<link rel="stylesheet" href="css/zabuto_calendar.min.css">
<link rel="stylesheet" href="css/jquery.dataTables.min.css">
<link rel="stylesheet" href="css/bootstrap-datetimepicker.css">
<link rel="stylesheet" href="css/bootstrap-switch.min.css">
<!-- link rel="stylesheet" href="css/datatables.min.css" -->
<link rel="stylesheet" href="css/styles.css">
<script src="js/jquery-2.1.4.min.js"></script>
</head>
<body>
</body>
<input type="checkbox" checked>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap-switch.min.js"></script>
<script>
$("input[type=\"checkbox\"], input[type=\"radio\"]").not("[data-switch-no-init]").bootstrapSwitch();
</script>
</html>
......@@ -35,9 +35,10 @@ $data = new data();
<link rel="stylesheet" href="css/zabuto_calendar.min.css">
<link rel="stylesheet" href="css/jquery.dataTables.min.css">
<link rel="stylesheet" href="css/bootstrap-datetimepicker.css">
<link rel="stylesheet" href="css/bootstrap-switch.min.css">
<!-- link rel="stylesheet" href="css/datatables.min.css" -->
<link rel="stylesheet" href="css/styles.css">
<script src="js/jquery-1.11.3.min.js"></script>
<script src="js/jquery-2.1.4.min.js"></script>
</head>
<body>
<nav class="navbar navbar-default">
......@@ -81,17 +82,16 @@ $data = new data();
</div>
</div>
</nav>
<?php
// compute date
include("helpers/date.php");
?>
<form action="index.php" method="POST" id="defaultform" name="defaultform"
class="form-horizontal" enctype="multipart/form-data">
<!-- div class="col-sm-9 col-md-10 main" -->
<div class="container">
<?php
$_REQUEST["a"] = (array_key_exists("a", $_REQUEST)) ? $_REQUEST["a"] : "";
$_REQUEST["i"] = (array_key_exists("i", $_REQUEST)) ? $_REQUEST["i"] : "";
if(array_key_exists("o", $_REQUEST) && $_REQUEST["o"] != ""
&& file_exists("controllers/".$_REQUEST["o"].".php")) {
include("controllers/".$_REQUEST["o"].".php");
} else {
$_REQUEST["o"] = "home";
......@@ -100,8 +100,8 @@ if(array_key_exists("o", $_REQUEST) && $_REQUEST["o"] != ""
?>
</div>
<input type="hidden" name="o" id="o" value="<?=$_REQUEST["o"]?>">
<input type="hidden" name="a" id="a" value="<?=(array_key_exists("a", $_REQUEST)) ? $_REQUEST["a"] : ""?>">
<input type="hidden" name="i" id="i" value="<?=(array_key_exists("i", $_REQUEST)) ? $_REQUEST["i"] : ""?>">
<input type="hidden" name="a" id="a" value="<?=$_REQUEST["a"]?>">
<input type="hidden" name="i" id="i" value="<?=$_REQUEST["i"]?>">
</form>
<footer>
<?php if($debug) { ?>
......@@ -121,6 +121,7 @@ SESSION :
<script src="js/typeahead.bundle.min.js"></script>
<script src="js/moment-with-locales.min.js"></script>
<script src="js/bootstrap-datetimepicker.js"></script>
<script src="js/bootstrap-switch.min.js"></script>
<script src="js/functions.js"></script>
<script type="application/javascript">
$(document).ready(function () {
......@@ -132,7 +133,7 @@ $(document).ready(function () {
});
var games = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('nom'),
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: { url : 'api.php?o=games&a=name_list',
cache: false }
......@@ -150,7 +151,7 @@ $(document).ready(function () {
}
});
$('#search-games .typeahead').typeahead({
$('#search-games-for-loans .typeahead').typeahead({
highlight: true
},
{
......@@ -159,7 +160,7 @@ $(document).ready(function () {
source: games
}).bind('typeahead:selected', function(obj, datum, name) {
if(typeof datum.id !== 'undefined') {
$('#id').val(datum.id);
$('#game_id').val(datum.id);
}
});
......@@ -193,7 +194,11 @@ $(document).ready(function () {
window.location.href = "index.php?o=games&a=edit&i=" + datum.id;
}
});
// every check box on site turned into a switch except with data-switch-with-ajax flag
$("input[type=\"checkbox\"]").not("[data-switch-with-ajax]").bootstrapSwitch({
onText: "Oui",
offText: "Non"
});
});
/*
TODO : Display calendar events via ajax
......
This diff is collapsed.
......@@ -24,7 +24,7 @@ function completeFamilyHandler (response) { // response is an array of family_me
$.each(response, function(key, val){
html = html + '<div id="fm_' + val.id + '" class="thumbnail col-sm-2" style="text-align: center">'
+ '<strong>' + val.lastname + '</strong><br>' + val.firstname + '<br>'
+ val.birthdate
+ val.birth_date
+ '<div class="caption">' + val.link_name
+ ' <a href="javascript:deleteFamilyMember(' + val.id + ')" class="glyphicon glyphicon-remove"></a></div></div>';
});
......
This diff is collapsed.
......@@ -38,9 +38,9 @@ This file is part of phpLudoreve.
<div class="panel-body">
<div class="form-group">
<label class="control-label col-sm-2" for="lastname">Nom</label>
<label class="control-label col-sm-2" for="name">Nom</label>
<div class="col-sm-10">
<input type="text" id="lastname" name="lastname" class="form-control" value="<?=$game->nom?>"/>
<input type="text" id="name" name="name" class="form-control" value="<?=$game->name?>"/>
</div>
</div>
<div class="form-group">
......@@ -93,32 +93,32 @@ This file is part of phpLudoreve.
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2 col-xs-7" for="nombre_mini">Nombre de joueurs de </label>
<label class="control-label col-sm-2 col-xs-7" for="players_min">Nombre de joueurs de </label>
<div class="col-sm-1 col-xs-1">
<input type="text" id="nombre_mini" name="nombre_mini" class="form-control" value="<?=$game->nombre_mini?>"/>
<input type="text" id="players_min" name="players_min" class="form-control" value="<?=$game->players_min?>"/>
</div>
<label class="control-label col-sm-1 col-xs-1" for="nombre_maxi">à</label>
<label class="control-label col-sm-1 col-xs-1" for="players_max">à</label>
<div class="col-sm-1 col-xs-1">
<input type="text" id="nombre_maxi" name="nombre_maxi" class="form-control" value="<?=$game->nombre_maxi?>"/>
<input type="text" id="players_max" name="players_max" class="form-control" value="<?=$game->players_max?>"/>
</div>
<label class="control-label col-sm-3 col-xs-7" for="age_mini">Age des joueurs de </label>
<label class="control-label col-sm-3 col-xs-7" for="age_min">Age des joueurs de </label>
<div class="col-sm-1 col-xs-1">
<input type="text" id="age_mini" name="age_mini" class="form-control" value="<?=$game->age_mini?>"/>
<input type="text" id="age_min" name="age_min" class="form-control" value="<?=$game->age_min?>"/>
</div>
<label class="control-label col-sm-1 col-xs-1" for="age_maxi">à</label>
<label class="control-label col-sm-1 col-xs-1" for="age_max">à</label>
<div class="col-sm-2 col-xs-1">
<input type="text" id="age_maxi" name="age_maxi" class="form-control" value="<?=$game->age_maxi?>"/>
<input type="text" id="age_max" name="age_max" class="form-control" value="<?=$game->age_max?>"/>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="type">Type de jeu</label>
<label class="control-label col-sm-2" for="game_type">Type de jeu</label>
<div class="col-sm-4">
<input type="text" id="type" name="type" class="form-control" value="<?=$game->type?>"/>
<input type="text" id="game_type" name="game_type" class="form-control" value="<?=$game->game_type?>"/>
</div>
<label class="control-label col-sm-2" for="date_achat">Date d'achat</label>
<label class="control-label col-sm-2" for="aquisition_date">Date d'achat</label>
<div class="col-sm-4">
<div class='input-group date' id='datetimepicker1'>
<input type="text" id="date_achat" name="date_achat" class="form-control"/>
<input type="text" id="aquisition_date" name="aquisition_date" class="form-control"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
......@@ -128,11 +128,11 @@ This file is part of phpLudoreve.
$('#datetimepicker1').datetimepicker({
locale: 'fr',
format: 'DD-MM-YYYY',
defaultDate: new Date(<?=($game->date_achat != ""
? "'".$game->date_achat."'" : "")?>)
defaultDate: new Date(<?=($game->aquisition_date != ""
? "'".$game->aquisition_date."'" : "")?>)
})
.on('changeDate', function(ev){
$('#date_achat') = ev.format();
$('#aquisition_date') = ev.format();
});
});
</script>
......@@ -165,15 +165,15 @@ This file is part of phpLudoreve.
<?php } ?>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="inventaire">Inventaire</label>
<label class="control-label col-sm-2" for="content_inventory">Inventaire</label>
<div class="col-sm-10">
<textarea id="inventaire" name="inventaire" class="form-control" rows="4"><?=$game->inventaire?></textarea>
<textarea id="content_inventory" name="content_inventory" class="form-control" rows="4"><?=$game->content_inventory?></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="commentaire">Commentaire</label>
<label class="control-label col-sm-2" for="comments">Commentaire</label>
<div class="col-sm-10">
<textarea id="commentaire" name="commentaire" class="form-control" rows="4"><?=$game->commentaire?></textarea>
<textarea id="comments" name="comments" class="form-control" rows="4"><?=$game->comments?></textarea>
</div>
</div>
......
......@@ -2,7 +2,7 @@
<div class="panel-heading">
<h4><!-- class="panel-title" -->
<span class="glyphicon glyphicon-th-list" style="margin-right: 10px" ></span>
<?=($loan->id != 0) ? $loan->member_name." - Emprunt du ".$loan->start_date : "Nouvel emprunt"?>
<?=($loan->id != 0) ? $loan->game_name." - Emprunt du ".$loan->start_date : "Nouvel emprunt"?>
</h4>
</div>
<div class="panel-body">
......@@ -55,18 +55,25 @@
</div>
</div>
<div class="form-group">
<?php if($loan->id == 0) { ?>
<label class="control-label col-sm-2" for="game_id">Jeu</label>
<div class="col-sm-4">
<input type="hidden" name="game_id" id="game_id" value="">
<div id="search-games" >
<div id="search-games-for-loans" >
<input class="typeahead form-control" type="text" placeholder="Jeu...">
</div>
</div>
<?php } else { ?>
<!-- FIXME : this field may be a little bit useless when creating a new loan -->
<label class="control-label col-sm-2" for="is_back">Rendu ?</label>
<div class="col-sm-1">
<div class="col-sm-4">
<input type="checkbox" id="is_back" name="is_back" class="form-control"
<?=($loan->is_back ? "checked" : "")?>/>
</div>
<?php } ?>
<div class="control-label col-sm-6">
Créé le : <?=$loan->created_at?> / Mis-à-jour le <?=$loan->updated_at?>
</div>
</div>
<input type="hidden" name="member_id" id="member_id" value="<?=$loan->member_id?>">
<div class="form-group">
......
......@@ -37,10 +37,10 @@ This file is part of phpLudoreve.
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="birthdate">Date de naissance</label>
<label class="control-label col-sm-2" for="birth_date">Date de naissance</label>
<div class="col-sm-4">
<div class='input-group date' id='birth_datetimepicker'>
<input type="text" id="birthdate" name="birthdate" class="form-control"/>
<input type="text" id="birth_date" name="birth_date" class="form-control"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
......@@ -50,11 +50,11 @@ This file is part of phpLudoreve.
$('#birth_datetimepicker').datetimepicker({
locale: 'fr',
format: 'DD-MM-YYYY',
defaultDate: new Date(<?=($member->birthdate != ""
? "'".$member->birthdate."'" : "")?>)
defaultDate: new Date(<?=($member->birth_date != ""
? "'".$member->birth_date."'" : "")?>)
})
.on('changeDate', function(ev){
$('#birthdate') = ev.format();
$('#birth_date') = ev.format();
});
});
</script>
......@@ -67,7 +67,7 @@ This file is part of phpLudoreve.
<div class="form-group">
<label class="control-label col-sm-2" for="address">Adresse</label>
<div class="col-sm-4">
<textarea id="address" name="address" class="form-control" rows="2"><?=$member->adresse?></textarea>
<textarea id="address" name="address" class="form-control" rows="2"><?=$member->address?></textarea>
</div>
<label class="control-label col-sm-2" for="po_town">Code postal - Ville</label>
<div class="col-sm-4">
......@@ -137,7 +137,7 @@ This file is part of phpLudoreve.
<div class="form-group">
<label class="control-label col-sm-2" for="subscribe_date">Date d'inscription</label>
<div class="col-sm-4">
<div class='input-group date' id='inscription_datetimepicker'>
<div class='input-group date' id='subscribe_datetimepicker'>
<input type="text" id="subscribe_date" name="subscribe_date" class="form-control"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
......@@ -145,10 +145,10 @@ This file is part of phpLudoreve.
</div>
<script type="text/javascript">
$(function () {
$('#inscription_datetimepicker').datetimepicker({
$('#subscribe_datetimepicker').datetimepicker({
locale: 'fr',
format: 'DD-MM-YYYY',
defaultDate: new Date(<?=($member->subscribe_date != ""
defaultDate: new Date(<?=($member->subscribe_date != "" && $member->subscribe_date != "0000-00-00"
? "'".$member->subscribe_date."'" : "")?>)
})
.on('changeDate', function(ev){
......@@ -181,16 +181,16 @@ This file is part of phpLudoreve.
<div class="form-group">
<label class="control-label col-sm-1 col-sm-offset-2" for="fm_lastname">Nom</label>
<div class="col-sm-2">
<input type="text" id="fm_lastname" name="fm_lastname" class="form-control" value="<?=$member->nom?>"/>
<input type="text" id="fm_lastname" name="fm_lastname" class="form-control" value="<?=$member->lastname?>"/>
</div>
<label class="control-label col-sm-1" for="fm_firstname">Prénom</label>
<div class="col-sm-2">
<input type="text" id="fm_firstname" name="fm_firstname" class="form-control" value=""/>
</div>
<label class="control-label col-sm-1" for="fm_birthdate">DDN</label>
<label class="control-label col-sm-1" for="fm_birth_date">DDN</label>
<div class="col-sm-2">
<div class='input-group date' id='fm_birth_datetimepicker'>
<input type="text" id="fm_birthdate" name="fm_birthdate" class="form-control"/>
<input type="text" id="fm_birth_date" name="fm_birth_date" class="form-control"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
......@@ -203,7 +203,7 @@ This file is part of phpLudoreve.
defaultDate: new Date()
})
.on('changeDate', function(ev){
$('#fm_birthdate') = ev.format();
$('#fm_birth_date') = ev.format();
});
});
</script>
......
......@@ -27,9 +27,11 @@
<td><?=$val->game_name?></td>
<td><?=$val->start_date?></td>
<td><?=$val->end_date?></td>
<td><?=$val->is_back?></td>
<td><input type="checkbox" id="is_back_<?=$val->id?>" name="is_back_<?=$val->id?>" class="form-control is_back_cbx"
data-switch-with-ajax <?=($val->is_back != "") ? "checked" : ""?></td>
<td>
<a href="index.php?o=loans&a=edit&i=<?=$val->idt?>">
<a href="index.php?o=loans&a=edit&i=<?=$val->id?>">
<button type="button" class="btn btn-default btn-sm">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>
</a>
......@@ -56,9 +58,19 @@
</div>
<script>
$('#back_button').click(function(){
// TODO this function should verify that the object has not been modified
// and if yes, ask for confirmation from the user.
window.location.href='index.php?o=members&a=edit&i=<?=$member->id?>';
$(document).ready(function () {
$('#back_button').click(function(){
// TODO this function should verify that the object has not been modified
// and if yes, ask for confirmation from the user.
window.location.href='index.php?o=members&a=edit&i=<?=$member->id?>';
});
$('.is_back_cbx').bootstrapSwitch({
onText: "Oui",
offText: "Non",
}).on('switchChange.bootstrapSwitch', function(event, state) {
console.log(this); // DOM element
console.log(event); // jQuery event
console.log(state); // true | false
});
});
</script>
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