=Certificate Changes

This commit is contained in:
Ravi Gulhane 2026-06-11 16:23:04 +05:30
parent 00eddaa10e
commit f02b3ed81c
4 changed files with 44 additions and 17 deletions

View File

@ -71,7 +71,7 @@ class AnalyticController extends LocalController
$exceldata = [];
$exceldata[] = $fields;
foreach($response->data->items as $item) {
$item = [$item->name,$item->email,$item->phone,isset($item->date_of_birth)?$item->date_of_birth:'-',isset($item->gender)?$item->gender:'-',$item->alternate_phone,$item->city,$item->state,$item->highlight_qualification,$item->specialization,$item->type_of_setup,$item->designation,$item->clinic_institute_name,isset($item->present) && $item->present == 'yes' ? 'Present':'Absent'];
$item = [$item->name ?? '',$item->email ?? '',$item->phone ?? '',$item->date_of_birth ?? '-',$item->gender ?? '-',$item->alternate_phone ?? '',$item->city ?? '',$item->state ?? '',$item->highlight_qualification ?? '',$item->specialization ?? '',is_array($item->type_of_setup ?? null) ? implode(', ', $item->type_of_setup) : ($item->type_of_setup ?? ''),$item->designation ?? '',$item->clinic_institute_name ?? '',isset($item->present) && $item->present == 'yes' ? 'Present':'Absent'];
$exceldata[] = $item;
}
return Excel::download(new InvoicesExport($exceldata), 'report.xlsx');

View File

@ -159,6 +159,24 @@ class SessionController extends LocalController
return Response::download($folder.'/'.$filename, 'certificate.png',$headers);
}
public function certificatepreview(Request $request) {
$type = $request->input('type', 'casper_plus');
$session = (object) [
'type' => $type,
'code' => 'preview',
'start_date' => $request->input('date', date('Y-m-d')),
];
$doctor = (object) [
'name' => $request->input('name', 'Sample Doctor Name'),
'id' => 'preview-' . time(),
];
$output = Creation::certificate($session, $doctor);
return response()->file($output['folder'] . '/' . $output['filename'], [
'Content-Type' => 'image/png',
]);
}
public function agenda(Request $request) {
$id = $request->input('id', 0);
if($id === 0) {

View File

@ -39,9 +39,18 @@ class Creation
}
if($session->type == 'casper_plus'){
$font = storage_path('app').'/fonts/pala.ttf';
$white = imagecolorallocate($outputImage, 0, 0, 0);
imagettftext($outputImage, 30, 0, 590, 514, $white, $font, $doctor->name );
imagettftext($outputImage, 30, 0, 988, 684, $white, $font, date("d M Y", strtotime($session->start_date)) );
$color = imagecolorallocate($outputImage, 0, 0, 0);
$nameSize = 30;
$dateSize = 30;
$nameX = 590;
$nameY = 514;
$dateX = 988;
$dateY = 684;
$certificateDate = !empty($session->start_date)
? date('d M Y', strtotime($session->start_date))
: date('d M Y');
imagettftext($outputImage, $nameSize, 0, $nameX, $nameY, $color, $font, $doctor->name);
imagettftext($outputImage, $dateSize, 0, $dateX, $dateY, $color, $font, $certificateDate);
}
if($session->type == 'APFT'){
$font = storage_path('app').'/fonts/pala.ttf';

View File

@ -60,19 +60,19 @@
<tbody>
@foreach($doctors as $item)
<tr>
<td>{{$item->name}}</td>
<td>{{$item->email}}</td>
<td>{{$item->phone}}</td>
<td>{{isset($item->date_of_birth)?$item->date_of_birth:''}}</td>
<td>{{isset($item->gender)?$item->gender:''}}</td>
<td>{{$item->alternate_phone}}</td>
<td>{{$item->city}}</td>
<td>{{$item->state}}</td>
<td>{{$item->highlight_qualification}}</td>
<td>{{$item->specialization}}</td>
<td>{{ is_array($item->type_of_setup) ? implode(', ', $item->type_of_setup) : $item->type_of_setup }}</td>
<td>{{$item->designation}}</td>
<td>{{$item->clinic_institute_name}}</td>
<td>{{ $item->name ?? '' }}</td>
<td>{{ $item->email ?? '' }}</td>
<td>{{ $item->phone ?? '' }}</td>
<td>{{ $item->date_of_birth ?? '' }}</td>
<td>{{ $item->gender ?? '' }}</td>
<td>{{ $item->alternate_phone ?? '' }}</td>
<td>{{ $item->city ?? '' }}</td>
<td>{{ $item->state ?? '' }}</td>
<td>{{ $item->highlight_qualification ?? '' }}</td>
<td>{{ $item->specialization ?? '' }}</td>
<td>{{ is_array($item->type_of_setup ?? null) ? implode(', ', $item->type_of_setup) : ($item->type_of_setup ?? '') }}</td>
<td>{{ $item->designation ?? '' }}</td>
<td>{{ $item->clinic_institute_name ?? '' }}</td>
<td>{{isset($item->present) && $item->present == 'yes' ? 'Present':'Absent'}}</td>
<td>{{isset($item->feedback) && $item->feedback == 'yes' ? 'Yes':'-'}}</td>
<td>{!!isset($item->present) && $item->present == 'yes' && isset($item->feedback) && $item->feedback == 'yes' ? '<a href="/session/certificate?code='.$session->code.'&doctor='.$item->id.'">Download</a>':''!!}</td>