fix editing orders
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Datatables\Shop;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Shop\Invoice;
|
||||
use App\Repositories\Shop\Invoices;
|
||||
|
||||
class InvoicesDataTable extends DataTable
|
||||
{
|
||||
@@ -15,11 +16,29 @@ class InvoicesDataTable extends DataTable
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('status', function (Invoice $invoice) {
|
||||
return Invoices::getStatus($invoice->status);
|
||||
})
|
||||
->editColumn('created_at', function (Invoice $invoice) {
|
||||
return $invoice->created_at->toDateTimeString();
|
||||
})
|
||||
->editColumn('customer.last_name', function (Invoice $invoice) {
|
||||
return $invoice->customer->last_name . ' ' . $invoice->customer->first_name;
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('status.name'),
|
||||
Column::make('customer.name'),
|
||||
|
||||
Column::make('status'),
|
||||
Column::make('created_at')->title('Date'),
|
||||
Column::make('customer.last_name'),
|
||||
Column::make('total'),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
|
||||
@@ -12,6 +12,9 @@ use App\Repositories\Shop\Orders;
|
||||
class OrdersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'orders';
|
||||
public $sortedColumn = 1;
|
||||
public $sortedOrder = 'desc';
|
||||
public $stateSave = true;
|
||||
|
||||
public function query(Order $model)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Repositories\Shop\Dashboards;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
@@ -14,6 +15,7 @@ class HomeController extends Controller
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('Admin.Shop.Dashboard.index');
|
||||
$data = Dashboards::getStats();
|
||||
return view('Admin.Shop.Dashboard.index', $data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,7 @@ class OrderController extends Controller
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data['order'] = Orders::edit($id)->toArray();
|
||||
// dump($data);
|
||||
// exit;
|
||||
$data = Orders::edit($id);
|
||||
return view('Admin.Shop.Orders.edit', $data);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,18 @@
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Venturecraft\Revisionable\RevisionableTrait;
|
||||
|
||||
class Order extends Model
|
||||
{
|
||||
use RevisionableTrait, SoftDeletes;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_orders';
|
||||
protected $revisionCreationsEnabled = false;
|
||||
protected $keepRevisionOf = ['customer_address_id', 'delivery_id', 'payment_type', 'status'];
|
||||
|
||||
public function customer()
|
||||
{
|
||||
|
||||
@@ -458,17 +458,17 @@ class Articles
|
||||
$images = count($article->images) ? $article->images : collect([]);
|
||||
switch ($article->product_type) {
|
||||
case 'App\Models\Botanic\Variety':
|
||||
$variety = $article->product;
|
||||
$specie = $variety->specie;
|
||||
$variety = $article->product ?? false;
|
||||
$specie = $variety->specie ?? false;
|
||||
$images = $variety ? (count($variety->images) ? $images->merge($variety->images) : $images) : $images;
|
||||
$images = $specie ? (count($specie->images) ? $images->merge($specie->images) : $images) : $images;
|
||||
break;
|
||||
case 'App\Models\Botanic\Specie':
|
||||
$specie = $article->product;
|
||||
$images = count($specie->images) ? $specie->images : $images;
|
||||
$specie = $article->product ?? false;
|
||||
$images = count($specie->images ?? []) ? $specie->images : $images;
|
||||
break;
|
||||
case 'App\Models\Shop\Merchandise':
|
||||
$merchandise = $article->product;
|
||||
$merchandise = $article->product ?? false;
|
||||
$images = count($merchandise->images) ? $merchandise->images : $images;
|
||||
break;
|
||||
}
|
||||
@@ -488,20 +488,13 @@ class Articles
|
||||
}
|
||||
switch ($article->product_type) {
|
||||
case 'App\Models\Botanic\Variety':
|
||||
$variety = $article->product;
|
||||
$image = $variety->image ?? false;
|
||||
if (!$image) {
|
||||
$specie = $variety->specie;
|
||||
$image = $specie->image ?? false;
|
||||
}
|
||||
$image = $article->product->image ?? ($article->product->specie->image ?? false);
|
||||
break;
|
||||
case 'App\Models\Botanic\Specie':
|
||||
$specie = $article->product;
|
||||
$image = $specie->image ?? false;
|
||||
$image = $article->product->image ?? false;
|
||||
break;
|
||||
case 'App\Models\Shop\Merchandise':
|
||||
$merchandise = $article->product;
|
||||
$image = $merchandise->image ?? false;
|
||||
$image = $article->product->image ?? false;
|
||||
break;
|
||||
}
|
||||
return $image;
|
||||
@@ -509,16 +502,16 @@ class Articles
|
||||
|
||||
public static function storeFull($data)
|
||||
{
|
||||
$images = isset($data['images']) ? $data['images'] : false;
|
||||
$images = $data['images'] ?? false;
|
||||
unset($data['images']);
|
||||
|
||||
$categories = isset($data['categories']) ? $data['categories'] : false;
|
||||
$categories = $data['categories'] ?? false;
|
||||
unset($data['categories']);
|
||||
|
||||
$tags = isset($data['tags']) ? $data['tags'] : false;
|
||||
$tags = $data['tags'] ?? false;
|
||||
unset($data['tags']);
|
||||
|
||||
$prices = isset($data['prices']) ? $data['prices'] : false;
|
||||
$prices = $data['prices'] ?? false;
|
||||
unset($data['prices']);
|
||||
|
||||
$article = self::store($data);
|
||||
|
||||
@@ -15,14 +15,11 @@ class Customers
|
||||
public static function editProfile($id = false)
|
||||
{
|
||||
$id = $id ? $id : self::getId();
|
||||
dump($id);
|
||||
exit;
|
||||
$data = [
|
||||
'customer' => self::get($id, ['addresses', 'deliveries', 'orders']),
|
||||
'customer' => self::get($id, ['addresses', 'deliveries', 'orders'])->toArray(),
|
||||
'deliveries' => Deliveries::getAll('sale_channel')->toArray(),
|
||||
];
|
||||
dump($data);
|
||||
exit;
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
18
app/Repositories/Shop/Dashboards.php
Normal file
18
app/Repositories/Shop/Dashboards.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use App\Models\Shop\Homepage;
|
||||
|
||||
class Dashboards
|
||||
{
|
||||
|
||||
public static function getStats()
|
||||
{
|
||||
return [
|
||||
'orders_count' => Orders::countByMonth(),
|
||||
'orders_sum' => Orders::sumByMonth(),
|
||||
'orders_avg' => Orders::avgByMonth(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Shop\Invoice;
|
||||
|
||||
class Invoices
|
||||
@@ -19,6 +19,17 @@ class Invoices
|
||||
return $relations ? Invoice::with($relations)->findOrFail($id) : Invoice::findOrFail($id);
|
||||
}
|
||||
|
||||
public static function count()
|
||||
{
|
||||
return Invoice::count();
|
||||
}
|
||||
|
||||
public static function countByMonth()
|
||||
{
|
||||
$start = Carbon::now()->beginOfMonth();
|
||||
return Invoice::where('created_at', '>', $start);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
return ($data['id'] ?? false) ? self::update($data) : self::create($data);
|
||||
@@ -53,4 +64,9 @@ class Invoices
|
||||
$last_ref = Invoice::orderBy('ref', 'desc')->where('ref', '>', $ref)->first();
|
||||
return $last_ref ? $last_ref->ref + 1 : $ref + 1;
|
||||
}
|
||||
|
||||
public static function statuses()
|
||||
{
|
||||
return ['En attente', 'Non soldée', 'Soldée'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Shop\Order;
|
||||
|
||||
class Orders
|
||||
@@ -24,9 +25,36 @@ class Orders
|
||||
return ($order && $detail) ? Invoices::saveInvoice($order->id, $data) : false;
|
||||
}
|
||||
|
||||
public static function count()
|
||||
{
|
||||
return Order::count();
|
||||
}
|
||||
|
||||
public static function countByMonth()
|
||||
{
|
||||
$start = Carbon::now()->startOfMonth();
|
||||
return Order::where('created_at', '>', $start)->count();
|
||||
}
|
||||
|
||||
public static function sumByMonth()
|
||||
{
|
||||
$start = Carbon::now()->startOfMonth();
|
||||
return Order::where('created_at', '>', $start)->sum('total_shipped');
|
||||
}
|
||||
|
||||
public static function avgByMonth()
|
||||
{
|
||||
return self::countByMonth() ? round(self::sumByMonth() / self::countByMonth(), 2) : 0;
|
||||
}
|
||||
|
||||
public static function edit($id)
|
||||
{
|
||||
return Orders::get($id, ['customer', 'address', 'delivery', 'detail']);
|
||||
return [
|
||||
'order' => self::get($id, ['customer', 'address', 'detail']),
|
||||
'statuses' => self::statuses(),
|
||||
'payment_types' => self::payment_types(),
|
||||
'sale_channels' => SaleChannels::getOptions(),
|
||||
];
|
||||
}
|
||||
|
||||
public static function get($id, $relations = false)
|
||||
@@ -65,10 +93,16 @@ class Orders
|
||||
|
||||
public static function statuses()
|
||||
{
|
||||
return [
|
||||
'En attente',
|
||||
'Expédié',
|
||||
'Livré',
|
||||
];
|
||||
return ['En attente', 'Expédié', 'Livré'];
|
||||
}
|
||||
|
||||
public static function getPaymentType($id)
|
||||
{
|
||||
return self::payment_types()[$id] ?? false;
|
||||
}
|
||||
|
||||
public static function payment_types()
|
||||
{
|
||||
return ['', 'CARTE BANCAIRE', 'CHEQUE', 'VIREMENT BANCAIRE'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
"thomasjohnkane/snooze": "^2.2",
|
||||
"toin0u/geocoder-laravel": "^4.2",
|
||||
"unicodeveloper/laravel-password": "^1.0",
|
||||
"venturecraft/revisionable": "^1.39",
|
||||
"watson/rememberable": "^5.0",
|
||||
"wildside/userstamps": "^2.1",
|
||||
"yadahan/laravel-authentication-log": "^1.2",
|
||||
|
||||
13
config/revisionable.php
Normal file
13
config/revisionable.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Revision Model
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'model' => Venturecraft\Revisionable\Revision::class,
|
||||
|
||||
'additional_fields' => [],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateRevisionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('revisions', function ($table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('revisionable_type');
|
||||
$table->unsignedBigInteger('revisionable_id');
|
||||
$table->unsignedBigInteger('user_id')->nullable();
|
||||
$table->string('key');
|
||||
$table->text('old_value')->nullable();
|
||||
$table->text('new_value')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(array('revisionable_id', 'revisionable_type'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('revisions');
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class TeamworkSetupTables extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table(\Config::get('teamwork.users_table'), function (Blueprint $table) {
|
||||
$table->integer('current_team_id')->unsigned()->nullable();
|
||||
});
|
||||
|
||||
Schema::create(\Config::get('teamwork.teams_table'), function (Blueprint $table) {
|
||||
$table->increments('id')->unsigned();
|
||||
$table->integer('owner_id')->unsigned()->nullable();
|
||||
$table->string('name');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create(\Config::get('teamwork.team_user_table'), function (Blueprint $table) {
|
||||
$table->bigInteger('user_id')->unsigned();
|
||||
$table->integer('team_id')->unsigned();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('user_id')
|
||||
->references(\Config::get('teamwork.user_foreign_key'))
|
||||
->on(\Config::get('teamwork.users_table'))
|
||||
->onUpdate('cascade')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign('team_id')
|
||||
->references('id')
|
||||
->on(\Config::get('teamwork.teams_table'))
|
||||
->onDelete('cascade');
|
||||
});
|
||||
|
||||
Schema::create(\Config::get('teamwork.team_invites_table'), function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->bigInteger('user_id')->unsigned();
|
||||
$table->integer('team_id')->unsigned();
|
||||
$table->enum('type', ['invite', 'request']);
|
||||
$table->string('email');
|
||||
$table->string('accept_token');
|
||||
$table->string('deny_token');
|
||||
$table->timestamps();
|
||||
$table->foreign('team_id')
|
||||
->references('id')
|
||||
->on(\Config::get('teamwork.teams_table'))
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table(\Config::get('teamwork.users_table'), function (Blueprint $table) {
|
||||
$table->dropColumn('current_team_id');
|
||||
});
|
||||
|
||||
Schema::table(\Config::get('teamwork.team_user_table'), function (Blueprint $table) {
|
||||
if (DB::getDriverName() !== 'sqlite') {
|
||||
$table->dropForeign(\Config::get('teamwork.team_user_table').'_user_id_foreign');
|
||||
}
|
||||
if (DB::getDriverName() !== 'sqlite') {
|
||||
$table->dropForeign(\Config::get('teamwork.team_user_table').'_team_id_foreign');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::drop(\Config::get('teamwork.team_user_table'));
|
||||
Schema::drop(\Config::get('teamwork.team_invites_table'));
|
||||
Schema::drop(\Config::get('teamwork.teams_table'));
|
||||
}
|
||||
}
|
||||
@@ -247,4 +247,30 @@ return [
|
||||
'successdel' => 'La déclinaison a été correctement effacée',
|
||||
'confirmdelete' => 'Confirmez-vous la suppression de la déclinaison ?',
|
||||
],
|
||||
'orders' => [
|
||||
'title' => 'Commandes',
|
||||
'name' => 'Commande',
|
||||
'description' => 'Gérer les commandes',
|
||||
'add' => 'Ajouter une commande',
|
||||
'edit' => 'Editer une commande',
|
||||
'del' => 'Effacer une commande',
|
||||
'list' => 'Liste des commandes',
|
||||
'successadd' => 'La commande a été correctement ajoutée',
|
||||
'successmod' => 'La commande a été correctement modifiée',
|
||||
'successdel' => 'La commande a été correctement effacée',
|
||||
'confirmdelete' => 'Confirmez-vous la suppression de la commande ?',
|
||||
],
|
||||
'invoices' => [
|
||||
'title' => 'Factures',
|
||||
'name' => 'Facture',
|
||||
'description' => 'Gérer les factures',
|
||||
'add' => 'Ajouter une facture',
|
||||
'edit' => 'Editer une facture',
|
||||
'del' => 'Effacer une facture',
|
||||
'list' => 'Liste des factures',
|
||||
'successadd' => 'La facture a été correctement ajoutée',
|
||||
'successmod' => 'La facture a été correctement modifiée',
|
||||
'successdel' => 'La facture a été correctement effacée',
|
||||
'confirmdelete' => 'Confirmez-vous la suppression de la facture ?',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -1,30 +1,27 @@
|
||||
<div class="row">
|
||||
<div class="col-md-3 col-sm-6 col-xs-12">
|
||||
<a href="{!! route('Admin.Shop.Orders.index') !!}">
|
||||
@include('Admin.Shop.Dashboard.components.infobox', ['count' => (isset($nb_orders)) ? $nb_orders : 0, 'class' => 'bg-aqua', 'icon' => 'ion ion-bag', 'text' => 'Commandes'])
|
||||
@include('Admin.Shop.Dashboard.components.infobox', ['count' => $orders_count ?? 0, 'class' => 'bg-aqua', 'icon' => 'ion ion-bag', 'text' => 'Commandes'])
|
||||
</a>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
|
||||
<div class="col-md-3 col-sm-6 col-xs-12">
|
||||
<a href="{!! route('Admin.Shop.Invoices.index') !!}">
|
||||
@include('Admin.Shop.Dashboard.components.infobox', ['count' => (isset($nb_invoices)) ? $nb_invoices : 0, 'class' => 'bg-red', 'icon' => 'fa-clock-o', 'text' => 'Factures'])
|
||||
@include('Admin.Shop.Dashboard.components.infobox', ['count' => $invoices_count ?? 0, 'class' => 'bg-red', 'icon' => 'fa-clock-o', 'text' => 'Factures'])
|
||||
</a>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
|
||||
<!-- fix for small devices only -->
|
||||
<div class="clearfix visible-sm-block"></div>
|
||||
|
||||
<div class="col-md-3 col-sm-6 col-xs-12">
|
||||
<a href="{!!route('Admin.Shop.Orders.index') !!}">
|
||||
@include('Admin.Shop.Dashboard.components.infobox', ['count' => (isset($total_invoices)) ? $total_invoices : 0, 'class' => 'bg-yellow', 'icon' => 'ion ion-stats-bars', 'text' => 'CA du mois'])
|
||||
@include('Admin.Shop.Dashboard.components.infobox', ['count' => $orders_sum ?? 0, 'class' => 'bg-yellow', 'icon' => 'ion ion-stats-bars', 'text' => 'CA du mois'])
|
||||
</a>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
|
||||
<div class="col-md-3 col-sm-6 col-xs-12">
|
||||
<a href="{!! route('Admin.Shop.Orders.index') !!}">
|
||||
@include('Admin.Shop.Dashboard.components.infobox', ['count' => (isset($nb_ventes)) ? $nb_ventes : 0, 'class' => 'bg-green', 'icon' => 'fa-check-square-o', 'text' => 'Panier moyen'])
|
||||
@include('Admin.Shop.Dashboard.components.infobox', ['count' => $orders_avg ?? 0, 'class' => 'bg-green', 'icon' => 'fa-check-square-o', 'text' => 'Panier moyen'])
|
||||
</a>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
@extends('layout.index', [
|
||||
'title' => 'Commandes',
|
||||
'subtitle' => 'Edition d\'une commandes',
|
||||
'title' => __('shop.orders.title'),
|
||||
'subtitle' => __('shop.orders.list'),
|
||||
'breadcrumb' => ['Commandes']
|
||||
])
|
||||
|
||||
@section('content')
|
||||
{{ Form::open(['route' => 'Admin.Shop.Orders.update', 'id' => 'order-form', 'autocomplete' => 'off']) }}
|
||||
{{ Form::open(['route' => 'Admin.Shop.Orders.store', 'id' => 'order-form', 'autocomplete' => 'off']) }}
|
||||
<input type="hidden" name="id" value="{{ $order['id'] ?? null }}">
|
||||
|
||||
<x-card>
|
||||
<div class="row mb-3">
|
||||
<div class="col-6">
|
||||
<h3>{{ $order['customer']['last_name'] }} {{ $order['customer']['first_name'] }}</h3>
|
||||
|
||||
<h4>{{ $order['delivery']['name'] }} </h4>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@@ -21,34 +21,50 @@
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<x-card title="Détail de la commande">
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="row mb-3">
|
||||
<div class="col-6" style="font-size: 1.2em; font-weight: 500;">
|
||||
Commande <br/>
|
||||
du {{ Carbon\Carbon::parse($order['created_at'])->isoFormat('LLLL') }}
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label>Canal de vente</label><br/>
|
||||
@include('components.form.select', [
|
||||
'name' => 'sale_channel_id',
|
||||
'list' => $sale_channels ?? [],
|
||||
'value' => $order['sale_channel_id'],
|
||||
'class' => 'select2',
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-6">
|
||||
<label>Statut</label><br/>
|
||||
@include('components.form.select', [
|
||||
'name' => 'status',
|
||||
'list' => $statuses ?? [],
|
||||
'value' => $order['status'],
|
||||
'class' => 'select2',
|
||||
])
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label>Règlement</label><br/>
|
||||
@include('components.form.select', [
|
||||
'name' => 'payment_type',
|
||||
'list' => $payment_types ?? [],
|
||||
'value' => $order['payment_type'],
|
||||
'class' => 'select2',
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
<table class="datatable w-100 table-bordered">
|
||||
<thead>
|
||||
<th>Quantité</th>
|
||||
<th>Nom</th>
|
||||
<th>Prix</th>
|
||||
<th>Total</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($order['detail'] as $detail)
|
||||
<tr>
|
||||
<td>{{ $detail['quantity'] }}</td>
|
||||
<td>{{ $detail['name'] }}</td>
|
||||
<td>{{ $detail['price'] }}</td>
|
||||
<td>{{ $detail['total'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@include('Admin.Shop.Orders.partials.detail')
|
||||
</div>
|
||||
</div>
|
||||
</x-card>
|
||||
</x-card>
|
||||
|
||||
</form>
|
||||
|
||||
{{ Form::close() }}
|
||||
@endsection
|
||||
|
||||
46
resources/views/Admin/Shop/Orders/partials/detail.blade.php
Normal file
46
resources/views/Admin/Shop/Orders/partials/detail.blade.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<x-card title="Détail de la commande">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-bordered table-hover w-100 ">
|
||||
<thead class="thead-light">
|
||||
<th>Nom</th>
|
||||
<th>Quantité</th>
|
||||
<th>Prix unitaire</th>
|
||||
<th>Total</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($order['detail'] as $detail)
|
||||
<tr>
|
||||
<td>{{ $detail['name'] }}</td>
|
||||
<td align="right">{{ $detail['quantity'] }}</td>
|
||||
<td align="right">{{ $detail['price_taxed'] }}</td>
|
||||
<td align="right">{{ $detail['total_taxed'] }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td style="font-size: 1.2em; font-weight: bold;">Total</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td align="right" style="font-size: 1.2em; font-weight: bold;">{{ $order['total_taxed'] }}</td>
|
||||
</tr>
|
||||
@if ($order['shipping'] ?? false)
|
||||
<tr>
|
||||
<td style="font-size: 1.1em; font-weight: 500;">Livraison</td>
|
||||
<td align="right"></td>
|
||||
<td align="right"></td>
|
||||
<td align="right" style="font-size: 1.1em; font-weight: bold;">{{ $order['shipping'] }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-size: 1.4em; font-weight: bold;">Total à payer</td>
|
||||
<td align="right"></td>
|
||||
<td align="right"></td>
|
||||
<td align="right" style="font-size: 1.4em; font-weight: bold;">{{ $order['total_shipped'] }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</x-card>
|
||||
@@ -1,10 +1,10 @@
|
||||
<hr>
|
||||
<strong>Mes coordonnées</strong><br>
|
||||
|
||||
<i class="fa fa-home pr-2"></i> {{ $customer['first_name'] }} {{ $customer['first_name'] }} {{ $customer['company'] }}
|
||||
<i class="fa fa-home pr-2"></i> {{ $customer['address'] }}<br>
|
||||
<i class="pr-5"></i> {{ $customer['address2'] }}<br>
|
||||
|
||||
<i class="fa fa-phone pr-2"></i> {{ $customer['phone'] }}<br>
|
||||
<i class="fa fa-envelope pr-2"></i> {{ $customer['email'] }}<br>
|
||||
<hr>
|
||||
<strong>Compte créé le {{ $customer['created_at'] }}</strong>
|
||||
<strong>Compte créé le {{ Carbon\Carbon::parse($customer['created_at'])->format('d-m-Y') }}</strong>
|
||||
Reference in New Issue
Block a user