diff --git a/frontend/common/Controller/Coins.php b/frontend/common/Controller/Coins.php index 9c8e47b..0d53318 100644 --- a/frontend/common/Controller/Coins.php +++ b/frontend/common/Controller/Coins.php @@ -12,4 +12,6 @@ class Coins { public function get(Request $request, Response $response, View $view, $coin_id): Response { return $view->render($response, 'coins.show', compact('coin_id')); } + public function values(Request $request, Response $response, View $view, $coin_id): Response { + } } diff --git a/frontend/resources/views/coins/list.blade.php b/frontend/resources/views/coins/list.blade.php index 3dec2af..80cde95 100644 --- a/frontend/resources/views/coins/list.blade.php +++ b/frontend/resources/views/coins/list.blade.php @@ -37,23 +37,26 @@ api: '{{$urls->api}}', base: '{{$urls->base}}' }, + table: null, modal: null, setup: function(table, modal) { + this.table = table this.modal = modal table.find('plus icon').css('cursor', 'pointer').click(() => { addCoin() }) - table.find('tbody').append($('
').attr('class', 'ui active dimmer').append( - $('').attr('class', 'ui loader') - )) table.find('.plus.icon').css('cursor', 'pointer').click((e) => { this.add() }) - this.load(table) + this.load() }, - load: function(table) { + load: function() { const url = this.urls.api + '/coins' + const table = this.table const body = table.find('tbody') + table.find('tbody').append($('').attr('class', 'ui active dimmer').append( + $('').attr('class', 'ui loader') + )) $.getJSON(url, (data) => { body.html('') data.coins.forEach((v) => { @@ -95,6 +98,12 @@ ).append( $('').attr('type', 'text').attr('name', 'name') ) + ).append( + $('').attr('class', 'field').append( + $('').html('Identificador') + ).append( + $('').attr('type', 'text').attr('name', 'identifier') + ) ).append( $('').attr('class', 'field').append( $('').html('Código') @@ -134,6 +143,7 @@ const fields = [ 'name', 'code', + 'identifier', 'prefix', 'suffix', 'decimals', @@ -149,7 +159,7 @@ data = JSON.stringify(data) $.post(url, data, (response) => { if (response.created === true) { - return reload() + return this.load() } }, 'json') } @@ -226,7 +236,7 @@ data: data, success: (response) => { if (response.edited === true) { - return reload() + return this.load() } }, dataType: 'json' @@ -244,7 +254,7 @@ success: (response) => { console.debug(response) if (response.deleted === true) { - return reload() + return this.load() } }, dataType: 'json' diff --git a/frontend/resources/views/coins/show.blade.php b/frontend/resources/views/coins/show.blade.php index c49c15b..1c298bd 100644 --- a/frontend/resources/views/coins/show.blade.php +++ b/frontend/resources/views/coins/show.blade.php @@ -2,30 +2,131 @@ @section('page_content')+ Fecha + | ++ Valor + | +
---|