Skip to content

Commit

Permalink
#23 Replace credit offers operations by operations-table
Browse files Browse the repository at this point in the history
  • Loading branch information
ihorml committed Nov 9, 2022
1 parent 2e0f1fb commit 57496e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 75 deletions.
38 changes: 10 additions & 28 deletions app/sections/credit_offers/credit_offer.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,16 @@
<div class="col-md-6">
</div>
</div>
<h2><span data-translate="Credit Offer Operations History"></span></h2>
<div class="panel-body table-responsive">
<responsive-table data-data="operations"
data-columns="operationsColumns"
data-loading="operationsLoading"
data-template="operations-table.html"
data-loading-error="operationsLoadingError"
></responsive-table>

<footer class="table-footer">
<div class="row">
<div class="col-md-6 page-num-info">
</div>
<div class="col-md-6 text-right pagination-container">
<ul
uib-pagination class="pagination-sm"
ng-model="currentPage"
total-items="total_ops"
max-size="4"
ng-change="currentPage===undefined || select(currentPage)"
items-per-page="20"
rotate="false"
previous-text="&lsaquo;" next-text="&rsaquo;"
boundary-links="true"
></ul>
</div>
</div>
</footer>
<div class="panel panel-default">
<div class="panel-heading">
<span data-translate="Credit Offer Operations History"></span>
<img src="images/filter.svg" ng-click="showFilters = !showFilters" class="operations-filter"/>
</div>
<loading ng-if="!credit_offer_id"></loading>
<operations-table ng-if="credit_offer_id"
group-by-credit-offer-id="credit_offer_id"
filter-by-asset-id-enabled="false"
show-filters="showFilters"
/>
</div>
</div>
50 changes: 3 additions & 47 deletions app/sections/credit_offers/credit_offers.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
'use strict';

angular.module('app.credit_offers')
.controller('creditOffersCtrl', ['$scope', '$route', '$routeParams', '$location', '$filter', 'utilities', 'marketService',
'chartService', 'appConfig', creditOffersCtrl])
.controller('creditOffersCtrl', ['$scope', '$route', '$routeParams', '$filter', 'marketService', creditOffersCtrl])
.filter('to_trusted', ['$sce', function($sce){
return function(text) {
return $sce.trustAsHtml(text);
Expand Down Expand Up @@ -49,56 +48,13 @@
}
}

function creditOffersCtrl($scope, $route, $routeParams, $location, $filter, utilities, marketService, chartService, appConfig) {
function creditOffersCtrl($scope, $route, $routeParams, $filter, marketService) {

$scope.credit_offer_id = $routeParams.name;
$scope.showOnlyActive = true;

if($scope.credit_offer_id) {

$scope.operationsColumns = [
{
title: $filter('translate')('Operation'),
index: 'operation_text',
},
{
title: $filter('translate')('ID'),
index: 'operation_id'
},
{
title: $filter('translate')('Date and time'),
index: 'time',
hidden: ['xs']
},
{
title: $filter('translate')('Block'),
index: 'block_num',
hidden: ['xs', 'sm']
},
{
title: $filter('translate')('Type'),
index: 'type',
hidden: ['xs', 'sm', 'md']
}
];
$scope.select = function(page_operations) {
const page = page_operations - 1;
const limit = 20;
const from = page * limit;

$scope.operationsLoading = true;
$scope.operationsLoadingError = false;
marketService.getCreditOfferOperationsHistory($scope.credit_offer_id, limit, from).then((returnData) => {
console.log('test?');
$scope.operationsLoading = false;
$scope.operations = returnData;
$scope.currentPage = page_operations;
}).catch(err => {
$scope.operationsLoadingError = true;
throw err;
});
}
$scope.select(1);

} else {
$scope.columns = [{
title: 'ID',
Expand Down

0 comments on commit 57496e6

Please sign in to comment.