Laravel Display Many to Many with Pivot in Blade - laravel

Background:
I have a pivot table with Medication, Patient with pivot element day, time, given, given by and lock.
Example:
id medication_id patient_id Day time given
1 1 (MED X) 1 (Patient X) Yesterday 0900 1
2 1 (MED X) 1 (Patient X) Yesterday 1200 1
3 1 (MED X) 1 (Patient X) Today 0900 0
4 2 (MED Y) 1 (Patient X) Tomorrow 1200 0
5 2 (MED Y) 1 (Patient X) Yesterday 0900 1
6 1 (MED X) 2 (Patient Y) Yesterday 1200 1
7 1 (MED X) 2 (Patient Y) Yesterday 0900 1
8 3 (MED Z) 2 (Patient Y) Yesterday 1200 0
A patient can have the same medication but at multiple times within the same day. Let's say Patient X had Med X yesterday at 0900 and 1200, today at 0900 but not tomorrow.
To see all the Medication assigned to the Patient X
$assignedMeds = $patient->medication()->get();
And passed it into the view.
What I have right now is
#if(isset($assignedMeds))
<div class="card-body">
<table class="table table-hover">
<tbody>
<tr>
<th>Name</th>
<th>Yesterday</th>
<th>Today</th>
<th>Tomorrow</th>
</tr>
#foreach($assignedMeds as $assignedMed)
<tr>
<td>{{$assignedMed->name}}</td>
<td>
#if(($assignedMed->pivot->day) == 'yesterday')
#if($assignedMed->pivot->given)
<i class="fas fa-check green"></i>
<strike>{{$assignedMed->pivot->time}}</strike>
<em>{{$assignedMed->pivot->givenby}}</em>
#else
{{$assignedMed->pivot->time}}
#endif
#endif
</td>
<td>
#if(($assignedMed->pivot->day) == 'today')
#if($assignedMed->pivot->given)
<i class="fas fa-check green"></i>
<strike>{{$assignedMed->pivot->time}}</strike>
<em>{{$assignedMed->pivot->givenby}}</em>
#else
<form method="post" action="/mar/{{$assignedMed->id}}">
#csrf
#method('PATCH')
<input hidden name="givenby" id="givenby" value="1">
<button>{{$assignedMed->pivot->time}}</button>
</form>
#endif
#endif
</td>
<td>
#if(($assignedMed->pivot->day) == 'tomorrow')
{{$assignedMed->pivot->time}}
#endif
</td>
</tr>
#endforeach
</tbody>
</table>
</div>
#endif
And it gives me
Medication Name Yesterday Today Tomorrow
Med X 0900 Given
Med X 0900
Med X 1200 Given
Med Y 0900 Given
Med Y 0900
What I am looking for
What I am trying to get is to display the name of medication once and show the time in it.
Example for Patient X
Medication Name Yesterday Today Tomorrow
Med X 0900 Given 0900
1200 Given
Med Y 0900 Given 0900

You could use the groupBy() and where() Collection methods in your #foreach. It should end up looking like this.
<!-- $index will be the 'name' we grouped by (medication name) -->
#foreach($assignedMeds->groupBy('name') as $index => $assignedMed)
<tr>
<!-- medication name -->
<td>{{ $index }}</td>
<!-- yesterday's medications -->
<td>
#foreach($assignedMed->where('pivot.day', 'Yesterday') as $yesterdaysMeds)
#if($yesterdaysMeds->pivot->given)
<i class="fas fa-check green"></i>
<strike>{{$yesterdaysMeds->pivot->time}}</strike>
<em>{{$yesterdaysMeds->pivot->givenby}}</em>
#else
{{$yesterdaysMeds->pivot->time}}
#endif
<!-- line break -->
<br>
#endforeach
</td>
<!-- today's medications -->
<td>
#foreach($assignedMed->where('pivot.day', 'Today') as $todaysMeds)
#if($todaysMeds->pivot->given)
<i class="fas fa-check green"></i>
<strike>{{$todaysMeds->pivot->time}}</strike>
<em>{{$todaysMeds->pivot->givenby}}</em>
#else
<form method="post" action="/mar/{{$todaysMeds->id}}">
#csrf
#method('PATCH')
<input hidden name="givenby" id="givenby" value="1">
<button>{{$todaysMeds->pivot->time}}</button>
</form>
#endif
<!-- line break -->
<br>
#endforeach
</td>
<!-- tomorrow's medications -->
<td>
#foreach($assignedMed->where('pivot.day', 'Tomorrow') as $tomorrowsMeds)
{{ $tomorrowsMeds->pivot->time }}
<!-- line break -->
<br>
#endforeach
</td>
</tr>
#endforeach

Related

The html file restored after deleting in windows looks different. How to restore the previous format?

I deleted my windows folder because of my inattention. I had important html files there that I didn't have time to push to the repository.
So I ran popular software to restore files (like CCleaner or Disk Drill), but the file I care about the most always looks the same (as in the photo below, this is the appearance after its restoration).
/#˙/s• ˙/ro˙Đ#„„9i·•#˙/uâđ/yTOŰńfő #qvsđls˙/˙}
ń/.Ń5xppk zĐ8 qT xp 3p€z0}5»PVq Đ*‘‘37wĐbt 0Đ»~0U/-0 Nwp cmŇ-lń| P±d‹°t±3'đ EPundĐŽ™
ż0o3?l˙}±=?Ueµ??“í?lĐ“s·oµ?5 1 7p˝So0'ń4q5p5r8t5?Ů5˙´˙´ ]d2 5w5Ż5#˙5s5• 55peúođŁsđµ˙´˙´˙´:ď:s5u5ś|5˙´ń©îc2Ť˙´q)tp,ŃR˙´4t ˙4_¸˙4g ˙ő4ńa´‘1Ó;´Q6?1ý?1e5?1´?1?1_“?1?1»g?1cspż0AÓ#}´q0ń0Řp´ę9ô0˙0˙0˙0˙0á– { ´˙0˙ó0• ˙0˙0˙0P‹˙0±QźŐaffffc ű0}y´`´pM7_.^.oµ p _ k z f 8 q x p3 Hz g 5€ c - 0 SŘ ** € ř :h 0 dcQ#“×  ŘP&ˇŁ& : 2 A 4  > â
'  Y
  F —Č! łm
‚#q Éá" k <3 Ä ™ 9 ˛dF©: żc{Gé  M i Ýr oD s€f t€tWQ€ n d€w€
-P S e€t‚
g€y n€;čÖ ŁH5W ekodt·$/ "D€0b u€µ€ë8p1÷ zH „ ¦S 7 E€Gp€r a€FiQ€n €Ot€r€e€X €Úo rU€p€
c€ça€)eE„t€- m€cck€‡x.€k€2Aa[Ŕ_‚,#Ĺ%O#eŁŔG%F l#g#Ň:Ŕ 4 AI#A9˘vBe T#uŔ©Á$d Á fŔl#Şe |i#eŔo#Z¶eŔZÁ4eŔGA'\ŔŞh#2lŔ\#oŔ
]Á4n#:ÁÉjsÄNh#KsŔH\Ŕi b Á CUAA.e .UŔpŔ2 Ân# P 2 9Ä˝sŔ…S+Á»Á˝h Ž;Ä˝?Î&$˙˝ { Ń˝żĎ˝EŐ˝E&˙˝` t &ľi 0˙^?h-h÷^ňŕ^"L mS PbCT ×!>ˇ]eas`s Aĺ`®f <˙^ď^tâeŕ>Şu`Icŕa 
e`J5aA_  w
ˇcb Ę3 l8 Gb a!˘® `!…cow`[t Ş `Fx` 0j H¨ Nŕ
w [c [!Xc+ â! l
rD '` Eŕ.dŰ  áws`ˇaFŕ aëˇaTcäu"áZcŻcec%aco``aŕ_·ˇ+'?%p˘m!xd˘?-ql1 7 6l 4B·#Sákál <äl~á˙l÷˙ËáĐńlżđË%ől%?˙lâ&˙ˤd–˙Ë- ×?Ő!Ő÷l¬ělC
±/}QYC%*ńW‘;Ń' Őp2a0"kĐ&g0 ×S]etUńł[pĐ[rÝhŃ%uf8˛4˙5ŞeĐ20˛?SPa0ÚF’.C”2Ó=6ź6k?2˙ceP.lp`‘a˙2q˙clóF?2“j?2?2ľlpÓ>_5Ń?2cPÚp0Bl°>sh6h2WŇnq1ń1čŔ=ô1Ęń˙1 ˙—12˙—˙—ű—‹ !Pś r˙ř—˙1ó—• ˙1˙—0ý˙1o°!rw&—u‡˙1'źś˙1źśc ű1ő Ľ“™  Ş pýCp _/12_/_/_/o_e[e˘P# ńqĺpP>uPU%˙†˛¶—{§P#~˙s• 0u÷±8¶ođ®»»S<űPu¶”pPő¶¶¶_¶¶q¶˙†˙†ep»yop†˙†·ŮŔF0MqsűrS·cp4··ż…·ďS·Ń”QˇtpV±L·ď14?y·1qdń/q0qâ?t0<Ď&000MpL2 ˙ć őć ý·#0s0• 00ď00Ň_·˙ćĐźëźS.0p0$µ ö L S P : T h e 8s y n c$e s i oQ D f r \pT a >k
g bs t t - mT i 2r Ns f 2. v p 9Q
i d Fo x5 .e Qs -Ys  _ 8 w k {b 3 )8 b q- 0 s/?dU w 7t ­ xE 0
- #N w c ›l lQ 1n g h nE _l€6r '€n ´ E€Ed€‰vF€U €#n€c€rĹ€u€p \€–é,\ wa‚}1
şe€pt„9…§… \€FŞo€’a€s€(t€Zi€#g€)Ľp‚(vë€xr€6l€>dŁę.€/p€» €1-ë€1 7 6 4€ü €8eh ** Ŕ#h„ Öá&“×€†Ř&€ˇŁ& € Ť ‚Ä Ŕ h Ŕ#Á D
 # E –Ŕ F#Ă! #ł #E Éá"Ŕ<3 ÄH E& A #˛d F©:żc{Gjé€/M#JcÂLEť-¬ WŔÁyoŔ•s#„
SJZSĸ;čÖ ŁH5Wekodtw/ D#b u#™ë#8p1÷ = ¬ ° SÉŮC#*e#‘íAĚCŔuÁeŔkÁ‹ĂŮ{˙×ÁnŔ“Cîß×áS`aŕPF`r C‡ŕkˇ#|= 0 /m˙dd+_dĄidío-Ńqd6 2$dsábácĘđ€UAäc$â˙c˙c#aińcŹ ! l ţrčc%őc%˙c˙c ‚?e&˙c?m#;% ëcő༓™ #‰a‘"ţ •żĘĄżĘˇ_˝Ę…ŤWâÖá<á= ŠBä=DĽa'˙ˇ˙ˇ :ń=«đˇż%ő=%˙=˙=˙ ˙Pżý|źUźUŃ˙PőPđPëU!ŃuppSrňPu†…Úrđ ez‡a0V±z•‡o0OopŠt "eLQ‡y‡, «pSyO*ePap -“
FĐu±sň“4 ]ŃI‘`Ń{c
T­u0‘drf°ęle#qi±yq_Ő1`oĐe0da°?†»?†=Nh°[Ń1†iđ“_1Ó3QO PO9[^ń0pń/q0Pp0Cńt0š<)0˛†°  súń0#0s• 0ű2oR!ß+ß+Ń+0O0†YźOg {Ţűp0˙· !‘ ©0»0˙·.đŹ‘¦±¬t¶˙p·¶¶ß1ą¶¶qŻ¶WĹ?„?0eP2lP°ű¶¶cPŚ¶Ý2?„׶ű‰?„c:pPB“/}¶P#q4ueDô4RZ˙4¶ł¶˙4˙4{¶e ţ#˙4ó4• ˙4˙4˙4˙PZ¶±ĐU0˙4˙4˙4˙4Ľc eye¶ŃZeЬćo2$¶c ěěńdîwr[4˙ę0r^˙´˙´˙›ëż0ż0ż0?ç—ä˙´’g0µ t i n g s y pc p r o v i d e X\ lŃ <c a s DÄÄ. Šp b¶e 6 2 4 i ** Ř Eh  Z)“ ×  Ř&ˇŁ& B ˘ 
'  :
 D F w ! E X rm #q p Éá"€5 < 3 ćL
˛d F©:żc{TGé cM€’c‚—sE€‘f€Ą- W€ n€ťo w€©- SŠ™S„˛;čÖ ŁH5Wekodt·$/ D€0b u€áő Ľ“™ • \ }Ťp€Ýc kU€g€s€Ra€eĐ - mŽ_.#-Az‚l#
t _ 8Ŕ‚eŔy b 3#5Š8ŔbÂ- 0FµP€[ ÁsÁuđ#S2FÄudÓ˙u×u“ô! AgłČuEŐuE&ë˙uBHtB{g#yCĎ˙uEËuë8p1÷b #t € ÉE µŔťp#"r#wÁ"oŔđ* ŔťtŔrByd h f# rŔ‚k[ŕW1A, eO`e« bˇLi n€plŕĄaŚ:ŕ4 ˇI «!W!Ťc T u"VeŕLáf`l e]ŕi`‰ááeŕ‹oU e`^a`
\`hŐ l`\ŕoŕ![»ˇšaeŕ ĺ4Ąśhŕű!aˇ›i`Zá#8çcńh2 9ä^yá\á]h Gä]DW.Ď˙˙ •ń ď]%˙ő]%˙]"'˙ŁĹe=˙]W?˘ă.÷]öŕ]L lSâ ⌠T ˇ=ˇ\#ő!e`#s`qă_˙]3źŞe Am Id aŕ Zx"hn`ăXs>˘ W ˇżaX ŕ¤i hQ`^0 xŕF0j Ń ° N Qw #ěVl áV `a`ydâ^r '` Eë"!ĘsfF ˇµ!Şn cŕ rŕ u `úp`Ŕs˘%c€ź]4ż‚ż‚ó"ß…Ó…?6 Ŕ 1 7 6Ô‚Uń5q6 Ht6\l6˙‚˙‚ 5[2 ˙‚đ„ó‚Ăe#˙6ó‚• 6˙‚6Ż˙‚q 6˙‚ođ]t°$_ź‡™O•6ue°|6CŐAeP$tĐ$C01$˙±WQ s6˙dź…•‘…˙5w±˙5‡w0‡qaS‹đ_±1F0 r C”2˝łŤ=6ź6?2˙ce6ölđ2ŃŻa’‘ń˙c3Gż?2“jß±?2?2?2o¸m?2 đ1ő´lq1ń1đŐŔ­Iô1T˙1˙1˙1Ł˙1h Ź˙´#˙˙1ó1• ˙1˙1p˙1˙1ű˙1˙´opR˙1źąśű1=ů´tĐ—˙´÷‚˙´t Ý_/e`_/¶b°hU/y…¶p qńqÔJůôőí˙P˙˙˙˙č «˙P#˙ó˙• ˙˙˙ ˙˙˙}˙dĐ˙˙óÓy¶÷đPUS¶n0{ł¶QwQQ1iđV"‡dŻŮ"˙·ÁF°Ma2ţńSř·Tµ e v i c pT r u s t Xd : # f a l De F Śl \ oT n c r uQ „p \ Fh lU Z\ Šo *m bnT g6e ¦tsÄ y ‚c h ‚Öâ\ 3i b'Ša…. —p p ‰
l=e 2 9 0 S ** h Kh{1“ ×  Ř&ˇŁ& B ˘€ €€
‚ U€
„€ # ! €
ł,‚
#…8 Éá"€5<3 Ä …L ! €˛ dF©:żc{¨Gé _M€oc‚śŠs€‹f€~- W‚yŠd€w€Ż- S€°jt€i€źg€–; čÖŁH€5Wekodt·$¨/ D#bŔ€g€N€ë8p1÷ €B( ö SL#S şPÂ…T#oÁbĹr Ŕ'şeŔ s#,Á‡AŽo#3Ş ŔnaŔpkŔgŔGv- Á‡K<. wÂp#mDe xŤ#<e#<Ĺ_ 8 ‚kŔ‘b 3 dŔbŔŹÁ- 0 UŔn#eŔ #
iŐŔh#0#0ŔÉ ¨ -#NBX Ŕ)ëA»CšgŔhŔ AÁ˝r 'Ŕ7 E#"~d#BI;˙ĆÍĆE×ÁĆoÝÄ%sŔ5GE^pÂŚAđŞdŔr#Ńl#3c#.Ăí_ql1 7 6Ä 4"Yo sákál LälĎ˙l˙láqńlĂďl%˙ől%˙lb&˙l˙l?v)źVS$ź÷l°ělC eŰ`9!˛Cŕ:á«eŕAáEĺălp c ˙k!Š˙k×a
ýkáÂSbRn#˘ˇ|ZC aŕb#|=`lx˙` kmd˙Çă1%_ddGdŁjqd6 2$di«ábácđ€ÂMäc]˙c˙Đ€Ż ńcŹ !ń Ů rčĐ%őc%×˙c˙1ROoĐTsShînđ hQ…rP+ź6ź‘‚˙1qhőĽ“™´ { \C_e§P012_et _/eR˙_e_eYe˘P# rvqńĺń‡Nôd“˙P‡‡ p2 ‡ ę s‡«˙P#˙s‡˙• ˙‡_Đs_Y˙g˙Ś˙Pc ˙Pu‡WđPU!‘§pr˛imn0z…r!ó~fýprpQĄ""qL«‡Q8P‡b01e01X0 ,Pµ
O*eWP41“
FP®aĐ°sőň“4ŇI…—Ń{˙·k˙·˙·e°ša°˙·a˙ň•ń±YUQ˙·•Wš­O POő·éů·Ot0xî6˙·˙·˛O˙·g0¸0w0’ BH¨| Yäpp ×ő·• 0˙0Đ#ßJ00˙·p“ĐßźĽTU#0u0ňp0˙·ßQ·3Ŕ˙·0ÓytźRP(îoŢs01v30“¸‘)e.µ"_p^w 5ŐĐ`102P7x0ŤÖy20ż·tp ·ż·ŃŤ3~ P…dP3~ep4ż·ŐŔ…‰1l˙±±h1ż·ż·ťż·źż·ó•5˙5 ą·ËôĄů·Pt6#6˙f˙fýf1µ#  :   FA 8ż!  łh##6 “×’BH ¨| Yp ×<3 Ä  PhVr l˛d F©:żc{ Gé M i c r o s f t - WQ n d w -P S e tg
y n 3;čÖ ŁH5W ekodt7I/ D ab u g ë8p1÷ z ¬ L€8S P : C€Te a€F˘e€o l€ e€EEMo€J p€cÔ k€g€)s€- m€_‹t. w‚i3 2€e bÔ v€e€h€}"_€-w 5€,1 ‚h€t x y€+˘w€- 0‚IS€Şa€F€r€Jh€=Şn€de€ť=€x€Ş0ŠF€2l€" €Şn€c‚e€a€_Z\Ŕ
h#Á6\BfaďÂ.ÁÁÉbsŔ!ÁbEj\ŔCoÂ#l#Q
pKBÁ9dŔr o.UŔpŔ) ŔiŔ=euŔe6ŔF4ĄŔ#5 ** čU  QDˇdD«€t Ř&ˇŁ& D
{ Ä D Ŕ Ŕc#Á
 ŃÇ‹„ !# r€»Ŕ€ #EŐÇE& ˙Ç=IZSÄd˙Ç% ëcő Ľ“™ #%  0ő'ŕ a 2ż^á{ż^c˝^ă+ uá;á<ĺŕ=Rä<ŹŕŁ’˙<Ŕ?÷ ;˙<é §đ %ő<%˙˙<bc˙ ˇ^˙ ?Ş-Ş÷ ®”€fĄAˇ†pŕlrŕŚçž#ťr"Łd ľfbŠ˙ˇ)ż?C=C, µĺO Re *áŻi jn Ůl`g “aą4ş ˇI ˇż!’c ŞT u`t`dâ«ţf`Ł™˙¦˙¦c7ĺ¦ĺĽýˇ iŕżá«ŁŰă)ˇńť 2 9 0Â`c Wŕ|á_á`pŕ`Sä`ÂlwA˘ó˙` ˙ť ÍŔđPó€˙€0ó€• 0˙€đ0oýqsđ˙€˙€˙€ź…ź…·ł0ő€üp0ů€TPyŰńgő #qwsvó€ß0u0.(oŇr0)p ń hp€±zlp 1‚ 0±”eUđ” đi:hP20«[0P-0 N°jwp cr/l‘ [Q†dPwQ5' t Eđwdđ‘9_2oű05ß…l°Ń?ß…uIUoß…ß…“ß…lĐ“s=tĐ8ß6 Ŕ1 7 6 ó…ro+q6ń6(đ6Tô6Ä~B˙6˙…2†˙…˙…ű6Éýg#˙6ó6• ˙6˙6˙P˙6˙6‘ őU˙…źĽźĽŮźŠc ˙6ő6¶ü6˙·Ýq¬cR˙·Q)tP,QTÝ˙·t4ó·6e°c6{ź¸±şyIź¸ź¸70ýiiň41uź¸Ń`eó+ß±ąż2ź/ź/oÇź¸×ż2Vż2cpp°BSBŻ›¸9ń1q2ř#±Ut2ü
2¸ł¸22{2ú•¸#2s2• 2ż22ęS2ęop’ßiiÓM{2y¸z‚ɸß/Wˇ_feîµ r e p . c h x a °p _ hw 5 n 1 ¨2 t dy św y -( 0 k Ľg eř ** € Vh >ÓdB“×  ŘP&ˇŁ& : 2 A 4  "
'  ‚:
  F ż ! E sm #q’BH¨€| Yp ×<3 x‘™ O ˛dF©:ż c{Gé M i€}r o Šs€f€|- W€ (n d€w€
- ŞS€„t€i€Źg€y€c ;čÖ ŁH5Wekodt·$/ DA€0b u g ť… ćˇ–©ˇ‚X źŔUB;Ń`z¸p °˙˙d  A˙˙/€F€!€=€jD C€_l l€,c‚]o€ZI€j
ř #
AA
A[D
B
u#
t
€l V€`hwLFt#‹eÜ mŔ#… :Â…Á‡Ę€"Wćś‹˙‡×‡±! AyłÇ‡ĂEŃ‡Ä E&˙‡;Ŕ?˙‡s#ÚSšË‡ë8°p1÷ŔpŔ[ž ŰŞSŔčnŔ° Ŕ{p#"ZrŔčtŔiÁ{ ŔŻtŔr#€eŔ~ fŃ# r  ~a`äy5¤t - 9-b. uë>.
p ?‰/‰,«`%O`eŕ‘aćS*FŕUa `s€ ´4 ˇI ácv`ęc T u"!€MŐ`aŕs`F`!^Őa!nŕc˘e káśZ\ h ˇb\ oµŕm n aeŕ«!'ás¤*h sŕÂ\ i b áăۡ!eb©á! bá# 2 9 ä¦ á`áa° Xyäa`ľ˙a˙ĄáŞńĄS˙đa%őĄ%˙ab'˙Ą˙ĄŢc? h2ĺF÷a#˙aŕ öa a]d`Qĺa7›?V­'V8?V"[f Ol Qje€Űi Fe áueí`ro ?Vg"Q?V?V7Qń+iq*ń*ŘH Yô*Ŕż˙* > ˙}1+˙}Ác˙} őő}y˙*#˙*ó}• ×˙*˙}R<oBtPV˙}?yU&˙}ź‚źźc «˙*ő[fđ*C…ER!¶NP
ńGf°Gł3 ň ő]| üX-0-qMqx_`‚n˛S Y NĐ} O P E R €A T I O0¨F LĐ GP=W˝mYqTQ2V °Lşx0 0: ßVż+eĐ-¶l°*–a˛eÓVcpZopYdP0óT\°l­upjŐWegZ>e0?ů­_X5 >7p­ˇ‰đśń,q-p Zt-˝dD«ź-˛«--{«‰ó- q‰• --űđXođ!ß„-«2Ź°°-u- P%ęS0%PŇ'Tr˘Ńłő‘ es°sŠ‰pĆoŃ‹Q(‰tpw}‰curUl#gĐŐ~_Îhűz]Î °qż“’±ń­ëż/Q0 pD Đ3±13«u Đa+d0.ęeĐ\' P7±žęsđ inß_PQ•ęupp/sr˙Šß_÷3ŹńŠo5•‘÷©•Rp o Q•dprĐŃ7±”7 ´ 1đ66pD7oq6•ń60đ6[ô6űy˙6ëdâ đß2 dwdúÍd#˙6ó6• ˙6˙6đ˙6˙61N˙6˙6ożi°!çS3˙6ő6şpdZLĐ6SĐ]ńZC°e0$‘3|චo n p# a c k Pg# e s t HtA H- m i dr śs f d. wQ Ln d <w ¬.Q >a l i –g- "h ra ®p "_ >w 5 61 h 2 ‚x y B‚w
- 0 : "SCn F Sr ZC 'aK‹= #xU 0
F l E 1n c9e u‘ ąp \…\ ˝˘aÉn ge …VtĹWy€5c€#oU€e€l€%c€#l«€"‘p‚(v€d€<Vr°™p€Ž „šee€6€Ť4 Ş- S0 ** ř \h €
LzD“ ×  Ř&ˇŁ& B€ ˘€ €€
‚ U€
€_Ŕ€^ ™ !# r, #E’B H¨| YpŔ×<3 DÄG& Â€˛dF©€:żc{Gé€1MŔJcBME‘- WoŔG‘Ŕ;ŔRtŔeC‘S#‡nŔd;čÖ ŁH5Wekodtw/ D#
b#g€NőĽ“™ €J ~DöŔcÁlB5oÁÂN W#ĄÁ{Á} N]Ä}â†ô˙}×}µ! ˇ7ţłč>%ő>%˙>˙>¨q˙>?H+Hë>ë8p1÷ > ˘€hëĺ
ápŕCrŕ~!ă˘#ˇrŕeŕť fO˘Ś˙Ą˙Ą˙Ąn óĄ,«`…ĄO`Veŕ+a ęi`nŔxl áOáŞt4 ˇIŕa_!–cµ`T u`!ĽdâŻ~f`Łť˙ŞĄ»˙ŞăŞh«ŕá(\bťb Ąsd{Ł+ˇńˇ2 9 0_Âbˇ¶ áaáb ŕb^ńäbwE˙ˇ˙ˇ žńˇćżŕbŔ« ±čb%ńbpx %˙b 0oĺ 0o Jt ˙ˇŁ)˙ˇ·? # ÷b¬p1ń/e6q«_ußcđoĐUd0
m\đ±tu°35eżr}:‘v?ůU!(0€4 7 6 )Đ#VS,bHT&.Đx­0 !°#701FĐ 1 3 4 8 `B E Ađ ń1(»
ł‹eĐ30đşFp7U±D¨ Rđtr°jHp(P)P9qCdŞ Ń
dđ8˛8rŞ4P FpŤDP 4 şC27lP±Q0xP<h: [0A méđ=t Ő>AĐ
1q<jt04]
2px–hq1ő1_ô1ů˙1k˙‚˙‚ 12 ˙‚9ö‚Ăc˙1 ˙ń1• ˙1˙‚2˙1ô‘RçńôAĐc ˙1ý«˙1Ż%‘‡˙1uc°đ1CPÚE˛SNP
Qf“gÚ poĐ0ń©c“Y¨ b°"oĐłsVrP2»Ą-P2oPŞau„sđ%gĐŞÓ¸-Ż’q!‘'Ń-x0"-Q6rRlnR
S Y N°&O Pđ/‚R0T I O0¨F LĐ Gđ=đ1_łq'ѱQ1 đ+xWP.Ń1±,fdđ1iďP±«ßB?¸ođ.ŃÄŃ}źAcP/ß#ßBFßBp×013q 2pÇ70 B2Aő1p `ô1dĽ˘F˙c˙´2µ˙´0µó˙1÷1˙1˙1ó´ż• ˙1˙1˙12$˙1gĐ˙3Y˙1˙1źą™*ŐH˙1ő1jüđ1LS°&Ń#T×đÜŃ5` ˛/sP •1Ż•č}
čc&pđ6Úup6eP1kR1?č˝;č P±ČSžńít0×S/au °z p3‘<[Ń2ąď P‘ëdr1rô '0 đ6±QF7˙–ÓçźvźvńCpUđyq–o ±˙ë3 řë¶ e r \ l# o c a ps t t i n# g s y cD p ”o v TdŐÄ. ´p T ÄR e 1 7 P6 4 c.p ** ( ah0l˝F “× Ř&ˇŁ& B  Ť
'  :
  F ÉČ! łm
#q’BH¨| Yp × <3 Ä …L €˛dF©:#żc{Gé _MU€|c‚s€”f€Ź-D W€ n d€wQ€“- SŠśS„ś; čÖŁH€5Wekodt·$/ D€0b u€Ë ë8p1÷˘ z ¶ ¦L€?S P ‡ C€TŞe€ćt€C€Ol€ĆVe€Řęo€ç €ÜaU€k€gŔsŔ3aAŔ e - mN:.¬ wJ:Á~a#t#"*r#pBk#r "_#w 5Ŕ1 ¨h 2ŔxŔAe#ŞyŔ0B'SŔa#jF#&rŔ*h#!ÁšeA#Q= 0 xŔ 0UĘ F#lŔ #nµŔcBeŔÁ!\Ŕ
Öh#A9\ÂhaB1ÁýÁe#!ÍłEoľ˙ĘÁĘľ6ŔFCĘŔ\ÁÇÁÉř ­bÄÉĹ˙ÉŘÉ• !ń#Ű rČÉ%őd%˙˙db0˙d#Ś˙d? + ëd€őĽ“™ #Š¨ z eŔp NÜc ż_á|ż_iŕYż_Î- Z ‹G <3á=á> cä>3ŢG˙Ł˙Ł ;ńŁżŕŁŔ­ś ±č>%ń>x'˙>˙>(q˙>˙>ů>飬·ŕŁáža o ?‡g`âµaŘo`Śdŕ‹Łŕ\ =­!ĺu ľ%ăe ™gŕ“Çá’ýĄć( 1ŕäˇĺ¶)ŕóĆH`śá˛. ›Zx` !ŕGŁ˘7#ÝF`í1 3 8 B E Aŕ: Ü ( ˇřˇĄr˘­%©QŻ4 8 Ę)PR#đÓ\n Hđ( ¬9 qQSd01đV7Đ18r4P FŐ°[DĐ 4 CP51XUgne\t0[Ő0A’epYp µ®AĐ
1q…tpb]f
2py
hq1ń1 dô1=˙1k˙˙ 12 ˙ú ő±đ1Q€ů˙1źó• ˙1˙2o ˙vsĐq nđ˙ńFrűź0opvźŐ˙ő®žđ1U1vpđ rĐW±ó‚‚r°ep wq4„tR„źTs6 „źTn2„0 Ö,"O°eP+Śęipnđ1lpŃ«11ş4ŇIP<ń“±&cđ
ZTu01’d’2fŐ0leđi“˙†ż˙†‘˙†‘ń‡UBhňęt0l°Bbp •“WQŐA9µ2801t¬ .q0ń0đ0eô0|Žž˙0˙0˙0˙0˙b4 »˙0#˙0 ßńb• ˙0˙0Ro˙0P˙˙´3X˙0˙0źą9 u#˙0Uő0¨đ0Cđ´Er!N[P
ńfJg p9o"QVc01S' b[0%38e ťÔ-pak0Ô‘3i’4uP'-[ňc1 rĐd±
-*x×p-Ńf1¶rđ.o~.Ń- S Y NXO°żE R`T I ˘O0F LĐ Gp¶=pb3m2e˛
¬ ń¶7]f
d˙/ëQu2p˛+˙¶“ýpcđźt_s›vů1Ş Đł5o5’1lń0q1xp1ft1'›Kż”ć˛ććA˘bvbüć1sb• 1˙1đߏß]FŐ,111e¶ t i n g S y pc / D e b u ë8p1÷  L śS P : T h± ¤ sre s i o –
f r Rp a ¨c k
g bs ć‚a e - m +¨c r 's f . w n d Şw M. 9l u  e x p Ar !*e­e o %t ˘_ 'w 5 1 Ş2 Ix —e My gÖ0 …1d =d c˘t ' 0€)0€E‰ € N‚# ±€+a l€ “ €Şa€2d€e€\'€>¨ E‚S€.s€UF€Rl€ €#nU€c€r€u€p\ \€ź,\‚€aׂ†Ĺ
e€`t€ «…°… \€=o„Ks€(k‡â…p‚(v€xrë€6ˇc€<l€;‘-MµÁ]p#[ ŔA>e#M€1 7 6 4Ŕ‚ lx ** 8Ŕgh K˛K“ ×  Ř&ˇŁ& "  ‘ Ä ”   Ŕ#Á
 # šŔ FA#Ő! #ł, #E’B H¨| YpŔ×<3 Ä E& A #
˛d F©:żc{4Gé€/MŔIKˇ- vWŔGˇ-Ŕ˝IMEË; čÖŁH€5Wekodtw©×ÝÂËÝCŔve#rÚt#~CŔ”Ae#A‹;ĂÝ˙Űoŕ!G˙mn «óm!„SbTn€7o`ćC$gc€= 1off?ătf­kf=qf6 Š2$f8`‘e káeÓáfŔ` häfś˙f˙föfˇ ! o rčf%őf%˙f ;!°oí ˝tŕ¦˙fn B˙f?pńŐőĽ“™ éa+ †"`żĎżĎżaąĎ€ŽB ˇ$ ˘á? Ĺ Źiä?h.L˙¦€—a§˙¦!
:€ ă¦ćÁঀ ±č?%˙Ŕ x • ˙S0Hő_1q_†˙iP!y€źź‘$SőŠ®ŻpSńP±QńGe0MaĐ »źw™wc˛uцD\ ×5±„gbe°u?«ůUA(R4t)0‹ßŃH˛t .°]Zx0 !PR“‰7PTFĐ1 3đD8 Bm0‡Ađ qV(
3ŠeŹĐ8ŐŚ_4 8ž ) Rđt0šr°‹Hpń 0 ‘©qNd ń d82Š8’4P F Cv 3 C°h1h±hn«P‹Qšt€{[PARŚÚeŤp UsAđ
1Őń‰tPš]°
ő1q1ĺő1jô1±3˙1…ł…­˙1°……v…˝đ1˙}…˙1s…• ˙1˙1˙1˙Ö­…SM˙1˙1źVŠ˙Ľý÷ĽŞđ11Ş“µ‘ąő»µ“şre˙Ľa0Âýżt Ń˙Ľ‘,˙ĽŐ4o˙Ľ˙Ľ˙…óĽ,0#ŐOGP=‘/·F l0 g´ sp( đ2ŃIĐ «±ÍQ'c°/T0/u0ő‘drf0ó±Dúe0l0.QKż»ń-ą»öh”=±»iđŐQHł÷Đő˙ Đ907Á1tžő1 kô1P×˙1˙1˙1 p2 ˙1ő÷1µ˙1#˙1óc• ˙˙1˙1˙1˙1˛VWę˙1˙1Ż˙1˙1˙1÷1˘đ1CpżîE˛!Ńŕ1fđJ¦‘áÖo2 Ű·bp%o°ž‘ŮVrđ%Ys’f0ií+ađ°qĽd0q(ű±Xń-đ)±·‘21ăQôFo^.‘^S YęC O PaR AUpůIĐ NđbLĐ Gí=0Ó
m01é±Đňµ 0 x 8 P0 4 Pf c d F i lD e čo n c o r u a p \ s hU 4l Ś\ .o *mQ bn g 6c *oD u Šs y zcU&e 2gfe.Ő “p w Yi 7— 2 5 7 a we s # ** lh ´®M “× Ř&ˇŁ& ! € €F€
‚D €
:€  ‘ Á!a€ ±6 #…8’BH¨| Yp€×<€3 x …LH ‚' ˛ dF©:żcP{Gé _M€Śc‚¬s€Ľf t -T W‚–d€w€ż-´ S€Ŕt€g€µ;čÖŁ H5Wekod˘t·$/ D#b#rg€Në8p1÷â ? ® S˙…˙…Ĺ…( 1Ŕ®7 6¬ )Ŕ’ÓEHŔMs#KŠ.Ŕ4xŔ ! 0D Š7€rFŔ’1 3#€8 B E AŔj:#ż(#ža#ťÁÂrŻ€~AËĂ
O
4#ŃD# ¨ RŔtŔMrŔŞVH#qÁ'1BtŔpdj Ád#8ÂÇŢF´ CŔ\ ŔĂ CŔŐUÁŘCŔ.nŔ.e#ętU#![#9AŔtŔmµŔĹtFAŔ+ÁvŔęt#ß]Ŕ
‚™ŔćÁĹ‹ÁÇÁÉmÄÇŁ4N˙c·˙c`ińcąŕcˇ\łčc˙%őc%˙c˙cb$˙c?mVe0 ÷c¦ŕcC`2Em"FN 7a2fŕ1c U 4o¤Jc iâ; ¬ b"ˇ{e s˘H+!áŞs €fŕr jm u žgŕ!Z-Ż`=ŁCáM!- xŕBVlâa p r J!
ˇwá[S Y ˘N NO P ^Rŕ^ T I O`F ęL G = b#aM˙!aáNˇˇaÇÇÇëÉ'Ç!&a-e }Çr ‚oĺĆ€ näb<ăĺ˙b˙ĆáËńb#ś! íb%ńbÄ'Ż˙b˘H˙ĆcQSP)nđ(ťciPĐĐ&o hń(źV‘1ucUP%S0%P’1TR„ łk‘ p|đ 1/ µ°,aĐkĐ+U/ap3e01±#c. wż1•r ń.Q+q2dp0Şlvň0yđ4apZQ3„r _pwp…nQ0eh 2PxeU0yĐ1 pnŐĐŤe0 ˛tpł0«5eu 0 Đ4op714łd“ P‘d uÓe'p P8±‘s×vßßePlpa~a0
3‘šąK™59\˝Poq ýF3p˛[ńdqrQEcl{đ żc°18 k°Ńz4’irq7qi#Ĺđ7oô7Ű+Oi›Ű˛››°››pťs›śÝ˙7˙7 ń7˙• ˙7›ĐV˙71 _3˙7ý›o˙7° ˙7ő7jĘpiLĐ7SĐ^ń[C˝°e‘11†±†eĐ ëb7tÔ-&7Q'»7ńZt3771p1Ő75CS˛*n›0ćC43A= ‘Ě8ż3˙ż3ż3ńcż3óż3ź0“żż3ż3s:u9ż3 P®>2yˇ3Ô7q3ń3Č pô3",˙3ĎuĎ ś2 ˙3÷3©Ä !0 rxť˙˙3ó3• ˙3˙3˙3Đ#˙3Q˙3˙3˙3ÔÔű3#őĽ“™ bŢŽËĐϡEpP0c ßh_1Ntđ‡ßhßhi ßheĐ9ßhÝh"T# 2+ńq pTqt j‰ y </td>
<td>Vertical gap between items</td>
</tr>
<tr>
<td>caption</td>
<td>
'pushTop'
<br>'pushDown'
<br>'revealBottom'
<br>'revealTop'
<br>'revealLeft'
<br>'moveRight'
<br>'overlayBottom'
<br>'overlayBottomPush'
<br>'overlayBottomReveal'
<br>'overlayBottomAlong'
<br>'overlayRightAlong'
<br>'minimal'
<br>'fadeIn'
<br>'zoom'
<br>'opacity'
</td>
<td>'pushTop'</td>
<td>Caption - the overlay that is shown when you put the mouse over an item. <br>NOTE: If you don't want to have captions set this option to an empty string (e.g. caption: '')</td>
</tr>
<tr>
<td>displayType</td>
<td>
'default'
<br>'bottomToTop'
<br>'fadeIn'
<br>'fadeInToTop'
<br>'sequentially'
</td>
<td>'fadeIn'</td>
<td>
The plugin will display his content based on the following values.
<br>- default (the content will be displayed without any animation)
<br>- fadeIn (e.g. lazyLoading) (the plugin will fully preload the images before displaying the items with a fadeIn effect)
<br>- fadeInToTop - fadeInToTop (the plugin will fully preload the images before displaying the items with a fadeIn effect from bottom to top)
<br>- sequentially (the plugin will fully preload the images before displaying the items with a sequentially effect)
<br>- bottomToTop (the plugin will fully preload the images before displaying the items with an animation from bottom to top)
</td>
</tr>
<tr>
<td>displayTypeSpeed</td>
<td>only integers, values in ms (e.g. 200, 300, 500)</td>
<td>400</td>
<td>Defines the speed of displaying the items (when <i>displayType: 'default'</i> this option will have no effect)</td>
</tr>
<tr>
<td>
lightboxDelegate
</td>
<td>strings that represent the elements in the document (DOM selector)</td>
<td>'.cbp-lightbox'</td>
<td>Define any clickable elements you wish to use to trigger lightbox popup on click. </td>
</tr>
<tr>
<td>
lightboxGallery
</td>
<td>true or false</td>
<td>true</td>
<td>Enable / disable gallery mode for lightbox popup</td>
</tr>
<tr>
<td>
lightboxTitleSrc
</td>
<td>HTML atributte</td>
<td>'data-title'</td>
<td>Attribute of the delegate item that contains caption for lightbox</td>
</tr>
<tr>
<td>
<span style="color: #D66767">lightboxShowCounter</span>
</td>
<td>-</td>
<td>-</td>
<td>This options is deprecated. Please use lightboxCounter option instead</td>
</tr>
<tr>
<td>
lightboxCounter
</td>
<td>HTML markup code</td>
<td>
'<div class="cbp-popup-lightbox-counter">{{current}} of {{total}}</div>'
</td>
<td>
Markup of the lightbox counter. To hide the counter for lightbox put this option to an empty string (e.g. '')
</td>
</tr>
<tr>
<td>
singlePageDelegate
</td>
<td>strings that represent the elements in the document (DOM selector)</td>
<td>'.cbp-singlePage'</td>
<td>Define any clickable elements you wish to use to trigger singlePage popup on click. </td>
</tr>
<tr>
<td>
singlePageDeeplinking
</td>
<td>true or false</td>
<td>true</td>
<td>Enable / disable the deeplinking feature for singlePage popup</td>
</tr>
<tr>
<td>
singlePageStickyNavigation
</td>
<td>true or false</td>
<td>true</td>
<td>Enable / disable the sticky navigation for singlePage popup</td>
</tr>
<tr>
<td>
<span style="color: #D66767">singlePageShowCounter</span>
</td>
<td>-</td>
<td>-</td>
<td>This options is deprecated. Please use singlePageCounter option instead</td>
</tr>
<tr>
<td>
singlePageCounter
</td>
<td>HTML markup code</td>
<td>
'<div class="cbp-popup-singlePage-counter">{{current}} of {{total}}</div>'
</td>
<td>
Markup of the singlePage counter. To hide the counter for singlePage put this option to an empty string (e.g. '')
</td>
</tr>
<tr>
<td>
singlePageAnimation
</td>
<td>
'left'
<br>'fade'
<br>'right'
</td>
<td>
'left'
</td>
<td>
Defines which animation to use when singlePage appear
</td>
</tr>
<tr>
<td>
singlePageCallback
</td>
<td>
function(url, element) { <br>
// to update singlePage content use the following method: this.updateSinglePage(yourContent)<br>
}
</td>
<td>null</td>
<td>Use this callback to update singlePage content. The callback will trigger after the singlePage popup is open. (#param url = the href attribute of the item clicked, #param element = the item clicked)</td>
<li class="page-item"><a class="page-link" href="javascript: void(0);">7</a></li>
<li class="page-item"><a class="page-link" href="javascript: void(0);">8</a></li>
<li class="page-item"><a class="page-link" href="javascript: void(0);">9</a></li>
<li class="page-item"><a class="page-link" href="javascript: void(0);">...</a></li>
<li class="page-item"><a class="page-link" href="javascript: void(0);">394</a></li>
<li class="page-item">
<a class="page-link" href="javascript: void(0);" aria-label="Next">
<span aria-hidden="true">»</span>
<span class="sr-only">Next</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
<!-- Footer Start -->
<footer class="footer">
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<script>
document.write(new Date().getFullYear())
</script> © Konektia - Wszystkie prawa zastrzeżone.
</div>
<div class="col-md-6">
<div class="text-md-right footer-links d-none d-md-block">
Wsparcie techniczne
Wyloguj
</div>
</div>
</div>
</div>
</footer>
<!-- end Footer -->
</div>
<!-- ============================================================== -->
<!-- End Page content -->
<!-- ============================================================== -->
</div>
<!-- End -->
<div class="rightbar-overlay"></div>
<!-- /Right-bar -->
<!-- bundle -->
<script src="{% static 'assets/js/vendor.min.js' %}"></script>
<script src="{% static 'assets/js/app.min.js' %}"></script>
</body>
</html>
Is there any way to restore the file in classic form or change these unusual characters to correct HTML code? I tried to change the UTF encoding but to no avail (I use Windows 10).
How can I restore a deleted file in the correct form or change the html file restored to the correct form?
So I ran popular software to restore files (like CCleaner or Disk Drill), but the file I care about the most always looks the same (as in the photo below, this is the appearance after its restoration).
According to me you didn't permanently delete the file right? cause whenever a file is deleted it goes to the recycle bin...you could've easily restored it from there, but now there is no reason crying on spilt milk.
I think this should work as I have never seen this error...ping me if this works or not!
right click on the file, go to properties and then click on previous version and then if there is a previous version then jump in the air and yell hooray!
This link might help you!
That's all I have, welcome.

Laravel total foreach index number

I want to total all the rows to loop, what do I do?
example :
index 0
ixdex 1
I want this ซ
index 2
My code :
#if(isset($unread[$messages_conversation_teachers->conversation_id]))
#foreach($unread[$messages_conversation_teachers->conversation_id] as $_index =>$unreads)
{{$_index}}
#endforeach
#endif
try this $loop->iteration it start from 1 not 0
#if(isset($unread[$messages_conversation_teachers->conversation_id]))
#foreach($unread[$messages_conversation_teachers->conversation_id] as $_index =>$unreads)
{{ $loop->iteration }}
#endforeach
#endif
ref link https://laravel.com/docs/8.x/blade#the-loop-variable

Laravel Sum each section using foreach

I have below table with data.
ID - CLASS - CATEGORY - AMOUNT
--------------------------------
1 I A 5000
2 I B 6000
3 I C 7000
4 V A 9000
5 V B 12000
now I want to sum the amount classwise in blade.php using foreach loop. like class I total is 18000, class V 21000 etc..
Controller Function:
$viewRecords = YearlyFees::Where('registration_id',Auth::user()->id)->get();
return view('yearly_fees_setup',
['viewRecords' => $viewRecords]);
Blade.php
#foreach($viewRecords as $record)
<tr>
<td>{{$record->Standard->class}}</td>
<td>
{{$record->Category->category}}
</td>
<td>{{$record->amount}}
</td>
</tr>
<tr>
<td> ?????? TOTAL of each class </td></tr>
#endforeach
Result:
Class Category Amount
I School Fees 5000
I Tution Fees 6000
I Library Fees 7000
**I WANT TOTAL HERE**
V School Fees 9000
V Tution Fees 12000
**I WANT TOTAL HERE**
Please help
You need to create a variable (or two) inside the for loop do conditionally echo out the total.
#php
$total = 0;
$category = null;
#endphp
#foreach(...)
#php
$total += $record->amount;
#endphp
#if ($category != $record->category)
{{ $total }}
#endif
#endforeach

Ruby to get the value from HTML table which has same elements

I have a HTML file code which is shown below:
<table id="plans" class="brand-table">
<thead>
<tr>
<th class="domain">Plans</th>
<th class="basic">Basic</th>
<th class="plus">Plus</th>
<th class="prime">Prime</th>
</tr>
</thead>
<tbody>
<tr class="even">
<td>
www.test.com
</td>
<td>
<input name="upgrade" type="radio">
//this span element is hidden
<span class="plan_status"></span>
</td>
<td>
<input name="upgrade" value="plus www.test.com" type="radio">
//this span element is hidden
<span class="plan_status"></span>
</td>
<td>
<input name="upgrade" value="prime www.test.com" checked="" type="radio">
<span class="plan_status">current</span>
</td>
</tr>
</tbody>
</table>
I want to check which plan is the current plan in the page through Ruby Watir. Below is the script:
require 'watir'
browser = Watir::Browser.new(:chrome)
browser.goto('file:///C:/Users/Ashwin/Desktop/new.html')
browser.table(:id, 'plans').tds.each do |table_row|
if table_row.input(:value, 'plus www.test.com').text =~ /current/i
p 'current plan status is plus'
elsif table_row.input(:value, 'prime www.test.com').text =~ /current/i
p 'current plan status is prime'
else
p 'current plan status is basic'
end
end
But I am getting the output as:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/element.rb:513:in `assert_exists': unable to locate element, using {:value=>"plus www.test.com", :tag_name=>"input"} (Watir::Exception::UnknownObjectException)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/element.rb:86:in `text'
from C:/Users/Name/Documents/NetBeansProjects/RubyApplication6/lib/new_main15.rb:8:in `block in <main>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.11/lib/watir-webdriver/element_collection.rb:29:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.11/lib/watir-webdriver/element_collection.rb:29:in `each'
from C:/Users/Name/Documents/NetBeansProjects/RubyApplication6/lib/new_main15.rb:7:in `<main>'
But I want the output to be as:
current plan status is prime
Can anyone please help?
Thanks in advance
Instead of checking which td element has the "current" text, I would suggest checking which radio has the checked attribute. This reduces the number of elements you have to worry about interacting with.
You can find the selected radio using:
table_row.radios.find(&:set?).value
You can then check the value of the radio to see if it starts with the word "plus" or "prime":
# Note that we scope to the tbody to ignore the header row.
# Also make sure you do `trs` not `tds` for the rows.
table_rows = browser.table(id: 'plans').tbody.trs
# Iterate through the rows and check the checked radio button
table_rows.each do |table_row|
case table_row.radios.find(&:set?).value
when /^plus/
p 'current plan status is plus'
when /^prime/
p 'current plan status is prime'
else
p 'current plan status is basic'
end
end
Note that for older versions of Ruby (ie v1.9), you will need to find the selected radio using:
table_row.radios.find { |r| r.set? }.value

How can I search a table faster?

I am trying to search a table for specific a specific value using Ruby and Selenium-webdriver. I have a method that works but takes a lot of time for some reason. It is a one row table and the page HTML looks like this:
<div id="permitGridContainer">
<table id="calendar" class="items" style="width:430px;" name="calendar">
<thead>
<tbody>
<tr>
<td id="avail1" class="status r slct" onmouseout="return nd();" onmouseover="return overlib("Available Quota<br>River Launches : 0 of 4");">
<div class="permitStatus">R</div>
</td>
<td id="avail2" class="status r" onmouseout="return nd();" onmouseover="return overlib("Available Quota<br>River Launches : 0 of 4");">
<div class="permitStatus">R</div>
</td>
<td id="avail3" class="status a" onmouseout="return nd();" onmouseover="return overlib("Available Quota<br>River Launches : 89 of 99");">
<a onclick="javascript:setNewArrivalDate("Sun Sep 06 2015", 2);return false;" href="#">
A
<br>
<small>89</small>
</a>
</td>
<td id="avail4" class="status a" onmouseout="return nd();" onmouseover="return overlib("Available Quota<br>River Launches : 97 of 99");">
</tr>
</tbody>
</table>
</div>
... I shortened the table it has 14 columns.
I am looking for a column that has an Item available and I am checking the class for this, but the text also changes so there are other things I could look for.
This is the code I am using, but it visibly slow. I used puts statements to see the progress. My sense is that is has to do with time accessing the element. So I was hoping there is a better way to process the table quickly. Thank you.
for j in 1..days_to_check[i]
check_avail = driver.find_element(id: "avail#{j}")
check_availclass = check_avail.attribute ("class")
if check_availclass == "status a" or check_availclass == "status a slct"
#process if
end
Depending on your comment I would suggest to use the following xpath. I find this is often easier and feasible to use better xpath than looping though the html table
//td[(#class='status a') or (#class='status A')]
This xpath finds the class with status a or status A

Resources