tarifAction

This commit is contained in:
Michael RICOIS 2013-06-28 13:36:24 +00:00
parent 0a030d6fcf
commit e449a5caef
2 changed files with 66 additions and 63 deletions

View File

@ -1,9 +1,6 @@
<div id="center">
<h1>Ajout d'un tarif</h1>
<?php if ($this->error) {?>
<?=$this->error?>
<?php }?>
<div class="paragraph">
<?php } else {?>
<form method="post" action="<?=$this->url(array('controller'=>'dashboard','action'=>'tarif'),null,true)?>">
<input type="hidden" name="idClient" value="<?=$this->idClient?>"/>
@ -45,7 +42,20 @@
</select>
<br/>
<input type="submit" name="submit" value="Ajouter" class="button"/>
</form>
</div>
</div>
<script>
var windowhref = window.location.href;
$('#dialog').dialog({ buttons: [
{ text: "Valider", click: function() { survSubmit(); } },
{ text: "Annuler", click: function() { $(this).dialog("close"); } }
]});
function survSubmit(){
$('#dialogsurv').dialog({buttons: []});
$('#dialogsurv').dialog({ buttons: [
{ text: "Fermer", click: function() { window.location.href = windowhref; $(this).dialog("close"); } }
]});
}
</script>
<?php }?>

View File

@ -9,20 +9,21 @@
<?php if(count($this->contrats)>0) {?>
<style>
table {width:100%;}
table th {border:1px solid #cccccc; padding:2px;}
table td {border:1px solid #cccccc; padding:2px; height:16px;}
table th {border:1px solid #cccccc; padding:2px; text-align:center;}
table td {border:1px solid #cccccc; padding:2px; height:16px; text-align:center;}
</style>
<?php foreach ( $this->contrats as $contrat ) {?>
<div class="contrat">
<div>Du <span><?=$contrat->dateBegin?></span> au <span><?=$contrat->dateEnd?></span></div>
<div>Du <span class="date-begin"><?=$contrat->dateBegin?></span> au <span><?=$contrat->dateEnd?></span></div>
<br/>
<table>
<tr>
<th>Log</th>
<th>Element</th>
<th>Service</th>
<th>Type</th>
<th>Prix unitaire</th>
<th>Limit</th>
<th>Limite</th>
<th>Dédoublonnage</th>
</tr>
<?php foreach ($contrat->tarifs->item as $tarif ) {?>
@ -36,13 +37,17 @@ table td {border:1px solid #cccccc; padding:2px; height:16px;}
</tr>
<?php }?>
</table>
<br/>
<div style="line-height:16px;">
<a class="tarif-add" title="Ajouter un tarif" href="#">
<a class="tarif-add" title="Ajouter un tarif" href="<?=$this->url(array('controller'=>'dashboard','action'=>'tarif','date'=>$contrat->dateBegin))?>">
<img style="vertical-align:middle;" src="/themes/default/images/interfaces/ajouter.png" />Ajouter un tarif</a>
</div>
<br/>
</div>
<?php }?>
<hr/>
<?php } else {?>
Aucun tarif défini.
<?php }?>
@ -50,60 +55,48 @@ Aucun tarif défini.
</div>
</div>
<script src="/libs/editable/jquery.jeditable.js" type="text/javascript"></script>
<script>
var waitTarifAdd = false;
var services = "{'DEFAULT':'DEFAULT',<?php foreach($this->services as $i => $service) {?>'<?=$service->code?>':'<?=$service->label?>'<?php if($i<count($this->services)){?>,<?php } }?>}";
var logs = "{<?php foreach($this->logs as $i => $log) {?>'<?=$log->code?>':'<?=$log->desc?>'<?php if($i<count($this->logs)){?>,<?php } }?>}";
$('a.tarif-add').click(function(e){
e.preventDefault();
if (waitTarifAdd){
} else {
$(this).parents('div.contrat').find('table').append('<tr><td class="edit-log"></td><td class="edit-service"></td><td class="edit-type"></td><td class="edit-priceUnit"></td><td class="edit-limit"></td><td class="edit-doublon"></td></tr>');
$(this).html('Enregistrer');
waitTarifAdd = true;
}
e.preventDefault();
var title = "Ajout d'un tarif";
var href = $(this).attr('href');
var dialogOpts = {
bgiframe: true,
title: title,
width: 500,
height: 400,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...');
$(this).load(href);
},
buttons: {
Annuler: function() { $(this).dialog('close'); }
},
close: function() { $('#dialog').remove(); }
};
$('<div id="dialog"></div>').dialog(dialogOpts);
});
$('a.contrat-add').click(function(e){
e.preventDefault();
e.preventDefault();
var title = "Ajout d'un contrat";
var href = $(this).attr('href');
var dialogOpts = {
bgiframe: true,
title: title,
width: 500,
height: 200,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...');
$(this).load(href);
},
buttons: {
Annuler: function() { $(this).dialog('close'); }
},
close: function() { $('#dialog').remove(); }
};
$('<div id="dialog"></div>').dialog(dialogOpts);
});
$('td.edit-log').editable(function(value, settings){
}, {
data: logs,
type: 'select',
});
$('td.edit-service').editable(function(value, settings){
}, {
data: services,
type: 'select',
});
$('td.edit-type').editable(function(value, settings){
}, {
data: "{'Unitaire':'Unitaire','ForfaitLimit':'ForfaitLimit','ForfaitNoLimit':'ForfaitNoLimit'}",
type: 'select',
});
$('td.edit-priceUnit').editable(function(value, settings){
}, {
type: 'text',
});
$('td.edit-limit').editable(function(value, settings){
}, {
type: 'text',
});
$('td.edit-doublon').editable(function(value, settings){
}, {
data: "{'none':'none', 'jour':'jour', 'mois':'mois','period';'period'}",
type: 'select',
});
</script>