Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm using `Laravel 5.7` & `VueJs 2.5.*` ...

I'm using a single Bootstrap Model to create as well as edit my `TicketInvoice` & it's `TicketInvocieItems`, but when i hit Edit, Bootstrap Model opens & i see data fill with `TicketInvoice` but can't see data of `TicketInvoiceItems`. I don't know how to fill data of `TicketInvoiceItems` as well.

An Image For Better Understanding

CLICK HERE TO OPEN IMAGE

What I have tried:

My `ticketInvoiceItems` input fields:
<pre>
    <tbody>
      <tr v-for="(ticketInvoiceItem, key) in form.ticketInvoiceItems" :key="key">
        <!--Passenger Name-->
        <td>
          <input v-model="ticketInvoiceItem.passenger_name" size="40" type="text" name="passenger_name" class="table-control form-control" :class="{ 'is-invalid': form.errors.has('passenger_name') }">
          <has-error :form="form" field="passenger_name"></has-error>
        </td>
        <!--Ticket No.-->
        <td>
          <input v-model="ticketInvoiceItem.ticket_no" size="24" type="text" name="ticket_no" class="table-control form-control" :class="{ 'is-invalid': form.errors.has('ticket_no') }">
          <has-error :form="form" field="ticket_no"></has-error>
        </td>
      </tr>

My `HTML` edit Button:
<a href="#" @click="editModel(ticketInvoice)">
  class="fas fa-user-edit fa-lg text-orange">
</a>

My `VueJs` `editModel()` code:
JavaScript
    <script>
      /*==============EDIT INVOICE CODE==============*/
      editModel(ticketInvoice) {
        this.editmode = true;
        this.form.reset();
        this.form.clear();
        $("#addNewTicketInvoice").modal("show");
        this.form.fill(ticketInvoice);
      }
</script>

My `data()` in `VueJs`:
JavaScript
<script>
  export default {
    data() {
      return {
        editmode: true,
        ticketInvoices: {},
        vendors: null,
        form: new Form({
          id: "",
          vendor_id: "",
          ticket_invoice_no: "",
          ticket_invoice_date: "",
          ticket_invoice_fares_total: "",
          ticket_invoice_grand_total: "",

          ticketInvoiceItems: [{
            id: "",
            ticket_invoice_id: "",
            passenger_name: "",
            ticket_no: "",
            departure_date: "",
            fares: "",
            sub_total: 0
          }]
        })
      };
    },
    </script>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900