0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.147.82.108


Current Path : /var/www/oasis/js_old/
Upload File :
Current File : /var/www/oasis/js_old/system.js

function Callenablegeneralmaster() {
  $("#page_main_div").load(
    "../html_modules/System_General_Master_Setup.html",
    function() {
      getDefaultHeadFooterLinks("General Master Setup");
      $geditinternalcode = 0;
      window.enable_proper_module = "enablegeneralmaster";
      document.getElementById("module_name_for_save").value =
        "savegeneralmasterDetails";
      document.getElementById("display_module_name").innerHTML =
        "General Master Setup ";
      getuserSchemaModuleType();
    }
  );
}
function getuserSchemaModuleType() {
  $.ajax({
    type: "POST",
    async: false,
    url: $host_url + "getModuleType",
    data: "type=",
    success: function populateModuleTypeResponce($responce) {
      $responce = eval("(" + $responce + ")");
      $op = "";
      $g_link_details_array = "";
      //$g_link_details_array=$responce.data['links_data'];
      document.getElementById("module_type").options.length = 0;
      document.getElementById("module_menu_name").options.length = 0;
      $op = new Option("Select One", "0");
      $op.id = "0";
      document.getElementById("module_menu_name").options.add($op);
      for ($i = 0; $i < $responce.data[0].length; $i++) {
        $op = new Option(
          $responce.data[0][$i]["type"],
          $responce.data[0][$i]["internal_code"]
        );
        $op.id = $responce.data[0][$i]["internal_code"]; //specifying the id  for options
        document.getElementById("module_type").options.add($op);
      }
      for ($i = 0; $i < $responce.data[1].length; $i++) {
        $op = new Option(
          $responce.data[1][$i]["type"],
          $responce.data[1][$i]["internal_code"]
        );
        $op.id = $responce.data[1][$i]["internal_code"]; //specifying the id  for options
        document.getElementById("module_menu_name").options.add($op);
      }
      document.getElementById("module_name").focus();

      $("#page_header").show();
      $("#page_footer").show();
    }
  });
}

function showModuleFunctionName() {
  if (document.getElementById("is_menu_only").checked == true)
    $("#row_module_function_name").show();
  else $("#row_module_function_name").hide();
}
function savegeneralmasterDetails() {
  if (trim(document.getElementById("module_name").value) == "") {
    alert("Please enter the Module Name.");
    document.getElementById("module_name").focus();
    return;
  }
  if (
    document.getElementById("is_menu_only").checked == true &&
    trim(document.getElementById("module_function_name").value) == ""
  ) {
    alert("Please enter the Formula Name.");
    document.getElementById("module_function_name").focus();
    return;
  } else {
    $is_menu_only = 0;
    var $create_table;
    $active = 0;
    $module_function_name = "";
    if (document.getElementById("is_menu_only").checked == true) {
      $is_menu_only = 1;
      $module_function_name = trim(
        document.getElementById("module_function_name").value
      );
    }
    if (document.getElementById("is_module_active").checked == true) {
      $active = 1;
    }
    if (document.getElementById("create_table").checked == true) {
      $create_table = 1;
    } else $create_table = 0;
    $display_type = $("#display_type option:selected").text();

    $is_save = 0;
    if (document.getElementById("is_user_schema_save").checked == false)
      $is_save = 0;
    else $is_save = 1;

    $is_clear = 0;
    if (document.getElementById("is_user_schema_clear").checked == false)
      $is_clear = 0;
    else $is_clear = 1;

    $is_download = 0;
    if (document.getElementById("is_user_schema_download").checked == false)
      $is_download = 0;
    else $is_download = 1;

    $is_view = 0;
    if (document.getElementById("is_user_schema_view").checked == false)
      $is_view = 0;
    else $is_view = 1;

    $is_generate = 0;
    if (document.getElementById("is_user_schema_generate").checked == false)
      $is_generate = 0;
    else $is_generate = 1;

    $is_close = 0;
    if (document.getElementById("is_user_schema_close").checked == false)
      $is_close = 0;
    else $is_close = 1;

    $lstr_query_string = "internal_code=" + $geditinternalcode;
    $lstr_query_string +=
      "&module_name=" +
      encodeURIComponent(trim(document.getElementById("module_name").value));
    $lstr_query_string +=
      "&user_schema_display_module_name=" +
      encodeURIComponent(
        trim(document.getElementById("user_schema_display_module_name").value)
      );
    $lstr_query_string +=
      "&module_type=" +
      encodeURIComponent(trim(document.getElementById("module_type").value));
    $lstr_query_string += "&is_menu_only=" + $is_menu_only;
    $lstr_query_string += "&create_table=" + $create_table;
    $lstr_query_string += "&active=" + $active;
    $lstr_query_string +=
      "&module_function_name=" + encodeURIComponent($module_function_name);
    $lstr_query_string +=
      "&main_menu=" + document.getElementById("module_menu_name").value;
    $lstr_query_string += "&display_type=" + $display_type;
    $lstr_query_string += "&is_save=" + $is_save;
    $lstr_query_string += "&is_clear=" + $is_clear;
    $lstr_query_string += "&is_download=" + $is_download;
    $lstr_query_string += "&is_view=" + $is_view;
    $lstr_query_string += "&is_generate=" + $is_generate;
    $lstr_query_string += "&is_close=" + $is_close;
    $lstr_query_string +=
      "&custom_links=" +
      encodeURIComponent(
        trim(document.getElementById("user_schema_custom_links").value)
      );
    $lstr_query_string +=
      "&module_grid_type=" +
      encodeURIComponent(
        trim(document.getElementById("module_grid_type").value)
      );
    $lstr_query_string +=
      "&grid_user_schema_coloum_names=" +
      encodeURIComponent(
        trim(document.getElementById("grid_user_schema_coloum_names").value)
      );
    $lstr_query_string +=
      "&grid_user_schema_coloum_models=" +
      encodeURIComponent(
        trim(document.getElementById("grid_user_schema_coloum_models").value)
      );
    $lstr_query_string +=
      "&grid_user_schema_grid_query=" +
      encodeURIComponent(
        trim(document.getElementById("grid_user_schema_grid_query").value)
      );
    $lstr_query_string +=
      "&grid_custom_links=" +
      encodeURIComponent(
        trim(document.getElementById("grid_custom_links").value)
      );
    $lstr_query_string +=
      "&user_schema_js_path=" +
      encodeURIComponent(
        trim(document.getElementById("user_schema_js_path").value)
      );
    $lstr_query_string +=
      "&user_schema_grid_default_rows=" +
      encodeURIComponent(
        trim(document.getElementById("user_schema_grid_default_rows").value)
      );

    $.ajax({
      type: "POST",
      url: $host_url + "insertUserSchemaMaster",
      data: $lstr_query_string,
      success: savegeneralmasterDetailsResponce
    });
  }
}

function savegeneralmasterDetailsResponce($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == 0) {
    alert($responce.data);
    $g_general_master_module_name = "";
    clear_generalmaster_fields();
    enablegeneralmaster();
    $geditinternalcode = 0;
    document.getElementById("module_name").focus();
  } else {
    alert("Insertion unsuccessfully!!");
  }
  return;
}
function getGeneralMasterDetails($id) {
  enablegeneralmaster();
  $.ajax({
    type: "POST",
    url: $host_url + "GetSchemaDetailsForUpdate",
    data: "internal_code=" + $id,
    success: function populateModuleDetalis($responce) {
      $responce = eval("(" + $responce + ")");
      if ($responce.error_code == 0) {
        $geditinternalcode = $responce.data.internal_code;
        document.getElementById("module_name").value =
          $responce.data.module_name;
        document.getElementById("user_schema_grid_default_rows").value =
          $responce.data.grid_default_rows;
        document.getElementById("user_schema_js_path").value =
          $responce.data.js_path;
        document.getElementById("user_schema_display_module_name").value =
          $responce.data.display_module_name;
        document.getElementById("module_type").value =
          $responce.data.module_type;
        document.getElementById("module_menu_name").value =
          $responce.data.main_menu;
        document.getElementById("display_type").value =
          $responce.data.display_type;
        document.getElementById("user_schema_custom_links").value =
          $responce.data.custom_links;
        document.getElementById("module_grid_type").value =
          $responce.data.grid_type;
        document.getElementById("grid_user_schema_coloum_names").value =
          $responce.data.s_col_names;
        document.getElementById("grid_user_schema_coloum_models").value =
          $responce.data.s_col_model;
        document.getElementById("grid_user_schema_grid_query").value =
          $responce.data.s_grid_query;
        document.getElementById("grid_custom_links").value =
          $responce.data.s_grid_custom_links;
        if ($responce.data.active == 1) {
          document.getElementById("is_module_active").checked = true;
        } else document.getElementById("is_module_active").checked = false;

        if ($responce.data.is_menu_only == 1) {
          document.getElementById("is_menu_only").checked = true;
          document.getElementById("module_function_name").value =
            $responce.data.menu_function;
        } else {
          document.getElementById("is_menu_only").checked = false;
          document.getElementById("module_function_name").value = "";
        }

        if ($responce.data.create_table == 1)
          document.getElementById("create_table").checked = true;
        else document.getElementById("create_table").checked = false;

        if ($responce.data.include_save == 1)
          document.getElementById("is_user_schema_save").checked = true;
        else document.getElementById("is_user_schema_save").checked = false;

        if ($responce.data.include_clear == 1)
          document.getElementById("is_user_schema_clear").checked = true;
        else document.getElementById("is_user_schema_clear").checked = false;

        if ($responce.data.include_download == 1)
          document.getElementById("is_user_schema_download").checked = true;
        else document.getElementById("is_user_schema_download").checked = false;

        if ($responce.data.include_view == 1)
          document.getElementById("is_user_schema_view").checked = true;
        else document.getElementById("is_user_schema_view").checked = false;

        if ($responce.data.include_generate == 1)
          document.getElementById("is_user_schema_generate").checked = true;
        else document.getElementById("is_user_schema_generate").checked = false;

        if ($responce.data.include_close == 1)
          document.getElementById("is_user_schema_close").checked = true;
        else document.getElementById("is_user_schema_close").checked = false;
      }
    }
  });
}

function clear_generalmaster_fields() {
  $geditinternalcode = 0;
  document.getElementById("module_name").value = "";
  document.getElementById("module_name").focus();
}
function sleep(interval) {
  var i = 0;
  while (i < interval) {
    i++;
  }
}
var $thisval;

function AssignDsplayModuleName($thisval) {
  if (document.getElementById("user_schema_display_module_name").value == "") {
    document.getElementById("user_schema_display_module_name").value = $thisval;
  }
}

var $sysname = "";
function AssignSystemName($sysname) {
  if (document.getElementById("user_schema_system_name").value == "") {
    $sysname = $sysname.replace(/[$.!@#$% ^&*//]/g, "_").toLowerCase();
    document.getElementById("user_schema_system_name").value = $sysname;
  }
}

function displayUserSchemaMaster_grid() {
  $main =
    "<table id='table_grid' class='scroll' ondblclick='selectRowId();'></table> <div id='sub_grid_div' class='scroll' style='text-align:center;'></div>";
  document.getElementById("page_main_div").innerHTML = $main;
  var user_schema = jQuery("#table_grid")
    .jqGrid({
      url: $host_url + "viewUserSchemaDetails",
      datatype: "json",
      colNames: ["Module Name", "Display Module Name", "Module type"],
      colModel: [
        { name: "grid_module_name", index: "grid_module_name", width: 100 },
        {
          name: "grid_display_module_name",
          index: "grid_display_module_name",
          width: 100
        },
        { name: "grid_module_type", index: "grid_module_type", width: 100 }
      ],
      rowNum: 20,
      rowList: [20, 30, 40, 60],
      imgpath: $img_path,
      pager: jQuery("#sub_grid_div"),
      sortname: "id",
      height: "250",
      viewrecords: true,
      sortorder: "desc",
      multiselect: true,
      cellEdit: true,
      width: "840",
      caption: "Module Details",
      editurl: $host_url + "deleteUserSchemaDetails"
    })
    .navGrid(
      "#sub_grid_div",
      { edit: false, add: false, del: true, search: true },
      {},
      {},
      {},
      { multipleSearch: true }
    )
    .navButtonAdd("#sub_grid_div", {
      caption: "Toggle",
      buttonicon: "ui-icon-pin-s",
      onClickButton: function() {
        user_schema[0].toggleToolbar();
      }
    })
    .navButtonAdd("#sub_grid_div", {
      caption: "Edit",
      onClickButton: function() {
        selectRowId();
      }
    });
  user_schema.filterToolbar();
}