-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
61 changed files
with
521 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Place all the behaviors and hooks related to the matching controller here. | ||
// All this logic will automatically be available in application.js. | ||
$(document).ready(function() { | ||
$('table').DataTable(); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Place all the behaviors and hooks related to the matching controller here. | ||
// All this logic will automatically be available in application.js. | ||
$(document).ready(function() { | ||
$('table').DataTable(); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
jQuery(document).ready(function($) { | ||
$(document).ready(function() { | ||
$('table').DataTable(); | ||
|
||
$(".clickable-row").click(function() { | ||
window.location = $(this).data("href"); | ||
}); | ||
}); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Place all the behaviors and hooks related to the matching controller here. | ||
// All this logic will automatically be available in application.js. | ||
$(document).ready(function() { | ||
$('table').DataTable(); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Place all the behaviors and hooks related to the matching controller here. | ||
// All this logic will automatically be available in application.js. | ||
jQuery(document).ready(function($) { | ||
jQuery.extend( jQuery.fn.dataTableExt.oSort, { | ||
"non-empty-string-asc": function (str1, str2) { | ||
if(str1 === "") | ||
return 1; | ||
if(str2 === "") | ||
return -1; | ||
return ((str1 < str2) ? -1 : ((str1 > str2) ? 1 : 0)); | ||
}, | ||
"non-empty-string-desc": function (str1, str2) { | ||
if(str1 === "") | ||
return 1; | ||
if(str2 === "") | ||
return -1; | ||
return ((str1 < str2) ? 1 : ((str1 > str2) ? -1 : 0)); | ||
} | ||
} ); | ||
|
||
$('table').DataTable({ | ||
columnDefs: [ | ||
{type: 'non-empty-string', targets: 0} // define 'name' column as non-empty-string type | ||
] | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Place all the behaviors and hooks related to the matching controller here. | ||
// All this logic will automatically be available in application.js. | ||
jQuery(document).ready(function($) { | ||
jQuery.extend( jQuery.fn.dataTableExt.oSort, { | ||
"date-uk-pre": function ( a ) { | ||
var ukDatea = a.split('/'); | ||
var yearWithoutTime = ukDatea[2].split(' ')[0]; | ||
return (yearWithoutTime + ukDatea[1] + ukDatea[0]) * 1; | ||
}, | ||
"date-uk-asc": function ( a, b ) { | ||
console.log("asc"); | ||
return ((a < b) ? -1 : ((a > b) ? 1 : 0)); | ||
}, | ||
"date-uk-desc": function ( a, b ) { | ||
console.log("desc"); | ||
return ((a < b) ? 1 : ((a > b) ? -1 : 0)); | ||
} | ||
} ); | ||
|
||
$('table').DataTable({ | ||
"order": [[ 0, "desc" ]], | ||
columnDefs: [ | ||
{ type: 'date-uk', targets: 0 } // define 'run' column as date | ||
] | ||
}); | ||
|
||
$('input#edi_errors_day').on('change', function() { | ||
var url = window.location.href; | ||
if (url.indexOf('?') > -1) { | ||
url = url.substr(0, url.indexOf('?')); | ||
} | ||
url += '?day=' + this.value; | ||
window.location.href = url; | ||
}) | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
jQuery(document).ready(function($) { | ||
$('table').DataTable(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Place all the behaviors and hooks related to the matching controller here. | ||
// All this logic will automatically be available in application.js. | ||
jQuery(document).ready(function($) { | ||
$('table').DataTable(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Place all the behaviors and hooks related to the matching controller here. | ||
// All this logic will automatically be available in application.js. | ||
jQuery(document).ready(function($) { | ||
$('table').DataTable(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Place all the behaviors and hooks related to the matching controller here. | ||
// All this logic will automatically be available in application.js. | ||
jQuery(document).ready(function($) { | ||
$('table').DataTable(); | ||
}); |
5 changes: 5 additions & 0 deletions
5
app/assets/javascripts/expenditures_with_circ_stats_reports.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Place all the behaviors and hooks related to the matching controller here. | ||
// All this logic will automatically be available in application.js. | ||
jQuery(document).ready(function($) { | ||
$('table').DataTable(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,3 @@ | ||
$(document).on('ready page:load', function () { | ||
jQuery.extend( jQuery.fn.dataTableExt.oSort, { | ||
"non-empty-string-asc": function (str1, str2) { | ||
if(str1 === "") | ||
return 1; | ||
if(str2 === "") | ||
return -1; | ||
return ((str1 < str2) ? -1 : ((str1 > str2) ? 1 : 0)); | ||
}, | ||
|
||
"non-empty-string-desc": function (str1, str2) { | ||
if(str1 === "") | ||
return 1; | ||
if(str2 === "") | ||
return -1; | ||
return ((str1 < str2) ? 1 : ((str1 > str2) ? -1 : 0)); | ||
} | ||
} ); | ||
$('table').DataTable({ | ||
columnDefs: [ | ||
{type: 'non-empty-string', targets: 0} // define 'name' column as non-empty-string type | ||
] | ||
}); | ||
$("[data-toggle='tooltip']").tooltip(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Place all the behaviors and hooks related to the matching controller here. | ||
// All this logic will automatically be available in application.js. | ||
$(document).ready(function() { | ||
$('table').DataTable(); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Controller to handle Edi Error Report requests | ||
class EdiErrorReportsController < ApplicationController | ||
load_and_authorize_resource | ||
has_scope :day | ||
|
||
def index | ||
@edi_error_report = apply_scopes(EdiErrorReport).all | ||
rescue StandardError => e | ||
flash[:error] = e.message | ||
redirect_to edi_error_reports_path | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Model for the Edi Error Report table | ||
class EdiErrorReport < ActiveRecord::Base | ||
# so we can use the database table column name 'type' which is normally a reserved keyword | ||
# which rails uses to define the subclass of a model that should be loaded. | ||
self.inheritance_column = 'inheritance_type' | ||
|
||
scope :day, ->(day) { where(date_query, day.to_date) } | ||
|
||
self.table_name = 'edi_error_report' | ||
|
||
# The date queries for 'development' sqlite3 and 'production' Oracle SQL are different | ||
# In order to test the application locally we need to check the database configuration | ||
# against the environment to construct the correct query. | ||
# (N.B. There may be a less hacky way to do this using the oracle_enhanced adapter or ruby-oci8...) | ||
def self.date_query | ||
if Rails.configuration.database_configuration[Rails.env]['database'] =~ /sqlite3/ | ||
'DATE(run) = ?' | ||
else | ||
'trunc(run) = ?' | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<% content_for :javascript_includes do %> | ||
<%= javascript_include_tag "edi_error_reports.js" %> | ||
<% end %> | ||
<div class="home-page-section"> | ||
<h1>EDIFACT invoice errors</h1> | ||
<div> | ||
<%= link_to 'Show errors for all days', { controller: 'edi_error_reports', action: 'index' }, class: 'btn btn-default', style: 'margin-bottom: 10px' %> | ||
<%= link_to 'Show errors for today', { controller: 'edi_error_reports', action: 'index', day: "#{Time.zone.today}" }, class: 'btn btn-default', style: 'margin-bottom: 10px' %> | ||
</div> | ||
<div class="field"> | ||
Show errors for selected date: | ||
<%= date_field('edi_errors', 'day', value: params[:day] || "#{Time.zone.today}", | ||
'data-behavior': 'date-picker', | ||
max: Time.zone.today) %> | ||
</div> | ||
<table class="table-striped" id="table-date"> | ||
<thead> | ||
<tr> | ||
<th>Run</th> | ||
<th>Type</th> | ||
<th>Error</th> | ||
<th>Error level</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% @edi_error_report.each do |eer| %> | ||
<tr class='<%= cycle("odd", "even") %>'> | ||
<td><%= eer.run.present? ? eer.run.strftime('%x %H:%M') : '' %></td> | ||
<td><%= eer.type %></td> | ||
<td><%= eer.error %></td> | ||
<td><%= eer.err_lvl %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
<div class="btn-group"> | ||
<%= main_menu_button %> | ||
</div> | ||
<div class="btn-group"> | ||
<%= edi_menu_button %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.