sửa UX nhận tín hiệu thẻ khi gán thẻ cho nhân viên

This commit is contained in:
dongpd 2020-11-11 11:11:51 +07:00
parent 1225b1bd2f
commit 096be1a116
4 changed files with 23 additions and 9 deletions

View File

@ -21,11 +21,11 @@
#schedule-search-staff{ #schedule-search-staff{
height: 700px; height: 700px;
background: #cecece; background: #cecece;
overflow-y: scroll; overflow: scroll;
} }
#schedule-search-staff::-webkit-scrollbar { {*#schedule-search-staff::-webkit-scrollbar {
display: none; display: none;
} }*}
#create-schedule-main{ #create-schedule-main{
border-left: 1px solid #cecece; border-left: 1px solid #cecece;
margin-bottom: -10px; margin-bottom: -10px;

View File

@ -96,6 +96,9 @@
{html_options options=$deviceArray} {html_options options=$deviceArray}
</select> </select>
<div class="input-group-btn"> <div class="input-group-btn">
<button class="btn btn-default hidden" id="spin-icon">
<i class="fa fa-spinner fa-pulse"></i>
</button>
<button class="btn btn-info" onclick="getRTLog(this);" data-href='{yii\helpers\Url::to(["get-rtlog"])}' title='Lấy mã thẻ từ đầu đọc'> <button class="btn btn-info" onclick="getRTLog(this);" data-href='{yii\helpers\Url::to(["get-rtlog"])}' title='Lấy mã thẻ từ đầu đọc'>
<i class="fa fa-download"></i> <i class="fa fa-download"></i>
</button> </button>

View File

@ -222,13 +222,17 @@ common.getUrlParameter = function (sParam) {
} }
}; };
common.error = function (id, text) { common.error = function (id, text) {
$("#" + id).addClass("has-error").removeClass("has-success"); $("#" + id).addClass("has-error").removeClass("has-success").removeClass("has-warning");
$("#" + id).find(".help-block").html(text).removeClass("hidden"); $("#" + id).find(".help-block").html(text).removeClass("hidden");
}; };
common.success = function (id) { common.success = function (id) {
$("#" + id).addClass("has-success").removeClass("has-error"); $("#" + id).addClass("has-success").removeClass("has-error");
$("#" + id).find(".help-block").addClass("hidden"); $("#" + id).find(".help-block").addClass("hidden");
}; };
common.warning = function (id, text) {
$("#" + id).addClass("has-warning").removeClass("has-error").removeClass("has-success");
$("#" + id).find(".help-block").html(text).removeClass("hidden");
};
common.form = function (e, obj, bigSize) { common.form = function (e, obj, bigSize) {
var size = bigSize | false; var size = bigSize | false;
common.modalBlock(true); common.modalBlock(true);

View File

@ -270,7 +270,9 @@ function formGetRTLog(e) {
} }
function getRTLog(e) { function getRTLog(e) {
common.modalBlock(true); // common.modalBlock(true);
common.warning("device-lists", "<i class='fa fa-info-circle'></i> Chờ tín hiệu thẻ (tối đa 60 giây)");
$("#spin-icon").removeClass("hidden");
$.ajax({ $.ajax({
url: $(e).attr('data-href'), url: $(e).attr('data-href'),
type: 'POST', type: 'POST',
@ -278,18 +280,23 @@ function getRTLog(e) {
device: $("select[name='Device']").val() device: $("select[name='Device']").val()
}, },
success: function (data) { success: function (data) {
common.modalBlock(false); // common.modalBlock(false);
if (data.ErrorCode === "1") { if (data.ErrorCode === "1") {
$("input[name='CardNumber']").val(data.CardNumber); $("input[name='CardNumber']").val(data.CardNumber);
$("#device-lists").addClass("hidden"); $("#device-lists").addClass("hidden");
$("#btn-get-rtlog").attr("data-stt", true); $("#btn-get-rtlog").attr("data-stt", true);
$("#device-lists").removeClass("has-error").removeClass("has-warning");
$("#device-lists").find(".help-block").addClass("hidden");
$("#spin-icon").addClass("hidden");
} else { } else {
alert("Không có tín hiệu thẻ"); common.error("device-lists", "<i class='fa fa-info-circle'></i> Không nhận được tín hiệu thẻ hoặc không có kết nối tới service");
$("#spin-icon").addClass("hidden");
} }
}, },
error: function (jqXHR, textStatus, errorThrown) { error: function (jqXHR, textStatus, errorThrown) {
common.modalBlock(false); // common.modalBlock(false);
alert("Không có tín hiệu thẻ"); common.error("device-lists", "<i class='fa fa-info-circle'></i> Không nhận được tín hiệu thẻ hoặc không có kết nối tới service");
$("#spin-icon").addClass("hidden");
} }
}); });
} }