11@extends (' layout' )
22@section (' content' )
3+
4+ @php
5+ $selec = 0 ;
6+ @endphp
7+
38<div class =" container" >
49 <div class =" row justify-content-md-center" >
510 <div class =" col col-lg-3" >
611 <form > <center >
7- <select class =" custom-select custom-select-lg mb-3" id =" election" name =" election" onChange >
12+ <select class =" custom-select custom-select-lg mb-3" class =" election" name =" election" onChange >
13+ <option value =" 0" disabled =" true" selected =" true" >Select Election</option >
814 @foreach ($Fdata as $data )
915 <option value =" {{ $data -> id } }" >{{ $data -> name } } </option >
1016 @endforeach
1117</select >
1218</div >
1319<div class =" col col-lg-3" >
14- <select class =" custom-select custom-select-lg mb-3" id =" district" name =" district" >
15- <option value =" pe" >Select The District </option >
16- <option value =" pre" >PRE</option >
17- <option value =" mc" >MC</option >
18- <option value =" r" >R</option >
20+
21+ <select class =" custom-select custom-select-lg mb-3" class =" district" name =" district" >
22+ <option value =" 0" disabled =" true" selected =" true" >Select District</option >
1923</select >
24+
2025</div >
2126</div > </div >
2227<center >
23- <button type =" button" class =" btn btn-primary" >Generate Report </button >
28+ <Button type =" button" class =" btn btn-primary" id = " bellot " >Generate Report </Button >
2429</center >
2530</form >
2631 </center >
4954
5055 </h5 >
5156 <p > Ballot Paper No:...............................................................................................................................................................................</p >
52- <table align =" center" border =" 1" cellpadding =" 5" width =" 80%" >
57+ <table align =" center" border =" 1" cellpadding =" 5" width =" 80%" id =" tblBellot" >
58+ <thead >
5359 <tr >
5460 <th align =" right" > Party Name</th >
5561 <th align =" left" > Symbol</th >
5662 <th align =" left" > No</th >
5763 </tr >
58-
59- @foreach ($Fdata as $data )
60- <tr >
61- <td >{{ $data -> id } } </td >
62- <td >{{ $data -> name } } </td >
63- <td >{{ $data -> username } } </td >
64-
65- </tr >
66- @endforeach
64+ </thead >
65+ <tbody >
66+
67+ </tbody >
6768
6869 </table >
69-
70-
7170 <table align =" center" border =" 1" cellpadding =" 5" width =" 80%" >
7271 <tr >
7372 <td >1</td ><td >2</td ><td >3</td ><td >4</td ><td >5</td ><td >6</td ><td >7</td ><td >8</td ><td >9</td ><td >10</td >
9493 <center > <input class =" btn btn-primary" type =" button" onclick =" printDiv('example')" value =" Print Data" /> </center >
9594 </section >
9695
96+ @push (' scripts' )
97+ <script src =" https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" ></script >
98+ <script >
99+
100+ // $(document).ready(function(){
101+
102+ // -------------------------Get District----------------------------------
103+ $ (" select[name='election']" ).change (function () {
104+
105+ var elec_id= $ (this ).val ();
106+ var op= " " ;
107+
108+ $ .ajax ({
109+ type: ' GET' ,
110+ url: ' {!! URL:: to (' getDistrict' ) ! !}' ,
111+ data: {' id' : elec_id},
112+ success : function (data ){
113+
114+ op+= ' <option value="0" disabled="true" >Select District</option>' ;
115+ for (var i= 0 ;i< data .length ;i++ ){
116+ op+= ' <option value="' + data[i].id + ' ">' + data[i].name + ' </option>' ;
117+
118+ }
119+ $ (" select[name='district']" ).html (" " );
120+ $ (" select[name='district']" ).append (op);
121+
122+ },
123+ error : function (){
124+
125+ }
126+ });
127+ });
128+
129+ // -------------------------Get Bellot----------------------------------
130+ $ (" #bellot" ).click (function () {
131+ var elec_id = $ (" select[name='election']" ).val ();
132+ var dist_id = $ (" select[name='district']" ).val ();
133+ var op= " " ;
134+
135+ $ .ajax ({
136+ type: ' GET' ,
137+ url: ' {!! URL:: to (' getBallot' ) ! !}' ,
138+ data: {' elecid' : elec_id,' disid' : dist_id},
139+ success : function (data ){
140+
141+ for (var i= 0 ;i< data .length ;i++ ){
142+
143+ op+= ' <tr>' ;
144+ op+= ' <td>' + data[i].id + ' </td><td>' + data[i].name + ' </td><td>' + data[i].username + ' </td>' ;
145+ op+= ' </tr>' ;
146+
147+ }
148+ $ (" #tblBellot tbody" ).empty ();
149+ $ (" #tblBellot tbody" ).append (op);
150+
151+ },
152+ error : function (){
153+
154+ }
155+ });
156+ });
157+
158+ // ---------------------------------------------------------------------
159+
160+
161+ // });
162+
163+ </script >
164+
165+
166+
167+ @endpush
168+
97169
98170
99171 @endsection
0 commit comments