Answer the question
In order to leave comments, you need to log in
Model description in json?
In general, an interesting task.
Conditions:
The company provides various legal services.
The website requires an order form for each service.
All services have a different set of attributes.
There are dependent attributes: for example, the cost of the service depends on the deadline and the number of copies of documents (price = cost * quantity * term).
You can add multiple services to an order.
And here's the task:
You need to make a constructor so that the content manager himself adds services to the site and describes their properties. Based on these properties, forms will be built on service pages. When filling out these forms, the data will be saved in the order.
At first I wanted to make a separate table for dynamic fields (name, type, code). But it is still not clear how to make the fields depend on each other, where to write the links and calculation formulas.
Then I thought, I can just make a service model (name, description), and in the description in json format describe all the necessary properties of the service, connections, functions. And in the frontend (for example, through Angular), parse json and build order forms.
Any ideas?
Answer the question
In order to leave comments, you need to log in
And if you need a new service, then programmatically change the json file?
In my opinion, it is better through a DB.
Tables: Services, Attributes, ServicesAttributes, Reports, ReportsAttribute Values
As for dependencies, before designing, it is necessary to consider what types of dependencies there are. Only arithmetic? Are the attributes on the form always shown, or is it possible that some attributes are shown only if some value is specified before the attribute?
For example, you can create a Dependency field in the Attributes table
and write something like (A20 + A30) - A40/2
, the numbers after A are the attributes id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question