In my company, we have different pages for different purposes and some of those pages have multiple starting points. According to these points, the pages open with different types. For example: when you click on a record to open the details page, open that page with the necessary information and the fields enabled and editable with that information, but when you select it from another list for approval, open the page with the same information , but slightly different, with non – editable writings. And for the initial purposes, the pages could include other partial pages within some divs.
One of those pages has more than 10,000 lines of spaghetti code and it is my duty to develop and maintain that page. Every time I need to add something to that code, I find myself reading, trying to understand it and trying to figure out where I should put my code.
So, what is the elegant way to handle these types of pages? Is there some design pattern that I can implement?
PS: we use a special framework that is written 8 years ago, before me. Use Java to handle events and use HTML / CSS / JS to represent the page.