diff --git a/app/Http/Controllers/Admin/TicketController.php b/app/Http/Controllers/Admin/TicketController.php index 6d16ebd..e8136bf 100644 --- a/app/Http/Controllers/Admin/TicketController.php +++ b/app/Http/Controllers/Admin/TicketController.php @@ -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) { diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 21ee769..09dbb53 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -10,6 +10,8 @@ class Invoice extends Model use HasFactory; + public static $invoiceStatus = ['PENDING', 'CANCELED', 'FAILED', 'PAID', 'PROCESSING', 'COMPLETED']; + public function getRouteKey() { return 'hash'; @@ -19,8 +21,8 @@ class Invoice extends Model { parent::boot(); - static::creating(function($model) { - $model->hash = generateUniqueID( (strlen(Invoice::count()) + 2)); + static::creating(function ($model) { + $model->hash = generateUniqueID((strlen(Invoice::count()) + 2)); }); } } diff --git a/app/Models/Ticket.php b/app/Models/Ticket.php index fa259a0..64968b0 100644 --- a/app/Models/Ticket.php +++ b/app/Models/Ticket.php @@ -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'); } diff --git a/app/Models/User.php b/app/Models/User.php index f10cc86..c2f4c02 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -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() { diff --git a/database/migrations/2024_05_07_130806_create_invoices_table.php b/database/migrations/2024_05_07_130806_create_invoices_table.php index 62ad962..b4dec43 100644 --- a/database/migrations/2024_05_07_130806_create_invoices_table.php +++ b/database/migrations/2024_05_07_130806_create_invoices_table.php @@ -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); diff --git a/database/migrations/2024_06_24_234732_create_tickets_table.php b/database/migrations/2024_06_24_234732_create_tickets_table.php index 6932e78..96ef3ad 100644 --- a/database/migrations/2024_06_24_234732_create_tickets_table.php +++ b/database/migrations/2024_06_24_234732_create_tickets_table.php @@ -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'); }); } diff --git a/resources/sass/panel/_common.scss b/resources/sass/panel/_common.scss index 8b5cde5..e9738d6 100644 --- a/resources/sass/panel/_common.scss +++ b/resources/sass/panel/_common.scss @@ -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; + } +} diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 4065384..5bb7197 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -2,139 +2,98 @@ @section('content')
-
-
-
+
+
+
+
-
+
{{__("Welcome bak")}} -

+

{{auth()->user()->name}}

+
+
+
+
+ {{__("Posts")}} +
+ {{number_format(auth()->user()->posts()->count())}} +
+
+
+ {{__("Products")}} +
+ {{number_format(auth()->user()->products()->count())}} +
+
+
+ {{__("Comments")}} +
+ {{number_format(auth()->user()->comments()->count())}} +
+
+
+ {{__("Tickets")}} +
+ {{number_format(auth()->user()->tickets()->count())}} +
+
+
-
-
+
+
- lorem + {{__("Need process orders")}}
- 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? + + +

+ {{number_format(\App\Models\Ticket::where('status','PAID')->count())}} +

+
-
-
+
+
- {{__("last month visits")}} + {{__("Pending tickets")}}
+
+
-
-
-
- lorem -
-
- 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? -
-
-
-
-
-
- lorem -
-
- 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? -
-
-
-
+
- lorem -
-
- 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? -
-
-
-
-
-
- lorem -
-
- 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? -
-
-
-
-
-
- lorem -
-
- 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? -
-
-
-
-
-
- lorem -
-
- 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? -
-
-
-
-
-
- lorem + {{__("last month visits")}}
- 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? +
+ +
@endsection