$(function () { }); function saveStep1(e) { common.modalBlock(true); $.ajax({ url: $(e).attr("data-href"), type: 'POST', data: { servermqtt: $("input[name='servermqtt']").val(), url: $("input[name='url']").val() }, success: function (data) { setInterval(function () { $.ajax({ url: data, type: 'POST', success: function (data) { if (data.status) window.location = data.url; }, error: function (jqXHR, textStatus, errorThrown) { common.ajaxError(); } }); }, 1000); }, error: function (jqXHR, textStatus, errorThrown) { common.modalBlock(false); common.ajaxError(); } }); } function saveStep2(e) { var config_json = { "camera": { "auto_check": parseInt($("#text-c11").html()), "num_cam": parseInt($("#text-c12").html()), "rgb": { "url": $("#text-c131").html(), "type": $("#text-c132").html(), "rotate": parseInt($("#text-c133").html()), "config": { "enable": parseInt($("#text-c1341").html()), "brightness": parseInt($("#text-c1342").html()), "gain": parseInt($("#text-c1343").html()), "saturation": parseInt($("#text-c1344").html()), "sharpness": parseInt($("#text-c1345").html()) } }, "ir": { "url": $("#text-c141").html(), "type": $("#text-c142").html(), "rotate": parseInt($("#text-c143").html()), "translate_x": parseInt($("#text-c144").html()), "translate_y": parseInt($("#text-c145").html()), "ir_scale": parseFloat($("#text-c146").html()), "config": { "enable": parseInt($("#text-c1471").html()) } }, "max_queue_size": parseInt($("#text-c15").html()), "count_frame_to_skip": parseInt($("#text-c16").html()), "fps": parseInt($("#text-c17").html()), "merge_queue_pause": parseInt($("#text-c18").html()), "raw_resolution": { "width": parseInt($("#text-c191").html()), "height": parseInt($("#text-c192").html()) }, "video_resize": { "width": parseInt($("#text-c1101").html()), "height": parseInt($("#text-c1102").html()) }, "crop_frame": { "x": parseInt($("#text-c1111").html()), "y": parseInt($("#text-c1112").html()), "width": parseInt($("#text-c1113").html()), "height": parseInt($("#text-c1114").html()) } }, "face_verify": { "show_fake_label": parseInt($("#text-c21").html()), "debug": parseInt($("#text-c22").html()), "max_fake_time": parseInt($("#text-c23").html()), "min_real_time": parseInt($("#text-c24").html()), "saturation": { "enable": parseInt($("#text-c251").html()), "min_std_thresh": parseInt($("#text-c252").html()), "min_mean_thresh": parseInt($("#text-c253").html()) }, "mtcnn": { "enable": parseInt($("#text-c261").html()), "size": parseInt($("#text-c262").html()), "num_thread": parseInt($("#text-c263").html()) }, "ir_face_verify": { "enable": parseInt($("#text-c271").html()), "ir_scale": parseFloat($("#text-c272").html()), "ir_neighbor": parseInt($("#text-c273").html()) } }, "haarcascade": { "enable": parseInt($("#text-c31").html()), "show_time_detect": parseInt($("#text-c32").html()), "min_size": parseInt($("#text-c33").html()), "max_size": parseInt($("#text-c34").html()), "scale": parseFloat($("#text-c35").html()), "neighbor": parseInt($("#text-c36").html()) }, "engine": { "max_fps": parseInt($("#text-c41").html()), "cam_id": parseInt($("#text-c42").html()), "server_authen": $("#text-c43").html() }, "recognition": { "enable": parseInt($("#text-c51").html()), "accuracy": parseFloat($("#text-c52").html()), "server_recog": $("#text-c53").html(), "request_timeout": parseInt($("#text-c54").html()), "num_face_recog": parseInt($("#text-c55").html()), "first_time_recog": parseInt($("#text-c56").html()), "next_time_recog": parseInt($("#text-c57").html()) }, "screen": { "show_video": parseInt($("#text-c61").html()), "full_screen": parseInt($("#text-c62").html()), "width": parseInt($("#text-c63").html()), "height": parseInt($("#text-c64").html()), "banner": parseInt($("#text-c65").html()) }, "id_city": parseInt($("#text-c7").html()), "open_door": { "enable": parseInt($("#text-c81").html()), "port_name": $("#text-c82").html() }, "log": { "path": $("#text-c91").html(), "limit": parseInt($("#text-c92").html()), "clear_line": parseInt($("#text-c93").html()) } }; common.modalBlock(true); $.ajax({ url: $(e).attr("data-href"), type: 'POST', data: { config: JSON.stringify(config_json) }, success: function (data) { if (data) { notification.success("Đã lưu cấu hình!", 2000); } else { notification.success("Lưu cấu hình thất bại!", 2000); } common.modalBlock(false); }, error: function (jqXHR, textStatus, errorThrown) { common.modalBlock(false); common.ajaxError(); } }); }