refactor popover and add end date after resizing