CrestRoad/laravel/app/Http/Controllers/MsgtemplateController.php

52 lines
2.5 KiB
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests\LambdaRequest;
use App\Models\MessageTemplate;
use DB;
class MsgtemplateController extends LocalController
{
public function __construct()
{
$this->middleware('auth');
$this->_service = 'mag';
$this->_module = 'magazine';
$this->_viewname = 'msgtemplate';
$this->_title = 'Message Templates';
$this->_base_url = '/msgtemplate';
$this->_basemodel = new MessageTemplate;
}
protected function get_list_buttons() {
return [ ['title' => 'Add New', 'link' => $this->_base_url.'/addnew' ] ];
}
protected function get_list_fields(){
return [
'actions' => ['title' => 'Actions', 'buttons' => [ 'edit', 'delete' ] ],
'type' => ['title' => 'Session Type', 'type' => 'text'],
'title' => ['title' => 'Title', 'type' => 'text'],
'status' => ['title' => 'Status', 'type' => 'select'],
];
}
protected function get_form_fields($type, $values){
$fields = [
'type' => ['title' => 'Session Type', 'type' => 'select', 'values' => ['any' => 'Any Type', 'road' => 'Road', 'casper' => 'Casper', 'casper_clinic' => 'Casper Clinic', 'APFT' => 'APFT', 'spirometry_simplified' => 'Spirometry Simplified'], 'required' => true],
'title' => ['title' => 'Title', 'type' => 'text', 'required' => true ],
'template_code' => ['title' => 'Template Code', 'type' => 'text', 'required' => true ],
'template_body' => ['title' => 'Template Body', 'type' => 'textarea', 'required' => true, 'fullwidth' => true],
'header_params' => ['title' => 'Header Params', 'type' => 'textarea', 'fullwidth' => true],
'body_params' => ['title' => 'Body Params', 'type' => 'textarea', 'fullwidth' => true],
'button_params' => ['title' => 'Button Params (WhatsApp)', 'type' => 'textarea', 'fullwidth' => true],
'button_url' => ['title' => 'Button URL (Email)', 'type' => 'text', 'fullwidth' => true, 'placeholder' => 'road.xltr.in/brochure/{{1}} or {{SESSION_CODE}}'],
'button_label' => ['title' => 'Button Label (Email)', 'type' => 'text', 'fullwidth' => true, 'placeholder' => 'Complete feedback'],
'status' => ['title' => 'Status', 'type' => 'select', 'required' => true, 'values' => ['active' => 'Active', 'disabled' => 'Disabled'] ],
];
return $fields;
}
}