Показать сообщение отдельно
  #4 (permalink)  
Старый 06.04.2015, 14:11
Интересующийся
Отправить личное сообщение для Нияз Посмотреть профиль Найти все сообщения от Нияз
 
Регистрация: 06.04.2015
Сообщений: 17

showInfo("Заполните все обязательные поля");
        markRequiredGroups();
        return;
      }

      var showCladdrError = function () {
        showInfo("Заполните адрес в параметрах здания до уровня дом");
      }

      var urlToSave = "";
      if (USER_GROUP == "JUR_GROUP") {
        urlToSave = "/app/contract/connectionpoint/save2";
        if (!me.cpCladdr.house) {
          showCladdrError();
          return;
        }
      } else {
        urlToSave = "/app/contract/connectionpoint/save2";
        if (!me.baCladdr.house) {
          showCladdrError();
          return;
        }
      }

      $.ajax({
        type: "post",
        data: $("#form-connpoint").serialize(),
        url: urlToSave,
        success: function (resp) {
          showSuccess("Точка расчета успешно сохранена.");
//          $.cookie("data['connpoint_id']", resp);
          goto("/connpoint", resp);
          $("#btn-add-norm").removeAttr("disabled");
        },
        error: function (e) {
          showError('Ошибка: ' + e.statusText);
        }
      });
    });

    $("#btn-reset").click(function () {
      $("#form-connpoint").each(function () {
        this.reset();
      });
      showSuccess("Все изменения отменены.");
    });

  },

  loadFromCookies: function () {
    var me = this;
    var cookie = $.cookie("data['connpoint_union_id']");
    if (cookie) {
      $("#connpoint-union-id").val(cookie);
      $.cookie("data['connpoint_union_id']", null);
    }
    cookie = $.cookie("data['connection_union_name']");
    if (cookie) {
      $("#connection-union-name").val(cookie);
      $.cookie("data['connection_union_name']", null);
    }
    cookie = $.cookie("data['contract_id']");
    if (cookie) {
      $("#contract-id").val(cookie);
      $.cookie("data['contract_id']", null);
    }


    cookie = $.cookie("cityId");
    var city;
    if (cookie) {
      city = { id: cookie, name: $.cookie("cityName") };
      //$.cookie("cityId", null);
      //$.cookie("cityName", null);
    }

    cookie = $.cookie("districtId");
    var district;
    if (cookie) {
      district = { id: cookie, name: $.cookie("districtName") };
      //$.cookie("districtId", null);
      //$.cookie("districtName", null);
    }

    cookie = $.cookie("streetId");
    var street;
    if (cookie) {
      street = { id: cookie, name: $.cookie("streetName") };
      //$.cookie("streetId", null);
      //$.cookie("streetName", null);
    }

    cookie = $.cookie("houseNumber");
    var house;
    if (cookie) {
      house = cookie;
      //$.cookie("houseNumber", null);
    }

    if (USER_GROUP != "JUR_GROUP") {
      if (!me.connPointId) {
//      setCladdrValue($("#ba_claddr"), city, district, street, house);
        me.baCladdr.setAddress(city, district, street, house, null);
        me.cpCladdr.setAddress(city, district, street, house, null);
      }
    }
  },

  loadContractObjectCalcPointsList: function (filters) {
    $("#cp-norms-list").cofTable({dataUrl: '/app/contract/connectionpoint/norms/list',
      params: {filter: JSON.stringify(filters)},
      afterLoad: function (table) {
        table.find("tbody tr").dblclick(function () {
          var cpNormsId = $(this).data("id");
          goto("/connpointnorms", cpNormsId);
        });
      }
    });
  },
  loadAccountDevicesList: function (filters) {
    var me = this;
    $("#cp-accDevices-list").cofTable({dataUrl: '/app/contract/connectionpoint/accdevices/list',
      actionBar: $("#cpAccDevices .action-bar"),
      params: {filter: JSON.stringify(filters)},
      afterLoad: function (table) {
        var tr = table.find("tbody tr");
        if (tr.length > 0) {
          $("#btn-add-accDevice").addClass("disabled");
          tr.dblclick(function () {
            var accDevId = $(this).data("id");
            $.cookie("data['connpoint_id']", me.connPointId);
            goto("/card_accdevice", accDevId);
          });
        } else {
          $("#btn-add-accDevice").removeClass("disabled");
        }
      }
    });
  },
  loadSubabonentsList: function (filters) {
    $("#cp-subabonents-list").cofTable({dataUrl: '/app/contract/connectionpoint/subabonents/list',
      params: {filter: JSON.stringify(filters)},
      afterLoad: function (table) {
        table.find("tbody tr").dblclick(function () {
//                    var cpNormsId = $(this).data("id");
//                    goto("/connpointnorms", cpNormsId);
        });
      }
    });
  },
  loadAccountChangeList: function (filters) {
    $("#cp-accountchange-list").cofTable({dataUrl: '/app/contract/connectionpoint/accountchange/list',
      params: {filter: JSON.stringify(filters)},
      afterLoad: function (table) {
        table.find("tbody tr").dblclick(function () {
//                    var cpNormsId = $(this).data("id");
//                    goto("/connpointnorms", cpNormsId);
        });
      }
    });
  },
  loadPlombs1List: function (filters) {
    var me = this;
    $("#cp-plombs-list").cofTable({dataUrl: '/app/contract/connectionpoint/plombs1/list',
      params: {filter: JSON.stringify(filters)},
      afterLoad: function (table) {
        table.find("tbody tr").dblclick(function () {
          var id = $(this).data("id");
          goto("/loopline", id);
        });

        table.find("tbody tr").click(function () {
          var id = $(this).data("id");
          me.loadPlombs2List([
            {field: "connectionPointLoopline.id", value: id, filterType: "EQ"}
          ]);
          $("#btn-add-looplinevalveseal").attr("disabled", false);
        });
      }
    });
  },

  loadPlombs2List: function (filters) {
    $("#cp-plombs-list2").cofTable({dataUrl: '/app/contract/connectionpoint/plombs2/list',
      params: {filter: JSON.stringify(filters)},
      afterLoad: function (table) {
        table.find("tbody tr").dblclick(function () {
          var id = $(this).data("id");
          goto("/looplinevalveseal", id);
        });
      }
    });
  },

  loadChargesList: function (filters) {
    $("#cp-invoices-list").cofTable({dataUrl: '/app/contract/connectionpoint/charges/list',
      params: {filter: JSON.stringify(filters)},
      afterLoad: function (table) {
//        table.find("tbody tr").dblclick(function () {
//          var id = $(this).data("id");
//          goto("/charge", id);
//        });
      }
    });
  }
}
Ответить с цитированием