sidemenu – folding multi-level side menu?

I am currently working on a project that requires a multi-level side menu.
Since the menu took up too much space on the screen (not English), I decided to make it foldable so that I can choose between the full menu view or the "icons only" menu view.

But I have problems with the menu items that are on several levels, and I'm not sure how to represent the icons on the second level when the menu is collapsed.

Open menu

Closed menu