wawi: autocomplete-Felder mit neuer Version von jQuery

This commit is contained in:
be10b025
2013-09-04 08:06:48 +00:00
parent a3a240aa33
commit 67c4e9598f
3 changed files with 218 additions and 45 deletions
+142 -20
View File
@@ -351,7 +351,10 @@ if(isset($_POST['deleteBtnStorno']) && isset($_POST['id']))
<link rel="stylesheet" href="../skin/jquery.css" type="text/css"/>
<link rel="stylesheet" href="../skin/fhcomplete.css" type="text/css"/>
<link rel="stylesheet" href="../skin/wawi.css" type="text/css"/>
<script type="text/javascript" src="../include/js/jquery.js"></script>
<!-- <script type="text/javascript" src="../include/js/jquery.js"></script> -->
<script type="text/javascript" src="../include/js/jquery1.9.min.js"></script>
<link rel="stylesheet" type="text/css" href="../skin/jquery-ui-1.9.2.custom.min.css"/>
<script type="text/javascript">
function conf_del()
{
@@ -413,7 +416,25 @@ if(isset($_POST['deleteBtnStorno']) && isset($_POST['id']))
return false;
});
$('#mitarbeiter_name').autocomplete('wawi_autocomplete.php',
$('#mitarbeiter_name').autocomplete({
source: "wawi_autocomplete.php?work=wawi_mitarbeiter_search",
minLength:2,
response: function(event, ui)
{
//Value und Label fuer die Anzeige setzen
for(i in ui.content)
{
ui.content[i].value=ui.content[i].uid;
ui.content[i].label=ui.content[i].vorname+' '+ui.content[i].nachname+' ('+ui.content[i].uid+')';
}
},
select: function(event, ui)
{
ui.item.value=ui.item.uid;
}
});
/* $('#mitarbeiter_name').autocomplete('wawi_autocomplete.php',
{
minChars:2,
matchSubset:1,matchContains:1,
@@ -421,11 +442,32 @@ if(isset($_POST['deleteBtnStorno']) && isset($_POST['id']))
formatItem:formatItem,
extraParams:{'work':'wawi_mitarbeiter_search'
}
}).result(function(event, item) {
}).result(function(event, item) {
$('#mitarbeiter_uid').val(item[1]);
});
}); */
$('#firmenname').autocomplete('wawi_autocomplete.php',
$('#firmenname').autocomplete({
source: "wawi_autocomplete.php?work=wawi_firma_search",
minLength:2,
response: function(event, ui)
{
//Value und Label fuer die Anzeige setzen
for(i in ui.content)
{
ui.content[i].value=ui.content[i].firma_id;
ui.content[i].label=ui.content[i].gesperrt+ui.content[i].name;
if(ui.content[i].kurzbz!='')
ui.content[i].label+=' ('+ui.content[i].kurzbz+')';
ui.content[i].label+=' '+ui.content[i].firma_id;
}
},
select: function(event, ui)
{
ui.item.value=ui.item.firma_id;
}
});
/* $('#firmenname').autocomplete('wawi_autocomplete.php',
{
minChars:2,
matchSubset:1,matchContains:1,
@@ -435,9 +477,27 @@ if(isset($_POST['deleteBtnStorno']) && isset($_POST['id']))
}
}).result(function(event, item) {
$('#firma_id').val(item[1]);
});
}); */
$('#besteller').autocomplete('wawi_autocomplete.php',
$('#besteller').autocomplete({
source: "wawi_autocomplete.php?work=wawi_mitarbeiter_search",
minLength:2,
response: function(event, ui)
{
//Value und Label fuer die Anzeige setzen
for(i in ui.content)
{
ui.content[i].value=ui.content[i].uid;
ui.content[i].label=ui.content[i].vorname+' '+ui.content[i].nachname+' ('+ui.content[i].uid+')';
}
},
select: function(event, ui)
{
ui.item.value=ui.item.uid;
}
});
/* $('#besteller').autocomplete('wawi_autocomplete.php',
{
minChars:2,
matchSubset:1,matchContains:1,
@@ -447,7 +507,7 @@ if(isset($_POST['deleteBtnStorno']) && isset($_POST['id']))
}
}).result(function(event, item) {
$('#besteller_uid').val(item[1]);
});
}); */
});
</script>
</head>
@@ -577,17 +637,36 @@ if($aktion == 'suche')
echo "</tr>\n";
echo "<script type='text/javascript'>
$('#tag').autocomplete('wawi_autocomplete.php',
{
$('#tag').autocomplete({
source: 'wawi_autocomplete.php?work=tags',
minChars:2,
matchSubset:1,matchContains:1,
width:500,
formatItem:formatItemTag,
extraParams:{'work':'tags'
}
})
response:function(event,ui)
{
for(i in ui.content)
{
ui.content[i].value=ui.content[i].tag;
ui.content[i].label=ui.content[i].tag;
}
},
select: function(event, ui)
{
ui.item.value=ui.item.tag;
}
});
</script>";
/* echo "<script type='text/javascript'>
$('#tag').autocomplete('wawi_autocomplete.php',
{
minChars:2,
matchSubset:1,matchContains:1,
width:500,
formatItem:formatItemTag,
extraParams:{'work':'tags'
}
})
</script>"; */
echo "<tr>\n";
echo "<tr>\n";
@@ -1587,7 +1666,26 @@ if($_GET['method']=='update')
$tag_help = $bestell_tag->GetStringTags();
echo "<td><input type='text' id='tags' name='tags' size='32' value='".$tag_help."'>\n";
echo ' <script type="text/javascript">
echo "<script type='text/javascript'>
$('#tags').autocomplete({
source: 'wawi_autocomplete.php?work=tags',
minChars:1,
response:function(event,ui)
{
for(i in ui.content)
{
ui.content[i].value=ui.content[i].tag;
ui.content[i].label=ui.content[i].tag;
}
},
select: function(event, ui)
{
ui.item.value=ui.item.tag;
}
});
</script>";
/* echo ' <script type="text/javascript">
$("#tags").autocomplete("wawi_autocomplete.php",
{
minChars:1,
@@ -1598,7 +1696,7 @@ if($_GET['method']=='update')
formatItem:formatItemTag,
extraParams:{"work":"tags", "bestell_id":"'.$bestellung->bestellung_id.'"}
});
</script>';
</script>'; */
echo "</td>\n";
echo "<td>Freigabe:</td>\n";
echo "<td colspan =2>";
@@ -2394,7 +2492,30 @@ function getDetailRow($i, $bestelldetail_id='', $sort='', $menge='', $ve='', $be
$detail_tag = new tags();
$detail_tag->GetTagsByBestelldetail($bestelldetail_id);
$help = $detail_tag->GetStringTags();
echo " <script type='text/javascript'>
echo "<script type='text/javascript'>
$(document).ready(function()
{
$('#detail_tag_'+$i).autocomplete({
source: 'wawi_autocomplete.php?work=detail_tags',
minChars:1,
response:function(event,ui)
{
for(i in ui.content)
{
ui.content[i].value=ui.content[i].tag;
ui.content[i].label=ui.content[i].tag;
}
},
select: function(event, ui)
{
ui.item.value=ui.item.tag;
}
});
});
</script>";
/* echo " <script type='text/javascript'>
$(document).ready(function()
{
$('#detail_tag_'+$i).autocomplete('wawi_autocomplete.php',
@@ -2407,7 +2528,8 @@ function getDetailRow($i, $bestelldetail_id='', $sort='', $menge='', $ve='', $be
extraParams:{'work':'detail_tags', 'detail_id':'.$bestelldetail_id.'}
});
});
</script>";
</script>"; */
echo "<td><input type='text' size='10' name='detail_tag_$i' id='detail_tag_$i' value='$help' ></td>";
echo "<td><input type='hidden' size='20' name='bestelldetailid_$i' id='bestelldetailid_$i' value='$bestelldetail_id'></td>";
echo "<td><input type='hidden' size='3' name='sort_$i' id='sort_$i' maxlength='2' value='$sort'></td>\n";
+26 -3
View File
@@ -63,7 +63,9 @@ if(isset($_POST['getBetragRow']) && isset($_POST['id']))
<link rel="stylesheet" href="../skin/fhcomplete.css" type="text/css">
<link rel="stylesheet" href="../skin/wawi.css" type="text/css">
<script type="text/javascript" src="../include/js/jquery.js"></script>
<script type="text/javascript" src="../include/js/jquery1.9.min.js"></script>
<link rel="stylesheet" type="text/css" href="../skin/jquery-ui-1.9.2.custom.min.css"/>
<!-- <script type="text/javascript" src="../include/js/jquery.js"></script> -->
<script type="text/javascript">
function loadFirma(id)
@@ -90,7 +92,7 @@ if(isset($_POST['getBetragRow']) && isset($_POST['id']))
<?php
if($aktion=='suche' && !isset($_POST['submit']))
{
echo "
/* echo "
$('#firmenname').autocomplete('wawi_autocomplete.php',
{
minChars:2,
@@ -100,8 +102,29 @@ if(isset($_POST['getBetragRow']) && isset($_POST['id']))
extraParams:{'work':'wawi_firma_search' }
}).result(function(event, item) {
$('#firma_id').val(item[1]);
});
}); */
echo "
$('#firmenname').autocomplete({
source: \"wawi_autocomplete.php?work=wawi_firma_search\",
minLength:2,
response: function(event, ui)
{
//Value und Label fuer die Anzeige setzen
for(i in ui.content)
{
ui.content[i].value=ui.content[i].firma_id;
ui.content[i].label=ui.content[i].gesperrt+ui.content[i].name;
if(ui.content[i].kurzbz!='')
ui.content[i].label+=' ('+ui.content[i].kurzbz+')';
ui.content[i].label+=' '+ui.content[i].firma_id;
}
},
select: function(event, ui)
{
ui.item.value=ui.item.firma_id;
}
});
$( \"#rechnungsdatum_von\" ).datepicker($.datepicker.regional['de']);
$( \"#rechnungsdatum_bis\" ).datepicker($.datepicker.regional['de']);
$( \"#buchungsdatum_von\" ).datepicker($.datepicker.regional['de']);
+37 -9
View File
@@ -63,12 +63,14 @@
{
// Firmen Search
case 'wawi_firma_search':
$firma_search=trim((isset($_REQUEST['q']) ? $_REQUEST['q']:''));
$firma_search=trim((isset($_REQUEST['term']) ? $_REQUEST['term']:''));
if (is_null($firma_search) ||$firma_search=='')
exit();
$sFirma = new firma();
if (!$sFirma->getAll($firma_search))
exit($sFirma->errormsg."\n");
$result=array();
for ($i=0;$i<count($sFirma->result);$i++)
{
$standort = new standort();
@@ -77,46 +79,72 @@
$kurzbz = $standort->result[0]->kurzbz;
else
$kurzbz = '';
echo html_entity_decode(($sFirma->result[$i]->gesperrt?'!!GESPERRT!! ':'').$sFirma->result[$i]->name).($kurzbz!=''?' ('.$kurzbz.')':'').'|'.html_entity_decode($sFirma->result[$i]->firma_id)."\n";
$item['gesperrt']=html_entity_decode($sFirma->result[$i]->gesperrt?'!!GESPERRT!! ':'');
$item['name']=html_entity_decode($sFirma->result[$i]->name);
$item['kurzbz']=$kurzbz;
$item['firma_id']=html_entity_decode($sFirma->result[$i]->firma_id);
$result[]=$item;
// echo html_entity_decode(($sFirma->result[$i]->gesperrt?'!!GESPERRT!! ':'').$sFirma->result[$i]->name).($kurzbz!=''?' ('.$kurzbz.')':'').'|'.html_entity_decode($sFirma->result[$i]->firma_id)."\n";
}
echo json_encode($result);
break;
// Bestellung Tags
case 'tags':
// $bestell_id = $_REQUEST['bestell_id'];
$tag_search=trim((isset($_REQUEST['q']) ? $_REQUEST['q']:''));
$tag_search=trim((isset($_REQUEST['term']) ? $_REQUEST['term']:''));
// if (is_null($bestell_id) || $tag_search=='')
// exit();
$tags = new tags();
if (!$tags->getAll())
exit($tags->errormsg."\n");
$result=array();
for ($i=0;$i<count($tags->result);$i++)
echo html_entity_decode($tags->result[$i]->tag)."\n";
{
$item['tag']=$tags->result[$i]->tag;
$result[]=$item;
// echo html_entity_decode($tags->result[$i]->tag)."\n";
}
echo json_encode($result);
break;
// Bestelldetail Tags
case 'detail_tags':
// $detail = $_REQUEST['detail_id'];
$tag_search=trim((isset($_REQUEST['q']) ? $_REQUEST['q']:''));
$tag_search=trim((isset($_REQUEST['term']) ? $_REQUEST['term']:''));
//if (is_null($detail) || $tag_search=='')
// exit();
$tags = new tags();
if (!$tags->getAll())
exit($tags->errormsg."\n");
$result=array();
for ($i=0;$i<count($tags->result);$i++)
echo html_entity_decode($tags->result[$i]->tag)."\n";
{
$item['tag']=$tags->result[$i]->tag;
$result[]=$item;
// echo html_entity_decode($tags->result[$i]->tag)."\n";
}
echo json_encode($result);
break;
case 'wawi_mitarbeiter_search':
$search=trim((isset($_REQUEST['q']) ? $_REQUEST['q']:''));
$search=trim((isset($_REQUEST['term']) ? $_REQUEST['term']:''));
if (is_null($search) ||$search=='')
exit();
$ma = new mitarbeiter();
$ma->search($search);
$result=array();
foreach($ma->result as $row)
echo html_entity_decode($row->vorname).' '.html_entity_decode($row->nachname).'|'.html_entity_decode($row->uid)."\n";
{
$item['vorname']=html_entity_decode($row->vorname);
$item['nachname']=html_entity_decode($row->nachname);
$item['uid']=html_entity_decode($row->uid);
$result[]=$item;
// echo html_entity_decode($row->vorname).' '.html_entity_decode($row->nachname).'|'.html_entity_decode($row->uid)."\n";
}
echo json_encode($result);
break;
}
exit();