UI
This commit is contained in:
40
ui/resources/views/currencies/list.blade.php
Normal file
40
ui/resources/views/currencies/list.blade.php
Normal file
@ -0,0 +1,40 @@
|
||||
@extends('layout.base')
|
||||
|
||||
@section('page_content')
|
||||
<h2 class="ui header">
|
||||
Monedas
|
||||
</h2>
|
||||
<div class="ui link list" id="currencies">
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
let currencies = {
|
||||
id: '#currencies',
|
||||
items: [],
|
||||
setup: function() {
|
||||
this.load().then((data) => {
|
||||
this.build(data)
|
||||
})
|
||||
},
|
||||
load: function() {
|
||||
let url = '{{$urls->api}}/currencies'
|
||||
return $.getJSON(url, (data) => {
|
||||
this.items = data.currencies
|
||||
})
|
||||
},
|
||||
build: function() {
|
||||
$(this.id).html('')
|
||||
$.each(this.items, (i, el) => {
|
||||
let item = $('<a></a>').attr('class', 'item').attr('href', '{{$urls->base}}/currency/' + el.id)
|
||||
.html(el.name)
|
||||
$(this.id).append(item)
|
||||
})
|
||||
}
|
||||
}
|
||||
$(document).ready(() => {
|
||||
currencies.setup()
|
||||
})
|
||||
</script>
|
||||
@endpush
|
Reference in New Issue
Block a user