us-dop-api/assets/templates/components/institution.html.tmpl
2024-07-21 11:30:05 -04:00

77 lines
2.6 KiB
Cheetah

{{ define "card" }}
{{ if ne .InstRequested "" }}
{{ $inst := .InstRequested }}
{{ range .Results }}
<div class="card">
<p class="inst-name">
{{ .Name }}
<span class="institucion">{{ $inst }}</span>
</p>
<a class="inst-link" href="/api/instituciones/{{ .Institution.Name }}/history?ta=4&tf=week&format=html">{{ .Institution.Name }}</a>
</div>
{{ end }}
{{ end }}
{{ end }}
<!-- definicion de lista -->
{{ define "list" }}
{{ if ne .InstRequested "" }}
{{ $inst := .InstRequested }}
<div id="inst-result-list-container" {{if eq $inst "all"}} x-show="comparerpage" {{ end }}>
<ul id="inst-result-list">
{{ range $idx, $obj := .Results }}
{{$idname := .Institution.Name | replace " " "-" }}
<li class="card">
{{ $name := .Institution.Name | replace " dominicano" "" | replace "asociacion " "a "| replace " de ahorros y prestamos" ""| replace " cambio online" "" | replace " " "-" }}
{{ $idname := .Institution.Name| replace " " "-" }}
<button
class="inst-link btn-{{ $idx }}"
name="{{ $idname }}"
style='{{ if eq $idname "banco-vimenca" }} background-color:#1789E1 {{ end }}'
{{ if ne $inst "all" }}
href="/api/instituciones/{{ $obj.Institution.Name }}/history?ta=4&tf=week&format=html"
x-bind:class='instSelected === "{{ $obj.Institution.Name }}" ? "opened" : ""'
@click='
open = true;
instSelected = "{{ $obj.Institution.Name }}";
instSelectedImage = "/static/img/{{ $name }}.png";
resetTableC();
'
{{ else }}
x-init="buttoninst['{{ $idname }}'] = false;"
@click='toglediv; buttoninst["{{ $idname }}"] = ! buttoninst["{{ $idname }}"];'
x-bind:class="buttoninst['{{ $idname }}'] ? 'opened' : '' "
href="/"
hx-target="id-{{ .Institution.Name }}"
{{ end }}
>
<img class="img-{{ $idx }}" name="{{ $idname }}" src='/static/img/{{ $name }}.png' alt="bank logo" >
</button>
</li>
{{ end }}
</ul>
</div>
{{ if eq $inst "all" }}
<div>
<div id="control-compra-venta">
<label>Compra</label>
<input type="radio" value="compra" @change="calcvalue" x-on:input="compoperation = 'compra'" checked name="operation">
<label>Venta</label>
<input type="radio" value="venta" @change="calcvalue" x-on:input="compoperation = 'venta'" name="operation">
</div>
<div id="control-cantidad">
<label>Cantidad</label>
<input @change="calcvalue" x-model="compvalue" x-on:input="calcvalue" inputmode="numeric" maxlength="7" pattern="[0-9.]{1,7}">
</div>
<div id="operation-description">
<p x-text="reprCompOperation"></p>
</div>
</div>
<div id="show-price-container" hx-get="/api/latest/all" hx-trigger="load delay:1sec">
</div>
{{ end }}
{{ end }}
{{ end }}