Rewrite using Thymeleaf and add deletePic js function