Two conditions I want to apply for a button that will show the application when applied and if the user has a login then the button will show and ask to login.
Blade
#if (Auth::check())
#if ($tuitionJob->checkApply())
<form action="{{url('/tuition/apply')}}" method="POST">
#csrf
<input type="hidden" value="{{$tuitionJob->id}}" name="tuitionid">
<button type="submit" class="btn btn-primary login-apply-btn my-2 text-light pull-right">
Apply <i class="fa fa-send"></i>
</button>
</form>
#else
<a href="/login" class="btn btn-primary login-apply-btn my-2 text-light pull-right">
<i class="fa fa-send"></i>
Login For Apply
</a>
#else
<a href="tuition/job" class="btn btn-primary login-apply-btn my-2 text-light pull-right">
<i class="fa fa-send"></i>
Applied
</a>
#endif
#endif
Model
public function checkApply(){
return \DB::table('tuition_applies')->where('users_id', auth()->user()->id)
->where('tuition_post_id', $this->id)->exists();
}
Try && Logical Operator
#if(Auth::check() && $tuitionJob->checkApply())
//Code
#else
//Code
#endif
May be helpful for you
#if (Auth::check())
#if ($tuitionJob->checkApply())
<form action="{{url('/tuition/apply')}}" method="POST">
#csrf
<input type="hidden" value="{{$tuitionJob->id}}" name="tuitionid">
<button type="submit" class="btn btn-primary login-apply-btn my-2 text-light pull-right">
Apply <i class="fa fa-send"></i>
</button>
</form>
#else
<a href="/login" class="btn btn-primary login-apply-btn my-2 text-light pull-right">
<i class="fa fa-send"></i>
Login For Apply
</a>
#endif
#else
<a href="tuition/job" class="btn btn-primary login-apply-btn my-2 text-light pull-right">
<i class="fa fa-send"></i>
Applied
</a>
#endif
Try this
Related
Below is my blade codes, the error shows thats its caused by line 307 of the codes.
#endwhile
#endif
Total Request
</table>
<div class="text-center {{$visibility}}">
<button class="btn btn-secondary btn-s add_row_after">
<i class="fa fa-fw" aria-hidden="true" title="Copy to use plus"></i>
Add Row After
</button>
<button class="btn btn-secondary btn-s add_row_before">
<i class="fa fa-fw" aria-hidden="true" title="Copy to use plus"></i>
Add Row Before
</button>
<button class="btn btn-secondary btn-s remove_row">
<i class="fa fa-fw" aria-hidden="true" title="Copy to use minus"></i>
Remove Line
</button>
</div>
does anyone know how to add the decimal number_format here?, I don't use the blade from Laravel but I route the view directly to html... so if I add the number_format attribute, I'm confused ;(
<tr dir-paginate="income in incomes | filter:searchText | itemsPerPage:20" total-items="totalItems">
<td>{{income.incomeTitle}}</td>
<td>{{income_cat[income.incomeCategory]}}</td>
<td>Rp.{{income.incomeAmount}}</td>
<td>{{income.incomeDate}}</td>
<td>{{income.incomeNotes}}</td>
<td>
<a ng-show="income.incomeImage != ''" target="_blank" href="{{'index.php/incomes/download/'+income.id}}"><button type="button" class="btn btn-success btn-circle" title="{{phrase.Download}}" tooltip><i class="fa fa-cloud-download"></i></button></a>
<button ng-show="$root.can('Incomes.editIncome')" ng-click="edit(income.id)" type="button" class="btn btn-info btn-circle" title="{{phrase.Edit}}" tooltip><i class="fa fa-pencil"></i></button>
<button ng-show="$root.can('Incomes.delIncome')" ng-click="remove(income,$index)" type="button" class="btn btn-danger btn-circle" title="{{phrase.Remove}}" tooltip><i class="fa fa-trash-o"></i></button>
</td>
</tr>
Im displaying a treeview data and everything works perfecly.
But when i add the fourth raw, Laravel crash.
I want to post my code but i don't even know which one and where that came from..
view :
<div class="list-group">
<div class="col-md-12">
<div class="col-md-2">Departement</div>
<div class=" float-right">
<button class=" btn-primary" type="button" data-toggle="collapse" data-target=".multi-collapse" aria-expanded="false" aria-controls="multiCollapseExample1" >
<span class="glyphicon glyphicon-eye-open"></span></button>
<button type="submit" class="btn btn-warning " data-toggle="modal" data-target="#exampleModalposition"><span class="glyphicon glyphicon-plus-sign"></span></button> </div>
</div>
<div class="list-group-item" name="state">
#foreach($treeViewPosition as $departement)
<div class=" collapse multi-collapse collapse in " id="8" >
<div class="col-md-2"> {{ $departement->departement_name}}</div>
<div class=" float-right"><button class="btn btn-success" data-toggle="collapse" data-target="#{{ $departement->id}}8" aria-expanded="false" aria-controls="{{ $departement->id}}8">
<span class="glyphicon glyphicon-eye-open"></span></button></div>
<div class="list-group">
#if(count($departement->position))
#include('treeposition2',['position'=>$departement->position])
#endif
</div>
#endforeach
</div>
</div>
</div>
Robot framework doesn't identify the element by xpath.
Following is the code
<div id="sticky-actions-sticky-wrapper" class="sticky-wrapper" style="height: 100px;"><section class="content-header" id="sticky-actions" style="">
<h1>Curriculum</h1>
<div class="breadcrumb save-message hidden">
<label class="text-success">
<i class="flaticon flaticon-circle-check"></i>
Saved <span>a few seconds ago</span>
</label>
</div>
<div class="row p-t-15">
<div class="col-xs-12">
<button type="button" class="btn btn-primary add-task-btn" disabled="">Create New Task</button>
<div class="btn-group m-r-15">
<button type="button" class="btn btn-primary dropdown-toggle add-statement-btn" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="">
Create <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a tabindex="0" class="add-curriculum-btn">Curriculum</a></li>
<li><a tabindex="0" class="add-learning-area-btn hidden">Learning Area</a></li>
<li><a tabindex="0" class="add-topic-btn hidden">Topic</a></li>
<li><a tabindex="0" class="add-outcome-btn hidden">Outcome</a></li>
</ul>
</div>
<button type="button" class="btn btn-circle btn-xs blue link-statements-btn" disabled="" data-toggle="tooltip" data-placement="top" title="" data-original-title="Link selected statements">
<i class="fa fa-link"></i>
</button>
</div>
</div>
</section></div>
Xpath I used to for find "Create" button:
xpath=//*[#id="sticky-actions-sticky-wrapper"]/div[2]/div/div/button
xpath=//*[#id="sticky-actions"]/div[2]/div/div/button[.//text() = 'Create']
Robot Framework step:
click element xpath=//*[#id="sticky-actions-sticky-wrapper"]/div[2]/div/div/button
Error:-
ValueError: Element locator 'xpath=//*[#id="sticky-actions-sticky-wrapper"]/div[2]/div/div/button' did not match any elements.
According to your XML, there is a section element inside the first div which you didn't include in your XPath. It should work if you add it:
//*[#id="sticky-actions-sticky-wrapper"]/section/div[2]/div/div/button
or
//*[#id="sticky-actions"]/div[2]/section/div/div/button[.//text() = 'Create']
In my current spring project, one of the views have the following thymeleaf code:
<div class="input-group" th:each="item : ${role}" th:id="${item.getId()}">
<span class="input-group-addon" th:with="possui = 'not'">
<span th:each="item2 : ${usuario.getRole()}" th:if="${item.getId() == item2.getId()}" th:with="possui = 'yes'" class="glyphicon glyphicon-check" th:id="icon__${item.getId()}__" aria-hidden="true"></span>
<span th:if="possui == 'not'" class="glyphicon glyphicon-unchecked" th:id="icon__${item.getId()}__" aria-hidden="true"></span>
</span>
<input type="text" class="form-control" th:value="${item.getNome()}" disabled="disabled"/>
<span class="input-group-btn">
<button class="btn btn-default" th:attr="data-id=${item.getId()}" type="button">
<span class="glyphicon glyphicon-refresh" aria-hidden="true"></span>
</button>
</span>
</div>
in the first block from input-group (the one with the class input-group-addon), should be displayed the checked icon if the user has the role, or the unchecked icon if the user hasn't. But with the code above, only the checked icon is displayed.
Anyone can see what's wrong with this code?
<span th:if="possui == 'not'" class="glyphicon glyphicon-unchecked" th:id="icon__${item.getId()}__" aria-hidden="true"></span>
should be
<span th:if="${possui == 'not'}" class="glyphicon glyphicon-unchecked" th:id="icon__${item.getId()}__" aria-hidden="true"></span>
Notice the ${possui == 'not'}
Tip: You ${item.getId()}, you can use ${item.id}