Readjusting responsive bootstrap rows and column - php

Please how can i make centralized these 3 buttons and the last button be centralized on the next line without affecting the whole framework.
<div class="col-md-4 col-12 col-lg-3 center-search">
<div class="">
<button (click)="searchEmployeeName()" class="btn btn-raised mr-1 shadow-z-2 btn-success btn-sm">
{{'Search' | translate}}
</button>
</div>
<div class="">
<button (click)="reset()" class="btn btn-raised mr-1 shadow-z-2 btn-warning btn-sm ml-1">
{{'Reset' | translate}}
</button>
</div>
<div class="">
<button (click)="viewAll()" class="btn btn-raised mr-1 shadow-z-2 btn-info btn-sm ml-1">
{{'View All' | translate}}
</button>
</div>
<div class="">
<button (click)="exportToExcel()" class="btn btn-raised mr-1 pull-rightshadow-z-2 btn-danger btn-sm ml-1">
{{'Export To Excel' | translate}}
</button>
</div>
</div>

Add another div:
<div class="col-md-4 col-12 col-lg-3 center-search">
<div class="d-flex justify-content-center">
<div class="">
<button (click)="searchEmployeeName()" class="btn btn-raised mr-1 shadow-z-2 btn-success btn-sm">
{{'Search' | translate}}
</button>
</div>
<div class="">
<button (click)="reset()" class="btn btn-raised mr-1 shadow-z-2 btn-warning btn-sm ml-1">
{{'Reset' | translate}}
</button>
</div>
<div class="">
<button (click)="viewAll()" class="btn btn-raised mr-1 shadow-z-2 btn-info btn-sm ml-1">
{{'View All' | translate}}
</button>
</div>
<div class="">
<button (click)="exportToExcel()" class="btn btn-raised mr-1 pull-rightshadow-z-2 btn-danger btn-sm ml-1">
{{'Export To Excel' | translate}}
</button>
</div>
</div>

Related

Trying to show currently authenticated user post in laravel view

I am working on a Laravel project and I want to display currently authenticated users posts in view file, I am getting an error while trying to achieve that says
"Class name must be a valid object or a string"...
my blade view
#extends('layouts.app')
#section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div id="accordion">
<div class="card">
<div class="card-header" id="headingOne">
<h5 class="mb-0">
<button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
<i class="fa fa-product-hunt" aria-hidden="true"></i> Swap
</button>
</h5>
</div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
#foreach($data as $dat)
<div class="card mb-3" style="max-width: 540px;">
<div class="row g-0">
<div class="col-md-4">
<img
src="{{asset('images/' . $dat->imogi)}}"
alt="Trendy Pants and Shoes"
/>
</div>
<div class="col-md-8">
<div class="card-body">
<div style="text-align: right;">
<small style="color:#3490dc;">{{$dat->organazation}}</small> <small><i class="fa fa-calendar" style="color:#3490dc" aria-hidden="true"></i> {{ $dat->created_at->format('d/m/Y') }}</small>
</div>
<h5 class="card-title"><i class="fa fa-user-circle-o" style="color:#3490dc" aria-hidden="true"></i> {{$dat->name}}</h5>
<small><i class="fa fa-map-marker" style="color:#3490dc" aria-hidden="true"></i> {{$dat->location}}</small> | <small><i class="fa fa-phone" style="color:#3490dc" aria-hidden="true"></i>{{$dat->contact}}</small>
<hr/>
<p class="card-text">
<b>{{$dat->title}}</b>
</p>
<small style="color:#3490dc;">M{{$dat->price}}</small>
<p class="card-text">
{{$dat->message}}
</p>
</div>
</div>
</div>
</div>
<br/>
#endforeach
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="headingTwo">
<h5 class="mb-0">
<button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
<i class="fa fa-product-hunt" aria-hidden="true"></i> Work
</button>
</h5>
</div>
<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
<div class="card-body">
<form class="form-inline" type="get" action="{{url('/search_work')}}" role="search" method="get">
<input id="search-input" type="search" name="query" class="form-control" placeholder="Search...">
<button type="submit" class="btn btn-primary"><i class="fa fa-search" aria-hidden="true"></i></button>
</form>
<br/>
<p style="text-align:center">
<button onclick="window.location.href='/workview'" type="button" class="btn btn-outline-primary">View</button><small style="color:#3490dc"> {{$count = DB::table('jobs')->count()}}</small> <small>Posts</small>
</p>
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="headingThree">
<h5 class="mb-0">
<button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
<i class="fa fa-product-hunt" aria-hidden="true"></i> Sell
</button>
</h5>
</div>
<div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordion">
<div class="card-body">
<form class="form-inline" type="get" action="{{url('/search_sell')}}" role="search" method="get">
<input id="search-input" type="search" name="query" class="form-control" placeholder="Search...">
<button type="submit" class="btn btn-primary"><i class="fa fa-search" aria-hidden="true"></i></button>
</form>
<br/>
<p style="text-align:center">
<button onclick="window.location.href='/sellview'" type="button" class="btn btn-outline-primary">View</button><small style="color:#3490dc"> {{$count = DB::table('announces')->count()}}</small> <small>Posts</small>
</p>
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="headingFour">
<h5 class="mb-0">
<button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseFour" aria-expanded="false" aria-controls="collapseFour">
<i class="fa fa-product-hunt" aria-hidden="true"></i> Tenders
</button>
</h5>
</div>
<div id="collapseFour" class="collapse" aria-labelledby="headingFour" data-parent="#accordion">
<div class="card-body">
<form class="form-inline" type="get" action="{{url('/search_tender')}}" role="search" method="get">
<input id="search-input" type="search" name="query" class="form-control" placeholder="Search...">
<button type="submit" class="btn btn-primary"><i class="fa fa-search" aria-hidden="true"></i></button>
</form>
<br/>
<p style="text-align:center">
<button onclick="window.location.href='/tenderview'" type="button" class="btn btn-outline-primary">View</button><small style="color:#3490dc"> {{$count = DB::table('Kinds')->count()}} </small><small>Posts</small>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br/>
#include('footer')
#endsection
My controller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\User;
use DB;
class PostController extends Controller
{
//
public function mapost()
{
$data = Auth::user()->Announce::orderBy('created_at', 'DESC')->get();
return view('users.mapost',['data'=>$data]);
}
}
My route in web.php
Route::get('users/mapost', 'PostController#mapost')->name('users.mapost');
I don`t know where I am getting this wrong, i will appreciate any help thanks in advance
Look at this line:
$data = Auth::user()->Announce::orderBy('created_at', 'DESC')->get();
Here you attempt to call the orderBy method of the Auth::user()->Announce class and of course, such class does not exist. It would make sense to do something like this:
Announce::where('user_id', $youruserid)->orderByDesc('created_at');

navbar buttons sorting if user was logged in php

hi there thanks for helping me
I have a navbar and with login and signup button and I want to hide these button if the user was logged in
I'm writing in PHP please help me
these are my navbar and login info code
<header class="navbar navbar-expand-lg bg-gradient-default p-2 navbar-expand navbar-dark flex-row align-items-md-center ct-navbar bg-primary py-2">
<a class="navbar-brand text-white" href="/"><img style="width:150px; height: 60px;" src="arodanalandscape.png" class="radius-10 shadow-sm"
width="100"></a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
</div>
<!-- <a style="font-family:'Droid-Arabic-Kufi';" href="team.php" class="btn btn-secondary my-2 my-sm-0"><i
class="fal fa-terminal ml-2"></i>تیمەکەمان</a>-->
<a style="font-family:'Droid-Arabic-Kufi';" href="login-user.php" class="btn btn-gradient-warning btn-round my-2 my-sm-0 text-white"><i
class="fal fa-sign-in-alt ml-2"></i> چونەژورەوە </a>
<a style="font-family:'Droid-Arabic-Kufi';" href="signup-user.php" class="btn btn-info mr-3 my-2 my-sm-0"><i
class="fal fa-user-plus ml-2"></i> خۆتۆمارکردن</a>
<div class="dropdown ">
<button style="font-family: 'Montserrat', sans-serif;" class="btn btn-gradient-secondary my-2 my-sm-0" type="button" id="multiDropdownMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" /> <i class="fas fa-cogs"></i> <strong class="center"> <?php echo $fetch_info['name'] ?> <img style="width:40px; height:40px;" class="img-fluid rounded shadow card-img-top" src= <?php echo $fetch_info['picture'] ?>>
<div class="ripple-container mr-3"></div></button>
<div class="dropdown-menu" aria-labelledby="multiDropdownMenu">
<a style="background-color: #e63946; " class="btn-danger text-white dropdown-item mr-3" href="logout-user.php">Logout</a>
<a style="background-color: #457b9d; " class="text-white dropdown-item mr-3" href="profile-user.php">Profile</a>
</div>
</div>
</div>
<!-- <i class="fas fa-user"></i> <strong class="center"> <?php echo $fetch_info['name'] ?> <img style="width:40px; height:40px;" class="rounded-circle card-img-top" src= <?php echo $fetch_info['picture'] ?> >
-->
</nav>
</header>
and this is my login code
require_once "controllerUserData.php"; $email = $_SESSION['email']; $password = $_SESSION['password']; if($email != false && $password != false){
$sql = "SELECT * FROM usertable WHERE email = '$email'";
$run_Sql = mysqli_query($con, $sql);
if($run_Sql){
$fetch_info = mysqli_fetch_assoc($run_Sql);
$status = $fetch_info['status'];
$code = $fetch_info['code'];
if($status == "verified"){
if($code != 0){
header('Location: reset-code.php');
}
}else{
header('Location: user-otp.php');
}
} }else{
header('Location: login-user.php'); } ?>
Replace...
<a style="font-family:'Droid-Arabic-Kufi';" href="login-user.php" class="btn btn-gradient-warning btn-round my-2 my-sm-0 text-white"><i
class="fal fa-sign-in-alt ml-2"></i> چونەژورەوە </a>
<a style="font-family:'Droid-Arabic-Kufi';" href="signup-user.php" class="btn btn-info mr-3 my-2 my-sm-0"><i
class="fal fa-user-plus ml-2"></i> خۆتۆمارکردن</a>
With...
Assuming that you have set a variable $loggedon to TRUE in the event that the user is already logged on
<?php
if(!$loggedon){
echo <<<EOT
<a style="font-family:'Droid-Arabic-Kufi';" href="login-user.php" class="btn btn-gradient-warning btn-round my-2 my-sm-0 text-white"><i
class="fal fa-sign-in-alt ml-2"></i> چونەژورەوە </a>
<a style="font-family:'Droid-Arabic-Kufi';" href="signup-user.php" class="btn btn-info mr-3 my-2 my-sm-0"><i
class="fal fa-user-plus ml-2"></i> خۆتۆمارکردن</a>';
EOT;
}
?>

Create multiple modals in a loop while passing data

I am trying to make a display while looping through items and displaying buttons. The buttons can open modals that display some data. I have tried to pass the data to the modal but it is just displaying the first iteration of the loops information and never get's updated. What do I need to do to make a modal for each iteration of my list?
#foreach ($forms as $form)
<div class="row">
<div class="col-lg-2">
<div style="float:left; padding-right: 10px;">
<a href="/form/{{$cuid}}/{{$form['cuBaseName']}}"
data-toggle="tooltip" title="Edit Fields"
><i class="fas fa-edit fa-2x"></i></a>
</div>
<div style="float:left; padding-right: 10px;">
<span data-toggle="modal" data-target="#copyFormModal">
<a href="#" data-toggle="tooltip" title="Copy"
><i class="fas fa-copy fa-2x"></i></a>
</span>
</div>
<div style="float:left; padding-right: 10px;">
<span data-toggle="modal" data-target="#deleteFormModal">
<a href="#" data-toggle="tooltip" title="Delete">
<i class="fas fa-trash-alt fa-2x"></i></a>
</span>
</div>
</div>
</div>
<hr>
#include('layouts.partials.modals.copyFormModal',['cuid'=>$cuid, 'cuBaseName'=> $form['cuBaseName']])
#include('layouts.partials.modals.deleteFormModal',['cuid'=>$cuid, 'cuBaseName'=> $form['cuBaseName']])
#endforeach
<!-- Modal -->
<div class="modal fade" id="deleteFormModal" tabindex="-1" role="dialog" aria-labelledby="deleteFormModal" aria-hidden="true" >
<div class="modal-dialog" role="document" style="max-width:900px;">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title" id="exampleModalLabel">Delete Form</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
Are you sure you want to delete form <b>{{$cuBaseName}}</b> from <b>{{$cuid}}</b>?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-success" data-dismiss="modal"
onclick='location.href="/forms/{{$cuid}}/{{$cuBaseName}}/delete"' >Delete</button>
</div>
</div>
</div>
</div>
Try this, add a unique #id to each modal window:
#foreach ($forms as $form)
<div class="row">
<div class="col-lg-2">
<div style="float:left; padding-right: 10px;">
<a href="/form/{{$cuid}}/{{$form['cuBaseName']}}"
data-toggle="tooltip" title="Edit Fields"
><i class="fas fa-edit fa-2x"></i></a>
</div>
<div style="float:left; padding-right: 10px;">
<span data-toggle="modal" data-target="#copyFormModal-{{$cuid}}">
<a href="#" data-toggle="tooltip" title="Copy"
><i class="fas fa-copy fa-2x"></i></a>
</span>
</div>
<div style="float:left; padding-right: 10px;">
<span data-toggle="modal" data-target="#deleteFormModal-{{$cuid}}">
<a href="#" data-toggle="tooltip" title="Delete">
<i class="fas fa-trash-alt fa-2x"></i></a>
</span>
</div>
</div>
</div>
<hr>
#include('layouts.partials.modals.copyFormModal',['cuid'=>$cuid, 'cuBaseName'=> $form['cuBaseName']])
#include('layouts.partials.modals.deleteFormModal',['cuid'=>$cuid, 'cuBaseName'=> $form['cuBaseName']])
#endforeach
<!-- Modal example -->
<div class="modal fade" id="deleteFormModal-{{$cuid}}" tabindex="-1" role="dialog" aria-labelledby="deleteFormModal" aria-hidden="true" >
<div class="modal-dialog" role="document" style="max-width:900px;">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title" id="exampleModalLabel">Delete Form</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
Are you sure you want to delete form <b>{{$cuBaseName}}</b> from <b>{{$cuid}}</b>?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-success" data-dismiss="modal"
onclick='location.href="/forms/{{$cuid}}/{{$cuBaseName}}/delete"' >Delete</button>
</div>
</div>
</div>
</div>
Hope it helps.

Symfony 3 modal

why my modal don't appears when I clik in my link?
I do like this and I don't know where is wrong?
In my table, my Edit button is a dropdown button because I have two Entity joined in this table, so when I click in the link who edited one of my entity the modal don't appears, the page becomes fade only.
edit.html.twig
<a data-toggle="modal" href="#edit{{ fruit.id }}">
Edit
</a>
<div class="modal" id="edit{{ fruit.id }}">
{{ form_start(edit_form, { 'method' : 'post', 'action': path('fruit_edit', { 'id' : fruit.id }) }) }}
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">Edit</h4>
</div>
<div class="modal-body">
{{ form_widget(edit_form) }}
<input type="submit" value="Edit" />
</div>
</div>
{{ form_end(edit_form) }}
</div>
index.html.twig
<td>
<div class="dropdown">
<button class="btn btn-info dropdown-toggle btn-xs" type="button" data-toggle="dropdown">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
</button>
<ul class="dropdown-menu">
<li>{{ render(controller('AppBundle:Fruit:edit', { 'id' : fruit.id } )) }}</li>
<li>href="#">Categories</a></li>
</ul>
</div>
Controller
public function editAction(Request $request, Fruit $fruit)
{
$deleteForm = $this->createDeleteForm($fruit);
$editForm = $this->createForm('AppBundle\Form\FruitType', $fruit);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('fruit_edit', array('id' => $fruit->getId()));
}
return $this->render('fruit/edit.html.twig', array(
'fruit' => $fruit,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
Help me please to show what the problem, thanks!
You can try just move your <div class="modal" ... ></div> container outside the <ul></ul> tag:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="dropdown">
<button class="btn btn-info dropdown-toggle btn-xs" type="button" data-toggle="dropdown">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
</button>
<ul class="dropdown-menu">
<li>
<a data-toggle="modal" href="#edit5">
Edit
</a>
</li>
<li>Categories</li>
</ul>
<div class="modal" id="edit5">
<form>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">Edit</h4>
</div>
<div class="modal-body">
<input>
<input type="submit" value="Edit" />
</div>
</div>
</form>
</div>
</div>
So...
edit.html.twig
<div class="modal" id="edit{{ fruit.id }}">
{{ form_start(edit_form, { 'method' : 'post', 'action': path('fruit_edit', { 'id' : fruit.id }) }) }}
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">Edit</h4>
</div>
<div class="modal-body">
{{ form_widget(edit_form) }}
<input type="submit" value="Edit" />
</div>
</div>
{{ form_end(edit_form) }}
</div>
index.html.twig
<td>
<div class="dropdown">
<button class="btn btn-info dropdown-toggle btn-xs" type="button" data-toggle="dropdown">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
</button>
<ul class="dropdown-menu">
<li>
<a data-toggle="modal" href="#edit{{ fruit.id }}">
Edit
</a>
</li>
<li>href="#">Categories</a></li>
</ul>
{{ render(controller('AppBundle:Fruit:edit', { 'id' : fruit.id } )) }}
</div>

Get a detail after open popup

I am using bootstrap for popup
Here is my code:
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" id='2' data-toggle="modal" data-target="#myModal">Open Modal</button>
<button type="button" class="btn btn-info btn-lg" id='3' data-toggle="modal" data-target="#myModal">Open Modal</button>
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
here there is two button is open same popup. I want to get which button is clicked. i want that button id
is it possible to get this?
Yes with bootstrap modal event listener,
modal trigger buttons
<button type="button" class="btn btn-info btn-lg" id='2' data-toggle="modal" data-target="#myModal">Open Modal</button>
<button type="button" class="btn btn-info btn-lg" id='3' data-toggle="modal" data-target="#myModal">Open Modal</button>
event script
$(document).ready(function(){
$('#myModal').on('show.bs.modal', function (e) {
var id = $(e.relatedTarget).attr('id');
alert(id);
});
});
Working Example
$(document).ready(function() {
$('#myModal').on('show.bs.modal', function(e) {
var id = $(e.relatedTarget).attr('id');
alert(id);
});
});
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModal" id='2'>Open Modal</button>
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModal" id='3'>Open Modal</button>
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<button type="button" class="btn btn-info btn-lg" id='2' ng-click="get_id_function(2)" data-toggle="modal" data-target="#myModal">Open Modal</button>
<button type="button" class="btn btn-info btn-lg" id='3'
ng-click="get_id_function(3)" data-toggle="modal" data-target="#myModal">Open Modal</button>
In javasscript
$scope.get_id_function(id){}
thus you can receive id in the function parameter id

Categories