Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

boyjarv's avatar

toggle show details for just one selected driver at a time

The method I am using selects multiple drivers and then deselects them when clicked again,

showDriverInfo(driver) {
      console.log("Show driver info: " + driver);
      var index = this.selectedDriver.findIndex(
        (item) => item.id === driver.id
      );

      if (index === -1) {
        this.selectedDriver.push(driver);
      } else {
        this.selectedDriver.splice(index, 1);
      }
    },

I just want to show the details of the one driver I have selected

0 likes
1 reply
durairaj's avatar

I have done with this scenerio multi doucment upload with dropdown if one doc selected , andother droptdown will disable that doc -> see my sample code. this may be help you

blade file:

				<div class="row" v-for="(kycItem, kycindex) in kycDocument" :key="kycindex">
                                <div class="col-5">
                                    <div class="mb-3">
                                        <select name="document_type[]" :class="[kycItem.document_id ? validClass : 				inValidClass, 'form-control']" v-if="!kycItem.customerDocumentId" v-model="kycItem.document_id" required >
                                            <option disabled value="">Please select one</option>
                                            <option v-for="doc in documentTypes" v-bind:disabled="isDisabled(doc)" v-bind:value="doc.id" >@{{ doc.type }}</option>
                                        </select>
                                        <input type="text" readonly name="document_type" v-model="kycItem.document_type" v-else class="form-control">

                                        <input type="hidden" name="document_id[]" v-if="!kycItem.image_url" v-model="kycItem.document_id">
                                        <input type="hidden" :name="'customerDocumentId_'+kycItem.document_id+''"  v-model="kycItem.customerDocumentId">
                                    </div>
                                </div>

script:

        isDisabled: function(doc) {
            return this.kycDocument.map(item => item.document_id).includes(doc.id);
        },

Please or to participate in this conversation.