<script>
//incluir no formulario
function script_itens_carga() {
	setTimeout(function(){
		$('input[type=checkbox]').change(function() {
			if($(this).attr("name").includes("recorrente"))
			{
				readonlyHoraExet = false;
				readonlyRecorrent = true;
				if($(this).is(":checked")) {
				   readonlyHoraExet = true;
				   readonlyRecorrent = false;
				}     
				$("#"+$(this).parent().parent().attr("id")+" .form").each(function(idx, itm) { 
						if($(itm).attr("name").includes("hora_execucao"))
						{
							$(itm).prop("readonly",readonlyHoraExet);
						}
						if($(itm).attr("name").includes("valor_recorrencia"))
						{
							$(itm).prop("readonly",readonlyRecorrent);
						}
						if($(itm).attr("name").includes("unidade_recorrencia"))
						{
							$(itm).prop("readonly",readonlyRecorrent);
						}
					});
			}
		});
		
		//iniciar form
		$('input[type=checkbox]').each(function() {
			if($(this).attr("name").includes("recorrente"))
			{
				readonlyHoraExet = false;
				readonlyRecorrent = true;
				if($(this).is(":checked")) {
				   readonlyHoraExet = true;
				   readonlyRecorrent = false;
				}     
				$("#"+$(this).parent().parent().attr("id")+" .form").each(function(idx, itm) { 
						if($(itm).attr("name").includes("hora_execucao"))
						{
							$(itm).prop("readonly",readonlyHoraExet);
						}
						if($(itm).attr("name").includes("valor_recorrencia"))
						{
							$(itm).prop("readonly",readonlyRecorrent);
						}
						if($(itm).attr("name").includes("unidade_recorrencia"))
						{
							$(itm).prop("readonly",readonlyRecorrent);
						}
					});
			}
		});
	},200);
}
</script>