Refactor and add securities controller
This commit is contained in:
8
lib/tradex_web/controllers/security_html/edit.html.heex
Normal file
8
lib/tradex_web/controllers/security_html/edit.html.heex
Normal file
@@ -0,0 +1,8 @@
|
||||
<.header>
|
||||
Edit Security {@security.id}
|
||||
<:subtitle>Use this form to manage security records in your database.</:subtitle>
|
||||
</.header>
|
||||
|
||||
<.security_form changeset={@changeset} action={~p"/securities/#{@security}"} />
|
||||
|
||||
<.back navigate={~p"/securities"}>Back to securities</.back>
|
28
lib/tradex_web/controllers/security_html/index.html.heex
Normal file
28
lib/tradex_web/controllers/security_html/index.html.heex
Normal file
@@ -0,0 +1,28 @@
|
||||
<.header>
|
||||
Listing Securities
|
||||
<:actions>
|
||||
<.link href={~p"/securities/new"}>
|
||||
<.button>New Security</.button>
|
||||
</.link>
|
||||
</:actions>
|
||||
</.header>
|
||||
|
||||
<.table id="securities" rows={@securities} row_click={&JS.navigate(~p"/securities/#{&1}")}>
|
||||
<:col :let={security} label="Name">{security.name}</:col>
|
||||
<:col :let={security} label="Ticker">{security.ticker}</:col>
|
||||
<:col :let={security} label="Wkn">{security.wkn}</:col>
|
||||
<:col :let={security} label="Isin">{security.isin}</:col>
|
||||
<:col :let={security} label="Expiration date">{security.expiration_date}</:col>
|
||||
<:col :let={security} label="Strike price">{security.strike_price}</:col>
|
||||
<:action :let={security}>
|
||||
<div class="sr-only">
|
||||
<.link navigate={~p"/securities/#{security}"}>Show</.link>
|
||||
</div>
|
||||
<.link navigate={~p"/securities/#{security}/edit"}>Edit</.link>
|
||||
</:action>
|
||||
<:action :let={security}>
|
||||
<.link href={~p"/securities/#{security}"} method="delete" data-confirm="Are you sure?">
|
||||
Delete
|
||||
</.link>
|
||||
</:action>
|
||||
</.table>
|
8
lib/tradex_web/controllers/security_html/new.html.heex
Normal file
8
lib/tradex_web/controllers/security_html/new.html.heex
Normal file
@@ -0,0 +1,8 @@
|
||||
<.header>
|
||||
New Security
|
||||
<:subtitle>Use this form to manage security records in your database.</:subtitle>
|
||||
</.header>
|
||||
|
||||
<.security_form changeset={@changeset} action={~p"/securities"} />
|
||||
|
||||
<.back navigate={~p"/securities"}>Back to securities</.back>
|
@@ -0,0 +1,14 @@
|
||||
<.simple_form :let={f} for={@changeset} action={@action}>
|
||||
<.error :if={@changeset.action}>
|
||||
Oops, something went wrong! Please check the errors below.
|
||||
</.error>
|
||||
<.input field={f[:name]} type="text" label="Name" />
|
||||
<.input field={f[:ticker]} type="text" label="Ticker" />
|
||||
<.input field={f[:wkn]} type="text" label="Wkn" />
|
||||
<.input field={f[:isin]} type="text" label="Isin" />
|
||||
<.input field={f[:expiration_date]} type="date" label="Expiration date" />
|
||||
<.input field={f[:strike_price]} type="number" label="Strike price" step="any" />
|
||||
<:actions>
|
||||
<.button>Save Security</.button>
|
||||
</:actions>
|
||||
</.simple_form>
|
20
lib/tradex_web/controllers/security_html/show.html.heex
Normal file
20
lib/tradex_web/controllers/security_html/show.html.heex
Normal file
@@ -0,0 +1,20 @@
|
||||
<.header>
|
||||
Security {@security.id}
|
||||
<:subtitle>This is a security record from your database.</:subtitle>
|
||||
<:actions>
|
||||
<.link href={~p"/securities/#{@security}/edit"}>
|
||||
<.button>Edit security</.button>
|
||||
</.link>
|
||||
</:actions>
|
||||
</.header>
|
||||
|
||||
<.list>
|
||||
<:item title="Name">{@security.name}</:item>
|
||||
<:item title="Ticker">{@security.ticker}</:item>
|
||||
<:item title="Wkn">{@security.wkn}</:item>
|
||||
<:item title="Isin">{@security.isin}</:item>
|
||||
<:item title="Expiration date">{@security.expiration_date}</:item>
|
||||
<:item title="Strike price">{@security.strike_price}</:item>
|
||||
</.list>
|
||||
|
||||
<.back navigate={~p"/securities"}>Back to securities</.back>
|
Reference in New Issue
Block a user