0

I have Invoice Model and InvoiceCharge Model. InvoiceCharge is belongsTo Invoice & Invoice hasMany InvoiceCharge. Invoice charges are like products and services those are listed in an invoice.

I am using jQuery to add more lines to add more charges.

Saving invoice and invoice_table work as it should.

But when it comes to edit Invoice I would want a "Remove Line" button (thanks to javascript, it works). When i save the invoice i want to update invoice_charges table with the new values, also i want to delete the entires that are not anymore in the invoice (Because i removed some charges by clicking the "Remove Line" button). I could use ajax function to remove those entries as soon as i clicked the button "remove line"; but i am not okay with that method. I only want to add/remove/update entries when i save invoice.

Please guide me.

4

1 に答える 1