Sha256: 488bc8991c01179ff0c5987933c7266bd071bb5bcc9f2588be05121b87a9323d

Contents?: true

Size: 1.86 KB

Versions: 1

Compression:

Stored size: 1.86 KB

Contents

<%
  print _site.header(_("Search for customers"))
%>

<form method="get">
<%=Knj::Web.hiddens([{:name => :show, :value => :customer_search}, {:name => :choice, :value => :dosearch}])%>

<%=_site.boxt(_("Enter criteria"), "350px")%>
  <table class="form">
    <%
      print Knj::Web.inputs([{
        :title => _("Name"),
        :name => :texname,
        :value => _get["texname"],
        :descr => _("A part of the customers name which you are looking for.")
      }])
    %>
    <tr>
      <td colspan="2" class="buttons">
        <input type="button" value="<%=_("Add new customer")%>" onclick="location.href='?show=customer_edit';" />
        <input type="submit" value="<%=_("Search")%>" />
      </td>
    </tr>
  </table>
<%=_site.boxb%>

</form>

<script type="text/javascript">
  $("#texname").focus();
</script>

<%
  if _get["choice"] == "dosearch"
    args = {"orderby" => "name"}
    
    if _get["texname"].to_s.length > 0
      args["name_search"] = _get["texname"]
    end
    
    customers = _ob.list(:Customer, args)
    
    %>
      <br />
      
      <%=_site.boxt(_("Results"), "350px")%>
        <table class="list">
          <thead>
            <tr>
              <th><%=_("Customer")%></th>
            </tr>
          </thead>
          <tbody>
            <%
              customers.each do |customer|
                %>
                  <tr>
                    <td>
                      <%=customer.html%>
                    </td>
                  </tr>
                <%
              end
              
              if customers.empty?
                %>
                  <tr>
                    <td colspan="1" class="error">
                      <%=_("No customers were found.")%>
                    </td>
                  </tr>
                <%
              end
            %>
          </tbody>
        </table>
      <%=_site.boxb%>
    <%
  end
%>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
knjtasks-0.0.3 pages/customer_search.rhtml