I have started to use wbraganca\dynamicform\DynamicFormWidget in combination with mootensai\relation\RelationTrait and figured out a problem:
In my application users are able to manage their consulting projects. They can enter their time spended for the projects and also their travel expenses in case they travelled to the customer.
Now I started to implement the topic of bills. Here, it would be great if the users are able to add positions of project time and positions of travel expenses (not every travel and every time can be accounted to every customer).
The tables are:
project 1:n travel expenses
project 1:n project times
project 1:n bills
Therefor, I planned to display the positions (of project time and travel expenses) and wanted to add the positions for the bill with a button behind them. In the attachment I already did the design example for project time (in red some english translation). The buttons beside the project times should be able to add a new bill position with the given values.
7392
Did anyone do sth. like this before?
I have no idea of how the solution could look like. I started by filling up one of the fields with a static string by Javascript jQuery(".dynamicform_wrapper").on("afterInsert", function(e, item) {}. But how do I get the data of the model in there?
I want to add a data row to the DynamicFormWidget with data from another object.
In my example:
The form of the invoice consists of master data of the invoice itself (date, …) plus invoice positions that can be added with the DynamicFormWidget. Here I want to make it possible to adopt positions of e.g. travel expenses that are connected to the project (see attachment).
But my question is: How can I add rows and values to the DynamicForm with a button? Did someone do this with Javascript (where I am not really an expert in) before?