| Current Path : /home/happyrenas/old/happy-r.fr/transfere_pro/administration/templates/admin2/ |
Linux webd005.cluster105.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 |
| Current File : /home/happyrenas/old/happy-r.fr/transfere_pro/administration/templates/admin2/promotion.php |
<?
session_start();
include("config.php");
$page="promotion";
?>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="fr" class="no-js">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8"/>
<title>HAPPY RENTALS ADMINISTRATION</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta content="" name="description"/>
<meta content="" name="author"/>
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css">
<link href="../../assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="../../assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css">
<link href="../../assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="../../assets/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css">
<link href="../../assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css"/>
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN PAGE LEVEL STYLES -->
<link rel="stylesheet" type="text/css" href="../../assets/global/plugins/jquery-notific8/jquery.notific8.min.css"/>
<link rel="stylesheet" type="text/css" href="../../assets/global/plugins/clockface/css/clockface.css"/>
<link rel="stylesheet" type="text/css" href="../../assets/global/plugins/bootstrap-datepicker/css/datepicker3.css"/>
<link rel="stylesheet" type="text/css" href="../../assets/global/plugins/bootstrap-timepicker/css/bootstrap-timepicker.min.css"/>
<link rel="stylesheet" type="text/css" href="../../assets/global/plugins/bootstrap-colorpicker/css/colorpicker.css"/>
<link rel="stylesheet" type="text/css" href="../../assets/global/plugins/bootstrap-daterangepicker/daterangepicker-bs3.css"/>
<link rel="stylesheet" type="text/css" href="../../assets/global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css"/>
<link rel="stylesheet" type="text/css" href="../../assets/global/plugins/bootstrap-fileinput/bootstrap-fileinput.css"/>
<link rel="stylesheet" type="text/css" href="../../assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css"/>
<link rel="stylesheet" type="text/css" href="../../assets/global/plugins/jquery-tags-input/jquery.tagsinput.css"/>
<link rel="stylesheet" type="text/css" href="../../assets/global/plugins/bootstrap-markdown/css/bootstrap-markdown.min.css">
<link rel="stylesheet" type="text/css" href="../../assets/global/plugins/typeahead/typeahead.css">
<!-- END PAGE LEVEL STYLES -->
<!-- BEGIN THEME STYLES -->
<link href="../../assets/global/css/components.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/css/plugins.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/admin/layout2/css/layout.css" rel="stylesheet" type="text/css"/>
<link id="style_color" href="../../assets/admin/layout2/css/themes/default.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/admin/layout2/css/custom.css" rel="stylesheet" type="text/css"/>
<!-- END THEME STYLES -->
<link rel="shortcut icon" href="favicon.ico"/>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<!-- DOC: Apply "page-header-fixed-mobile" and "page-footer-fixed-mobile" class to body element to force fixed header or footer in mobile devices -->
<!-- DOC: Apply "page-sidebar-closed" class to the body and "page-sidebar-menu-closed" class to the sidebar menu element to hide the sidebar by default -->
<!-- DOC: Apply "page-sidebar-hide" class to the body to make the sidebar completely hidden on toggle -->
<!-- DOC: Apply "page-sidebar-closed-hide-logo" class to the body element to make the logo hidden on sidebar toggle -->
<!-- DOC: Apply "page-sidebar-hide" class to body element to completely hide the sidebar on sidebar toggle -->
<!-- DOC: Apply "page-sidebar-fixed" class to have fixed sidebar -->
<!-- DOC: Apply "page-footer-fixed" class to the body element to have fixed footer -->
<!-- DOC: Apply "page-sidebar-reversed" class to put the sidebar on the right side -->
<!-- DOC: Apply "page-full-width" class to the body element to have full width page without the sidebar menu -->
<body class="page-boxed page-header-fixed page-sidebar-closed-hide-logo page-container-bg-solid page-sidebar-closed-hide-logo">
<!-- BEGIN HEADER -->
<?include("header_top.php");?>
<!-- END HEADER -->
<div class="clearfix">
</div>
<!-- BEGIN CONTAINER -->
<div class="container">
<div class="page-container">
<!-- BEGIN SIDEBAR -->
<div class="page-sidebar-wrapper">
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Change data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<div class="page-sidebar navbar-collapse collapse">
<?include("header_left.php");?>
</div>
</div>
<!-- END SIDEBAR -->
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<div class="page-content">
<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
<div class="modal fade" id="portlet-config" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
<!-- BEGIN STYLE CUSTOMIZER -->
<!-- END STYLE CUSTOMIZER -->
<!-- BEGIN PAGE HEADER-->
<h3 class="page-title">
Gestion des promotions <small>Promotions</small>
</h3>
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<i class="fa fa-home"></i>
<a href="index.php">Accueil</a>
<i class="fa fa-angle-right"></i>
</li>
<li>
<a href="#">Ajouter une Promotion</a>
</li>
</ul>
</div>
<!-- END PAGE HEADER-->
<!-- BEGIN PAGE CONTENT-->
<!--PHILIPPE-->
<?
/*
http://www.vijayjoshi.org/2011/09/07/php-get-intersecting-dates-between-2-date-ranges/
*/
// INSERTION
if ($_POST['date1']!='')
{
$date1 = $db->escape($_POST['date1']);
$date2 = $db->escape($_POST['date2']);
$id_logement = $db->escape($_POST['id_logement']);
$statut = 5;
$id_proprietaire = $_SESSION['proprietaire_id'];
$tarif_promotion = $db->escape($_POST['tarif_promotion']);
$date1 = date("Y-m-d", strtotime($date1));
$date2 = date("Y-m-d", strtotime($date2));
$date_demande=date("Y-m-d");
// GESTION ERREUR : SI DATE DEBUT POSTERIEURE A LA DATE FIN
$erreur="";
if ($date1>$date2) {$erreur=1;$texte_message="La date de début est postérieure à la date de fin";}
// SI DATES DE RESERVATION DEJA RESERVEES
$b1 = $db->escape($_POST['date1']);
$b2 = $db->escape($_POST['date2']);
$myquery = "SELECT date1,date2,statut,tarif_promotion from reservation where id_logement=$id_logement";
$site_calls = $db->get_results($myquery);
if (!empty($site_calls))
{
foreach ( $site_calls as $call )
{
$a1=$call->date1;
$a2=$call->date2;
// DATE 1 JOUR
if ($a2==$date2 && $a1==$date1)
{
$texte_message = "";
$erreur=2;
}
// DATE PLUSIEURS JOURS
$intersection = getIntersection($a1,$a2,$b1,$b2);
if($intersection === false)
{
}
else
{
$texte_message = "Réservation active du ".date('d-M-Y', $intersection['start'])." au ".date('d-M-Y', $intersection['end']);
$erreur=2;
}
//echo $a1." => ".$a2;
//echo "<br>";
}
}
//echo "<b>" . $date1." => ".$date2;
if ($erreur)
{
$type_message="danger";
$titre_message="Erreur";
echo "
<div class='portlet-body'>
<div class='note note-$type_message'>
<h4 class='block'>$titre_message</h4>
<p>$texte_message</p>
</div>
</div>
";
}
else
{
$requete="INSERT INTO reservation(
id_proprietaire,
id_logement,
date1,
date2,
date_demande,
tarif_promotion,
statut
)
VALUES(
'$id_proprietaire',
'$id_logement',
'$date1',
'$date2',
'$date_demande',
'$tarif_promotion',
'$statut' )";
//echo $requete;
$db->query($requete);
$type_message="info";
$titre_message="Mise à jour effectuée";
$texte_message="Promotion validée";
echo "
<div class='portlet-body'>
<div class='note note-$type_message'>
<h4 class='block'>$titre_message</h4>
<p>$texte_message</p>
</div>
</div>
";
// ENVOI DU MAIL
}
}
?>
<div class="row">
<div class="col-md-12">
<div class="portlet box blue-hoki">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-cogs"></i>Promotion
</div>
<div class="tools">
<a href="javascript:;" onclick='location.reload(true); return false;' class="reload">
</a>
</div>
</div>
<div class="portlet-body form">
<!-- BEGIN FORM-->
<form method="post" action="promotion.php" class="form-horizontal form-row-seperated">
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">Promotion entre le </label>
<div class="col-md-4">
<div class="input-group input-large date-picker input-daterange" data-date="10/11/2012" data-date-format="dd-mm-yyyy">
<input value="" type="text" class="form-control" name="date1">
<span class="input-group-addon">
et </span>
<input value="" type="text" class="form-control" name="date2">
</div>
<!-- /input-group -->
<span class="help-block">
Selectionner la période souhaitée </span>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Tarif</label>
<div class="col-md-3">
<input value="" type="text" name="tarif_promotion" placeholder="Saisissez ici le tarif en Euros" maxlength="100" required class="form-control"/>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Pourcentage de remise</label>
<div class="col-md-3">
<select name="pourcentage_remise" class="form-control select2_category">
<?
for ($i = 1; $i <= 100; $i++) {
?>
<option <?if ($i==50) {echo "selected ";}?> value="<?echo $i;?>"><?echo $i;?></option>
<?}?>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Logement : </label>
<div class="col-md-9">
<select name="id_logement" class="form-control select2_category">
<?
$ordre="id desc";
if ($_GET['order']=='label') {$ordre="label";}
$myquery = "SELECT * from logement where id_proprietaire=".$_SESSION['proprietaire_id']." order by ".$ordre;
$site_calls = $db->get_results($myquery);
$num = $db->num_rows;
?>
<?
if (!empty($site_calls))
{
foreach ( $site_calls as $call )
{
?>
<option <?if ($call->id==$id_logement) {echo "selected ";}?> value="<?echo $call->id;?>"><?echo $call->label;?></option>
<?
}
}
?>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">Type de tarif visible : </label>
<div class="col-md-9">
<select name="type_tarif_promotion" class="form-control select2_category">
<option value="Journée">Journée</option>
<option value="Semaine">Semaine</option>
<option value="Week-end">Week-end</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-md-offset-3 col-md-9">
<button type="submit" class="btn green"><i class="fa fa-pencil"></i> Valider</button>
</div>
</div>
</div>
</form>
<!-- END FORM-->
</div>
</div>
<!-- END EXTRAS PORTLET-->
</div>
</div>
<?
$type_message="warning";
$titre_message="<b>Information importante</b>";
$texte_message="Après validation, l'annonce paraitra automatiquement sur le site location-derniere-minute.com 15 jours avant la date de début de promotion jusqu'au dernier jour de promotion.";
echo "
<div class='portlet-body'>
<div class='note note-$type_message'>
<h4 class='block'>$titre_message</h4>
<p>$texte_message</p>
</div>
</div>
";?>
<!-- END PAGE CONTENT-->
</div>
</div>
<!-- END CONTENT -->
<!-- BEGIN QUICK SIDEBAR -->
<!--Cooming Soon...-->
<!-- END QUICK SIDEBAR -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->
<input class="jquery_nom_proprietaire" type="hidden" value="<?echo $_SESSION['proprietaire_nom'];?>">
<input class="jquery_prenom_proprietaire" type="hidden" value="<?echo $_SESSION['proprietaire_prenom'];?>">
<div class="page-footer">
<div class="page-footer-inner">
2014 © P.J
</div>
<div class="scroll-to-top">
<i class="icon-arrow-up"></i>
</div>
</div>
<!-- END FOOTER -->
</div>
<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
<!-- BEGIN CORE PLUGINS -->
<!--[if lt IE 9]>
<script src="../../assets/global/plugins/respond.min.js"></script>
<script src="../../assets/global/plugins/excanvas.min.js"></script>
<![endif]-->
<script src="../../assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/jquery-migrate.min.js" type="text/javascript"></script>
<!-- IMPORTANT! Load jquery-ui-1.10.3.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
<script src="../../assets/global/plugins/jquery-ui/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/jquery.cokie.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN PAGE LEVEL PLUGINS -->
<script type="text/javascript" src="../../assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="../../assets/global/plugins/bootstrap-timepicker/js/bootstrap-timepicker.min.js"></script>
<script type="text/javascript" src="../../assets/global/plugins/clockface/js/clockface.js"></script>
<script type="text/javascript" src="../../assets/global/plugins/bootstrap-daterangepicker/moment.min.js"></script>
<script type="text/javascript" src="../../assets/global/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
<script type="text/javascript" src="../../assets/global/plugins/bootstrap-colorpicker/js/bootstrap-colorpicker.js"></script>
<script type="text/javascript" src="../../assets/global/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="../../assets/global/plugins/jquery-notific8/jquery.notific8.min.js"></script>
<script src="../../assets/global/scripts/metronic.js" type="text/javascript"></script>
<script src="../../assets/admin/layout2/scripts/layout.js" type="text/javascript"></script>
<script src="../../assets/admin/layout2/scripts/demo.js" type="text/javascript"></script>
<script src="../../assets/admin/pages/scripts/components-pickers.js"></script>
<!-- END PAGE LEVEL SCRIPTS -->
<script src="../../assets/admin/pages/scripts/ui-notific8.js"></script>
<script>
jQuery(document).ready(function() {
//https://github.com/ralivue/jquery-notific8
var jquery_nom_proprietaire = $(".jquery_nom_proprietaire").val();
var jquery_prenom_proprietaire = $(".jquery_prenom_proprietaire").val();
//console.log (jquery_nom_proprietaire);
//$.notific8('Bonjour '+jquery_prenom_proprietaire+' '+jquery_nom_proprietaire, {
$.notific8('Page en cours de développement', {
life: 5000,
heading: 'In progress ...',
icon: 'check-mark-2',
theme: 'teal',
sticky: true,
horizontalEdge: 'bottom',
verticalEdge: 'right',
zindex: 1500
});
// initiate layout and plugins
Metronic.init(); // init metronic core components
Layout.init(); // init current layout
Demo.init(); // init demo features
ComponentsPickers.init();
});
</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>