change sms
This commit is contained in:
parent
495f920326
commit
efd3c419c0
@ -99,5 +99,5 @@ use CodeIgniter\Router\RouteCollection;
|
||||
|
||||
|
||||
$routes->get('sendSms','TestController::sendSms');
|
||||
$routes->get('protected-page', 'TestController::protectedPage', ['filter' => 'signedUrl']);
|
||||
$routes->get('preview', 'TestController::protectedPage', ['filter' => 'signedUrl']);
|
||||
$routes->get('sendUrl', 'TestController::sendUrl');
|
||||
@ -1,16 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Helpers\MailHelper;
|
||||
use App\Models\ServiceModel;
|
||||
use App\Models\TemplateModel;
|
||||
use App\Models\StaffModel;
|
||||
use App\Models\ClientDocsModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\BusinessModel;
|
||||
use App\Models\BranchModel;
|
||||
use App\Models\ServiceGroupModel;
|
||||
use App\Models\ClientBranchModel;
|
||||
use App\Models\DocsStatusModel;
|
||||
use CodeIgniter\Controller;
|
||||
|
||||
class TestController extends Controller
|
||||
{
|
||||
|
||||
protected $ServiceModel;
|
||||
protected $TemplateModel;
|
||||
protected $StaffModel;
|
||||
protected $ClientDocsModel;
|
||||
protected $ClientModel;
|
||||
protected $BusinessModel;
|
||||
protected $BranchModel;
|
||||
protected $ServiceGroupModel;
|
||||
protected $ClientBranchModel;
|
||||
protected $DocsStatusModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->ServiceModel = new ServiceModel();
|
||||
$this->TemplateModel = new TemplateModel();
|
||||
$this->StaffModel = new StaffModel();
|
||||
$this->ClientDocsModel = new ClientDocsModel();
|
||||
$this->ClientModel = new ClientModel();
|
||||
$this->BusinessModel = new BusinessModel();
|
||||
$this->BranchModel = new BranchModel();
|
||||
$this->ServiceGroupModel = new ServiceGroupModel();
|
||||
$this->ClientBranchModel = new ClientBranchModel();
|
||||
$this->DocsStatusModel = new DocsStatusModel();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function sendSms()
|
||||
{
|
||||
$apiKey = 'HgvlULWCIrs'; // Your API key
|
||||
$mobileNumbers = '9894638731'; // Recipient mobile numbers
|
||||
$DLTTemplateID = '1107171922342349877'; // DLT Template ID
|
||||
$mobileNumbers = '919894638731'; // Recipient mobile numbers
|
||||
$DLTTemplateID = '1105171896608602869'; // DLT Template ID
|
||||
$senderId = 'LDRAJ'; // Sender ID
|
||||
$message = 'Dear Gowtham, 986532 is OTP to approve Service group for service name purposes.';
|
||||
$serviceName = 'TEMPLATE_BASED'; // Service name
|
||||
@ -38,12 +79,92 @@ class TestController extends Controller
|
||||
public function sendUrl()
|
||||
{
|
||||
helper('url');
|
||||
$signedUrl = generate_signed_url('protected-page', [], 36000);
|
||||
$signedUrl = generate_signed_url('preview', ['doc_id'=>md5(7)], 60);
|
||||
// Send the $signedUrl to your client (e.g., via email)
|
||||
|
||||
return $this->response->setJSON(['url' => $signedUrl]);
|
||||
}
|
||||
|
||||
public function protectedPage(){
|
||||
echo "This is protectedPage";
|
||||
$doc_id = $this->request->getVar('doc_id');
|
||||
$data['docData'] = $this->ClientDocsModel->docPreview($doc_id);
|
||||
|
||||
$data['clientData'] = $this->ClientBranchModel->select('client.name , client.pan_no ,client_branch.gst_no , client_branch.mobile_no , client_branch.email , client_branch.address , client_branch.country , client_branch.state , client_branch.city , client_branch.pin_code ')
|
||||
->join('client', 'client_branch.client_id = client.client_id', 'left')
|
||||
->where('client_branch.id',$data['docData']->client_branch_id)
|
||||
->get()->getRow();
|
||||
|
||||
|
||||
|
||||
|
||||
$data['header_html'] = $data['docData']->header_html;
|
||||
$data['footer_html'] = $data['docData']->footer_html;
|
||||
$data['body_html'] = $data['docData']->body_html;
|
||||
//replace client details in template content
|
||||
foreach ($data['clientData'] as $key => $value) {
|
||||
$placeHolder = '%'.$key.'%';
|
||||
$data['body_html'] = str_replace($placeHolder,$value,$data['body_html']);
|
||||
}
|
||||
|
||||
if($data['docData']->is_active == 1){
|
||||
$DateAndYears = $data['docData']->place_holder_object;
|
||||
}else{
|
||||
$DateAndYears = $this->dateAndYearPlaceholder();
|
||||
}
|
||||
//replace Date and Year values in template content
|
||||
foreach (json_decode($DateAndYears,true) as $key => $value) {
|
||||
$placeHolder = '%'.$key.'%';
|
||||
$data['body_html'] = str_replace($placeHolder,$value,$data['body_html']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
echo view('client_docs_preview',$data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function dateAndYearPlaceholder()
|
||||
{
|
||||
$currentDate = date('d-m-Y');
|
||||
$currentYear = date('Y');
|
||||
$currentMonth = date('m');
|
||||
|
||||
|
||||
if ($currentMonth >= 4) {
|
||||
$financialYearStart = $currentYear . '-04-01';
|
||||
$financialYearEnd = ($currentYear + 1) . '-03-31';
|
||||
$financialYear = $currentYear . '-' . ($currentYear + 1);
|
||||
$assessmentYear = ($currentYear + 1) . '-' . ($currentYear + 2);
|
||||
$q1 = '01-04-' . $currentYear . ' to ' . '30-06-' . $currentYear;
|
||||
$q2 = '01-07-' . $currentYear . ' to ' . '30-09-' . $currentYear;
|
||||
$q3 = '01-10-' . $currentYear . ' to ' . '31-12-' . $currentYear;
|
||||
$q4 = '01-01-' . ($currentYear + 1) . ' to ' . '31-03-' . ($currentYear + 1);
|
||||
|
||||
} else {
|
||||
$financialYearStart = ($currentYear - 1) . '-04-01';
|
||||
$financialYearEnd = $currentYear . '-03-31';
|
||||
$financialYear = ($currentYear - 1) . '-' . $currentYear;
|
||||
$assessmentYear = $currentYear . '-' . ($currentYear + 1);
|
||||
$q1 = '01-04-' . ($currentYear - 1) . ' to ' . '30-06-' . ($currentYear - 1);
|
||||
$q2 = '01-07-' . ($currentYear - 1) . ' to ' . '30-09-' . ($currentYear - 1);
|
||||
$q3 = '01-10-' . ($currentYear - 1) . ' to ' . '31-12-' . ($currentYear - 1);
|
||||
$q4 = '01-01-' . $currentYear . ' to ' . '31-03-' . $currentYear;
|
||||
}
|
||||
|
||||
$DateAndYears = [
|
||||
"CD" => $currentDate,
|
||||
"CY" => $currentYear,
|
||||
"FY" => $financialYear,
|
||||
"AY" => $assessmentYear,
|
||||
"Q1" => $q1,
|
||||
"Q2" => $q2,
|
||||
"Q3" => $q3,
|
||||
"Q4" => $q4,
|
||||
];
|
||||
|
||||
return json_encode($DateAndYears);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ class ClientDocsModel extends Model
|
||||
$this->join('template', 'template.template_id = client_docs.template_id','left');
|
||||
$this->join('services', 'services.service_id = template.service_id','left');
|
||||
$this->join('business', 'business.business_id = template.template_header_business','left');
|
||||
$this->where('client_docs.id', $doc_id);
|
||||
$this->where('md5(client_docs.id)', $doc_id);
|
||||
|
||||
return $this->get()->getRow();
|
||||
|
||||
|
||||
BIN
public/assets/images/dox2apprv-fav.png
Normal file
BIN
public/assets/images/dox2apprv-fav.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
Loading…
Reference in New Issue
Block a user