added status to invoice

added user relations
added invoice and ticket to index
pull/44/head
A1Gard 4 months ago
parent abb4330d62
commit 597beda443

@ -121,6 +121,7 @@ class TicketController extends XController
{
$item->answer = $request->answer;
$item->status = $request->status;
$item->user_id = auth()->id();
$item->save();
if ($request->has('answers')){
foreach ($request->answers as $id => $answer) {

@ -10,6 +10,8 @@ class Invoice extends Model
use HasFactory;
public static $invoiceStatus = ['PENDING', 'CANCELED', 'FAILED', 'PAID', 'PROCESSING', 'COMPLETED'];
public function getRouteKey()
{
return 'hash';

@ -15,6 +15,12 @@ class Ticket extends Model
return $this->belongsTo(Customer::class);
}
public function user(){
return $this->belongsTo(User::class);
}
public function subTickets(){
return $this->hasMany(Ticket::class,'parent_id','id')->orderBy('id');
}

@ -58,6 +58,18 @@ class User extends Authenticatable
{
return $this->hasMany(Post::class);
}
public function products()
{
return $this->hasMany(Product::class);
}
public function tickets()
{
return $this->hasMany(Ticket::class);
}
public function comments()
{
return $this->morphMany(Comment::class,'commentator');
}
public function logs()
{

@ -15,7 +15,7 @@ return new class extends Migration
Schema::create('invoices', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('customer_id');
$table->enum("status", ['PENDING', 'PROCESSING', 'COMPLETED', 'CANCELED', 'FAILED',])->nullable()->default("PENDING");
$table->enum("status",\App\Models\Invoice::$invoiceStatus)->nullable()->default("PENDING");
$table->unsignedBigInteger('total_price')->nullable()->default(0);
$table->json('meta')->nullable();
$table->unsignedBigInteger('discount_id')->nullable()->default(null);

@ -15,6 +15,7 @@ return new class extends Migration
$table->id();
$table->string('title',128)->nullable()->default(null);
$table->unsignedBigInteger('customer_id');
$table->unsignedBigInteger('user_id')->nullable();
$table->text('body');
$table->enum('status',['PENDING','ANSWERED','CLOSED'])->default('PENDING');
$table->text('answer')->nullable()->default(null);
@ -22,6 +23,8 @@ return new class extends Migration
$table->timestamps();
$table->foreign('customer_id')->on('customers')
->references('id')->onDelete('cascade');
$table->foreign('user_id')->on('users')
->references('id')->onDelete('cascade');
});
}

@ -206,3 +206,69 @@ a.btn,a.action-btn,a.circle-btn{
object-fit: cover;
border: 3px rgba($primary-color-panel,127) solid ;
}
.skewed-container{
overflow: hidden;
position: relative;
min-height: 128px;
}
.skewed-icon{
font-size: 128px;
opacity: .3;
position: absolute;
transform: rotateZ(27deg);
inset-inline-end: 1%;
top: -30px;
}
.order-card{
background: rgba(255, 196, 0, 0.8) !important;
.card-header{
background: #ffffff22 !important;
color: $secondary-color-panel;
}
.card-body{
background: #00000011;
text-align: center;
}
i{
font-size: 100px;
}
a{
color: white;
}
}
.ticket-card{
background: rgba(0, 255, 166, 0.8) !important;
.card-header{
background: #ffffff22 !important;
color: $secondary-color-panel;
}
.card-body{
background: #00000011;
text-align: center;
}
i{
font-size: 100px;
}
a,a:visited{
color: white;
}
}
.equal-height {
display: flex;
display: -webkit-flex;
flex-wrap: wrap;
}
@media (min-width: 768px) {
.row.equal {
display: flex;
flex-wrap: wrap;
}
}

@ -2,139 +2,98 @@
@section('content')
<div class="container-fluid">
<div class="row">
<div class="col-md-6 p-0 pe-md-2 mb-3">
<div class="card">
<div class="row equal-height">
<div class="col-lg-6 p-0 pe-lg-2 mb-3">
<div class="card skewed-container">
<i class="ri-user-follow-line skewed-icon"></i>
<div class="card-body">
<div class="row">
<div class="col-3 text-center">
<img src="{{asset('panel/images/xshop-logo.svg')}}" class="avatar-x64" alt="">
</div>
<div class="col-9">
<div class="col-9 pt-1">
{{__("Welcome bak")}}
<h4>
<h4 class="mt-2">
{{auth()->user()->name}}
</h4>
</div>
<div class="p-4">
<div class="row text-center">
<div class="col-6 mt-3">
<h5>
{{__("Posts")}}
</h5>
{{number_format(auth()->user()->posts()->count())}}
</div>
<div class="col-6 mt-3">
<h5>
{{__("Products")}}
</h5>
{{number_format(auth()->user()->products()->count())}}
</div>
<div class="col-6 mt-3">
<h5>
{{__("Comments")}}
</h5>
{{number_format(auth()->user()->comments()->count())}}
</div>
</div>
<div class="col-md-6 p-0 ps-md-2 mb-3">
<div class="card">
<div class="card-header">
lorem
</div>
<div class="card-body">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Aliquam aspernatur, commodi consequatur deleniti dolor,
dolore ducimus ipsa laudantium magni natus nemo neque odit
officia perferendis provident suscipit ullam voluptas voluptate?
</div>
</div>
</div>
<div class="col-md-12 mb-3 p-0" id="visitor-container">
<div class="card">
<div class="card-header">
{{__("last month visits")}}
</div>
<div class="card-body">
<canvas id="visitor-chart" height="300"></canvas>
</div>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="card">
<div class="card-header">
lorem
</div>
<div class="card-body">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Aliquam aspernatur, commodi consequatur deleniti dolor,
dolore ducimus ipsa laudantium magni natus nemo neque odit
officia perferendis provident suscipit ullam voluptas voluptate?
</div>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="card">
<div class="card-header">
lorem
</div>
<div class="card-body">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Aliquam aspernatur, commodi consequatur deleniti dolor,
dolore ducimus ipsa laudantium magni natus nemo neque odit
officia perferendis provident suscipit ullam voluptas voluptate?
<div class="col-6 mt-3">
<h5>
{{__("Tickets")}}
</h5>
{{number_format(auth()->user()->tickets()->count())}}
</div>
</div>
</div>
<div class="col-md-4 mb-4">
<div class="card">
<div class="card-header">
lorem
</div>
<div class="card-body">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Aliquam aspernatur, commodi consequatur deleniti dolor,
dolore ducimus ipsa laudantium magni natus nemo neque odit
officia perferendis provident suscipit ullam voluptas voluptate?
</div>
</div>
</div>
<div class="col-md-3 mb-4">
<div class="card">
<div class="col-lg-3 p-0 px-lg-2 mb-3">
<div class="card order-card h-100">
<div class="card-header">
lorem
{{__("Need process orders")}}
</div>
<div class="card-body">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Aliquam aspernatur, commodi consequatur deleniti dolor,
dolore ducimus ipsa laudantium magni natus nemo neque odit
officia perferendis provident suscipit ullam voluptas voluptate?
<a href="#">
<i class="ri-shopping-bag-4-line"></i>
<h2>
{{number_format(\App\Models\Ticket::where('status','PAID')->count())}}
</h2>
</a>
</div>
</div>
</div>
<div class="col-md-3 mb-4">
<div class="card">
<div class="col-lg-3 p-0 ps-lg-2 mb-3">
<div class="card ticket-card h-100">
<div class="card-header">
lorem
{{__("Pending tickets")}}
</div>
<div class="card-body">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Aliquam aspernatur, commodi consequatur deleniti dolor,
dolore ducimus ipsa laudantium magni natus nemo neque odit
officia perferendis provident suscipit ullam voluptas voluptate?
<a href="{{route('admin.ticket.index')}}">
<i class="ri-customer-service-2-line"></i>
<h2>
{{number_format(\App\Models\Invoice::where('status','PENDING')->count())}}
</h2>
</a>
</div>
</div>
</div>
<div class="col-md-3 mb-4">
<div class="card">
<div class="card-header">
lorem
</div>
<div class="card-body">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Aliquam aspernatur, commodi consequatur deleniti dolor,
dolore ducimus ipsa laudantium magni natus nemo neque odit
officia perferendis provident suscipit ullam voluptas voluptate?
</div>
</div>
</div>
<div class="col-md-3 mb-4">
<div class="row">
<div class="col-lg-12 mb-3 p-0" id="visitor-container">
<div class="card">
<div class="card-header">
lorem
{{__("last month visits")}}
</div>
<div class="card-body">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Aliquam aspernatur, commodi consequatur deleniti dolor,
dolore ducimus ipsa laudantium magni natus nemo neque odit
officia perferendis provident suscipit ullam voluptas voluptate?
<canvas id="visitor-chart" height="300"></canvas>
</div>
</div>
</div>
</div>
</div>
@endsection

Loading…
Cancel
Save