Cambio a la forma de obtener los indices
This commit is contained in:
@ -36,6 +36,7 @@
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var file_url = ''
|
||||
$('#indices_calendar').calendar({
|
||||
type: 'month',
|
||||
text: {
|
||||
@ -51,12 +52,23 @@
|
||||
'{!!implode("', '", $months->full)!!}'
|
||||
]
|
||||
var date = arguments[0]
|
||||
var url = '{{$urls->uploads}}/indices_' + date.getFullYear() + '_' + months[date.getMonth()] + '.pdf'
|
||||
$('#indices_descarga').attr('href', url)
|
||||
var test = 'indices_' + date.getFullYear() + '_' + months[date.getMonth()]
|
||||
$.getJSON('{{$urls->base}}/documentos/existe/' + test, function(data) {
|
||||
if (data.existe) {
|
||||
var url = '{{$urls->uploads}}/indices_' + date.getFullYear() + '_' + months[date.getMonth()] + '.pdf'
|
||||
$('#indices_descarga').attr('href', url).show()
|
||||
file_url = url
|
||||
return
|
||||
}
|
||||
$('#indices_descarga').attr('href', '').hide()
|
||||
file_url = ''
|
||||
})
|
||||
}
|
||||
})
|
||||
$('#indices_descarga').hide()
|
||||
$('#form_indices').submit(function(e) {
|
||||
e.preventDefault()
|
||||
window.open(file_url, '_blank')
|
||||
return false
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user