mirror of
https://github.com/netfun2000/hipudding-teslamate.git
synced 2026-02-27 09:44:28 +08:00
* feat: update to Phenix HTML 4.1 * fix: updating to the new Gettext.Backend approach * chore: update pot files ro locale version 45.0.0 * fix: downgrade cloack back to 1.1.2 * revert: merge of mix.lock * fix: new syntax for field name generation for phx-feedback-for * Revert "fix: new syntax for field name generation for phx-feedback-for" This reverts commit 4d95e4f1c9367d2d5c606ced2190ab23edcb971b. * fix: downgrade floki back to 0.35.2 * Revert "fix: downgrade floki back to 0.35.2" This reverts commit a4f0b6bf4b32099d89003c3d20f72333d510e109. * fix: ensure floki nil is handled * style: linter findings * Revert "fix: ensure floki nil is handled" * fix: new syntax for field name generation for phx-feedback-for * debug: floki paramter error * Revert "debug: floki paramter error" This reverts commit 61920267edf5186b593920bde7d87e8b30af55aa. * fix: Remove unnecessary code in settings_test.exs which breaks floki 0.36+
182 lines
5.3 KiB
Plaintext
182 lines
5.3 KiB
Plaintext
<nav class="breadcrumb" aria-label="breadcrumbs">
|
|
<ul>
|
|
<li><.link navigate={~p"/"}><%= gettext("Home") %></.link></li>
|
|
<li><.link navigate={~p"/geo-fences"}><%= gettext("Geo-Fences") %></.link></li>
|
|
<li class="is-active">
|
|
<a href="#">
|
|
<%= case @action do
|
|
:new -> Ecto.Changeset.get_field(@changeset, :name) || "…"
|
|
:edit -> @geofence.name
|
|
end %>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
|
|
<.form :let={f} for={@changeset} phx-change="validate" phx-submit="save" class="geofence">
|
|
<div class="field is-horizontal">
|
|
<div class="field-label is-normal">
|
|
<%= label(f, :position, gettext("Position"), class: "label") %>
|
|
</div>
|
|
<div class="field-body">
|
|
<div class="field">
|
|
<div class="control">
|
|
<div id="map_container" phx-update="ignore">
|
|
<figure id="map" style="height: 400px; position: relative;" phx-hook="Map"></figure>
|
|
</div>
|
|
<%= hidden_input(f, :latitude) %>
|
|
<%= hidden_input(f, :longitude) %>
|
|
<%= hidden_input(f, :radius) %>
|
|
</div>
|
|
<%= if @show_errors do %>
|
|
<p class="help is-danger">
|
|
<%= error_tag(f, :address_id) %>
|
|
<%= error_tag(f, :latitude) %>
|
|
<%= error_tag(f, :longitude) %>
|
|
<%= error_tag(f, :radius) %>
|
|
</p>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="field is-horizontal">
|
|
<div class="field-label is-normal">
|
|
<%= label class: "label" do
|
|
gettext("Name")
|
|
end %>
|
|
</div>
|
|
<div class="field-body">
|
|
<div class="field is-expanded">
|
|
<div class="control">
|
|
<%= text_input(f, :name, class: "input", placeholder: gettext("Name")) %>
|
|
</div>
|
|
<%= if @show_errors do %>
|
|
<p class="help is-danger"><%= error_tag(f, :name) %></p>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="field is-horizontal mt-4">
|
|
<div class="field-label is-normal">
|
|
<%= label class: "label" do
|
|
gettext("Cost")
|
|
end %>
|
|
</div>
|
|
<div class="field-body">
|
|
<div class="field has-addons">
|
|
<p class="control">
|
|
<span class="select">
|
|
<%= select(f, :billing_type, [
|
|
{gettext("Per kWh"), :per_kwh},
|
|
{gettext("Per Minute"), :per_minute}
|
|
]) %>
|
|
</span>
|
|
</p>
|
|
<p class="control is-expanded">
|
|
<%= text_input(f, :cost_per_unit,
|
|
class: "input",
|
|
type: :number,
|
|
inputmode: :decimal,
|
|
step: 0.0001,
|
|
placeholder: "0.00"
|
|
) %>
|
|
</p>
|
|
<%= if @show_errors do %>
|
|
<p class="help is-danger"><%= error_tag(f, :cost_per_unit) %></p>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="field is-horizontal">
|
|
<div class="field-label is-normal">
|
|
<%= label class: "label" do
|
|
gettext("Session fee")
|
|
end %>
|
|
</div>
|
|
<div class="field-body">
|
|
<div class="field">
|
|
<div class="control">
|
|
<%= text_input(f, :session_fee,
|
|
class: "input",
|
|
type: :number,
|
|
inputmode: :decimal,
|
|
min: 0.0,
|
|
step: 0.01,
|
|
placeholder: "0.00"
|
|
) %>
|
|
</div>
|
|
<%= if @show_errors do %>
|
|
<p class="help is-danger"><%= error_tag(f, :session_fee) %></p>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="field is-horizontal mt-5">
|
|
<div class="field-label"></div>
|
|
<div class="field-body">
|
|
<div class="field is-grouped">
|
|
<div class="control">
|
|
<.link navigate={Routes.live_path(@socket, GeoFenceLive.Index)} class="button">
|
|
<%= gettext("Back") %>
|
|
</.link>
|
|
</div>
|
|
<div class="control">
|
|
<%= submit(gettext("Save"),
|
|
phx_disable_with: gettext("Saving..."),
|
|
class: "button is-info"
|
|
) %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</.form>
|
|
|
|
<div
|
|
id="charging_cost_modal"
|
|
class={[
|
|
"modal modal-fx-fadeInScale",
|
|
if(@show_modal, do: "is-active"),
|
|
if(not @connected?, do: "is-hidden")
|
|
]}
|
|
phx-hook="Modal"
|
|
>
|
|
<div
|
|
class="modal-background"
|
|
phx-click="close-modal"
|
|
{if @show_modal, do: [phx_window_keyup: "keyup"], else: []}
|
|
>
|
|
</div>
|
|
<div class="modal-card modal-content">
|
|
<header class="modal-card-head">
|
|
<p class="modal-card-title"><%= gettext("Charging Costs") %></p>
|
|
<button class="button is-text is-rounded" aria-label="close" phx-click="close-modal">
|
|
<span class="icon is-small"><i class="mdi mdi-close"></i></span>
|
|
</button>
|
|
</header>
|
|
<section class="modal-card-body">
|
|
<p>
|
|
<%= raw(
|
|
ngettext(
|
|
"There is <strong>%{n} charging session</strong> at this location for which no costs have been added yet.",
|
|
"There are <strong>%{n} charging sessions</strong> at this location for which no costs have been added yet.",
|
|
@charges_without_costs,
|
|
n: @charges_without_costs
|
|
)
|
|
) %>
|
|
</p>
|
|
</section>
|
|
<footer class="modal-card-foot">
|
|
<button class="button" phx-click="calc-costs" phx-value-result="no">
|
|
<%= gettext("Continue") %>
|
|
</button>
|
|
<button class="button is-info" phx-click="calc-costs" phx-value-result="yes">
|
|
<%= gettext("Add costs retroactively") %>
|
|
</button>
|
|
</footer>
|
|
</div>
|
|
</div>
|