Merge branch 'main' of bitbucket.org:venbainformationtechnology/bb_sign
This commit is contained in:
commit
7497d8e72a
@ -6,6 +6,8 @@ use CodeIgniter\Router\RouteCollection;
|
||||
* @var RouteCollection $routes
|
||||
*/
|
||||
|
||||
$routes->get('/set_business_in_session/(:any)','StaffController::set_business_in_session/$1');
|
||||
|
||||
// $routes->get('/home','Home::index');
|
||||
// $routes->post('/upload_1','Home::upload_1');
|
||||
|
||||
@ -25,6 +27,7 @@ use CodeIgniter\Router\RouteCollection;
|
||||
$routes->match(['get','post'],'/change_password','StaffController::change_password');
|
||||
$routes->post('status_staff','StaffController::status_staff');
|
||||
$routes->post('staff_password_update','StaffController::staff_password_update');
|
||||
$routes->get('business_view/(:any)','StaffController::business_view/$1');
|
||||
|
||||
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ namespace App\Controllers;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\ClientBranchModel;
|
||||
use App\Models\BranchModel;
|
||||
use App\Models\BusinessModel;
|
||||
use App\Models\StaffModel;
|
||||
use App\Models\ClientDocsModel;
|
||||
|
||||
@ -24,6 +25,7 @@ class ClientController extends BaseController
|
||||
protected $ClientModel;
|
||||
protected $ClientBranchModel;
|
||||
protected $BranchModel;
|
||||
protected $BusinessModel;
|
||||
protected $StaffModel;
|
||||
protected $ClientDocsModel;
|
||||
protected $DocsStatusModel;
|
||||
@ -36,6 +38,7 @@ class ClientController extends BaseController
|
||||
$this->ClientModel = new ClientModel();
|
||||
$this->ClientBranchModel = new ClientBranchModel();
|
||||
$this->BranchModel = new BranchModel();
|
||||
$this->BusinessModel = new BusinessModel();
|
||||
$this->StaffModel = new StaffModel();
|
||||
$this->ClientDocsModel = new ClientDocsModel();
|
||||
$this->DocsStatusModel = new DocsStatusModel();
|
||||
@ -318,6 +321,12 @@ class ClientController extends BaseController
|
||||
// echo"<pre>";
|
||||
// print_r($data);die;
|
||||
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
|
||||
foreach (json_decode($staffdata->business_id) as $key => $value) {
|
||||
$business = $this->BusinessModel->where('business_id', $value)->first();
|
||||
if ($business) {
|
||||
$data['business_list'][] = $business;
|
||||
}
|
||||
}
|
||||
echo view('layout/header', ['Data'=>$staffdata]);
|
||||
// echo view('layout/header');
|
||||
echo view('client_branch_list',$data);
|
||||
@ -334,7 +343,7 @@ class ClientController extends BaseController
|
||||
return json_encode(false);
|
||||
}else{
|
||||
$data = $this->request->getPost();
|
||||
|
||||
// print_r($data);die;
|
||||
$this->ClientBranchModel->insert($data);
|
||||
return json_encode(true);
|
||||
}
|
||||
|
||||
@ -22,6 +22,8 @@ use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
class MasterController extends BaseController
|
||||
{
|
||||
protected $db;
|
||||
|
||||
public $session;
|
||||
protected $ServiceModel;
|
||||
protected $TemplateModel;
|
||||
@ -52,6 +54,8 @@ class MasterController extends BaseController
|
||||
$this->ClientBranchModel = new ClientBranchModel();
|
||||
$this->DocsStatusModel = new DocsStatusModel();
|
||||
|
||||
$this->db = \Config\Database::connect();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -63,10 +67,10 @@ class MasterController extends BaseController
|
||||
|
||||
$data['serviceGroupList'] = $this->ServiceGroupModel->select('service_group.* , COUNT(services.service_id) as service_count')
|
||||
->join('services', 'service_group.service_group_id = services.service_group_id', 'left')
|
||||
->where('service_group.business_id',$this->session->get('logged_in_staff_business_id'))
|
||||
// ->where('service_group.business_id',$this->session->get('logged_in_staff_business_id'))
|
||||
->groupBy('service_group.service_group_id')
|
||||
->findAll();
|
||||
|
||||
$data['business_list'] = $this->BusinessModel->findAll();
|
||||
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
|
||||
echo view('layout/header', ['Data'=>$staffdata]);
|
||||
echo view('service_group_list',$data);
|
||||
@ -75,19 +79,22 @@ class MasterController extends BaseController
|
||||
}
|
||||
|
||||
public function service_group_create()
|
||||
|
||||
{
|
||||
if(!$this->session->has('is_staff_logged_in')){ return redirect()->to(base_url().'staff'); }
|
||||
|
||||
if($this->request->getmethod() == 'POST')
|
||||
{
|
||||
|
||||
$serviceGroupData = $this->request->getVar();
|
||||
if( isset($serviceGroupData['service_group_id']) ){
|
||||
|
||||
$serviceGroupData['business_id'] = json_encode($serviceGroupData['business']);
|
||||
$this->ServiceGroupModel->where('service_group_id', $this->request->getVar('service_group_id') )->set($serviceGroupData)->update();
|
||||
|
||||
}else{
|
||||
$serviceGroupData = $this->request->getVar();
|
||||
$serviceGroupData['business_id'] = $this->session->get('logged_in_staff_business_id');
|
||||
$serviceGroupData['business_id'] = json_encode($this->request->getPost('business'));
|
||||
// $serviceGroupData['business_id'] = $this->session->get('logged_in_staff_business_id');
|
||||
$serviceGroupData['branch_id'] = $this->session->get('logged_in_staff_branch_id');
|
||||
|
||||
$this->ServiceGroupModel->insert($serviceGroupData);
|
||||
@ -120,12 +127,18 @@ class MasterController extends BaseController
|
||||
$data['serviceList'] = $this->ServiceModel->select('services.* , service_group.group_name ,COUNT(template.template_id) as template_count')
|
||||
->join('template', 'services.service_id = template.service_id', 'left')
|
||||
->join('service_group', 'services.service_group_id = service_group.service_group_id', 'left')
|
||||
->where('services.branch_id',$this->session->get('logged_in_staff_branch_id'))
|
||||
// ->where('services.branch_id',$this->session->get('logged_in_staff_branch_id'))
|
||||
->groupBy('services.service_id')
|
||||
->orderBy('services.service_group_id')
|
||||
->findAll();
|
||||
$data['serviceGroupData'] = $this->ServiceGroupModel->where('is_active',1)->findall();
|
||||
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
|
||||
foreach (json_decode($staffdata->business_id) as $key => $value) {
|
||||
$business = $this->BusinessModel->where('business_id', $value)->first();
|
||||
if ($business) {
|
||||
$data['business_list'][] = $business;
|
||||
}
|
||||
}
|
||||
echo view('layout/header', ['Data'=>$staffdata]);
|
||||
echo view('service_list',$data);
|
||||
echo view('layout/footer');
|
||||
@ -191,6 +204,12 @@ class MasterController extends BaseController
|
||||
|
||||
|
||||
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
|
||||
foreach (json_decode($staffdata->business_id) as $key => $value) {
|
||||
$business = $this->BusinessModel->where('business_id', $value)->first();
|
||||
if ($business) {
|
||||
$data['business_list'][] = $business;
|
||||
}
|
||||
}
|
||||
echo view('layout/header', ['Data'=>$staffdata]);
|
||||
echo view('template_list',$data);
|
||||
echo view('layout/footer');
|
||||
@ -225,6 +244,12 @@ class MasterController extends BaseController
|
||||
$data['AllBusinessData'] = $this->BusinessModel->where('isactive',1)->findAll();
|
||||
|
||||
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
|
||||
foreach (json_decode($staffdata->business_id) as $key => $value) {
|
||||
$business = $this->BusinessModel->where('business_id', $value)->first();
|
||||
if ($business) {
|
||||
$data['business_list'][] = $business;
|
||||
}
|
||||
}
|
||||
echo view('layout/header', ['Data'=>$staffdata]);
|
||||
echo view('template_form',$data);
|
||||
echo view('layout/footer');
|
||||
@ -273,30 +298,109 @@ class MasterController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function shared_docs_list()
|
||||
{
|
||||
|
||||
if(!$this->session->has('is_staff_logged_in')){ return redirect()->to(base_url().'staff'); }
|
||||
|
||||
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
|
||||
if($this->session->get('logged_in_staff_role') == 'Admin'){
|
||||
$data['doc_list'] = $this->ClientDocsModel->select('client_docs.* , services.service_name , service_group.group_name , client_branch.name as client_branch_name , client.name as client_name')
|
||||
->join('template', 'template.template_id = client_docs.template_id', 'left')
|
||||
->join('services', 'services.service_id = template.service_id', 'left')
|
||||
->join('service_group', 'service_group.service_group_id = template.service_group_id', 'left')
|
||||
->join('client_branch', 'client_branch.id = client_docs.client_branch_id', 'left')
|
||||
->join('client', 'client.client_id = client_branch.client_id', 'left')
|
||||
->orderBy('client_docs.id','DESC')
|
||||
->findAll();
|
||||
|
||||
|
||||
$data['doc_list'] = $this->ClientDocsModel->select('client_docs.* , services.service_name , service_group.group_name , client_branch.name as client_branch_name , client.name as client_name')
|
||||
|
||||
// print_r($data['doc_list']);die;
|
||||
$data['clientdata'] = $this->ClientBranchModel->select('client.name as client_name , client_branch.name as client_branch_name , client_branch.id as client_branch_id')
|
||||
->join('client', 'client_branch.client_id = client.client_id', 'left')
|
||||
// ->where('client.business_id',$this->session->get('logged_in_staff_business_id'))
|
||||
->findAll();
|
||||
$data['serviceGroupData'] = $this->ServiceGroupModel->findAll();
|
||||
|
||||
}else{
|
||||
$business_id = $this->session->get('logged_in_staff_business_id');
|
||||
// print_r($business_id);die;
|
||||
$data['doc_list'] = $this->ClientDocsModel->select('client_docs.*,
|
||||
services.service_name,
|
||||
service_group.group_name,
|
||||
client_branch.name as client_branch_name,
|
||||
client.name as client_name, service_group.business_id')
|
||||
->join('template', 'template.template_id = client_docs.template_id', 'left')
|
||||
->join('services', 'services.service_id = template.service_id', 'left')
|
||||
->join('service_group', 'service_group.service_group_id = template.service_group_id', 'left')
|
||||
->join('client_branch', 'client_branch.id = client_docs.client_branch_id', 'left')
|
||||
->join('client', 'client.client_id = client_branch.client_id', 'left')
|
||||
->orderBy('client_docs.id','DESC')
|
||||
->findAll();
|
||||
|
||||
$data['clientdata'] = $this->ClientBranchModel->select('client.name as client_name , client_branch.name as client_branch_name , client_branch.id as client_branch_id')
|
||||
->join('client', 'client_branch.client_id = client.client_id', 'left')
|
||||
// ->where('client.business_id',$this->session->get('logged_in_staff_business_id'))
|
||||
->findAll();
|
||||
$data['serviceGroupData'] = $this->ServiceGroupModel->findAll();
|
||||
|
||||
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
|
||||
// echo "<pre>";
|
||||
// print_r($data['doc_list']);die;
|
||||
->join('client', 'client.client_id = client_branch.client_id ' , 'left')
|
||||
// ->where('client.business_id', $business_id)
|
||||
// ->where('service_group.business_id', $business_id )
|
||||
// ->where("JSON_CONTAINS(service_group.business_id, '" . $business_id . "')")
|
||||
->orderBy('client_docs.id', 'DESC')
|
||||
->get()
|
||||
->getResultArray();
|
||||
$business_id_check = 0;
|
||||
// echo "<pre>";
|
||||
// print_r($data['doc_list']);die;
|
||||
|
||||
foreach ($data['doc_list'] as $index => $value) {
|
||||
foreach (json_decode($value['business_id']) as $key => $values) {
|
||||
if($values == $business_id){
|
||||
$business_id_check = $business_id;
|
||||
}
|
||||
}
|
||||
if($business_id_check != 0){
|
||||
// print_r($value);die;
|
||||
$data['doc_list'][$index] =$value;
|
||||
}else{
|
||||
unset($data['doc_list'][$index]); // Remove the element completely
|
||||
}
|
||||
$business_id_check = 0;
|
||||
|
||||
}
|
||||
|
||||
// echo "<pre>";
|
||||
// print_r($data['doc_list']);die;
|
||||
$docStatusByClientId = [];
|
||||
|
||||
|
||||
// Fetch all doc_status entries and group them by client_docs_id
|
||||
foreach ($data['doc_list'] as $doc) {
|
||||
// print_r($doc['id']);die;
|
||||
$doc_id_temp = $doc['id'];
|
||||
$docStatusByClientId[$doc_id_temp] = $this->db->table('docs_status')
|
||||
->where('client_docs_id', $doc_id_temp)
|
||||
->where('status', "Approved")
|
||||
->get()
|
||||
->getResultArray();
|
||||
}
|
||||
// Assign doc_status arrays to each document in doc_list
|
||||
foreach ($data['doc_list'] as &$doc) {
|
||||
$doc['doc_status'] = isset($docStatusByClientId[$doc['id']]) ? $docStatusByClientId[$doc['id']] : [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
$data['clientdata'] = $this->ClientBranchModel->select('client.name as client_name , client_branch.name as client_branch_name , client_branch.id as client_branch_id')
|
||||
->join('client', 'client_branch.client_id = client.client_id', 'left')
|
||||
// ->where('client.business_id',$this->session->get('logged_in_staff_business_id'))
|
||||
->findAll();
|
||||
$data['serviceGroupData'] = $this->ServiceGroupModel->findAll();
|
||||
|
||||
|
||||
}
|
||||
$data['business_list'] = [];
|
||||
foreach (json_decode($staffdata->business_id) as $key => $value) {
|
||||
$business = $this->BusinessModel->where('business_id', $value)->first();
|
||||
if ($business) {
|
||||
$data['business_list'][] = $business;
|
||||
}
|
||||
}
|
||||
// echo"<pre>";
|
||||
// print_r($data);die;
|
||||
echo view('layout/header', ['Data'=>$staffdata]);
|
||||
echo view('share_docs',$data);
|
||||
echo view('layout/footer');
|
||||
@ -352,6 +456,7 @@ class MasterController extends BaseController
|
||||
{
|
||||
|
||||
$docData = $this->request->getVar();
|
||||
$docData['is_active'] = 1;
|
||||
$docData['created_by'] = $this->session->has('is_staff_logged_in');
|
||||
$docData['body_html'] = $this->TemplateModel->where('template_id',$this->request->getVar('template_id'))->get()->getRow()->body_html;
|
||||
$insert = $this->ClientDocsModel->insert($docData);
|
||||
|
||||
@ -4,6 +4,7 @@ namespace App\Controllers;
|
||||
use App\Helpers\MailHelper;
|
||||
use App\Models\StaffModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\ClientBranchModel;
|
||||
use App\Models\ServiceModel;
|
||||
use App\Models\BusinessModel;
|
||||
use App\Models\BranchModel;
|
||||
@ -17,6 +18,7 @@ class StaffController extends BaseController
|
||||
public $session;
|
||||
protected $StaffModel;
|
||||
protected $ClientModel;
|
||||
protected $ClientBranchModel;
|
||||
protected $ServiceModel;
|
||||
|
||||
protected $BusinessModel;
|
||||
@ -30,6 +32,7 @@ class StaffController extends BaseController
|
||||
$this->session = session();
|
||||
$this->StaffModel = new StaffModel();
|
||||
$this->ClientModel = new ClientModel();
|
||||
$this->ClientBranchModel = new ClientBranchModel();
|
||||
$this->ServiceModel = new ServiceModel();
|
||||
$this->BusinessModel = new BusinessModel();
|
||||
$this->BranchModel = new BranchModel();
|
||||
@ -37,7 +40,11 @@ class StaffController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
public function set_business_in_session($business_id){
|
||||
$this->session->set('logged_in_staff_business_id', $business_id);
|
||||
|
||||
return json_encode(true);
|
||||
}
|
||||
|
||||
public function login()
|
||||
{
|
||||
@ -49,7 +56,6 @@ class StaffController extends BaseController
|
||||
$email = $this->request->getVar('email');
|
||||
$password = $this->request->getVar('password');
|
||||
$staffdata = $this->StaffModel->verifyEmail($email);
|
||||
|
||||
if($staffdata)
|
||||
{
|
||||
if($staffdata['is_active'] == 0)
|
||||
@ -63,8 +69,14 @@ class StaffController extends BaseController
|
||||
$this->session->set('is_staff_logged_in',$staffdata['staff_id']);
|
||||
$this->session->set('logged_in_staff_role',$staffdata['role']);
|
||||
$this->session->set('logged_in_staff_name',$staffdata['name']);
|
||||
$this->session->set('logged_in_staff_branch_id',$staffdata['branch_id']);
|
||||
$this->session->set('logged_in_staff_business_id',$staffdata['business_id']);
|
||||
// $this->session->set('logged_in_staff_branch_id',$staffdata['branch_id']);
|
||||
|
||||
|
||||
if($staffdata['role'] == 'Admin'){
|
||||
$this->session->set('logged_in_staff_business_id', 0);
|
||||
}else{
|
||||
$this->session->set('logged_in_staff_business_id',json_decode($staffdata['business_id'])[0]);
|
||||
}
|
||||
|
||||
return redirect()->to(base_url().'shared_docs_list');
|
||||
}
|
||||
@ -72,7 +84,6 @@ class StaffController extends BaseController
|
||||
$this->session->setTempdata('error','Email or Password is invalid',3);
|
||||
return redirect()->to(base_url()."staff");
|
||||
}
|
||||
|
||||
}else{
|
||||
$this->session->setTempdata('error','Email or Password is invalid',3);
|
||||
return redirect()->to(base_url()."staff");
|
||||
@ -112,6 +123,7 @@ class StaffController extends BaseController
|
||||
}
|
||||
public function staff_create()
|
||||
{
|
||||
|
||||
if(!$this->session->has('is_staff_logged_in')){ return redirect()->to(base_url().'staff'); }
|
||||
|
||||
if($this->request->getmethod() == 'POST')
|
||||
@ -123,9 +135,11 @@ class StaffController extends BaseController
|
||||
return json_encode('mail_exists');
|
||||
}else{
|
||||
$staffData = $this->request->getVar();
|
||||
// print_r($staffData);die;
|
||||
$staffData['created_by'] = $this->session->get('is_staff_logged_in');
|
||||
// $staffData['branch_id'] = $this->session->get('logged_in_staff_branch_id');
|
||||
|
||||
$staffData['business_id'] = json_encode($this->request->getVar('business_id'));
|
||||
|
||||
$insert = $this->StaffModel->save($staffData);
|
||||
if($insert)
|
||||
{
|
||||
@ -138,7 +152,7 @@ class StaffController extends BaseController
|
||||
|
||||
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
|
||||
$data['business'] = $this->BusinessModel->where('isactive', 1)->findAll();
|
||||
$data['branch'] = $this->BranchModel->where('isactive', 1)->findAll();
|
||||
// $data['branch'] = $this->BranchModel->where('isactive', 1)->findAll();
|
||||
$data['page_heading'] = "Create Staff";
|
||||
echo view('layout/header', ['Data'=>$staffdata]);
|
||||
echo view('staff_form', $data);
|
||||
@ -153,7 +167,10 @@ class StaffController extends BaseController
|
||||
//update staff details
|
||||
$staffData = $this->request->getVar();
|
||||
$staffData['updated_by'] = $this->session->get('is_staff_logged_in');
|
||||
|
||||
$staff_id = $this->request->getVar('id');
|
||||
$staffData['business_id'] = json_encode($this->request->getVar('business_id'));
|
||||
|
||||
$this->StaffModel->where('staff_id', $staff_id )->set($staffData)->update();
|
||||
|
||||
return json_encode('edit_success');
|
||||
@ -163,7 +180,8 @@ class StaffController extends BaseController
|
||||
$data['staffData'] = $this->StaffModel->where('md5(staff.staff_id)', $this->request->getVar('staff_id') )->get()->getRow();
|
||||
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
|
||||
$data['business'] = $this->BusinessModel->where('isactive', 1)->findAll();
|
||||
$data['branch'] = $this->BranchModel->where('isactive', 1)->findAll();
|
||||
// $data['branch'] = $this->BranchModel->where('isactive', 1)->findAll();
|
||||
// print_r($data['staffData']->business_id);die;
|
||||
$data['page_heading'] = "Edit Staff";
|
||||
echo view('layout/header', ['Data'=>$staffdata]);
|
||||
echo view('staff_form',$data);
|
||||
@ -174,6 +192,24 @@ class StaffController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
public function business_view($staff_id){
|
||||
|
||||
$staffdata = $this->StaffModel->where('staff_id',$staff_id)->first();
|
||||
$businessData =[];
|
||||
$businessIds = json_decode($staffdata['business_id']);
|
||||
|
||||
if (isset($businessIds) && is_array($businessIds)) {
|
||||
foreach ($businessIds as $key => $value) {
|
||||
$businessData[] = $this->BusinessModel->where('business_id', $value)->first();
|
||||
}
|
||||
}else{
|
||||
$businessData[] = $this->BusinessModel->where('business_id', $businessIds)->first();
|
||||
}
|
||||
|
||||
return json_encode($businessData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// client crud
|
||||
public function client_list()
|
||||
@ -188,22 +224,28 @@ class StaffController extends BaseController
|
||||
echo view('client_list',$data);
|
||||
echo view('layout/footer');
|
||||
}
|
||||
public function client_edit($client_id)
|
||||
public function client_edit($client_idd)
|
||||
{
|
||||
if(!$this->session->has('is_staff_logged_in')){ return redirect()->to(base_url().'staff'); }
|
||||
if($this->request->getmethod() == 'POST')
|
||||
{
|
||||
//update staff details
|
||||
$clientData = $this->request->getVar();
|
||||
|
||||
$clientData['updated_by'] = $this->session->get('is_staff_logged_in');
|
||||
$client_id = $this->request->getVar('client_id');
|
||||
$this->ClientModel->where('client_id', $client_id )->set($clientData)->update();
|
||||
$client_update =$this->ClientModel->where('client_id', $client_id )->set($clientData)->update();
|
||||
|
||||
if($client_update){
|
||||
return json_encode(true);
|
||||
}else{
|
||||
return ;
|
||||
}
|
||||
|
||||
return redirect()->to(base_url()."client_list");
|
||||
}else{
|
||||
|
||||
// $data['clientData'] = $this->ClientModel->where('md5(client.client_id)', $this->request->getVar('client_id') )->get()->getRow();
|
||||
$data['clientData'] = $this->ClientModel->where('client_id', $client_id )->get()->getRow();
|
||||
$data['clientData'] = $this->ClientModel->where('client_id', $client_idd )->get()->getRow();
|
||||
// print_r($data);die;
|
||||
$staffdata = $this->StaffModel->where('staff_id',$this->session->get('is_staff_logged_in'))->get()->getRow();
|
||||
|
||||
@ -229,10 +271,28 @@ class StaffController extends BaseController
|
||||
->where('branches.branch_id ',$clientData['branch_id'])
|
||||
->first();
|
||||
$clientData['business_id'] = $business['business_id'];
|
||||
$insert = $this->ClientModel->save($clientData);
|
||||
// $insert = $this->ClientModel->save($clientData);
|
||||
$insert = $this->ClientModel->insert($clientData);
|
||||
if($insert)
|
||||
{
|
||||
return redirect()->to(base_url()."client_list");
|
||||
{
|
||||
$data['client_id'] = $insert;
|
||||
$data['email'] = $clientData['branch_email'];
|
||||
$data['country'] = $clientData['country'];
|
||||
$data['name'] = $clientData['branch_name'];
|
||||
$data['address'] = $clientData['address'];
|
||||
$data['city'] = $clientData['city'];
|
||||
$data['state'] = $clientData['state'];
|
||||
$data['pin_code'] = $clientData['pin_code'];
|
||||
$data['mobile_no'] = $clientData['branch_mobile_no'];
|
||||
$data['gst_no'] = $clientData['gst_no'];
|
||||
|
||||
$branch_insert = $this->ClientBranchModel->insert($data);
|
||||
|
||||
if($branch_insert){
|
||||
return json_encode(true);
|
||||
}else{
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
@ -12,7 +12,7 @@ class ClientBranchModel extends Model
|
||||
'email' , 'address',
|
||||
'country', 'state',
|
||||
'city', 'pin_code',
|
||||
'otp', 'is_active',
|
||||
'otp', 'sms', 'whatsapp', 'is_active',
|
||||
'created_by', 'updated_by'];
|
||||
|
||||
|
||||
|
||||
@ -32,7 +32,8 @@ class StaffModel extends Model
|
||||
{
|
||||
|
||||
$builder = $this->db->table('staff');
|
||||
$builder -> select("staff_id,name,email,password,is_active,role,branch_id,business_id");
|
||||
// $builder -> select("staff_id,name,email,password,is_active,role,branch_id,business_id");
|
||||
$builder -> select("staff_id,name,email,password,is_active,role,business_id");
|
||||
$builder -> where('email',$email);
|
||||
$result = $builder->get();
|
||||
if(count($result->getResultArray()) ==1)
|
||||
@ -46,9 +47,8 @@ class StaffModel extends Model
|
||||
|
||||
public function getStaffWithBusinessAndBranch($is_staff_logged_in, $logged_in_staff_branch_id) {
|
||||
$query = $this->db->table('staff')
|
||||
->select('staff.*, business.business_name AS business_name, branches.branch_name AS branch_name')
|
||||
->join('business', 'business.business_id = staff.business_id')
|
||||
->join('branches', 'branches.branch_id = staff.branch_id')
|
||||
->select('staff.*')
|
||||
// ->join('business', 'business.business_id = staff.business_id')
|
||||
->where('staff.staff_id != ', $is_staff_logged_in);
|
||||
|
||||
// Execute the query and fetch results as an array
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100">
|
||||
<table id="business_branch_table" class="table table-striped dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Branch Name</th>
|
||||
@ -206,6 +206,19 @@
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
datatable_bikeModel = $('#business_branch_table').DataTable({
|
||||
"order": [[0, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
});
|
||||
|
||||
$('#business').select2();
|
||||
});
|
||||
function submitBranch(params) {
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100">
|
||||
<table id="business_table" class="table table-striped dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Business Name</th>
|
||||
@ -103,6 +103,21 @@
|
||||
<script>
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
datatable_bikeModel = $('#business_table').DataTable({
|
||||
"order": [[0, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
function statusChange(params) {
|
||||
var status = params.getAttribute('data-isactive');
|
||||
var business_id = params.getAttribute('data-id');
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100">
|
||||
<table id="client_branch_table" class="table table-striped dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Client</th>
|
||||
@ -178,6 +178,29 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<h5 class="mb-3 text-uppercase bg-light p-2"><i class="fas fa-bell mr-1"></i> Notification</h5>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label for="sms">SMS</label>
|
||||
<input style="float:right" name="sms" type="checkbox" id="sms" required="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label for="whatsapp">WhatsApp</label>
|
||||
<input style="float:right" name="whatsapp" type="checkbox" id="whatsapp" required="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right">
|
||||
@ -194,6 +217,18 @@
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
datatable_bikeModel = $('#client_branch_table').DataTable({
|
||||
"order": [[0, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
});
|
||||
$('.select2').select2();
|
||||
});
|
||||
|
||||
@ -236,11 +271,22 @@
|
||||
|
||||
function submitBranch(event,params) {
|
||||
// event.preventDefault();
|
||||
console.log($('#sms').is(':checked'));
|
||||
|
||||
if ($('#client').val() == 0) {
|
||||
toastr.warning('Select Client');
|
||||
return;
|
||||
}
|
||||
|
||||
var sms = 0;
|
||||
if($('#sms').is(':checked')){
|
||||
sms = 1;
|
||||
}
|
||||
|
||||
var whatsapp = 0;
|
||||
if($('#whatsapp').is(':checked')){
|
||||
whatsapp = 1;
|
||||
}
|
||||
|
||||
var formData = {
|
||||
client_id: $('#client').val(),
|
||||
@ -254,7 +300,9 @@
|
||||
city: $('#city').val(),
|
||||
state: $('#state').val(),
|
||||
pin_code: $('#pin_code').val(),
|
||||
mobile_no: $('#mobile_no').val()
|
||||
mobile_no: $('#mobile_no').val(),
|
||||
sms: sms,
|
||||
whatsapp: whatsapp,
|
||||
};
|
||||
|
||||
if ($('#id').val()) {
|
||||
@ -281,6 +329,11 @@
|
||||
if (!isValid) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$('#sms').is(':checked') && !$('#whatsapp').is(':checked')) {
|
||||
toastr.warning('One Notification is must');
|
||||
return;
|
||||
}
|
||||
$('#client_branch_submit').attr('disabled','true');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
@ -331,6 +384,16 @@
|
||||
$('#pin_code').val(response.pin_code);
|
||||
$('#state').val(response.state);
|
||||
$('#country').val(response.country);
|
||||
if(response.sms == 1){
|
||||
$('#sms').prop('checked', true);
|
||||
}else{
|
||||
$('#sms').prop('checked', false);
|
||||
}
|
||||
if(response.whatsapp == 1){
|
||||
$('#whatsapp').prop('checked', true);
|
||||
}else{
|
||||
$('#whatsapp').prop('checked', false);
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<table id="datatable-buttonss" class="table table-striped dt-responsive nowrap w-100">
|
||||
<table id="client_table" class="table table-striped dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
@ -73,7 +73,7 @@
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" data-toggle="modal" data-target="#bike_make_login-modal" value="<?= $value['client_id']; ?>" onclick="editBranch(this)"> <i class='mdi mdi-pencil-outline mr-1' style="margin-right: 16px !important;margin-left: 5px;"></i>Edit</a>
|
||||
<a class="dropdown-item edit" data-toggle="modal" data-target="#bike_make_login-modal" value="<?= $value['client_id']; ?>" onclick="editBranch(this)"> <i class='mdi mdi-pencil-outline mr-1' style="margin-right: 16px !important;margin-left: 5px;"></i>Edit</a>
|
||||
|
||||
<?php if($value['is_active'] == 1): ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $value['client_id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Deactivate" onclick="statusChange(this)"><i class="ri-shield-user-line"></i><i class="fa fa-times" style="font-size: x-small;margin-right:10px"></i>Deactivate</a>
|
||||
@ -150,6 +150,73 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="create_client">
|
||||
<h5 class="mb-3 text-uppercase bg-light p-2">
|
||||
<i class="mdi mdi-office-building mr-1"></i> Branch
|
||||
</h5>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="branchname">Branch Name</label>
|
||||
<input class="form-control" name="branch_name" type="text" id="branch_name" required="true" placeholder="Branch Name">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="gstno">GST No</label>
|
||||
<input class="form-control" name="gst_no" type="text" id="gst_no" required="" placeholder="GST No" pattern="[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[0-9]{1}[Z]{1}[0-9A-Z]{1}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="branch_email">Email</label>
|
||||
<input class="form-control" name="branch_email" type="email" id="branch_email" required="" placeholder="Email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="branch_mobile_no">Mobile No</label>
|
||||
<input class="form-control" name="branch_mobile_no" type="text" id="branch_mobile_no" required="" minlength="6" maxlength="16" placeholder="Mobile No">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="address">Address</label>
|
||||
<input class="form-control" name="address" type="text" id="address" required="" placeholder="Address">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="city">City</label>
|
||||
<input class="form-control" name="city" type="text" id="city" required="" placeholder="City">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="state">State</label>
|
||||
<input class="form-control" name="state" type="text" id="state" value="Tamil Nadu" required="" placeholder="State">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="country">Country</label>
|
||||
<input class="form-control" name="country" type="text" value="India" id="country" required="" placeholder="Country">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="postalcode">Pin Code</label>
|
||||
<input class="form-control" name="pin_code" type="text" id="pin_code" required="" placeholder="Pin Code">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right">
|
||||
<button class="btn btn-info waves-effect waves-light" type="submit" id="client_submit_button" onclick="submitBranch(this)">Submit</button>
|
||||
</div>
|
||||
@ -169,6 +236,59 @@
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('.edit').click(function (params) {
|
||||
$('.create_client').hide();
|
||||
$('#gst_no').prop('required', false);
|
||||
$('#branch_email').prop('required', false);
|
||||
$('#contact').prop('required', false);
|
||||
$('#country').prop('required', false);
|
||||
$('#state_code').prop('required', false);
|
||||
$('#branch_name').prop('required', false);
|
||||
$('#address').prop('required', false);
|
||||
$('#city').prop('required', false);
|
||||
$('#state').prop('required', false);
|
||||
$('#pin_code').prop('required', false);
|
||||
$('#branch_mobile_no').prop('required', false);
|
||||
})
|
||||
|
||||
$('#add_client_button').click(function (params) {
|
||||
|
||||
$('#name').val('');
|
||||
$('#pan_no').val('');
|
||||
$('#email').val('');
|
||||
$('#mobile_no').val('');
|
||||
$('#client_id').val('')
|
||||
|
||||
$('.create_client').show();
|
||||
$('#gst_no').prop('required', true);
|
||||
$('#branch_email').prop('required', true);
|
||||
$('#contact').prop('required', true);
|
||||
$('#country').prop('required', true);
|
||||
$('#state_code').prop('required', true);
|
||||
$('#branch_name').prop('required', true);
|
||||
$('#address').prop('required', true);
|
||||
$('#city').prop('required', true);
|
||||
$('#state').prop('required', true);
|
||||
$('#pin_code').prop('required', true);
|
||||
$('#branch_mobile_no').prop('required', true);
|
||||
})
|
||||
|
||||
|
||||
datatable_bikeModel = $('#client_table').DataTable({
|
||||
"order": [[0, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById('downloadLink').addEventListener('click', function(event)
|
||||
{
|
||||
event.preventDefault();
|
||||
@ -198,9 +318,21 @@
|
||||
|
||||
if ($('#client_id').val()) {
|
||||
formData.client_id = $('#client_id').val();
|
||||
var url = '<?= base_url("client_edit/"); ?>'+$('#client_id').val();
|
||||
var url = '<?= base_url("client_edit/"); ?>'+ $('#client_id').val();
|
||||
}else{
|
||||
var url = '<?= base_url("client_create"); ?>';
|
||||
|
||||
formData.gst_no = $('#gst_no').val();
|
||||
formData.branch_email = $('#branch_email').val();
|
||||
formData.contact = $('#contact').val();
|
||||
formData.country = $('#country').val();
|
||||
formData.state_code = $('#state_code').val();
|
||||
formData.branch_name = $('#branch_name').val();
|
||||
formData.address = $('#address').val();
|
||||
formData.city = $('#city').val();
|
||||
formData.state = $('#state').val();
|
||||
formData.pin_code = $('#pin_code').val();
|
||||
formData.branch_mobile_no = $('#branch_mobile_no').val();
|
||||
}
|
||||
|
||||
var form = $(params).parent().parent();
|
||||
@ -223,9 +355,12 @@
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
$('#bike_model_login-modal').modal('hide');
|
||||
|
||||
window.location.reload();
|
||||
if(response == true){
|
||||
$('#bike_model_login-modal').modal('hide');
|
||||
window.location.reload();
|
||||
}else{
|
||||
// redirect()->to(base_url()."client_list")
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
|
||||
@ -25,6 +25,28 @@
|
||||
<!-- Right bar overlay-->
|
||||
<!-- <div class="rightbar-overlay"></div> -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
<?php if (isset($business_list) && isset($_SESSION['logged_in_staff_business_id'])) { ?>
|
||||
var business_list = <?php echo json_encode($business_list); ?>;
|
||||
var selectElement = document.getElementById('business_list_header');
|
||||
|
||||
var session_business_id = <?php echo $_SESSION['logged_in_staff_business_id'] ?>;
|
||||
|
||||
// Loop through business_list and create options
|
||||
business_list.forEach(function(business) {
|
||||
var option = document.createElement('option');
|
||||
option.value = business.business_id; // Set the value attribute
|
||||
option.textContent = business.business_name; // Set the text content
|
||||
selectElement.appendChild(option); // Append the option to <select>
|
||||
if (business.business_id == session_business_id) {
|
||||
option.selected = true;
|
||||
}
|
||||
});
|
||||
<?php } ?>
|
||||
})
|
||||
</script>
|
||||
|
||||
<!-- Vendor js -->
|
||||
<script src="<?= base_url()."public"; ?>/assets/js/vendor.min.js"></script>
|
||||
|
||||
|
||||
@ -43,6 +43,25 @@
|
||||
|
||||
|
||||
<style>
|
||||
.select2-container .select2-selection--multiple .select2-selection__choice {
|
||||
padding: 5px 7px 5px 0 !important;
|
||||
color: #000000;
|
||||
}
|
||||
#business_list_header option{
|
||||
background-color: white;
|
||||
color:black;
|
||||
}
|
||||
.btn-secondary {
|
||||
background-color: #f4f9fb;
|
||||
border-color: #f4f9fb;
|
||||
color:black;
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
color: #343a40;
|
||||
background-color: #d8eaf1;
|
||||
border-color: #cfe5ed;
|
||||
}
|
||||
.loader-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
@ -52,7 +71,14 @@
|
||||
background-color: #00000069;
|
||||
z-index: 99999;
|
||||
}
|
||||
|
||||
.dataTables_wrapper button{
|
||||
background: #f1f5f7;
|
||||
color: #343a40;
|
||||
border-width: 0;
|
||||
}
|
||||
.dataTables_wrapper .dt-buttons{
|
||||
float:left;
|
||||
}
|
||||
.loader {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
@ -149,6 +175,13 @@
|
||||
|
||||
<ul class="list-unstyled topnav-menu float-right mb-0">
|
||||
|
||||
<li>
|
||||
<?php if(isset($_SESSION['logged_in_staff_business_id']) && $_SESSION['logged_in_staff_business_id']) { ?>
|
||||
|
||||
<select name="business" class="form-control" id="business_list_header" style="width: 213px;margin-top: 13px;background-color: #85a7c9;border: none;color:white;">
|
||||
</select>
|
||||
<?php } ?>
|
||||
</li>
|
||||
|
||||
<li class="dropdown notification-list topbar-dropdown">
|
||||
<a class="nav-link dropdown-toggle nav-user mr-0 waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
|
||||
@ -225,15 +258,15 @@
|
||||
<!-- <span class="logo-lg-text-light">M</span> -->
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a class="logo logo-light text-center">
|
||||
<a>teeeeeeeeeeee</a>
|
||||
<!-- <a class="logo logo-light text-center">
|
||||
<span class="logo-sm">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/logo_white_sm.png" alt="" height="24">
|
||||
<img src="?= base_url()."public"; ?>/assets/images/logo_white_sm.png" alt="" height="24">
|
||||
</span>
|
||||
<span class="logo-lg">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/logo_white.png" alt="" height="20">
|
||||
<img src="?= base_url()."public"; ?>/assets/images/logo_white.png" alt="" height="20">
|
||||
</span>
|
||||
</a>
|
||||
</a> -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<table id="datatable-buttons" class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" >
|
||||
<table id="service_group_table" class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" >
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>Group Name</th>
|
||||
@ -97,12 +97,22 @@
|
||||
<form id="save-service-group" enctype="multipart/form-data">
|
||||
<div class="modal-body p-4">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="field-1" class="control-label">Service Group Name</label>
|
||||
<input type="text" class="form-control" name="group_name" >
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="field-1" class="control-label">Business</label>
|
||||
<select name="business[]" id="business" class="form-control Select2" multiple required>
|
||||
<?php foreach ($business_list as $key => $value) { ?>
|
||||
<option value="<?= $value['business_id'] ?>"><?= $value['business_name'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="field-1" class="control-label">Service Group Name</label>
|
||||
<input type="text" class="form-control" name="group_name" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@ -127,6 +137,16 @@
|
||||
<div class="modal-body p-4">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="field-1" class="control-label">Business</label>
|
||||
<select name="business[]" id="business_edit" class="form-control Select2" multiple required>
|
||||
<?php foreach ($business_list as $key => $value) { ?>
|
||||
<option value="<?= $value['business_id'] ?>"><?= $value['business_name'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="field-1" class="control-label">Service Group Name</label>
|
||||
@ -157,6 +177,23 @@
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
$('.Select2').select2({
|
||||
placeholder: "Select Business",
|
||||
allowClear: true
|
||||
});
|
||||
datatable_bikeModel = $('#service_group_table').DataTable({
|
||||
"order": [[0, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
});
|
||||
|
||||
$('#save-service-group').submit(function(e) {
|
||||
e.preventDefault(); // Prevent the form from submitting normally
|
||||
|
||||
@ -173,6 +210,7 @@
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
if(response){
|
||||
toastr.success('Data saved successfully ', 'Success');
|
||||
window.location.reload();
|
||||
@ -204,6 +242,8 @@
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function(response) {
|
||||
console.log("------------");
|
||||
console.log(response);
|
||||
if(response){
|
||||
toastr.success('Data saved successfully ', 'Success');
|
||||
window.location.reload();
|
||||
@ -225,10 +265,8 @@
|
||||
|
||||
function getGroupData(params) {
|
||||
|
||||
|
||||
var service_group_id = params.getAttribute('data-id');
|
||||
|
||||
|
||||
|
||||
var formData = {
|
||||
service_group_id: service_group_id
|
||||
};
|
||||
@ -242,8 +280,11 @@
|
||||
if (response.success) {
|
||||
$('#group_name').val(response.data.group_name);
|
||||
$('#service_group_id').val(response.data.service_group_id);
|
||||
|
||||
var selectedBusinesses = JSON.parse(response.data.business_id); // Assuming this is an array of selected business IDs
|
||||
|
||||
$('#business_edit').val(selectedBusinesses).trigger('change');
|
||||
$('#edit_view').click();
|
||||
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
@ -251,7 +292,5 @@
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -26,7 +26,7 @@
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<table id="datatable-buttons" class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" >
|
||||
<table id="service_table" class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" >
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>Group Name</th>
|
||||
@ -204,6 +204,18 @@
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
datatable_bikeModel = $('#service_table').DataTable({
|
||||
"order": [[0, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
});
|
||||
|
||||
$('.select2-dropdown').select2();
|
||||
|
||||
|
||||
|
||||
@ -13,6 +13,8 @@
|
||||
top:4px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<div class="content-page">
|
||||
@ -43,15 +45,38 @@
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<table id="datatable-buttons" class="table table-striped dt-responsive nowrap w-100 display">
|
||||
<table id="share_docs_table" class="table table-striped dt-responsive nowrap w-100 display">
|
||||
<thead>
|
||||
<tr >
|
||||
<td style="border: none;">
|
||||
<input class="form-control form-control-sm" type="text" id="searchClientName" placeholder="Search Client Name">
|
||||
</td>
|
||||
<td style="border: none;">
|
||||
<input class="form-control form-control-sm" type="text" id="searchClientBranchName" placeholder="Search Client Branch Name">
|
||||
</td>
|
||||
<td style="border: none;">
|
||||
<input class="form-control form-control-sm" type="text" id="searchServiceGroup" placeholder="Search Service Group">
|
||||
</td>
|
||||
<td style="border: none;">
|
||||
<input class="form-control form-control-sm" type="text" id="searchServiceName" placeholder="Search Service Name">
|
||||
</td>
|
||||
<td style="border: none;">
|
||||
<input class="form-control form-control-sm" type="text" id="searchDocumentName" placeholder="Search Document Name">
|
||||
</td>
|
||||
<td style="border: none;">
|
||||
<input class="form-control form-control-sm" type="text" id="searchDocStatus" placeholder="Search Doc Status">
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th style="width:10px">Client Name</th>
|
||||
<th style="width:10px">Client Name</th>
|
||||
<th>Client Branch Name</th>
|
||||
<th>Service Group</th>
|
||||
<th>Service Name</th>
|
||||
<th>Document Name</th>
|
||||
<th>Doc Status</th>
|
||||
<!-- <th>Approve Date</th> -->
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -59,7 +84,7 @@
|
||||
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($doc_list as $key => $value) { ?>
|
||||
<?php foreach ($doc_list as $key => $value) { ?>
|
||||
|
||||
<tr>
|
||||
<td style="width:10px"> <?php echo $value['client_name']; ?></td>
|
||||
@ -268,8 +293,74 @@
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.1.0/js/select2.min.js"></script>
|
||||
<script>
|
||||
|
||||
$('#business_list_header').change(function () {
|
||||
var businessId = $(this).val();
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("set_business_in_session/") ?>' + businessId,
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
window.location.reload();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('input[type="text"]').on('input', function() {
|
||||
var searchTextSKU = $('#searchClientName').val().toLowerCase();
|
||||
var searchTextProductName = $('#searchClientBranchName').val().toLowerCase();
|
||||
var searchTextManufacturerName = $('#searchServiceGroup').val().toLowerCase();
|
||||
var searchTextCategory = $('#searchServiceName').val().toLowerCase();
|
||||
var searchTextUnitPrice = $('#searchDocumentName').val().toLowerCase();
|
||||
var searchTextRackNo = $('#searchDocStatus').val().toLowerCase();
|
||||
|
||||
$('#share_docs_table tbody tr').each(function() {
|
||||
var cellTextSKU = $(this).find('td:nth-child(1)').text().toLowerCase();
|
||||
var cellTextProductName = $(this).find('td:nth-child(2)').text().toLowerCase();
|
||||
var cellTextManufacturerName = $(this).find('td:nth-child(3)').text().toLowerCase();
|
||||
var cellTextCategory = $(this).find('td:nth-child(4)').text().toLowerCase();
|
||||
var cellTextUnitPrice = $(this).find('td:nth-child(5)').text().toLowerCase();
|
||||
var cellTextRackNo = $(this).find('td:nth-child(7)').text().toLowerCase();
|
||||
|
||||
// Show the row if all search fields match
|
||||
if (cellTextSKU.includes(searchTextSKU) &&
|
||||
cellTextProductName.includes(searchTextProductName) &&
|
||||
cellTextManufacturerName.includes(searchTextManufacturerName) &&
|
||||
cellTextCategory.includes(searchTextCategory) &&
|
||||
cellTextUnitPrice.includes(searchTextUnitPrice) &&
|
||||
cellTextRackNo.includes(searchTextRackNo)) {
|
||||
$(this).show();
|
||||
} else { $(this).hide();}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
// $('#business_list_header').
|
||||
|
||||
|
||||
datatable_bikeModel = $('#share_docs_table').DataTable({
|
||||
"order": [[0, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
});
|
||||
|
||||
$('.select2-dropdown').select2({ });
|
||||
|
||||
$("#service_group_id").on("change", function()
|
||||
|
||||
@ -50,25 +50,19 @@
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="business">Business<span class="text-danger">*</span></label>
|
||||
<select class="form-control slect2-dropdown" id="business_id" name="business_id" parsley-trigger="change" required >
|
||||
<option value="0">Select Business</option>
|
||||
<select class="form-control slect2-dropdown" id="business_id" name="business_id[]" parsley-trigger="change" required multiple>
|
||||
<!-- <option value="0">Select Business</option> -->
|
||||
<?php foreach ($business as $key => $value) { ?>
|
||||
<option value="<?php echo $value['business_id']; ?>" <?php if(isset($staffData)){ echo ($staffData->business_id == $value['business_id']) ? 'selected' : '';} ?>>
|
||||
<?php echo $value['business_name']; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<option value="<?php echo $value['business_id']; ?>"
|
||||
<?php echo (isset($staffData) && is_array(json_decode($staffData->business_id)) && in_array($value['business_id'], json_decode($staffData->business_id))) ? 'selected' : ''; ?>>
|
||||
<?php echo $value['business_name']; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="branch">Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control slect2-dropdown" id="branch_id" name="branch_id" parsley-trigger="change" required >
|
||||
<option value="0">Select Branch</option>
|
||||
<?php if(isset($staffData)){ foreach ($branch as $key => $value) { ?>
|
||||
<option value="<?php echo $value['branch_id']; ?>" <?php echo ($staffData->branch_id == $value['branch_id']) ? 'selected' : ''; ?>>
|
||||
<?php echo $value['branch_name']; ?>
|
||||
</option>
|
||||
<?php }} ?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
<div class="form-group col-md-1">
|
||||
</div>
|
||||
@ -209,48 +203,18 @@ $(document).ready(function() {
|
||||
|
||||
|
||||
$('#staff_data_form_submit').click(function (event) {
|
||||
console.log("come");
|
||||
event.preventDefault();
|
||||
if($('#business_id').val() == 0){
|
||||
toastr.warning('Select Business');
|
||||
return;
|
||||
}
|
||||
if($('#branch_id').val() == 0){
|
||||
toastr.warning('Select Branch');
|
||||
return;
|
||||
}
|
||||
|
||||
$('#staff_form').submit();
|
||||
})
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.slect2-dropdown').select2();
|
||||
|
||||
|
||||
$("#business_id").on("change", function() {
|
||||
var business_id = $(this).val();
|
||||
if (business_id) {
|
||||
var branch_list = <?php echo json_encode($branch); ?>;
|
||||
// Filter branch_list based on business_id
|
||||
var filteredBranches = branch_list.filter(function(element) {
|
||||
return element.business_id == business_id;
|
||||
});
|
||||
|
||||
$('#branch_id').empty();
|
||||
$('#branch_id option:not(:first)').remove();
|
||||
|
||||
$('#branch_id').append($('<option>', {
|
||||
value: 0,
|
||||
text: "Select Branch"
|
||||
}));
|
||||
$.each(filteredBranches, function(index, item) {
|
||||
$('#branch_id').append($('<option>', {
|
||||
value: item.branch_id,
|
||||
text: item.branch_name
|
||||
}));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -28,11 +28,10 @@
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<table id="datatable-buttonss" class="table table-striped dt-responsive nowrap w-100">
|
||||
<table id="staff_table" class="table table-striped dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Business And Branch</th>
|
||||
<th>Email</th>
|
||||
<th>Mobile</th>
|
||||
<th>Role</th>
|
||||
@ -48,7 +47,6 @@
|
||||
|
||||
<tr>
|
||||
<td> <?php echo $value['name']; ?></td>
|
||||
<td><?php echo $value['business_name']; ?> - <?php echo $value['branch_name']; ?></td>
|
||||
<td><?php echo $value['email']; ?></td>
|
||||
<td><?php echo $value['mobile_no']; ?></td>
|
||||
<td><?php echo $value['role']; ?></td>
|
||||
@ -64,6 +62,8 @@
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="<?= base_url()."staff_edit?staff_id=".md5($value['staff_id']); ?>" ><i class='mdi mdi-pencil-outline mr-1' style="margin-right: 16px !important;margin-left: 5px;"></i>Edit</a>
|
||||
<a class="dropdown-item" data-toggle="modal" data-target="#staff_business_list_modal" href="#" onclick="view_business(<?= $value['staff_id'] ?>)"><i class='mdi mdi-briefcase-outline mr-1' style="margin-right: 16px !important;margin-left: 5px;"></i>Business View</a>
|
||||
|
||||
<?php if($value['is_active'] == 1): ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $value['staff_id']; ?>" data-isactive="<?php echo $value['is_active']; ?>" title="Deactivate" onclick="statusChange(this)"><i class="ri-user-line"></i><i class="fa fa-times" style="font-size: x-small;margin-right:10px"></i>Deactivate</a>
|
||||
<?php else: ?>
|
||||
@ -94,6 +94,50 @@
|
||||
|
||||
|
||||
|
||||
<div id="staff_business_list_modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 id="branch_action_type">Staff Business List</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<table class="table table-striped dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Business Name
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right">
|
||||
<!-- <button class="btn btn-info waves-effect waves-light" type="submit" onclick="submitBranch(this)">Submit</button> -->
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- End Page content -->
|
||||
@ -101,13 +145,50 @@
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttonss').DataTable({
|
||||
|
||||
|
||||
"ordering": false
|
||||
|
||||
function view_business(params) {
|
||||
console.log(params);
|
||||
$('#staff_business_list_modal').click();
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '<?php echo base_url()."business_view/"?>'+ params,
|
||||
dataType: 'json',
|
||||
success:function (response) {
|
||||
console.log(response);
|
||||
var tbody = $('#staff_business_list_modal tbody');
|
||||
tbody.empty();
|
||||
response.forEach(element => {
|
||||
console.log(element);
|
||||
var row = '<tr>' +
|
||||
'<td>' + element.business_name + '</td>' +
|
||||
'</tr>';
|
||||
|
||||
tbody.append(row);
|
||||
});
|
||||
},
|
||||
error: function name(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
datatable_bikeModel = $('#staff_table').DataTable({
|
||||
"order": [[0, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function statusChange(params) {
|
||||
var status = params.getAttribute('data-isactive');
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
</h4>
|
||||
|
||||
|
||||
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" >
|
||||
<table id="template_list_table" class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" >
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th>Group Name</th>
|
||||
@ -125,8 +125,19 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
datatable_bikeModel = $('#template_list_table').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
});
|
||||
|
||||
$('.preview-button').on('click', function(e) {
|
||||
$('.preview-button').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var templateId = $(this).data('template-id');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user