|
@@ -1,4 +1,4 @@
|
|
|
-@model GreenTree.Strohrmann.ERP.Web.Models.Shared.SearchModel
|
|
|
|
|
|
|
+@model GreenTree.Strohrmann.ERP.Web.Models.Search.ICustomerSearchable
|
|
|
|
|
|
|
|
@{
|
|
@{
|
|
|
var partialId = Html.RandomId();
|
|
var partialId = Html.RandomId();
|
|
@@ -8,6 +8,22 @@
|
|
|
|
|
|
|
|
@{
|
|
@{
|
|
|
<text>
|
|
<text>
|
|
|
|
|
+ $(document).ready(function () {
|
|
|
|
|
+ $("#text_@partialId").on('keypress', function (e) {
|
|
|
|
|
+ if (e.keyCode == 13) {
|
|
|
|
|
+ search_@partialId ();
|
|
|
|
|
+ e.preventDefault();
|
|
|
|
|
+ };
|
|
|
|
|
+ });
|
|
|
|
|
+ $("#text_@partialId").on('keydown', function (e) {
|
|
|
|
|
+ if (e.keyCode == 8 && $("#value_@partialId").val() != "") {
|
|
|
|
|
+ $("#text_@partialId").val("");
|
|
|
|
|
+ $("#value_@partialId").val("");
|
|
|
|
|
+ e.preventDefault();
|
|
|
|
|
+ };
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
function search_@partialId () {
|
|
function search_@partialId () {
|
|
|
$.ajax({
|
|
$.ajax({
|
|
|
method: "POST",
|
|
method: "POST",
|
|
@@ -16,19 +32,41 @@
|
|
|
SearchTerm: $("#text_@partialId").val()
|
|
SearchTerm: $("#text_@partialId").val()
|
|
|
},
|
|
},
|
|
|
success: function (data) {
|
|
success: function (data) {
|
|
|
- debugger;
|
|
|
|
|
- $("#searchCustomerModal_@partialId").modal("show");
|
|
|
|
|
- if (data == null) return;
|
|
|
|
|
- $(data).each(function (index, element) {
|
|
|
|
|
|
|
+ $("#searchCustomerModal_@partialId").find(".list-group").empty();
|
|
|
|
|
+ if (data.length > 0) {
|
|
|
|
|
+ $(data).each(function (index, elem) {
|
|
|
|
|
+ $("#searchCustomerModal_@partialId").find(".list-group").append(
|
|
|
|
|
+ '<a href="#" class="list-group-item list-group-item-info list-group-item-action" ' +
|
|
|
|
|
+ 'data-toggle="list" data-val="{0}" data-text="{1}">{1} ({2})</a>'
|
|
|
|
|
+ .format(elem.id, elem.fullname, elem.localAddress));
|
|
|
|
|
+ $("#searchCustomerModal_@partialId").find(".list-group").append(
|
|
|
|
|
+ '<a href="#" class="list-group-item list-group-item-info list-group-item-action" ' +
|
|
|
|
|
+ 'data-toggle="list" data-val="{0}" data-text="{1}">{1} ({2})</a>'
|
|
|
|
|
+ .format(elem.id, elem.fullname, elem.localAddress));
|
|
|
|
|
+ $("#searchCustomerModal_@partialId").find(".list-group").append(
|
|
|
|
|
+ '<a href="#" class="list-group-item list-group-item-info list-group-item-action" ' +
|
|
|
|
|
+ 'data-toggle="list" data-val="{0}" data-text="{1}">{1} ({2})</a>'
|
|
|
|
|
+ .format(elem.id, elem.fullname, elem.localAddress));
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
$("#searchCustomerModal_@partialId").find(".list-group").append(
|
|
$("#searchCustomerModal_@partialId").find(".list-group").append(
|
|
|
- '<button type="button" class="list-group-item list-group-item-action">' + element + '</button>');
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ '<button type="button" class="list-group-item">Keine Treffer</button>');
|
|
|
|
|
+ }
|
|
|
|
|
+ $("#searchCustomerModal_@partialId").modal("show");
|
|
|
},
|
|
},
|
|
|
error: function (msg) {
|
|
error: function (msg) {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ function select_@partialId () {
|
|
|
|
|
+ $("#searchCustomerModal_@partialId").modal("hide");
|
|
|
|
|
+ var val = $("#searchCustomerModal_@partialId").find("a.active").attr("data-val");
|
|
|
|
|
+ var text = $("#searchCustomerModal_@partialId").find("a.active").attr("data-text");
|
|
|
|
|
+ $("#value_@partialId").val(val);
|
|
|
|
|
+ $("#text_@partialId").val(text);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
</text>
|
|
</text>
|
|
|
}
|
|
}
|
|
@@ -37,19 +75,13 @@
|
|
|
|
|
|
|
|
<div class="input-group mb-3">
|
|
<div class="input-group mb-3">
|
|
|
<div class="input-group-prepend">
|
|
<div class="input-group-prepend">
|
|
|
- <button class="btn btn-outline-secondary fas fa-search" type="button" onclick="search_@partialId ()"></button>
|
|
|
|
|
|
|
+ <button class="btn btn-info fas fa-search" type="button" onclick="search_@partialId ()"></button>
|
|
|
</div>
|
|
</div>
|
|
|
<input id="text_@partialId" type="text" class="form-control" placeholder="Suchbegriff" aria-label="Suchbegriff" aria-describedby="basic-addon1">
|
|
<input id="text_@partialId" type="text" class="form-control" placeholder="Suchbegriff" aria-label="Suchbegriff" aria-describedby="basic-addon1">
|
|
|
- @if (Model == null)
|
|
|
|
|
- {
|
|
|
|
|
- <input id="hiddenValue_@partialId" type="hidden" />
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- <input id="hiddenValue_@partialId" type="hidden" name="@Model.ModelPropertyPath" />
|
|
|
|
|
- }
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
+<input id="value_@partialId" type="hidden" asp-for="CustomerId" />
|
|
|
|
|
+
|
|
|
<div id="searchCustomerModal_@partialId" class="modal fade">
|
|
<div id="searchCustomerModal_@partialId" class="modal fade">
|
|
|
<div class="modal-dialog">
|
|
<div class="modal-dialog">
|
|
|
<div class="modal-content">
|
|
<div class="modal-content">
|
|
@@ -57,15 +89,12 @@
|
|
|
<h4 class="modal-title">Suchergebnisse</h4>
|
|
<h4 class="modal-title">Suchergebnisse</h4>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="modal-body">
|
|
<div class="modal-body">
|
|
|
- <div class="form-group">
|
|
|
|
|
- <label class="control-label"></label>
|
|
|
|
|
- <div class="list-group">
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div class="list-group">
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="modal-footer">
|
|
<div class="modal-footer">
|
|
|
<div class="btn btn-secondary" data-dismiss="modal">Schließen</div>
|
|
<div class="btn btn-secondary" data-dismiss="modal">Schließen</div>
|
|
|
- <div class="btn btn-success">Auswählen</div>
|
|
|
|
|
|
|
+ <div class="btn btn-success" onclick="select_@partialId ()">Auswählen</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|