I am trying to user MdBootstrap 5's chat feature in my app.
This is what I have tried in the template but the thing is I need to refresh the page for it to work even though I am using SignalR in my backend.
<section style="background-color: #eee;">
<div class="container py-5">
<div class="row d-flex justify-content-center">
<div class="col-md-10 col-lg-8 col-xl-6">
<div class="card" id="chat2">
<div class="card-header d-flex justify-content-between align-items-center p-3">
<h5 class="mb-0">Chat</h5>
<button type="button" class="btn btn-primary btn-sm" data-mdb-ripple-color="dark">
Let's Chat
App
</button>
</div>
<div class="card-body" data-mdb-perfect-scrollbar="true" style="position: relative; height: 400px">
<div *ngFor="let message of (messageService.messageThread$ | async)">
<ng-container *ngIf="message.senderUsername !== currentUser!.userName">
<div class="d-flex flex-row justify-content-start">
<img src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-chat/ava3-bg.webp"
alt="avatar 1" style="width: 45px; height: 100%;">
<div>
<p class="small p-2 ms-3 mb-1 rounded-3" style="background-color: #f5f6f7;">ouweee {{message.content}}</p>
<p class="small ms-3 mb-3 rounded-3 text-muted">{{message.messageSent | date:'medium'}}</p>
<span class="text-danger" *ngIf="!message.dateRead">(unread)</span>
<span class="text-success" *ngIf="message.dateRead">(read {{message.dateRead + 'Z' | timeago}})</span>
</div>
</div>
</ng-container>
<ng-container *ngIf="message.senderUsername === currentUser!.userName">
<div class="d-flex flex-row justify-content-end mb-4 pt-1">
<div>
<p class="small p-2 me-3 mb-1 text-white rounded-3 bg-primary"> Nouwweee {{message.content}}</p>
<p class="small me-3 mb-3 rounded-3 text-muted d-flex justify-content-end">{{message.messageSent | date:'medium'}}</p>
<span class="text-danger" *ngIf="!message.dateRead">(unread)</span>
<span class="text-success" *ngIf="message.dateRead">(read {{message.dateRead + 'Z' | timeago}})</span>
</div>
<img src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-chat/ava4-bg.webp"
alt="avatar 1" style="width: 45px; height: 100%;">
</div>
</ng-container>
</div>
<form [formGroup]="messageForm" enctype="multipart/form-data" (ngSubmit)="createNewMessage()">
<div class="card-footer text-muted d-flex justify-content-start align-items-center p-3">
<img src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-chat/ava3-bg.webp"
alt="avatar 3" style="width: 40px; height: 100%;">
<input type="text" class="form-control form-control-lg" id="exampleFormControlInput1"
placeholder="Type message" formControlName="content" name="content">
<a class="ms-1 text-muted" href="#!"><i class="fas fa-paperclip"></i></a>
<a class="ms-3 text-muted" href="#!"><i class="fas fa-smile"></i></a>
<button class="btn btn-primary" type="submit">Send</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
This is the page from which I extracted the MDBootstrap template :
https://mdbootstrap.com/docs/standard/extended/chat
Thanks for your time
Related
I have a input file to select some files, as soon as I select them a preview modal is open containig the array, the user must delete one of the files if wanted but everytime I click do delete it, the modal just closes (the item is deleted btw).
Here's the template:
<div id="showFiles" class="modal fade" ref="modal" aria-labelledby="staticBackdropLabel">
<div class="modal-dialog modal-dialog-scrollable modal-lg">
<div class="modal-content">
<div class="modal-header p-3 bg-soft-primary">
<h5 class="modal-title">Arquivos</h5>
</div>
<div class="modal-body">
<div v-for="file in files" :key="file.name" class="preview-card border rounded">
<div class="d-flex align-items-center p-2">
<b-img v-if="file.type != 'application/pdf'" class="img-thumbnail me-2" alt="200x200" width="200"
:src="generateURL(file)" data-holder-rendered="true" />
<iframe v-else class="img-thumbnail me-2" data-holder-rendered="true" frameBorder="0" scrolling="no" alt="200x200" width="200" :src="generateURL(file)" />
<div class="flex-grow-1">
<div class="pt-1">
<h5 class="fs-11 mb-1" data-dz-name="">
{{ file.name }}
</h5>
<p class="fs-9 text-muted mb-0" data-dz-size="">
<strong>{{ (file.size / 1024) / 1000 }}</strong> MB
</p>
<strong class="error text-danger" data-dz-errormessage="" />
</div>
</div>
<div class="flex-shrink-0 ms-3">
<b-button-group>
<b-button class="btn btn-sm btn-danger" #click="remove(files.indexOf(file))">
Excluir
</b-button>
</b-button-group>
</div>
</div>
</div>
</div>
<div class="modal-footer hstack gap-2 justify-content-end">
<button type="submit" class="btn btn-success btn-label chat-send waves-effect waves-light"
#click="formSubmit">
<i class="ri-send-plane-2-fill align-bottom label-icon" />Enviar
</button>
</div>
</div>
</div>
</div>
And here is the script of the delete option:
remove(i) {
this.files.splice(i, 1)
},
I've tried preventDefault(), #click.prevent and modal.show() right after the splice but none of it worked.
I have a strange issue with a bootstrap carousel I've implemented in a vue wordpress theme.
I want to show some featured products and I've used a v-for loop to iterate some different arrays, and this seems working. The problem is when I want to load the product details of an item of the carousel, The modal I've implemented that will be opened when an item is clicked, will show the wrong information, but the information in the carousel are correct.
Here is the code I'm using to show the carousel
<div id="caroselloCatalogo" class="carousel slide mt-4 mb-4" data-bs-ride="carousel">
<div class="carousel-inner">
<!-- -->
<div class="carousel-item active">
<div class="row m-0">
<!-- TOFIX VISUALIZZARE PRODOTTO CORRETTO -->
<div class="col-md-4 col-lg-4" v-for="(product, i) in store.featuredPescheria" :key="i">
<a href="#" class="text-decoration-none stretched-link" #click.prevent="showFeaturedProduct(product)" data-bs-target="#featuredModal" data-bs-toggle="modal">
<div class="card">
<div class="row m-0">
<div class="col-md-5 col-lg-5 p-0">
<img src="http://localhost/iperfutura-prenotazioni/wp-content/uploads/2022/10/600.png" class="card-img-top">
</div>
<div class="col-md-7 col-lg-7">
<div class="card-body">
<h5 class="card-title text-uppercase m-0" id="featuredCardTitle">
{{ product.prodName }}
</h5>
<p class="card-text text-uppercase m-0">
{{ product.prodPrice }} {{ product.prodUnit }}
</p>
<small class="text-uppercase">Cod. {{ product.prodCode }}</small>
<a href="#" class="text-uppercase text-decoration-none" id="featuredProductLink" #click.prevent="showFeaturedProduct(product)">
Visualizza prodotto
</a>
</div>
</div>
</div>
</div>
</a>
</div>
</div>
</div>
<!-- -->
<div class="carousel-item">
<div class="row m-0">
<div class="col-md-4 col-lg-4" v-for="(product, i) in store.featuredGastronomia" :key="i">
<a href="#" class="text-decoration-none stretched-link" #click.prevent="showFeaturedProduct(product)" data-bs-target="#featuredModal" data-bs-toggle="modal">
<div class="card">
<div class="row m-0">
<div class="col-md-5 col-lg-5 p-0">
<img src="http://localhost/iperfutura-prenotazioni/wp-content/uploads/2022/10/600.png" class="card-img-top" alt="" id="">
</div>
<div class="col-md-7 col-lg-7">
<div class="card-body">
<h5 class="card-title text-uppercase m-0" id="featuredCardTitle">
{{ product.prodName }}
</h5>
<p class="card-text text-uppercase m-0">
{{ product.prodPrice }} {{ product.prodUnit }}
</p>
<a href="#" class="text-uppercase text-decoration-none" id="featuredProductLink" #click.prevent="showFeaturedProduct(product)">
Visualizza prodotto
</a>
</div>
</div>
</div>
</div>
</a>
</div>
</div>
</div>
<!-- -->
<div class="carousel-item">
<div class="row m-0">
<div class="col-md-4 col-lg-4" v-for="(product, i) in store.featuredPasticceria" :key="i">
<a href="#" class="text-decoration-none stretched-link" #click.prevent="showFeaturedProduct(product)" data-bs-target="#featuredModal" data-bs-toggle="modal">
<div class="card">
<div class="row m-0">
<div class="col-md-5 col-lg-5 p-0">
<img src="http://localhost/iperfutura-prenotazioni/wp-content/uploads/2022/10/600.png" class="card-img-top" alt="" id="">
</div>
<div class="col-md-7 col-lg-7">
<div class="card-body">
<h5 class="card-title text-uppercase m-0" id="featuredCardTitle">
{{ product.prodName }}
</h5>
<p class="card-text text-uppercase m-0">
{{ product.prodPrice }} {{ product.prodUnit }}
</p>
<a href="#" class="text-uppercase text-decoration-none" id="featuredProductLink" #click.prevent="showFeaturedProduct(product)">
Visualizza prodotto
</a>
</div>
</div>
</div>
</div>
</a>
</div>
</div>
</div>
<!-- -->
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#caroselloCatalogo" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#caroselloCatalogo" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
I'm getting the information from the WP rest api, and after that all the available products are fetched, I'm using slice to limit the numbers of products that each array will hold
this.store.featuredGastronomia = this.store.gastronomia.slice(0, 3)
When a product is clicked, I'm calling this method to assign to a variable all the needed information
showFeaturedProduct(product){
console.log(product)
this.showOffacnvas = true
this.featuredProduct = product
},
dismissFeaturedProduct(){
this.featuredProduct = {}
this.showOffacnvas = false
}
What's wrong with the carousel code and why the modal data are wrong?
Image attached is the button from display of two different sizes (24inch and 13inch), button on 24inch display appears normal whereas add to cart button on 13inch display is broken.13inch display button 24 inch display button
<div class="row my-5" id="3">
<span id="lblArtworkId" style="display: none;">3</span>
<div class="col-2">
<div class="d-flex justify-content-center">
<a href="./">
<img src="upload/artworks/Artwork3.jpg" alt="" class="card-img-top" style="max-height: 8rem;">
</a>
</div>
</div>
<div class="col-6">
<div class="h-100 d-flex flex-column justify-content-between">
<span>
<a href="./" class="text-decoration-none text-muted fs-4">
Construction in Red, Blue & Yellow Drawing
</a>
</span>
<hr>
<p class="m-0">Artist: Karin White</p>
</div>
</div>
<div class="col-2">
<div class="h-100 d-flex align-items-center justify-content-center">
<span class="fw-bold">$ 1120.00</span>
</div>
</div>
<div class="col-2">
<div class="h-100 d-flex align-items-center justify-content-between">
<button id="btnRemove" class="btn btn-outline-danger">Remove</button>
<button id="btnCart" class="btn btn-primary">Add to Cart</button>
</div>
</div>
</div>
Welcome to stackoverflow.
You can use cols with a breakpoint prefix to adjust the layout. (e.g. col-xxl-2 col-3). Read Bootstrap Breakpoints and Grid options for more information. Also, since Bootstrap is sensitive to pixels, it is much better to consider pixels instead of inches.
Example:
<div class="container">
<div class="row my-5" id="3">
<span id="lblArtworkId" style="display: none;">3</span>
<div class="col-xxl-2 col-3">
<div class="d-flex justify-content-center">
<a href="./">
<img src="upload/artworks/Artwork3.jpg" alt="" class="card-img-top" style="max-height: 8rem;">
</a>
</div>
</div>
<div class="col-xxl-6 col-9">
<div class="h-100 d-flex flex-column justify-content-between">
<span>
<a href="./" class="text-decoration-none text-muted fs-4">
Construction in Red, Blue & Yellow Drawing
</a>
</span>
<hr>
<p class="m-0">Artist: Karin White</p>
</div>
</div>
<div class="col-xxl-2 col-4">
<div class="h-100 d-flex align-items-center justify-content-center">
<span class="fw-bold">$ 1120.00</span>
</div>
</div>
<div class="col-xxl-2 col-8">
<div class="h-100 d-flex align-items-center justify-content-between">
<button id="btnRemove" class="btn btn-outline-danger w-50 mx-1">Remove</button>
<button id="btnCart" class="btn btn-primary w-50 mx-1">Add to Cart</button>
</div>
</div>
</div>
</div>
Edit
Don't forget to include the required meta tags:
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
so basically im doing this in angular and using bootstrap
I want the name and description on the left and img on the right but it isn't working , pls help
code link is below
here
<div class="row">
<div class="col-xs-12">
<button class='btn btn-success'>New bug</button>
</div>
</div>
<hr>
<div class="row">
<div class="col-xs-12">
<a href="#" class="list-group-item clearfix"
style="background:grey ; color:red;"
*ngFor="let bug of bugs">
<div class="pull-left">
<h4 class="list-group-item-headin">name</h4>
<p class="list-group-item-text">description</p>
<span class="list-group-item-text">type</span>
<span class="list-group-item-text">status</span>
<span class="list-group-item-text">priority</span> </div>
<div class="pull-right">
<img src="https://upload.wikimedia.org/wikipedia/commons/3/3f/Dead-Bug_43215-480x360_%285000576310%29.jpg"
alt="{{bug.name}}"
class="img-responsive"
style="max-height: 100px;">
</div>
</a>
<app-bugs-item></app-bugs-item>
</div>
</div>
I'm guessing you want the text to wrap around the image. If that is the case then only put the float class on the image, and reorder the image to above the text.
<div class="container">
<div class="row">
<div class="col-xs-12">
<button class="btn btn-success">New bug</button>
</div>
</div>
<hr />
<div class="row">
<div class="col-xs-12">
<a href="#" class="list-group-item clearfix" style="background: grey; color: red" *ngFor="let bug of bugs">
<div class="float-right">
<img src="https://upload.wikimedia.org/wikipedia/commons/3/3f/Dead-Bug_43215-480x360_%285000576310%29.jpg" alt="{{bug.name}}" class="img-responsive" style="max-height: 100px" />
</div>
<h4 class="list-group-item-headin">name</h4>
<p class="list-group-item-text">description</p>
<span class="list-group-item-text">type</span>
<span class="list-group-item-text">status</span>
<span class="list-group-item-text">priority</span>
</a>
<app-bugs-item></app-bugs-item>
</div>
</div>
</div>
If you want the text and image to be in 2 columns I would suggest using flexbox
<div class="container">
<div class="row">
<div class="col-xs-12">
<button class="btn btn-success">New bug</button>
</div>
</div>
<hr />
<div class="row">
<div class="col-xs-12">
<a href="#" class="list-group-item d-flex justify-content-between" style="background: grey; color: red" *ngFor="let bug of bugs">
<div>
<h4 class="list-group-item-headin">name</h4>
<p class="list-group-item-text">description</p>
<span class="list-group-item-text">type</span>
<span class="list-group-item-text">status</span>
<span class="list-group-item-text">priority</span>
</div>
<div>
<img src="https://upload.wikimedia.org/wikipedia/commons/3/3f/Dead-Bug_43215-480x360_%285000576310%29.jpg" alt="{{bug.name}}" class="img-responsive" style="max-height: 100px" />
</div>
</a>
<app-bugs-item></app-bugs-item>
</div>
</div>
</div>
I am doing an eCommerce project. While displaying the products list, if I insert any content inside, height will vary and total alignment is disturbed.
You can see the code below. I'm using bootstrap 4.
#product_list {
width: 210px;
margin-right: 0px;
font-size: 14px;
}
.product-item {
width: 100%;
height: 350px;
cursor: pointer;
background-color: #FFFFFF;
}
.product {
width: 100%;
height: 350px;
border: solid 2px #e9e9e9;
}
.product_image {
width: 100%;
text-align: center;
}
.product_image img {
width: 70%;
height: 70%;
}
<!-- Start to products display -->
<ul class="inline-item pt-2" style="padding-left:0px;padding-right:0px;" id="product_list_grid">
<li class="list-inline-item mb-1" id="product_list">
<div class="product-item mb-1">
<div class="product">
<div class="product_image">
<img src="images/FREEDOM.png" alt="">
</div>
<div class=" text-center mb-0 ">
<h6 class="product_brand"><a class="text-dark" href="single.html">Ashirvad</a></h6>
<h6 class="product_name">
<p class="card-text m-0">
<label> Ahirvad </label>
<button type="button" class="btn btn-sm text-white " id="background_color" data-toggle="modal" data-target="#myModal1"> 1kg </button>
</p>
</h6>
<p class=" mb-0">
<span>20pc/Box</span> ❙ <span>Min 5 boxes</span>
</p>
<div class="product_price">
<span>MRP : <del>$50</del></span> ❙ <span> <b> Sale : $40 </b> </span>
</div>
<div class="quantity mb-1 ">
<input type="button" value="-" class="minus " style="border-radius:50px;">
<span> 1 </span>
<input type="button" value="+" class="plus" style="border-radius:50px;">
</div>
<div class=" text-center my-2 ">
<a class="btn btn-sm text-white" id="background_color" href="#">add to cart</a>
</div>
</div>
</div>
</div>
</li>
<li class="list-inline-item mb-1" id="product_list">
<div class="product-item mb-1">
<div class="product">
<div class="product_image">
<img src="images/FREEDOM.png" alt="">
</div>
<div class=" text-center mb-0 ">
<h6 class="product_brand"><a class="text-dark" href="single.html">Ashirvad</a></h6>
<h6 class="product_name">
<p class="card-text m-0">
<label> Ahirvad </label>
<button type="button" class="btn btn-sm text-white " id="background_color" data-toggle="modal" data-target="#myModal1"> 1kg </button>
</p>
</h6>
<p class=" mb-0">
<span>20pc/Box</span> ❙ <span>Min 5 boxes</span>
</p>
<div class="product_price"> <span>MRP : <del>$50</del></span> ❙ <span> <b>
Sale : $40 </b> </span> </div>
<div class="quantity mb-1 ">
<input type="button" value="-" class="minus " style="border-radius:50px;">
<span> 1 </span>
<input type="button" value="+" class="plus" style="border-radius:50px;">
</div>
<div class=" text-center my-2 "><a class="btn btn-sm text-white" id="background_color" href="#">add to cart</a></div>
</div>
</div>
</div>
</li>
........
</ul>
This the code I am using to display the products ,while displaying if the list items content and images everything same it will display clearly. If I insert any content inside height alignment issue is arising.
<ul class="inline-item pt-2 d-flex flex-wrap" style="padding-left:0px;padding-right:0px;" id="product_list_grid">
<li class="list-inline-item mb-1" id="product_list">
<div class="product-item mb-1">
<div class="product">
<div class="product_image">
<img src="images/FREEDOM.png" alt="">
</div>
<div class=" text-center mb-0 ">
<h6 class="product_brand"><a class="text-dark" href="single.html">Ashirvad</a></h6>
<h6 class="product_name">
<p class="card-text m-0">
<label> Ahirvad </label>
<button type="button" class="btn btn-sm text-white " id="background_color"
data-toggle="modal" data-target="#myModal1">
1kg
</button>
</p>
</h6>
<p class=" mb-0">
<span>20pc/Box</span> ❙ <span>Min 5 boxes</span>
</p>
<div class="product_price"> <span>MRP : <del>$50</del></span> ❙ <span> <b>
Sale : $40 </b> </span> </div>
<div class="quantity mb-1 ">
<input type="button" value="-" class="minus " style="border-radius:50px;">
<span> 1 </span>
<input type="button" value="+" class="plus" style="border-radius:50px;">
</div>
<div class=" text-center my-2 "><a class="btn btn-sm text-white" id="background_color"
href="#">add
to cart</a></div>
</div>
</div>
</div>
</li>
<li class="list-inline-item mb-1" id="product_list">
<div class="product-item mb-1">
<div class="product">
<div class="product_image">
<img src="images/FREEDOM.png" alt="">
</div>
<div class=" text-center mb-0 ">
<h6 class="product_brand"><a class="text-dark" href="single.html">Ashirvad</a></h6>
<h6 class="product_name">
<p class="card-text m-0">
<label> Ahirvad </label>
<button type="button" class="btn btn-sm text-white " id="background_color"
data-toggle="modal" data-target="#myModal1">
1kg
</button>
</p>
</h6>
<p class=" mb-0">
<span>20pc/Box</span> ❙ <span>Min 5 boxes</span>
</p>
<div class="product_price"> <span>MRP : <del>$50</del></span> ❙ <span> <b>
Sale : $40 </b> </span> </div>
<div class="quantity mb-1 ">
<input type="button" value="-" class="minus " style="border-radius:50px;">
<span> 1 </span>
<input type="button" value="+" class="plus" style="border-radius:50px;">
</div>
<div class=" text-center my-2 "><a class="btn btn-sm text-white" id="background_color"
href="#">add
to cart</a></div>
</div>
</div>
</div>
</li>
</ul>
<style>
/* Start to css for product list */
#product_list {width:210px;
margin-right: 0px;
font-size: 14px;}
.product-item
{
width: 100%;
height: 350px;
cursor: pointer;
background-color: #FFFFFF;
}
.product {
width: 100%;
height: auto;
border: solid 2px #e9e9e9;
max-height: 600px;
}
.product_image
{
width: 100%;
text-align: center;
}
.product_image img
{
width: 70%;
height:70%;
}
/* END to css for product list */
</style>
use "d-flex" and "flex-wrap" class for ul tag. and use max-height instead of height.
I hope it would be helpful.