Hi was trying to implement a Collection Visit Plan on my reactJs Application.
Basically it starts from supervisor planning at SOD (Start of Day) time to arrange a collection visit for the Field Collection Officer.
the initial Data Visit Plan are receive from API form as an array of objects below :
intialVisitPLanData:[{
id:1,
custName:'Mr. John',
address:'St. Lorem ipsum dolor sit.',
fieldcoll:'Officer 01',
isVisited:null,
isWarnLetter1:null,
isWarnLetter1:null,
isWarnLetter1:null,
isWarnLetter1:null,
},
{
id:2,
custName:'Mr. Jack',
address:'St. Lorem ipsum dolor sit.',
fieldcoll:'Officer 02',
isVisited:null,
isWarnLetter1:null,
isWarnLetter1:null,
isWarnLetter1:null,
isWarnLetter1:null,
},
... more objects here
]
I've managed to Render this Data as table Rows and put checkbox on each rows . So Supervisor can select which customers he want based on checkbox that selected.
The Question is how do i make a new visitPlan array of objects based on those selected rows and preserve the initial object structure (object key property)(the initialVisitPlanData that has been checked)
example :
object structure ready to inserted to new object
{id:null,custname:null,etc}
* initial data :
this.state = {
visitPlan:[]
}
I don't know the method to approach this requirement.
Thanks in advance