Skip to content

Commit

Permalink
Mail to InfraTeam
Browse files Browse the repository at this point in the history
  • Loading branch information
Akshiteshnaithani committed Jul 10, 2023
1 parent 42ae6ef commit 362a6c3
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 5 deletions.
37 changes: 37 additions & 0 deletions Modules/HR/Emails/NewJoinerEmailForInfraTeam.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace Modules\HR\Emails;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class NewJoinerEmailForInfraTeam extends Mailable
{
use Queueable, SerializesModels;

public $data;

/**
* Create a new message instance.
*
* @return void
*/
public function __construct($data)
{
$this->data = $data;
}

/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->from(config('mail.from.address'), config('mail.from.name'))
->subject('Subject: Request for Email Creation ' .$this->data[1])
->to('[email protected]')
->view('hr::mail.infra-team');
}
}
17 changes: 14 additions & 3 deletions Modules/HR/Http/Controllers/EmployeeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@
namespace Modules\HR\Http\Controllers;

use App\Services\EmployeeService;
use Google_Client;
use Google_Service_Sheets;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Mail;
use Modules\HR\Emails\NewJoinerEmailForInfraTeam;
use Modules\HR\Entities\Assessment;
use Modules\HR\Entities\Employee;
use Modules\HR\Entities\HrJobDesignation;
use Modules\HR\Entities\HrJobDomain;
use Modules\HR\Entities\IndividualAssessment;
use Modules\HR\Entities\Job;
use Modules\Project\Entities\ProjectTeamMember;
use Google_Client;
use Google_Service_Sheets;
use Modules\User\Entities\User;

class EmployeeController extends Controller
Expand Down Expand Up @@ -151,7 +153,7 @@ public function updateEmployeeReviewers(Request $request, Employee $employee)
public function showApprovalForm()
{
$client = new Google_Client();
$client->setAuthConfig('E:\Downloads\ninth-nebula-392106-8478ffdda8b1.json');
$client->setAuthConfig('C:\xampp\htdocs\portal\ninth-nebula-392106-8478ffdda8b1.json');
$client->addScope(Google_Service_Sheets::SPREADSHEETS_READONLY);

$service = new Google_Service_Sheets($client);
Expand All @@ -173,4 +175,13 @@ public function processApprovalForm(Request $request)

return redirect()->back()->with('success', 'Users added successfully');
}

public function sendMailToInfraTeam(Request $request)
{
$data = $request->input('data');

Mail::send(new NewJoinerEmailForInfraTeam($data));

return redirect()->back()->with('success', 'Mail sent successfully');
}
}
18 changes: 18 additions & 0 deletions Modules/HR/Resources/views/mail/infra-team.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div>
<style>
.line {
line-height: 1px;
}
</style>
<p>Dear Infrasupport Team,</p>
<p>I hope this email finds you well. I am writing to request the creation of an email account for a new employee
{{ $data[1] }} in our organization.
</p>
<p>If there are any specific forms or documentation required for this process, kindly let me know, and I will
promptly provide the necessary information.</p>
<br>
<p>Thank you for your prompt attention to this matter. Your assistance is greatly appreciated.
Best regards,</p>
<p class="line">Best regards,</p>
<p class="line mt-4">Mohit Sharma</p>
</div>
2 changes: 2 additions & 0 deletions Modules/HR/Routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@
Route::post('/update-reviewers/{employee}', 'EmployeeController@updateEmployeeReviewers')->name('update.employee.reviewers');
Route::get('/approve-joinees', 'EmployeeController@showApprovalForm')->name('approve.joinees.show');
Route::post('/approve-joinees', 'EmployeeController@processApprovalForm')->name('approve.joinees');
Route::GET('/infra-mail', 'EmployeeController@sendMailToInfraTeam')->name('infra.mail');


Route::resource('requisition', 'RequisitionController')
->only(['index', 'show', 'store'])
Expand Down
13 changes: 13 additions & 0 deletions ninth-nebula-392106-8478ffdda8b1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"type": "service_account",
"project_id": "ninth-nebula-392106",
"private_key_id": "8478ffdda8b1e31385449eefb87eefdba915e1c1",
"private_key": "-----BEGIN PRIVATE KEY-----\nMII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1pJMizmzCEUy/B2FouuqvR+ES3pdTcF4oGLuzEQFA66VYrSNXC8Uva8/TS0\nsA8FZ7Pm4QKBgQD0kxMdIwHAUYUisNHR01hQiU21hQfX7QBw+NvdzV4pHlZbHGJ3\n/hGc4+WNp0F2CIEZhrHyrGoJ2VLpJ7F9Ngj2IDRAcvNAkKfDbu89hWTym7eMBYGF\nT/u+K20ZJhh6q6xUw89aKlMMt44ZVFOYhh/0LGy3QuSPIipUXEMB3TyOqQKBgAq/\na+HgV1NOw+fwBX4YfwRCUI4+aZPC2OpsTph675aYbb1dw+XngvsOJ+MSqqgCoKwW\nS2F23eyQ8M+lBIYK78ZIAzgJQyBdzBeML6c5ftaWUhYNTohlXhbbVmDOhQxElaT1\nKNEaPNnZ1X6KPzCQrRPyttGLC5iRnosG5z8mgUBBAoGBAOlLBlLcR2aOuCEo82cj\nqeMYRESNIKuvOQKO8ebfYimsWgqCyZTSZIvnClNj/vUp+BokALXPWT0rHYyT0t8f\nAWl/MRr25ryc5NjEl/7iPMmNI9jPcYk0t4JkMsF0CTxEJLo79Hvmmybi0LkCpOH8\nCBoowuuovBTwVh0mEOwN8aGt\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]",
"client_id": "111979648204663340683",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/google-sheets-api%40ninth-nebula-392106.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}
11 changes: 9 additions & 2 deletions resources/views/hr/employees/approve-joinees.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@
<tr>
<td>{{ $row[1] }}</td>
<td>{{ $row[0] }}</td>
<td> <a href="">Send email</a> </td>
<td> <input type="text" id="email" name="email" class="save email" placeholder="email" required>
<td>
<form method="GET" action="{{ route('infra.mail') }}">
@csrf
<input type="hidden" name="data[0]" value="{{ $row[0] }}">
<input type="hidden" name="data[1]" value="{{ $row[1] }}">
<button type="submit"class="btn btn-transparent text-primary">Send email</button>
</form>
</td>
<td> <input type="text" id="email" name="email" class="save email" placeholder="email">
</td>
<td>
<input type="hidden" name="timestamp[]" value="{{ $row[0] }}">
Expand Down

0 comments on commit 362a6c3

Please sign in to comment.