from server

This commit is contained in:
Shohrat 2024-01-18 11:17:01 +05:00
parent 0e8c9277ef
commit c00fa69a05
5 changed files with 52 additions and 10 deletions

View File

@ -57,9 +57,9 @@ return [
'engine' => 'InnoDB',
'host' => 'localhost',
'port' => 3306,
'database' => 'gok_bakja_from_server2',
'database' => 'gok_bakja_12',
'username' => 'root',
'password' => 'bt110226',
'password' => '',
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',

View File

@ -267,7 +267,7 @@ class Order extends ComponentBase
$html_data = '';
$orderDatas = OrderModel::with(["client", "shipping"])
$orderDatas = OrderModel::with(["client", "shipping", "shippingTransport"])
->withCount(['order_items as qty'])
->withCount(['order_items as order_all_price' => function ($query) {
$query->select(DB::raw('sum(price) * sum(amount) / qty'));
@ -298,7 +298,39 @@ class Order extends ComponentBase
} else{
$mustPay = $mustPayCalc.' $';
}
if($orderDatas[$x]->shippingTransport == null){
$shippingDate = '';
$status = '';
}else{
$shippingDate = Carbon::parse($orderDatas[$x]->shippingTransport->date)->format('d.m.Y') ?? '';
if ($orderDatas[$x]->shippingTransport->status == "loaded") {
$status = '<span class="badge badge-soft-info"
style="font-size: 14px;">ÝÜKLENDI</span>';
}
if ($orderDatas[$x]->shippingTransport->status == "loading") {
$status = '<span class="badge badge-soft-primary"
style="font-size: 14px;">ÝÜKLENÝÄR</span>';
}
if ($orderDatas[$x]->shippingTransport->status == "proccess") {
$status = '<span class="badge badge-soft-warning"
style="font-size: 14px;">ÝOLDA</span>';
}
if ($orderDatas[$x]->shippingTransport->status == "complated") {
$status = '<span class="badge badge-soft-success"
style="font-size: 14px;">TAMAMLANDY</span>';
}
}
$html_data .= '<tr>
<td style="font-weight: bold;">' . ($x + 1) . '</td>
<td><a href="/order-detail/' . $orderDatas[$x]->id . '" style="font-weight: bold;">Sargyt #' . $orderDatas[$x]->id . '</a></td>
@ -313,7 +345,8 @@ class Order extends ComponentBase
</td>
<td><a href="#" class="badge badge-soft-danger" style="font-size: 14px;">' . $mustPay . '</a>
</td>
<td>' . $orderDatas[$x]->created_at->format('d.m.Y') . '</td>
<td>' .$shippingDate . '</td>
<td>' .$status . '</td>
<td>' . $orderDatas[$x]->note . '</td>
<td>'.$editBtn.'</td>
</tr>';

View File

@ -244,8 +244,8 @@ class OrderItem extends ComponentBase
</div>
<div class="modal-body">
<form data-request="onUpdateOrderItemPrice" method="POST" data-request-flash>
<input type="number" step="0.01" pattern="/^-?\d+\.?\d*$/"
onKeyPress="if(this.value.length==4) return false;"
<input type="number" step="0.0001" pattern="/^-?\d+\.?\d*$/"
onKeyPress="if(this.value.length==7) return false;"
name="price" class="form-control"
placeholder="%"
value="' . $orderItem->price . '">

View File

@ -40,6 +40,13 @@ class Order extends Model
],
];
public $hasOne = [
'shippingTransport' => [
'Romanah\Gokbakja\Models\ShippingTransport',
'key' => 'order_id'
],
];
/**
* @var string The database table used by the model.

View File

@ -110,7 +110,8 @@ function onStart(){
<th>Bahasy</th>
<th>Tölenen</th>
<th>Bergisi</th>
<th>Senesi</th>
<th>Ugramaly Senesi</th>
<th>Status</th>
<th>Bellik</th>
<th>Sazlamalar</th>
</tr>
@ -128,7 +129,8 @@ function onStart(){
<th>Bahasy</th>
<th>Tölenen</th>
<th>Bergisi</th>
<th>Senesi</th>
<th>Ugramaly Senesi</th>
<th>Status</th>
<th>Bellik</th>
<th>Sazlamalar</th>
</tr>
@ -159,4 +161,4 @@ function onStart(){
{% endput %}
{% partial 'dataTableJs' %}
{% partial 'dataTableJs' %}