I want to read the patientid in when the corresponding row button in is clicked. Using the code i could able to get the patientid of 1st row of the table. I wanted to get the corresponding row's patientid
<table id="mytable" class="styled-table">
<thead>
<tr>
<th>Patientid</th>
<th>Name</th>
<th>Path</th>
<th>Category</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{% for row in value %}
<tr>
<td><input type="hidden" name="patientid" value="{{row[0]}}"> {{ row[0] }}</td>
<td>{{row[1]}}</td>
<td>{{row[2]}}</td>
<td>{{row[3]}}</td>
<td><form action="/get" method="POST"><input type="submit" class="button" value="Generate" name="generate"></a> </td>
</tr>
{% endfor %}
</tbody>
</table>
if request.form.get('generate') == 'Generate':
print('selected')
print(request.form.get("patientid"))
a=request.form.get("patientid")
return render_template('automated.html')
Related
Anyone know how to use datatable with format table like this
table
My data table can't use with format table like that. My code for show data
<table id="table-rekap" class="table table-bordered">
<thead>
<tr>
<th class="text-center" style="width: 20%;">No</th>
<th class="text-center" style="width: 20%;">Unit Kerja</th>
<th>Jenis Kendaraan</th>
<th>Total</th>
</tr>
</thead>
#php $no = 1; #endphp
<tbody>
#foreach($rekapUnker as $unitKerja => $jenisKendaraan)
<tr>
<td class="text-center" rowspan="9">{{ $no++ }}</td>
<td class="text-center" rowspan="9">{{ $unitKerja }}</td>
#foreach($jenisKendaraan as $jenKen => $total)
<tr>
<td>{{ $jenKen }}</td>
<td>{{ $total }}</td>
</tr>
#endforeach
</tr>
#endforeach
</tbody>
</table>
Id table rekap for call data table
I am trying to show product items when button order detail is pressed, but its not working in any way I tried, it's possible to make it work with bootstrap 5 or I have to do it with javascript ?
Useless information for "It looks like your post is mostly code; please add some more details." : In the first foreach I am displaying information from the order, then the second foreach is retrieving product id and quantity from a different table that contain order id and the third foreach is getting product where id from the second foreach in order to display product details
<table class="table border">
<thead>
<tr>
<th class="h4" style="width: 18%">Order Number</th>
<th class="h4">Date</th>
<th class="h4">Total</th>
<th class="h4">Status</th>
<th class="h4"></th>
<td></td>
</tr>
</thead>
<tbody>
<tr>
<?php
foreach ($order as $row_order) {
$order_status = intval($row_order->status);
?>
<td class="fw-bold">{{ $row_order->id }}</td>
<td class="fw-bold">{{ $row_order->added_on }}</td>
<td class="fw-bold">{{ $row_order->order_total }} $</td>
<td class="fw-bold"><?php if($order_status == 0){ ?>
Not Paid
<?php }elseif ($order_status == 1) { ?>
Paid
<?php }elseif ($order_status == 2) { ?>
Shipped
<?php }elseif ($order_status == 3) { ?>
Delivered
<?php } ?>
</td>
<td></td>
{{-- <td><a class="btn btn-primary" href="">Order Detail</a></td> --}}
<div class="btn-group">
<td>
<button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-expanded="false">
Order Detail
</button>
</td>
#foreach (\App\Models\Order_product_size_color::where('order_id', '=', $row_order->id)->get() as $order_variant)
#foreach (\App\Models\Product_size_color::where('id', '=', $order_variant->product_size_color_id)->get() as $variant)
<div class="dropdown-menu">
<td class="border-0 p-0 dropdown-item">
<tr>
<td class="border-0"><img class="rounded" src="{{ asset('storage/'. $variant->image1->product_image) }}" alt="" style="width: 80px; height: 90px;"></td>
<td class="fw-bold border-0">{{ $variant->product->product_name }}</td>
<td class="border-0">{{ $order_variant->count }} products</td>
<td class="fw-bold border-0">Size: {{ $variant->size->size_name }}</td>
<td class="fw-bold border-0">Color: {{ $variant->color->color_name }}</td>
<td class="fw-bold border-0">${{ $variant->product->price }}</td>
</tr>
</td>
</div>
#endforeach
#endforeach
</div>
<tr>
<td class="fw-bold">Delivery Address:</td>
<td class="fw-bold">{{ $row_order->address }}</td>
</tr>
</tr>
<?php }//end foreach ?>
</tbody>
</table>
I am trying to iterate through *ngFor using table tr td.*ngFor shows the empty data in IE browser.However works fine in chrome.
Piece of code:
<tbody>
<tr *ngFor="let item of files; let indx= index">
<td><strong>{{ item.name }}</strong></td>
<th class="text-center">
<mat-icon (click)="removeFile(indx)">delete</mat-icon>
<!-- <mat-icon>get_app</mat-icon> -->
</th>
</tr>
</tbody>
Okay,try with changing structure of table
<table>
<thead>
<th> <mat-icon (click)="removeFile(indx)">delete</mat-icon></th>
</thead>
<tbody>
<tr *ngFor="let item of files">
<td><strong>{{ item.name }}</strong></td>
</tr>
</tbody>
</table>
I would like to retrieve each row of a datatable that is dynamically created. I created a form with the post method to get these rows but I don't how what to write in my view function to have these in a panda DataFrame.
<form action="{%url 'livedb_model:validation' property.id roomtype.id %}?normal_price={{normal_price}}&week_day_multi={{week_day_multi}}&week_end_multi={{week_end_multi}}&max_discount={{max_discount}}&max_markup={{max_markup}}&coccCategory={{coccCategory}}&agressiveness={{agressiveness}}" method="post">
{% csrf_token %}
<input class='btn btn-primary btn-large btn-block align-self-center'type='submit' value='submit'>
<div id="datatable" class="table-editable align-self-stretch">
<table class="table table-bordered table-responsive-md table-striped text-center">
<tr>
<th class="text-center">Date</th>
<th class="text-center">Availability</th>
<th class="text-center">Current Price</th>
<th class="text-center">Current Occupancy</th>
<th class="text-center">Advised Price</th>
</tr>
{% for day in invdf.itertuples %}
<tr>
{% if day.availability.room %}
<td class="pt-3-half" id='date'>{{day.date|date:'M d,Y'}}</td>
<td class="pt-3-half">{{day.allotment}}</td>
<td class="pt-3-half">{{day.price|floatformat:2}}</td>
<td class="pt-3-half">{{day.occupancy|floatformat:2}}</td>
<td class="pt-3-half" id='price_advised' contenteditable="true">{{day.price_advised|floatformat:2}}</td>
{% else %}
<td class="pt-3-half" id='date'>{{day.date|date:'M d,Y'}}</td>
<td class="pt-3-half">{{day.allotment}}</td>
<td class="pt-3-half">{{day.price|floatformat:2}}</td>
<td class="pt-3-half">{{day.occupancy|floatformat:2}}</td>
<td class="pt-3-half" id='price_advised' contenteditable="true">{{day.price_advised|floatformat:2}}</td>
{% endif %}
</tr>
{% endfor%}
</div>
</form>
For instance I would like to write something like in my view:
def validation(request,id,rt_id):
if request.method=='POST':
price_advised=request.POST.get(ADVISED PRICE COLUMN)
Could you help me on this?
Thank you
you can use javascript add parameter before submitting form
So I am trying to make bootstrap table with search and sorting with the data coming from a GET calll
<table id="example" class="table table-bordered table-striped table-hover" data-search="true">
<thead>
<tr class="text-white clickable-row" bgcolor="#578ebe" >
<th id="white-text"> # </th>
<th id="white-text"> Name </th>
<th id="white-text"> DBA </th>
<th id="white-text"> Facility ID </th>
<th id="white-text"> Active </th>
</tr>
</thead>
<tbody>
<tr ng-repeat="hospital in hospital_filtered = hospitals">
<td> <a ng-click="click(hospital)"> {{ hospital.hospital_id }} </td>
<td> <a ng-click="click(hospital)"> {{ hospital.hospital_name }} </td>
<td> <a ng-click="click(hospital)"> {{ hospital.hospital_dba }} </td>
<td> <a ng-click="click(hospital)"> {{ hospital.facility_id }} </td>
<td> <a ng-click="click(hospital)"> {{ hospital.active_flag }} </td>
</tr>
</tbody>
</table>
Here is where I make the GET call from my API. The data is coming in, but the bootstrap table sorting and sort are not working. How do I populate bootstrap table with this call?
$http.get("/hospitals/all", {
params: {authtoken: $rootScope.auth_token}}
)
.then(function(response) {
// Request completed successfully
//console.log(response);
$scope.hospitals=response.data
}, function(x) {
// Request error
console.log("Error");
});
});
You're correctly fetching the data, but the iteration is wrong.
HTML:
<input ng-model="searchKeyword" type="text">
<table id="example" class="table table-bordered table-striped table-hover" data-search="true">
<thead>
<tr class="text-white clickable-row" bgcolor="#578ebe" >
<th id="white-text" ng-click="changeSort('hospital_id')"> # </th>
<th id="white-text" ng-click="changeSort('hospital_name')"> Name </th>
<th id="white-text" ng-click="changeSort('hospital_dba')"> DBA </th>
<th id="white-text" ng-click="changeSort('facility_id')"> Facility ID </th>
<th id="white-text" ng-click="changeSort('active_flag')"> Active </th>
</tr>
</thead>
<tbody>
<tr ng-repeat="hospital in hospitals | filter: searchKeyword | orderBy: orderKeyword">
<td> <a ng-click="click(hospital)"> {{ hospital.hospital_id }} </td>
<td> <a ng-click="click(hospital)"> {{ hospital.hospital_name }} </td>
<td> <a ng-click="click(hospital)"> {{ hospital.hospital_dba }} </td>
<td> <a ng-click="click(hospital)"> {{ hospital.facility_id }} </td>
<td> <a ng-click="click(hospital)"> {{ hospital.active_flag }} </td>
</tr>
</tbody>
</table>
The Javascript part:
$scope.orderKeyword = 'hospital_name';
$scope.changeSort = function(sortAttr) {
$scope.orderKeyword = sortAttr;
};
filter: searchKeyword will use the keyword typed into the additional input-field. This way you can basically "search" the table. The results that are left will then be ordered by (orderBy) the attribute-name that's stored inside $scope.orderKeyword. I initialized it with hospital_name.
You may add additional logic like how strict the filtering and which direction the sorting is supposed to be.
Here's the documentation for the two filters in question:
https://docs.angularjs.org/api/ng/filter/orderBy
https://docs.angularjs.org/api/ng/filter/filter