How to resize the parent div together with the child collapsible div?

How to resize the parent div together with the child collapsible div?

I have a parent div used to make my child panel resizable and draggable. Now I wanted to do the panel collapsible. But when it collapses the parent panel should disappear too ... but it is not working. You can see the demo I made here (please see, adding a panel and trying minimize):

https://codepen.io/AlamBique/pen/LLqddr/?editors=1010

How to collapse the parent div together with the body-panel? And why the .panel-body (using height: 100%) extrapolates the height of the parent div?