Wednesday, April 15, 2015

Cakephp3 + Multiple entrys in form

Hello,
I'm new to CakePHP and have a problem creating a form.

I want to create a form to generate invoices. An invoice has a customer, lots of products, a different quantity of each product and a changable price for each product.

So I created a table 'customers' for the customer which has a 'hasOne' relationship to the invoice, so each invoice has one customer - that works fine.

But here is the difficult part: 
I need to create a "subform" which has a drop-down for a product. This subform must allow to edit the quantity and the price of the product.

I created a table "products" with name, description and so on. After that I added another table which has uses again the hasOne relationship to fetch the article and allows the user to enter quantity.

id int(11) 
product_id int(11)
invoice _id int(11)
price decimal(5,2)
quantity int(11)

That works so far, but the user has to create the invoice and must add the sold products in a second step. It would be much nicer to add all the sold products when creating the invoice. Also it's annoing to select the correct invoice when there are hundreds of invoices.

So my question is:
Is it possible to merge these two steps in a single step?

I tried several ways from the CookBook, but the examples are for different situation - there is always a selection for a pre-defined pool of choices (like several doctors for one patient. But i want to create these several doctors on the fly)

Thank you very much
iuv

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: