Пример #1
0
  @Override
  public void renderAddEntityForm() {
    try {
      AbsEnt data = getFabric().get("div");
      LinkedHashMap<AbsEnt, String> hs = new LinkedHashMap<AbsEnt, String>();
      hs.put(
          textInput(fieldName, getReq(fieldName), "Сообщение*")
              .setAttribute(EnumAttrType.size, "80"),
          "");
      hs.put(hiddenInput("client_id", getReq("client_id")), "");
      hs.put(hiddenInput("showMenu", renders.entities.client.MENU_COMMENTS), "");

      FormOptionInterface fo = getFormOption(objectName, "add", "add");
      fo.setTitle("ОК");
      setButtonStyle(fo, BUTTON_OK);
      fo.setRenderType(RenderTypes.ajax);
      fo.setJsHandler(JsHandlers.ajax(CONTAINER_ID));
      AbsEnt form = rightForm(hs, fo);
      // AbsEnt form = standartAjaxForm(false, objectName, "add", "add", hs, "ОК",
      // getRenderConstant().OK_IMGPH);
      data.addEnt(form);
      AbsEnt Mw = standartFloatWindow("Добавить комментарий", data);
      addRenderResult(Mw.render());
    } catch (Exception ex) {
      addRenderResult(MyString.getStackExeption(ex));
    }
  }
Пример #2
0
  /** просмотр одного */
  @Override
  public void renderOneEntity() {
    try {
      AbsEnt data = div("", "", "profile", null);
      AbsEnt title = div("div", "");
      title.setValue("Тип задач");

      if (!getAr().getDinamicArrayList().isEmpty()) {
        DinamicModel dm = getAr().getDinamicArrayList().get(0);

        data.addEnt(renderParameter("Название: ", dm.get("name")));

        data.addEnt(div("", "{task_type_step:search}"));

        addRenderResult(moduleWindow(objectName, title, data, false).render());
      }
    } catch (Exception ex) {
      registerException(ex);
    }
  }
Пример #3
0
  @Override
  public void renderEntityList() {
    try {
      AbsEnt data = div("", "");
      // добавление
      FormOptionInterface afo = getFormOption(objectName, "add", "");
      afo.setTitle("Добавить");
      setButtonStyle(afo, BUTTON_ADD);
      afo.setRenderType(RenderTypes.ajax);
      afo.setJsHandler(JsHandlers.ajax(CONTAINER_ID));
      AbsEnt addForm = rightForm(null, afo);
      // AbsEnt addForm = standartAjaxForm(true, objectName, "add", "", null, "Добавить",
      // fr.getRenderConstant().ADD_IMGPH);
      addForm.addEnt(hiddenInput("client_id", getReq("client_id")));

      addForm.setAttribute(EnumAttrType.style, "float: left; margin-right: 10px; ");
      AbsEnt div = div("", "Комментарии");
      div.addEnt(addForm);

      AbsEnt table = fr.getFabric().get("table").setCss(TABLE_CLASS);
      trTh(table, div);
      for (DinamicModel dm : getActionResult().getDinamicArrayList()) {
        // tr(table, dm.get("message"));
        AbsEnt messageDiv = getFabric().get("div");
        String text =
            dateFormat(dm.get("insert_date"), getRenderConstant().DT_FULL)
                + " "
                + comboLikeString("users", "getAllWithCombo", dm.get("insert_user_id"));
        AbsEnt smallDiv = getFabric().get("div").setValue(text).setCss("small_text");
        messageDiv.addEnt(smallDiv).addEnt(div("", dm.get("message")));
        tr(table, messageDiv);
      }
      data.addEnt(table);
      addRenderResult(data.render());
    } catch (Exception ex) {
      registerException(ex);
    }
  }
Пример #4
0
  @Override
  public void renderEntityList() {
    try {
      AbsEnt title = getFabric().get("div");
      title.setValue("Настройка продлений");
      AbsEnt data = div("float:left;width:100%;", "");
      AbsEnt table = getFabric().get("table");
      // добавление
      AbsEnt add = simpleAddForm(ObjectName, null);
      data.addEnt(renderError(ObjectName));
      data.addEnt(renderMessage(ObjectName));
      data.addEnt(getAddForm());
      data.addEnt(table);
      for (DinamicModel dm : getAr().getDinamicArrayList()) {
        AbsEnt tr = getFabric().get("tr");
        table.addEnt(tr);
        AbsEnt td = getFabric().get("td");

        tr.addEnt(td);

        AbsEnt td1 = getFabric().get("td");
        td1.addEnt(getChangeForm(dm.get("prolongOption_id"), dm.get("user_id"), dm.get("number")));
        tr.addEnt(td1);

        AbsEnt td2 = getFabric().get("td");
        tr.addEnt(td2);
        Map<String, Object> mp = new HashMap<String, Object>();
        mp.put("prolongOption_id", dm.get("prolongOption_id"));
        AbsEnt form = simpleDeleteForm(ObjectName, mp);
        td2.addEnt(form);
      }
      AbsEnt Mw = moduleWindow(ObjectName, title, data, false);
      Mw.setAttribute(EnumAttrType.style, "margin-top:5px;");
      addRenderResult(Mw.render());
    } catch (Exception ex) {
      registerException(ex);
    }
  }
Пример #5
0
 @Override
 public void renderAddEntityForm() {
   try {
     AbsEnt data = div("position:absolute;width:18%;z-index:1;bottom:100;", null);
     data.addEnt(renderError(ObjectName));
     data.addEnt(renderMessage(ObjectName));
     Map<AbsEnt, String> inn = new HashMap<AbsEnt, String>();
     AbsEnt input = combo("managerPhones", "findActive", null, "manager_phone_id");
     inn.put(input, "");
     AbsEnt ae =
         rightForm(
             Boolean.TRUE,
             ObjectName,
             "add",
             "add",
             inn,
             "Добавить",
             getRenderConstant().ADD_IMGPH);
     data.addEnt(ae);
     addRenderResult(data.render());
   } catch (Exception e) {
     registerException(e);
   }
 }
Пример #6
0
  /** новый отчет */
  public void report() {
    try {
      // отсортировать по пользователям и по типам
      Map<String, Day> days = new LinkedHashMap();
      List<String> types = new ArrayList();
      Map<String, Integer> sumMap = new LinkedHashMap();
      int totalSumm = 0;

      for (DinamicModel model : getAr().getDinamicArrayList()) {
        if (model.get("insert_user_id") != null
            && model.get("manager_phone_id") != null
            && model.get("date") != null) {
          String date = model.get("date").toString();
          if (!days.containsKey(date)) {
            days.put(date, new Day());
          }

          Day day = days.get(date);
          day.add(model.get("insert_user_id"), model.get("manager_phone_id"), model.get("count"));
          String type = model.get("manager_phone_id").toString();
          if (!types.contains(type)) {
            types.add(type);
          }
        }
      }

      AbsEnt title = div("float:left;", "Отчет по звонкам");
      AbsEnt data = div("float:left;", "");
      data.addEnt(renderError(ObjectName));
      data.addEnt(renderMessage(ObjectName));
      data.addEnt(getFormReport());
      AbsEnt table = getFabric().get("table");
      table.setAttribute(EnumAttrType.border, "1");
      table.setAttribute(EnumAttrType.cellpadding, "5");
      table.setAttribute(EnumAttrType.cellspacing, "5");

      if (!types.isEmpty()) {

        // заголовок таблицы
        AbsEnt th1 = getFabric().get("th");
        AbsEnt tr1 = getFabric().get("tr").addEnt(th1);
        table.addEnt(tr1);
        th1.setValue("Пользователь");
        for (String type : types) {
          String name = comboLikeString("managerPhones", "findActive", type);
          tr1.addEnt(getFabric().get("th").setValue(name));
        }
        tr1.addEnt(getFabric().get("th").setValue("Всего"));

        // по дням
        for (String date : days.keySet()) {

          Map<String, Integer> summMapDay = new LinkedHashMap();
          Integer summDay = 0;

          Day day = days.get(date);

          AbsEnt tdDay = getFabric().get("td");
          AbsEnt trDay = getFabric().get("tr").addEnt(tdDay);
          table.addEnt(trDay);

          Integer colspan = types.size() + 2;
          tdDay.setAttribute(EnumAttrType.colspan, colspan.toString());
          date = dateFormat(date, getRenderConstant().DT_SMALL);
          tdDay.setValue("Дата: " + date);
          tdDay.setAttribute(EnumAttrType.style, "font-weight: bold;");
          Map<String, User> users = day.getUsers();
          // строки по пользователям
          for (String userId : users.keySet()) {
            User user = users.get(userId);
            String userName = comboLikeString("userProfile", "getAllWithComboName", userId);
            AbsEnt td1 = getFabric().get("td");
            AbsEnt tr = getFabric().get("tr");
            table.addEnt(tr.addEnt(td1));
            td1.setValue(userName);
            for (String type : types) {

              Integer count = user.getCount(type);
              if (count == null) {
                count = 0;
              }
              AbsEnt td = getFabric().get("td");
              tr.addEnt(td);
              td.setValue(count);

              // сложить сумму
              if (!sumMap.containsKey(type)) {
                sumMap.put(type, 0);
              }
              if (!summMapDay.containsKey(type)) {
                summMapDay.put(type, 0);
              }
              sumMap.put(type, sumMap.get(type) + count);
              summMapDay.put(type, summMapDay.get(type) + count);
            }
            int summ = user.getSumm();
            totalSumm += summ;
            summDay += summ;
            AbsEnt td2 = getFabric().get("td");
            td2.setValue(summ);
            tr.addEnt(td2);
          }

          // строка с суммой по дню
          AbsEnt tr2 = getFabric().get("tr");
          table.addEnt(tr2);
          tr2.setAttribute(EnumAttrType.style, "font-weight: bold;");
          AbsEnt td1 = getFabric().get("td");
          tr2.addEnt(td1);
          td1.setValue("Всего за день:");
          for (Integer summ : summMapDay.values()) {
            AbsEnt td = getFabric().get("td");
            tr2.addEnt(td);
            td.setValue(summ);
          }

          AbsEnt td2 = getFabric().get("td");
          tr2.addEnt(td2);
          td2.setValue(summDay);
        }

        // строка с итоговой суммой
        AbsEnt tr2 = getFabric().get("tr");
        table.addEnt(tr2);
        tr2.setAttribute(EnumAttrType.style, "font-weight: bold;");
        AbsEnt td1 = getFabric().get("td");
        tr2.addEnt(td1);
        td1.setValue("Всего");
        for (Integer summ : sumMap.values()) {
          AbsEnt td = getFabric().get("td");
          tr2.addEnt(td);
          td.setValue(summ);
        }
        AbsEnt td2 = getFabric().get("td");
        tr2.addEnt(td2);
        td2.setValue(totalSumm);
      }

      data.addEnt(table);
      AbsEnt Mw = moduleWindow(ObjectName, title, data, false);
      Mw.setAttribute(EnumAttrType.style, "margin-top:5px;");
      addRenderResult(Mw.render());
    } catch (Exception e) {
      registerException(e);
    }
  }
Пример #7
0
  @Override
  public void renderEntityList() {
    try {
      AbsEnt title = getFabric().get("div");
      title.setValue("Типы  задач");
      AbsEnt data = div("float:left;width:100%;", "");
      AbsEnt table = getFabric().get("table");
      // добавление
      AbsEnt add = simpleAddForm(objectName, null);
      data.addEnt(renderError(objectName));
      data.addEnt(renderMessage(objectName));
      data.addEnt(getAddForm());
      data.addEnt(table);
      for (DinamicModel dm : getAr().getDinamicArrayList()) {
        AbsEnt tr = getFabric().get("tr");
        table.addEnt(tr);
        AbsEnt td = getFabric().get("td");

        tr.addEnt(td);

        AbsEnt td1 = getFabric().get("td");
        td1.addEnt(
            getChangeForm(
                dm.get("task_type_id"),
                dm.get("name"),
                dm.get("showInLinks"),
                dm.get("daysToDead")));
        tr.addEnt(td1);

        AbsEnt td2 = getFabric().get("td");
        tr.addEnt(td2);
        Map<String, Object> mp = new HashMap<String, Object>();
        mp.put("task_type_id", dm.get("task_type_id"));
        AbsEnt form = simpleDeleteForm(objectName, mp);
        td2.addEnt(form);

        AbsEnt td3 = getFabric().get("td");
        HrefOptionInterface ho = getHrefOption(objectName, "showOne", "", "Изменить этапы");
        AbsEnt href = href(mp, ho);
        td3.addEnt(href);
        tr.addEnt(td3);
      }
      AbsEnt Mw = moduleWindow(objectName, title, data, false);
      Mw.setAttribute(EnumAttrType.style, "margin-top:5px;");
      addRenderResult(Mw.render());
    } catch (Exception ex) {
      registerException(ex);
    }
  }