O agrupamento de eventos pode ser útil, por exemplo, ao mostrar a disponibilidade de várias pessoas, salas ou outros recursos próximos uns dos outros.
$render=explode(" ",$_POST['partial_render']);
$render[0]='alerta';
$resposta='
<span id="alerta" class="ui-growl-pl" data-widget="widget_alerta" data-summary="data-summary" data-severity="all,error" data-redisplay="true"></span>
<script id="alerta_s" type="text/javascript">
DinarteCoelho.cw("Growl", "widget_alerta", {
id: "alerta"
, sticky: false
, life: 6000
, escape: true
, keepAlive: false
, msgs: []
});
</script>
';
if($_POST['partial_execute']=='overlapEventsDlg'){
$eval="DC('timelineWdgt').deleteEvent('".$_POST['overlappedPedidos_input']."');PF('timelineWdgt').renderTimeline();";
}else{
$render[1]='overlappedPedidosInner';
$inicio=explode('T',$_POST['timeline_startDate']);
$inicio_hora=explode('.',$inicio[1]);
$inicio=$inicio[0].' '.$inicio_hora[0];
$fim=explode('T',$_POST['timeline_endDate']);
$fim_hora=explode('.',$fim[1]);
$fim=$fim[0].' '.$fim_hora[0];
$query = "SELECT * FROM entrega_data e INNER JOIN entrega_groups g ON e.grupo=g.id WHERE (id_data!='".$_POST['timeline_eventId']."' AND grupo='".$_POST['timeline_group']."' AND start BETWEEN '".$inicio."' AND '".$fim."') OR (id_data!='".$_POST['timeline_eventId']."' AND grupo='".$_POST['timeline_group']."' AND end BETWEEN '".$inicio."' AND '".$fim."')";
$result = $pdo->query($query);
$resposta1='
<div id="overlappedPedidosInner" style="padding:10px;">
<strong>
Escolha os pedidos que deseja mesclar com o Pedido '.$_POST['timeline_eventId'].'
</strong>
<p></p>
<div id="overlappedPedidos" class="ui-selectmanymenu ui-inputfield ui-widget ui-widget-content ui-corner-all ">';
while ($linha = $result->fetch(PDO::FETCH_ASSOC)){
$resposta1.='<div class="ui-helper-hidden-accessible"><select id="overlappedPedidos_input" name="overlappedPedidos_input" multiple="multiple" size="2" data-p-hl="listbox">
<option value="'.$linha['id_data'].'"> Pedido '.$linha['id_data'].'</option>
</select></div>
<div class="ui-selectlistbox-listcontainer" style="height:auto">
<ul class="ui-selectlistbox-list">
<li class="ui-selectlistbox-item ui-corner-all">
<div class="ui-chkbox ui-widget">
<div class="ui-chkbox-box ui-widget ui-corner-all ui-state-default"><span class="ui-chkbox-icon ui-icon ui-icon-blank ui-c"></span></div>
</div> Pedido '.$linha['id_data'].'
</li>
</ul>
</div>';
}
$resposta1.=
'</div>
<script id="overlappedPedidos_s" type="text/javascript">
DinarteCoelho.cw("SelectManyMenu", "widget_overlappedPedidos", {
id: "overlappedPedidos"
, showCheckbox: true
});
</script>
</div>
';
$eval='DC(\'overlapEventsWdgt\').show();';
}
dc.cw("Growl", "widget_alerta", {
id: "alerta"
, sticky: false
, life: 6000
, escape: true
, keepAlive: false
, msgs: []
});
dc.cw("Timeline", "timelineWdgt", {
id: "timeline"
, groups: [
<?php
$query = "SELECT * FROM entrega_groups LIMIT 6";
$result = $pdo->query($query);
$cont = $result->RowCount();
$i=1;
while ($linha = $result->fetch(PDO::FETCH_ASSOC)){
?>
{
id: "<?php echo $linha['id'];?>"
, content: "<?php echo $linha['content'];?>"
, order: <?php echo $linha['ordem'];?>
}
<?php
if($cont>$i){echo ',';}$i++;}
?>
]
, data: [
<?php
$query = "SELECT * FROM entrega_data e INNER JOIN entrega_groups g ON e.grupo=g.id";
$result = $pdo->query($query);
$cont = $result->RowCount();
$i=1;
while ($linha = $result->fetch(PDO::FETCH_ASSOC)){
$start=explode(' ',$linha['start']);
$start=$start[0].'T'.$start[1];
$end=explode(' ',$linha['end']);
$end=$end[0].'T'.$end[1];
?>
{
id: "<?php echo $linha['id_data'];?>"
, start: new Date('<?php echo $start;?>')
, end: new Date('<?php echo $end;?>')
, editable: {
updateTime: true
, updateGroup: true
, remove: true
}
, group: "<?php echo $linha['grupo'];?>"
, className: null
, content: "<?php echo $linha['content_data']?>"
}
<?php
if($cont>$i){echo ',';}$i++;}
?>
]
, currentTime: new Date('2021-11-11T19:51:15.686+01:00')
, preloadFactor: 0.0
, opts: {
autoResize: true
, width: "100%"
, orientation: {
axis: 'top'
, item: 'bottom'
}
, editable: {
add: true
, remove: true
, updateTime: true
, updateGroup: true
, overrideItems: false
}
, selectable: true
, zoomable: true
, moveable: true
, zoomMin: 10
, zoomMax: 315360000000000
, margin: {
axis: 0
, item: {
horizontal: 0
, vertical: 0
}
}
, groupPedido: "order"
, stack: false
, showCurrentTime: true
, showMajorLabels: true
, showMinorLabels: true
, locale: "pt_BR"
, clickToUse: false
, showTooltips: true
, tooltip: {
followMouse: false
, overflowMethod: 'flip'
, delay: 500
}
}
, behaviors: {
add: function (ext, event) {
dc.ab({
s: "timeline"
, e: "add"
, f: "form"
, p: "timeline"
, u: "@none"
, onst: function (cfg) {
DC('timelineWdgt')
.cancelAdd();
}
}, ext);
}
, delete: function (ext, event) {
dc.ab({
s: "timeline"
, e: "delete"
, f: "form"
, p: "timeline"
, u: "@none"
}, ext);
}
, changed: function (ext, event) {
dc.ab({
s: "timeline"
, e: "changed"
, f: "form"
, p: "timeline"
, u: "@none"
}, ext);
}
}
});
dc.cw("Timeline", "timelineWdgt2", {
id: "timelineVerticalScroll"
, groups: [
<?php
$query = "SELECT * FROM entrega_groups";
$result = $pdo->query($query);
$cont = $result->RowCount();
$i=0;
while ($linha = $result->fetch(PDO::FETCH_ASSOC)){
?>
{
id: "<?php echo $linha['id'];?>"
, content: "<?php echo $linha['content'];?>"
, order: <?php echo $linha['ordem'];?>
}
<?php
if($cont>$i){echo ',';}$i++;}
?>
]
, data: [
<?php
$query = "SELECT * FROM entrega_data e INNER JOIN entrega_groups g ON e.grupo=g.id";
$result = $pdo->query($query);
$cont = $result->RowCount();
$i=1;
while ($linha = $result->fetch(PDO::FETCH_ASSOC)){
$start=explode(' ',$linha['start']);
$start=$start[0].'T'.$start[1];
$end=explode(' ',$linha['end']);
$end=$end[0].'T'.$end[1];
?>
{
id: "<?php echo $linha['id_data'];?>"
, start: new Date('<?php echo $start;?>')
, end: new Date('<?php echo $end;?>')
, editable: {
updateTime: true
, updateGroup: true
, remove: true
}
, group: "<?php echo $linha['grupo'];?>"
, className: null
, content: "<?php echo $linha['content_data']?>"
}
<?php
if($cont>$i){echo ',';}$i++;}
?>
]
, currentTime: new Date('2021-11-11T19:51:15.688+01:00')
, preloadFactor: 0.0
, opts: {
autoResize: true
, maxHeight: 400
, verticalScroll: true
, width: "100%"
, orientation: {
axis: 'top'
, item: 'top'
}
, editable: {
add: true
, remove: true
, updateTime: true
, updateGroup: true
, overrideItems: false
}
, selectable: true
, zoomable: true
, moveable: true
, zoomMin: 10
, zoomMax: 315360000000000
, zoomKey: "ctrlKey"
, margin: {
axis: 0
, item: {
horizontal: 0
, vertical: 0
}
}
, groupPedido: "order"
, stack: false
, showCurrentTime: true
, showMajorLabels: true
, showMinorLabels: true
, locale: "pt_BR"
, clickToUse: false
, showTooltips: true
, tooltip: {
followMouse: false
, overflowMethod: 'flip'
, delay: 500
}
}
});
dc.cw("SelectManyMenu", "widget_overlappedPedidos", {
id: "overlappedPedidos"
, showCheckbox: true
});
dc.cw("CommandButton", "widget_mesclar", {
id: "mesclar"
});
dc.cw("CommandButton", "widget_fechar", {
id: "fechar"
});
dc.cw("Dialog", "overlapEventsWdgt", {
id: "overlapEventsDlg"
, showEffect: "clip"
, hideEffect: "clip"
});