added send customer to IVT

This commit is contained in:
Frank Schubert
2021-10-07 22:31:12 +02:00
parent 63c00e64d2
commit 87d2f032c1
6 changed files with 241 additions and 1 deletions

View File

@@ -609,6 +609,15 @@
<div class="card-body">
<?php if($me->is("Admin", "netoperator")): ?>
<?php if($order->id): ?>
<div class="form-group row">
<label class="col-lg-2"></label>
<div class="col-lg-10 mb-2">
<button type="button" id="savetoivt-button" class="btn btn-info">Kunde an IVT übertragen</button>
<span id="savetoivt-info"></span>
</div>
</div>
<?php endif; ?>
<div class="form-group row">
<label class="col-lg-2"></label>
<div class="col-lg-10">
@@ -662,6 +671,41 @@
});
});
<?php if($order->id): ?>
$('#savetoivt-button').click(function() {
$('#savetoivt-button').prop("disabled", true);
$('#savetoivt-info').html("<img src='<?=self::getResourcePath()?>img/ajax-loader.gif' />");
$.get("<?=self::getUrl("IvtCustomer","create", ["order_id" => $order->id])?>",
{},
function(data) {
console.log(data);
if(data.status == "OK") {
$('#savetoivt-info').removeClass("text-danger");
$('#savetoivt-info').addClass("text-success");
$('#savetoivt-info').text("Kunde erfolgreich an IVT übertragen!");
$('#savetoivt-button').remove();
} else {
$('#savetoivt-info').removeClass("text-success");
$('#savetoivt-info').addClass("text-danger");
if(data.reason) {
if(data.reason == "no-cust-num") {
$('#savetoivt-info').text("Inhaber und/oder Rechungsempfänger hat keine Kundennummer!");
}
if(data.reason == "ivt-exist") {
$('#savetoivt-info').text("Kunde existiert bereits im IVT!");
}
} else {
$('#savetoivt-info').text("Fehler bei übertragung.");
}
$('#savetoivt-button').prop("disabled", false);
}
},
"json"
);
});
<?php endif; ?>
$('#owner_id').change(function() {
var val = $('#owner_id').val();