function save() {
    var error = checkValidation('');
    if (error === '') {
        var data = getJsonValue();
        var code = getQuery("code");
        if ($("#chkKharid").prop("checked") && $("#chkForosh").prop("checked"))
            data["State"] = 0;
        else if ($("#chkKharid").prop("checked"))
            data["State"] = 1;
        else if ($("#chkForosh").prop("checked"))
            data["State"] = 2;
        ajax({
            url: "SaleApi/" + (code ? "UpdateShoppingCenter" : "InsertShoppingCenter"),
            data: data ,
            success: function (result) {
                refreshParent("loadGrid()");
                showMsgModal(2, result.FinalMessage);
                closeTopModal();
            }
        });
    }
    else {
        showMsgModal(0, error);
    }
}
function cboTafsilGroupChange() {
    $("#cboTafsil").lookupBuilder().setSelectedValue("");
}
async function getEventLookupCombo($combo, search, code) {
    var id = $combo.attr('id');
    var url = "";
    var data = null;
    switch (id) {
        case "cboTafsilGroup":
            url = "AccountingApi/GetTafsilGroupList";
            data = { level: -1, search: search, pageNo: 1, selectedCode: code };
            break;
        case "cboTafsil":
            url = "AccountingApi/GetTafsilList";
            data = { tafsilGroupCode: $("#cboTafsilGroup").lookupBuilder().getSelectedValue(), level: -1, search: search, pageNo: 1, selectedCode: code };
            break;
    }
    await ajax({
        url: url,
        loading: false,
        data: data,
        success: function (result) {
            $combo.lookupBuilder().bindData(result);
        }
    });
}