- - {!! Lang::get('lang.submit_a_ticket') !!} + {!! Lang::get('lang.submit_a_ticket') !!}
{!! Lang::get('lang.max') !!}. {!! $max_size_in_actual !!}
diff --git a/app/Http/Controllers/Client/helpdesk/FormController.php b/app/Http/Controllers/Client/helpdesk/FormController.php index 85d448549..6141a6de2 100644 --- a/app/Http/Controllers/Client/helpdesk/FormController.php +++ b/app/Http/Controllers/Client/helpdesk/FormController.php @@ -23,6 +23,7 @@ use App\Model\helpdesk\Utility\CountryCode; use App\User; use App\Model\helpdesk\Agent\Location; use Exception; +use App\Model\helpdesk\Agent\Department; // classes use Form; use GeoIP; @@ -66,6 +67,7 @@ class FormController extends Controller public function getForm(Help_topic $topic, CountryCode $code) { $locations = Location::all(); + $departments = Department::all(); if (\Config::get('database.install') == '%0%') { return \Redirect::route('licence'); } @@ -87,7 +89,7 @@ class FormController extends Controller [$max_size_in_bytes, $max_size_in_actual] = $this->fileUploadController->file_upload_max_size(); - return view('themes.default1.client.helpdesk.form', compact('topics', 'codes', 'email_mandatory', 'max_size_in_bytes', 'max_size_in_actual', 'locations'))->with('phonecode', $phonecode); + return view('themes.default1.client.helpdesk.form', compact('topics', 'codes', 'email_mandatory', 'max_size_in_bytes', 'max_size_in_actual', 'locations', 'departments'))->with('phonecode', $phonecode); } else { return \Redirect::route('home'); } diff --git a/app/Model/helpdesk/Ticket/Tickets.php b/app/Model/helpdesk/Ticket/Tickets.php index 8c4740e64..cada491b0 100644 --- a/app/Model/helpdesk/Ticket/Tickets.php +++ b/app/Model/helpdesk/Ticket/Tickets.php @@ -4,6 +4,7 @@ namespace App\Model\helpdesk\Ticket; use App\BaseModel; use App\Model\helpdesk\Agent\Location; +use App\Model\helpdesk\Agent\Department; class Tickets extends BaseModel { @@ -38,7 +39,8 @@ class Tickets extends BaseModel 'created_at', 'updated_at', 'assigned_to', - 'locationid' // <-- Thêm locationid vào đây + 'locationid', // <-- Thêm locationid vào đây + 'submitdep_id' ]; // Các quan hệ cũ... @@ -71,7 +73,10 @@ class Tickets extends BaseModel { return $this->belongsTo(Location::class, 'locationid', 'locationid'); } - + public function submitDepartment() + { + return $this->belongsTo(Department::class, 'submitdept_id'); + } public function extraFields() { $id = $this->attributes['id']; diff --git a/database/migrations/2025_08_16_220156_add_dept_id_to_tickets_table.php b/database/migrations/2025_08_16_220156_add_dept_id_to_tickets_table.php new file mode 100644 index 000000000..ac5e7a67a --- /dev/null +++ b/database/migrations/2025_08_16_220156_add_dept_id_to_tickets_table.php @@ -0,0 +1,29 @@ +unsignedInteger('submitdept_id')->nullable()->after('id'); + $table->foreign('submitdept_id')->references('id')->on('department')->onDelete('cascade'); + }); + } + + public function down() + { + Schema::table('tickets', function (Blueprint $table) { + $table->dropForeign(['submitdept_id']); + $table->dropColumn('submitdept_id'); + }); + } +}; diff --git a/resources/views/themes/default1/client/helpdesk/form.blade.php b/resources/views/themes/default1/client/helpdesk/form.blade.php index 0dfbcdd0c..9f840a226 100644 --- a/resources/views/themes/default1/client/helpdesk/form.blade.php +++ b/resources/views/themes/default1/client/helpdesk/form.blade.php @@ -7,35 +7,26 @@ @section('submit') class = "nav-item active" @stop - + @section('breadcrumb') - {{--
- {!! Lang::get('lang.have_a_ticket') !!}?
@@ -56,30 +47,32 @@ {!! Form::open(['url' => 'checkmyticket', 'method' => 'POST']) !!} {!! Form::label('email', Lang::get('lang.email')) !!} * {!! Form::text('email_address', null, ['class' => 'form-control form-group']) !!} + {!! Form::label('ticket_number', Lang::get('lang.ticket_number')) !!} * {!! Form::text('ticket_number', null, ['class' => 'form-control form-group']) !!} + {!! Form::close() !!}