I have an existing VueJS template file (let's refer to it as Template A) that contains a table populated with data from a JSON output.
Example of JSON output:
{"driver_id":1,"driver_name":"{driver_first_name}, {driver_last_name}","driver_truck":"13","driver_trailer":"83","driver_status":"driving","has_violations":false},
{"driver_id":2,"driver_name":"{driver_first_name}, {driver_last_name}","driver_truck":"58","driver_trailer":"37","driver_status":"sleeping","has_violations":true},
{"driver_id":3,"driver_name":"{driver_first_name}, {driver_last_name}","driver_truck":"80","driver_trailer":"27","driver_status":"driving","has_violations":true},
Below is an image showing how the table appears:
https://i.sstatic.net/b9oR0.png
The button in the table is conditionally displayed when has_violations
is true. Here is the code for the button:
<template slot="list_of_violations" slot-scope="row">
<b-button v-if="row.value.list_of_violations == true" id="account_list">View Account List</b-button></template>
What I am trying to achieve is making this button a link to another VueJS template file (referred to as Template B), where it will take the driver_id
from Template A and perform the following actions:
- Send an AJAX request to retrieve all current violations related to the
driver_id
(from Template A) to the backend application - Process the Ajax response
- Display the Ajax results in a table within Template B
My challenge lies in establishing the connection between these two templates and transferring the driver_id
from Template A to Template B.
Is this considered state management? Or perhaps nested routing? I find myself quite perplexed by this situation.