This commit is contained in:
2025-08-02 23:14:28 +07:00
parent 6568aa45f8
commit e075da48fd
403 changed files with 7813 additions and 4283 deletions

46
app/Http/Controllers/Client/helpdesk/FormController.php Executable file → Normal file
View File

@@ -21,6 +21,7 @@ use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Utility\CountryCode;
use App\User;
use App\Model\helpdesk\Agent\Location;
use Exception;
// classes
use Form;
@@ -64,6 +65,7 @@ class FormController extends Controller
*/
public function getForm(Help_topic $topic, CountryCode $code)
{
$locations = Location::all();
if (\Config::get('database.install') == '%0%') {
return \Redirect::route('licence');
}
@@ -85,7 +87,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'))->with('phonecode', $phonecode);
return view('themes.default1.client.helpdesk.form', compact('topics', 'codes', 'email_mandatory', 'max_size_in_bytes', 'max_size_in_actual', 'locations'))->with('phonecode', $phonecode);
} else {
return \Redirect::route('home');
}
@@ -113,29 +115,29 @@ class FormController extends Controller
$form_fields = explode(',', $form_data->value);
$var = '';
foreach ($form_fields as $form_field) {
$var .= '<option value="'.$form_field.'">'.$form_field.'</option>';
$var .= '<option value="' . $form_field . '">' . $form_field . '</option>';
}
echo '<br/><label>'.ucfirst($form_data->label).'</label><select class="form-control" name="'.$form_data->name.'">'.$var.'</select>';
echo '<br/><label>' . ucfirst($form_data->label) . '</label><select class="form-control" name="' . $form_data->name . '">' . $var . '</select>';
} elseif ($form_data->type == 'radio') {
$type2 = $form_data->value;
$vals = explode(',', $type2);
echo '<br/><label>'.ucfirst($form_data->label).'</label><br/>';
echo '<br/><label>' . ucfirst($form_data->label) . '</label><br/>';
foreach ($vals as $val) {
echo '<input type="'.$form_data->type.'" name="'.$form_data->name.'"> '.$form_data->value.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
echo '<input type="' . $form_data->type . '" name="' . $form_data->name . '"> ' . $form_data->value . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
}
echo '<br/>';
} elseif ($form_data->type == 'textarea') {
$type3 = $form_data->value;
echo '<br/><label>'.$form_data->label.'</label></br><textarea id="unique-textarea" name="'.$form_data->name.'" class="form-control" style="height:15%;"></textarea>';
echo '<br/><label>' . $form_data->label . '</label></br><textarea id="unique-textarea" name="' . $form_data->name . '" class="form-control" style="height:15%;"></textarea>';
} elseif ($form_data->type == 'checkbox') {
$type4 = $form_data->value;
$checks = explode(',', $type4);
echo '<br/><label>'.ucfirst($form_data->label).'</label><br/>';
echo '<br/><label>' . ucfirst($form_data->label) . '</label><br/>';
foreach ($checks as $check) {
echo '<input type="'.$form_data->type.'" name="'.$form_data->name.'">&nbsp&nbsp'.$check;
echo '<input type="' . $form_data->type . '" name="' . $form_data->name . '">&nbsp&nbsp' . $check;
}
} else {
echo '<br/><label>'.ucfirst($form_data->label).'</label><input type="'.$form_data->type.'" class="form-control" name="'.$form_data->name.'" />';
echo '<br/><label>' . ucfirst($form_data->label) . '</label><input type="' . $form_data->type . '" class="form-control" name="' . $form_data->name . '" />';
}
}
echo '<br/><br/>';
@@ -238,27 +240,27 @@ class FormController extends Controller
if ($attachments != null) {
$storage = new \App\FaveoStorage\Controllers\StorageController();
$storage->saveAttachments($thread->id, $attachments);
// foreach ($attachments as $attachment) {
// if ($attachment != null) {
// $name = $attachment->getClientOriginalName();
// $type = $attachment->getClientOriginalExtension();
// $size = $attachment->getSize();
// $data = file_get_contents($attachment->getRealPath());
// $attachPath = $attachment->getRealPath();
// $ta->create(['thread_id' => $thread->id, 'name' => $name, 'size' => $size, 'type' => $type, 'file' => $data, 'poster' => 'ATTACHMENT']);
// }
// }
// foreach ($attachments as $attachment) {
// if ($attachment != null) {
// $name = $attachment->getClientOriginalName();
// $type = $attachment->getClientOriginalExtension();
// $size = $attachment->getSize();
// $data = file_get_contents($attachment->getRealPath());
// $attachPath = $attachment->getRealPath();
// $ta->create(['thread_id' => $thread->id, 'name' => $name, 'size' => $size, 'type' => $type, 'file' => $data, 'poster' => 'ATTACHMENT']);
// }
// }
}
// dd($result);
return Redirect::back()->with('success', Lang::get('lang.Ticket-has-been-created-successfully-your-ticket-number-is').' '.$result[0].'. ');
return Redirect::back()->with('success', Lang::get('lang.Ticket-has-been-created-successfully-your-ticket-number-is') . ' ' . $result[0] . '. ');
} else {
return Redirect::back()->withInput($request->except('password'))->with('fails', Lang::get('lang.failed-to-create-user-tcket-as-mobile-has-been-taken'));
}
} catch (\Exception $ex) {
return redirect()->back()->with('fails', $ex->getMessage());
}
// dd($result);
// dd($result);
}
/**
@@ -276,7 +278,7 @@ class FormController extends Controller
$tickets = Tickets::where('id', '=', $id)->first();
$thread = Ticket_Thread::where('ticket_id', '=', $tickets->id)->first();
$subject = $thread->title.'[#'.$tickets->ticket_number.']';
$subject = $thread->title . '[#' . $tickets->ticket_number . ']';
$body = $comment;
$user_cred = User::where('id', '=', $tickets->user_id)->first();