MT#5879 Few small fixes of some some already fixed errors.

Some small fixes which should make behavior much more clear.
I already did some of them them today, but seems like lost somwhow.
ipeshinskaya/InvoiceTemplate5
Irina Peshinskaya 11 years ago committed by Victor Seva
parent cdd05a1df1
commit 4a1b5c005e

@ -205,7 +205,7 @@ sub invoice_data :Chained('invoice') :PathPart('data') :Args(1) {
my $backend = NGCP::Panel::Model::DB::InvoiceTemplate->new( schema => $c->model('DB') );
my $invoice = $backend->getInvoice(invoice_id => $invoice_id);
$c->response->content_type('application/pdf');
$c->response->body( $invoice->first->get_column('data') );
$c->response->body( $invoice->get_column('data') );
return;
}
@ -395,7 +395,7 @@ sub generate_invoice :Private{
}
$svg = $c->view('SVG')->getTemplateProcessed($c,\$svg, $stash );
NGCP::Panel::Utils::InvoiceTemplate::convertSvg2Pdf($c,\$svg,$in,$out);
#$backend->storeInvoiceData('invoice'=>$invoice,'data'=>\$out->{tt_string_pdf});
$backend->storeInvoiceData('invoice'=>$invoice,'data'=>\$out->{tt_string_pdf});
}
sub parse_invoice_period :Private{
my ($self, $c, $in) = @_;

@ -62,7 +62,7 @@ $(document).ready(function() {
'iShowPages': 5,
"sAjaxSource": "[% helper.ajax_uri %]",
"fnServerParams": function ( aoData ) {
var params = localStorage.getItem("datatables.paramsJSON");
var params = localStorage.getItem("ngcp_dt.[%helper.id_from_name%]_table.paramsJSON");
if(params){
var paramsParsed = JSON.parse(params);
for(var key in paramsParsed){

@ -9,6 +9,7 @@
[%PROCESS 'helpers/modal.tt' -%]
[%mf_helper = {
ajax_load => 1,
ajax_callback => 'refreshInvoicesTable();'
}%]
[%modal_script( m = mf_helper )%]
@ -33,6 +34,12 @@
[%PROCESS 'helpers/ajax_messages.tt' -%]
</div>
<script>
function refreshInvoicesTable(){
invoicesTable = $('#invoice_list_data_ajax_table');
if(invoicesTable){
invoicesTable.dataTable().fnDraw();
}
}
function applyClientFilter(table,tr,contact_id){
var classSelected = 'ngcp_current_edit';
if(tr){
@ -52,10 +59,8 @@ function applyClientFilter(table,tr,contact_id){
}
contact_id = '';
}
localStorage.setItem('datatables.paramsJSON',JSON.stringify({'client_contact_id':contact_id}));invoicesTable = $('#invoice_list_data_ajax_table');
if(invoicesTable){
invoicesTable.dataTable().fnDraw();
}
localStorage.setItem('ngcp_dt.invoice_list_data_ajax_table.paramsJSON',JSON.stringify({'client_contact_id':contact_id}));
refreshInvoicesTable();
}
</script>
@ -116,6 +121,7 @@ function applyClientFilter(table,tr,contact_id){
clearHelper();
helper.name_single = c.loc('Invoices');
helper.name = c.loc('Invoices');
helper.identifier = 'invoice_list_data_ajax';
helper.dt_columns = [
{ name => 'contract_balances.contract.contact.reseller_id'},
{ name => 'contract_balances.contract.contact.reseller.name'},
@ -129,10 +135,9 @@ function applyClientFilter(table,tr,contact_id){
{ name => 'contract_balances.free_time_balance', title => c.loc('Free Time balance')},
];
helper.dt_buttons = [
{ name = c.loc('Delete'), uri = "javascript:fetch_into(\\'messages\\', \\'" _ c.uri_for_action('/invoice/invoice_delete', [ provider.id ] ) _ "\\',\\'invoice_id='+full.contract_balances_invoice_id+'\\',function(){\$(\\'#" _ helper.id_from_name _ "_table\\').DataTable().fnDraw();});void(0);", class = 'btn-small btn-secondary', icon = 'icon-trash' },
{ name = c.loc('Delete'), uri = "javascript:fetch_into(\\'messages\\', \\'" _ c.uri_for_action('/invoice/invoice_delete', [ provider.id ] ) _ "\\',\\'invoice_id='+full.contract_balances_invoice_id+'\\',function(){\$(\\'#" _ helper.identifier _ "_table\\').DataTable().fnDraw();});void(0);", class = 'btn-small btn-secondary', icon = 'icon-trash' },
{ name = c.loc('View invoice PDF'), uri = "javascript:window.open(\\'/invoice/data/' + full.contract_balances_invoice_id + '\\',\\'_blank\\');void(0);", class = 'btn-small btn-primary', icon = 'icon-edit' },
];
helper.identifier = 'invoice_list_data_ajax';
helper.ajax_uri = c.uri_for_action( '/invoice/ajax_datatables_data', [ provider.id, 'invoice_list_data' ] ) ;
initHelperAuto();
PROCESS 'helpers/datatables.tt';

Loading…
Cancel
Save