|
- <% Flash().ShowErrorsIfPresent : Flash().ShowSuccessIfPresent %>
-
- <nav aria-label="breadcrumb">
- <ol class="breadcrumb small mb-2">
- <li class="breadcrumb-item"><a href="/businesses">Businesses</a></li>
- <li class="breadcrumb-item active" aria-current="page">Add business</li>
- </ol>
- </nav>
-
- <h1 class="h3 mb-3">Add business</h1>
-
- <div class="row">
- <div class="col-lg-7">
- <% If Not dup Is Nothing Then %>
- <div class="alert alert-warning small">
- <i class="bi bi-exclamation-triangle"></i>
- Nothing was saved yet. The <%= dup("matched") %> you entered is already used by
- <a href="/businesses/<%= dup("id") %>" target="_blank" rel="noopener"><%= H(dup("name")) %></a>.
- Fix it, or press <strong>Save anyway</strong> to add it as a second business.
- </div>
- <% End If %>
-
- <div class="card shadow-sm mb-3">
- <div class="card-body">
- <form method="post" action="/business/create">
- <input type="hidden" name="csrf" value="<%= H(csrf) %>" />
- <% If Not dup Is Nothing Then %><input type="hidden" name="allow_duplicate" value="1" /><% End If %>
-
- <div class="mb-2">
- <label class="form-label small mb-1" for="f_name">Business name</label>
- <input type="text" class="form-control form-control-sm" id="f_name" name="name" value="<%= H(fv("name")) %>" maxlength="255" required autofocus />
- </div>
- <div class="mb-2">
- <label class="form-label small mb-1" for="f_contact">Contact</label>
- <input type="text" class="form-control form-control-sm" id="f_contact" name="contact_name" value="<%= H(fv("contact_name")) %>" maxlength="150" />
- </div>
- <div class="row g-2 mb-2">
- <div class="col-6">
- <label class="form-label small mb-1" for="f_phone">Phone</label>
- <input type="text" class="form-control form-control-sm" id="f_phone" name="phone" value="<%= H(fv("phone")) %>" maxlength="40" />
- </div>
- <div class="col-6">
- <label class="form-label small mb-1" for="f_email">Email</label>
- <input type="text" class="form-control form-control-sm" id="f_email" name="email" value="<%= H(fv("email")) %>" maxlength="255" />
- </div>
- </div>
- <div class="mb-2">
- <label class="form-label small mb-1" for="f_web">Website</label>
- <input type="text" class="form-control form-control-sm" id="f_web" name="website" value="<%= H(fv("website")) %>" maxlength="255" />
- </div>
- <div class="mb-2">
- <label class="form-label small mb-1" for="f_addr">Address</label>
- <input type="text" class="form-control form-control-sm" id="f_addr" name="address1" value="<%= H(fv("address1")) %>" maxlength="255" />
- </div>
- <div class="row g-2 mb-2">
- <div class="col-5"><label class="form-label small mb-1" for="f_city">City</label><input type="text" class="form-control form-control-sm" id="f_city" name="city" value="<%= H(fv("city")) %>" maxlength="100" /></div>
- <div class="col-3"><label class="form-label small mb-1" for="f_state">State</label><input type="text" class="form-control form-control-sm" id="f_state" name="state" value="<%= H(fv("state")) %>" maxlength="50" /></div>
- <div class="col-4"><label class="form-label small mb-1" for="f_zip">Zip</label><input type="text" class="form-control form-control-sm" id="f_zip" name="zip" value="<%= H(fv("zip")) %>" maxlength="20" /></div>
- </div>
- <div class="row g-2 mb-2">
- <div class="col-6">
- <label class="form-label small mb-1" for="f_ind">Industry</label>
- <select class="form-select form-select-sm" id="f_ind" name="industry_id">
- <option value="">(none)</option>
- <% For Each indKey2 In industries.Keys %>
- <option value="<%= indKey2 %>"<% If CStr(fv("industry_id") & "") = indKey2 Then Response.Write " selected" %>><%= H(industries(indKey2)) %></option>
- <% Next %>
- </select>
- </div>
- <div class="col-6">
- <label class="form-label small mb-1" for="f_indnew">…or add new</label>
- <input type="text" class="form-control form-control-sm" id="f_indnew" name="industry_new" maxlength="100" value="<% If fv.Exists("_industry_new") Then Response.Write H(fv("_industry_new")) %>" />
- </div>
- </div>
- <fieldset class="mb-2">
- <legend class="form-label small mb-1">Areas served</legend>
- <% If allAreas.Count > 0 Then %>
- <div class="border rounded px-2 py-1 mb-1" style="max-height:9rem;overflow-y:auto">
- <% For ix = 0 To allAreas.Count - 1 %>
- <div class="form-check form-check-inline">
- <input class="form-check-input" type="checkbox" id="f_area_<%= allAreas(ix)("id") %>" name="area_ids" value="<%= allAreas(ix)("id") %>"<% If areaSel.Exists(CStr(allAreas(ix)("id"))) Then Response.Write " checked" %> />
- <label class="form-check-label small" for="f_area_<%= allAreas(ix)("id") %>"><%= H(allAreas(ix)("name")) %></label>
- </div>
- <% Next %>
- </div>
- <% End If %>
- <label class="visually-hidden" for="f_areanew">Add new areas</label>
- <input type="text" class="form-control form-control-sm" id="f_areanew" name="area_new" maxlength="500" placeholder="<% If allAreas.Count > 0 Then Response.Write "…or add new, comma-separated" Else Response.Write "e.g. Dallas, Fort Worth" %>" value="<% If fv.Exists("_area_new") Then Response.Write H(fv("_area_new")) %>" />
- </fieldset>
- <div class="row g-2 mb-2 align-items-end">
- <div class="col-6">
- <div class="form-check">
- <input class="form-check-input" type="checkbox" id="f_cust" name="is_customer" value="1"<% If fv("is_customer") & "" = "1" Then Response.Write " checked" %> />
- <label class="form-check-label small" for="f_cust">Previous customer</label>
- </div>
- </div>
- <div class="col-6">
- <label class="form-label small mb-1" for="f_first">First order</label>
- <input type="date" class="form-control form-control-sm" id="f_first" name="first_order_date" value="<%= Date_Iso(fv("first_order_date")) %>" />
- </div>
- </div>
- <div class="mb-3">
- <label class="form-label small mb-1" for="f_notes">Notes</label>
- <textarea class="form-control form-control-sm" id="f_notes" name="notes" rows="4" maxlength="10000"><%= H(fv("notes")) %></textarea>
- </div>
- <button type="submit" class="btn <% If dup Is Nothing Then Response.Write "btn-primary" Else Response.Write "btn-warning" %> btn-sm"><% If dup Is Nothing Then Response.Write "Add business" Else Response.Write "Save anyway" %></button>
- <a href="/businesses" class="btn btn-outline-secondary btn-sm">Cancel</a>
- </form>
- </div>
- </div>
- </div>
- </div>
|