Skip to content

Instantly share code, notes, and snippets.

@mfyance
Created August 25, 2015 17:27
Show Gist options
  • Save mfyance/a707451e882e0fc3b8d0 to your computer and use it in GitHub Desktop.
Save mfyance/a707451e882e0fc3b8d0 to your computer and use it in GitHub Desktop.
latinApp.controller("mostrarTareasReportadas", ['$scope', '$http','$timeout',function($scope, $http,$timeout) {
$scope.this_true = true
$scope.this_false = false
new_url = yOSON.baseHost +'json/listar_tareas_reportadas.json'
type = 'GET'
if(yOSON.produccion === 'true'){
type = 'POST'
new_url = yOSON.baseHost +'json/listar_tareas_reportadas.json'
}
$http({
url: new_url,
method: type,
data: {}
}).success(function(results, status, headers, config) {
$scope.fechas = results.data
}).error(function(data, statusresults, headers, config) {
$scope.status = status;
});
$scope.fnAlerta = function(data){
btnClass = ''
if(data==$scope.this_true){
btnClass = 'active'
}
return btnClass
}
$scope.fnVerDataAlerta = function( $event){
idPaquete = $('#'+$event.currentTarget.id).attr('data-id-paquete')
option = $('#'+$event.currentTarget.id).attr('data-alert-opcion')
comment = $('#'+$event.currentTarget.id).attr('data-alert-comentario')
$scope.alerta_comentario = $scope.this_false
if(option==$scope.this_false){
$scope.alerta_comentario = $scope.this_true
}
$scope.getIdLinkAlert = $event.currentTarget.id
$scope.idPaqueteTrabajoPopup = idPaquete
$scope.rad_problema = option
if($scope.rad_problema == "true"){
$scope.rad_problema = $scope.this_true
}else{
$scope.rad_problema = $scope.this_false
}
console.log($scope.rad_problema)
$('#tarea_opcion_clone').val(option)
$('#tarea_comentario').val(comment)
$.fancybox.open({
href: '#tmp_mensaje_alerta',
fitToView: false,
autoSize: false,
maxWidth: 500,
width: "100%",
height: "auto",
closeClick: false,
openEffect: "fade",
closeEffect: "fade",
padding: [20, 20, 20, 20],
beforeClose: function(){
}
})
}
$scope.clickButton = function(idLinkAlert){
nuevo_comentario = $('#tarea_comentario').val()
$('#'+idLinkAlert).attr('data-alert-comentario', nuevo_comentario)
$('#'+idLinkAlert).attr('data-alert-opcion',$scope.rad_problema)
$('#tarea_opcion_clone').val($scope.rad_problema)
if($scope.rad_problema===$scope.this_false){
$('#'+idLinkAlert).removeClass('active')
$('#'+idLinkAlert).attr('data-alert-comentario', '')
}else{
$('#'+idLinkAlert).addClass('active')
}
}
$scope.change = function(idLinkAlert){
console.log($scope.rad_problema)
if($scope.rad_problema===$scope.this_false){
$scope.alerta_comentario = $scope.this_true
}else{
$scope.alerta_comentario = $scope.this_false
}
}
}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment