Versão com o datePicker funcional

parent 935ffa87
/META-INF/
/content/
/mprj/ /mprj/
...@@ -63,28 +63,15 @@ $(function () { ...@@ -63,28 +63,15 @@ $(function () {
}) })
}); });
function createDatesValidation() { function createDatesValidation() {
var date = new Date(); var date = new Date();
$('#datepickeragendamento').datepicker({ $('#datepickeragendamento').datepicker({
startDate: date,
language: 'pt-BR', language: 'pt-BR',
autoclose: 1, autoclose: 1,
ignoreReadonly: true, ignoreReadonly: true,
beforeShowDay: function (currentDate) {
if (dates != null && dates.length > 0) { });
for (var i = 0; i < dates.length; i++) {
if (moment(currentDate).unix()==moment(dates[i],'DD.MM.YYYY').unix()){
return false;
}
}
}
return true;
}
}).on('show', function() {
var $clazz = $(".datepicker-days").children().find("tfoot").children().find(".today");
$clazz.show();
$clazz.addClass("label-calendar-agendamento");
$clazz.text("* Já existe agendamento da publicação para esse dia ou o horário limite foi ultrapassado.");
$clazz.removeClass("today");
});
} }
...@@ -89,4 +89,19 @@ ...@@ -89,4 +89,19 @@
<script type="text/javascript"> <script type="text/javascript">
var urlAjax = "<%=testAjaxResourceUrl%>"; var urlAjax = "<%=testAjaxResourceUrl%>";
var urlOculto = "<%=ocultoJob%>"; var urlOculto = "<%=ocultoJob%>";
$.ajax ({
url:urlAjax,
type: 'POST',
cache: false,
async: false,
dataType: "json",
success: function(response)
{
dates = response.result;
dates = dates.split(",");
createDatesValidation();
}
});
</script> </script>
\ No newline at end of file
...@@ -109,6 +109,6 @@ repositories { ...@@ -109,6 +109,6 @@ repositories {
} }
liferay{ liferay{
liferayHome="C:/Projetos/mprj/opt/deploy" liferayHome="C:/liferay-mprj-fixpack6/deploy"
deployDir=file("${liferayHome}/") deployDir=file("${liferayHome}/")
} }
\ No newline at end of file
...@@ -25,6 +25,7 @@ import org.osgi.service.component.annotations.Component; ...@@ -25,6 +25,7 @@ import org.osgi.service.component.annotations.Component;
import mprj.doerj.caderno.constants.MprjDoerjCadernoPortletKeys; import mprj.doerj.caderno.constants.MprjDoerjCadernoPortletKeys;
import mprj.doerj.caderno.rest.RestServices; import mprj.doerj.caderno.rest.RestServices;
import mprj.doerj.caderno.util.CadernoUtil;
import mprj.doerj.caderno.util.GeraCaderno; import mprj.doerj.caderno.util.GeraCaderno;
/** /**
...@@ -38,6 +39,7 @@ import mprj.doerj.caderno.util.GeraCaderno; ...@@ -38,6 +39,7 @@ import mprj.doerj.caderno.util.GeraCaderno;
"com.liferay.portlet.instanceable=false", "com.liferay.portlet.instanceable=false",
"com.liferay.portlet.scopeable=true", "com.liferay.portlet.scopeable=true",
"com.liferay.portlet.header-portlet-css=/css/admin/admin.css", "com.liferay.portlet.header-portlet-css=/css/admin/admin.css",
"com.liferay.portlet.header-portlet-css=/css/main.css",
"com.liferay.portlet.header-portlet-css=/css/datepicker/bootstrap.min.css", "com.liferay.portlet.header-portlet-css=/css/datepicker/bootstrap.min.css",
"com.liferay.portlet.header-portlet-css=/css/datepicker/bootstrap-datepicker3.standalone.min.css", "com.liferay.portlet.header-portlet-css=/css/datepicker/bootstrap-datepicker3.standalone.min.css",
"com.liferay.portlet.header-portlet-css=/css/confirm/jquery-confirm.min.css", "com.liferay.portlet.header-portlet-css=/css/confirm/jquery-confirm.min.css",
...@@ -49,6 +51,7 @@ import mprj.doerj.caderno.util.GeraCaderno; ...@@ -49,6 +51,7 @@ import mprj.doerj.caderno.util.GeraCaderno;
"com.liferay.portlet.header-portlet-javascript=/js/datepicker/bootstrap-datepicker.min.js", "com.liferay.portlet.header-portlet-javascript=/js/datepicker/bootstrap-datepicker.min.js",
"com.liferay.portlet.header-portlet-javascript=/js/datepicker/bootstrap-datepicker.pt-BR.js", "com.liferay.portlet.header-portlet-javascript=/js/datepicker/bootstrap-datepicker.pt-BR.js",
"com.liferay.portlet.header-portlet-javascript=/js/confirm/jquery-confirm.min.js", "com.liferay.portlet.header-portlet-javascript=/js/confirm/jquery-confirm.min.js",
"com.liferay.portlet.header-portlet-javascript=/js/bootpag/jquery.bootpag.min.js",
"com.liferay.portlet.header-portlet-javascript=/js/main.js", "com.liferay.portlet.header-portlet-javascript=/js/main.js",
"com.liferay.portlet.header-portlet-javascript=/js/admin/admin.js", "com.liferay.portlet.header-portlet-javascript=/js/admin/admin.js",
"com.liferay.portlet.icon=/icon.png", "com.liferay.portlet.icon=/icon.png",
...@@ -59,8 +62,8 @@ import mprj.doerj.caderno.util.GeraCaderno; ...@@ -59,8 +62,8 @@ import mprj.doerj.caderno.util.GeraCaderno;
"com.liferay.portlet.preferences-unique-per-layout=false", "com.liferay.portlet.preferences-unique-per-layout=false",
"com.liferay.portlet.preferences-owned-by-group=true", "com.liferay.portlet.preferences-owned-by-group=true",
"com.liferay.portlet.add-default-resource=true", "com.liferay.portlet.add-default-resource=true",
"com.liferay.portlet.css-class-wrapper=mprj-doerj-materia-web", "com.liferay.portlet.css-class-wrapper=doerj-caderno-dxp-7.2",
"javax.portlet.display-name=Caderno do Diário Oficial", "javax.portlet.display-name=Caderno do Dirio Oficial",
"javax.portlet.expiration-cache=0", "javax.portlet.expiration-cache=0",
"javax.portlet.init-param.portlet-title-based-navigation=true", "javax.portlet.init-param.portlet-title-based-navigation=true",
"javax.portlet.init-param.template-path=/", "javax.portlet.init-param.template-path=/",
...@@ -105,12 +108,15 @@ public class MprjDoerjCadernoPortlet extends MVCPortlet { ...@@ -105,12 +108,15 @@ public class MprjDoerjCadernoPortlet extends MVCPortlet {
}else{ }else{
try { try {
//jsonResponse.put("result", CadernoUtil.getDatasCadastradas()); jsonResponse.put("result", CadernoUtil.getDatasCadastradas());
} catch (SystemException e) { } catch (SystemException e) {
logger.error("Erro requisicao AJAX",e); logger.error("Erro requisicao AJAX",e);
//} catch (ParseException e) { //} catch (ParseException e) {
//logger.error("Erro validar horários AJAX",e); //logger.error("Erro validar horários AJAX",e);
} catch (java.text.ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} }
// Writing the result in resourceResponse writer. // Writing the result in resourceResponse writer.
PrintWriter writer = resourceResponse.getWriter(); PrintWriter writer = resourceResponse.getWriter();
......
...@@ -63,28 +63,15 @@ $(function () { ...@@ -63,28 +63,15 @@ $(function () {
}) })
}); });
function createDatesValidation() { function createDatesValidation() {
var date = new Date(); var date = new Date();
$('#datepickeragendamento').datepicker({ $('#datepickeragendamento').datepicker({
startDate: date,
language: 'pt-BR', language: 'pt-BR',
autoclose: 1, autoclose: 1,
ignoreReadonly: true, ignoreReadonly: true,
beforeShowDay: function (currentDate) {
if (dates != null && dates.length > 0) { });
for (var i = 0; i < dates.length; i++) {
if (moment(currentDate).unix()==moment(dates[i],'DD.MM.YYYY').unix()){
return false;
}
}
}
return true;
}
}).on('show', function() {
var $clazz = $(".datepicker-days").children().find("tfoot").children().find(".today");
$clazz.show();
$clazz.addClass("label-calendar-agendamento");
$clazz.text("* Já existe agendamento da publicação para esse dia ou o horário limite foi ultrapassado.");
$clazz.removeClass("today");
});
} }
...@@ -89,4 +89,19 @@ ...@@ -89,4 +89,19 @@
<script type="text/javascript"> <script type="text/javascript">
var urlAjax = "<%=testAjaxResourceUrl%>"; var urlAjax = "<%=testAjaxResourceUrl%>";
var urlOculto = "<%=ocultoJob%>"; var urlOculto = "<%=ocultoJob%>";
$.ajax ({
url:urlAjax,
type: 'POST',
cache: false,
async: false,
dataType: "json",
success: function(response)
{
dates = response.result;
dates = dates.split(",");
createDatesValidation();
}
});
</script> </script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment