/home/mip/mip/public/vendor/laravel-filemanager/files/folder-1/821668/app.tar
Http/Middleware/EncryptCookies.php000066400000000456152434100730013220 0ustar00<?php

namespace QxCMS\Http\Middleware;

use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter;

class EncryptCookies extends BaseEncrypter
{
    /**
     * The names of the cookies that should not be encrypted.
     *
     * @var array
     */
    protected $except = [
        //
    ];
}
Http/Middleware/RedirectIfAuthenticated.php000066400000001015152434100730014772 0ustar00<?php

namespace QxCMS\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Auth;

class RedirectIfAuthenticated
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  string|null  $guard
     * @return mixed
     */
    public function handle($request, Closure $next, $guard = null)
    {
        if (Auth::guard($guard)->check()) {
            return redirect('/home');
        }

        return $next($request);
    }
}
Http/Middleware/VerifyCsrfToken.php000066400000000476152434100730013344 0ustar00<?php

namespace QxCMS\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;

class VerifyCsrfToken extends BaseVerifier
{
    /**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array
     */
    protected $except = [
        'api/*'
    ];
}
Http/Controllers/Website/ManpowerController.php000066400000005661152434100730015751 0ustar00<?php

namespace QxCMS\Http\Controllers\Website;

use Illuminate\Http\Request;
use QxCMS\Http\Requests\ManpowerFormRequest;
use QxCMS\Http\Controllers\Controller;

class ManpowerController extends Controller
{
    public function create()
    {
        return view('website.about-us');
    }

    public function store(ManpowerFormRequest $request)
    {
    	\Mail::send('emails.manpower-request',
        array(
            'business_name' => $request->get('business_name'),
            'address' => $request->get('address'),
            'telephone' => $request->get('telephone'),
            'fax' => $request->get('fax'),
            'email' => $request->get('email'),
            'website' => $request->get('website'),
            'contact_person' => $request->get('contact_person'),
            'position' => $request->get('position'),
            'license_number' => $request->get('license_number'),
            'nature' => $request->get('nature'),
            'position1' => $request->get('position1'),
            'required1' => $request->get('required1'),
            'description1' => $request->get('description1'),
            'position2' => $request->get('position2'),
            'required2' => $request->get('required2'),
            'description2' => $request->get('description2'),
            'position3' => $request->get('position3'),
            'required3' => $request->get('required3'),
            'description3' => $request->get('description3'),
            'position4' => $request->get('position4'),
            'required4' => $request->get('required4'),
            'description4' => $request->get('description4'),
            'position5' => $request->get('position5'),
            'required5' => $request->get('required5'),
            'description5' => $request->get('description5'),
            'position6' => $request->get('position6'),
            'required6' => $request->get('required6'),
            'description6' => $request->get('description6'),
            'position7' => $request->get('position7'),
            'required7' => $request->get('required7'),
            'description7' => $request->get('description7'),
            'position8' => $request->get('position8'),
            'required8' => $request->get('required8'),
            'description8' => $request->get('description8'),
            'position9' => $request->get('position9'),
            'required9' => $request->get('required9'),
            'description9' => $request->get('description9'),
            'position10' => $request->get('position10'),
            'required10' => $request->get('required10'),
            'description10' => $request->get('description10')
        ), function($message)
  	  {
        $message->from('noreply@mipinternational.com');
        $message->to('mip.intlmanpowerservices@gmail.com', 'Admin')->subject('MIP Website Manpower Request');
    });
    	return \Redirect::route('manpowerrequest')
      ->with('message', 'Thanks for applying to us!');
    }
}
Http/Controllers/Website/WebsiteController.php000066400000003144152434100730015555 0ustar00<?php

namespace QxCMS\Http\Controllers\Website;

use QxCMS\Http\Controllers\Controller;
use QxCMS\Modules\Client\Repositories\Posts\PostsRepositoryInterface as Posts;
use QxCMS\Modules\Client\Repositories\JobOpening\JobOpeningRepositoryInterface as Job;
use QxCMS\Models\Countries as Country;
use Yajra\Datatables\Datatables;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use DB;

class WebsiteController extends Controller
{
    protected $posts;
    protected $job;
    protected $country;

    public function __construct(Posts $posts, Job $job, Country $country)
    {
        $this->posts = $posts;
        $this->job = $job;
        $this->country = $country;
    }

    public function datatable()
    {
        return view('datatable');
    }

    public function getJobs()
    {
        $job = $this->job->with('country')->select(['slug','position','country_id','opening_date','closing_date','status'])
        ->where([
            ['status','=','Open'],
            ['opening_date','<=', DB::raw('CURDATE()')],
            ['closing_date','>', DB::raw('CURDATE()')]
            ]);

        return Datatables::of($job)
            ->addColumn('country_name', function($job){
                return ucwords(strtolower($job->country->name));
            })
            ->addColumn('action', function ($job) {
                return '<a href="'.$job->slug.'" class="btn btn-xs btn-datatable"><i class="glyphicon glyphicon-search"></i> View Details</a>';
            })
            ->editColumn('slug', '{{$slug}}')
            ->make(true);
        // return DataTables::of(User::query())->make(true);
    }
}
Http/Controllers/Website/PostController.php000064400000004545152434100730015104 0ustar00<?php

namespace QxCMS\Http\Controllers\Website;

use QxCMS\Http\Controllers\Controller;
use QxCMS\Modules\Client\Repositories\Posts\PostsRepositoryInterface as Posts;
use QxCMS\Modules\Client\Repositories\JobOpening\JobOpeningRepositoryInterface as Job;
use QxCMS\Modules\Client\Repositories\Posts\PostCategoryRepositoryInterface as Category;
use Illuminate\Http\Request;
use client;
use DB;
use App\User;

class PostController extends Controller
{
    protected $posts;
    protected $job;
    protected $category;

    public function __construct(Posts $posts, Job $job, Category $category)
    {
        $this->posts = $posts;     
        $this->job = $job;
        $this->category = $category;
    }

    public function index(){
        $data['posts'] = $this->posts->getAllPost();
        $data['latestPosts'] = $this->posts->getLatestPost();
        $data['allPages'] = $this->posts->getAllPage();
        $data['latestPosts'] = $this->posts->getLatestPost();
        $data['latestJobs'] = $this->job->getLatestJob();
        return view('website.index', $data);
    }

    public function posts($category, $slug)
    {
        $data['posts'] = $this->posts->findBySlug($slug);
        $data['allPages'] = $this->posts->getAllPage();
        $data['latestPostByCategory'] = $this->posts->getLatestByCategory($category);
        $view = $this->viewFactory($slug, 'post');
        return view($view, $data);
    }

    public function pages(Request $request, $slug, $limit = 4)
    {
        $data['allPages'] = $this->posts->getAllPage();
        $data['specificPages'] = $this->posts->findBySlug($slug);
        $data['latestPosts'] = $this->posts->getLatestPost();
        $data['latestJobs'] = $this->job->getLatestJob();
        $data['jobpages'] = $this->job->findBySlug($slug);
        $data['postpages'] = $this->posts->findBySlug($slug);
        $data['latestPostByCategory'] = $this->posts->getLatestByCategory('mip');
        if ($request->get('slug')) {
           $data['jobapply'] = $this->job->findBySlug($request->get('slug'));
        }
        $view = $this->viewFactory($slug, 'page');
        return view($view, $data);
    }

    protected function viewFactory($category, $type)
    {
        $view = "website.".$type."-{$category}";
        if (view()->exists($view))
        {
            return $view;
        }

        return 'website.includes.'.$type.'-default';
    }
}
Http/Controllers/Website/ContactController.php000066400000001530152434100730015543 0ustar00<?php

namespace QxCMS\Http\Controllers\Website;

use Illuminate\Http\Request;
use QxCMS\Http\Requests\ContactFormRequest;
use QxCMS\Http\Controllers\Controller;

class ContactController extends Controller
{
    public function create()
    {
        return view('website.contact-us');
    }

    public function store(ContactFormRequest $request)
    {

    	\Mail::send('emails.contact',
        array(
            'name' => $request->get('name'),
            'email' => $request->get('email'),
            'user_message' => $request->get('message')
        ), function($message)
  	  {
        $message->from('noreply@mipinternational.com');
        $message->to('mip.intlmanpowerservices@gmail.com', 'Admin')->subject('MIP Website Inquiry');
    });
    	return \Redirect::route('contact')
      ->with('message', 'Thanks for contacting us!');
    }
}
Http/Controllers/Website/ApplyNowController.php000064400000052624152434100730015731 0ustar00<?php

namespace QxCMS\Http\Controllers\Website;

use Illuminate\Http\Request;
use QxCMS\Http\Requests\ApplyNowFormRequest;
use QxCMS\Http\Controllers\Controller;

use DB;

class ApplyNowController extends Controller
{
    public function create()
    {
        return view('website.apply-now');
    }
    

    public function store(ApplyNowFormRequest $request)
    {
      //return 1;
        $singaporeCountryID = 15;
        $taiwanCountryID = 28;
        $selectedCountryID = $request->get('selected_country_id');
        $appliyingForCTPosition = $request->get('appliyingForCTPosition');

        $questionWith = $request->get('questionWith');
        $firstname = $request->get('fname');
        $middlename = $request->get('mname');
        $lastname = $request->get('lname');
        $position = ucwords(strtolower($request->get('position')));
        $email = $request->get('email');
        
        //send email to applicant
        $applicantSubject = $position. ' Job Application';
        if(!empty($email)) {
            \Mail::send('emails.apply-auto-mail',
            array('email' => $email),
            function($message) use ($email, $firstname, $applicantSubject)
      	    {
                $message->from('noreply@mipinternational.com', 'MIP International Manpower Services Inc.');
                $message->to($email, $firstname)->subject($applicantSubject);
            });
        }
        
        //send email to company
        $companySubject = $firstname.' '.$middlename.' '.$lastname.' - '.$position;
    	\Mail::send('emails.apply-now',
        array(
            // Personal Info
            'position' => $position,
            'country' => $request->get('country'),
            'fname' => $firstname,
            'mname' => $middlename,
            'lname' => $lastname,
            'birthdate' => $request->get('birthdate'),
            'gender' => $request->get('gender'),
            'marital_status' => $request->get('marital_status'), // marital status
            'religon' => $request->get('religon'), // religon
            'provincial_address' => $request->get('provincial_address'), // provincial address
            'present_address' => $request->get('present_address'), // present address
            'telephone' => $request->get('telephone'), 
            'facebook' => $request->get('facebook'), // fb
            'email' => $email,
            'height' => $request->get('height'),
            'weight' => $request->get('weight'),
            'passport' => $request->get('passport'),
            'passportNo' => $request->get('passportNo'),
            'dateIssued' => $request->get('dateIssued'),
            'dateExpired' => $request->get('dateExpired'),
            'uploadPhoto' => $request->get('uploadPhoto'),
            'docfile' => $request->get('docfile'),
            
            // Education 1
            'education_level1' => $request->get('education_level1'),
            'school_university1' => $request->get('school_university1'),
            'course1' => $request->get('course1'),
            'startMonth1' => $request->get('startMonth1'),
            'startYear1' => $request->get('startYear1'),
            'endMonth1' => $request->get('endMonth1'),
            'endYear1' => $request->get('endYear1'),
            
            // Education 2
            'education_level2' => $request->get('education_level2'),
            'school_university2' => $request->get('school_university2'),
            'course2' => $request->get('course2'),
            'startMonth2' => $request->get('startMonth2'),
            'startYear2' => $request->get('startYear2'),
            'endMonth2' => $request->get('endMonth2'),
            'endYear2' => $request->get('endYear2'),
            
            // Education 3
            'education_level3' => $request->get('education_level3'),
            'school_university3' => $request->get('school_university3'),
            'course3' => $request->get('course3'),
            'startMonth3' => $request->get('startMonth3'),
            'startYear3' => $request->get('startYear3'),
            'endMonth3' => $request->get('endMonth3'),
            'endYear3' => $request->get('endYear3'),
            
            // Education 4
            'education_level4' => $request->get('education_level4'),
            'school_university4' => $request->get('school_university4'),
            'course4' => $request->get('course4'),
            'startMonth4' => $request->get('startMonth4'),
            'startYear4' => $request->get('startYear4'),
            'endMonth4' => $request->get('endMonth4'),
            'endYear4' => $request->get('endYear4'),
            
            // Work Experience 1
            'company_name1' => $request->get('company_name1'),
            'step3Position1' => $request->get('step3Position1'),
            'departmentName1' => $request->get('departmentName1'),
            'companyAddress1' => $request->get('companyAddress1'),
            'salaryCurrency1' => $request->get('salaryCurrency1'),
            'salary1' => $request->get('salary1'),
            'jobDescription1' => $request->get('jobDescription1'),
            'employmentStartMonth1' => $request->get('employmentStartMonth1'),
            'employmentStartYear1' => $request->get('employmentStartYear1'),
            'employmentEndMonth1' => $request->get('employmentEndMonth1'),
            'employmentEndYear1' => $request->get('employmentEndYear1'),
            
            // Work Experience 2
            'company_name2' => $request->get('company_name2'),
            'step3Position2' => $request->get('step3Position2'),
            'departmentName2' => $request->get('departmentName2'),
            'companyAddress2' => $request->get('companyAddress2'),
            'salaryCurrency2' => $request->get('salaryCurrency2'),
            'salary2' => $request->get('salary2'),
            'jobDescription2' => $request->get('jobDescription2'),
            'employmentStartMonth2' => $request->get('employmentStartMonth2'),
            'employmentStartYear2' => $request->get('employmentStartYear2'),
            'employmentEndMonth2' => $request->get('employmentEndMonth2'),
            'employmentEndYear2' => $request->get('employmentEndYear2'),
            
            // Work Experience 3
            'company_name3' => $request->get('company_name3'),
            'step3Position3' => $request->get('step3Position3'),
            'departmentName3' => $request->get('departmentName3'),
            'companyAddress3' => $request->get('companyAddress3'),
            'salaryCurrency3' => $request->get('salaryCurrency3'),
            'salary3' => $request->get('salary3'),
            'jobDescription3' => $request->get('jobDescription3'),
            'employmentStartMonth3' => $request->get('employmentStartMonth3'),
            'employmentStartYear3' => $request->get('employmentStartYear3'),
            'employmentEndMonth3' => $request->get('employmentEndMonth3'),
            'employmentEndYear3' => $request->get('employmentEndYear3'),
            
            // Work Experience 4
            'company_name4' => $request->get('company_name4'),
            'step3Position4' => $request->get('step3Position4'),
            'departmentName4' => $request->get('departmentName4'),
            'companyAddress4' => $request->get('companyAddress4'),
            'salaryCurrency4' => $request->get('salaryCurrency4'),
            'salary4' => $request->get('salary4'),
            'jobDescription4' => $request->get('jobDescription4'),
            'employmentStartMonth4' => $request->get('employmentStartMonth4'),
            'employmentStartYear4' => $request->get('employmentStartYear4'),
            'employmentEndMonth4' => $request->get('employmentEndMonth4'),
            'employmentEndYear4' => $request->get('employmentEndYear4'),
            
            // Work Experience 5
            'company_name5' => $request->get('company_name5'),
            'step3Position5' => $request->get('step3Position5'),
            'departmentName5' => $request->get('departmentName5'),
            'companyAddress5' => $request->get('companyAddress5'),
            'salaryCurrency5' => $request->get('salaryCurrency5'),
            'salary5' => $request->get('salary5'),
            'jobDescription5' => $request->get('jobDescription5'),
            'employmentStartMonth5' => $request->get('employmentStartMonth5'),
            'employmentStartYear5' => $request->get('employmentStartYear5'),
            'employmentEndMonth5' => $request->get('employmentEndMonth5'),
            'employmentEndYear5' => $request->get('employmentEndYear5'),
            
            // Work Experience 6
            'company_name6' => $request->get('company_name6'),
            'step3Position6' => $request->get('step3Position6'),
            'departmentName6' => $request->get('departmentName6'),
            'companyAddress6' => $request->get('companyAddress6'),
            'salaryCurrency6' => $request->get('salaryCurrency6'),
            'salary6' => $request->get('salary6'),
            'jobDescription6' => $request->get('jobDescription6'),
            'employmentStartMonth6' => $request->get('employmentStartMonth6'),
            'employmentStartYear6' => $request->get('employmentStartYear6'),
            'employmentEndMonth6' => $request->get('employmentEndMonth6'),
            'employmentEndYear6' => $request->get('employmentEndYear6'),
            
            // Work Experience 7
            'company_name7' => $request->get('company_name7'),
            'step3Position7' => $request->get('step3Position7'),
            'departmentName7' => $request->get('departmentName7'),
            'companyAddress7' => $request->get('companyAddress7'),
            'salaryCurrency7' => $request->get('salaryCurrency7'),
            'salary7' => $request->get('salary7'),
            'jobDescription7' => $request->get('jobDescription7'),
            'employmentStartMonth7' => $request->get('employmentStartMonth7'),
            'employmentStartYear7' => $request->get('employmentStartYear7'),
            'employmentEndMonth7' => $request->get('employmentEndMonth7'),
            'employmentEndYear7' => $request->get('employmentEndYear7'),
            
            // Work Experience 8
            'company_name8' => $request->get('company_name8'),
            'step3Position8' => $request->get('step3Position8'),
            'departmentName8' => $request->get('departmentName8'),
            'companyAddress8' => $request->get('companyAddress8'),
            'salaryCurrency8' => $request->get('salaryCurrency8'),
            'salary8' => $request->get('salary8'),
            'jobDescription8' => $request->get('jobDescription8'),
            'employmentStartMonth8' => $request->get('employmentStartMonth8'),
            'employmentStartYear8' => $request->get('employmentStartYear8'),
            'employmentEndMonth8' => $request->get('employmentEndMonth8'),
            'employmentEndYear8' => $request->get('employmentEndYear8'),
            
            // Work Experience 9
            'company_name9' => $request->get('company_name9'),
            'step3Position9' => $request->get('step3Position9'),
            'departmentName9' => $request->get('departmentName9'),
            'companyAddress9' => $request->get('companyAddress9'),
            'salaryCurrency9' => $request->get('salaryCurrency9'),
            'salary9' => $request->get('salary9'),
            'jobDescription9' => $request->get('jobDescription9'),
            'employmentStartMonth9' => $request->get('employmentStartMonth9'),
            'employmentStartYear9' => $request->get('employmentStartYear9'),
            'employmentEndMonth9' => $request->get('employmentEndMonth9'),
            'employmentEndYear9' => $request->get('employmentEndYear9'),
            
            // Work Experience 10
            'company_name10' => $request->get('company_name10'),
            'step3Position10' => $request->get('step3Position10'),
            'departmentName10' => $request->get('departmentName10'),
            'companyAddress10' => $request->get('companyAddress10'),
            'salaryCurrency10' => $request->get('salaryCurrency10'),
            'salary10' => $request->get('salary10'),
            'jobDescription10' => $request->get('jobDescription10'),
            'employmentStartMonth10' => $request->get('employmentStartMonth10'),
            'employmentStartYear10' => $request->get('employmentStartYear10'),
            'employmentEndMonth10' => $request->get('employmentEndMonth10'),
            'employmentEndYear10' => $request->get('employmentEndYear10'),
            
            // Work Experience 11
            'company_name11' => $request->get('company_name11'),
            'step3Position11' => $request->get('step3Position11'),
            'departmentName11' => $request->get('departmentName11'),
            'companyAddress11' => $request->get('companyAddress11'),
            'salaryCurrency11' => $request->get('salaryCurrency11'),
            'salary11' => $request->get('salary11'),
            'jobDescription11' => $request->get('jobDescription11'),
            'employmentStartMonth11' => $request->get('employmentStartMonth11'),
            'employmentStartYear11' => $request->get('employmentStartYear11'),
            'employmentEndMonth11' => $request->get('employmentEndMonth11'),
            'employmentEndYear11' => $request->get('employmentEndYear11'),
            
            // Work Experience 12
            'company_name12' => $request->get('company_name12'),
            'step3Position12' => $request->get('step3Position12'),
            'departmentName12' => $request->get('departmentName12'),
            'companyAddress12' => $request->get('companyAddress12'),
            'salaryCurrency12' => $request->get('salaryCurrency12'),
            'salary12' => $request->get('salary12'),
            'jobDescription12' => $request->get('jobDescription12'),
            'employmentStartMonth12' => $request->get('employmentStartMonth12'),
            'employmentStartYear12' => $request->get('employmentStartYear12'),
            'employmentEndMonth12' => $request->get('employmentEndMonth12'),
            'employmentEndYear12' => $request->get('employmentEndYear12'),
            
            // Work Experience 13
            'company_name13' => $request->get('company_name13'),
            'step3Position13' => $request->get('step3Position13'),
            'departmentName13' => $request->get('departmentName13'),
            'companyAddress13' => $request->get('companyAddress13'),
            'salaryCurrency13' => $request->get('salaryCurrency13'),
            'salary13' => $request->get('salary13'),
            'jobDescription13' => $request->get('jobDescription13'),
            'employmentStartMonth13' => $request->get('employmentStartMonth13'),
            'employmentStartYear13' => $request->get('employmentStartYear13'),
            'employmentEndMonth13' => $request->get('employmentEndMonth13'),
            'employmentEndYear13' => $request->get('employmentEndYear13'),
            
            // Work Experience 14
            'company_name14' => $request->get('company_name14'),
            'step3Position14' => $request->get('step3Position14'),
            'departmentName14' => $request->get('departmentName14'),
            'companyAddress14' => $request->get('companyAddress14'),
            'salaryCurrency14' => $request->get('salaryCurrency14'),
            'salary14' => $request->get('salary14'),
            'jobDescription14' => $request->get('jobDescription14'),
            'employmentStartMonth14' => $request->get('employmentStartMonth14'),
            'employmentStartYear14' => $request->get('employmentStartYear14'),
            'employmentEndMonth14' => $request->get('employmentEndMonth14'),
            'employmentEndYear14' => $request->get('employmentEndYear14'),
            
            // Work Experience 15
            'company_name15' => $request->get('company_name15'),
            'step3Position15' => $request->get('step3Position15'),
            'departmentName15' => $request->get('departmentName15'),
            'companyAddress15' => $request->get('companyAddress15'),
            'salaryCurrency15' => $request->get('salaryCurrency15'),
            'salary15' => $request->get('salary15'),
            'jobDescription15' => $request->get('jobDescription15'),
            'employmentStartMonth15' => $request->get('employmentStartMonth15'),
            'employmentStartYear15' => $request->get('employmentStartYear15'),
            'employmentEndMonth15' => $request->get('employmentEndMonth15'),
            'employmentEndYear15' => $request->get('employmentEndYear15'),
            
            
            // Taiwan - Factory Worker Position
            'taiwanFactoryExperienceElectronics' => $request->get('taiwanFactoryExperienceElectronics'),
            'taiwanFactoryExperienceSemicon' => $request->get('taiwanFactoryExperienceSemicon'),
            'taiwanFactoryExperienceSoldering' => $request->get('taiwanFactoryExperienceSoldering'),
            'taiwanFactoryExperienceCNC' => $request->get('taiwanFactoryExperienceCNC'),
            'taiwanFactoryExperienceSewer' => $request->get('taiwanFactoryExperienceSewer'),
            'taiwanFactoryFirstTimeAbroad' => $request->get('taiwanFactoryFirstTimeAbroad'),
            'taiwanFactorySmoking' => $request->get('taiwanFactorySmoking'),
            'taiwanFactoryDrinkingAlcohol' => $request->get('taiwanFactoryDrinkingAlcohol'),
            'taiwanFactoryHandSweat' => $request->get('taiwanFactoryHandSweat'),
            'taiwanFactoryEyesight' => $request->get('taiwanFactoryEyesight'),
            
            // Taiwan - Factory Worker Position
            'singaporeNurseOverseasExperience' => $request->get('singaporeNurseOverseasExperience'),
            'singaporeNurseWhatCountry' => $request->get('singaporeNurseWhatCountry'),
            'singaporeNurseNameEmployer' => $request->get('singaporeNurseNameEmployer'),
            'singaporeNurseBedCapacity' => $request->get('singaporeNurseBedCapacity'),
            'singaporeNurseAreaExposure' => $request->get('singaporeNurseAreaExposure'),
            'singaporeNursePosition' => $request->get('singaporeNursePosition'),
            
            // Domestic Helper
            'domesticHelperOverseasExperience' => $request->get('domesticHelperOverseasExperience'),
            'domesticHelperWorkingPeriod' => $request->get('domesticHelperWorkingPeriod'),
            'domesticHelperLeaving' => $request->get('domesticHelperLeaving'),
            'domesticHelperTakingCareBabies' => $request->get('domesticHelperTakingCareBabies'),
            'domesticHelperTakingCareAges' => $request->get('domesticHelperTakingCareAges'),
            'domesticHelperCook' => $request->get('domesticHelperCook'),
            
            // Korea Performing Arts
            'koreaPerformingArtsSinger' => $request->get('koreaPerformingArtsSinger'),
            'koreaPerformingArtsPosition' => $request->get('koreaPerformingArtsPosition'),
            'koreaPerformingArtsWorkingPeriod' => $request->get('koreaPerformingArtsWorkingPeriod'),
            
            // China English Teacher
            'chinaEnglishTeacherExperience' => $request->get('chinaEnglishTeacherExperience'),
            'chinaEnglishTeacherArtsPosition' => $request->get('chinaEnglishTeacherArtsPosition'),
            'chinaEnglishTeacherWorkingPeriod' => $request->get('chinaEnglishTeacherWorkingPeriod')
            

        ), function($message) use ($request, $companySubject, $singaporeCountryID, $taiwanCountryID, $selectedCountryID, $appliyingForCTPosition)
  	    {
            $to_email = "mip.intlmanpowerservices@gmail.com";
            if($selectedCountryID == $singaporeCountryID) $to_email = "applycvs.singapore@gmail.com";
            if($selectedCountryID == $taiwanCountryID) $to_email = "applycvs.taiwan@gmail.com";
            if($appliyingForCTPosition == 1) {
                  if(($selectedCountryID == $taiwanCountryID) || ($selectedCountryID == $singaporeCountryID)) {
                     $to_email = "applycvs.dhct@gmail.com";
                  }
            }

            /*$to_email = "danilo@quantumx.com";
            if($selectedCountryID == $singaporeCountryID) $to_email = "jayson@quantumx.com";
            if($selectedCountryID == $taiwanCountryID) $to_email = "christinejoy@quantumx.com";
            if($appliyingForCTPosition == 1) {
                  if(($selectedCountryID == $taiwanCountryID) || ($selectedCountryID == $singaporeCountryID)) {
                     $to_email = "jude@quantumx.com";
                  }
            }*/

            $message->from('noreply@mipinternational.com', 'MIP Website Application');
            $message->to([$to_email])->subject($companySubject);
            //$message->to(['danilo@quantumx.com'])->subject($companySubject);
            //$message->to(['jovylou@quantumx.com'])->subject($companySubject);
            
            if(!empty($request['uploadPhoto'])){
                $message->attach($request['uploadPhoto']->getRealPath(), array(
                    'as'=>$request['uploadPhoto']->getClientOriginalName(),
                    'mime' => $request['uploadPhoto']->getMimeType())
                );
            }
            
            if(!empty($request['docfile'])){
                    $message->attach($request['docfile']->getRealPath(), array(
                    'as'=>$request['docfile']->getClientOriginalName(),
                    'mime' => $request['docfile']->getMimeType())
                );
            }
            
        });//end
        
    	return \Redirect::route('applynow')
            ->with('message', 'Message Sent. Thanks for applying to us!')->with('questionWith', $questionWith);
        
    } // function end
}Http/Controllers/Website/GeneralApplicationController.php000066400000042733152434100730017723 0ustar00<?php

namespace QxCMS\Http\Controllers\Website;

use Illuminate\Http\Request;
use QxCMS\Http\Requests\ApplyNowFormRequest; //
use QxCMS\Http\Controllers\Controller;

use DB;

class GeneralApplicationController extends Controller
{
    public function create()
    {
        return view('website.general-application');
    }
    
    
    public function store(ApplyNowFormRequest $request)
    {
        $questionWith = $request->get('questionWith');
        $firstname = $request->get('fname');
        $middlename = $request->get('mname');
        $lastname = $request->get('lname');
        $position = ucwords(strtolower($request->get('position')));
        $email = $request->get('email');
        
        //send email to applicant
        $applicantSubject = $position. ' | General Application';
        if(!empty($email)) {
            \Mail::send('emails.apply-auto-mail',
            array('email' => $email),
            function($message) use ($email, $firstname, $applicantSubject)
      	    {
                $message->from('noreply@mipinternational.com', 'MIP International Manpower Services Inc.');
                $message->to($email, $firstname)->subject($applicantSubject);
            });
        }
        
        //send email to company
        $companySubject = $firstname.' '.$middlename.' '.$lastname.' - '.$position;
    	\Mail::send('emails.general-application',
        array(
            // Personal Info
            'position' => $position,
            'country' => $request->get('country'),
            'fname' => $firstname,
            'mname' => $middlename,
            'lname' => $lastname,
            'birthdate' => $request->get('birthdate'),
            'gender' => $request->get('gender'),
            'marital_status' => $request->get('marital_status'), // marital status
            'religon' => $request->get('religon'), // religon
            'provincial_address' => $request->get('provincial_address'), // provincial address
            'present_address' => $request->get('present_address'), // present address
            'telephone' => $request->get('telephone'),
            'facebook' => $request->get('facebook'), // fb
            'email' => $email,
            'height' => $request->get('height'),
            'weight' => $request->get('weight'),
            'passport' => $request->get('passport'),
            'passportNo' => $request->get('passportNo'),
            'dateIssued' => $request->get('dateIssued'),
            'dateExpired' => $request->get('dateExpired'),
            'uploadPhoto' => $request->get('uploadPhoto'),
            'docfile' => $request->get('docfile'),
            
            // Education 1
            'education_level1' => $request->get('education_level1'),
            'school_university1' => $request->get('school_university1'),
            'course1' => $request->get('course1'),
            'startMonth1' => $request->get('startMonth1'),
            'startYear1' => $request->get('startYear1'),
            'endMonth1' => $request->get('endMonth1'),
            'endYear1' => $request->get('endYear1'),
            
            // Education 2
            'education_level2' => $request->get('education_level2'),
            'school_university2' => $request->get('school_university2'),
            'course2' => $request->get('course2'),
            'startMonth2' => $request->get('startMonth2'),
            'startYear2' => $request->get('startYear2'),
            'endMonth2' => $request->get('endMonth2'),
            'endYear2' => $request->get('endYear2'),
            
            // Education 3
            'education_level3' => $request->get('education_level3'),
            'school_university3' => $request->get('school_university3'),
            'course3' => $request->get('course3'),
            'startMonth3' => $request->get('startMonth3'),
            'startYear3' => $request->get('startYear3'),
            'endMonth3' => $request->get('endMonth3'),
            'endYear3' => $request->get('endYear3'),
            
            // Education 4
            'education_level4' => $request->get('education_level4'),
            'school_university4' => $request->get('school_university4'),
            'course4' => $request->get('course4'),
            'startMonth4' => $request->get('startMonth4'),
            'startYear4' => $request->get('startYear4'),
            'endMonth4' => $request->get('endMonth4'),
            'endYear4' => $request->get('endYear4'),
            
            // Work Experience 1
            'company_name1' => $request->get('company_name1'),
            'step3Position1' => $request->get('step3Position1'),
            'departmentName1' => $request->get('departmentName1'),
            'companyAddress1' => $request->get('companyAddress1'),
            'salaryCurrency1' => $request->get('salaryCurrency1'),
            'salary1' => $request->get('salary1'),
            'jobDescription1' => $request->get('jobDescription1'),
            'employmentStartMonth1' => $request->get('employmentStartMonth1'),
            'employmentStartYear1' => $request->get('employmentStartYear1'),
            'employmentEndMonth1' => $request->get('employmentEndMonth1'),
            'employmentEndYear1' => $request->get('employmentEndYear1'),
            
            // Work Experience 2
            'company_name2' => $request->get('company_name2'),
            'step3Position2' => $request->get('step3Position2'),
            'departmentName2' => $request->get('departmentName2'),
            'companyAddress2' => $request->get('companyAddress2'),
            'salaryCurrency2' => $request->get('salaryCurrency2'),
            'salary2' => $request->get('salary2'),
            'jobDescription2' => $request->get('jobDescription2'),
            'employmentStartMonth2' => $request->get('employmentStartMonth2'),
            'employmentStartYear2' => $request->get('employmentStartYear2'),
            'employmentEndMonth2' => $request->get('employmentEndMonth2'),
            'employmentEndYear2' => $request->get('employmentEndYear2'),
            
            // Work Experience 3
            'company_name3' => $request->get('company_name3'),
            'step3Position3' => $request->get('step3Position3'),
            'departmentName3' => $request->get('departmentName3'),
            'companyAddress3' => $request->get('companyAddress3'),
            'salaryCurrency3' => $request->get('salaryCurrency3'),
            'salary3' => $request->get('salary3'),
            'jobDescription3' => $request->get('jobDescription3'),
            'employmentStartMonth3' => $request->get('employmentStartMonth3'),
            'employmentStartYear3' => $request->get('employmentStartYear3'),
            'employmentEndMonth3' => $request->get('employmentEndMonth3'),
            'employmentEndYear3' => $request->get('employmentEndYear3'),
            
            // Work Experience 4
            'company_name4' => $request->get('company_name4'),
            'step3Position4' => $request->get('step3Position4'),
            'departmentName4' => $request->get('departmentName4'),
            'companyAddress4' => $request->get('companyAddress4'),
            'salaryCurrency4' => $request->get('salaryCurrency4'),
            'salary4' => $request->get('salary4'),
            'jobDescription4' => $request->get('jobDescription4'),
            'employmentStartMonth4' => $request->get('employmentStartMonth4'),
            'employmentStartYear4' => $request->get('employmentStartYear4'),
            'employmentEndMonth4' => $request->get('employmentEndMonth4'),
            'employmentEndYear4' => $request->get('employmentEndYear4'),
            
            // Work Experience 5
            'company_name5' => $request->get('company_name5'),
            'step3Position5' => $request->get('step3Position5'),
            'departmentName5' => $request->get('departmentName5'),
            'companyAddress5' => $request->get('companyAddress5'),
            'salaryCurrency5' => $request->get('salaryCurrency5'),
            'salary5' => $request->get('salary5'),
            'jobDescription5' => $request->get('jobDescription5'),
            'employmentStartMonth5' => $request->get('employmentStartMonth5'),
            'employmentStartYear5' => $request->get('employmentStartYear5'),
            'employmentEndMonth5' => $request->get('employmentEndMonth5'),
            'employmentEndYear5' => $request->get('employmentEndYear5'),
            
            // Work Experience 6
            'company_name6' => $request->get('company_name6'),
            'step3Position6' => $request->get('step3Position6'),
            'departmentName6' => $request->get('departmentName6'),
            'companyAddress6' => $request->get('companyAddress6'),
            'salaryCurrency6' => $request->get('salaryCurrency6'),
            'salary6' => $request->get('salary6'),
            'jobDescription6' => $request->get('jobDescription6'),
            'employmentStartMonth6' => $request->get('employmentStartMonth6'),
            'employmentStartYear6' => $request->get('employmentStartYear6'),
            'employmentEndMonth6' => $request->get('employmentEndMonth6'),
            'employmentEndYear6' => $request->get('employmentEndYear6'),
            
            // Work Experience 7
            'company_name7' => $request->get('company_name7'),
            'step3Position7' => $request->get('step3Position7'),
            'departmentName7' => $request->get('departmentName7'),
            'companyAddress7' => $request->get('companyAddress7'),
            'salaryCurrency7' => $request->get('salaryCurrency7'),
            'salary7' => $request->get('salary7'),
            'jobDescription7' => $request->get('jobDescription7'),
            'employmentStartMonth7' => $request->get('employmentStartMonth7'),
            'employmentStartYear7' => $request->get('employmentStartYear7'),
            'employmentEndMonth7' => $request->get('employmentEndMonth7'),
            'employmentEndYear7' => $request->get('employmentEndYear7'),
            
            // Work Experience 8
            'company_name8' => $request->get('company_name8'),
            'step3Position8' => $request->get('step3Position8'),
            'departmentName8' => $request->get('departmentName8'),
            'companyAddress8' => $request->get('companyAddress8'),
            'salaryCurrency8' => $request->get('salaryCurrency8'),
            'salary8' => $request->get('salary8'),
            'jobDescription8' => $request->get('jobDescription8'),
            'employmentStartMonth8' => $request->get('employmentStartMonth8'),
            'employmentStartYear8' => $request->get('employmentStartYear8'),
            'employmentEndMonth8' => $request->get('employmentEndMonth8'),
            'employmentEndYear8' => $request->get('employmentEndYear8'),
            
            // Work Experience 9
            'company_name9' => $request->get('company_name9'),
            'step3Position9' => $request->get('step3Position9'),
            'departmentName9' => $request->get('departmentName9'),
            'companyAddress9' => $request->get('companyAddress9'),
            'salaryCurrency9' => $request->get('salaryCurrency9'),
            'salary9' => $request->get('salary9'),
            'jobDescription9' => $request->get('jobDescription9'),
            'employmentStartMonth9' => $request->get('employmentStartMonth9'),
            'employmentStartYear9' => $request->get('employmentStartYear9'),
            'employmentEndMonth9' => $request->get('employmentEndMonth9'),
            'employmentEndYear9' => $request->get('employmentEndYear9'),
            
            // Work Experience 10
            'company_name10' => $request->get('company_name10'),
            'step3Position10' => $request->get('step3Position10'),
            'departmentName10' => $request->get('departmentName10'),
            'companyAddress10' => $request->get('companyAddress10'),
            'salaryCurrency10' => $request->get('salaryCurrency10'),
            'salary10' => $request->get('salary10'),
            'jobDescription10' => $request->get('jobDescription10'),
            'employmentStartMonth10' => $request->get('employmentStartMonth10'),
            'employmentStartYear10' => $request->get('employmentStartYear10'),
            'employmentEndMonth10' => $request->get('employmentEndMonth10'),
            'employmentEndYear10' => $request->get('employmentEndYear10'),
            
            // Work Experience 11
            'company_name11' => $request->get('company_name11'),
            'step3Position11' => $request->get('step3Position11'),
            'departmentName11' => $request->get('departmentName11'),
            'companyAddress11' => $request->get('companyAddress11'),
            'salaryCurrency11' => $request->get('salaryCurrency11'),
            'salary11' => $request->get('salary11'),
            'jobDescription11' => $request->get('jobDescription11'),
            'employmentStartMonth11' => $request->get('employmentStartMonth11'),
            'employmentStartYear11' => $request->get('employmentStartYear11'),
            'employmentEndMonth11' => $request->get('employmentEndMonth11'),
            'employmentEndYear11' => $request->get('employmentEndYear11'),
            
            // Work Experience 12
            'company_name12' => $request->get('company_name12'),
            'step3Position12' => $request->get('step3Position12'),
            'departmentName12' => $request->get('departmentName12'),
            'companyAddress12' => $request->get('companyAddress12'),
            'salaryCurrency12' => $request->get('salaryCurrency12'),
            'salary12' => $request->get('salary12'),
            'jobDescription12' => $request->get('jobDescription12'),
            'employmentStartMonth12' => $request->get('employmentStartMonth12'),
            'employmentStartYear12' => $request->get('employmentStartYear12'),
            'employmentEndMonth12' => $request->get('employmentEndMonth12'),
            'employmentEndYear12' => $request->get('employmentEndYear12'),
            
            // Work Experience 13
            'company_name13' => $request->get('company_name13'),
            'step3Position13' => $request->get('step3Position13'),
            'departmentName13' => $request->get('departmentName13'),
            'companyAddress13' => $request->get('companyAddress13'),
            'salaryCurrency13' => $request->get('salaryCurrency13'),
            'salary13' => $request->get('salary13'),
            'jobDescription13' => $request->get('jobDescription13'),
            'employmentStartMonth13' => $request->get('employmentStartMonth13'),
            'employmentStartYear13' => $request->get('employmentStartYear13'),
            'employmentEndMonth13' => $request->get('employmentEndMonth13'),
            'employmentEndYear13' => $request->get('employmentEndYear13'),
            
            // Work Experience 14
            'company_name14' => $request->get('company_name14'),
            'step3Position14' => $request->get('step3Position14'),
            'departmentName14' => $request->get('departmentName14'),
            'companyAddress14' => $request->get('companyAddress14'),
            'salaryCurrency14' => $request->get('salaryCurrency14'),
            'salary14' => $request->get('salary14'),
            'jobDescription14' => $request->get('jobDescription14'),
            'employmentStartMonth14' => $request->get('employmentStartMonth14'),
            'employmentStartYear14' => $request->get('employmentStartYear14'),
            'employmentEndMonth14' => $request->get('employmentEndMonth14'),
            'employmentEndYear14' => $request->get('employmentEndYear14'),
            
            // Work Experience 15
            'company_name15' => $request->get('company_name15'),
            'step3Position15' => $request->get('step3Position15'),
            'departmentName15' => $request->get('departmentName15'),
            'companyAddress15' => $request->get('companyAddress15'),
            'salaryCurrency15' => $request->get('salaryCurrency15'),
            'salary15' => $request->get('salary15'),
            'jobDescription15' => $request->get('jobDescription15'),
            'employmentStartMonth15' => $request->get('employmentStartMonth15'),
            'employmentStartYear15' => $request->get('employmentStartYear15'),
            'employmentEndMonth15' => $request->get('employmentEndMonth15'),
            'employmentEndYear15' => $request->get('employmentEndYear15')
            
        ), function($message) use ($request, $companySubject)
  	    {
            $message->from('noreply@mipinternational.com', 'MIP General Application');
            $message->to(['mip.intlmanpowerservices@gmail.com'])->subject($companySubject);
            //$message->to(['jovylou@quantumx.com', 'christinejoy@quantumx.com'])->subject($companySubject);
            //$message->to(['jovylou@quantumx.com'])->subject($companySubject);
            
            if(!empty($request['uploadPhoto'])){
                $message->attach($request['uploadPhoto']->getRealPath(), array(
                    'as'=>$request['uploadPhoto']->getClientOriginalName(),
                    'mime' => $request['uploadPhoto']->getMimeType())
                );
            }
            
            if(!empty($request['docfile'])){
                    $message->attach($request['docfile']->getRealPath(), array(
                    'as'=>$request['docfile']->getClientOriginalName(),
                    'mime' => $request['docfile']->getMimeType())
                );
            }
            
        });
        
    	return \Redirect::route('applygeneral')
            ->with('message', 'Message Sent. Thanks for applying to us!')->with('questionWith', $questionWith);
        
    } // function end
    
} // class end
Http/Controllers/Auth/ForgotPasswordController.php000066400000000556152434100730016441 0ustar00<?php

namespace QxCMS\Http\Controllers\Auth;

use QxCMS\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use QxCMS\Modules\Likod\Models\Clients\User;

class ForgotPasswordController extends Controller
{

    use SendsPasswordResetEmails;

    public function __construct()
    {
        $this->middleware('guest');
    }
    
}
Http/Controllers/Auth/LoginController.php000066400000001671152434100730014525 0ustar00<?php

namespace QxCMS\Http\Controllers\Auth;

use QxCMS\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

class LoginController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles authenticating users for the application and
    | redirecting them to your home screen. The controller uses a trait
    | to conveniently provide its functionality to your applications.
    |
    */

    use AuthenticatesUsers;

    /**
     * Where to redirect users after login.
     *
     * @var string
     */
    protected $redirectTo = '/home';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest', ['except' => 'logout']);
    }
}
Http/Controllers/Auth/RegisterController.php000066400000003405152434100730015236 0ustar00<?php

namespace QxCMS\Http\Controllers\Auth;

use QxCMS\User;
use QxCMS\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;

class RegisterController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Register Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users as well as their
    | validation and creation. By default this controller uses a trait to
    | provide this functionality without requiring any additional code.
    |
    */

    use RegistersUsers;

    /**
     * Where to redirect users after registration.
     *
     * @var string
     */
    protected $redirectTo = '/home';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest');
    }

    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => 'required|max:255',
            'email' => 'required|email|max:255|unique:users',
            'password' => 'required|min:6|confirmed',
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return User
     */
    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
        ]);
    }
}
Http/Controllers/Auth/ResetPasswordController.php000066400000001711152434100730016255 0ustar00<?php

namespace QxCMS\Http\Controllers\Auth;

use QxCMS\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;

class ResetPasswordController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Password Reset Controller
    |--------------------------------------------------------------------------
    |
    | This controller is responsible for handling password reset requests
    | and uses a simple trait to include this behavior. You're free to
    | explore this trait and override any methods you wish to tweak.
    |
    */

    use ResetsPasswords;

    /**
     * Where to redirect users after resetting their password.
     *
     * @var string
     */
    protected $redirectTo = '/client/auth/login';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest');
    }
}
Http/Controllers/Controller.php000064400000001607152434100730012630 0ustar00<?php

namespace QxCMS\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use QxCMS\Modules\Likod\Models\Developer\ClientModule;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public function getDetails($module_id)
    {
        $module = ClientModule::where('id', $module_id)->first();
        return view()->share([
        	'pageTitle' => (isset($module->title)) ? $module->title : '',
            'pageIcon'=> (isset($module->title)) ? $module->icon : '',
            'pageDescription' => (isset($module->title)) ? $module->module_description : '',
            'pageModuleName' => (isset($module->title)) ? $module->module_name : '',
        ]);
    }
}
Http/Kernel.php000066400000004512152434100730007417 0ustar00<?php

namespace QxCMS\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    /**
     * The application's global HTTP middleware stack.
     *
     * These middleware are run during every request to your application.
     *
     * @var array
     */
    protected $middleware = [
        \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
    ];

    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
        'web' => [
            \QxCMS\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \QxCMS\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],

        'api' => [
            'throttle:60,1',
            'bindings',
        ],
    ];

    /**
     * The application's route middleware.
     *
     * These middleware may be assigned to groups or used individually.
     *
     * @var array
     */
    protected $routeMiddleware = [
        'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
        'can' => \Illuminate\Auth\Middleware\Authorize::class,
        'guest' => \QxCMS\Http\Middleware\RedirectIfAuthenticated::class,
        'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
        'auth.likod' => \QxCMS\Modules\Likod\Middleware\Authenticate::class,
        'guest.likod' => \QxCMS\Modules\Likod\Middleware\RedirectIfAuthenticated::class,
        'auth.client' => \QxCMS\Modules\Client\Middleware\Authenticate::class,
        'guest.client' => \QxCMS\Modules\Client\Middleware\RedirectIfAuthenticated::class,
        'auth.employer' => \QxCMS\Modules\Employer\Middleware\Authenticate::class,
        'guest.employer' => \QxCMS\Modules\Employer\Middleware\RedirectIfAuthenticated::class,
        'guest.kiosk' => \QxCMS\Modules\Kiosk\Middleware\RedirectIfAuthenticated::class,
        'cors' => \QxCMS\Modules\Api\Middleware\Cors::class
    ];
}
Http/Requests/ManpowerFormRequest.php000066400000001320152434100730013771 0ustar00<?php

namespace QxCMS\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ManpowerFormRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'business_name' => 'required',
            'address' => 'required',
            'telephone' => 'required',
            'email' => 'required|email',
            'contact_person' => 'required',
            'position' => 'required'
        ];
    }
}
Http/Requests/ApplyNowFormRequest.php000066400000001227152434100730013760 0ustar00<?php

namespace QxCMS\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ApplyNowFormRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'position' => 'required',
            'fname' => 'required',
            'mname' => 'required',
            'lname' => 'required',  
            'birthdate' => 'required',
        ];
    }
}
Http/Requests/ContactFormRequest.php000066400000001116152434100730013577 0ustar00<?php

namespace QxCMS\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ContactFormRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required',
            'email' => 'required|email',
            'message' => 'required',
        ];
    }
}
Models/Countries.php000066400000000255152434100730010456 0ustar00<?php

namespace QxCMS\Models;

use Illuminate\Database\Eloquent\Model;

class Countries extends Model
{

	protected $connection = 'client';
	public $table = 'countries';
}
Handlers/LfmConfigHandler.php000064400000000307152434100730012156 0ustar00<?php

namespace App\Handlers;

class LfmConfigHandler extends \UniSharp\LaravelFilemanager\Handlers\ConfigHandler
{
    public function userField()
    {
        return parent::userField();
    }
}
Console/Kernel.php000066400000001465152434100730010106 0ustar00<?php

namespace QxCMS\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        //
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')
        //          ->hourly();
    }

    /**
     * Register the Closure based commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        require base_path('routes/console.php');
    }
}
Providers/BroadcastServiceProvider.php000066400000001041152434100730014165 0ustar00<?php

namespace QxCMS\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Broadcast;

class BroadcastServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Broadcast::routes();

        /*
         * Authenticate the user's personal channel...
         */
        Broadcast::channel('App.User.*', function ($user, $userId) {
            return (int) $user->id === (int) $userId;
        });
    }
}
Providers/AuthServiceProvider.php000066400000001175152434100730013174 0ustar00<?php

namespace QxCMS\Providers;

use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;

class AuthServiceProvider extends ServiceProvider
{
    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        'QxCMS\Modules\Client\Models\Settings\Roles\Permission' => 'QxCMS\Modules\Client\Policies\RolePolicy',
    ];

    /**
     * Register any authentication / authorization services.
     *
     * @return void
     */
    public function boot()
    {
        $this->registerPolicies();

        //
    }
}
Providers/EventServiceProvider.php000066400000001136152434100730013351 0ustar00<?php

namespace QxCMS\Providers;

use Illuminate\Support\Facades\Event;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;

class EventServiceProvider extends ServiceProvider
{
    /**
     * The event listener mappings for the application.
     *
     * @var array
     */
    protected $listen = [
        'QxCMS\Events\SomeEvent' => [
            'QxCMS\Listeners\EventListener',
        ],
    ];

    /**
     * Register any events for your application.
     *
     * @return void
     */
    public function boot()
    {
        parent::boot();

        //
    }
}
Providers/AppServiceProvider.php000066400000001560152434100730013011 0ustar00<?php

namespace QxCMS\Providers;

use Validator;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Validator::extend('greater_than_field', function($attribute, $value, $parameters, $validator) {
            $min_field = $parameters[0];
            $data = $validator->getData();
            $min_value = $data[$min_field];
            return $value > $min_value;
        });   

        Validator::replacer('greater_than_field', function($message, $attribute, $rule, $parameters) {
            return str_replace(':field', $parameters[0], $message);
        });
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}
Providers/RouteServiceProvider.php000066400000003211152434100730013362 0ustar00<?php

namespace QxCMS\Providers;

use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;

class RouteServiceProvider extends ServiceProvider
{
    /**
     * This namespace is applied to your controller routes.
     *
     * In addition, it is set as the URL generator's root namespace.
     *
     * @var string
     */
    protected $namespace = 'QxCMS\Http\Controllers';

    /**
     * Define your route model bindings, pattern filters, etc.
     *
     * @return void
     */
    public function boot()
    {
        //

        parent::boot();
    }

    /**
     * Define the routes for the application.
     *
     * @return void
     */
    public function map()
    {
        $this->mapApiRoutes();

        $this->mapWebRoutes();

        //
    }

    /**
     * Define the "web" routes for the application.
     *
     * These routes all receive session state, CSRF protection, etc.
     *
     * @return void
     */
    protected function mapWebRoutes()
    {
        Route::group([
            'middleware' => 'web',
            'namespace' => $this->namespace,
        ], function ($router) {
            require base_path('routes/web.php');
        });
    }

    /**
     * Define the "api" routes for the application.
     *
     * These routes are typically stateless.
     *
     * @return void
     */
    protected function mapApiRoutes()
    {
        Route::group([
            'middleware' => 'api',
            'namespace' => $this->namespace,
            'prefix' => 'api',
        ], function ($router) {
            require base_path('routes/api.php');
        });
    }
}
Modules/EmployerServiceProvider.php000066400000003342152434100730013520 0ustar00<?php

namespace QxCMS\Modules;

use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;

class EmployerServiceProvider extends ServiceProvider
{

    protected $namespace = 'QxCMS\Modules';

    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot(Router $router)
    {
        $modules = config('modules.modules');
        array_filter($modules, function($module) use ($router) {
            if($module=='Employer')
            {
                $this->registerModuleRoute($router, $module);
                $this->registerModuleView($module);
            }
        });
        /*\DB::listen(function($sql) {
            var_dump($sql);
        });*/
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->setEmployerInterface();
        $this->mergeConfigFrom(
            __DIR__.'/tables.php', 'tables'
        );
    }

    public function registerModuleView($module)
    {
        return $this->loadViewsFrom(__DIR__."/$module/Views", $module);
    }

    public function registerModuleRoute($router, $module)
    {
        $router->group([
            'namespace' => $this->namespace.'\\'.$module.'\\'.'Controllers',
            'middleware' => 'web',
            'prefix' => strtolower($module)
        ], function ($router) use ($module) {
                require __DIR__."/$module/routes.php";
        });
    }
    
    public function setEmployerInterface()
    {
        /*$this->app->bind(
            \QxCMS\Modules\Client\Repositories\Settings\Roles\RoleRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Settings\Roles\RoleRepository::class
        );*/
    }
}
Modules/helpers.php000064400000010500152434100730010322 0ustar00<?php
use Hashids\Hashids;
use Illuminate\Support\Str;
function str_random($data) {
    return Str::random($data);
}

function get_website_assets($file_path = "")
{
    $path = config('website.path');
    return url($path.'/'.$file_path);
}

function get_template($file_path = "")
{
    $path = config('template.path');
    $name = config('template.name');
    return url($path.'/'.$name.'/'.$file_path);
}

function hashid($id = 0)
{
    $hashids = new Hashids();
    $id = $hashids->encode($id);
    return $id;
}

function decode($hashid = "")
{
    if($hashid <> "")
    {
        $hashids = new Hashids();
        $ids = $hashids->decode($hashid);
        if(isset($ids[0])) return $ids[0];
    }
    return;   
}

function yearArray($start_year = 2010)
{
    $years = array();
    $end_year = (int) Carbon\Carbon::now()->format('Y');
    while($end_year >= $start_year)  {
        $years[$end_year] = $end_year;
        $end_year--;
    }
   
    return $years;
}

function getYear($personal_id)
{
    return substr($personal_id, 0,4);
}

function lists($datas = array())
{
    $rows = array();
    if(!empty($datas)) {
        foreach ($datas as $data_key => $data) {
           $rows[$data] = $data;
        }
    }
    return $rows;
}

function format_date($sqldate = '0000-00-00', $format = null, $datetype = 'single', $guard = 'client') {
    if(empty($format) || $format == null) $dateformats = auth($guard)->user()->client->date_picker_display;
    else $dateformats = array('php' => $format);
    if($datetype == 'single' || $datetype == null) {
        if($sqldate <> '0000-00-00' && !empty($sqldate)) return Carbon\Carbon::parse($sqldate)->format($dateformats['php']);
    } else if($datetype=='range'){
        $date = explode('-', preg_replace('/\s+/', '', $sqldate));
        if(isset($date[0]) && isset($date[1])) {
            $from = Carbon\Carbon::parse($date[0])->format($dateformats['php']);
            $to = Carbon\Carbon::parse($date[1])->format($dateformats['php']);

            if($from == $to) return $from;
            return $from. ' to '. $to;
        }
    }
    return '';
}

function get_applicant_attachment($personal_id = 0, $file = "", $guard = 'client')
{
    $client = auth($guard)->user()->client;
    if(!empty($file) && $personal_id != 0) {
        if($client->storage_type == "public") {
            return url(\Storage::disk($client->storage_type)->url($client->root_dir.'/attachments/'.getYear($personal_id).'/'.$personal_id.'/'.$file));
        }
        if($client->storage_type == "s3") {
            return \Storage::disk($client->storage_type)->url($client->root_dir.'/attachments/'.getYear($personal_id).'/'.$personal_id.'/'.$file);
        }
    }
}

function get_extension($file = "")
{
    if($file != "") {
        $chunks = explode('.', $file);
        return strtolower(end($chunks));
    }
    return '';
}

function getDateFormatConfig($method = 'get')
{
    /*
       Form Accessor and Mutator
       use for adding or updating dates
    */
    if(in_array(strtolower($method), array('form','set'))) {
        $dateformats = config('account.dateformat.'.config('account.dateformat.default'));
    }

    /*
       Laravel built-in Accessor
       use for displaying dates
    */
    if(in_array(strtolower($method), array('get'))){
       $dateformats = config('account.displaydateformat.'.config('account.displaydateformat.default'));
    }

    return $dateformats;

}

function get_link($file_path = '')
{
    if(auth()->check()) {
        $client = auth()->user()->client;
        if(!empty($file_path)) {
            $storage_type = $client->storage_type;

            $url = Storage::disk($storage_type)->url($client->root_dir.'/'.$file_path);
            if($storage_type == "public") {
                return url($url);
            }

            if($storage_type == "s3") {
                return $url;
            }
            
        }
    }
}

function get_photo_link($filename = '', $thumbs = false)
{
   if(!empty($filename)){
        $url = '/photos/'.env('CLIENT_ROOT_DIR').'/shares/'.(($thumbs) ? 'thumbs/':'').$filename;
        if(file_exists($url)){
            return $url;
        }
        
       return $url = '/photos/'.env('CLIENT_ROOT_DIR').'/shares/'.$filename;
    }

    return '';
}


function remove_script_tags($text) 
{ 
    $text = preg_replace("/(\<script)(.*?)(script>)/si", "", "$text"); 
    return $text; 
}  Modules/tables.php000066400000011715152434100730010145 0ustar00<?php

    return [
        'nationalities' => [
            "Afghan",
            "Albanian",
            "Algerian",
            "Andorran",
            "Angolan",
            "Argentine",
            "Armenian",
            "Australian",
            "Austrian",
            "Azerbaijani",
            "Bahamian",
            "Bahraini",
            "Bangladeshi",
            "Barbadian",
            "Belarusian",
            "Belgian",
            "Belizean",
            "Beninese",
            "Bhutanese",
            "Bolivian",
            "Bosnian",
            "Batswana",
            "Brazilian",
            "Bruneian",
            "Bulgarian",
            "Burkinabe",
            "Burmese",
            "Burundian",
            "Cambodian",
            "Cameroonian",
            "Canadian",
            "Cape Verdean",
            "Chadian",
            "Chilean",
            "Chinese",
            "Colombian",
            "Comoran",
            "Congolese",
            "Costa Rican",
            "Croatian",
            "Cuban",
            "Cypriot",
            "Czech",
            "Dane",
            "Djiboutian",
            "Dominican",
            "Dominican",
            "East Timorese",
            "Ecuadorian",
            "Egyptian",
            "Salvadorean",
            "English",
            "Eritrean",
            "Estonian",
            "Ethiopian",
            "Fijian",
            "Finn",
            "French",
            "Gabonese",
            "Gambian",
            "Georgian",
            "German",
            "Ghanaian",
            "Greek",
            "Grenadian",
            "Guatemalan",
            "Guinean",
            "Guyanese",
            "Haitian",
            "Honduran",
            "Hungarian",
            "Icelander",
            "Indian",
            "Indonesian",
            "Iranian",
            "Iraqi",
            "Irish",
            "Israeli",
            "Italian",
            "Ivorian",
            "Jamaican",
            "Japanese",
            "Jordanian",
            "Kazakh",
            "Kenyan",
            "Korean",
            "Kuwaiti",
            "Laotian",
            "Latvian",
            "Lebanese",
            "Liberian",
            "Libyan",
            "Liechtensteiner",
            "Lithuanian",
            "Luxembourger",
            "Macedonian",
            "Malagasy",
            "Malawian",
            "Malaysian",
            "Maldivian",
            "Malian",
            "Maltese",
            "Mauritanian",
            "Mauritian",
            "Mexican",
            "Moldovan",
            "Monacan",
            "Mongolian",
            "Montenegrin",
            "Moroccan",
            "Mozambican",
            "Namibian",
            "Nepalese",
            "Dutch",
            "New Zealander",
            "Nicaraguan",
            "Nigerien",
            "Nigerian",
            "Norwegian",
            "Omani",
            "Pakistani",
            "Panamanian",
            "Papua New Guinean",
            "Paraguayan",
            "Peruvian",
            "Filipino",
            "Pole",
            "Portuguese",
            "Qatari",
            "Romanian",
            "Russian",
            "Rwandan",
            "Saudi",
            "Scot",
            "Senegalese",
            "Serb",
            "Seychellois",
            "Sierra Leonian",
            "Singaporean",
            "Slovak",
            "Slovene",
            "Solomon Islander",
            "Somali",
            "South African",
            "Spaniard",
            "Sri Lankan",
            "Sudanese",
            "Surinamese",
            "Swazi",
            "Swede",
            "Swiss",
            "Syrian",
            "Taiwanese",
            "Tajik or Tadjik",
            "Tanzanian",
            "Thai",
            "Togolese",
            "Trinidadian",
            "Tunisian",
            "Turk",
            "Tuvaluan",
            "Ugandan",
            "Ukrainian",
            "Emirati",
            "British",
            "American",
            "Uruguayan",
            "Uzbek",
            "Vanuatuan",
            "Venezuelan",
            "Vietnamese",
            "Welsh",
            "Western Samoan",
            "Yemeni",
            "Yugoslav",
            "Zairean",
            "Zambian",
            "Zimbabwean"
        ],

        'religions' => [
            'Buddhism',
            'Christianity - Catholic',
            'Christianity - Others',
            'Hinduism',
            'Islam',
            'Judaism',
        ],

        'civil_statuses' => [
            'Single' => 'Single',
            'Married' => 'Married',
            'Widower' => 'Widower',
            'Separated' => 'Separated'
        ],

        'units' => [
                'weights' => [
                    'kg' => 'kg',
                    'lbs' => 'lbs',
                ],

                'heights' => [
                    'in' => 'in',
                    'cm' => 'cm',
                    'ft' => 'ft'
                ]
        ]
    ];
?>Modules/Likod/Models/Clients/User.php000066400000007360152434100730013500 0ustar00<?php

namespace QxCMS\Modules\Likod\Models\Clients;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Carbon\Carbon;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
    use Notifiable;

    protected $connection = 'qxcms';
    protected $table = "client_users";
    protected $guarded = ['password_confirmation'];
    protected $appends = ['hashid'];
    public $module_id = 3;

    /*
     * Model Accessors
     */

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function setValidityDateAttribute($value) 
    {
        if($value <> '') {
            $dateformats = getDateFormatConfig('set');
            return $this->attributes['validity_date'] = Carbon::createFromFormat($dateformats['php'], $value)->format('Y-m-d');
        }
        return $this->attributes['validity_date'] = '0000-00-00';
    }

    public function getValidityDateAttribute($value) 
    {
        if($value <> '0000-00-00') {
            $dateformats = getDateFormatConfig('get');
            return Carbon::createFromFormat('Y-m-d', $value)->format($dateformats['php']);
        }
        return;
    }

    public function formValidityDateAttribute($value)
    {
        if($value <> '0000-00-00') {
            $dateformats = getDateFormatConfig('form');
            return Carbon::createFromFormat('Y-m-d', $value)->format($dateformats['php']);
        }
        return;
    }


    /*
     * Model Mutators
     */
    public function client()
    {
        return $this->belongsTo('QxCMS\Modules\Likod\Models\Clients\Client', 'client_id');
    } 
   
    public function role()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Settings\Roles\Role', 'role_id');
    }

    public function permissions()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Settings\Roles\Permission', 'role_id', 'role_id');
    }

    public function post()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Posts\Posts', 'author_id');
    } 

    public function userLogs()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs', 'user_id');
    } 

    public function scopeFilterUsersByRole($query, $roleIds = array())
    {
        if(!empty($roleIds))
        {
            if(is_array($roleIds)) return $query->whereNotIn('role_id', $roleIds);
            return $query->where('role_id', $roleIds);
        }

        return $query;
    }

    public function scopeIsNotSubUser($query)
    {
        return $query->where('is_sub_user', 'No');
    }

    public function scopeIsSubUser($query)
    {
        return $query->where('is_sub_user', 'Yes');
    }

    public function page()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Pages\Pages', 'author_id');
    }

    public function scopeSearchByName($query, $criteria = null)
    {
        if(!empty($criteria))
        {
            return $query->where('name', 'LIKE', '%'.$criteria.'%');
        }
    }

    public function scopeFieldOfficer($query)
    {
        return $query->where('access_type', config('role.field_officer'));
    }

    public function scopeEditor($query)
    {
        return $query->where('access_type', config('role.editor'));
    }

    public function scopeSearchUserType($query, $user_type = '')
    {
        if(!empty($user_type))
        {
            if(strtolower($user_type) == 'field_officer') return $query->fieldOfficer();
            if(strtolower($user_type) == 'editor') return $query->editor();
        }
        return $query;
    }

    public function scopeClientUser($query, $client_id = '')
    {
        if(auth()->check()){
            $client_id = auth()->user()->client->id;
        }
        return $query->where('client_id', $client_id);
    }
}Modules/Likod/Models/Clients/Client.php000066400000003637152434100730014003 0ustar00<?php

namespace QxCMS\Modules\Likod\Models\Clients;

use Illuminate\Database\Eloquent\Model;

class Client extends Model
{
    protected $connection = 'qxcms';
    protected $table = "clients";
    public $module_id = 5;
    protected $fillable = [
        'client_name',
        'client_address',
        'telephone_no',
        'email',
        'client_address',
        'database_name',
        'database_host',
        'database_username',
        'database_password',
        'api_key',
        'api_secret',
        'status',
        'number_of_users',
        'disk_size',
        'date_picker_format',
        'display_date_format',
        'name_format',
        'monthly_mail_quota',
        'root_dir',
        'mail_driver',
        'mail_sender_address',
        'mail_sender_name',
        'mail_host',
        'mail_username',
        'mail_password',
        'mail_port',
        'storage_type',
        's3_key',
        's3_secret',
        's3_region',
        's3_bucket_name',
        'cpanel_email',
        'cpanel_host',
        'cpanel_ip',
        'cpanel_port',
        'cpanel_account',
        'cpanel_password',
        'cpanel_domain',
        'cpanel_user_default_password',
        'cpanel_qouta',
        'cpanel_forwarder'
    ];
    protected $appends = ['hashid', 'date_picker', 'date_picker_display'];

    /*
     * Model Accessors
     */

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function getDatePickerAttribute()
    {
        return config('account.dateformat.'.$this->date_picker_format);
    }

    public function getDatePickerDisplayAttribute()
    {
        return config('account.displaydateformat.'.$this->display_date_format);
    }

    /*
     * Model Mutators
     */


    /*
     * Model Relationship
    */

    public function users()
    {
       return $this->hasMany('QxCMS\Modules\Likod\Models\Clients\User', 'client_id');
    }
}Modules/Likod/Models/Settings/Roles/Permission.php000066400000001024152434100730016164 0ustar00<?php

namespace QxCMS\Modules\Likod\Models\Settings\Roles;

use Illuminate\Database\Eloquent\Model;

class Permission extends Model
{
    protected $connection = 'qxcms';
    protected $table = 'role_permissions';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'role_id',
        'menu_id',
        'can_access',
        'can_create',
        'can_update',
        'can_delete',
        'can_export',
        'can_import',
        'can_export'
    ]; 
}Modules/Likod/Models/Settings/Roles/Role.php000066400000002023152434100730014735 0ustar00<?php

namespace QxCMS\Modules\Likod\Models\Settings\Roles;

use Illuminate\Database\Eloquent\Model;

class Role extends Model
{
    protected $connection = 'qxcms';
    protected $table = 'roles';
    public $module_id = 2;
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'display_name', 'description',
    ];
    protected $appends = ['hashid'];
   
   /*
    * Model Accessors
    */
    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function permissions()
    {
        return $this->hasMany('QxCMS\Modules\Likod\Models\Settings\Roles\Permission');
    }

    public function users()
    {
        return $this->hasMany('QxCMS\Modules\Likod\User');
    }

    /*
     * Model Custom Functions
     */
    public function role_access($role_id = 1) 
    {
        if ($role_id == 1) {
            return $this->all();
        } else {
            return $this->where('id', '<>', 1)->get();
        }
    }
}Modules/Likod/Models/Developer/Module.php000066400000002050152434100730014322 0ustar00<?php

namespace QxCMS\Modules\Likod\Models\Developer;

use Illuminate\Database\Eloquent\Model;
use DB;
use File;
class Module extends Model
{
    protected $connection = 'qxcms';
    protected $table = "modules";
    protected $fillable = [
        'title',
        'link_type',
        'page_id',
        'menu_group_id',
        'module_name',
        'module_description',
        'is_parent',
        'has_parent',
        'parent_id',
        'url',
        'uri',
        'icon',
        'target',
        'show_menu',
        'has_read',
        'has_create',
        'has_update',
        'has_delete',
        'has_export',
        'has_import',
        'has_print'
    ];
    protected $appends = ['hashid'];

    /*
     * Model Accessors
     */

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }


    /*
     * Model Mutators
     */
    public function setParentIdAttribute($value)
    {
        if(empty($value)) $this->attributes['parent_id'] = 0;
        else $this->attributes['parent_id'] = $value;
    }
}Modules/Likod/Models/Developer/ClientModule.php000066400000002275152434100730015472 0ustar00<?php

namespace QxCMS\Modules\Likod\Models\Developer;

use Illuminate\Database\Eloquent\Model;

class ClientModule extends Model
{
    protected $connection = 'qxcms';
    protected $table = "client_modules";
    protected $fillable = [
        'title',
        'link_type',
        'page_id',
        'menu_group_id',
        'module_name',
        'module_description',
        'is_parent',
        'has_parent',
        'parent_id',
        'url',
        'uri',
        'icon',
        'target',
        'show_menu',
        'has_read',
        'has_create',
        'has_update',
        'has_delete',
        'has_export',
        'has_import',
        'has_print'
    ];

    protected $appends = ['hashid'];


    /*
     * Model Accessors
     */

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }


    /*
     * Model Mutators
     */

    public function setParentIdAttribute($value)
    {
        if(empty($value)) $this->attributes['parent_id'] = 0;
        else $this->attributes['parent_id'] = $value;
    }

    public function moduleLogs()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs', 'module_id');
    } 
}
Modules/Likod/Middleware/Authenticate.php000066400000001357152434100730014431 0ustar00<?php

namespace QxCMS\Modules\Likod\Middleware;

use Closure;
use Illuminate\Support\Facades\Auth;

class Authenticate
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  string|null  $guard
     * @return mixed
     */
    public function handle($request, Closure $next, $guard = 'likod')
    {
        if (Auth::guard($guard)->guest()) {
            if ($request->ajax() || $request->wantsJson()) {
                return response('Unauthorized.', 401);
            } else {
                return redirect()->guest('likod/auth/login');
            }
        }
        config(['auth.defaults.guard' => $guard]);
        return $next($request);
    }
}
Modules/Likod/Middleware/RedirectIfAuthenticated.php000066400000001246152434100730016533 0ustar00<?php

namespace QxCMS\Modules\Likod\Middleware;

use Closure;
use Illuminate\Support\Facades\Auth;

class RedirectIfAuthenticated
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  string|null  $guard
     * @return mixed
     */
    public function handle($request, Closure $next, $guard = 'likod')
    {
        if (Auth::guard($guard)->check()) {
            $request->setUserResolver(function () use ($guard) {
                return Auth::guard($guard)->user();
            });
            return redirect('likod/dashboard');
        }
        return $next($request);
    }
}Modules/Likod/Views/message.blade.php000066400000000660152434100730013521 0ustar00<div id="message-wrapper">
    @if(session('logout'))
        <div class="alert alert-success alert-dismissable fade in" style="padding-top: 4px;padding-bottom: 4px; padding-right: 29px; padding-left: 10px;">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <i class="fa fa-check"></i>&nbsp;
            {{ session('logout') }}
        </div>
    @endif    
</div>Modules/Likod/Views/dashboard/dashboard.blade.php000066400000006536152434100730015763 0ustar00@extends('Likod::layouts')
@section('page-body')
	<!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            Dashboard
            <small>Control panel</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li class="active">Dashboard</li>
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">
    	<div class="row">
            <div class="col-lg-3 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-aqua">
                    <div class="inner">
                        <h3>
                            1
                        </h3>
                        <p>
                            Total Users
                        </p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-android-social-user"></i>
                    </div>
                    <a href="#" class="small-box-footer">
                        More info <i class="fa fa-arrow-circle-right"></i>
                    </a>
                </div>
            </div><!-- ./col -->
            <div class="col-lg-3 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-green">
                    <div class="inner">
                        <h3>
                            1
                        </h3>
                        <p>
                            Total Agency
                        </p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-android-contacts"></i>
                    </div>
                    <a href="#" class="small-box-footer">
                        More info <i class="fa fa-arrow-circle-right"></i>
                    </a>
                </div>
            </div><!-- ./col -->
            <div class="col-lg-3 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-yellow">
                    <div class="inner">
                        <h3>
                            1
                        </h3>
                        <p>
                            Active Agency
                        </p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-android-friends"></i>
                    </div>
                    <a href="#" class="small-box-footer">
                        More info <i class="fa fa-arrow-circle-right"></i>
                    </a>
                </div>
            </div><!-- ./col -->
            <div class="col-lg-3 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-red">
                    <div class="inner">
                        <h3>
                            1
                        </h3>
                        <p>
                            Non-Active Agency
                        </p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-android-contact"></i>
                    </div>
                    <a href="#" class="small-box-footer">
                        More info <i class="fa fa-arrow-circle-right"></i>
                    </a>
                </div>
            </div><!-- ./col -->
        </div>
    </section>
@stopModules/Likod/Views/clients/create.blade.php000066400000002730152434100730015001 0ustar00@extends('Likod::layouts',['title'=>'Add Client'])
@section('page-body')
     <!-- Content Header (Page header) -->
     <section class="content-header">
     <h1>
          <i class="fa fa-plus-circle" aria-hidden="true"></i> Add Client
     </h1>
     <ol class="breadcrumb">
          <li><a href="#"><i class="fa fa-cog"></i>Settings</a></li>
          <li><a href="{{ url(config('modules.likod').'/clients') }}"><i class="fa fa-user-circle-o"></i>Client Directory</a></li>
          <li class="active">Add</li>            
     </ol>
     </section>
     <!-- Main content -->
     <section class="content">
          @include('Likod::message')
          @include('Likod::all-fields-are-required')
          {!! Form::open(['url'=>url(config('modules.likod').'/clients'),'method'=>'POST','class'=>'form-horizontal','role'=>'form','id'=>'client-form']) !!}
          <div class="box box-primary">
               <div class="box-body">
                    @include('Likod::clients.includes.form', array('client_config' => true))
               </div>
               <div class="box-footer text-center">
                    <button class="btn btn-primary btn-flat"><i class="fa fa-save"></i>&nbsp;&nbsp;Save&nbsp;&nbsp;</button>
               </div>
          </div>
          {!! Form::close() !!}
     </section>
@stop
@section('page-css')
     @include('Likod::clients.includes.css')
@stop
@section('page-js')
     @include('Likod::clients.includes.js')
     @include('Likod::notify')
@stopModules/Likod/Views/clients/includes/form.blade.php000066400000044344152434100730016316 0ustar00@if (count($errors) > 0)
<div class="form-group"> 
    <div class="col-md-12">
        <div class="callout callout-danger">
            <h4>The following error occured.</h4>
            <ul>
                @foreach ($errors->all() as $error)
                    <li>{{ $error }}</li>
                @endforeach
            </ul>
        </div>
    </div>
</div>
@endif 

@if(!isset($client))
<h3 class="page-header"><i class="fa fa-lock"></i>&nbsp;Login Details</h3>
<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Name of User: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('name', null , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('email') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Email: <i class="required">*</i></label>
    <div class="col-md-9">
        <span class="text-warning">*Note: Email must be active.</span>
        {!! Form::text('email', null , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('password') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Password: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('password', null , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Re-type Password: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('password_confirmation', null , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off']) !!}
    </div>
</div>
@endif

<h3 class="page-header"><i class="fa fa-building"></i>&nbsp;Client Information</h3>
<div class="form-group {{ $errors->has('client_name') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Client Name: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('client_name', null , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('client_address') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Client Address: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('client_address', null , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('telephone_no') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Telephone No: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('telephone_no', null , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('email') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Email: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('email', null , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off']) !!}
    </div>
</div>
@if(isset($client))
<div class="form-group">
    <label class="control-label col-md-3">Kiosk URL:</label>
    <div class="col-md-9">
        {!! Form::text('kiok_url', url(config('modules.kiosk')).'/'.$client->root_dir.'/' , ['class'=>'form-control', 'disabled' => 'disabled']) !!}
    </div>
</div>
@endif

@if($client_config)
<h3 class="page-header"><i class="fa fa-database"></i>&nbsp;Database Information</h3>
<div class="form-group {{ $errors->has('database_name') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Database Name: <i class="required">*</i></label>
    <div class="col-md-9">
        <span class="text-warning">*Note: Database name must be atleast 5 letters.</span>
       
        {!! Form::text('database_name', null , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off', ((isset($client->database_name)) ? 'readonly':'')]) !!}
       
    </div>
</div>
<div class="form-group {{ $errors->has('database_host') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Database Host: <i class="required">*</i></label>
    <div class="col-md-9">
        <span class="text-warning"></span>
        {!! Form::text('database_host', (isset($client->database_host)) ? null:'127.0.0.1' , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('database_username') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Database Username: <i class="required">*</i></label>
    <div class="col-md-9">
        <span class="text-warning"></span>
        {!! Form::text('database_username', (isset($client->database_username)) ? null:'root' , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('database_password') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Database Password:</label>
    <div class="col-md-9">
        <span class="text-warning"></span>
        {!! Form::text('database_password', null , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off']) !!}
    </div>
</div>
@endif

<h3 class="page-header"><i class="fa fa-gears"></i>&nbsp;API Configuration</h3>
<div class="form-group {{ $errors->has('api_key') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">API Key:</label>
    <div class="col-md-9">
        <span class="text-warning"></span>
        {!! Form::text('api_key', (isset($client->api_key)) ? $client->api_key:str_random(40) , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off', 'readonly'=>'true']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('api_secret') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">API Secret:</label>
    <div class="col-md-9">
        {!! Form::text('api_secret', (isset($client->api_secret)) ? $client->api_secret:str_random(40) , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off', 'readonly'=>'true']) !!}
    </div>
</div>

<h3 class="page-header"><i class="fa fa-gear"></i>&nbsp;Account Configuration</h3>
@if($client_config)
<div class="form-group {{ $errors->has('status') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Account Status: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::select('status', [1=>'Active', 0 => 'Inactive'], null, ['class'=>'form-control']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('number_of_users') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Number of users: <i class="required">*</i></label>
    <div class="col-md-9">
        <span class="text-warning">Note: If number of users is unlimited, set to 0.</span>
        {!! Form::text('number_of_users', (isset($client->number_of_users)) ? null:0 , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('disk_size') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Disk Size <i>(GB)</i>: <i class="required">*</i></label>
    <div class="col-md-9">
        <span class="text-warning">Note: If disk size is unlimited, set to 0.</span>
        {!! Form::text('disk_size', (isset($client->disk_size)) ? null:0 , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off']) !!}
    </div>
</div>
@endif
<div class="form-group {{ $errors->has('date_picker_format') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Date Picker Format: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::select('date_picker_format', $datepickerformats, null, ['class'=>'form-control']) !!}
    </div>
</div>
@if($client_config)
<div class="form-group {{ $errors->has('display_date_format') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Display Date Format: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::select('display_date_format', $displaydateformats, null, ['class'=>'form-control']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('name_format') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Name Format: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::select('name_format', $nameformats, null, ['class'=>'form-control']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('monthly_mail_quota') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Monthy Mail Quota: <i class="required">*</i></label>
    <div class="col-md-9">
        <span class="text-warning">Note: If Monthly mail quota is unlimited set to 0.</span>
        {!! Form::text('monthly_mail_quota', (isset($client->monthly_mail_quota)) ? null:0 , ['class'=>'form-control', 'placeholder'=>'', 'autocomplete'=>'off']) !!}
    </div>
</div>
@if(isset($client) && $client != null)
<div class="form-group {{ $errors->has('root_dir') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Attachment Root Folder:</label>
    <div class="col-md-9">
        {!! Form::text('root_dir', null , ['class'=>'form-control', 'placeholder'=>'', 'disabled'=>'disabled']) !!}
    </div>
</div>
@endif
@endif

<h3 class="page-header"><i class="fa fa-envelope"></i>&nbsp;Mail Configuration</h3>
<div class="row">
    <div class="col-sm-9 col-sm-offset-3">
        <!-- <div class="alert alert-warning"> -->
            <p class="text-warning"><b><i class="fa fa-lightbulb-o"></i> Note: </b>Mail Configuration is set by default. You can also set this configuration using the client Mail account.</p>
        <!-- </div> -->
    </div>
</div>
<div class="form-group {{ $errors->has('mail_driver') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Mail Driver: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::select('mail_driver', $mail_driver , null, ['class'=>'form-control']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('mail_sender_address') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Mail Sender Address: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('mail_sender_address', (isset($client->mail_sender_address)) ? null:config('mail.from.address'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('mail_sender_name') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Mail Sender Name: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('mail_sender_name', (isset($client->mail_sender_name)) ? null:config('mail.from.name'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('mail_host') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Mail Host: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('mail_host', (isset($client->mail_host)) ? null:config('mail.host'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('mail_username') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Mail Username: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('mail_username',  (isset($client->mail_username)) ? null:config('mail.username'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('mail_password') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Mail Password: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('mail_password', (isset($client->mail_password)) ? null:config('mail.password'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('mail_port') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Mail Port: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('mail_port', (isset($client->mail_port)) ? null:config('mail.port'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>

@if($client_config)
<h3 class="page-header"><i class="fa fa-usb"></i>&nbsp;Storage Configuration</h3>
<div class="row">
    <div class="col-sm-9 col-sm-offset-3">
        <p class="text-warning"><b><i class="fa fa-lightbulb-o"></i> Note: </b>For Amazon S3 Storage Type, configuration is set by default. You can also set this configuration using the client amazon S3 account.</p>
    </div>
</div>
<div class="form-group {{ $errors->has('storage_type') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Storage Type: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::select('storage_type', $storage_type , null, ['placeholder'=>' - Select - ','class'=>'form-control', 'id' => 'storage_type']) !!}
    </div>
</div>
<div class="for_s3 form-group {{ $errors->has('s3_key') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">S3 Key: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('s3_key', (isset($client->s3_key)) ? null:config('filesystems.disks.s3.key'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="for_s3 form-group {{ $errors->has('s3_secret') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">S3 Secret: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('s3_secret', (isset($client->s3_secret)) ? null:config('filesystems.disks.s3.secret'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="for_s3 form-group {{ $errors->has('s3_region') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">S3 Region: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('s3_region', (isset($client->s3_region)) ? null:config('filesystems.disks.s3.region'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="for_s3 form-group {{ $errors->has('s3_bucket_name') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">S3 Bucket Name: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('s3_bucket_name', (isset($client->s3_bucket_name)) ? null:config('filesystems.disks.s3.bucket'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>

<h3 class="page-header for_cpanel"><input type="checkbox" name="create_email" class="icheck" value="1"> Create an E-mail on Cpanel account</h3>
<div class="for_cpanel row">
    <div class="col-sm-9 col-sm-offset-3">
        <p class="text-warning"><b><i class="fa fa-lightbulb-o"></i> Note: </b>Cpanel Configuration is set by default. You can also set this configuration using the client Cpanel account.</p>
    </div>
</div>
<div class="for_cpanel form-group {{ $errors->has('cpanel_host') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">CPanel Host: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('cpanel_host', (isset($client->cpanel_host)) ? null:config('cpanel.host') , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="for_cpanel form-group {{ $errors->has('cpanel_ip') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">CPanel IP: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('cpanel_ip', (isset($client->cpanel_ip)) ? null:config('cpanel.ip'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="for_cpanel form-group {{ $errors->has('cpanel_port') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">CPanel Port: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('cpanel_port', (isset($client->cpanel_port)) ? null:config('cpanel.port'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="for_cpanel form-group {{ $errors->has('cpanel_account') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">CPanel Account: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('cpanel_account', (isset($client->cpanel_account)) ? null:config('cpanel.account'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="for_cpanel form-group {{ $errors->has('cpanel_password') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">CPanel Password: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('cpanel_password', (isset($client->cpanel_password)) ? null:config('cpanel.password'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="for_cpanel form-group {{ $errors->has('cpanel_domain') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">CPanel Domain: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('cpanel_domain', (isset($client->cpanel_domain)) ? null:config('cpanel.domain'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="for_cpanel form-group {{ $errors->has('cpanel_user_default_password') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">CPanel User Default Password: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('cpanel_user_default_password', (isset($client->cpanel_user_default_password)) ? null:config('cpanel.user_default_password'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="for_cpanel form-group {{ $errors->has('cpanel_qouta') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">CPanel Qouta: </label>
    <div class="col-md-9">
        {!! Form::text('cpanel_qouta', (isset($client->cpanel_qouta)) ? null:config('cpanel.qouta'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="for_cpanel form-group {{ $errors->has('cpanel_forwader') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">CPanel Forwarder: </label>
    <div class="col-md-9">
        {!! Form::text('cpanel_forwarder', (isset($client->cpanel_forwarder)) ? null:config('cpanel.forwarder'), ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
@endifModules/Likod/Views/clients/includes/js.blade.php000066400000002060152434100730015754 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Likod\Requests\Clients\ClientRequest', '#client-form'); !!}
<script type="text/javascript">
$(function() {
	$('.for_cpanel').css({'display':'none'});
    changeStorageType($('#storage_type').val());
    $('input.icheck').iCheck({
        checkboxClass: 'icheckbox_square-blue',
        radioClass: 'iradio_square-blue',
        increaseArea: '20%' // optional
    }).on('ifChanged', function(e) {
       var isCheck = e.currentTarget.checked;
       hideCpanel(isCheck);
    }).end();
    $('#storage_type').change(function(){
        changeStorageType($(this).val());
    });
})
function changeStorageType(val)
{
    if(val=='s3') {
        $('.for_s3').css({'display':'block'});
    } else {
        $('.for_s3').css({'display':'none'});
    }
}
function hideCpanel(isCheck)
{
    if(isCheck) {
        $('.for_cpanel').css({'display':'block'});
    } else {
        $('.for_cpanel').css({'display':'none'});
    }
}
</script>Modules/Likod/Views/clients/includes/css.blade.php000066400000000126152434100730016131 0ustar00<link rel="stylesheet" href="{{ get_template('js/plugins/iCheck/square/blue.css') }}">Modules/Likod/Views/clients/index.blade.php000066400000006067152434100730014654 0ustar00@extends('Likod::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-user-circle-o"></i> Clients Directory
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-cog"></i> Settings</a></li>
            <li class="active">Clients Directory</li>
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">
        @include('Likod::message')
        <div class="callout callout-info" style="margin: 0 0 5px 0;">
        List of Clients
        </div>
        <div class="box box-primary">
            <div class="box-header with-border">
                <span class="pull-right">
                    <a href="{{ url(config('modules.likod').'/clients/create') }}" data-toggle="tooltip" data-placement="top" title="" data-original-title="Add Client"><button class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add Client</button></a>
                </span>
            </div>
            <div class="box-body">
                <table class="table table-condensed table-bordered table-striped table-hover" id="clients-table"width="100%">
                <thead>
                <tr>
                    <th>#</th>
                    <th>Client Name</th>
                    <th>Users</th>
                    <th>Email</th>
                    <th>Disk Space</th>
                    <th>Status</th>
                    <th>Action</th>
                </tr>
                </thead>
               </table>
            </div>                
        </div>
    </section>
@stop
@section('page-js')
<script type="text/javascript" src="{{ get_template('js/plugins/datatables/extensions/Pagination/input_old.js') }}"></script>
<script type="text/javascript">
$(function() {
    var clientTable = $('#clients-table').DataTable({
    processing: true,
    serverSide: true,
    "pagingType": "input",
    ajax:{
        url: '{!! url(config('modules.likod').'/clients/get-clients-data') !!}',
        method: 'POST'
    } ,
        columns: [
            {
                width:'10px', searchable: false, orderable: false,
                render: function (data, type, row, meta) {
                    return meta.row + meta.settings._iDisplayStart + 1;
                }
            },
            { data: 'client_name', name: 'client_name' },
            { data: 'number_of_users', name: 'number_of_users', searchable: false, orderable: false },
            { data: 'monthly_mail_quota', name: 'monthly_mail_quota', searchable: false, orderable: false},
            { data: 'disk_size', name: 'disk_size', searchable: false, orderable: false},
            { data: 'status', name: 'status', searchable: false, orderable: false},
            { data: 'action', name: 'action', orderable: false, searchable: false, width:'70px', className:'text-center'},
        ],
        fnDrawCallback: function ( oSettings ) {
            $('[data-toggle="tooltip"]').tooltip();
        },
        "order": [[1, "asc"]],
    });
});
</script>
@include('Likod::notify')
@stopModules/Likod/Views/clients/edit.blade.php000066400000002740152434100730014464 0ustar00@extends('Likod::layouts',['title'=>'Edit Client'])
@section('page-body')
     <!-- Content Header (Page header) -->
     <section class="content-header">
     <h1>
          <i class="fa fa-pencil"></i> Edit Client
     </h1>
     <ol class="breadcrumb">
          <li><a href="#"><i class="fa fa-cog"></i>Settings</a></li>
          <li><a href="{{ url(config('modules.likod').'/clients') }}"><i class="fa fa-user-circle-o"></i>Client Directory</a></li>
          <li class="active">Edit</li>            
     </ol>
     </section>
     <!-- Main content -->
     <section class="content">          
          @include('Likod::message')
          @include('Likod::all-fields-are-required')
          {!! Form::model($client, array('url' => config('modules.likod').'/clients/'.$client->hashid, 'method' => 'PUT', 'class'=>'form-horizontal', 'role' => 'form' , 'id'=>'client-form')) !!}
          <div class="box box-primary">
               <div class="box-body">
                    @include('Likod::clients.includes.form', array('client_config' => true))
               </div>
               <div class="box-footer text-center">
                    <button class="btn btn-primary btn-flat"><i class="fa fa-save"></i>&nbsp;Save</button>
               </div>
          </div>
          {!! Form::close() !!}
     </section>
@stop
@section('page-css')
     @include('Likod::clients.includes.css')
@stop
@section('page-js')
     @include('Likod::clients.includes.js')
     @include('Likod::notify')
@stopModules/Likod/Views/auth/emails/password.blade.php000066400000000242152434100730016146 0ustar00Click here to reset your password: <a href="{{ $link = url('password/reset', $token).'?email='.urlencode($user->getEmailForPasswordReset()) }}"> {{ $link }} </a>
Modules/Likod/Views/auth/register.blade.php000066400000007321152434100730014663 0ustar00@extends('Likod::layouts.app')

@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading">Register</div>
                <div class="panel-body">
                    <form class="form-horizontal" role="form" method="POST" action="{{ url('/register') }}">
                        {!! csrf_field() !!}

                        <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">Name</label>

                            <div class="col-md-6">
                                <input type="text" class="form-control" name="name" value="{{ old('name') }}">

                                @if ($errors->has('name'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('name') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">E-Mail Address</label>

                            <div class="col-md-6">
                                <input type="email" class="form-control" name="email" value="{{ old('email') }}">

                                @if ($errors->has('email'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">Password</label>

                            <div class="col-md-6">
                                <input type="password" class="form-control" name="password">

                                @if ($errors->has('password'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">Confirm Password</label>

                            <div class="col-md-6">
                                <input type="password" class="form-control" name="password_confirmation">

                                @if ($errors->has('password_confirmation'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password_confirmation') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <button type="submit" class="btn btn-primary">
                                    <i class="fa fa-btn fa-user"></i>Register
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
Modules/Likod/Views/auth/passwords/email.blade.php000066400000003570152434100730016155 0ustar00@extends('layouts.app')

<!-- Main Content -->
@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading">Reset Password</div>
                <div class="panel-body">
                    @if (session('status'))
                        <div class="alert alert-success">
                            {{ session('status') }}
                        </div>
                    @endif

                    <form class="form-horizontal" role="form" method="POST" action="{{ url('/password/email') }}">
                        {!! csrf_field() !!}

                        <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">E-Mail Address</label>

                            <div class="col-md-6">
                                <input type="email" class="form-control" name="email" value="{{ old('email') }}">

                                @if ($errors->has('email'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <button type="submit" class="btn btn-primary">
                                    <i class="fa fa-btn fa-envelope"></i>Send Password Reset Link
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
Modules/Likod/Views/auth/passwords/reset.blade.php000066400000006203152434100730016204 0ustar00@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading">Reset Password</div>

                <div class="panel-body">
                    <form class="form-horizontal" role="form" method="POST" action="{{ url('/password/reset') }}">
                        {!! csrf_field() !!}

                        <input type="hidden" name="token" value="{{ $token }}">

                        <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">E-Mail Address</label>

                            <div class="col-md-6">
                                <input type="email" class="form-control" name="email" value="{{ $email or old('email') }}">

                                @if ($errors->has('email'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">Password</label>

                            <div class="col-md-6">
                                <input type="password" class="form-control" name="password">

                                @if ($errors->has('password'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">Confirm Password</label>
                            <div class="col-md-6">
                                <input type="password" class="form-control" name="password_confirmation">

                                @if ($errors->has('password_confirmation'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password_confirmation') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <button type="submit" class="btn btn-primary">
                                    <i class="fa fa-btn fa-refresh"></i>Reset Password
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
Modules/Likod/Views/auth/login.blade.php000066400000007671152434100730014157 0ustar00<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>QxCMS | Likod Log-in</title>
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        <link rel="stylesheet" href="{{ get_template('bootstrap/css/bootstrap.min.css') }}">
        <link rel="stylesheet" href="{{ get_template('font-awesome-4.5.0/css/font-awesome.min.css') }}">
        <link rel="stylesheet" href="{{ get_template('ionicons-2.0.1/css/ionicons.min.css') }}">
        <link rel="stylesheet" href="{{ get_template('dist/css/AdminLTE.min.css') }}">
        <link rel="stylesheet" href="{{ get_template('plugins/iCheck/square/blue.css') }}">
        <link rel="stylesheet" href="{{ get_template('dist/css/custom.css') }}">
        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body class="hold-transition login-page">
        <div class="login-box">
            <div class="login-logo">
                <span><b>QxCMS</b> | Likod</span>
            </div>
            @include('Likod::message')
            <div class="login-box-body">
                <p class="login-box-msg">Sign in to start your session</p>
                <form role="form" method="POST" action="{{ url('likod/auth/login') }}" id="login-form">
                    {!! csrf_field() !!}
                    <!-- <div class="form-group has-feedback"> -->
                    <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }} has-feedback">
                        <input type="email" name="email" class="form-control" placeholder="Email" value="{{ old('email') }}">
                        <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
                        @if ($errors->has('email'))
                            <span class="help-block">
                                {{ $errors->first('email') }}
                            </span>
                        @endif
                    </div>
                    <!-- <div class="form-group has-feedback"> -->
                    <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }} has-feedback">
                        <input type="password" name="password" class="form-control" placeholder="Password">
                        <span class="glyphicon glyphicon-lock form-control-feedback"></span>
                        @if ($errors->has('password'))
                            <span class="help-block">
                                {{ $errors->first('password') }}
                            </span>
                        @endif
                    </div>
                    <div class="row">
                        <div class="col-xs-8" id="checkbox" style="padding-left:35px;">
                        </div>
                        <div class="col-xs-4">
                          <button type="submit" class="btn btn-primary btn-block btn-flat"><i class="fa fa-sign-in"></i> Sign In</button>
                        </div>
                    </div>
                </form>
                <a href="#"><i class="fa fa-lock"></i> Forgot my password?</a><br>
            </div>
        </div>
        <script src="{{ get_template('plugins/jQuery/jQuery-2.1.4.min.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('bootstrap/js/bootstrap.min.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('plugins/iCheck/icheck.min.js') }}"></script>
        <script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
        {!! $validator !!}
    </body>
</html>Modules/Likod/Views/all-fields-are-required.blade.php000066400000000270152434100730016471 0ustar00<div class="callout callout-info" style="margin: 0 0 5px 0;">
<span class="text-danger">All fields with <i>(<i class="fa fa-asterisk form-required"></i>)</i> are required</span>
</div>Modules/Likod/Views/notify.blade.php000066400000010776152434100730013416 0ustar00@if(session('success'))
<script type="text/javascript">
$(function() {
    /* Notify Success */
    $.notify.addStyle('success', {
        html: "<div><i class=\"fa fa-check-circle\" aria-hidden=\"true\"></i>&nbsp;<span data-notify-text/></div>",
        classes: {
            base: {
              "white-space": "nowrap",
              "background-color": "#dff0d8",
              "padding": "5px"
            },
            supersuccess: {
              "color": "#3c763d",
              "background-color": "#dff0d8"
            }
        }
    });
    $.notify('{{ session("success") }}', {
        style: 'success',
        className: 'supersuccess',
        clickToHide: true,
        position:"top right", 
        autoHide: true, 
        autoHideDelay: 3000, 
        showAnimation: 'slideDown',
        showDuration: 400,
        hideAnimation: 'slideUp',
        hideDuration: 200
    });
});
</script>    
@endif

@if(session('error'))
<script type="text/javascript">
$(function() {
    /* Notify Danger */
    $.notify.addStyle('danger', {
        html: "<div><i class=\"fa fa-times-circle\" aria-hidden=\"true\"></i>&nbsp;<span data-notify-text/></div>",
        classes: {
            base: {
              "white-space": "nowrap",
              "background-color": "#f2dede",
              "padding": "5px"
            },
            superdanger: {
              "color": "#a94442",
              "background-color": "#f2dede"
            }
        }
    });
    $.notify('{{ session("error") }}', {
        style: 'danger',
        className: 'superdanger',
        clickToHide: true,
        position:"top right", 
        autoHide: true, 
        autoHideDelay: 3000, 
        showAnimation: 'slideDown',
        showDuration: 400,
        hideAnimation: 'slideUp',
        hideDuration: 200
    });
});
</script>    
@endif

@if(session('danger'))
<script type="text/javascript">
$(function() {
    /* Notify Danger */
    $.notify.addStyle('danger', {
        html: "<div><i class=\"fa fa-times-circle\" aria-hidden=\"true\"></i>&nbsp;<span data-notify-text/></div>",
        classes: {
            base: {
              "white-space": "nowrap",
              "background-color": "#f2dede",
              "padding": "5px"
            },
            superdanger: {
              "color": "#a94442",
              "background-color": "#f2dede"
            }
        }
    });
    $.notify('{{ session("danger") }}', {
        style: 'danger',
        className: 'superdanger',
        clickToHide: true,
        position:"top right", 
        autoHide: true, 
        autoHideDelay: 3000, 
        showAnimation: 'slideDown',
        showDuration: 400,
        hideAnimation: 'slideUp',
        hideDuration: 200
    });
});
</script>    
@endif

@if(session('info'))
<script type="text/javascript">
$(function() {
    /* Notify Info */
    $.notify.addStyle('info', {
        html: "<div><i class=\"fa fa-info-circle\" aria-hidden=\"true\"></i>&nbsp;<span data-notify-text/></div>",
        classes: {
            base: {
              "white-space": "nowrap",
              "background-color": "#d9edf7",
              "padding": "5px"
            },
            superinfo: {
              "color": "#31708f",
              "background-color": "#d9edf7"
            }
        }
    });
    $.notify('{{ session("info") }}', {
        style: 'info',
        className: 'superinfo',
        clickToHide: true,
        position:"top right", 
        autoHide: true, 
        autoHideDelay: 3000, 
        showAnimation: 'slideDown',
        showDuration: 400,
        hideAnimation: 'slideUp',
        hideDuration: 200
    });
});
</script>    
@endif

@if(session('warning'))
<script type="text/javascript">
$(function() {
    /* Notify Warning */
    $.notify.addStyle('warning', {
        html: "<div><i class=\"fa fa-exclamation-circle\" aria-hidden=\"true\"></i>&nbsp;<span data-notify-text/></div>",
        classes: {
            base: {
              "white-space": "nowrap",
              "background-color": "#fcf8e3",
              "padding": "5px"
            },
            superwarning: {
              "color": "#8a6d3b",
              "background-color": "#fcf8e3"
            }
        }
    });
    $.notify('{{ session("warning") }}', {
        style: 'warning',
        className: 'superwarning',
        clickToHide: true,
        position:"top right", 
        autoHide: true, 
        autoHideDelay: 3000, 
        showAnimation: 'slideDown',
        showDuration: 400,
        hideAnimation: 'slideUp',
        hideDuration: 200
    });
});
</script>    
@endifModules/Likod/Views/layouts.blade.php000066400000024633152434100730013603 0ustar00<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="csrf-token" content="{{ csrf_token() }}" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>QxCMS- {{ isset($title) ? $title:'Dashboard' }}</title>
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        <!-- jquery ui 1.11.2 -->
        <link href="{{ get_template('plugins/tablednd/tablednd.css') }}" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" href="{{ get_template('plugins/jquery-ui-1.11.2/jquery-ui.min.css') }}">
        <!-- bootstrap 3.0.2 -->
        <link href="{{ get_template('plugins/bootstrap-3.3.7/css/bootstrap.min.css') }}" rel="stylesheet" type="text/css" />
        <!-- font Awesome -->
        <link href="{{ get_template('font-awesome-4.7.0/css/font-awesome.min.css') }}" rel="stylesheet" type="text/css" />
        <!-- Ionicons -->
        <link href="{{ get_template('ionicons-2.0.1/css/ionicons.min.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('plugins/sweetalert2/dist/sweetalert2.min.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('plugins/iCheck/square/_all.css') }}" rel="stylesheet" type="text/css" />
        <!-- Select 2 -->
        <link href="{{ get_template('plugins/select2/select2.min.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('plugins/select2/select2.bootstrap.min.css') }}" rel="stylesheet" type="text/css" />
        <!-- Datatables -->
        <link href="{{ get_template('plugins/DataTables-1.10.12/media/css/dataTables.bootstrap.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('dist/css/AdminLTE.min.css') }}" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" href="{{ get_template('dist/css/skins/_all-skins.min.css') }}">
        <!-- custom style -->
        <link href="{{ get_template('plugins/notifyjs/notifyjs.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('dist/css/custom.css') }}" rel="stylesheet" type="text/css" />
        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
          <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
        <![endif]-->       
        @yield('page-css')
    </head>
    <body class="skin-{{ config('template.skin') }} fixed" data-url="{{ url('/') }}">
        <!-- header logo: style can be found in header.less -->
        <div class="wrapper">
            <header class="main-header">
                <a href="{{ url('client/dashboard') }}" class="logo">
                    <span class="logo-mini"><b>Qx</b><!-- <img src="{{ url('img/dashboard-logo.png') }}"  class="img-responsive" style="margin-top: 10px;"> --></span>
                    <span class="logo-lg"><b>Qx</b>CMS<!-- <img src="{{ url('img/dashboard-logo.png') }}"  class="img-responsive"> --></span>
                </a>
                <nav class="navbar navbar-static-top">
                    <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
                        <span class="sr-only">Toggle navigation</span>
                    </a>
                    <div class="navbar-custom-menu">
                        <ul class="nav navbar-nav">
                        <!-- User Account: style can be found in dropdown.less -->
                            <li class="dropdown user user-menu">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                    <i class="glyphicon glyphicon-user"></i>
                                    <span>{{ auth('likod')->user()->name }} <i class="caret"></i></span>
                                </a>
                                <ul class="dropdown-menu">
                                    <!-- User image -->
                                    <li class="user-header bg-light-purple" style="height:100px;">
                                        <p>
                                            {{ auth('likod')->user()->name }}
                                            <small>{{ auth('likod')->user()->email }}</small>
                                            <small><b>Version:</b> {{ config('app.version') }}</small>
                                        </p>
                                    </li>                                
                                    <!-- Menu Footer-->
                                    <li class="user-footer">
                                        <div class="pull-left">
                                            <a href="{{ url(config('modules.likod').'/settings/users/'.hashid(auth('likod')->user()->id).'/edit') }}" class="btn btn-default btn-flat">Profile</a>
                                        </div>
                                        <div class="pull-right">
                                            <a href="{{ url(config('modules.likod').'/auth/logout') }}" class="btn btn-default btn btn-flat">Sign out</a>
                                        </div>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                </nav>
            </header>
            <aside class="main-sidebar">
                <section class="sidebar">
                    <ul class="sidebar-menu">
                        <li class="header">MAIN NAVIGATION</li>
                        <li class="active">
                            <a href="{{ url(config('modules.likod').'/dashboard') }}">
                                <i class="fa fa-dashboard"></i> <span>Dashboard</span>
                            </a>
                        </li>                        
                        <li class="treeview">
                            <a href="#">
                                <i class="fa fa-cog"></i>
                                <span>Settings</span>
                                <i class="fa fa-angle-left pull-right"></i>
                            </a>
                            <ul class="treeview-menu">
                                <li><a href="{{ url(config('modules.likod').'/settings/users') }}"><i class="fa fa-angle-double-right"></i> User Manager</a></li>
                            </ul>
                        </li>
                        <li>
                            <a href="{{ url(config('modules.likod').'/clients') }}">
                                <i class="fa fa-user-circle-o"></i> <span>Clients Directory</span>
                            </a>
                        </li>                 
                    </ul>
                </section>
            </aside>
            <div class="content-wrapper">
                <!-- <div class="container-fluid"> -->
                    @yield('page-body')
                <!-- </div> -->
            </div>

            <footer class="main-footer">
                <div class="container-fluid">
                    <div class="pull-right hidden-xs">
                        <b>Version:</b> {{ config('app.version') }}
                    </div>
                    <strong>Copyright &copy; 2016-{{ Date('Y') + 1}} <a href="http://www.quantumx.com">Quantum X, Inc</a>.</strong>
                </div>
            </footer>

        </div>

        <script src="{{ get_template('plugins/jQuery/jQuery-2.1.4.min.js') }}"></script>
        <script src="{{ get_template('plugins/jquery-ui-1.11.2/jquery-ui.min.js') }}" type="text/javascript"></script>
        <script src="{{ get_template('plugins/bootstrap-3.3.7/js/bootstrap.min.js') }}" type="text/javascript"></script>
        <script type="text/javascript" src="{{ get_template('plugins/slimScroll/jquery.slimscroll.min.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('plugins/fastclick/fastclick.js') }}"></script>
        <script src="{{ get_template('/plugins/sweetalert2/dist/sweetalert2.min.js') }}" type="text/javascript"></script>
        <script src="{{ get_template('plugins/select2/select2.full.js') }}" type="text/javascript"></script>    
        <script src="{{ get_template('plugins/DataTables-1.10.12/media/js/jquery.dataTables.js') }}" type="text/javascript"></script>
        <script src="{{ get_template('plugins/DataTables-1.10.12/media/js/dataTables.bootstrap.js') }}" type="text/javascript"></script>
        <script type="text/javascript" src="{{ get_template('plugins/DataTables-1.10.12/extensions/Pagination/input_old.js') }}"></script>
        <script src="{{ get_template('plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js') }}" type="text/javascript"></script>
        <script src="{{ get_template('plugins/iCheck/icheck.min.js') }}" type="text/javascript"></script>
        <!-- notifyjs -->
        <script src="{{ get_template('plugins/notifyjs/notify.min.js') }}" type="text/javascript"></script>
        <!-- token input -->
       <!--  <script type="text/javascript" src="{{ get_template('js/plugins/tokeninput/jquery.tokeninput.js') }}"></script> -->
        <!-- input mask -->
        <script type="text/javascript" src="{{ get_template('plugins/input-mask/jquery.inputmask.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('plugins/input-mask/jquery.inputmask.date.extensions.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('plugins/input-mask/jquery.inputmask.extensions.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('plugins/tablednd/jquery.tablednd.0.7.min.js') }}"></script>
        <!-- AdminLTE App -->

        <script src="{{ get_template('dist/js/app.min.js') }}" type="text/javascript"></script>       
        <script type="text/javascript">
        $.ajaxSetup({
            headers: { 
                'X-CSRF-Token' : $('meta[name=csrf-token]').attr('content'),
            }
        });
        $(function () {
          $('[data-toggle="tooltip"]').tooltip();
        });
        </script>
        <script type="text/javascript" src="{{ get_template('dist/js/helpers.js') }}"></script>
        @yield('page-js')
    </body>
</html>Modules/Likod/Views/settings/users/create.blade.php000066400000002571152434100730016344 0ustar00@extends('Likod::layouts',['title'=>'Add User'])
@section('page-body')
     <!-- Content Header (Page header) -->
     <section class="content-header">
     <h1>
          <i class="fa fa-plus-circle" aria-hidden="true"></i> Add User
     </h1>
     <ol class="breadcrumb">
          <li><a href="#"><i class="fa fa-cog"></i>Settings</a></li>
          <li><a href="{{ url(config('modules.likod').'/settings/users') }}"><i class="fa fa-user"></i>User Manager</a></li>
          <li class="active">Add</li>            
     </ol>
     </section>
     <!-- Main content -->
     <section class="content">
          @include('Likod::message')
          @include('Likod::all-fields-are-required')
          {!! Form::open(['url'=>url(config('modules.likod').'/settings/users'),'method'=>'POST','class'=>'form-horizontal','role'=>'form','id'=>'user-form']) !!}
          <div class="box box-primary">
               <div class="box-body">
                    @include('Likod::settings.users.includes.form')
               </div>
               <div class="box-footer text-center">
                    <button class="btn btn-primary btn-flat"><i class="fa fa-save"></i>&nbsp;&nbsp;Save&nbsp;&nbsp;</button>
               </div>
          </div>
          {!! Form::close() !!}
     </section>
@stop
@section('page-js')
     @include('Likod::settings.users.includes.js')
     @include('Likod::notify')
@stopModules/Likod/Views/settings/users/includes/form.blade.php000066400000003745152434100730017656 0ustar00@if (count($errors) > 0)
<div class="form-group"> 
    <div class="col-md-12">
        <div class="callout callout-danger">
            <h4>The following error occured.</h4>
            <ul>
                @foreach ($errors->all() as $error)
                    <li>{{ $error }}</li>
                @endforeach
            </ul>
        </div>
    </div>
</div>
@endif 
<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Name: <i class="required">*</i></label>
    <div class="col-md-4">
        {!! Form::text('name', null , ['class'=>'form-control', 'placeholder'=>'Name', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('email') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Email: <i class="required">*</i></label>
    <div class="col-md-4">
        {!! Form::text('email', null , ['class'=>'form-control', 'placeholder'=>'Email', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('role_id') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Role: <i class="required">*</i></label>
    <div class="col-md-2">
        {!! Form::select('role_id', $roles, null, ['placeholder' => ' - Select -', 'class'=>'form-control']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('password') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Password: <i class="required">*</i></label>
    <div class="col-md-3">
        {!! Form::password('password', ['class'=>'form-control', 'id' => 'password', 'placeholder'=>'Password']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Re-type Password: <i class="required">*</i></label>
    <div class="col-md-3">
        {!! Form::password('password_confirmation', ['class'=>'form-control', 'id' => 'password_confirmation' ,'placeholder'=>'Re-type Password']) !!}
    </div>
</div>Modules/Likod/Views/settings/users/includes/js.blade.php000066400000000310152434100730017310 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Likod\Requests\Settings\UserRequest', '#user-form'); !!}Modules/Likod/Views/settings/users/index.blade.php000066400000007730152434100730016212 0ustar00@extends('Likod::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-user"></i> User Manager
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-cog"></i> Settings</a></li>
            <li class="active">User Manager</li>
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">
        @include('Likod::message')
        <div class="callout callout-info" style="margin: 0 0 5px 0;">
        List of Users
        </div>
        <div class="box box-primary">
            <div class="box-header with-border">
                <span class="pull-right">
                    <a href="{{ url(config('modules.likod').'/settings/users/create') }}" data-toggle="tooltip" data-placement="top" title="" data-original-title="Add User"><button class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add User</button></a>
                </span>
            </div>
            <div class="box-body">
                <table class="table table-condensed table-bordered table-striped table-hover" id="users-table"width="100%">
                <thead>
                <tr>
                    <th>#</th>
                    <th>Name</th>
                    <th>Email</th>
                    <th>Role</th>
                    <th>Action</th>
                </tr>
                </thead>
               </table>
            </div>                
        </div>
    </section>
@stop
@section('page-js')
<script type="text/javascript" src="{{ get_template('js/plugins/datatables/extensions/Pagination/input_old.js') }}"></script>
<script type="text/javascript">
$(function() {
    var userTable = $('#users-table').DataTable({
    processing: true,
    serverSide: true,
    "pagingType": "input",
    ajax: '{!! url(config('modules.likod').'/settings/users/get-users-data') !!}',
        columns: [
            {
                width:'10px', searchable: false, orderable: false,
                render: function (data, type, row, meta) {
                    return meta.row + meta.settings._iDisplayStart + 1;
                }
            },
            { data: 'name', name: 'name' },
            { data: 'email', name: 'email', searchable: false},
            { data: 'role.name', name: 'role.name', searchable: false, orderable: false},
            { data: 'action', name: 'action', orderable: false, searchable: false, width:'50px', className:'text-center'},
        ],
        fnDrawCallback: function ( oSettings ) {
            $('[data-toggle="tooltip"]').tooltip();
            $("#users-table td").on("click", 'a#btn-delete', function() {
                var action = $(this).data('action');
                swal({
                    title: 'Are you sure you want to delete?',
                    text: "This will be permanently deleted",
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: 'Yes'
                    }).then(function () {                    
                    $.ajax({
                        type: "DELETE",
                        url: action,
                        dataType: 'json',
                        success: function(data) {
                            if(data.type == "success") {
                                userTable.draw();
                                swal(data.message, '', 'success')
                           }else{
                                swal(data.message, '', 'error')
                           }
                        },
                        error :function( jqXhr ) {
                            swal('Unable to delete.', 'Please try again.', 'error')
                        }
                    });
                })                
            });
        },
        "order": [[1, "asc"]],
    });
});
</script>
@include('Likod::notify')
@stopModules/Likod/Views/settings/users/edit.blade.php000066400000002635152434100730016027 0ustar00@extends('Likod::layouts',['title'=>'Edit User'])
@section('page-body')
     <!-- Content Header (Page header) -->
     <section class="content-header">
     <h1>
          <i class="fa fa-pencil"></i> Edit User
     </h1>
     <ol class="breadcrumb">
          <li><a href="#"><i class="fa fa-cog"></i>Settings</a></li>
          <li><a href="{{ url(config('modules.likod').'/settings/users') }}"><i class="fa fa-user"></i>User Manager</a></li>
          <li class="active">Edit</li>            
     </ol>
     </section>
     <!-- Main content -->
     <section class="content">
          @include('Likod::message')          
          @include('Likod::all-fields-are-required')          
          {!! Form::model($user, array('url' => config('modules.likod').'/settings/users/'.$user->hashid, 'method' => 'PUT', 'class'=>'form-horizontal', 'role' => 'form' , 'id'=>'user-form')) !!}
          <div class="box box-primary">
               <div class="box-body">
                    @include('Likod::settings.users.includes.form', ['id' => $user->id])
               </div>
               <div class="box-footer text-center">
                    <button class="btn btn-primary btn-flat"><i class="fa fa-save"></i>&nbsp;Save</button>
               </div>
          </div>
          {!! Form::close() !!}
     </section>
@stop
@section('page-js') 
     @include('Likod::settings.users.includes.js')
     @include('Likod::notify')
@stopModules/Likod/Repositories/Clients/Clients/ClientRepositoryInterface.php000066400000000154152434100730022560 0ustar00<?php

namespace QxCMS\Modules\Likod\Repositories\Clients\Clients;

interface ClientRepositoryInterface
{

}Modules/Likod/Repositories/Clients/Clients/ClientRepository.php000064400000011176152434100730020743 0ustar00<?php

namespace QxCMS\Modules\Likod\Repositories\Clients\Clients;
use Illuminate\Support\Str;
use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Likod\Repositories\Clients\Clients\ClientRepositoryInterface;
use QxCMS\Modules\Likod\Models\Clients\Client;
use QxCMS\Modules\Likod\Models\Clients\User;
use QxCMS\Modules\Client\Models\Settings\Roles\Permission;
use QxCMS\Modules\Likod\Models\Developer\ClientModule;
use DB;
use Artisan;
use Config;
use Illuminate\Support\Arr;

class ClientRepository extends AbstractRepository implements ClientRepositoryInterface
{
    protected $model;
    protected $user;
    protected $permission;
    protected $clientModule;
    protected $db_prefix = "";

    function __construct(Client $model, User $user, Permission $permission, ClientModule $clientModule)
    {
        $this->model = $model;
        $this->user = $user;
        $this->permission = $permission;
        $this->clientModule = $clientModule;
        $this->db_prefix = env('DB_PREFIX', 'qxcms_');
    }

    public function create(array $request)
    {
        $client = $this->model->fill($this->makeClient($request));
        $client->save();
        $client->users()->create($this->makeUser($request, $client->id));
        $this->makeDB($client->database_name);
        $this->makeMigration($client);
        $this->makeRolePermission($client);
        return $client;
    }

    public function makeClient(array $request)
    {
        if (Str::endsWith($request['database_name'], 'db')) {
            $request['root_dir'] = substr($request['database_name'], 0, -2);
        } else {
            $request['root_dir'] = $request['database_name'];
        }
        return $request;
    }

    public function makeUser(array $request, $client_id)
    {
        return [
            'client_id' => $client_id,
            'name' => $request['name'],
            'username' => '',
            'email' => $request['email'],
            'password' => bcrypt($request['password']),
            'type_id' => 1,
            'role_id' => 2,
            'status' => $request['status'], 
        ];
    }

    public function makeDB($name)
    {
        if ($name != "") 
        {
            DB::statement('CREATE DATABASE IF NOT EXISTS '.$this->db_prefix.$name.';');
        }       
    }

    public function makeMigration($client)
    {
        $this->setConfig($client);
        return Artisan::call('migrate', array('--database'=>'client','--path'=>'database/migrations/client'));
    }

    public function makeRolePermission($client)
    {
        $this->setConfig($client);
        $clientModules = $this->clientModule->all();
        foreach ($clientModules as $clientModule) {
            $cmode = json_decode(json_encode($clientModule), true);
            $this->addPermission($cmode, 1);
            $this->addPermission($cmode, 2);
        }
        return $clientModules;
    }

    public function addPermission(array $clientModules, $role_id)
    {
        $id = $clientModules['id'];
        $this->permission->where('menu_id', $id)->where('role_id', $role_id)->delete();
        $this->permission->create($this->permissionRequest($clientModules, $role_id));
    }

    public function permissionRequest(array $clientModules, $role_id)
    {
        return $permissions = [
                'role_id' => $role_id,
                'menu_id' =>  $clientModules['id'],
                'can_access' => $clientModules['show_menu'],
                'can_create' => $clientModules['has_create'],
                'can_update' => $clientModules['has_update'],
                'can_delete' => $clientModules['has_delete'],
                'can_export' => $clientModules['has_export'],
                'can_import' => $clientModules['has_import'],
                'can_print' => $clientModules['has_print']
        ];
    }

    public function update($id, array $request, $client_config = true)
    {
        $client = $this->findById($id);
        $client->fill($this->getEditable($request));
        return $this->affectedRows($client, $client_config);
    }

    public function getEditable(array $request)
    {
        return Arr::except($request, ['database_name', 'root_dir', 'cpanel_email']);
    }

    public function affectedRows(Client $client, $client_config) 
    {
        if(count($client->getDirty()) > 0) {
            $client->save();
            session()->flash('success', 'Successfully updated.');
            if(!$client_config) {
                $this->logUser(85, 'Edit', auth('client')->user()->id, $client->id);
            }
        }
        return $client;
    }

    public function mainUser($id)
    {
        return $this->findById($id)->users()->where('type_id', 1)->first();
    }
}Modules/Likod/Repositories/Settings/Users/UserRepository.php000064400000004006152434100730020334 0ustar00<?php

namespace QxCMS\Modules\Likod\Repositories\Settings\Users;
use Illuminate\Support\Arr;
use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Likod\Repositories\Settings\Users\UserRepositoryInterface;
use QxCMS\Modules\Likod\User;
use QxCMS\Modules\Likod\Models\Settings\Roles\Role;

class UserRepository extends AbstractRepository implements UserRepositoryInterface
{
    protected $model;
    protected $role;
   
    function __construct(User $model, Role $role)
    {
        $this->model = $model;
        $this->role = $role;
    }

    public function create(array $request)
    {
        $user = $this->model->fill($this->makeUser($request));
        $user->save();
        return $user;
    }

    public function getUsersWithRole($columns = ['*'])
    {
        $users = $this->model->select($columns)->with('role');
        return $users;
    }

    public function update($id, array $request)
    {
        $user = $this->findById($id);
        $user->fill($this->changePassword($request));
        return $this->affectedRows($user);
    }

    public function affectedRows(User $user) 
    {
        if(count($user->getDirty()) > 0) {
            $user->save();
            session()->flash('success', 'Successfully updated.');
        }
        return $user;
    }

    public function makeUser(array $request)
    {
        return $request;
    }

    public function changePassword(array $request)
    {
        $confirm_password = $request['password_confirmation'];
        
        if(!empty($confirm_password)) {
            $request['password'] = bcrypt($confirm_password);
            return $request;
        }

        return  Arr::except($request, ['password_confirmation','password']);
    }

    public function getRoleLists($role_id = 1)
    {
        if($role_id == 1) return $this->role->pluck('name', 'id');
        return  $this->role->where('id', '<>', 1)->pluck('name', 'id');
    }

    public function delete($id)
    {
        $user = $this->findById($id);
        $user->delete();
        return true;
    }
}Modules/Likod/Repositories/Settings/Users/UserRepositoryInterface.php000066400000000151152434100730022154 0ustar00<?php

namespace QxCMS\Modules\Likod\Repositories\Settings\Users;

interface UserRepositoryInterface
{

}Modules/Likod/Repositories/Settings/Roles/RoleRepository.php000064400000062327152434100730020314 0ustar00<?php

namespace QxCMS\Modules\Likod\Repositories\Settings\Roles;
use Illuminate\Support\Arr;
use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Likod\Repositories\Settings\Roles\RoleRepositoryInterface;
use QxCMS\Modules\Likod\Models\Settings\Roles\Role;
use QxCMS\Modules\Likod\Models\Settings\Roles\Permission;
use QxCMS\Modules\Likod\Models\Developer\Module;
use DB;
use File;

class RoleRepository extends AbstractRepository implements RoleRepositoryInterface
{
    protected $model;
    protected $module;
    protected $permission;

    function __construct(Role $model, Module $module, Permission $permission)
    {
        $this->model = $model;
        $this->module = $module;
        $this->permission = $permission;
    }

   
    public function create(array $request)
    {
        $role = $this->model->fill($this->makeRole($request));
        $role->save();
        $this->makeRolePermissions($request, $role->id);
        return $role;
    }

    public function makeRole(array $request)
    {
        return Arr::except($request, ['module']);
    }


    public function makeRolePermissions(array $request, $role_id)
    {
        $modules = isset($request['module']) ? $request['module']:array();
        $this->permission->where('role_id', $role_id)->delete();
        if (count($modules) <= 0) return;
        foreach ($modules as $module_id => $module) {
            $module['role_id'] = $role_id;
            $module['module_id'] = $module_id;
            $this->permission->create($this->makeModulePermissions($module));
        }
        return $module;
    }

    public function makeModulePermissions(array $module)
    {
        return $useroles = [
            'menu_id' => $module['module_id'],
            'role_id' => $module['role_id'],
            'can_access' => (isset($module['can_access']) && !empty($module['can_access'])) ? $module['can_access']:0,
            'can_create' => (isset($module['can_create']) && !empty($module['can_create'])) ? $module['can_create']:0,
            'can_update' => (isset($module['can_update']) && !empty($module['can_update'])) ? $module['can_update']:0,
            'can_delete' => (isset($module['can_delete']) && !empty($module['can_delete'])) ? $module['can_delete']:0,
            'can_export' => (isset($module['can_export']) && !empty($module['can_export'])) ? $module['can_export']:0,
            'can_import' => (isset($module['can_import']) && !empty($module['can_upload'])) ? $module['can_import']:0,
            'can_print' => (isset($module['can_print']) && !empty($module['can_print'])) ? $module['can_print']:0,
        ];
    }

    public function select($columns = ['*'])
    {
        $roles = $this->model->select($columns);
        return $roles;
    }

    public function update($id, array $request)
    {
        $role = $this->findById($id);
        $role->fill($this->makeRole($request));
        $role->save();
        $this->makeRolePermissions($request, $role->id);
        $this->write_menu($id);
        return $role;
    }

    public function delete($id)
    {
        $role = $this->model->findOrFail($id);
        if(!$this->checkIfInUsed($role->users()->count())) return false;
        $role->permissions()->delete();
        $role->delete();
        return true;
    }

    public function checkIfInUsed($count = 0)
    {
        return (($count > 0) ? false:true); 
    }
    
    function build_role_permissions($role_id = 0, $disabled = '')
    {
        $modules = $this->module->select([
            'modules.*',
            'ups.can_access',
            'ups.can_delete',
            'ups.can_update',
            'ups.can_create', 
            'ups.can_export',
            'ups.can_import',
            'ups.can_print'
            ])
            ->where('modules.parent_id', 0)
            ->where('modules.menu_group_id', 1)
            ->where('modules.show_menu', 1)
            ->leftJoin(DB::raw('(SELECT * FROM role_permissions where role_id = '.$role_id.' ) as ups'), 'modules.id', '=', 'ups.menu_id')
            ->get();        
        $html_out = "<div class=\"box-group\" id=\"accordion\">";
        foreach ($modules as $module_key => $row )
        {
            $id = $row->id;
            $title = $row->title;
            $link_type = $row->link_type;
            $page_id = $row->page_id;
            $module_name = $row->module_name;
            $url = $row->url;
            $uri = $row->uri;
            $icon = $row->icon;
            $menu_group_id = $row->menu_group_id;
            $position = $row->position;
            $target = $row->target;
            $parent_id = $row->parent_id;
            $is_parent = $row->is_parent;
            $show_menu = $row->show_menu;
            $can_access = $row->can_access;
            $can_create = $row->can_create;
            $can_update = $row->can_update;
            $can_delete = $row->can_delete;
            $can_export = $row->can_export;
            $can_import = $row->can_import;
            $can_print = $row->can_print;
            $html_out .= "<div class=\"panel box box-primary\">";
                $html_out .= "<div class=\"box-header with-border\" data-toggle=\"collapse\" href=\"#collapse".$id."\" style=\"cursor:pointer;\"";
                    $html_out .= "<h4 class=\"box-title\">";
                        $html_out .= "<a href=\"\">";
                             $html_out .= "<b><input name=\"module[".$id."][can_access]\" value=\"1\" class=\"main-menu\" type=\"checkbox\" ".(($can_access) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"show\" data-access-id=\"".$role_id."\" ".$disabled.">&nbsp;<i class=\"fa fa-".$icon."\"></i>&nbsp;".$title."</b>";
                        $html_out .= "</a>";
                    $html_out .= "</h4>";
                $html_out .= "</div>";
                $html_out .= "<div id=\"collapse".$id."\" class=\"panel-collapse collapse in\">";
                    $html_out .= "<div class=\"box-body\" style=\"padding:0 !important\">";
                        $html_out   .= '<table class="table table-condensed table-bordered">';
                            $html_out .= "<thead>";
                                $html_out .= "<tr valign='middle'>";
                                        $html_out .= "<th colspan=\"3\" > Title</th>";

                                        $html_out .= "<th colspan=\"7\" style=\"text-align:center !important;\"> <b>Permissions</b> </th>";
                                $html_out .= "</tr>"; 
                            $html_out .= "</thead>";                    
                            $html_out .= "<tbody>";
                                $html_out .= "<tr>";
                                        $html_out .= "<td align=\"center\" colspan=\"3 \"></td>";
                                        $html_out .= "<td align=\"center\"> <b>Activate</b> </td>";
                                        $html_out .= "<td align=\"center\"> <b>Create</b> </td>";
                                        $html_out .= "<td align=\"center\"> <b>Update</b> </td>";
                                        $html_out .= "<td align=\"center\"> <b>Delete</b> </td>";
                                        $html_out .= "<td align=\"center\"> <b>Export</b> </td>";
                                        $html_out .= "<td align=\"center\"> <b>Import</b> </td>";
                                        $html_out .= "<td align=\"center\"> <b>Print</b> </td>";
                                $html_out .= "</tr>"; 
                                $html_out .=  $this->get_childs_role_permissions($id, $role_id, $disabled);
                            $html_out .= "</tbody>";
                        $html_out .= '</table>';
                    $html_out .= "</div>";
                $html_out .= "</div>";
            $html_out .= "</div>";
        }
        $html_out   .= '</div>';
        return $html_out;
    }

    function get_childs_role_permissions($id, $role_id, $disabled)
    {
        $has_subcats = FALSE; 
        $html_out  = '';
        $modules = $this->module->select('modules.*','ups.can_access','ups.can_delete','ups.can_update', 'ups.can_create', 'ups.can_export', 'ups.can_import', 'ups.can_print')
            ->where('modules.parent_id', $id)
            ->where('modules.menu_group_id', 1)
            ->where('modules.show_menu', 1)
            ->leftJoin(DB::raw('(SELECT * FROM role_permissions where role_id = '.$role_id.' ) as ups'), 'modules.id', '=', 'ups.menu_id')
            ->orderBy('modules.title', 'ASC')
            ->get();
        foreach ($modules as $module_key => $row )
        {
            $id = $row->id;
            $hashid = $row->hashid;
            $title = $row->title;
            $link_type = $row->link_type;
            $page_id = $row->page_id;
            $module_name = $row->module_name;
            $url = $row->url;
            $uri = $row->uri;
            $icon = $row->icon;
            $dyn_group_id = $row->menu_group_id;
            $position = $row->position;
            $target = $row->target;
            $parent_id = $row->parent_id;
            $is_parent = $row->is_parent;
            $show_menu = $row->show_menu;
            $has_read = $row->has_read;
            $has_create = $row->has_create;
            $has_update = $row->has_update;
            $has_delete = $row->has_delete;
            $has_export = $row->has_export;
            $has_import = $row->has_import;
            $has_print = $row->has_print;
            $can_access = $row->can_access;
            $can_create = $row->can_create;
            $can_update = $row->can_update;
            $can_delete = $row->can_delete;
            $can_export = $row->can_export;
            $can_import = $row->can_import;
            $can_print = $row->can_print;
            $has_subcats = TRUE;
            if ($is_parent == 1) {
                $html_out .= "<tr valign='top' class='sub-parent-tr'>";
                $html_out .= "<td colspan=\"3\" rowspan=\"1\"><b><i class=\"fa fa-".$icon."\"></i>&nbsp;".$title ."&nbsp;</b><i class=\"fa fa-long-arrow-right\"></i> </td>";
                $html_out .= "<td colspan=\"1\" align=\"center\"><input name=\"module[".$id."][can_access]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_access) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"show\" data-access-id=\"".$role_id."\" ".$disabled."></td>";
                $html_out .= "<td align=\"center\" colspan=\"8\">";
                $html_out .= "</td>";
                $html_out .= "</tr>";
                $html_out .= $this->get_childs2($id, $role_id,  $disabled);                        
            } else {                    
                $html_out .= "<tr valign='top' class='sub-parent-tr'>";
                $html_out .= "<td  colspan=\"3\" width=\"20%\" style='white-space:nowrap;'><i class=\"fa fa-".$icon."\"></i>&nbsp;".$title."</td>";
                $html_out .= "<td width=\"10%\" align=\"center\">";
                $html_out .= "<label><input name=\"module[".$id."][can_access]\" value=\"1\"  class=\"sub-menu\" type=\"checkbox\" ".(($can_access) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"show\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
                $html_out .= "</td>";
                $html_out .= "<td width=\"10%\" align=\"center\">";
                if ($has_create) {
                    $html_out .= "<label><input name=\"module[".$id."][can_create]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_create) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"create\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
                } else {
                    $html_out .= "<span class=\"fa fa-times text-red\"></span>";
                }
                $html_out .= "</td>";
                $html_out .= "<td width=\"10%\" align=\"center\">";
                if ($has_update) {
                    $html_out .= "<label><input name=\"module[".$id."][can_update]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_update) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"update\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
                } else {
                    $html_out .= "<span class=\"fa fa-times text-red\"></span>";
                }
                $html_out .= "</td>";
                $html_out .= "<td width=\"10%\" align=\"center\">";
                if ($has_delete) {
                    $html_out .= "<label><input name=\"module[".$id."][can_delete]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_delete) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"delete\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
                } else {
                   $html_out .= "<span class=\"fa fa-times text-red\"></span>";
                }
                $html_out .= "</td>";
                $html_out .= "<td width=\"10%\" align=\"center\">";
                if ($has_export) {
                    $html_out .= "<label><input name=\"module[".$id."][can_export]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_export) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"export\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
                } else {
                    $html_out .= "<span class=\"fa fa-times text-red\"></span>";
                }
                $html_out .= "</td>";
                $html_out .= "<td width=\"10%\" align=\"center\">";
                if ($has_import) {
                    $html_out .= "<label><input name=\"module[".$id."][can_import]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_import) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"import\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
                } else {
                    $html_out .= "<span class=\"fa fa-times text-red\"></span>";
                }
                $html_out .= "</td>";
                $html_out .= "<td width=\"10%\" align=\"center\">";
                if ($has_print) {
                    $html_out .= "<label><input name=\"module[".$id."][can_print]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_print) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"print\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
                } else {
                    $html_out .= "<span class=\"fa fa-times text-red\"></span>";
                }
                $html_out .= "</td>";
                $html_out .= '</tr>';                             
            }   
        }
        return ($has_subcats) ? $html_out : FALSE;
    }

    function get_childs2($id, $role_id, $disabled)
    {
        $has_subcats = FALSE; 
        $html_out  = '';
        $modules = $this->module->select('modules.*','ups.can_access','ups.can_delete','ups.can_update', 'ups.can_create', 'ups.can_export', 'ups.can_import', 'ups.can_print')
            ->where('modules.parent_id', $id)
            ->where('modules.menu_group_id', 1)
            ->where('modules.show_menu', 1)
            ->leftJoin(DB::raw('(SELECT * FROM role_permissions where role_id = '.$role_id.' ) as ups'), 'modules.id', '=', 'ups.menu_id')
            ->orderBy('modules.title', 'ASC')
            ->get();          
        foreach ($modules as $module_key => $row )
        {
            $id = $row->id;
            $title = $row->title;
            $link_type = $row->link_type;
            $page_id = $row->page_id;
            $module_name = $row->module_name;
            $url = $row->url;
            $uri = $row->uri;
            $dyn_group_id = $row->menu_group_id;
            $position = $row->position;
            $target = $row->target;
            $parent_id = $row->parent_id;
            $is_parent = $row->is_parent;
            $show_menu = $row->show_menu;
            $has_read = $row->has_read;
            $has_create = $row->has_create;
            $has_update = $row->has_update;
            $has_delete = $row->has_delete;
            $has_export = $row->has_export;
            $has_import = $row->has_import;
            $has_print = $row->has_print;                    
            $can_access = $row->can_access;
            $can_create = $row->can_create;
            $can_update = $row->can_update;
            $can_delete = $row->can_delete;
            $can_export = $row->can_export;
            $can_import = $row->can_import;
            $can_print = $row->can_print;
            $has_subcats = TRUE;
            $html_out .= "<tr valign='top' class='sub-child-tr sub-table'>";
            if($module_key == 0) {
                $html_out .= "<td rowspan=\"".count($modules)."\" colspan=\"2\" width=\"20%\" style='white-space:nowrap;background-color:#E1E1E1'></td>";
            }           
            $html_out .= "<td nowrap=\"nowrap\"> &nbsp;".$title."- ID: ".$id."</td>";
            $html_out .= "<td width=\"10%\" align=\"center\">";
            $html_out .= "<label><input name=\"module[".$id."][can_access]\" value=\"1\"  class=\"icheck\" type=\"checkbox\" ".(($can_access) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"show\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
            $html_out .= "</td>";
            $html_out .= "<td width=\"10%\" align=\"center\">";
            if ($has_create) {
                $html_out .= "<label><input name=\"module[".$id."][can_create]\" value=\"1\" class=\"icheck\" type=\"checkbox\" ".(($can_create) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"create\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
            } else {
                $html_out .= "<span class=\"fa fa-times text-red\"></span>";
            }
            $html_out .= "</td>";
            $html_out .= "<td width=\"10%\" align=\"center\">";
            if ($has_update) {
                $html_out .= "<label><input name=\"module[".$id."][can_update]\" value=\"1\" class=\"icheck\" type=\"checkbox\" ".(($can_update) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"update\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
            } else {
                $html_out .= "<span class=\"fa fa-times text-red\"></span>";
            }
            $html_out .= "</td>";
            $html_out .= "<td width=\"10%\" align=\"center\">";
            if ($has_delete) {
                $html_out .= "<label><input name=\"module[".$id."][can_delete]\" value=\"1\" class=\"icheck\" type=\"checkbox\" ".(($can_delete) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"delete\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
            } else {
               $html_out .= "<span class=\"fa fa-times text-red\"></span>";
            }
            $html_out .= "</td>";
            $html_out .= "<td width=\"10%\" align=\"center\">";
            if ($has_export) {
                $html_out .= "<label><input name=\"module[".$id."][can_export]\" value=\"1\" class=\"icheck\" type=\"checkbox\" ".(($can_export) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"export\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
            } else {
                $html_out .= "<span class=\"fa fa-times text-red\"></span>";
            }
            $html_out .= "</td>";
            $html_out .= "<td width=\"10%\" align=\"center\">";
            if ($has_import) {
                $html_out .= "<label><input name=\"module[".$id."][can_import]\" value=\"1\" class=\"icheck\" type=\"checkbox\" ".(($can_import) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"import\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
            } else {
                $html_out .= "<span class=\"fa fa-times text-red\"></span>";
            }
            $html_out .= "</td>";
            $html_out .= "<td width=\"10%\" align=\"center\">";
            if ($has_print) {
                $html_out .= "<label><input name=\"module[".$id."][can_print]\" value=\"1\" class=\"icheck\" type=\"checkbox\" ".(($can_print) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"print\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
            } else {
                $html_out .= "<span class=\"fa fa-times text-red\"></span>";
            }
            $html_out .= "</td>";
            $html_out .= '</tr>';
        }
        return ($has_subcats) ? $html_out : FALSE;        
    }

    function build_menu($role_id = 0)
    {
        $modules = $this->module->select('modules.*','ups.can_access','ups.can_delete','ups.can_update', 'ups.can_create', 'ups.can_export', 'ups.can_import', 'ups.can_print')
            ->where('modules.parent_id', 0)
            ->where('modules.menu_group_id', 1)
            ->where('modules.show_menu', 1)
            ->where('ups.can_access', 1)
            ->leftJoin(DB::raw('(SELECT * FROM role_permissions where role_id = '.$role_id.' ) as ups'), 'modules.id', '=', 'ups.menu_id')
            ->where('ups.can_access', 1)
            ->orderBy('id', 'ASC')
            ->get();
        $html_out = "\t"."<ul class=\"nav navbar-nav\">"."\n";
        $html_out .= "\t\t"."<li>"."\n";
        $html_out .= "\t\t\t"."<a href=\"#\"><i class=\"fa fa-cogs\"></i> Developer <span class=\"caret\"></span></a>"."\n";
        $html_out .= "\t\t\t\t"."<ul class=\"dropdown-menu\" role=\"menu\">"."\n";
        $html_out .= "\t\t\t\t\t"."<li><a href=\"".url(config('modules.likod').'/developer/modules')."\"><i class=\"fa fa-cubes\"></i> Module Manager</a></li>"."\n";
        $html_out .= "\t\t\t\t\t"."<li><a href=\"".url(config('modules.likod').'/developer/client-modules')."\"><i class=\"fa fa-cubes\"></i> QxCMS Module Manager</a></li>"."\n";
        $html_out .= "\t\t\t\t"."</ul>"."\n";
        $html_out .= "\t\t"."</li>"."\n";
        foreach ($modules as $menu_key => $row )
        {               
            $id = $row->id;
            $hashid = $row->hashid;
            $title = $row->title;
            $link_type = $row->link_type;
            $page_id = $row->page_id;
            $module_name = $row->module_name;
            $url = $row->url;
            $uri = $row->uri;
            $icon = $row->icon;
            $menu_group_id = $row->menu_group_id;
            $position = $row->position;
            $target = $row->target;
            $parent_id = $row->parent_id;
            $is_parent = $row->is_parent;
            $show_menu = $row->show_menu;    
            if ($show_menu && $parent_id == 0) {
                if ($is_parent == TRUE) {
                    $html_out .= "\t\t"."<li>"."\n";
                    $html_out .= "\t\t\t"."<a href=\"#\"><i class=\"fa fa-".$icon."\"></i> ".$title." <span class=\"caret\"></span></a>"."\n";
                } else {
                    $html_out .= "\t\t"."<li>"."\n";
                    $html_out .= "\t\t\t".'<a href="'.url(config('modules.likod').'/'.$url).'" title="'.$title.'" id="menu'.$id.'" target="'.$target.'"><span class="fa fa-'.$icon.'"></span>&nbsp;'.$title.'</a>'."\n";
                }   
                $html_out .= $this->get_menu_childs($role_id, $id);
            }
            $html_out .= '</li>'."\n";
        }
        $html_out .= "\t\t".'</ul>' . "\n";
        return $html_out;
    }

    function get_menu_childs($role_id, $id)
    {
        $has_subcats = FALSE;
        $html_out  = '';
        $html_out .= "\t\t\t\t\t".'<ul class="dropdown-menu">'."\n";
        $modules = $this->module->select('modules.*','ups.can_access','ups.can_delete','ups.can_update', 'ups.can_create', 'ups.can_export', 'ups.can_import', 'ups.can_print')
            ->where('modules.parent_id', $id)
            ->where('modules.menu_group_id', 1)
            ->where('modules.show_menu', 1)
            ->where('ups.can_access', 1)
            ->leftJoin(DB::raw('(SELECT * FROM role_permissions where role_id = '.$role_id.' ) as ups'), 'modules.id', '=', 'ups.menu_id')
            ->orderBy('modules.title', 'ASC')
            ->get();
        foreach ($modules as $menu_key => $row )
        {
            $id = $row->id;
            $hashid = $row->hashid;
            $title = $row->title;
            $link_type = $row->link_type;
            $page_id = $row->page_id;
            $module_name = $row->module_name;
            $url = $row->url;
            $uri = $row->uri;
            $icon = $row->icon;
            $menu_group_id = $row->menu_group_id;
            $position = $row->position;
            $target = $row->target;
            $parent_id = $row->parent_id;
            $is_parent = $row->is_parent;
            $show_menu = $row->can_access;
            $has_subcats = TRUE;
            if($show_menu) {
                if ($is_parent == TRUE) {
                    $html_out .= "\t\t\t".'<li  class="dropdown"><a href="'.(($uri != "") ? $uri:'#').'" title="'.$title.'" id="'.$id.'" target="'.$target.'"><i class="fa fa-'.$icon.'"></i>&nbsp;'.$title.'&nbsp;></a>';
     
                } else {
                    $html_out .= "\t\t\t".'<li><a href="'.url(config('modules.likod').'/'.$url).'" title="'.$title.'" id="'.$id.'" target="'.$target.'"><i class="fa fa-'.$icon.'"></i>&nbsp;'.$title.'</a>';
                }
            }
            $html_out .= $this->get_menu_childs($role_id, $id);
            $html_out .= '</li>' . "\n";
        }
        $html_out .= "\t\t\t\t\t".'</ul>' . "\n";
        return ($has_subcats) ? $html_out : FALSE;
    }

    function write_menu($role_id)
    {
        $view_path = realpath(app_path()).'/Modules/Likod/Views';
        $realpath =  $view_path."/cache/menus/";
        File::makeDirectory($realpath, 0775, true, true);
        $filename = "custom_".$role_id.".blade.php"; 
        $contents = $this->build_menu($role_id);
        $created = File::put($realpath.$filename, $contents);
    }
}Modules/Likod/Repositories/Settings/Roles/RoleRepositoryInterface.php000066400000000151152434100730022122 0ustar00<?php

namespace QxCMS\Modules\Likod\Repositories\Settings\Roles;

interface RoleRepositoryInterface
{

}Modules/Likod/routes.php000066400000004772152434100730011263 0ustar00<?php
Route::group(['namespace'=>'Auth', 'prefix' => 'auth'], function(){
    Route::get('/logout', 'AuthController@logout');
    Route::group(['prefix'=>'login', 'middleware'=>'guest.likod'], function(){
        Route::get('/',  'AuthController@getLogin');
        Route::post('/', 'AuthController@postLogin');
    });
});

Route::group(['middleware'=>['auth.likod']], function(){
    Route::get('/', function(){
        return redirect('likod/auth/login');
    });
    Route::group(['namespace'=>'Dashboard'], function(){
        Route::group(['prefix'=>'dashboard'], function(){
            Route::get('/', 'DashboardController@dashboard');
        });
    });
    Route::group(['namespace'=>'Settings'], function() {        
        Route::group(['prefix'=>'settings'], function() {
            Route::group(['prefix' => 'users'], function() {
                Route::get('get-users-data', 'UserController@getUsersData');
            });
            Route::resource('users', 'UserController',
            [
                'names' => [
                    'index' => config('modules.likod').'.settings.users.index',
                    'create' => config('modules.likod').'.settings.users.create',
                    'store' => config('modules.likod').'.settings.users.store',
                    'show' => config('modules.likod').'.settings.users.show',
                    'edit' => config('modules.likod').'.settings.users.edit',
                    'update' => config('modules.likod').'.settings.users.update',
                    'destroy' => config('modules.likod').'.settings.users.destroy'
                ]
            ]);           
        });
    });
    Route::group(['namespace'=>'Clients'], function() {
        Route::group(['prefix' => 'clients'], function() {
            Route::post('get-clients-data', 'ClientsController@getClientsData');
            Route::get('{id}/login', 'ClientsController@login');
        });
        Route::resource('clients', 'ClientsController',
        [
            'names' => [
                'index' => config('modules.likod').'.clients.index',
                'create' => config('modules.likod').'.clients.create',
                'store' => config('modules.likod').'.clients.store',
                'show' => config('modules.likod').'.clients.show',
                'edit' => config('modules.likod').'.clients.edit',
                'update' => config('modules.likod').'.clients.update',
                'destroy' => config('modules.likod').'.clients.destroy'
            ]
        ]);
    });
});Modules/Likod/Controllers/Clients/ClientsController.php000064400000013061152434100730017303 0ustar00<?php

namespace QxCMS\Modules\Likod\Controllers\Clients;

use Illuminate\Http\Request;
use QxCMS\Modules\Likod\Requests\Clients\ClientRequest;

use QxCMS\Http\Controllers\Controller;
use QxCMS\Modules\Likod\Repositories\Clients\Clients\ClientRepositoryInterface as Client;
use QxCMS\Modules\Client\Repositories\Settings\Roles\RoleRepositoryInterface as Role;
use DB;
use Datatables;
use Auth;
use Lang;
use Gate;
class ClientsController extends Controller
{
	protected $client;
    protected $role;
	protected $auth;
	protected $prefix_name = '';

	public function __construct(Client $client, Role $role)
	{
		$this->auth = Auth::guard('likod');
		$this->prefix_name = config('modules.likod');
		$this->client = $client;
        $this->role = $role;
	}

    public function index()
    {
        return view('Likod::clients.index');
    }

    public function create()
    {
        $data['datepickerformats'] =  config('account.dateformat.lists');
        $data['displaydateformats'] =  config('account.displaydateformat.lists');
        $data['nameformats'] =  config('account.nameformat');
        $data['mail_driver'] =  config('account.mail.driver');
        $data['storage_type'] =  config('account.storage.types');
    	return view('Likod::clients.create', $data);
    }

    public function store(ClientRequest $request)
    {
        $this->client->create($request->all());
        $request->session()->flash('success', 'Client successfully created.');
        return redirect()->route($this->prefix_name.'.clients.index');
    }

    public function edit($hashid)
    {
        $id = decode($hashid);
        $data['client'] = $client = $this->client->findById($id);
        $data['datepickerformats'] =  config('account.dateformat.lists');
        $data['displaydateformats'] =  config('account.displaydateformat.lists');
        $data['nameformats'] =  config('account.nameformat');
        $data['mail_driver'] =  config('account.mail.driver');
        $data['storage_type'] =  config('account.storage.types');
        return view('Likod::clients.edit', $data);
    }

    public function update(ClientRequest $request, $hashid)
    {
        $id = decode($hashid);
        $this->client->update($id, $request->all());
        return redirect($this->prefix_name.'/clients');
    }

    public function login(Request $request, $hashid)
    {
        $id = decode($hashid);
        $user = $this->client->mainUser($id);
        if (Auth::guard('client')->loginUsingId($user->id)) {
            if(Auth::guard('client')->user()->client->status==1) {
                $this->role->setConfig($user->client);
                $this->role->write_menu($user->client->id, $user->role_id);
                return redirect(config('modules.client').'/dashboard');
            } else {
                Auth::guard('client')->logout();
                $request->session()->regenerate();
                session()->flash('error', 'This client is inactive.');
                return redirect(config('modules.client').'/auth/login');
            }                    
        }
        $request->session()->flash('error','Unable to login this account.');
        return redirect($this->prefix_name.'/clients');
    }

    /*
    * Datatables
    */
    public function getClientsData()
    {        
        $clients =  $this->client->select([
            'id',
            'client_name',
            'number_of_users',
            'monthly_mail_quota',
            'disk_size',
            'status'
        ]);
        return Datatables::of($clients)
            ->editColumn('number_of_users',function($client){
                if($client->number_of_users == 0) return 'Unlimited';
                return $client->number_of_users;
            })
            ->editColumn('monthly_mail_quota',function($client){
                if($client->monthly_mail_quota == 0) return 'Unlimited';
                return $client->monthly_mail_quota;
            })
            ->editColumn('disk_size',function($client){
                if($client->disk_size == 0) return 'Unlimited';
                return $client->disk_size;
            })
            ->editColumn('status',function($client){
                if($client->status == 0) return '<span class="label label-danger">Deactivated</span>';
                return '<span class="label label-success">Activated</span>';
            })
            ->addColumn('action', function ($client) {
                $html_out = '';
                $html_out .= '<a href="'.url($this->prefix_name.'/clients/'.$client->hashid.'/edit').'" class="btn btn-xs btn-flat btn-warning" data-toggle="tooltip" data-placement="top" title="Edit"><i class="fa fa-pencil"></i></a>&nbsp;&nbsp;';
                $html_out .= '<a href="'.url($this->prefix_name.'/clients/'.$client->hashid.'/login').'" class="btn btn-xs btn-flat btn-success" data-toggle="tooltip" data-placement="top" title="Login" target="_blank"><i class="fa fa-sign-in"></i></a>&nbsp;&nbsp;';
                return $html_out;
            })
            ->rawColumns(['status', 'action'])
            ->make(true);
    }

    public function setConfig($client)
    {
        if(!empty($client)) {
          return  Config::set('database.connections.client', array(
                'driver'    => 'mysql',
                'host'      => $client->database_host,
                'database'  => 'myradh_'.$client->database_name,
                'username'  => $client->database_username,
                'password'  => $client->database_password,
                'charset'   => 'utf8',
                'collation' => 'utf8_unicode_ci',
                'prefix'    => '',
            ));
        }
    }
}Modules/Likod/Controllers/Auth/AuthController.php000066400000006020152434100730016102 0ustar00<?php

namespace QxCMS\Modules\Likod\Controllers\Auth;

use QxCMS\Modules\Likod\User;
use Validator;
use JsValidator;
use Auth;
use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use QxCMS\Modules\Likod\Repositories\Settings\Roles\RoleRepositoryInterface as Role;

class AuthController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Registration & Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users, as well as the
    | authentication of existing users. By default, this controller uses
    | a simple trait to add these behaviors. Why don't you explore it?
    |
    */

    use AuthenticatesUsers;

    /**
     * Where to redirect users after login / registration.
     *
     * @var string
     */
    protected $redirectTo = '/likod/dashboard';
    protected $guard = 'likod';
    protected $redirectAfterLogout = 'likod/auth/login';
    protected $role;
    /**
     * Create a new authentication controller instance.
     *
     * @return void
     */
    public function __construct(Role $role)
    {
        $this->middleware('guest.likod', ['except' => 'logout']);
        $this->role = $role;
    }

    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => 'required|max:255',
            'email' => 'required|email|max:255|unique:users',
            'password' => 'required|confirmed|min:6',
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return User
     */
    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
        ]);
    }

    public function getLogin()
    {
        $rules = array(
            'email' => 'required|email',
            'password' => 'required',
        );
        $validator = JsValidator::make($rules, array(), array(), '#login-form');
        return view('Likod::auth.login', ['validator'=> $validator]);
    }    

    public function postLogin(Request $request)
    {
        return $this->login($request);
    }
    
    protected function authenticated(Request $request, $user)
    {
        return redirect($this->redirectTo);
    }

    public function guard() 
    {
        return Auth::guard('likod');
    }

    public function logout(Request $request)
    {
        $this->guard()->logout();
        $request->session()->regenerate();
        session()->flash('logout', 'You have successfully logged out!');
        return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
    }
}Modules/Likod/Controllers/Settings/UserController.php000066400000007331152434100730017024 0ustar00<?php

namespace QxCMS\Modules\Likod\Controllers\Settings;

use Illuminate\Http\Request;
use QxCMS\Modules\Likod\Requests\Settings\UserRequest;

use QxCMS\Http\Requests;
use QxCMS\Http\Controllers\Controller;
use QxCMS\Modules\Likod\Repositories\Settings\Users\UserRepositoryInterface as User;
use DB;
use Datatables;
use Auth;
use Lang;
use Gate;
class UserController extends Controller
{
    protected $user;
    protected $auth;
    protected $prefix_name = '';

    public function __construct(
       User $user
    )
    {
        $this->auth = Auth::guard('likod');
        $this->prefix_name = config('modules.likod');
        $this->user = $user;
    }
   
    public function index()
    {
        return view('Likod::settings.users.index');
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        $data['roles'] = $this->user->getRolelists();
        return view('Likod::settings.users.create', $data);
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(UserRequest $request)
    {
        $user = $this->user->create($request->all()); 
        session()->flash('success', 'Successfully added.');
        return redirect($this->prefix_name.'/settings/users');
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($hashid)
    {
        $id = decode($hashid);
        $data['roles'] = $this->user->getRolelists($this->auth->user()->role_id);
        $data['user'] = $this->user->findById($id);
        return view('Likod::settings.users.edit', $data);
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(UserRequest $request, $hashid)
    {
        $id = decode($hashid);
        $this->user->update($id, $request->all());
        return redirect($this->prefix_name.'/settings/users');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($hashid)
    {
        $id = decode($hashid);
        if(!$this->user->delete($id))
        {
            return $this->user->getAjaxResponse('error', 'User is currently used and connot be deleted.');
        } 
        return $this->user->getAjaxResponse('success', 'Successfully deleted.');
    }

     /*
     * Datatables
     */
    public function getUsersData()
    {        
        $users = $this->user->getUsersWithRole(['id', 'role_id', 'name', 'email']);
        return Datatables::of($users)
            ->addColumn('action', function ($user) {
                $html_out = '';
                $html_out .= '<a href="'.url($this->prefix_name.'/settings/users/'.$user->hashid.'/edit').'" class="btn btn-xs btn-flat btn-warning" data-toggle="tooltip" data-placement="top" title="Edit"><i class="fa fa-pencil"></i></a>&nbsp;&nbsp;';
                $html_out .= '<a href="#delete-'.$user->hashid.'" class="btn btn-xs btn-flat btn-danger" id="btn-delete" data-action="'.url($this->prefix_name).'/settings/users/'.$user->hashid.'" data-toggle="tooltip" data-placement="top" title="Delete"><i class="fa fa-trash-o"></i></a>';
                return $html_out;
            })
            ->make(true);
    }
}Modules/Likod/Controllers/Dashboard/DashboardController.php000066400000000455152434100730020064 0ustar00<?php

namespace QxCMS\Modules\Likod\Controllers\Dashboard;

use Illuminate\Http\Request;

use QxCMS\Http\Requests;
use QxCMS\Http\Controllers\Controller;

class DashboardController extends Controller
{    
    public function dashboard()
    {
    	return view('Likod::dashboard.dashboard');
    }
}
Modules/Likod/User.php000066400000001734152434100730010653 0ustar00<?php

namespace QxCMS\Modules\Likod;

use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    protected $connection = 'qxcms';
    protected $table = 'users';
    public $module_id = 3;
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password', 'role_id',
    ];

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    protected $appends = ['hashid'];
    /*
     * Model Accessors
     */

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    /*
     * Model Relationships
     */
    public function role()
    {
        return $this->belongsTo('QxCMS\Modules\Likod\Models\Settings\Roles\Role', 'role_id');
    }

    public function menu_id()
    {
        return $this->menu_id;
    }
}Modules/Likod/Requests/Clients/ClientRequest.php000066400000016725152434100730015746 0ustar00<?php

namespace QxCMS\Modules\Likod\Requests\Clients;

use Illuminate\Foundation\Http\FormRequest;

class ClientRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        if($this->getId()) {
            return [
                'client_name' => 'required|min:6',
                'client_address' => 'required|min:6',
                'telephone_no' => 'required|min:6',
                'email' => 'required|email',
                //'database_name' => 'required|min:5',
                'database_host' => 'required',
                'database_username' => 'required',
                'status' => 'required|in:0,1',
                'number_of_users' => 'required|numeric',
                'disk_size' => 'required|numeric',
                'date_picker_format' => 'required|numeric|in:1,2,3',
                'monthly_mail_quota' => 'required|numeric',
                'mail_driver' => 'required|in:smtp,mail',
                'mail_sender_address' => 'required|email',
                'mail_sender_name' => 'required|min:6',
                'mail_host' => 'required',
                'mail_username' => 'required',
                'mail_password' => 'required',
                'mail_port' => 'required|numeric',
                'storage_type' => 'required|in:public,s3',
                's3_key' => 'required_if:storage_type,s3',
                's3_secret' => 'required_if:storage_type,s3',
                's3_region' => 'required_if:storage_type,s3',
                's3_bucket_name' => 'required_if:storage_type,s3',
                'cpanel_host' => 'required_with:create_email',
                'cpanel_ip' => 'required_with:create_email',
                'cpanel_port' => 'required_with:create_email',
                'cpanel_account' => 'required_with:create_email',
                'cpanel_password' => 'required_with:create_email',
                'cpanel_domain' => 'required_with:create_email',
                'cpanel_user_default_password' => 'required_with:create_email',
            ];
        } 

        return [
                'name' => 'required|min:6',                
                'email' => 'required|email',
                'password' => 'required|min:6|confirmed',
                'client_name' => 'required|min:6',
                'client_address' => 'required|min:6',
                'telephone_no' => 'required|min:6',
                'email' => 'required|email',
                'database_name' => 'required|min:5',
                'database_host' => 'required',
                'database_username' => 'required',
                'status' => 'required|in:0,1',
                'number_of_users' => 'required|numeric',
                'disk_size' => 'required|numeric',
                'date_picker_format' => 'required|numeric|in:1,2,3',
                'monthly_mail_quota' => 'required|numeric',
                'mail_driver' => 'required|in:smtp,mail',
                'mail_sender_address' => 'required|email',
                'mail_sender_name' => 'required|min:6',
                'mail_host' => 'required',
                'mail_username' => 'required',
                'mail_password' => 'required',
                'mail_port' => 'required|numeric',
                'storage_type' => 'required|in:public,s3',
                's3_key' => 'required_if:storage_type,s3',
                's3_secret' => 'required_if:storage_type,s3',
                's3_region' => 'required_if:storage_type,s3',
                's3_bucket_name' => 'required_if:storage_type,s3',
                'cpanel_host' => 'required_with:create_email',
                'cpanel_ip' => 'required_with:create_email',
                'cpanel_port' => 'required_with:create_email',
                'cpanel_account' => 'required_with:create_email',
                'cpanel_password' => 'required_with:create_email',
                'cpanel_domain' => 'required_with:create_email',
                'cpanel_user_default_password' => 'required_with:create_email',
            ];
    }

    public function messages()
    {
        if($this->getId()) {
            return [
                'password.confirmed' => 'Re-type password does not match.',
                'status.required' => 'The account status is a required field.',
                'status.in' => 'The selected account status is invalid.',
                's3_key.required_if' => 'The :attribute field is required if storage type is Amazon S3.',
                's3_secret.required_if' => 'The :attribute field is required if storage type is Amazon S3.',
                's3_region.required_if' => 'The :attribute field is required if storage type is Amazon S3.',
                's3_bucket_name.required_if' => 'The :attribute field is required if storage type is Amazon S3.',
                'cpanel_host.required_with' => 'The :attribute field is required when create email is checked.',
                'cpanel_ip.required_with' => 'The :attribute field is required when create email is checked.',
                'cpanel_port.required_with' => 'The :attribute field is required when create email is checked.',
                'cpanel_account.required_with' => 'The :attribute field is required when create email is checked.',
                'cpanel_password.required_with' => 'The :attribute field is required when create email is checked.',
                'cpanel_domain.required_with' => 'The :attribute field is required when create email is checked.',
                'cpanel_user_default_password.required_with' => 'The :attribute field is required when create email is checked.',
            ];
        }

        return [
                'name.required' => 'The name of user is a required field.',
                'name.min' => 'The name of user must be at least :min characters.',
                'password.confirmed' => 'Re-type password does not match.',
                'status.required' => 'The account status is a required field.',
                'status.in' => 'The selected account status is invalid.',
                's3_key.required_if' => 'The :attribute field is required if storage type is Amazon S3.',
                's3_secret.required_if' => 'The :attribute field is required if storage type is Amazon S3.',
                's3_region.required_if' => 'The :attribute field is required if storage type is Amazon S3.',
                's3_bucket_name.required_if' => 'The :attribute field is required if storage type is Amazon S3.',
                'cpanel_host.required_with' => 'The :attribute field is required when create email is checked.',
                'cpanel_ip.required_with' => 'The :attribute field is required when create email is checked.',
                'cpanel_port.required_with' => 'The :attribute field is required when create email is checked.',
                'cpanel_account.required_with' => 'The :attribute field is required when create email is checked.',
                'cpanel_password.required_with' => 'The :attribute field is required when create email is checked.',
                'cpanel_domain.required_with' => 'The :attribute field is required when create email is checked.',
                'cpanel_user_default_password.required_with' => 'The :attribute field is required when create email is checked.',
            ];
    }

    public function getId()
    {
        return decode($this->client);
    }
}
Modules/Likod/Requests/Settings/UserRequest.php000066400000003414152434100730015634 0ustar00<?php

namespace QxCMS\Modules\Likod\Requests\Settings;

use Illuminate\Foundation\Http\FormRequest;

class UserRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        if($this->getId()) {
            return [
                'name' => 'required|min:3',
                'email' => 'required|email|unique:myradh.users,email,'.(($this->getId()) ? $this->getId():'NULL'),
                'role_id' => 'required',
                'password' => 'min:6',
                'password_confirmation' => 'required_with:password|min:6|same:password'
            ];
        }

        return [
                'name' => 'required|min:3',
                'email' => 'required|email|unique:myradh.users,email,'.(($this->getId()) ? $this->getId():'NULL'),
                'role_id' => 'required',
                'password' => 'required|min:6',
                'password_confirmation' => 'required|min:6|same:password'
            ];

    }

    public function messages()
    {
        return [
                'role_id.required' => 'The role field is required.',
                'password.required' => 'The password field is required.',
                'password_confirmation.required' => 'The re-type password field is required.',
                'password_confirmation.required_with' => 'Please re-type your password.',
                'password_confirmation.min' => 'The re-type password must be at least :min characters.',
            ];
    }

    public function getId()
    {
        return decode($this->user);
    }
}Modules/Client/Models/Principals/Principal.php000066400000003667152434100730015370 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Principals;

/*use Illuminate\Database\Eloquent\Model;*/
use Illuminate\Foundation\Auth\User as Authenticatable;
use Carbon\Carbon;

class Principal extends Authenticatable
{
    protected $connection = "client";
    protected $table = "principals";
    
    public $module_id = 4;
    
    protected $guarded = []; 

    public $principal_status = [
        'Active' =>'Active',
        'Inactive' => 'Inactive'
    ];

    protected $appends = ['hashid'];

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function setPasswordAttribute($value)
    {
        if(!empty($value)) {
            return $this->attributes['password'] = bcrypt($value);
        }
      	return $this->attributes['password'] = "";
    }

    public function setContactDetailsAttribute($value)
    {   
        if(is_array($value)) {
            $arr_clean = array_filter($value, 'strlen');
            if(!empty($arr_clean))
            {
                $str_value =  '"'.implode('","', $arr_clean).'"';
                return $this->attributes['contact_details'] = $str_value;
            }
            
        }

        return $this->attributes['contact_details'] = "";

    }

    public function getContactDetailsAttribute($value)
    {
        $clean_value = trim($value, '"');
        if(!empty($clean_value))
        {
           return $arr_value =  explode('","', $clean_value);
        }
        return '';
    }

    public function client()
    {
        return $this->belongsTo('QxCMS\Modules\Likod\Models\Clients\Client', 'client_id');
    }

    public function contacts()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Principals\ContactPerson', 'principal_id');
    }

    public function scopeSearchByName($query, $criteria = null)
    {
        if(!empty($criteria))
        {
            return $query->where('name', 'LIKE', '%'.$criteria.'%');
        }
    }
}Modules/Client/Models/Principals/ContactNumber.php000066400000001100152434100730016167 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Principals;

use Illuminate\Database\Eloquent\Model;

class ContactNumber extends Model
{
    protected $connection = "client";
    protected $table = "principal_contact_persons_numbers";
    public $module_id = 4;
    
    protected $guarded = [];

    protected $appends = ['hashid'];

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function person()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Principals\ContactPerson', 'principal_contact_id');
    }
}Modules/Client/Models/Principals/ContactPerson.php000066400000001323152434100730016214 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Principals;

use Illuminate\Database\Eloquent\Model;

class ContactPerson extends Model
{
    protected $connection = "client";
    protected $table = "principal_contact_persons";
     public $module_id = 4;
    
    protected $guarded = ['contact'];

    protected $appends = ['hashid'];

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function principal()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Principals\Principal', 'principal_id');
    }

    public function numbers()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Principals\ContactNumber', 'principal_contact_id');
    }
}Modules/Client/Models/Principals/PrincipalUserAssign.php000066400000000377152434100730017367 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Principals;

use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;

class PrincipalUserAssign extends Model
{
    protected $connection = "client";
    protected $table = "assigned_users_principals";    
}Modules/Client/Models/Subject/Subject.php000066400000005760152434100730014335 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Subject;

use Illuminate\Database\Eloquent\Model;
use Collective\Html\Eloquent\FormAccessible;
use \Carbon\Carbon;
class Subject extends Model
{
    use FormAccessible;

    protected $connection = 'client';

    protected $table = 'survey_subjects';
    
    public $module_id = 6;

    /*
    * The attributes that are mass assignable.
    *
    * @var array
    */
    protected $guarded = [];

    protected $appends = ['hashid'];
   

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    // Interview Date Overrides
    public function setInterviewDateAttribute($value) 
    {
        if($value <> '') {
            $dateformats = getDateFormatConfig('set');
            return $this->attributes['interview_date'] = Carbon::createFromFormat($dateformats['php'], $value)->format('Y-m-d');
        }
        return $this->attributes['interview_date'] = '0000-00-00';
    }

    public function getInterviewDateAttribute($value) 
    {
        if($value <> '0000-00-00') {
            $dateformats = getDateFormatConfig('get');
            return Carbon::createFromFormat('Y-m-d', $value)->format($dateformats['php']);
        }
        return;
    }

    public function formInterviewDateAttribute($value)
    {
        if($value <> '0000-00-00') {
            $dateformats = getDateFormatConfig('form');
            return Carbon::createFromFormat('Y-m-d', $value)->format($dateformats['php']);
        }
        return;
    }


    public function setCompletionDateAttribute($value) 
    {
        if($value <> '') {
            $dateformats = getDateFormatConfig('set');
            return $this->attributes['completion_date'] = Carbon::createFromFormat($dateformats['php'], $value)->format('Y-m-d');
        }
        return $this->attributes['completion_date'] = '0000-00-00';
    }

    public function getCompletionDateAttribute($value) 
    {
        if($value <> '0000-00-00') {
            $dateformats = getDateFormatConfig('get');
            return Carbon::createFromFormat('Y-m-d', $value)->format($dateformats['php']);
        }
        return;
    }

    public function formCompletionDateAttribute($value)
    {
        if($value <> '0000-00-00') {
            $dateformats = getDateFormatConfig('form');
            return Carbon::createFromFormat('Y-m-d', $value)->format($dateformats['php']);
        }
        return;
    }

    /*
    * Model Custom Functions
    */

    public function principal()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Principals\Principal', 'principal_id');
    }

    public function template()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Questionnaire\Template', 'template_id');
    }

    public function fieldOfficer()
    {
        return $this->belongsTo('QxCMS\Modules\Likod\Models\Clients\User', 'field_officer_assigned');
    }

    public function editor()
    {
        return $this->belongsTo('QxCMS\Modules\Likod\Models\Clients\User', 'editor_assigned');
    }
}Modules/Client/Models/JobOpening/JobOpening.php000066400000004700152434100730015414 0ustar00<?php

namespace QxCMS\Modules\Client\Models\JobOpening;

use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;

class JobOpening extends Model
{
    protected $connection = 'client';
    protected $table = 'job_opening';
    public $module_id = 14;
    
    protected $guarded = [];
    protected $appends = ['hashid'];

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function setOpeningDateAttribute($value) 
    {
        if($value <> '') {
            $dateformats = getDateFormatConfig('set');
            return $this->attributes['opening_date'] = Carbon::createFromFormat($dateformats['php'], $value)->format('Y-m-d');
        }
        return $this->attributes['opening_date'] = '0000-00-00';
    }

    public function getOpeningDateAttribute($value) 
    {
        if($value <> '0000-00-00') {
            $dateformats = getDateFormatConfig('get');
            return Carbon::createFromFormat('Y-m-d', $value)->format($dateformats['php']);
        }
        return;
    }

    public function formOpeningDateAttribute($value)
    {
        if($value <> '0000-00-00') {
            $dateformats = getDateFormatConfig('form');
            return Carbon::createFromFormat('Y-m-d', $value)->format($dateformats['php']);
        }
        return;
    }

    public function setClosingDateAttribute($value) 
    {
        if($value <> '') {
            $dateformats = getDateFormatConfig('set');
            return $this->attributes['closing_date'] = Carbon::createFromFormat($dateformats['php'], $value)->format('Y-m-d');
        }
        return $this->attributes['closing_date'] = '0000-00-00';
    }

    public function getClosingDateAttribute($value) 
    {
        if($value <> '0000-00-00') {
            $dateformats = getDateFormatConfig('get');
            return Carbon::createFromFormat('Y-m-d', $value)->format($dateformats['php']);
        }
        return;
    }

    public function formClosingDateAttribute($value)
    {
        if($value <> '0000-00-00') {
            $dateformats = getDateFormatConfig('form');
            return Carbon::createFromFormat('Y-m-d', $value)->format($dateformats['php']);
        }
        return;
    }

    public function country()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Settings\Country', 'country_id');
    }

    public function applicants()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Applicants\JobApplied', 'job_id');
    }
}
Modules/Client/Models/Pages/FAQ.php000066400000001375152434100730013003 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Pages;

use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;

class FAQ extends Model
{
    protected $connection = 'client';
    protected $table = 'faq';
    public $module_id = 17;

    protected $guarded = [];
    protected $appends = ['hashid', 'status_name'];

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function getStatusNameAttribute()
    {
        if($this->status == 'Publish') return '<span class="label label-success">Publish</span>';
        else if($this->status == 'Draft') return '<span class="label label-warning">Draft</span>';
        else if($this->status == 'Inactive') return '<span class="label label-danger">Inactive</span>';
    }
}Modules/Client/Models/Pages/AboutUs.php000066400000001406152434100730013751 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Pages;

use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;

class AboutUs extends Model
{
    protected $connection = 'client';
    protected $table = 'about_us';
    public $module_id = 16;

    protected $guarded = [];
    protected $appends = ['hashid', 'status_name'];

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function getStatusNameAttribute()
    {
        if($this->status == 'Publish') return '<span class="label label-success">Publish</span>';
        else if($this->status == 'Draft') return '<span class="label label-warning">Draft</span>';
        else if($this->status == 'Inactive') return '<span class="label label-danger">Inactive</span>';
    }
}Modules/Client/Models/Pages/ContactUs.php000066400000001412152434100730014267 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Pages;

use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;

class ContactUs extends Model
{
    protected $connection = 'client';
    protected $table = 'contact_us';
    public $module_id = 18;

    protected $guarded = [];
    protected $appends = ['hashid', 'status_name'];

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function getStatusNameAttribute()
    {
        if($this->status == 'Publish') return '<span class="label label-success">Publish</span>';
        else if($this->status == 'Draft') return '<span class="label label-warning">Draft</span>';
        else if($this->status == 'Inactive') return '<span class="label label-danger">Inactive</span>';
    }
}Modules/Client/Models/Settings/Country.php000066400000000546152434100730014577 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Settings;

use Illuminate\Database\Eloquent\Model;

class Country extends Model
{
    protected $connection = 'client';
    protected $table = 'countries';
    protected $guarded = []; 
    protected $appends = ['hashid'];

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }
}
Modules/Client/Models/Settings/UserLogs/UserLogs.php000066400000002505152434100730016437 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Settings\UserLogs;

use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;

class UserLogs extends Model
{
    protected $connection = 'client';
    protected $table = 'users_logs';

    protected $guarded = [];
    protected $appends = ['hashid'];

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function saveLog($request)
    {
    	$log = $this->fill($request);
    	$log->save();

        $all_logs = $this->where('user_id', $this->attributes['user_id'])
            ->where('module_id', $this->attributes['module_id'])
            ->count();
        $old_logs = $this->where('user_id', $this->attributes['user_id'])
            ->where('module_id', $this->attributes['module_id'])
            ->where('created_at', '<=', Carbon::now()->subDays(90));
        if($all_logs - $old_logs->count() > 3) {
            $old_logs->delete();
        }
    }

    public function getCreatedAtAttribute($value)
    {
        return Carbon::parse($value)->format('M d, Y h:i A');
    }

    public function user()
    {
        return $this->belongsTo('QxCMS\Modules\Likod\Models\Clients\User', 'user_id');
    }

    public function module()
    {
        return $this->belongsTo('QxCMS\Modules\Likod\Models\Developer\ClientModule', 'module_id');
    }
}
Modules/Client/Models/Settings/LoginLogs/LoginLogs.php000066400000001201152434100730016713 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Settings\LoginLogs;

use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;

class LoginLogs extends Model
{
    protected $connection = 'client';
    protected $table = 'login_logs';
    protected $fillable = [
        'name',
        'username',
        'ipaddress'
    ];
    protected $guarded = [];
    protected $appends = ['hashid'];

    /*
    * Model Accessors
    */
    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function getCreatedAtAttribute($value)
    {
        return Carbon::parse($value)->format('M d, Y h:i A');
    }
}
Modules/Client/Models/Settings/Roles/Permission.php000066400000001027152434100730016343 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Settings\Roles;

use Illuminate\Database\Eloquent\Model;

class Permission extends Model
{
    protected $connection = 'client';
    protected $table = 'role_permissions';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'role_id',
        'menu_id',
        'can_access',
        'can_create',
        'can_update',
        'can_delete',
        'can_export',
        'can_import',
        'can_print'
    ]; 
}
Modules/Client/Models/Settings/Roles/Role.php000066400000002676152434100730015127 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Settings\Roles;

use Illuminate\Database\Eloquent\Model;

class Role extends Model
{
    protected $connection = 'client';
    protected $table = 'roles';
    public $module_id = 2;

    public $developer_id = 1;
    public $administrator_id = 2;
    public $editor_id = 3;
    public $field_officer_id = 4;

    /*
    * The attributes that are mass assignable.
    *
    * @var array
    */
    protected $guarded = [];
    protected $appends = ['hashid'];
   
    /*
    * Model Accessors
    */
    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function permissions()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Settings\Roles\Permission');
    }

    public function users()
    {
        return $this->hasMany('QxCMS\Modules\Likod\Models\Clients\User');
    }

    /*
    * Model Custom Functions
    */
    public function role_access($role_id = 1) 
    {
        if ($role_id == 1) {
            return $this->all();
        } else {
            return $this->where('id', '<>', 1)->get();
        }
    }

    public function getDefaultIDs()
    {
        return $defaultIDs = array(
            $this->developer_id,
            $this->administrator_id,
            $this->editor_id,
            $this->field_officer_id
        );
    }

    public function hiddenRoleIds()
    {
        return [
            $this->developer_id
        ];
    }
}Modules/Client/Models/Applicants/Applicant.php000066400000001620152434100730015337 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Applicants;

use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;

class Applicant extends Model
{
    protected $connection = 'client';
    protected $table = 'applicants';
    public $module_id = 19;
    
    protected $guarded = [];
    protected $appends = ['hashid', 'full_name'];

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function getFullNameAttribute()
    {
        return ucwords(strtolower($this->first_name.' '.(($this->middle_name != "") ?  $this->middle_name. ' ':'').$this->last_name));
    }

    public function jobs()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Applicants\JobApplied', 'applicant_id');
    }

    public function latestJob()
    {
        return $this->hasOne('QxCMS\Modules\Client\Models\Applicants\JobApplied', 'applicant_id')->latest();
    }
}
Modules/Client/Models/Applicants/JobApplied.php000066400000001272152434100730015440 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Applicants;

use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;

class JobApplied extends Model
{
    protected $connection = 'client';
    protected $table = 'job_applied';
    // public $module_id = ;
    
    protected $guarded = [];
    protected $appends = ['hashid'];

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function applicant()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Applicants\Applicant', 'applicant_id');
    }

    public function job()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\JobOpening\JobOpening', 'job_id');
    }
}
Modules/Client/Models/Directory/Cities.php000066400000000603152434100730014512 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Directory;

use Illuminate\Database\Eloquent\Model;

class Cities extends Model
{
	protected $connection = 'client';
    protected $table = 'cities';
    
    protected $fillable = [
    	'name'
    ];

    public function directory()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Directory\Directory', 'city_id');
    }
}
Modules/Client/Models/Directory/Municipalities.php000066400000000633152434100730016254 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Directory;

use Illuminate\Database\Eloquent\Model;

class Municipalities extends Model
{
	protected $connection = 'client';
    protected $table = 'municipalities';
    
    protected $fillable = [
    	'name'
    ];

    public function directory()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Directory\Directory', 'municipality_id');
    }
}
Modules/Client/Models/Directory/Provinces.php000066400000000615152434100730015245 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Directory;

use Illuminate\Database\Eloquent\Model;

class Provinces extends Model
{
	protected $connection = 'client';
    protected $table = 'provinces';
    
    protected $fillable = [
    	'name'
    ];

    public function directory()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Directory\Directory', 'province_id');
    }
}
Modules/Client/Models/Directory/Directory.php000066400000002201152434100730015232 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Directory;

use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;

class Directory extends Model
{

    protected $connection = 'client';
    protected $table = 'locations';
    public $module_id = 7;

    protected $guarded = [];
    protected $appends = ['hashid'];

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function affiliates()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Directory\Affiliates', 'affiliate_id');
    }

    public function specializations()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Directory\Specializations', 'specialization_id');
    }

    public function provinces()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Directory\Provinces', 'province_id');
    }

    public function cities()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Directory\Cities', 'city_id');
    }

    public function municipalities()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Directory\Municipalities', 'municipality_id');
    }
}
Modules/Client/Models/Directory/Specializations.php000066400000000637152434100730016442 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Directory;

use Illuminate\Database\Eloquent\Model;

class Specializations extends Model
{
	protected $connection = 'client';
    protected $table = 'specializations';
    
    protected $fillable = [
    	'name'
    ];

    public function directory()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Directory\Directory', 'specialization_id');
    }
}
Modules/Client/Models/Directory/Affiliates.php000066400000000620152434100730015340 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Directory;

use Illuminate\Database\Eloquent\Model;

class Affiliates extends Model
{
	protected $connection = 'client';
    protected $table = 'affiliates';
    
    protected $fillable = [
    	'name'
    ];

    public function directory()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Directory\Directory', 'affiliate_id');
    }
}
Modules/Client/Models/Participants/Answer.php000066400000001113152434100730015223 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Participants;

use Illuminate\Database\Eloquent\Model;
use Collective\Html\Eloquent\FormAccessible;
use \Carbon\Carbon;
class Answer extends Model
{
    use FormAccessible;

    protected $connection = 'client';

    protected $table = 'participants_answers';
    
   /* public $module_id = 6;*/

    /*
    * The attributes that are mass assignable.
    *
    * @var array
    */
    protected $guarded = [];

    protected $appends = ['hashid'];
   

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

}Modules/Client/Models/Participants/Participant.php000066400000002275152434100730016254 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Participants;

use Illuminate\Database\Eloquent\Model;
use Collective\Html\Eloquent\FormAccessible;
use \Carbon\Carbon;
class Participant extends Model
{
    use FormAccessible;

    protected $connection = 'client';

    protected $table = 'survey_participants';
    
    //public $module_id = 6;

    /*
    * The attributes that are mass assignable.
    *
    * @var array
    */
    protected $guarded = [];

    protected $appends = ['hashid'];
   

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }


    /*
    * Model Custom Functions
    */
    public function answers()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Participants\Answer', 'participant_id');
    }
/*

    public function template()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Questionnaire\Template', 'template_id');
    }

    public function fieldOfficer()
    {
        return $this->belongsTo('QxCMS\Modules\Likod\Models\Clients\User', 'field_officer_assigned');
    }

    public function editor()
    {
        return $this->belongsTo('QxCMS\Modules\Likod\Models\Clients\User', 'editor_assigned');
    }*/
}Modules/Client/Models/Questionnaire/Answer.php000066400000001311152434100730015410 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Questionnaire;

use Illuminate\Database\Eloquent\Model;

class Answer extends Model
{
    protected $connection = 'client';

    protected $table = 'survey_answers';
    
    public $module_id = 5;

    /*
    * The attributes that are mass assignable.
    *
    * @var array
    */
    protected $guarded = [];
    protected $appends = ['hashid'];
   
    /*
    * Model Accessors
    */
    public function getHashidAttribute()
    {
        return hashid($this->id);


    }

    public function question()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Questionnaire\Question', 'question_id');
    }
    /*
    * Model Custom Functions
    */
}Modules/Client/Models/Questionnaire/Template.php000066400000001623152434100730015732 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Questionnaire;

use Illuminate\Database\Eloquent\Model;

class Template extends Model
{
    protected $connection = 'client';

    protected $table = 'survey_templates';
    
    public $module_id = 5;

    /*
    * The attributes that are mass assignable.
    *
    * @var array
    */
    protected $guarded = [];
    protected $appends = ['hashid'];
   
    /*
    * Model Accessors
    */
    public function getHashidAttribute()
    {
        return hashid($this->id);
    }


    /*
    * Model Custom Functions
    */

    public function questions()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Questionnaire\Question', 'template_id');
    }


    public function scopeSearchByTitle($query, $criteria = null)
    {
        if(!empty($criteria))
        {
            return $query->where('title', 'LIKE', '%'.$criteria.'%');
        }
    }
}Modules/Client/Models/Questionnaire/Question.php000066400000002515152434100730015767 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Questionnaire;

use Illuminate\Database\Eloquent\Model;

class Question extends Model
{
    protected $connection = 'client';

    protected $table = 'survey_questions';
    
    public $module_id = 5;

    protected $question_types = array(
            1 => 'Open Text Field',
            2 => 'Multiple Choice'
        );
    /*
    * The attributes that are mass assignable.
    *
    * @var array
    */
    protected $guarded = [];
    protected $appends = ['hashid', 'question_type_name'];

    protected $casts = ['required' => 'boolean', 'multiple_select' => 'boolean'];
   
    /*
    * Model Accessors
    */
    public function getHashidAttribute()
    {
        return hashid($this->id);
    }


    /*
    * Model Custom Functions
    */

    public function questionTypes()
    {
        return $this->question_types;
    }

    public function getQuestionTypeNameAttribute()
    {
        return ((isset($this->questionTypes()[$this->question_type])) ? $this->questionTypes()[$this->question_type]:'');
    }

    public function answers()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Questionnaire\Answer', 'question_id');
    }

    public function template()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Questionnaire\Template', 'template_id');
    }
}Modules/Client/Models/Posts/Posts.php000066400000005255152434100730013556 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Posts;

use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;

class Posts extends Model
{
    protected $connection = 'client';
    protected $table = 'posts';
    public $module_id = 9;
    
    protected $guarded = [];
    protected $appends = ['hashid'];

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function setPublishedAtAttribute($value) 
    {
        if($value <> '') {
            $dateformats = getDateFormatConfig('set');
            return $this->attributes['published_at'] = Carbon::createFromFormat($dateformats['php'], $value)->format('Y-m-d');
        }
        return $this->attributes['published_at'] = '0000-00-00';
    }

    public function getPublishedAtAttribute($value) 
    {
        if($value <> '0000-00-00') {
            $dateformats = getDateFormatConfig('get');
            return Carbon::createFromFormat('Y-m-d', $value)->format($dateformats['php']);
        }
        return;
    }

    public function formPublishedAtAttribute($value)
    {
        if($value <> '0000-00-00') {
            $dateformats = getDateFormatConfig('form');
            return Carbon::createFromFormat('Y-m-d', $value)->format($dateformats['php']);
        }
        return;
    }

    public function setExpiredAtAttribute($value) 
    {
        if($value <> '') {
            $dateformats = getDateFormatConfig('set');
            return $this->attributes['expired_at'] = Carbon::createFromFormat($dateformats['php'], $value)->format('Y-m-d');
        }
        return $this->attributes['expired_at'] = '0000-00-00';
    }

    public function getExpiredAtAttribute($value) 
    {
        if($value <> '0000-00-00') {
            $dateformats = getDateFormatConfig('get');
            return Carbon::createFromFormat('Y-m-d', $value)->format($dateformats['php']);
        }
        return;
    }

    public function formExpiredAtAttribute($value)
    {
        if($value <> '0000-00-00') {
            $dateformats = getDateFormatConfig('form');
            return Carbon::createFromFormat('Y-m-d', $value)->format($dateformats['php']);
        }
        return;
    }

    public function getCreatedAtAttribute($value)
    {
        return Carbon::parse($value)->format('M d, Y @ h:i A');
    }

    public function category()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Posts\PostCategory', 'posts_category_id');
    }

    public function author()
    {
        return $this->belongsTo('QxCMS\Modules\Likod\Models\Clients\User', 'author_id');
    }

    public function subPages()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Pages\Pages', 'post_parent_id');
    }
}
Modules/Client/Models/Posts/PostCategory.php000066400000000603152434100730015061 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Posts;

use Illuminate\Database\Eloquent\Model;

class PostCategory extends Model
{
	protected $connection = 'client';
    protected $table = 'posts_category';

    protected $fillable = ['name', 'slug'];

    public function post()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Posts\Posts', 'posts_category_id');
    }
}
Modules/Client/Models/Products/ProductBrand.php000066400000000613152434100730015521 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Products;

use Illuminate\Database\Eloquent\Model;

class ProductBrand extends Model
{
	protected $connection = 'client';
    protected $table = 'product_brand';
    
    protected $fillable = [
    	'name'
    ];

    public function product()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Products\Product', 'brand_id');
    }
}
Modules/Client/Models/Products/Product.php000066400000001263152434100730014554 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Products;

use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;

class Product extends Model
{

    protected $connection = 'client';
    protected $table = 'products';
    public $module_id = 8;

    protected $guarded = [];
    protected $appends = ['hashid'];

    public function getHashidAttribute()
    {
        return hashid($this->id);
    }

    public function brand()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Products\ProductBrand', 'brand_id');
    }

    public function category()
    {
        return $this->belongsTo('QxCMS\Modules\Client\Models\Products\ProductCategory', 'category_id');
    }
}
Modules/Client/Models/Products/ProductCategory.php000066400000000626152434100730016254 0ustar00<?php

namespace QxCMS\Modules\Client\Models\Products;

use Illuminate\Database\Eloquent\Model;

class ProductCategory extends Model
{
	protected $connection = 'client';
    protected $table = 'product_categories';
    
    protected $fillable = [
    	'name'
    ];

    public function product()
    {
        return $this->hasMany('QxCMS\Modules\Client\Models\Products\Product', 'category_id');
    }
}
Modules/Client/Middleware/Authenticate.php000066400000003327152434100730014604 0ustar00<?php

namespace QxCMS\Modules\Client\Middleware;

use Closure;
use Config;
use Illuminate\Support\Facades\Auth;

class Authenticate
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  string|null  $guard
     * @return mixed
     */
    public function handle($request, Closure $next, $guard = 'client')
    {
        if (Auth::guard($guard)->guest()) {
            if ($request->ajax() || $request->wantsJson()) {
                return response('Unauthorized.', 401);
            } else {
                return redirect()->guest('client/auth/login');
            }
        }

        $client = Auth::guard($guard)->user()->client;

        config(['auth.defaults.guard' => $guard]);
        config(['account.dateformat.default' => $client->date_picker_format]);
        config(['account.displaydateformat.default' => $client->display_date_format]);

        Config::set('database.connections.client', array(
            'driver'    => 'mysql',
            'host'      => $client->database_host,
            'database'  => env('DB_PREFIX', 'qxcms_').$client->database_name,
            'username'  => $client->database_username,
            'password'  => $client->database_password,
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ));

        Config::set('filesystems.disks.s3', array(
            'driver' => 's3',
            'key'    => $client->s3_key,
            'secret' => $client->s3_secret,
            'region' => $client->s3_region,
            'bucket' => $client->s3_bucket_name,
            'scheme' => 'http',
        ));
        return $next($request);
    }
}
Modules/Client/Middleware/RedirectIfAuthenticated.php000066400000001251152434100730016703 0ustar00<?php

namespace QxCMS\Modules\Client\Middleware;

use Closure;
use Illuminate\Support\Facades\Auth;

class RedirectIfAuthenticated
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  string|null  $guard
     * @return mixed
     */
    public function handle($request, Closure $next, $guard = 'client')
    {
        if (Auth::guard($guard)->check()) {
            $request->setUserResolver(function () use ($guard) {
                return Auth::guard($guard)->user();
            });
            return redirect('client/dashboard');
        }
        return $next($request);
    }
}Modules/Client/Views/logs.blade.php000066400000000644152434100730013217 0ustar00<div class="box box-danger">
    <div class="box-header with-border">
        <h3 class="box-title"><i class="fa fa-history"></i> Logs</h3>
    </div>
    <div class="box-body">
	@forelse ($userLogs as $logs)
	    <span>{{$logs->created_at}} - {{$logs->action}} by {{$logs->user ? $logs->user->email : 'n/a'}}</span>
	    <br>
	@empty
	    <span><i>No Logs Found</i></span>
	@endforelse
    </div>                
</div>Modules/Client/Views/applicants/view.blade.php000066400000004675152434100730015373 0ustar00@extends('Client::reports-layout')
@section('page-body')
    <!-- Content Header (Page header) -->
    <!-- Main content -->
    <section class="content"> 
        <div class="box box-primary">
            <div class="box-body">
                <form method="get" action="{!! route(config('modules.client').'.applicants.excel', $job->hashid) !!}">
                    <span class="pull-right">
                        <button class="btn btn-danger btn-flat" type="button" onclick="window.close();"><i class="fa fa-times"></i> Close</button>
                        <button class="btn btn-success btn-flat" type="submit"><i class="fa fa-file-excel-o"></i> Export To Excel</button>
                    </span>
                    <h4><b>Applicants for {{ $job->position }} ({{ $job->no_position }})</b></h4>
                </form>
            </div>
        </div>
        <div class="box box-default">
            <div class="box-body">
                <table class="table table-bordered table-striped table-hover data" id="applicants-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Applicant Name</th>
                            <th>Mobile No.</th>
                            <th>Date Applied</th>
                        </tr>
                    </thead>
               </table>
            </div>
        </div>
    </section>
@stop
@section('page-js')
<script type="text/javascript">
$(function() {
    var applicantsTable = $('#applicants-table').DataTable({
        processing: true,
        serverSide: true,
        pagingType: "input",
        iDisplayLength: 25,
        filter: false,
        ajax: {
            url: '{!! route(config('modules.client').'.applicants-list.datatables-index', $job->hashid) !!}',
            method: 'POST',
        },
        columns: [
            {
                width:'10px', searchable: false, orderable: false,
                render: function (data, type, row, meta) {
                    return meta.row + meta.settings._iDisplayStart + 1;
                }
            },
            { data: 'full_name', name: 'full_name', sortable: true, searchable: false},
            { data: 'applicant.mobile_number', name: 'applicant.mobile_number', sortable: false, searchable: false},
            { data: 'apply_date', name: 'apply_date', sortable: true, searchable: false},
        ],
        "order": [[1, "asc"]],
    });
});
</script>
@stopModules/Client/Views/applicants/includes/applicant-lists-table.blade.php000066400000002524152434100730022412 0ustar00@extends('Client::reports-table-layouts')
@section('page-body')
    <table class="table table-bordered table-striped table-hover data" id="applicants-table" width="100%">
        <thead>
            <tr>
                <td colspan="4" style="text-align: center;"><h2><strong>Applicants for {{ $job->position }} ({{ $job->no_position }})</strong></h2></td>
            </tr>
            <tr>
                <td colspan="4"></td>
            </tr>
            <tr>
                <th style="text-align: center;">No.</th>
                <th style="text-align: center;">Applicant Name</th>
                <th style="text-align: center;">Mobile No.</th>
                <th style="text-align: center;">Date Applied</th>
            </tr>
        </thead>
        <tbody>
        @foreach($applicants as $count => $applicant)
            <tr>
                <td width="5" style="text-align: center;">{{++$count}}</td>
                <td width="50">{{$applicant->applicant->last_name}}, {{$applicant->applicant->first_name}} {{$applicant->applicant->middle_name}}</td>
                <td width="25" style="text-align: center;">{{$applicant->applicant->mobile_number}}</td>
                <td width="30" style="text-align: center;">{{date('M d, Y', strtotime($applicant->apply_date))}}</td>
            </tr>
        @endforeach
        </tbody>
   </table>
@stopModules/Client/Views/applicants/source-applicant/view.blade.php000066400000007310152434100730020631 0ustar00@extends('Client::reports-layout')
@section('page-body')
    <!-- Main content -->
    <section class="content">
        <div class="box box-primary">
            <div class="box-body">
                <form method="get" action="{{route(config('modules.client').'.source-applicants.excel')}}">
                @foreach(Input::all() as $input => $value)
                    <input type="hidden" name="{{$input}}" value="{{$value}}">
                @endforeach
                    <span class="pull-right">
                        <button class="btn btn-danger btn-flat" type="button" onclick="window.close();"><i class="fa fa-times"></i> Close</button>
                    @can('export', $permissions)
                        <button class="btn btn-success btn-flat" type="submit"><i class="fa fa-file-excel-o"></i> Export To Excel</button>
                    @endcan
                    </span>
                </form>
                <h4><b>Applicant Source Result</b></h4>
                <p style="font-size:17px">Total of applicants found : <b><i>{{ $count }}</i></b></p>
            </div>
        </div>
        <div class="box box-default">
            <div class="box-body">
                <table class="table table-bordered table-striped table-hover data" id="source-applicant-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Name</th>
                            <th>Mobile No.</th>
                            <th>Email</th>
                            <th>Latest Employment</th>
                        </tr>
                    </thead>
               </table>
            </div>
        </div>
    </section>
@stop
@section('page-js')
<script type="text/javascript">
$(function(){
    var sourceTable = $('#source-applicant-table').DataTable({
        "processing": true,
        "serverSide": true,
        "pagingType": "input",
        "filter":false,
        "lengthChange": false,
        "pageLength": 15,
        language: {
            "processing": '<i class=\"fa fa-spinner fa-spin fa-2x\" style=\"color: black;\"></i>',
            "zeroRecords": "No matching records found",
        },
        ajax: {
            url: '{{ route(config('modules.client').'.source-applicants.datatables-index') }}',
            type: 'POST',
            "data": function(d){
                d.position_applied = $('input[name="position_applied"]').val();
                d.school = $('input[name="school"]').val();
                d.recent_emp = $('input[name="recent_emp"]').val();
                d.col_deg = $('input[name="col_deg"]').val();
                d.min_yrs = $('input[name="min_yrs"]').val();
                d.max_yrs = $('input[name="max_yrs"]').val();
                d.work_location = $('input[name="work_location"]').val();
            }
        },
        "dom": "<'row'<'col-sm-6'i><'col-sm-6 text-right'l>>" +
                "<'row'<'col-sm-12'tr>>" +
                "<'row'<'col-sm-5'><'col-sm-7'p>>",
        columns: [
            {
                width:'10px', searchable: false, orderable: false,
                render: function (data, type, row, meta) {
                    return meta.row + meta.settings._iDisplayStart + 1;
                }
            },
            { data: 'full_name', name: 'full_name' , sortable: true, searchable: false},
            { data: 'mobile_number', name: 'mobile_number', sortable: false, searchable: false},
            { data: 'email', name: 'email', sortable: false, searchable: false},
            { data: 'position', name: 'position', sortable: false, searchable: false},
        ],
        fnDrawCallback: function ( oSettings ){
        },
        "order": [[1, "asc"]],
    });
});
</script>
@stopModules/Client/Views/applicants/source-applicant/includes/form.blade.php000066400000003421152434100730022427 0ustar00<div class="form-group">
    <label class="control-label col-md-4">Position Applied:</label>
    <div class="col-md-5">
        {!! Form::text('position_applied', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-4">Years of Experience:</label>
    <div class="col-md-8">
        <div class="row">
            <label class="control-label col-md-1"><b>Min</b></label>
            <div class="col-md-2">
                {!! Form::text('min_yrs', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
            </div>
            <label class="control-label col-md-1"><b>Max</b></label>
            <div class="col-md-2">
                {!! Form::text('max_yrs', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
            </div>
        </div>
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-4">Recent Employer:</label>
    <div class="col-md-5">
        {!! Form::text('recent_emp', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-4">College Degree:</label>
    <div class="col-md-5">
        {!! Form::text('col_deg', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-4">School:</label>
    <div class="col-md-5">
        {!! Form::text('school', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-4">Preferred Work Location:</label>
    <div class="col-md-5">
        {!! Form::text('work_location', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>Modules/Client/Views/applicants/source-applicant/includes/source-applicant-table.blade.php000066400000003043152434100730026022 0ustar00@extends('Client::reports-table-layouts')
@section('page-body')
    <table class="table table-bordered table-striped table-hover data" id="applicants-table" width="100%">
        <thead>
            <tr>
                <td colspan="5" style="text-align: center;"><h2><strong>Applicant Source Result</strong></h2></td>
            </tr>
            <tr>
                <td colspan="5" style="text-align: center;"><p style="font-size:17px">Total of applicants found : <i>{{ $count }}</i></p></td>
            </tr>
            <tr>
                <td colspan="5"></td>
            </tr>
            <tr>
                <th style="text-align: center;">No.</th>
                <th style="text-align: center;">Name</th>
                <th style="text-align: center;">Mobile No.</th>
                <th style="text-align: center;">Email</th>
                <th style="text-align: center;">Latest Employment</th>
            </tr>
        </thead>
        <tbody>
        @foreach($applicants as $count => $applicant)
            <tr>
                <td width="5" style="text-align: center;">{{++$count}}</td>
                <td width="50">{{$applicant->last_name}}, {{$applicant->first_name}} {{$applicant->middle_name}}</td>
                <td width="25" style="text-align: center;">{{$applicant->mobile_number}}</td>
                <td width="30" style="text-align: center;">{{$applicant->email}}</td>
                <td width="40" style="text-align: center;">{{$applicant->position}}</td>
            </tr>
        @endforeach
        </tbody>
   </table>
@stopModules/Client/Views/applicants/source-applicant/index.blade.php000066400000004423152434100730020770 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}" aria-hidden="true"></i> {{$pageTitle}}
            <br>
            <small>{{$pageDescription}}</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.applicants.index') }}"><i class="fa fa-file-text-o"></i> Applicants</a></li>
            <li class="active"></i> {{$pageTitle}}</li>
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">
        @include('Client::message')
        <div class="box box-default">
            {!! Form::open(array('route' => config('modules.client').'.source-applicants.show', 'class' => 'form-horizontal', 'method' => 'POST', 'id' => 'source-applicant-form', 'target'=>'_blank')) !!}
            <div class="box-body">
                @include('Client::applicants.source-applicant.includes.form')
            </div>
            <div class="box-footer text-center">
                <div class="row">
                    <div class="col-md-4 col-md-offset-7">
                        <button class="btn btn-primary btn-flat btn-md btn-block" type="button" onClick="sourceSubmit()"><i class="fa fa-street-view"></i> Source Applicant</button>
                    </div>
                </div>
           </div>
           {!! Form::close() !!}
        </div>
    </section>
@stop
@section('page-js')
<script type="text/javascript">
function sourceSubmit(){
    var position_applied = $('input[name="position_applied"]').val();
    var min_yrs_exp = $('input[name="min_yrs"]').val();
    var max_yrs_exp = $('input[name="max_yrs"]').val();
    var rec_emp = $('input[name="recent_emp"]').val();
    var col_deg = $('input[name="col_deg"]').val();
    var school = $('input[name="school"]').val();
    var work_location = $('input[name="work_location"]').val();
    
    if(position_applied != '' || min_yrs_exp != '' || max_yrs_exp != '' || rec_emp != '' || col_deg != '' || school != '' || work_location != ''){
        $('#source-applicant-form').submit();
    }else{
        swal('Please fill in at least one field.', '', 'error');
    }
}
</script>
@include('Client::notify')
@stopModules/Client/Views/applicants/index.blade.php000066400000005304152434100730015516 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}" aria-hidden="true"></i> {{$pageTitle}}
            <br>
            <small>{{$pageDescription}}</small>
        </h1>
        <ol class="breadcrumb">
            <li class="active"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</li>           
        </ol>
    </section>
    <!-- Main content -->
    <section class="content"> 
        @include('Client::message')
        <div class="box box-default">
            <div class="box-header with-border">
            </div>
            <div class="box-body">
                <table class="table table-bordered table-striped table-hover" id="applicant-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Job Title</th>
                            <th>Opening Date</th>
                            <th>Closing Date</th>
                            <th>Location</th>
                            <th>No. of Applicant(s)</th>
                        </tr>
                    </thead>
               </table>
            </div>                
        </div>
    </section>
@stop
@section('page-js')
<script type="text/javascript">
    $(document).ready(function() {
        var applicantTable = $('#applicant-table').DataTable({
            "processing": true,
            "serverSide": true,
            "pagingType": "input",
            ajax: {
                url: '{{ route(config('modules.client').'.applicants.datatables-index') }}', 
                type: 'POST',
            },
            columns: [
                {
                    width:'10px', searchable: false, orderable: false,
                    render: function (data, type, row, meta) {
                        return meta.row + meta.settings._iDisplayStart + 1;
                    }
                },
                { data: 'position', name: 'position' },
                { data: 'opening_date', name: 'opening_date', sortable: true, searchable: true},
                { data: 'closing_date', name: 'closing_date', sortable: true, searchable: true},
                { data: 'location', name: 'location', sortable: false, searchable: true},
                { data: 'applicants_count', name: 'applicants_count', sortable: true, searchable: false, className: 'text-center', width:'120px'},
            ],
            fnDrawCallback: function ( oSettings ) {         
            },
            "order": [[1, "desc"]],
        });
    });
</script>
@include('Client::notify')
@stopModules/Client/Views/applicants/search-applicant/index.blade.php000066400000011651152434100730020736 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}" aria-hidden="true"></i> {{$pageTitle}}
            <br>
            <small>{{$pageDescription}}</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.applicants.index') }}"><i class="fa fa-file-text-o"></i> Applicants</a></li>
            <li class="active"></i> {{$pageTitle}}</li> 
        </ol>
    </section>
    <!-- Main content -->
    <section class="content"> 
        @include('Client::message')
        <div class="box box-default">
            <div class="box-header with-border">
            </div>
            <div class="box-body">
                <div class="col-md-12">
                    <div class="form-group">
                        <label class="control-label col-md-3"></label>
                        <div class="col-md-6">
                            <form action="{{route(config('modules.client').'.search-applicants.index')}}" id="search-filter" method="GET" role="form">
                                <div class="input-group">
                                    <input class="form-control" placeholder="Type first name or last name to search." name="name" type="text" autocomplete="off" value="{{Input::get('name')}}">
                                    <span class="input-group-btn">
                                        <button class="btn btn-primary btn-flat" type="submit"><i class="fa fa-search"></i></button>
                                    </span>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <div class="hidden-xs hidden-sm">
                    <br><br><br>
                </div>
                <div class="search-applicant" style="display:none;">
                    <table class="table table-bordered table-striped table-hover" id="search-applicant-table" width="100%">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>Name</th>
                                <th>Mobile No.</th>
                                <th>Position Applied</th>
                                <th>Date Applied</th>
                            </tr>
                        </thead>
                   </table>
                </div>
            </div>                
        </div>
    </section>
@stop
@section('page-js')
<script type="text/javascript">
$(document).ready(function(){
    if($('#search-filter [name="name"]').val() != ''){
        var searchTable = $('#search-applicant-table').DataTable({
            "processing": true,
            "serverSide": true,
            "pagingType": "input",
            "filter":false,
            "lengthChange": false,
            "pageLength": 15,
            "scrollCollapse": true,
            "scrollY":"220px",
            language: {
                "processing": '<i class=\"fa fa-spinner fa-spin fa-2x\" style=\"color: black;\"></i>',
                "zeroRecords": "No matching records found",
            },
            ajax: {
                url: '{{ route(config('modules.client').'.search-applicants.datatables-index') }}', 
                type: 'POST',
                "data": function(d){
                    d.name = $('#search-filter [name="name"]').val();
                }
            },
            "dom": "<'row'<'col-sm-6'i><'col-sm-6 text-right'l>>" +
                    "<'row'<'col-sm-12'tr>>" +
                    "<'row'<'col-sm-5'><'col-sm-7'p>>",
            columns: [
                {
                    width:'10px', searchable: false, orderable: false,
                    render: function (data, type, row, meta) {
                        return meta.row + meta.settings._iDisplayStart + 1;
                    }
                },
                { data: 'full_name', name: 'full_name' , sortable: true, searchable: false},
                { data: 'mobile_number', name: 'mobile_number', sortable: false, searchable: false},
                { data: 'position', name: 'position', sortable: false, searchable: false},
                { data: 'apply_date', name: 'apply_date', sortable: false, searchable: false},
            ],
            fnDrawCallback: function ( oSettings ) {         
            },
            "order": [[1, "asc"]],
        });
    }

    function searchApplicant(){
        var search = $('#search-filter [name="name"]').val();
        if(search != ''){
            searchTable.draw();
            $('.search-applicant').show();
        }else{
          $('.search-applicant').hide();
        }
    }
    searchApplicant();
    $('#search-filter').on('submit', function(e){
        searchApplicant();
        e.preventDefault();
    });
});
</script>
@include('Client::notify')
@stopModules/Client/Views/message.blade.php000066400000000660152434100730013675 0ustar00<div id="message-wrapper">
    @if(session('logout'))
        <div class="alert alert-success alert-dismissable fade in" style="padding-top: 4px;padding-bottom: 4px; padding-right: 29px; padding-left: 10px;">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <i class="fa fa-check"></i>&nbsp;
            {{ session('logout') }}
        </div>
    @endif    
</div>Modules/Client/Views/pages/create.blade.php000066400000003262152434100730014614 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-plus"></i> Add {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.pages.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>             
            <li class="active">Add</li>           
        </ol>
    </section>

    <section class="content"> 
        @include('Client::message')
        {!! Form::open(array('url'=>url(config('modules.client').'/pages/store'), 'class' => 'form-horizontal', 'method' => 'POST', 'id' => 'page-form','files' => true)) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::pages.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-primary save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save</button>
            </div>
        </div>
        {!! Form::close() !!}
    </section>
@stop
@section('page-css')
    @include('Client::pages.includes.css')
@stop
@section('page-js')
    @include('Client::pages.includes.js')
    @include('Client::notify')
@stopModules/Client/Views/pages/contact-us/create.blade.php000066400000003360152434100730016673 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-plus"></i> Add {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.contact-us.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>
            <li class="active">Add</li>
        </ol>
    </section>

    <section class="content">
        @include('Client::message')
        {!! Form::open(array('route'=> config('modules.client').'.contact-us.store', 'class' => 'form-horizontal', 'method' => 'POST', 'id' => 'contact-us-form')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::pages.contact-us.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-primary save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save</button>
            </div>
        </div>
        {!! Form::close() !!}
    </section>
@stop
@section('page-css')
    @include('Client::pages.contact-us.includes.css')
@stop
@section('page-js')
    @include('Client::pages.contact-us.includes.gmaps')
    @include('Client::pages.contact-us.includes.js')
    @include('Client::notify')
@stopModules/Client/Views/pages/contact-us/includes/form.blade.php000066400000007216152434100730020205 0ustar00<div class="form-group">
    <label class="control-label col-md-3">Name <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::text('name', null , ['class'=>'form-control', 'autocomplete'=>'off', 'placeholder'=>'Name']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-3">Email <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::text('email', null , ['class'=>'form-control', 'autocomplete'=>'off', 'placeholder'=>'Email']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-3">Contact Number <i class="required">*</i></label>
    <div class="col-md-6">
     <!--    <div class="input-group"> -->
        {!! Form::text('contact', null , ['class'=>'form-control', 'autocomplete'=>'off', 'placeholder'=>'Contact Number']) !!}
  <!--          <span class="input-group-btn">
                <button class="btn btn-primary btn-flat" type="button" data-toggle="tooltip" title=""><i class="fa fa-plus"></i></button>
           </span> -->
       <!--  </div> -->
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-3">Recruitment Building</label>
    <div class="col-md-4">
    {!! Form::text('building_name', null , ['class'=>'form-control uppercaseFirst', 'autocomplete'=>'off', 'placeholder' => 'Building Name']) !!}
    </div>
    <div class="col-md-2">
    {!! Form::text('building_floor', null , ['class'=>'form-control uppercaseFirst', 'autocomplete'=>'off', 'placeholder' => 'Floor']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-3">Recruitment Office Address <i class="required">*</i></label>
    <div class="col-md-3">
    {!! Form::text('rec_number', null , ['class'=>'form-control', 'autocomplete'=>'off', 'placeholder' => 'Number']) !!}
    </div>
    <div class="col-md-3">
    {!! Form::text('rec_street', null , ['class'=>'form-control pascal', 'autocomplete'=>'off', 'placeholder' => 'Street']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-3"></label>
    <div class="col-md-6">
        {!! Form::text('rec_city', null , ['class'=>'form-control', 'autocomplete'=>'off', 'placeholder'=>'City']) !!}
    </div>
</div>
<!-- <div class="form-group">
    <label class="control-label col-md-3"></label>
    <div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-body">
                <div class="form-group">
                    <input id="search" type="text" placeholder="Search.." style="width: 150px; height: 30px; margin-top: 10px;">
                    <div id="map" style="width: 100%; height: 250px;"></div>
                </div>
                <div class="form-group">
                    <label class="control-label col-md-3">Latitude: <i class="required">*</i></label>
                    <div class="col-md-8">
                        {!! Form::text('lat', null , ['class'=>'form-control', 'id'=>'lat', 'autocomplete'=>'off']) !!}
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-md-3">Longitude: <i class="required">*</i></label>
                    <div class="col-md-8">
                        {!! Form::text('lng', null , ['class'=>'form-control', 'id'=>'lng', 'autocomplete'=>'off']) !!}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div> -->
<div class="form-group">
    <label class="control-label col-md-3">Status <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::select('status',  $status , null ,  ['class'=>'form-control']) !!}
    </div>
</div>Modules/Client/Views/pages/contact-us/includes/gmaps.blade.php000066400000004032152434100730020342 0ustar00<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyB4CBr0reSrrQ9EuBFxPVM_TzbuV3uBow4&libraries=places"></script>
<script>
function initMap(pos) {
	var LatLng = new google.maps.LatLng(pos.lat, pos.lng);
  	map = new google.maps.Map(document.getElementById('map'), {
	    center: LatLng,
	    zoom: 14,
	    mapTypeId: google.maps.MapTypeId.ROADMAP
  	});

  	marker = new google.maps.Marker({
	    position: LatLng,
	    map: map,
	    title: 'Your Location!',
	    draggable:true
  	});

	var input = document.getElementById('search');
  	var searchBox = new google.maps.places.SearchBox(input);
  	map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);

  	// Bias the SearchBox results towards current map's viewport.
  	map.addListener('bounds_changed', function() {
    	searchBox.setBounds(map.getBounds());
  	});

	searchBox.addListener('places_changed', function() {
	    var places = searchBox.getPlaces();

	    if (places.length == 0) {
	      return;
	    }
	    marker.setMap(null);
	  	marker = new google.maps.Marker({
		    position: places[0].geometry.location,
		    map: map,
		    title: 'Recruitment Location!',
		    draggable:true
	  	});
	  	$("#lat").val(marker.getPosition().lat());
        $("#lng").val(marker.getPosition().lng());


	  	map.setCenter(places[0].geometry.location);
  		google.maps.event.addListener(marker, 'dragend', function () {
            $("#lat").val(marker.getPosition().lat());
            $("#lng").val(marker.getPosition().lng());
        });
  	});

  	google.maps.event.addListener(marker, 'dragend', function () {
        $("#lat").val(marker.getPosition().lat());
        $("#lng").val(marker.getPosition().lng());
    });

}

if ($('#map').length)
{
	if ($("input[name=lat]").val() && $("input[name=lng]").val())
	{
		var lat = $("input[name=lat]").val();
		var lng = $("input[name=lng]").val();
		var pos = {
	        lat: lat,
	        lng: lng
	    };
      	initMap(pos);
	}
	else {
		var pos = {
        lat: 14.624520,
        lng: 121.055754
      };

      initMap(pos);
	}
}
</script>Modules/Client/Views/pages/contact-us/includes/js.blade.php000066400000001271152434100730017651 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Pages\ContactUsRequest', 'form#contact-us-form'); !!}
<script type="text/javascript">
$(function(){
	var body = $('body');
    $(".intlphone").intlTelInput({
    	onlyCountries: ["ph"],
          //allowExtensions:true,
        autoFormat:true,
        numberType:"MOBILE",
          //autoPlaceholder:false,
        defaultCountry: "ph",
          //autoHideDialCode: false,
         // nationalMode:true,
        utilsScript: body.data('url')+'/template/AdminLTE/plugins/intlnum/lib/libphonenumber/build/utils.js'
    });
});
</script>Modules/Client/Views/pages/contact-us/includes/css.blade.php000066400000000370152434100730020024 0ustar00<style type="text/css">
    .intl-tel-input .selected-flag {
        z-index: 3;
    }
    .intl-tel-input {
         display: initial; 
         position: initial;
    }
    .intl-tel-input .flag-dropdown {
     position: absolute; 
    }
</style>Modules/Client/Views/pages/contact-us/index.blade.php000066400000011062152434100730016535 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}" aria-hidden="true"></i> {{$pageTitle}}
            <br>
            <small>{{$pageDescription}}</small>
        </h1>
        <ol class="breadcrumb">
            <li class="active"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</li>
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">
        @include('Client::message')
        <div class="box box-default">
            <div class="box-header with-border">
                @can('create', $permissions)
                    <div class="pull-right">
                        <a href="{{ route(config('modules.client').'.contact-us.create') }}" class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add {{$pageModuleName}}</a>
                    </div>
                @endcan
            </div>
            <div class="box-body">
                <table class="table table-bordered table-striped table-hover" id="contact-us-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Name</th>
                            <th>Contact Number</th>
                            <th>Email</th>
                            <th>Address</th>
                            <th>Status</th>
                            <th>Action</th>
                        </tr>
                    </thead>
               </table>
            </div>
        </div>
        @include('Client::logs')
    </section>
@stop
@section('page-js')
<script type="text/javascript">
    $(document).ready(function() {
        var contactUsTable = $('#contact-us-table').DataTable({
            "processing": true,
            "serverSide": true,
            "pagingType": "input",
            ajax: {
                url: '{!! route(config('modules.client').'.contact-us.datatables-index') !!}',
                type: 'POST',
            },
            columns: [
                {
                    width:'10px', searchable: false, orderable: false,
                    render: function (data, type, row, meta) {
                        return meta.row + meta.settings._iDisplayStart + 1;
                    }
                },
                { data: 'name', name: 'name' },
                { data: 'contact', name: 'contact', sortable: false, searchable: true},
                { data: 'email', name: 'email', sortable: false, searchable: true},
                { data: 'address', name: 'address', sortable: false, searchable: true},
                { data: 'status_name', name: 'status_name', sortable: false, searchable: false, width:'60px', className:'text-center'},
                { data: 'action', name: 'action', orderable: false, searchable: false, width:'60px', className:'text-center'},
            ],
            fnDrawCallback: function ( oSettings ) {
                contactUsTable.on("click", '#btn-delete', function() {
                    var action = $(this).data('action');
                    swal({
                        title: 'Are you sure you want to delete?',
                        text: "This will be permanently deleted",
                        type: 'warning',
                        showCancelButton: true,
                        confirmButtonColor: '#3085d6',
                        cancelButtonColor: '#d33',
                        confirmButtonText: 'Yes'
                        }).then(function () {
                        $.ajax({
                            type: "DELETE",
                            url: action,
                            dataType: 'json',
                            success: function(data) {
                                if(data.type == "success") {
                                    contactUsTable.draw();
                                    swal(data.message, '', 'success').catch(swal.noop);
                               }else{
                                    swal(data.message, '', 'error').catch(swal.noop);
                               }
                            },
                            error :function( jqXhr ){
                                swal('Unable to delete.', 'Please try again.', 'error').catch(swal.noop);
                            }
                        });
                    }).catch(swal.noop);
                });
            },
            "order": [[1, "asc"]],
        });
    });
</script>
@include('Client::notify')
@stopModules/Client/Views/pages/contact-us/edit.blade.php000066400000003450152434100730016355 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
         <h1>
            <i class="fa fa-pencil"></i> Edit {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.contact-us.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>
            <li class="active">Edit</li>
        </ol>
    </section>

    <section class="content">
        @include('Client::message')
        {!! Form::model($contact_us, array('route' => [config('modules.client').'.contact-us.update', $contact_us->hashid], 'method' => 'PUT', 'class'=>'form-horizontal', 'role' => 'form' , 'id'=>'contact-us-form')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::pages.contact-us.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-warning save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save Changes</button>
            </div>
        </div>
        {!! Form::close() !!}
        <br>
        @include('Client::logs')
    </section>
@stop
@section('page-css')
    @include('Client::pages.contact-us.includes.css')
@stop
@section('page-js')
    @include('Client::pages.contact-us.includes.js')
    @include('Client::notify')
@stopModules/Client/Views/pages/faq/create.blade.php000066400000003216152434100730015362 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-plus"></i> Add {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.faq.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>
            <li class="active">Add</li>
        </ol>
    </section>

    <section class="content">
        @include('Client::message')
        {!! Form::open(array('route'=> config('modules.client').'.faq.store', 'class' => 'form-horizontal', 'method' => 'POST', 'id' => 'faq-form')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::pages.faq.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-primary save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save</button>
            </div>
        </div>
        {!! Form::close() !!}
    </section>
@stop
@section('page-css')
    @include('Client::pages.faq.includes.css')
@stop
@section('page-js')
    @include('Client::pages.faq.includes.js')
    @include('Client::notify')
@stopModules/Client/Views/pages/faq/includes/form.blade.php000066400000001341152434100730016665 0ustar00<div class="form-group">
    <label class="control-label col-md-3">Question <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::text('title', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-3">Answer <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::textarea('content', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-3">Status <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::select('status',  $status , null ,  ['class'=>'form-control']) !!}
    </div>
</div>Modules/Client/Views/pages/faq/includes/js.blade.php000066400000002225152434100730016340 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Pages\FAQRequest', 'form#faq-form'); !!}
<script type="text/javascript">
    CKEDITOR.replace( 'content', {
        filebrowserImageBrowseUrl: '/qxcms/laravel/filemanager?type=Images',
        filebrowserBrowseUrl: '/qxcms/laravel/filemanager?type=Files',
        height: '250px',
    });

    var faq_form = $('form#faq-form');
    $('button.save-btn').on('click', function() {
        var btn = $(this);
        btn.button('loading');
        var messageLength = CKEDITOR.instances['content'].getData().replace(/<[^>]*>/gi, '').length;
        
        if(faq_form.valid()){
        	if(!messageLength) {
	            swal('Please enter the answer.', '', 'error').catch(swal.noop);
	            
	            setTimeout(function(){
                btn.button('reset');
	            }, 200);
	            return false;
	        }
	        return true;
        }else{
            setTimeout(function(){
                btn.button('reset');
            }, 200);
           return false;
        }
    });
</script>Modules/Client/Views/pages/faq/includes/css.blade.php000066400000000172152434100730016513 0ustar00<style>
.panel-heading a:after {
    font-family:'Glyphicons Halflings';
    content:"\e114";
    float: right;
}
</style>Modules/Client/Views/pages/faq/includes/faq-details-modal.blade.php000066400000002440152434100730021207 0ustar00<div id="faq-details-modal" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">FAQ Details</h4>
            </div>
            <div class="modal-body">
                <table class="table table-condensed" id="details-table" width="100%">
                    <tbody>
                        <tr>
                            <th width="10%">Question:</th>
                            <td width="40%" class="title"></td>
                        </tr>
                        <tr>
                            <th width="10%">Answer:</th>
                            <td width="40%" class="content"></td>
                        </tr>
                        <tr>
                            <th width="10%">Status:</th>
                            <td width="40%" class="status"></td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default btn-flat close-modal" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>Modules/Client/Views/pages/faq/index.blade.php000066400000015065152434100730015233 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}" aria-hidden="true"></i> {{$pageTitle}}
            <br>
            <small>{{$pageDescription}}</small>
        </h1>
        <ol class="breadcrumb">
            <li class="active"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</li>
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">
        @include('Client::message')
        <div class="box box-default">
            <div class="box-header with-border">
                <div class="pull-left">
                    <form action="javascript:void(0)" id="faq-filter" method="POST" class="form-inline" role="form">
                        <b>Filter: </b>
                        <div class="form-group">
                            <input type="text" name="title" class="form-control" placeholder="Type question to search." style="width: 300px !important;" autocomplete="off">
                        </div>
                        <div class="form-group">
                            <label class="sr-only" for="">Search FAQ</label>
                            {!! Form::select('status', $status, null, ['class' => 'form-control', 'placeholder'=>'All']) !!}
                        </div>
                        <button type="submit" class="btn btn-primary">Filter</button>
                        <button href="javascript:void(0)" class="btn btn-default" id="reset">Reset</button>
                    </form>
                </div>
                @can('create', $permissions)
                    <div class="pull-right">
                        <a href="{{ route(config('modules.client').'.faq.create') }}" class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add {{$pageModuleName}}</a>
                    </div>
                @endcan
            </div>
            <div class="box-body">
                <table class="table table-bordered table-striped table-hover" id="faq-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Question</th>
                            <th>Status</th>
                            <th>Action</th>
                        </tr>
                    </thead>
               </table>
            </div>
        </div>
        @include('Client::logs')
        @include('Client::pages.faq.includes.faq-details-modal')
    </section>
@stop
@section('page-js')
<script type="text/javascript">
    $(document).ready(function() {
        var faqTable = $('#faq-table').DataTable({
            "processing": true,
            "serverSide": true,
            "pagingType": "input",
            ajax: {
                url: '{!! route(config('modules.client').'.faq.datatables-index') !!}',
                type: 'POST',
                "data": function(d){
                    d.title = $('#faq-filter [name="title"]').val();
                    d.status = $('#faq-filter [name="status"]').val();
                }
            },
            "dom": "<'row'<'col-sm-6'i><'col-sm-6 text-right'l>>" +
                "<'row'<'col-sm-12'tr>>" +
                "<'row'<'col-sm-5'><'col-sm-7'p>>",
            columns: [
                {
                    width:'10px', searchable: false, orderable: false,
                    render: function (data, type, row, meta) {
                        return meta.row + meta.settings._iDisplayStart + 1;
                    }
                },
                { data: 'title', name: 'title' },
                { data: 'status_name', name: 'status_name', sortable: false, searchable: false, width:'100px', className:'text-center'},
                { data: 'action', name: 'action', orderable: false, searchable: false, width:'60px', className:'text-center'},
            ],
            fnDrawCallback: function ( oSettings ) {
                faqTable.on("click", '#btn-delete', function() {
                    var action = $(this).data('action');
                    swal({
                        title: 'Are you sure you want to delete?',
                        text: "This will be permanently deleted",
                        type: 'warning',
                        showCancelButton: true,
                        confirmButtonColor: '#3085d6',
                        cancelButtonColor: '#d33',
                        confirmButtonText: 'Yes'
                        }).then(function () {
                        $.ajax({
                            type: "DELETE",
                            url: action,
                            dataType: 'json',
                            success: function(data) {
                                if(data.type == "success") {
                                    faqTable.draw();
                                    swal(data.message, '', 'success').catch(swal.noop);
                               }else{
                                    swal(data.message, '', 'error').catch(swal.noop);
                               }
                            },
                            error :function( jqXhr ){
                                swal('Unable to delete.', 'Please try again.', 'error').catch(swal.noop);
                            }
                        });
                    }).catch(swal.noop);
                });
            },
            "order": [[1, "asc"]],
        });
        $('#faq-filter').on('submit', function(){
            faqTable.draw();
        });
        $('#reset').on('click', function(event) {
            event.preventDefault();
            $('#faq-filter [name="title"]').val('');
            $('#faq-filter [name="status"]').val('');
            faqTable.draw();
        });
    });
</script>
<script type="text/javascript">
    $('#faq-details-modal').on('show.bs.modal', function (event) {
        var modal = $(this);
        var href = $(event.relatedTarget);
        var details_url = href.data('details_url');

        $.ajax({
            url: details_url,
            type: 'GET',
        }).done(function(response){
            modal.find('.title').html(response.title);
            modal.find('.content').html(response.content);
            modal.find('.status').html(response.status_name);
        })
    });

    $('#faq-details-modal').on('hidden.bs.modal', function (event) {
        var modal = $(this);

        modal.find('.title').html('');
        modal.find('.content').html('');
        modal.find('.status').html('');
    });
</script>
@include('Client::notify')
@stopModules/Client/Views/pages/faq/edit.blade.php000066400000003360152434100730015044 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
         <h1>
            <i class="fa fa-pencil"></i> Edit {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.faq.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>
            <li class="active">Edit</li>
        </ol>
    </section>

    <section class="content">
        @include('Client::message')
        {!! Form::model($faq, array('route' => [config('modules.client').'.faq.update', $faq->hashid], 'method' => 'PUT', 'class'=>'form-horizontal', 'role' => 'form' , 'id'=>'faq-form')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::pages.faq.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-warning save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save Changes</button>
            </div>
        </div>
        {!! Form::close() !!}
        <br>
        @include('Client::logs')
    </section>
@stop
@section('page-css')
    @include('Client::pages.faq.includes.css')
@stop
@section('page-js')
    @include('Client::pages.faq.includes.js')
    @include('Client::notify')
@stopModules/Client/Views/pages/includes/form.blade.php000066400000015421152434100730016122 0ustar00<input type="hidden" name="_token" value="{{ csrf_token() }}">
	<div class="row">
        <div class="col-md-7">
            <div class="col-md-12">
                <div class="form-group {{ ($errors->has('title') ? 'has-error':'') }}">
                    <label class="control-label col-md-2">Title: <i class="required">*</i></label>
                    <div class="col-md-10">
                        {!! Form::text('title', null , ['class'=>'form-control', 'placeholder'=>'Enter Post Title', 'autocomplete'=>'off']) !!}
                        {!! $errors->first('title', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
                <div class="form-group {{ $errors->has('content') ? ' has-error' : '' }}">
                    <label class="control-label col-md-2">Content:</label>
                    <div class="col-md-12">
                        {!! Form::textarea('content', null , ['class'=>'form-control wysihtml5', 'placeholder'=>'Details here...', 'autocomplete'=>'off']) !!}
                        {!! $errors->first('content', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-5">
            <div class="col-md-12">
                <div class="panel-group" id="accordion">
                    <div class="panel panel-default" id="panel1">
                        <div class="panel-heading">Publish</div>
                        <div class="panel-body">
                            <div class="form-group">
                                <label class="control-label col-md-3">Status: </label>
                                <div class="col-md-9">
                                    {!! Form::select('status',  $status , null ,  ['class'=>'input-sm form-control']) !!}
                                    {!! $errors->first('status', '<span class="text-red">:message</span>') !!}
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3">Visibility: </label>
                                <div class="col-md-9">
                                    {!! Form::select('visibility',  $visibility , null ,  ['class'=>'input-sm form-control']) !!}
                                    {!! $errors->first('visibility', '<span class="text-red">:message</span>') !!}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel-group" id="accordion">
                    <div class="panel panel-default" id="panel1">
                        <div class="panel-heading">
                            <h4 class="panel-title">
                                <a data-toggle="collapse" data-target="#collapseOne" style="cursor: pointer;">Featured Image
                                </a>
                            </h4>
                        </div>
                        <div id="collapseOne" class="panel-collapse collapse in">
                            <div class="panel-body">
                                <div class="form-group">
                                    <div class="col-sm-12">
                                        <div class="input-group">
                                          <span class="input-group-btn">
                                            <a id="image" data-input="featured_image" data-preview="featuredImagePreview" class="btn btn-primary">
                                              <i class="fa fa-picture-o"></i> Choose
                                            </a>
                                          </span>
                                          {!! Form::text('featured_image', null , ['class'=>'form-control', 'id' => 'featured_image', 'readonly' => 'readonly']) !!}
                                        </div>
                                    </div>
                                </div>
                                <br>
                                <img src="" id="featuredImagePreview" alt="Uploaded Image Preview" width="365px" height="290px"/>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel-group" id="accordion">
                    <div class="panel panel-default" id="panel1">
                        <div class="panel-heading">
                            <h4 class="panel-title">
                                <a data-toggle="collapse" data-target="#collapseTwo" style="cursor: pointer;">Excerpt
                                </a>
                            </h4>
                        </div>
                        <div id="collapseTwo" class="panel-collapse collapse in">
                            <div class="panel-body">
                                <div class="form-group">
                                    <div class="col-sm-12">
                                        {!! Form::textarea('excerpt', null , ['class'=>'form-control', 'placeholder'=>'Enter Excerpt', 'autocomplete'=>'off', 'rows'=>'3', 'style'=>'resize: vertical;']) !!}
                                        {!! $errors->first('excerpt', '<span class="text-red">:message</span>') !!}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel-group" id="accordion">
                    <div class="panel panel-default" id="panel1">
                        <div class="panel-heading">
                            <h4 class="panel-title">
                                <a data-toggle="collapse" data-target="#collapseThree" style="cursor: pointer;">Page Attributes
                                </a>
                            </h4>
                        </div>
                        <div id="collapseThree" class="panel-collapse collapse in">
                            <div class="panel-body">
                                <div class="form-group">
                                    <label class="control-label col-md-3">Parent: </label>
                                    <div class="col-md-9">
                                        {!! Form::select('post_parent_id',  ['0' => '-- No Parent'] + $pages , null , ['class'=>'input-sm form-control']) !!}
                                        {!! $errors->first('post_parent_id', '<span class="text-red">:message</span>') !!}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>Modules/Client/Views/pages/includes/js.blade.php000064400000001215152434100730015565 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Pages\PagesRequest', 'form#page-form'); !!}
<script>
     $('#image').filemanager('image', {prefix: "{{ URL::to('/qxcms/laravel/filemanager') }}"});
</script>
<script type="text/javascript">
    CKEDITOR.replace( 'content', {
        filebrowserImageBrowseUrl: '/qxcms/laravel/filemanager?type=Images',
        filebrowserBrowseUrl: '/qxcms/laravel/filemanager?type=Files',
    });

    var path = $('[name="featured_image"]').val();
    $("#featuredImagePreview").attr("src", path);
</script>Modules/Client/Views/pages/includes/css.blade.php000066400000000172152434100730015744 0ustar00<style>
.panel-heading a:after {
    font-family:'Glyphicons Halflings';
    content:"\e114";
    float: right;
}
</style>Modules/Client/Views/pages/about-us/create.blade.php000066400000003254152434100730016354 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-plus"></i> Add {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.about-us.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>
            <li class="active">Add</li>
        </ol>
    </section>

    <section class="content">
        @include('Client::message')
        {!! Form::open(array('route'=> config('modules.client').'.about-us.store', 'class' => 'form-horizontal', 'method' => 'POST', 'id' => 'about-us-form')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::pages.about-us.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-primary save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save</button>
            </div>
        </div>
        {!! Form::close() !!}
    </section>
@stop
@section('page-css')
    @include('Client::pages.about-us.includes.css')
@stop
@section('page-js')
    @include('Client::pages.about-us.includes.js')
    @include('Client::notify')
@stopModules/Client/Views/pages/about-us/includes/about-us-details-modal.blade.php000066400000002450152434100730023170 0ustar00<div id="about-us-details-modal" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">About Us Details</h4>
            </div>
            <div class="modal-body">
                <table class="table table-condensed" id="details-table" width="100%">
                    <tbody>
                        <tr>
                            <th width="10%">Title:</th>
                            <td width="40%" class="title"></td>
                        </tr>
                        <tr>
                            <th width="10%">Content:</th>
                            <td width="40%" class="content"></td>
                        </tr>
                        <tr>
                            <th width="10%">Status:</th>
                            <td width="40%" class="status"></td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default btn-flat close-modal" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>Modules/Client/Views/pages/about-us/includes/form.blade.php000066400000001337152434100730017662 0ustar00<div class="form-group">
    <label class="control-label col-md-3">Title <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::text('title', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-3">Content <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::textarea('content', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-3">Status <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::select('status',  $status , null ,  ['class'=>'form-control']) !!}
    </div>
</div>Modules/Client/Views/pages/about-us/includes/js.blade.php000066400000002237152434100730017333 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Pages\AboutUsRequest', 'form#about-us-form'); !!}
<script type="text/javascript">
    CKEDITOR.replace( 'content', {
        filebrowserImageBrowseUrl: '/qxcms/laravel/filemanager?type=Images',
        filebrowserBrowseUrl: '/qxcms/laravel/filemanager?type=Files',
        height: '300px',
    });

    var about_us_form = $('form#about-us-form');
    $('button.save-btn').on('click', function() {
        var btn = $(this);
        btn.button('loading');
        var messageLength = CKEDITOR.instances['content'].getData().replace(/<[^>]*>/gi, '').length;
        
        if(about_us_form.valid()){
        	if(!messageLength) {
	            swal('Please enter a content.', '', 'error').catch(swal.noop);

	            setTimeout(function(){
                btn.button('reset');
	            }, 200);
	            return false;
	        }
	        return true;
        }else{
            setTimeout(function(){
                btn.button('reset');
            }, 200);
           return false;
        }
    });
</script>Modules/Client/Views/pages/about-us/includes/css.blade.php000066400000000172152434100730017503 0ustar00<style>
.panel-heading a:after {
    font-family:'Glyphicons Halflings';
    content:"\e114";
    float: right;
}
</style>Modules/Client/Views/pages/about-us/index.blade.php000066400000015216152434100730016221 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}" aria-hidden="true"></i> {{$pageTitle}}
            <br>
            <small>{{$pageDescription}}</small>
        </h1>
        <ol class="breadcrumb">
            <li class="active"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</li>
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">
        @include('Client::message')
        <div class="box box-default">
            <div class="box-header with-border">
                <div class="pull-left">
                    <form action="javascript:void(0)" id="about-us-filter" method="POST" class="form-inline" role="form">
                        <b>Filter: </b>
                        <div class="form-group">
                            <input type="text" name="title" class="form-control" placeholder="Type title to search." style="width: 300px !important;" autocomplete="off">
                        </div>
                        <div class="form-group">
                            <label class="sr-only" for="">Search About Us</label>
                            {!! Form::select('status', $status, null, ['class' => 'form-control', 'placeholder'=>'All']) !!}
                        </div>
                        <button type="submit" class="btn btn-primary">Filter</button>
                        <button href="javascript:void(0)" class="btn btn-default" id="reset">Reset</button>
                    </form>
                </div>
                @can('create', $permissions)
                    <div class="pull-right">
                        <a href="{{ route(config('modules.client').'.about-us.create') }}" class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add {{$pageModuleName}}</a>
                    </div>
                @endcan
            </div>
            <div class="box-body">
                <table class="table table-bordered table-striped table-hover" id="about-us-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Title</th>
                            <th>Status</th>
                            <th>Action</th>
                        </tr>
                    </thead>
               </table>
            </div>
        </div>
        @include('Client::logs')
        @include('Client::pages.about-us.includes.about-us-details-modal')
    </section>
@stop
@section('page-js')
<script type="text/javascript">
    $(document).ready(function() {
        var aboutUsTable = $('#about-us-table').DataTable({
            "processing": true,
            "serverSide": true,
            "pagingType": "input",
            ajax: {
                url: '{!! route(config('modules.client').'.about-us.datatables-index') !!}',
                type: 'POST',
                "data": function(d){
                    d.title = $('#about-us-filter [name="title"]').val();
                    d.status = $('#about-us-filter [name="status"]').val();
                }
            },
            "dom": "<'row'<'col-sm-6'i><'col-sm-6 text-right'l>>" +
                "<'row'<'col-sm-12'tr>>" +
                "<'row'<'col-sm-5'><'col-sm-7'p>>",
            columns: [
                {
                    width:'10px', searchable: false, orderable: false,
                    render: function (data, type, row, meta) {
                        return meta.row + meta.settings._iDisplayStart + 1;
                    }
                },
                { data: 'title', name: 'title' },
                { data: 'status_name', name: 'status_name', sortable: false, searchable: false, width:'100px', className:'text-center'},
                { data: 'action', name: 'action', orderable: false, searchable: false, width:'60px', className:'text-center'},
            ],
            fnDrawCallback: function ( oSettings ) {
                aboutUsTable.on("click", '#btn-delete', function() {
                    var action = $(this).data('action');
                    swal({
                        title: 'Are you sure you want to delete?',
                        text: "This will be permanently deleted",
                        type: 'warning',
                        showCancelButton: true,
                        confirmButtonColor: '#3085d6',
                        cancelButtonColor: '#d33',
                        confirmButtonText: 'Yes'
                        }).then(function () {
                        $.ajax({
                            type: "DELETE",
                            url: action,
                            dataType: 'json',
                            success: function(data) {
                                if(data.type == "success") {
                                    aboutUsTable.draw();
                                    swal(data.message, '', 'success').catch(swal.noop);
                               }else{
                                    swal(data.message, '', 'error').catch(swal.noop);
                               }
                            },
                            error :function( jqXhr ){
                                swal('Unable to delete.', 'Please try again.', 'error').catch(swal.noop);
                            }
                        });
                    }).catch(swal.noop);
                });
            },
            "order": [[1, "asc"]],
        });
        $('#about-us-filter').on('submit', function(){
            aboutUsTable.draw();
        });
        $('#reset').on('click', function(event) {
            event.preventDefault();
            $('#about-us-filter [name="title"]').val('');
            $('#about-us-filter [name="status"]').val('');
            aboutUsTable.draw();
        });
    });
</script>
<script type="text/javascript">
    $('#about-us-details-modal').on('show.bs.modal', function (event) {
        var modal = $(this);
        var href = $(event.relatedTarget);
        var details_url = href.data('details_url');

        $.ajax({
            url: details_url,
            type: 'GET',
        }).done(function(response){
            modal.find('.title').html(response.title);
            modal.find('.content').html(response.content);
            modal.find('.status').html(response.status_name);
        })
    });

    $('#about-us-details-modal').on('hidden.bs.modal', function (event) {
        var modal = $(this);

        modal.find('.title').html('');
        modal.find('.content').html('');
        modal.find('.status').html('');
    });
</script>
@include('Client::notify')
@stopModules/Client/Views/pages/about-us/edit.blade.php000066400000003430152434100730016032 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
         <h1>
            <i class="fa fa-pencil"></i> Edit {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.about-us.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>
            <li class="active">Edit</li>
        </ol>
    </section>

    <section class="content">
        @include('Client::message')
        {!! Form::model($about_us, array('route' => [config('modules.client').'.about-us.update', $about_us->hashid], 'method' => 'PUT', 'class'=>'form-horizontal', 'role' => 'form' , 'id'=>'about-us-form')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::pages.about-us.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-warning save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save Changes</button>
            </div>
        </div>
        {!! Form::close() !!}
        <br>
        @include('Client::logs')
    </section>
@stop
@section('page-css')
    @include('Client::pages.about-us.includes.css')
@stop
@section('page-js')
    @include('Client::pages.about-us.includes.js')
    @include('Client::notify')
@stopModules/Client/Views/pages/index.blade.php000066400000012653152434100730014464 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}" aria-hidden="true"></i> {{$pageTitle}}
            <br>
            <small>{{$pageDescription}}</small>
        </h1>
        <ol class="breadcrumb">
            <li class="active"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</li>           
        </ol>
    </section>
    <!-- Main content -->
    <section class="content"> 
        @include('Client::message')
        <div class="box box-default">
            <div class="box-header with-border">
                <div class="pull-left">
                    <form action="javascript:void(0)" id="page-filter" method="POST" class="form-inline" role="form">
                        <b>Filter: </b>
                        <div class="form-group">
                            {!! Form::text('title', null, ['placeholder' => 'Page Title', 'class' => 'form-control', 'autocomplete' => 'off']) !!}
                        </div>
                        <button type="submit" class="btn btn-primary">Filter</button>
                        <button href="javascript:void(0)" class="btn btn-default" id="reset">Reset</button>
                    </form>
                </div>
                @can('create', $permissions)
                    <div class="pull-right">
                        <a href="/client/pages/create" class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add {{$pageModuleName}}</a>
                    </div>
                @endcan
            </div>
            <div class="box-body">
                <table class="table table-bordered table-striped table-hover" id="page-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Title</th>
                            <th>Author</th>
                            <th>Slug</th>
                            <th>Action</th>
                        </tr>
                    </thead>
               </table>
            </div>                
        </div>
        @include('Client::logs')
    </section>
@stop
@section('page-js')
<script type="text/javascript">
    $(document).ready(function() {
        var pageTable = $('#page-table').DataTable({
            "processing": true,
            "serverSide": true,
            "pagingType": "input",
            "bFilter": false,
            ajax: {
                url:'pages/get-page-data', 
                type: 'POST',
                "data": function(d){
                    d.title = $('#page-filter [name="title"]').val();
                }
            },
            "dom": "<'row'<'col-sm-6'i><'col-sm-6 text-right'l>>" +
                "<'row'<'col-sm-12'tr>>" +
                "<'row'<'col-sm-5'><'col-sm-7'p>>",
            columns: [
                {
                    width:'10px', searchable: false, orderable: false,
                    render: function (data, type, row, meta) {
                        return meta.row + meta.settings._iDisplayStart + 1;
                    }
                },
                { data: 'title', name: 'title' },
                { data: 'author', name: 'author', sortable: false, searchable: false},
                { data: 'slug', name: 'slug', sortable: false, searchable: false},
                { data: 'action', name: 'action', orderable: false, searchable: false, width:'60px', className:'text-center'},
            ],
            fnDrawCallback: function ( oSettings ) {
                $('[data-toggle="tooltip"]').tooltip();
                $("#page-table td").on("click", '.deleted', function() {
                    var action = $(this).data('action');
                    swal({
                        title: 'Are you sure you want to delete?',
                        text: "This will be permanently deleted",
                        type: 'warning',
                        showCancelButton: true,
                        confirmButtonColor: '#3085d6',
                        cancelButtonColor: '#d33',
                        confirmButtonText: 'Yes'
                        }).then(function () {                    
                        $.ajax({
                            type: "GET",
                            url: action,
                            dataType: 'json',
                            success: function(data) {
                                if(data.type == "success") {
                                    pageTable.draw();
                                    swal(data.message, '', 'success')
                               }else{
                                    swal(data.message, '', 'error')
                               }
                            },
                            error :function( jqXhr ) {
                                swal('Unable to delete.', 'Please try again.', 'error')
                            }
                        });
                    })              
                });            
            },
            "order": [[1, "asc"]],
        });
        $('#page-filter').on('submit', function(){
            pageTable.draw();
        });
        $('#reset').on('click', function(event) {
            event.preventDefault();
            $('#page-filter [name="title"]').val('');
            pageTable.draw();
        });
    });
</script>
@include('Client::notify')
@stopModules/Client/Views/pages/edit.blade.php000066400000003407152434100730014277 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
         <h1>
            <i class="fa fa-pencil"></i> Edit {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.pages.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>             
            <li class="active">Edit</li>
        </ol>
    </section>

    <section class="content"> 
        @include('Client::message')
        {!! Form::model($page, array('url' => config('modules.client').'/pages/update/'.$page->hashid, 'method' => 'POST', 'class'=>'form-horizontal', 'role' => 'form' , 'id'=>'page-form', 'files' => true)) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::pages.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-warning save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save Changes</button>
            </div>
        </div>
        {!! Form::close() !!}
        <br>
        @include('Client::logs')
    </section>
@stop
@section('page-css')
    @include('Client::pages.includes.css')
@stop
@section('page-js')
    @include('Client::pages.includes.js')
    @include('Client::notify')
@stopModules/Client/Views/job-opening/create.blade.php000066400000004044152434100730015723 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-plus"></i> Add {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.job-opening.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>             
            <li class="active">Add</li>           
        </ol>
    </section>

    <section class="content"> 
        @include('Client::message')
        {!! Form::open(array('route' => config('modules.client').'.job-opening.store', 'class' => 'form-horizontal', 'method' => 'POST', 'id' => 'job-form')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::job-opening.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-2">
                <button class="btn btn-flat btn-lg btn-block btn-primary" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." name="_save" value="add" id="add-question-btn"><i class="fa fa-save"></i> Save</button>
            </div>
            <div class="col-md-4">
                <button class="btn btn-flat btn-lg btn-block btn-default" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." name="_save" value="add_another" id="add-another-question-btn"><i class="fa fa-save"></i> Save & Add Another</button>
            </div>
        </div>
        {!! Form::close() !!}
    </section>
@stop
@section('page-css')
    @include('Client::job-opening.includes.css')
@stop
@section('page-js')
    @include('Client::job-opening.includes.js')
    @include('Client::notify')
@stopModules/Client/Views/job-opening/includes/form.blade.php000066400000011654152434100730017236 0ustar00<h3 class="page-header">&nbsp;Job Opening</h3>

 <div class="form-group">
      <label class="control-label col-md-4">Type of Questionnaire </label>
      <div class="col-md-6">
        {!! Form::select('type_questionnaire', ['0' => '', '1' => 'Taiwan Factory Worker', '2' => 'Singapore Nurse', '3' => 'Domestic Helper', '4' => 'Korea Performing Arts', '5' => 'China English Teacher'], null, ['class' => 'form-control', 'id' => 'type_questionnaire']); !!}
        <small style="font-size:14px"><b>Note:</b> Leave blank if no additional questionnaire needed.</small>
     </div>
</div>

<div class="form-group">
    <label class="control-label col-md-4">Position Title <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::text('position', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-4">No. of applicants needed <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::text('no_position', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-4">Proposed Salary <i>(Optional)</i></label>
    <div class="col-md-6">
        {!! Form::text('proposed_salary', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-4">Location <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::text('location', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-4">Country:</label>
    <div class="col-md-6">
        {!! Form::select('country_id' , $country, null ,  ['class'=>'form-control']) !!}
    </div>
</div>

<br>
<h3 class="page-header">&nbsp;Required Qualifications</h3>
<div class="form-group">
    <label class="control-label col-md-4">Gender <i class="required">*</i></label>
    <div class="col-md-1">
        {{ Form::radio('gender', 'Any', true) }}&nbsp;Any
    </div>
    <div class="col-md-1">
        {{ Form::radio('gender', 'Male') }}&nbsp;Male
    </div>
    <div class="col-md-2">
        {{ Form::radio('gender', 'Female') }}&nbsp;Female
    </div>
</div>
<div class="row">
    <div class="form-inline">
        <label class="control-label col-md-4">Age:</label>
        <div class="col-md-3">
            <div class="form-group">
                <label class="control-label col-md-1"><i>Min</i></label>
                <div class="col-md-5">
                    {!! Form::text('min_age', null , ['class'=>'form-control min_age', 'autocomplete'=>'off']) !!}
                </div>
            </div>
        </div>
        <div class="col-md-5">
            <div class="form-group">
                <label class="control-label col-md-1"><i>Max</i></label>
                <div class="col-md-5">
                    {!! Form::text('max_age', null , ['class'=>'form-control max_age', 'autocomplete'=>'off']) !!}
                </div>
            </div>
        </div>
    </div>
</div>
<br>
<h3 class="page-header">&nbsp;Job Status</h3>
<div class="form-group">
    <label class="control-label col-md-4">Status: <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::select('status' , $status, null ,  ['class'=>'form-control']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-4">Opening Date: <i class="required">*</i></label>
    <div class="col-md-6">
        <div class="input-group opening_date">
        @if(isset($job->opening_date))
            {!! Form::text('opening_date', null, ['class' => 'form-control', 'id'=>'opening_date', 'data-mask']) !!}
        @else
            {!! Form::text('opening_date', null, ['class' => 'form-control opening_date', 'id'=>'opening_date', 'data-mask']) !!}
        @endif
          <div class="input-group-addon">
              <span class="fa fa-calendar"></span>
          </div>
        </div>
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-4">Closing Date: <i class="required">*</i></label>
    <div class="col-md-6">
        <div class="input-group closing_date">
        @if(isset($job->closing_date))
            {!! Form::text('closing_date', null, ['class' => 'form-control', 'id'=>'closing_date', 'data-mask']) !!}
        @else
            {!! Form::text('closing_date', null, ['class' => 'form-control closing_date', 'id'=>'closing_date', 'data-mask']) !!}
        @endif
          <div class="input-group-addon">
              <span class="fa fa-calendar"></span>
          </div>
        </div>
    </div>
</div>

<br>
<h3 class="page-header">&nbsp;Job Details</h3>
<div class="form-group">
    <label class="control-label col-md-2"></label>
    <div class="col-md-8">
        {!! Form::textarea('job_details', null , ['class'=>'form-control wysihtml5', 'placeholder'=>'Details here...', 'autocomplete'=>'off']) !!}
    </div>
</div>
Modules/Client/Views/job-opening/includes/js.blade.php000066400000007347152434100730016713 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\JobOpening\JobOpeningRequest', 'form#job-form'); !!}
<script>
$(function(){
    var body = $('body');
    $("#opening_date, #closing_date").inputmask(body.data('datepicker-mask'), {"placeholder": body.data('datepicker-mask')});
    $("#opening_date, #closing_date").datepicker({ 
        yearRange: "1970:+0",
        changeMonth: true,
        changeYear: true,
        minDate: 0,
        dateFormat: body.data('datepicker-format'),
        onSelect: function(datetext){
            $(this).valid();
        }
    });

    var date = new Date();
    date.setMonth(date.getMonth() + 1);
    $(".closing_date").datepicker('setDate', date);
    $('.opening_date').datepicker("setDate", "0");

    $.validator.setDefaults({ ignore: '' });
    $(function(){
        $('textarea[name="job_details"]').wysihtml5({
            toolbar: {
                "font-styles": true, // Font styling, e.g. h1, h2, etc.
                "emphasis": true, // Italics, bold, etc.
                "lists": true, // (Un)ordered lists, e.g. Bullets, Numbers.
                "html": false, // Button which allows you to edit the generated HTML.
                "link": false, // Button to insert a link.
                "image": false, // Button to insert an image.
                "color": false, // Button to change color of font
                "blockquote": false, // Blockquote
            }
        });
    });
    $('input').iCheck({
        checkboxClass: 'icheckbox_square-blue',
        radioClass: 'iradio_square-blue',
        decreaseArea: '20%',
    })

    var min_age = $('.min_age').val();
    var max_age = $('.max_age').val();
    if(min_age == 0){
        $('.min_age').val('');
    }
    if(max_age == 0){
        $('.max_age').val('');
    }

    $('#job-details-modal').on('show.bs.modal', function (event) {
        var modal = $(this);
        var href = $(event.relatedTarget);
        var details_url = href.data('details_url');

        $.ajax({
            url: details_url,
            type: 'GET',
        }).done(function(response){
            modal.find('.position_title').html(response.position);
            modal.find('.applicants_needed').html(response.no_position);
            modal.find('.proposed_salary').html(response.proposed_salary);
            modal.find('.location').html(response.location);
            modal.find('.country').html(response.country.name);
            modal.find('.gender').html(response.gender);
            modal.find('.min_age').html(response.max_age != 0 ? response.max_age : 'N/A');
            modal.find('.max_age').html(response.min_age != 0 ? response.min_age : 'N/A');
            modal.find('.status').html(response.status);
            modal.find('.opening_date').html(moment(response.opening_date).format('MMMM DD, YYYY'));
            modal.find('.closing_date').html(moment(response.closing_date).format('MMMM DD, YYYY'));
            modal.find('.job_details').html(response.job_details != '' ? response.job_details : 'N/A');
        })
    });

    $('#job-details-modal').on('hidden.bs.modal', function (event) {
        var modal = $(this);

        modal.find('.position_title').html('');
        modal.find('.applicants_needed').html('');
        modal.find('.proposed_salary').html('');
        modal.find('.location').html('');
        modal.find('.country').html('');
        modal.find('.gender').html('');
        modal.find('.min_age').html('');
        modal.find('.max_age').html('');
        modal.find('.status').html('');
        modal.find('.opening_date').html('');
        modal.find('.closing_date').html('');
        modal.find('.job_details').html('');
    });
});
</script>Modules/Client/Views/job-opening/includes/css.blade.php000066400000000172152434100730017054 0ustar00<style>
.panel-heading a:after {
    font-family:'Glyphicons Halflings';
    content:"\e114";
    float: right;
}
</style>Modules/Client/Views/job-opening/includes/job-opening-modal.blade.php000066400000006714152434100730021575 0ustar00<!-- Modal -->
<div id="job-details-modal" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Job Opening</h4>
            </div>
            <div class="modal-body">
            <h3 class="page-header">&nbsp;Details</h3>
                <table class="table table-bordered table-condensed table-hover" id="details-table" width="100%">
                    <tbody>
                        <tr>
                            <th width="20%">Position Title</th>
                            <td width="30%" class="position_title"></td>
                        </tr>
                        <tr>
                            <th width="20%">No. of applicants needed</th>
                            <td width="30%" class="applicants_needed"></td>
                        </tr>
                        <tr>
                            <th width="20%">Proposed Salary</th>
                            <td width="30%" class="proposed_salary"></td>
                        </tr>
                        <tr>
                            <th width="20%">Location</th>
                            <td width="30%" class="location"></td>
                        </tr>
                        <tr>
                            <th width="20%">Country</th>
                            <td width="30%" class="country"></td>
                        </tr>
                    </tbody>
                </table>
            <h3 class="page-header">&nbsp;Required Qualifications</h3>
                <table class="table table-bordered table-condensed table-hover" id="details-table" width="100%">
                    <tbody>
                        <tr>
                            <th width="20%">Gender</th>
                            <td width="30%" class="gender"></td>
                        </tr>
                        <tr>
                            <th width="20%">Age</th>
                            <td width="30%"><b>Min:</b> <span class="min_age"></span> 
                                <br><b>Max:</b> <span class="max_age"></span>
                            </td>
                        </tr>
                    </tbody>
                </table>
            <h3 class="page-header">&nbsp;Job Status</h3>
                <table class="table table-bordered table-condensed table-hover" id="details-table" width="100%">
                    <tbody>
                        <tr>
                            <th width="20%">Status</th>
                            <td width="30%" class="status"></td>
                        </tr>
                        <tr>
                            <th width="20%">Opening Date</th>
                            <td width="30%" class="opening_date"></td>
                        </tr>
                        <tr>
                            <th width="20%">Closing Date</th>
                            <td width="30%" class="closing_date"></td>
                        </tr>
                    </tbody>
                </table>
            <h3 class="page-header">&nbsp;Job Details</h3>
                <p class="job_details" style="margin: 20px;"></p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default btn-flat close-modal" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>Modules/Client/Views/job-opening/index.blade.php000066400000014604152434100730015572 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}" aria-hidden="true"></i> {{$pageTitle}}
            <br>
            <small>{{$pageDescription}}</small>
        </h1>
        <ol class="breadcrumb">
            <li class="active"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</li>           
        </ol>
    </section>
    <!-- Main content -->
    <section class="content"> 
        @include('Client::message')
        <div class="box box-default">
            <div class="box-header with-border">
                <div class="pull-left">
                    <form action="javascript:void(0)" id="job-filter" method="POST" class="form-inline" role="form">
                        <b>Filter: </b>
                        <div class="form-group">
                            {!! Form::text('position', null, ['placeholder' => 'Enter Position Title', 'class' => 'form-control', 'autocomplete' => 'off']) !!}
                        </div>
                        <div class="form-group">
                            <label class="sr-only" for="">Search Job</label>
                            {!! Form::select('status', $status, null, ['class' => 'form-control', 'placeholder'=>'All']) !!}
                        </div>
                        <button type="submit" class="btn btn-primary">Filter</button>
                        <button href="javascript:void(0)" class="btn btn-default" id="reset">Reset</button>
                    </form>
                </div>
                @can('create', $permissions)
                    <div class="pull-right">
                        <a href="{{ route(config('modules.client').'.job-opening.create') }}" class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add {{$pageModuleName}}</a>
                    </div>
                @endcan
            </div>
            <div class="box-body">
                <table class="table table-bordered table-striped table-hover" id="job-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Position Title</th>
                            <th>Opening Date</th>
                            <th>Closing Date</th>
                            <th>Location</th>
                            <th>Status</th>
                            <th>Action</th>
                        </tr>
                    </thead>
               </table>
            </div>
        </div>
        @include('Client::job-opening.includes.job-opening-modal')
        @include('Client::logs')
    </section>
@stop
@section('page-css')
    @include('Client::job-opening.includes.css')
@stop
@section('page-js')
<script type="text/javascript">
    $(document).ready(function() {
        var jobTable = $('#job-table').DataTable({
            "processing": true,
            "serverSide": true,
            "pagingType": "input",
            ajax: {
                url: '{!! route(config('modules.client').'.job-opening.datatables-index') !!}', 
                type: 'POST',
                "data": function(d){
                    d.position = $('#job-filter [name="position"]').val();
                    d.status = $('#job-filter [name="status"]').val();
                }
            },
            "dom": "<'row'<'col-sm-6'i><'col-sm-6 text-right'l>>" +
                "<'row'<'col-sm-12'tr>>" +
                "<'row'<'col-sm-5'><'col-sm-7'p>>",
            columns: [
                {
                    width:'10px', searchable: false, orderable: false,
                    render: function (data, type, row, meta) {
                        return meta.row + meta.settings._iDisplayStart + 1;
                    }
                },
                { data: 'position', name: 'position'},
                { data: 'opening_date', name: 'opening_date', orderable: true, searchable: false},
                { data: 'closing_date', name: 'closing_date', orderable: true, searchable: false},
                { data: 'location', name: 'location', orderable: false, searchable: true},
                { data: 'status', name: 'status', orderable: false, searchable: false},
                { data: 'action', name: 'action', orderable: false, searchable: false, width:'60px', className:'text-center'},
            ],
            fnDrawCallback: function ( oSettings ) {
                $('[data-toggle="tooltip"]').tooltip();
                jobTable.$("td").on("click", 'a#btn-delete', function() {
                    var action = $(this).data('action');
                    swal({
                        title: 'Are you sure you want to delete?',
                        text: "This will be permanently deleted",
                        type: 'warning',
                        showCancelButton: true,
                        confirmButtonColor: '#3085d6',
                        cancelButtonColor: '#d33',
                        confirmButtonText: 'Yes'
                        }).then(function () {                    
                        $.ajax({
                            type: "DELETE",
                            url: action,
                            dataType: 'json',
                            success: function(data) {
                                if(data.type == "success") {
                                    jobTable.draw();
                                    swal(data.message, '', 'success')
                               }else{
                                    swal(data.message, '', 'error')
                               }
                            },
                            error :function( jqXhr ) {
                                swal('Unable to delete.', 'Please try again.', 'error')
                            }
                        });
                    }).catch(swal.noop);
                });            
            },
            "order": [[1, "asc"]],
        });
        $('#job-filter').on('submit', function(){
            jobTable.draw();
        });
        $('#reset').on('click', function(event) {
            event.preventDefault();
            $('#job-filter [name="position"]').val('');
            $('#job-filter [name="status"]').val('');
            jobTable.draw();
        });
    });
</script>
@include('Client::job-opening.includes.js')
@include('Client::notify')
@stopModules/Client/Views/job-opening/edit.blade.php000066400000003423152434100730015405 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-pencil"></i> Edit {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.job-opening.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>             
            <li class="active">Edit</li>
        </ol>
    </section>

    <section class="content"> 
        @include('Client::message')
        {!! Form::model($job, array('route' => [config('modules.client').'.job-opening.update', $job->hashid], 'method' => 'PUT', 'class'=>'form-horizontal', 'role' => 'form' , 'id'=>'job-form')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::job-opening.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-warning save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save Changes</button>
            </div>
        </div>
        {!! Form::close() !!}
        <br>
        @include('Client::logs')
    </section>
@stop
@section('page-css')
    @include('Client::job-opening.includes.css')
@stop
@section('page-js')
    @include('Client::job-opening.includes.js')
    @include('Client::notify')
@stopModules/Client/Views/principals/create.blade.php000066400000003537152434100730015666 0ustar00@extends('Client::layouts')
@section('page-body')           
     <!-- Content Header (Page header) -->
     <section class="content-header">
          <h1>
               <i class="fa fa-plus-circle" aria-hidden="true"></i> Add Client
          </h1>
          <ol class="breadcrumb">
               <li><a href="{{ route(config('modules.client').'.settings.principals.index') }}"><i class="fa fa-user-o"></i> Client</a></li>
               <li class="active">Add</li>  
          </ol>
     </section>
     <!-- Main content -->
     <section class="content">
          @include('Client::errors')
          @include('Client::message')
          {!! Form::open(['url'=>url(config('modules.client').'/principals'),'method'=>'POST' , 'class'=>'form-horizontal', 'role'=>'form', 'id'=>'principal-form', 'autocomplete'=>'off']) !!}
          <div class="box box-primary">
               <div class="box-header">
                    <h1 class="box-title">@include('Client::all-fields-are-required')</h1>
               </div>     
               <div class="box-body">                
                    @include('Client::principals.includes.form')
               </div>
               <div class="box-footer">
                    <div class="row">
                         
                         <div class="col-md-3 col-md-offset-8 text-center">
                              <button class="btn btn-primary btn-flat btn-lg btn-block save-btn" data-loading-text="<i class='fa fa-circle-o-notch'></i> Saving..."><i class="fa fa-save"></i> Save</button>
                         </div>
                    </div>
               </div>
          </div>
          {!! Form::close() !!}
     </section>
@stop
@section('page-css')
     @include('Client::principals.includes.css')
@stop
@section('page-js')
     @include('Client::principals.includes.js')
     @include('Client::notify')
@stop
Modules/Client/Views/principals/navigation.blade.php000066400000001620152434100730016551 0ustar00<div id="principal-navigation-scrollspy">
    <ul class="nav nav-pills nav-stacked" id="principal-navigation-affix" style="background-color:#fff;">
        <li role="presentation" class="{{ (isset($active) && $active == 'overview') ? 'active':'' }}"><a href="{{ route(config('modules.client').'.settings.principals.overview', $principal->hashid) }}"><i class="fa fa-eye"></i> Overview</a></li>
        <li role="presentation" class="{{ (isset($active) && $active == 'info') ? 'active':'' }}"><a href="{{ route(config('modules.client').'.settings.principals.edit', $principal->hashid) }}"><i class="fa fa-pencil"></i> Update Info</a></li>
        <li role="presentation" class="{{ (isset($active) && $active == 'contact-person') ? 'active':'' }}"><a href="{{ route(config('modules.client').'.principals.contact-persons.index', $principal->hashid) }}"><i class="fa fa-users"></i> Contacts</a></li>
    </ul>
</div>Modules/Client/Views/principals/includes/form.blade.php000066400000005270152434100730017170 0ustar00<div class="form-group">
    <label class="control-label col-md-2">Name <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('name', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('address') ? ' has-error' : '' }}">
    <label class="control-label col-md-2">Address <i class="required">*</i></label>
    <div class="col-md-9">
    {!! Form::text('address', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('email') ? ' has-error' : '' }}">
    <label class="control-label col-md-2">Email <i class="required">*</i></label>
    <div class="col-md-6">
    {!! Form::text('email', null, ['class'=>'form-control']) !!}
    </div>
</div>

<div class="form-group {{ $errors->has('contact_details') ? ' has-error' : '' }}">
    <label class="control-label col-md-2">Contact</label>
    <div class="col-md-6">
        <div class="input-group">
             <input type="text" name="contact_details[{{ ((isset($principal->contact_details[0])) ? $principal->contact_details[0]:'new_1') }}]" value="{{ ((isset($principal->contact_details[0])) ? $principal->contact_details[0]:null) }}" class="form-control intlphone" style="width:100%;" />
            <div class="input-group-btn">
                <button class="btn btn-primary btn-flat add-contact-btn" type="button"><i class="fa fa-plus"></i></button>
            </div>
        </div>
    </div>
</div>
<div class="contact-holder">
    @if(isset($principal->contact_details))
        @if(!empty($principal->contact_details))
            @foreach($principal->contact_details as $num_key => $number)
                @if($num_key <> 0)
                <div class="form-group">
                    <label class="control-label col-md-2"></label>
                    <div class="col-md-6">
                        <div class="input-group">
                            <input type="text" name="contact_details[{{$num_key}}]" value="{{ $number }}" class="form-control intlphone"/>
                            <div class="input-group-btn">
                                <button class="btn btn-danger btn-flat remove-contact-btn" type="button"><i class="fa fa-times"></i></button>
                            </div>
                        </div>
                    </div>
                </div>
                @endif
            @endforeach
        @endif
    @endif
</div>

<div class="form-group {{ $errors->has('status') ? ' has-error' : '' }}">
    <label class="control-label col-md-2">Status</label>
    <div class="col-md-4">
    {!! Form::select('status',  $statuses , null ,  ['class'=>'form-control']) !!}
    </div>
</div>


Modules/Client/Views/principals/includes/js.blade.php000066400000006533152434100730016644 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Principals\PrincipalRequest', '#principal-form'); !!}
<script type="text/javascript">
$(function(){
    var body = $('body');
    var form = $('form#principal-form');
   /* 
    $('#real_password').on('keyup', function(e){
        $('#password').val($(this).val());
        e.preventDefault();
    });
    $('#real_password').attr('type', 'password');
    $('#view-password').on('click', function(e) {
        if($(this).hasClass('open')) {
            $(this).removeClass('open');
            $(this).closest('.input-group').find('input').attr('type', 'password');
            $(this).html('<i class="fa fa-eye-slash"></i>');
        } else {
            $(this).addClass('open');
            $(this).closest('.input-group').find('input').attr('type', 'text');
            $(this).html('<i class="fa fa-eye"></i>');
        }
    });*/

    $(".intlphone").intlTelInput({
          //allowExtensions:true,
        autoFormat:true,
        numberType:"MOBILE",
          //autoPlaceholder:false,
        defaultCountry: "ph",
          //autoHideDialCode: false,
         // nationalMode:true,
        utilsScript: body.data('url')+'/template/AdminLTE/plugins/intlnum/lib/libphonenumber/build/utils.js'
    });



    $('body').on('click', 'button.add-contact-btn', function(e){
        var counter = form.find('input[name^="contact"]').length + 1;

        var limit = 5;
        if (counter > limit)  {
              swal('',"You have reached the maximum limit of contact.", 'error');
              return false
        }
        var new_input = "<div class=\"form-group\">";
                new_input += "<label class=\"control-label col-md-2\"></label>";
                new_input += "<div class=\"col-md-6\">";
                    new_input += "<div class=\"input-group\">"
                        new_input += "<input type=\"text\" name=\"contact_details[new_"+counter+"]\" class=\"form-control intlphone\" style=\"width:100%\">";
                        new_input += "<div class=\"input-group-btn\">";
                            new_input += "<button class=\"btn btn-flat btn-danger remove-contact-btn\" type=\"button\"><i class=\"fa fa-times\"></i></button>";           
                        new_input += "</div>";
                    new_input += "</div>";
                new_input += "</div>";
            new_input += "</div>";

        $('.contact-holder').append(new_input);
        $(".intlphone").intlTelInput({
          //allowExtensions:true,
            autoFormat:true,
            numberType:"MOBILE",
          //autoPlaceholder:false,
            defaultCountry: "ph",
          //autoHideDialCode: false,
         // nationalMode:true,
            utilsScript: body.data('url')+'/template/AdminLTE/plugins/intlnum/lib/libphonenumber/build/utils.js'
        });
        return false;  
        
    });

      $('body').on('click', 'button.remove-contact-btn', function(e){
            $(this).closest('.form-group').remove();
        });

    $('button.save-btn').on('click', function() {
        var btn = $(this);
        btn.button('loading');
        if($('form#principal-form').valid()) return true;

        setTimeout(function(){
            btn.button('reset');
        }, 200);

       return false;
    });
});
</script>Modules/Client/Views/principals/includes/css.blade.php000066400000000370152434100730017011 0ustar00<style type="text/css">
    .intl-tel-input .selected-flag {
        z-index: 3;
    }
    .intl-tel-input {
         display: initial; 
         position: initial;
    }
    .intl-tel-input .flag-dropdown {
     position: absolute; 
    }
</style>Modules/Client/Views/principals/includes/modal.blade.php000066400000005327152434100730017324 0ustar00<div class="modal fade" id="principal-modal" tabindex="-1" role="dialog">
    <div class="modal-dialog modal-md">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title"><i class="fa fa-university"></i> Manage Principal</h4>
            </div>
            <div class="modal-body">
                <div id="principal-modal-message-wrapper"></div>
                <div class="row">
                    <div class="col-md-12">
                        <span class="text-danger">All field with <i>(<i class="fa fa-asterisk form-required"></i>)</i> is required</span>
                    </div>
                    <div class="col-md-12">
                        {{ Form::open(['url' => url(config('modules.client')).'/settings/principals', 'method' => 'POST' ,'class' => '', 'id' => 'principal-modal-form']) }}
                            <div class="row">
                                <div class="col-md-8">
                                    <div class="form-group" >
                                        <label>Name <i>(<i class="fa fa-asterisk form-required"></i>)</i></label>
                                        {{ Form::text('name', null, array('class' => 'form-control', 'style'=>'width:100%', 'placeholder' => 'Name')) }}
                                        <div class="name_error error"></div>
                                    </div>
                                </div>
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <label>Code <i>(<i class="fa fa-asterisk form-required"></i>)</i></label>
                                        {{ Form::text('code', null, array('class' => 'form-control', 'placeholder' => 'Code')) }}
                                        <div class="code_error error"></div>
                                    </div>
                                </div>
                            </div>
                            <hr>
                            <div class="row">
                                <div class="col-md-12 text-center">
                                    <div class="form-group">
                                       <button type="submit" class="btn btn-primary btn-flat" id="principal-save-btn"><i class="fa fa-save"></i> Save</button>
                                    </div>
                                </div>
                            </div>
                        {{ Form::close() }}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

Modules/Client/Views/principals/includes/modal-requiredjs.blade.php000066400000004737152434100730021503 0ustar00<script type="text/javascript">

    $(function() {

         $('#principal-modal').on('hide.bs.modal', function () {
           
            var form = $('form#principal-modal-form');
            var formGroup = $('form#principal-modal-form .form-group');
            var formGroupErrorDiv = $('form#principal-modal-form .form-group div.error');
            formGroup.removeClass('has-error');
            formGroup.removeClass('has-success');
            formGroupErrorDiv.html("");
            $('#principal-modal-message-wrapper').html("");
            form[0].reset();

         });


        $('#principal-save-btn').click(function(){
            var form = $(this).closest('form');
            var action = form.attr('action');
            var btn = $(this); 
            var formGroup = form.find('.form-group');
            var formGroupErrorDiv = form.find('.form-group').find('div.error');
                $.ajax({
                    type: "POST",
                    url: action,
                    dataType: 'json',
                    data: form.serialize(),
                    success: function(data) {
                        if(data.type == "success") {
                            formGroup.removeClass('has-error');
                            formGroup.removeClass('has-success');
                            formGroupErrorDiv.html("");
                            $('<option value="'+data.row.id+'">'+data.row.name+'</option>').appendTo('#vessel-modal #principal_id');
                            $('#vessel-modal #principal_id').select2('val', data.row.id);
                            $("#vessel-modal #principal_id").select2('close');
                            form[0].reset();
                            show_alert(data.message, 'success', 'principal-modal-message-wrapper');
                       }else{
                            show_alert(data.message, 'error', 'principal-modal-message-wrapper');
                       }
                    },
                    error :function( jqXhr ) {
                        //
                        if( jqXhr.status === 422 ) {
                            var errors = jqXhr.responseJSON;
                            ajaxValidate(form, formGroup, formGroupErrorDiv, btn, errors)

                        } else {
                            show_alert("Something went wrong. Please report to IRIS Team.", 'error'); 
                        }      
                    }
                });
            return false;
        });
    });
</script>Modules/Client/Views/principals/overview.blade.php000066400000006133152434100730016264 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-eye"></i> Client Overview
           
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.settings.principals.index') }}"><i class="fa fa-user-o"></i> Client</a></li>
            <li class="active">Overview</li>           
        </ol>
    </section>
    <!-- Main content -->
    <section class="content"> 
        @include('Client::errors')
        @include('Client::message')
        <div class="row">
            <div class="col-md-3">
                @include('Client::principals.navigation', array('active' => 'overview'))
            </div>
            <div class="col-md-9">
                <div class="box box-primary">
                    <div class="box-body">
                        <div class="page-header">
                             <h1 class="text-info">{{ $principal->name }}</h1>
                             <small><i class="fa fa-map-marker"></i> {{ $principal->address }}</small>
                             <small><i class="fa fa-envelope"></i> {{ $principal->email }}</small>
                        </div>
                    </div>
                </div>
                <div class="box box-default">
                    <div class="box-header">
                        <h1 class="box-title"><a href="{{ route(config('modules.client').'.principals.contact-persons.index', $principal->hashid) }}">List of Contacts</a></h1>
                    </div>

                    <div class="box-body">
                        <table class="table table-bordered table-condensed table-striped" id='contact-persons-table' width="100%">
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th>Details</th>
                                    <th>Contact Nos.</th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </section>
@stop
@section('page-js')

<script type="text/javascript">
$(function() {
    var contactTable = $('#contact-persons-table').DataTable({
        processing: true,
        serverSide: true,
        "pagingType": "input",
        filter:false,
        paging:false,
        info:false,
        ajax: "{!! url(config('modules.client').'/principals/'.$principal->hashid.'/get-contact-persons-data') !!}",
        columns: [
            {
                width:'10px', searchable: false, orderable: false,
                render: function (data, type, row, meta) {
                    return meta.row + meta.settings._iDisplayStart + 1;
                }
            },
            { data: 'contact_details', name: 'contact_details', searchable:false},
            { data: 'contact_numbers', name: 'contact_numbers', searchable: false, orderable: false},
        ],
        "order": [[1, "asc"]],
    });
});
</script>
@include('Client::notify')
@stopModules/Client/Views/principals/contact-persons/create.blade.php000066400000003730152434100730021003 0ustar00@extends('Client::layouts')
@section('page-body')           
     <!-- Content Header (Page header) -->
     <section class="content-header">
          <h1>
               <i class="fa fa-plus-circle" aria-hidden="true"></i> Add Contact
          </h1>
          <ol class="breadcrumb">
               <li><a href="{{ route(config('modules.client').'.settings.principals.index') }}"><i class="fa fa-user-o"></i> Client</a></li>
               <li><a href="{{ route(config('modules.client').'.principals.contact-persons.index', $principal->hashid) }}"> Contact</a></li>
               <li class="active">Add</li>  
          </ol>
     </section>
     <!-- Main content -->
     <section class="content">
          @include('Client::errors')
          @include('Client::message')
          {!! Form::open(['route'=> [config('modules.client').'.principals.contact-persons.store', $principal->hashid], 'method'=>'POST' ,'class'=>'form-horizontal','role'=>'form','id'=>'contact-person-form']) !!}
          <div class="box box-primary">
               <div class="box-header">
                    <h1 class="box-title">@include('Client::all-fields-are-required')</h1>
               </div>     
               <div class="box-body">                
                    @include('Client::principals.contact-persons.includes.form')
               </div>
               <div class="box-footer">
                    <div class="col-md-3 col-md-offset-8 text-center">
                         <button class="btn btn-primary btn-flat btn-lg btn-block save-btn" data-loading-text="<i class='fa fa-spin fa-circle-o-notch'></i> Saving..."><i class="fa fa-save"></i> Save </button>
                    </div>
               </div>
          </div>
          {!! Form::close() !!}
     </section>
@stop
@section('page-css')
     
     @include('Client::principals.contact-persons.includes.css')
@stop
@section('page-js')
     @include('Client::principals.contact-persons.includes.js')
     @include('Client::notify')
@stop
Modules/Client/Views/principals/contact-persons/includes/form.blade.php000066400000004441152434100730022311 0ustar00<div class="form-group">
    <label class="control-label col-md-2">Name <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('name', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('position') ? ' has-error' : '' }}">
    <label class="control-label col-md-2">Position <i class="required">*</i></label>
    <div class="col-md-9">
    {!! Form::text('position', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('email') ? ' has-error' : '' }}">
    <label class="control-label col-md-2">Email <i class="required">*</i></label>
    <div class="col-md-9">
    {!! Form::text('email', null, ['class'=>'form-control']) !!}
    </div>
</div>

<div class="form-group {{ $errors->has('contact_no') ? ' has-error' : '' }}">
    <label class="control-label col-md-2">Contact <i class="required">*</i></label>
    <div class="col-md-6">
        <div class="input-group">
             <input type="text" name="contact[{{ ((isset($contact->numbers[0])) ? $contact->numbers[0]->id:'new_1') }}]" value="{{ ((isset($contact->numbers[0])) ? $contact->numbers[0]->contact:null) }}" class="form-control intlphone" style="width:100%;" />
            <div class="input-group-btn">
                <button class="btn btn-primary btn-flat add-contact-btn" type="button"><i class="fa fa-plus"></i></button>
            </div>
        </div>
    </div>
</div>

@if(isset($contact->numbers))
    @if(!empty($contact->numbers))
        @foreach($contact->numbers as $num_key => $number)
            @if($num_key <> 0)
            <div class="form-group">
                <label class="control-label col-md-2"></label>
                <div class="col-md-6">
                    <div class="input-group">
                        <input type="text" name="contact[{{ $number->id }}]" value="{{ $number->contact }}" class="form-control intlphone"/>
                        <div class="input-group-btn">
                            <button class="btn btn-danger btn-flat remove-contact-btn" type="button"><i class="fa fa-times"></i></button>
                        </div>
                    </div>
                </div>
            </div>
            @endif
        @endforeach
    @endif
@endif

Modules/Client/Views/principals/contact-persons/includes/js.blade.php000066400000006060152434100730021761 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Principals\ContactPersonRequest', '#contact-person-form'); !!}

<script type="text/javascript">
    $(function(){
        var body = $('body');
        var form = $('form#contact-person-form');
        $('button.save-btn').on('click', function() {
            var btn = $(this);
            btn.button('loading');
            if(btn.hasClass('btn-warning')) $('a.btn-cancel').hide();
            if(form.valid()) return true;

            setTimeout(function(){
                btn.button('reset');
                if(btn.hasClass('btn-warning')) $('a.btn-cancel').show();
            }, 200);
            return false;
        }); 

        $(".intlphone").intlTelInput({
              //allowExtensions:true,
            autoFormat:true,
            numberType:"MOBILE",
              //autoPlaceholder:false,
            defaultCountry: "ph",
              //autoHideDialCode: false,
             // nationalMode:true,
            utilsScript: body.data('url')+'/template/AdminLTE/plugins/intlnum/lib/libphonenumber/build/utils.js'
        });

        $('body').on('click', 'button.add-contact-btn', function(e){
            var counter = form.find('input[name^="contact"]').length + 1;

            var limit = 5;
            if (counter > limit)  {
                  swal('',"You have reached the maximum limit of contact.", 'error');
                  return false
            }
            var new_input = "<div class=\"form-group\">";
                    new_input += "<label class=\"control-label col-md-2\"></label>";
                    new_input += "<div class=\"col-md-6\">";
                        new_input += "<div class=\"input-group\">"
                            new_input += "<input type=\"text\" name=\"contact[new_"+counter+"]\" class=\"form-control intlphone\" style=\"width:100%\">";
                            new_input += "<div class=\"input-group-btn\">";
                                new_input += "<button class=\"btn btn-flat btn-danger remove-contact-btn\" type=\"button\"><i class=\"fa fa-times\"></i></button>";           
                            new_input += "</div>";
                        new_input += "</div>";
                    new_input += "</div>";
                new_input += "</div>";

            $(this).closest('.form-group').parent().append(new_input);
            $(".intlphone").intlTelInput({
              //allowExtensions:true,
                autoFormat:true,
                numberType:"MOBILE",
              //autoPlaceholder:false,
                defaultCountry: "ph",
              //autoHideDialCode: false,
             // nationalMode:true,
                utilsScript: body.data('url')+'/template/AdminLTE/plugins/intlnum/lib/libphonenumber/build/utils.js'
            });
            return false;  
            
        });

         $('body').on('click', 'button.remove-contact-btn', function(e){
            $(this).closest('.form-group').remove();
        });
    });
</script>Modules/Client/Views/principals/contact-persons/includes/css.blade.php000066400000000370152434100730022133 0ustar00<style type="text/css">
    .intl-tel-input .selected-flag {
        z-index: 3;
    }
    .intl-tel-input {
         display: initial; 
         position: initial;
    }
    .intl-tel-input .flag-dropdown {
     position: absolute; 
    }
</style>Modules/Client/Views/principals/contact-persons/index.blade.php000066400000011332152434100730020644 0ustar00@extends('Client::layouts')
@section('page-body')           
     <!-- Content Header (Page header) -->
     <section class="content-header">
          <h1>
               <i class="fa fa-pencil" aria-hidden="true"></i> Manage Contacts
          </h1>
          <ol class="breadcrumb">
               <li><a href="{{ route(config('modules.client').'.settings.principals.index') }}"><i class="fa fa-user-o"></i> Client</a></li>
               <li class="active">Contact</li>  
          </ol>
     </section>
     <!-- Main content -->
     <section class="content">
          @include('Client::errors')
          @include('Client::message')
          <div class="row">
               <div class="col-md-3">
                    @include('Client::principals.navigation', array('active' => 'contact-person'))
               </div>
               <div class="col-md-9">
                    <div class="box box-primary">
                         <div class="box-header">
                              <h1 class="box-title">List of Contacts</h1>
                              @can('create', $permissions)
                              <span class="pull-right">
                                   <a href="{{ route(config('modules.client').'.principals.contact-persons.create', $principal->hashid) }}" data-toggle="tooltip" data-placement="top" title="" data-original-title="Add Contact" class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add Contact</a>
                              </span>
                              @endcan
                         </div>
                         <div class="box-body">
                              <table class="table table-bordered table-condensed table-striped" id='contact-persons-table' width="100%">
                                   <thead>
                                        <tr>
                                            <th>#</th>
                                            <th>Details</th>
                                            <th>Contact Nos.</th>
                                            <th>Action</th>
                                        </tr>
                                   </thead>
                              </table>
                         </div>
                    </div>
                    @include('Client::logs')
               </div>
          </div>
     </section>
@stop
@section('page-css')
  
@stop
@section('page-js')
<script type="text/javascript">
$(function() {
    var contactTable = $('#contact-persons-table').DataTable({
        processing: true,
        serverSide: true,
        "pagingType": "input",
        ajax: "{!! url(config('modules.client').'/principals/'.$principal->hashid.'/get-contact-persons-data') !!}",
        columns: [
            {
                width:'10px', searchable: false, orderable: false,
                render: function (data, type, row, meta) {
                    return meta.row + meta.settings._iDisplayStart + 1;
                }
            },
            { data: 'contact_details', name: 'contact_details', searchable:false},
            { data: 'contact_numbers', name: 'contact_numbers', searchable: false, orderable: false},
            { data: 'action', name: 'action', orderable: false, searchable: false, width:'50px', className:'text-center'},
        ],
        fnDrawCallback: function ( oSettings ) {
          $('[data-toggle="tooltip"]').tooltip();
          contactTable.$("td").on("click", 'a#btn-delete', function() {
                var action = $(this).data('action');
                swal({
                    title: 'Are you sure you want to delete?',
                    text: "This will be permanently deleted",
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: 'Yes'
                    }).then(function () {                    
                    $.ajax({
                        type: "DELETE",
                        url: action,
                        dataType: 'json',
                        success: function(data) {
                            if(data.type == "success") {
                                contactTable.draw();
                                swal(data.message, '', 'success')
                           }else{
                                swal(data.message, '', 'error')
                           }
                        },
                        error :function( jqXhr ) {
                            swal('Unable to delete.', 'Please try again.', 'error')
                        }
                    });
                })
            });
        },
        "order": [[1, "asc"]],
    });
});
</script>
@include('Client::notify')
@stopModules/Client/Views/principals/contact-persons/edit.blade.php000066400000004665152434100730020475 0ustar00@extends('Client::layouts')
@section('page-body')           
     <!-- Content Header (Page header) -->
     <section class="content-header">
          <h1>
               <i class="fa fa-pencil" aria-hidden="true"></i> Edit Contact
          </h1>
          <ol class="breadcrumb">
               <li><a href="{{ route(config('modules.client').'.settings.principals.index') }}"><i class="fa fa-user-o"></i> Client</a></li>
               <li><a href="{{ route(config('modules.client').'.principals.contact-persons.index', $principal->hashid) }}"> Contact</a></li>
               <li class="active">Edit</li>  
          </ol>
     </section>
     <!-- Main content -->
     <section class="content">
          @include('Client::errors')
          @include('Client::message')
          {!! Form::model($contact, ['route'=> [config('modules.client').'.principals.contact-persons.update', $principal->hashid, $contact->hashid], 'method'=>'PUT' ,'class'=>'form-horizontal','role'=>'form','id'=>'contact-person-form']) !!}
          <div class="box box-primary">
               <div class="box-header">
                    <h1 class="box-title">@include('Client::all-fields-are-required')</h1>
               </div>     
               <div class="box-body">                
                    @include('Client::principals.contact-persons.includes.form')
               </div>
               <div class="box-footer">
                    <div class="row">
                         <div class="col-md-3 col-md-offset-5">
                              <a href="{{ route(config('modules.client').'.principals.contact-persons.index', $principal->hashid) }}" class="btn btn-default btn-flat btn-lg btn-block btn-cancel"><i class="fa fa-chevron-left"></i> Back</a>
                         </div>
                         <div class="col-md-3 text-center">
                              <button class="btn btn-warning btn-flat btn-lg btn-block save-btn" data-loading-text="<i class='fa fa-spin fa-circle-o-notch'></i> Saving..."><i class="fa fa-save"></i> Save Changes </button>
                         </div>
                    </div>
               </div>
          </div>
          {!! Form::close() !!}
          <br>
          @include('Client::logs')
     </section>
@stop
@section('page-css')
     @include('Client::principals.contact-persons.includes.css')
@stop
@section('page-js')
     @include('Client::principals.contact-persons.includes.js')
     @include('Client::notify')
@stop
Modules/Client/Views/principals/index.blade.php000066400000007573152434100730015536 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-user-o"></i> Manage Clients
            @include('Client::cache.descriptions.'.$permissions->menu_id)
        </h1>
        <ol class="breadcrumb">
            <li class="active"><i class="fa fa-user-o"></i> Client</li>            
        </ol>
    </section>
    <!-- Main content -->
    <section class="content"> 
        @include('Client::message')
        <div class="box box-primary">
            <div class="box-header">
                @can('create', $permissions)
                <span class="pull-right">
                    <a href="{{ url(config('modules.client').'/principals/create') }}" data-toggle="tooltip" data-placement="top" title="" data-original-title="Add Principal"><button class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add Client</button></a>
                </span>
                @endcan
            </div>
            <div class="box-body">
                <table class="table table-condensed table-bordered table-striped table-hover" id="principals-table" width="100%">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>Details</th>
                        <th>Status</th>
                        <th>Action</th>
                    </tr>
                </thead>
               </table>
            </div>                
        </div>
        @include('Client::logs')
    </section>
@stop
@section('page-js')

<script type="text/javascript">
$(function() {
    var principalTable = $('#principals-table').DataTable({
        processing: true,
        serverSide: true,
        "pagingType": "input",
        ajax: '{!! url(config('modules.client').'/principals/get-principals-data') !!}',
        columns: [
            {
                width:'10px', searchable: false, orderable: false,
                render: function (data, type, row, meta) {
                    return meta.row + meta.settings._iDisplayStart + 1;
                }
            },
            { data: 'details', name: 'details' },
            { data: 'status', name: 'status', width:'50px', searchable: false, orderable: false},
            { data: 'action', name: 'action', orderable: false, searchable: false, width:'50px', className:'text-center'},
        ],
        fnDrawCallback: function ( oSettings ) {
            $('[data-toggle="tooltip"]').tooltip();
            principalTable.$("td").on("click", 'a#btn-delete', function() {
                var action = $(this).data('action');
                swal({
                    title: 'Are you sure you want to delete?',
                    text: "All related details to this client will be permanently deleted.",
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: 'Yes'
                    }).then(function () {                    
                    $.ajax({
                        type: "DELETE",
                        url: action,
                        dataType: 'json',
                        success: function(data) {
                            if(data.type == "success") {
                                principalTable.draw();
                                swal(data.message, '', 'success')
                           }else{
                                swal(data.message, '', 'error')
                           }
                        },
                        error :function( jqXhr ) {
                            swal('Unable to delete.', 'Please try again.', 'error')
                        }
                    });
                })
            });
        },
        "order": [[1, "asc"]],
    });
});
</script>
@include('Client::notify')
@stopModules/Client/Views/principals/edit.blade.php000066400000004527152434100730015350 0ustar00@extends('Client::layouts')
@section('page-body')           
     <!-- Content Header (Page header) -->
     <section class="content-header">
          <h1>
               <i class="fa fa-pencil" aria-hidden="true"></i> Edit Client
          </h1>
          <ol class="breadcrumb">
               <li><a href="{{ route(config('modules.client').'.settings.principals.index') }}"><i class="fa fa-user-o"></i> Client</a></li>
               <li class="active">Edit</li>  
          </ol>
     </section>
     <!-- Main content -->
     <section class="content">
          @include('Client::errors')
          @include('Client::message')
          <div class="row">
               <div class="col-md-3">
                    @include('Client::principals.navigation', array('active' => 'info'))
               </div>
               <div class="col-md-9">
                    {!! Form::model($principal, array('url' => config('modules.client').'/principals/'.$principal->hashid, 'method' => 'PUT', 'class'=>'form-horizontal', 'role' => 'form' , 'id'=>'principal-form')) !!}
                    <div class="box box-primary">
                         <div class="box-header">
                              <h1 class="box-title">@include('Client::all-fields-are-required')</h1>
                         </div>     
                         <div class="box-body">
                              @include('Client::principals.includes.form')
                         </div>
                    
                         <div class="box-footer">
                              <div class="row">
                                   <div class="col-md-3 col-md-offset-8">
                                        <button class="btn btn-warning btn-flat btn-lg btn-block save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..."><i class="fa fa-pencil"></i> Save Changes</button>
                                   </div>
                              </div>
                         </div>             
                    </div>
                    {!! Form::close() !!}
                    <br>
                    @include('Client::logs')
               </div>
          </div>
     </section>
@stop
@section('page-css')
     @include('Client::principals.includes.css')
@stop
@section('page-js')
     @include('Client::principals.includes.js')
     @include('Client::notify')
@stopModules/Client/Views/dashboard/dashboard.blade.php000066400000001124152434100730016123 0ustar00@extends('Client::layouts')
@section('page-body')
	<!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            Dashboard
            <small>Control panel</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li class="active">Dashboard</li>
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">
    	<h1 class="text-center"><b>Welcome to MIP CMS</b></h1>

    </section>
@stop
@section('page-js')     
    @include('Client::notify')
@stopModules/Client/Views/auth/emails/password.blade.php000066400000000242152434100730016322 0ustar00Click here to reset your password: <a href="{{ $link = url('password/reset', $token).'?email='.urlencode($user->getEmailForPasswordReset()) }}"> {{ $link }} </a>
Modules/Client/Views/auth/register.blade.php000066400000007322152434100730015040 0ustar00@extends('Client::layouts.app')

@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading">Register</div>
                <div class="panel-body">
                    <form class="form-horizontal" role="form" method="POST" action="{{ url('/register') }}">
                        {!! csrf_field() !!}

                        <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">Name</label>

                            <div class="col-md-6">
                                <input type="text" class="form-control" name="name" value="{{ old('name') }}">

                                @if ($errors->has('name'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('name') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">E-Mail Address</label>

                            <div class="col-md-6">
                                <input type="email" class="form-control" name="email" value="{{ old('email') }}">

                                @if ($errors->has('email'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">Password</label>

                            <div class="col-md-6">
                                <input type="password" class="form-control" name="password">

                                @if ($errors->has('password'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">Confirm Password</label>

                            <div class="col-md-6">
                                <input type="password" class="form-control" name="password_confirmation">

                                @if ($errors->has('password_confirmation'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password_confirmation') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <button type="submit" class="btn btn-primary">
                                    <i class="fa fa-btn fa-user"></i>Register
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
Modules/Client/Views/auth/passwords/email.blade.php000066400000007046152434100730016333 0ustar00<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>QxCMS | Log-in</title>
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        <link rel="stylesheet" href="{{ get_template('bootstrap/css/bootstrap.min.css') }}">
        <link rel="stylesheet" href="{{ get_template('font-awesome-4.5.0/css/font-awesome.min.css') }}">
        <link rel="stylesheet" href="{{ get_template('ionicons-2.0.1/css/ionicons.min.css') }}">
        <link rel="stylesheet" href="{{ get_template('dist/css/AdminLTE.min.css') }}">
        <link rel="stylesheet" href="{{ get_template('plugins/iCheck/square/blue.css') }}">
        <link rel="stylesheet" href="{{ get_template('dist/css/custom.css') }}">
        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body class="hold-transition login-page">
        <div class="container" style="margin-top:100px;">
            <div class="row">
                <div class="col-md-8 col-md-offset-2">
                    <div class="panel panel-default">
                        <div class="panel-heading"><i class="fa fa-lock"></i> Reset Password</div>
                        <div class="panel-body">
                            <form class="form-horizontal" role="form" method="POST" action="{{ url('/password/reset') }}">
                                {!! csrf_field() !!}
                                <div class="form-group">
                                    <label class="col-md-4 control-label">E-mail Address</label>
                                    <div class="col-md-6">
                                        <input type="email" name="email" class="form-control" placeholder="Email" value="{{ old('email') }}">
                                        @if ($errors->has('email'))
                                            <span class="help-block">
                                                {{ $errors->first('email') }}
                                            </span>
                                        @endif
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-md-6 col-md-offset-4">
                                        <button type="submit" class="btn btn-primary">
                                            <i class="fa fa-btn fa-envelope"></i> Send Password Reset Link
                                        </button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script src="{{ get_template('plugins/jQuery/jquery-1.12.0.min.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('bootstrap/js/bootstrap.min.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('plugins/iCheck/icheck.min.js') }}"></script>
        <script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
        {!! $validator !!}
    </body>
</html>Modules/Client/Views/auth/passwords/reset.blade.php000066400000006203152434100730016360 0ustar00@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading">Reset Password</div>

                <div class="panel-body">
                    <form class="form-horizontal" role="form" method="POST" action="{{ url('/password/reset') }}">
                        {!! csrf_field() !!}

                        <input type="hidden" name="token" value="{{ $token }}">

                        <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">E-Mail Address</label>

                            <div class="col-md-6">
                                <input type="email" class="form-control" name="email" value="{{ $email or old('email') }}">

                                @if ($errors->has('email'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">Password</label>

                            <div class="col-md-6">
                                <input type="password" class="form-control" name="password">

                                @if ($errors->has('password'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">Confirm Password</label>
                            <div class="col-md-6">
                                <input type="password" class="form-control" name="password_confirmation">

                                @if ($errors->has('password_confirmation'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password_confirmation') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <button type="submit" class="btn btn-primary">
                                    <i class="fa fa-btn fa-refresh"></i>Reset Password
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
Modules/Client/Views/auth/login.blade.php000066400000007724152434100730014332 0ustar00<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>MipCMS | Log-in</title>
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        <link rel="stylesheet" href="{{ get_template('bootstrap/css/bootstrap.min.css') }}">
        <link rel="stylesheet" href="{{ get_template('font-awesome-4.5.0/css/font-awesome.min.css') }}">
        <link rel="stylesheet" href="{{ get_template('ionicons-2.0.1/css/ionicons.min.css') }}">
        <link rel="stylesheet" href="{{ get_template('dist/css/AdminLTE.min.css') }}">
        <link rel="stylesheet" href="{{ get_template('plugins/iCheck/square/blue.css') }}">
        <link rel="stylesheet" href="{{ get_template('dist/css/custom.css') }}">
        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body class="hold-transition login-page">
        <div class="login-box">
            <div class="login-logo">
                <span><b>MipCMS</b> | Login </span>
            </div>
            @include('Client::message')
            <div class="login-box-body">
                <p class="login-box-msg">Sign in to start your session</p>
                <form role="form" method="POST" action="{{ url('client/auth/login') }}" id="login-form">
                    {!! csrf_field() !!}
                    <!-- <div class="form-group has-feedback"> -->
                    <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }} has-feedback">
                        <input type="email" name="email" class="form-control" placeholder="Email" value="{{ old('email') }}">
                        <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
                        @if ($errors->has('email'))
                            <span class="help-block">
                                {{ $errors->first('email') }}
                            </span>
                        @endif
                    </div>
                    <!-- <div class="form-group has-feedback"> -->
                    <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }} has-feedback">
                        <input type="password" name="password" class="form-control" placeholder="Password">
                        <span class="glyphicon glyphicon-lock form-control-feedback"></span>
                        @if ($errors->has('password'))
                            <span class="help-block">
                                {{ $errors->first('password') }}
                            </span>
                        @endif
                    </div>
                    <div class="row">
                        <div class="col-xs-8" id="checkbox" style="padding-left:35px;">
                        </div>
                        <div class="col-xs-4">
                          <button type="submit" class="btn btn-primary btn-block btn-flat"><i class="fa fa-sign-in"></i> Sign In</button>
                        </div>
                    </div>
                </form>
                <a href="{{ url('/password/reset') }}"><i class="fa fa-lock"></i> Forgot my password?</a><br>
            </div>
        </div>
        <script src="{{ get_template('plugins/jQuery/jquery-1.12.0.min.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('bootstrap/js/bootstrap.min.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('plugins/iCheck/icheck.min.js') }}"></script>
        <script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
        {!! $validator !!}
    </body>
</html>Modules/Client/Views/reports-layout.blade.php000066400000004400152434100730015256 0ustar00<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="csrf-token" content="{{ csrf_token() }}" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>QxCMS- {{ isset($title) ? $title:'Dashboard' }}</title>
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        <!-- bootstrap 3.0.2 -->
        <link href="{{ get_template('plugins/bootstrap-3.3.7/css/bootstrap.min.css') }}" rel="stylesheet" type="text/css" />
        <!-- font Awesome -->
        <link href="{{ get_template('font-awesome-4.7.0/css/font-awesome.min.css') }}" rel="stylesheet" type="text/css" />
        <!-- Datatables -->
        <link href="{{ get_template('plugins/DataTables-1.10.12/media/css/dataTables.bootstrap.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('dist/css/AdminLTE.min.css') }}" rel="stylesheet" type="text/css" />
    </head>
    <body class="skin-blue layout-top-nav">
        <!-- Main content -->
        <div class="wrapper">
            <div class="content-wrapper">
                <div class="container-fluid">
                @yield('page-body')
                </div>
            </div>
        </div>
        <script src="{{ get_template('plugins/jQuery/jQuery-2.1.4.min.js') }}"></script>
        <script src="{{ get_template('plugins/bootstrap-3.3.7/js/bootstrap.min.js') }}" type="text/javascript"></script>
        <script src="{{ get_template('plugins/DataTables-1.10.12/media/js/jquery.dataTables.js') }}" type="text/javascript"></script>
        <script src="{{ get_template('plugins/DataTables-1.10.12/media/js/dataTables.bootstrap.js') }}" type="text/javascript"></script>
        <script type="text/javascript" src="{{ get_template('plugins/DataTables-1.10.12/extensions/Pagination/input_old.js') }}"></script>
        <script src="{{ get_template('dist/js/app.min.js') }}" type="text/javascript"></script>  
        <script type="text/javascript">
        $.ajaxSetup({
            headers: { 
                'X-CSRF-Token' : $('meta[name=csrf-token]').attr('content'),
            }
        });
        </script>
        @yield('page-js')
    </body>
</html>Modules/Client/Views/reports-table-layouts.blade.php000066400000001011152434100730016521 0ustar00<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="csrf-token" content="{{ csrf_token() }}" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>{{$type}}</title>
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    </head>
    <body>
         <div class="wrapper">
            <div class="content-wrapper">
                @yield('page-body')
            </div>
        </div>
    </body>
</html>Modules/Client/Views/all-fields-are-required.blade.php000066400000000165152434100730016650 0ustar00<span class="text-danger">All fields with <i>(<i class="fa fa-asterisk form-required"></i>)</i> are required</span>.
Modules/Client/Views/cache/.gitignore000066400000000046152434100730013523 0ustar00*
!/descriptions/
!/menus/
!.gitignoreModules/Client/Views/cache/menus/.gitignore000066400000000015152434100730014646 0ustar00*
!.gitignoreModules/Client/Views/cache/menus/9/custom_2.blade.php000064400000001411152434100730016337 0ustar00	<ul class="sidebar-menu">
		<li class="header">MAIN NAVIGATION</li>
		<li id="appslidemenu0">
		<a href="/client/dashboard">
		<i class="fa fa-dashboard"></i> <span>Dashboard</span>
		</a>
		</li>
		<li id="appslidemenu1" class="treeview">
			<a href="#"><i class="fa fa-cog"></i> <span>Administration</span> <i class="fa fa-angle-left pull-right"></i></a>
	<ul class="treeview-menu">
			<li id="appslidemenu3"><a href="/client/settings/users"><i class="fa fa-angle-double-right"></i>&nbsp;User Manager&nbsp;</a></li>		</ul>
</li>
		<li id="appslidemenu9">
			<a href="/client/posts"><i class="fa fa-list-alt "></i><span>Posts</a></a>
</li>
		<li id="appslidemenu14">
			<a href="/client/job-opening"><i class="fa fa-newspaper-o "></i><span>Job Openings</a></a>
</li>
		</ul>
Modules/Client/Views/cache/descriptions/.gitignore000066400000000015152434100730016225 0ustar00*
!.gitignoreModules/Client/Views/notify.blade.php000066400000011645152434100730013566 0ustar00@if(session('success'))
<script type="text/javascript">
$(function() {
    /* Notify Success */
    $.notify.addStyle('success', {
        html: "<div><i class=\"fa fa-check-circle\" aria-hidden=\"true\"></i>&nbsp;<span data-notify-text/></div>",
        classes: {
            base: {
              "white-space": "nowrap",
              "background-color": "#dff0d8",
              "padding": "5px"
            },
            supersuccess: {
              "color": "#3c763d",
              "background-color": "#dff0d8"
            }
        }
    });
    $.notify('{{ session("success") }}', {
        style: 'success',
        className: 'supersuccess',
        clickToHide: true,
        position:"top right", 
        autoHide: true, 
        autoHideDelay: 3000, 
        showAnimation: 'slideDown',
        showDuration: 400,
        hideAnimation: 'slideUp',
        hideDuration: 200
    });
});
</script>    
@endif

@if(session('error'))
<script type="text/javascript">
$(function() {
    /* Notify Danger */
    $.notify.addStyle('danger', {
        html: "<div><i class=\"fa fa-times-circle\" aria-hidden=\"true\"></i>&nbsp;<span data-notify-text/></div>",
        classes: {
            base: {
              "white-space": "nowrap",
              "background-color": "#f2dede",
              "padding": "5px"
            },
            superdanger: {
              "color": "#a94442",
              "background-color": "#f2dede"
            }
        }
    });
    $.notify('{{ session("error") }}', {
        style: 'danger',
        className: 'superdanger',
        clickToHide: true,
        position:"top right", 
        autoHide: true, 
        autoHideDelay: 3000, 
        showAnimation: 'slideDown',
        showDuration: 400,
        hideAnimation: 'slideUp',
        hideDuration: 200
    });
});
</script>    
@endif

@if(session('danger'))
<script type="text/javascript">
$(function() {
    /* Notify Danger */
    $.notify.addStyle('danger', {
        html: "<div><i class=\"fa fa-times-circle\" aria-hidden=\"true\"></i>&nbsp;<span data-notify-text/></div>",
        classes: {
            base: {
              "white-space": "nowrap",
              "background-color": "#f2dede",
              "padding": "5px"
            },
            superdanger: {
              "color": "#a94442",
              "background-color": "#f2dede"
            }
        }
    });
    $.notify('{{ session("danger") }}', {
        style: 'danger',
        className: 'superdanger',
        clickToHide: true,
        position:"top right", 
        autoHide: true, 
        autoHideDelay: 3000, 
        showAnimation: 'slideDown',
        showDuration: 400,
        hideAnimation: 'slideUp',
        hideDuration: 200
    });
});
</script>    
@endif

@if(session('info'))
<script type="text/javascript">
$(function() {
    /* Notify Info */
    $.notify.addStyle('info', {
        html: "<div><i class=\"fa fa-info-circle\" aria-hidden=\"true\"></i>&nbsp;<span data-notify-text/></div>",
        classes: {
            base: {
              "white-space": "nowrap",
              "background-color": "#d9edf7",
              "padding": "5px"
            },
            superinfo: {
              "color": "#31708f",
              "background-color": "#d9edf7"
            }
        }
    });
    $.notify('{{ session("info") }}', {
        style: 'info',
        className: 'superinfo',
        clickToHide: true,
        position:"top right", 
        autoHide: true, 
        autoHideDelay: 3000, 
        showAnimation: 'slideDown',
        showDuration: 400,
        hideAnimation: 'slideUp',
        hideDuration: 200
    });
});
</script>    
@endif

@if(session('warning'))
<script type="text/javascript">
$(function() {
    /* Notify Warning */
    $.notify.addStyle('warning', {
        html: "<div><i class=\"fa fa-exclamation-circle\" aria-hidden=\"true\"></i>&nbsp;<span data-notify-text/></div>",
        classes: {
            base: {
              "white-space": "nowrap",
              "background-color": "#fcf8e3",
              "padding": "5px"
            },
            superwarning: {
              "color": "#8a6d3b",
              "background-color": "#fcf8e3"
            }
        }
    });
    $.notify('{{ session("warning") }}', {
        style: 'warning',
        className: 'superwarning',
        clickToHide: true,
        position:"top right", 
        autoHide: true, 
        autoHideDelay: 3000, 
        showAnimation: 'slideDown',
        showDuration: 400,
        hideAnimation: 'slideUp',
        hideDuration: 200
    });
});
</script>
@endif
<script type="text/javascript">
$(function() {
    $("#appslidemenu{{ isset($permissions->menu_id) ? $permissions->menu_id : '0' }}").addClass("active");
    $("#appslidemenu{{ isset($permissions->menu_id) ? $permissions->menu_id : '0' }}").parent('ul').css('display', 'block');
    $("#appslidemenu{{ isset($permissions->menu_id) ? $permissions->menu_id : '0' }}").closest('ul').parent('li').addClass("active");
});
</script>Modules/Client/Views/officers/create.blade.php000066400000006614152434100730015321 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-plus"></i> Add {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.officer.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>             
            <li class="active">Add</li>            
        </ol>
    </section>

    <section class="content"> 
        @include('Client::message')
        {!! Form::open(array('route' => config('modules.client').'.officer.store', 'class' => 'form-horizontal', 'method' => 'POST', 'id' => 'officer-form')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::officers.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-primary save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save</button>
            </div>
        </div>
        {!! Form::close() !!}
    </section>
@stop
@section('page-css')
<style type="text/css">
    .form-group label{
        text-align: left !important;
    }
    label.checkbox-inline ,  label.radio-inline {
        min-height: 20px;
        padding-left: 0px !important; 
        margin-bottom: 0;
        font-weight: bold !important;
        cursor: pointer;
    }
</style>
@stop
@section('page-js')
@include('Client::officers.includes.js')

<script type="text/javascript">
    $(function(){
       /* $('#add-another-question-btn').on('click', function(){
            var btn_another = $(this);
            var btn = $('#add-question-btn');

            btn_another.parent().addClass('col-md-offset-4');

            btn.parent().removeClass('col-md-4').hide();
            btn_another.button("loading");

            if(!$('#question-form').valid()) {
                setTimeout(function(){
                    btn_another.parent().removeClass('col-md-offset-4');
                    
                    btn.parent().addClass('col-md-4').show();
                    btn_another.button("reset");
                }, '300');
                return false;
            }
        });

         $('#add-question-btn').on('click', function(){
            var btn_another = $(this);
            var btn = $('#add-another-question-btn');

            btn_another.parent().removeClass('col-md-offset-2').addClass('col-md-offset-4');
            
            btn.parent().removeClass('col-md-4').hide();
            btn_another.button("loading");

            if(!$('#question-form').valid()) {
                setTimeout(function(){
                    btn_another.parent().removeClass('col-md-offset-4').addClass('col-md-offset-2');
                    btn.parent().addClass('col-md-4').show();
                    btn_another.button("reset");
                }, '300');
                return false;
            }
        });*/
    });
</script>
@include('Client::notify')
@stopModules/Client/Views/officers/includes/form.blade.php000066400000007334152434100730016627 0ustar00<div class="form-group {{ ($errors->has('name') ? 'has-error':'') }}">
    <label class="control-label col-sm-3">Name: <i class="required">*</i></label>
    <div class="col-sm-8">
        {!! Form::text('name', null, ['class' => 'form-control ', 'placeholder' => 'Enter field officer / editor name here.', 'data-focus' => 'true']) !!}
        {!! $errors->first('name', '<span class="text-red">:message</span>') !!}
    </div>
</div>

<div class="form-group {{ ($errors->has('access_type') ? 'has-error':'') }}">
    <label class="control-label col-sm-3">Access Type: <i class="required">*</i></label>
    <div class="col-sm-4">
        {!! Form::select('access_type', $access_types, null, array('class' => 'form-control', 'placeholder' => ' - Select - ')) !!}
        {!! $errors->first('access_type', '<span class="text-red">:message</span>') !!}
    </div>
</div>
<div class="access-view-wrapper" style="{{ ((isset($officer->access_type) && $officer->access_type == 'Field Officer' ) ? 'display: block':'display:none')  }}">
    <div class="form-group">
        <label class="control-label col-sm-3">Access View: <i class="required">*</i></label>
        <div class="col-sm-9">
            <label class="radio-inline">
                {!! Form::radio('access_view', 'Web', null) !!} Web
            </label>
            <label class="radio-inline">
                {!! Form::radio('access_view', 'Mobile', null) !!} Mobile
            </label>
        </div>
    </div>
</div>
<div class="form-group {{ $errors->has('email') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Email: <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::text('email', null , ['class'=>'form-control', 'placeholder'=>'Enter email here.', 'autocomplete'=>'off']) !!}
    </div>
</div>

<div class="form-group {{ ($errors->has('username') ? 'has-error':'') }}">
    <label class="control-label col-sm-3">Username: <i class="required">*</i></label>
    <div class="col-sm-6">
        {!! Form::text('username', null, ['class' => 'form-control', 'placeholder' => 'Enter username here.']) !!}
        {!! $errors->first('username', '<span class="text-red">:message</span>') !!}
    </div>
</div>

<div class="form-group {{ $errors->has('password') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Password: <?php if(!isset($officer->id)) {?><i class="required">*</i><?php } ?></label>
    <div class="col-md-6">
        {!! Form::password('password', ['class'=>'form-control', 'id' => 'password', 'placeholder'=>'Enter password here.']) !!}
    </div>
</div>

<div class="form-group {{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Re-type Password: <?php if(!isset($officer->id)) {?><i class="required">*</i><?php } ?></label>
    <div class="col-md-6">
        {!! Form::password('password_confirmation', ['class'=>'form-control', 'id' => 'password_confirmation' ,'placeholder'=>'Re-type password here.']) !!}
    </div>
</div>

<div class="form-group {{ $errors->has('status') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Status: <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::select('status', [1=>'Active', 0 => 'Inactive'], null, ['class'=>'form-control']) !!}
    </div>
</div>

<div class="form-group has-feedback {{ ($errors->has('validity_date') ? 'has-error':'') }}">
    <label class="control-label col-sm-3">Account Period Validity:</label>
    <div class="col-sm-3">
        {!! Form::text('validity_date', null, ['class' => 'form-control']) !!}
        <span class="fa fa-calendar form-control-feedback" aria-hidden="true"></span>
        {!! $errors->first('validity_date', '<span class="text-red">:message</span>') !!}
    </div>
</div>Modules/Client/Views/officers/includes/js.blade.php000066400000002507152434100730016275 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Officers\OfficerRequest', 'form#officer-form'); !!}
<script type="text/javascript">
    $(function(){
        var body = $('body');
        var officer_form = $('form#officer-form');

        $('input').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%' // optional
        });

        officer_form.find('select[name="access_type"]').on('change', function(){
            $(this).valid();
            var value = $(this).val();
            if(value.toLowerCase() == 'editor')
            {
                $('.access-view-wrapper').css({'display':'none'});
            } else {
                $('.access-view-wrapper').css({'display':'block'});
            }
        });

        officer_form.find("input[name='validity_date']").inputmask(body.data('datepicker-mask'), {"placeholder": body.data('datepicker-mask')});
        officer_form.find("input[name='validity_date']").datepicker({ 
            yearRange: "2017:+5",
            changeMonth: true,
            changeYear: true,
            onSelect: function(dateText) {
                $(this).valid();
            }
        });
    });
</script>Modules/Client/Views/officers/index.blade.php000066400000012155152434100730015162 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}" aria-hidden="true"></i> {{$pageTitle}}
            <br>
            <small>{{$pageDescription}}</small>
        </h1>
        <ol class="breadcrumb">
            <li class="active"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</li>           
        </ol>
    </section>
    <!-- Main content -->
    <section class="content"> 
        @include('Client::message')
        <div class="box box-primary">
            <div class="box-header with-border">
                <h1 class="box-title">
                    <form class="form-inline">
                        <div class="form-group">
                            <label>Access Type</label>
                            {!! Form::select('access_type', $access_types, null, array('class' => 'form-control', 'placeholder' => ' - All - ')) !!}
                        </div>
                    </form>
                </h1>
                @can('create', $permissions)
                    <span class="pull-right">
                        <a href="{{ route(config('modules.client').'.officer.create') }}" class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add {{$pageModuleName}}</a>
                    </span>
                @endcan
            </div>
            <div class="box-body">
                <table class="table table-bordered table-striped table-hover" id="officer-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Name</th>
                            <th>Email</th>
                            <th>Access Type</th>
                            <th>Account Validity</th>
                            <th>Status</th>
                            <th>Action</th>
                        </tr>
                    </thead>
               </table>
            </div>                
        </div>
        @include('Client::logs')
    </section>
@stop
@section('page-js')
@include('Client::questionnaire.template.js')
<script type="text/javascript">
$(function() {
    var officerTable = $('#officer-table').DataTable({
        processing: true,
        serverSide: true,
        pagingType:'input',
        "pagingType": "input",
        rowReorder: true,
        ajax: {
            url:'{!! url(config('modules.client').'/officers/get-datatables-index') !!}',
            data: function(d){
                d.access_type = $('select[name="access_type"]').val();
            }            
        },
        columns: [
            {
                width:'10px', searchable: false, orderable: false,
                render: function (data, type, row, meta) {
                    return meta.row + meta.settings._iDisplayStart + 1;
                }
            },
            { data: 'name', name: 'name', orderable:true, searchable: true},
            { data: 'email', name: 'email', orderable:true, searchable: true},
            { data: 'access_type', name: 'access_type', orderable:true, searchable:false},
            { data: 'validity_date', name: 'validity_date', orderable:false, searchable: false, className:'text-center'},
            { data: 'status', name: 'status', orderable: false, searchable: false, className:'text-center'},
            { data: 'action', name: 'action', orderable: false, searchable: false, width:'100px', className:'text-center'},
        ],
        fnDrawCallback: function ( oSettings ) {
            $('[data-toggle="tooltip"]').tooltip();
            officerTable.$("td").on("click", 'a#btn-delete', function() {
                var action = $(this).data('action');
                swal({
                    title: 'Are you sure you want to delete?',
                    text: "This will be permanently deleted.",
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: 'Yes'
                    }).then(function () {                    
                    $.ajax({
                        type: "DELETE",
                        url: action,
                        dataType: 'json',
                        success: function(data) {
                            if(data.type == "success") {
                                officerTable.draw();
                                swal(data.message, '', 'success')
                           }else{
                                swal(data.message, '', 'error')
                           }
                        },
                        error :function( jqXhr ) {
                            swal('Unable to delete.', 'Please try again.', 'error')
                        }
                    });
                });
            });

        
        },
        "order": [[1, "desc"]],
    });

    $('select[name="access_type"]').on('change', function(){
        officerTable.draw();
    });
});
</script>
@include('Client::notify')
@stopModules/Client/Views/officers/edit.blade.php000066400000007236152434100730015004 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-pencil"></i> Edit {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.officer.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>             
            <li class="active">Edit</li>            
        </ol>
    </section>

    <section class="content"> 
        @include('Client::message')
        {!! Form::model($officer, array('route' => [config('modules.client').'.officer.update', $officer->hashid] , 'class' => 'form-horizontal', 'method' => 'PUT', 'id' => 'officer-form')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::officers.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-4 col-sm-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-warning save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..."><i class="fa fa-save"></i> Save Changes</button>
            </div>
        </div>
        {!! Form::close() !!}
        <br>
        @include('Client::logs')
    </section>
@stop
@section('page-css')
<style type="text/css">
    .form-group label{
        text-align: left !important;
    }
    label.checkbox-inline ,  label.radio-inline {
        min-height: 20px;
        padding-left: 0px !important; 
        margin-bottom: 0;
        font-weight: bold !important;
        cursor: pointer;
    }
</style>
@stop
@section('page-js')
@include('Client::officers.includes.js')

<script type="text/javascript">
    $(function(){
        //var principal = $('form#subject-form').find('select[name="principal_id"]');


      
       // var questionnaire = $('form#subject-form').find('select[name="template_id"]');

       /* $('#add-another-question-btn').on('click', function(){
            var btn_another = $(this);
            var btn = $('#add-question-btn');

            btn_another.parent().addClass('col-md-offset-4');

            btn.parent().removeClass('col-md-4').hide();
            btn_another.button("loading");

            if(!$('#question-form').valid()) {
                setTimeout(function(){
                    btn_another.parent().removeClass('col-md-offset-4');
                    
                    btn.parent().addClass('col-md-4').show();
                    btn_another.button("reset");
                }, '300');
                return false;
            }
        });

         $('#add-question-btn').on('click', function(){
            var btn_another = $(this);
            var btn = $('#add-another-question-btn');

            btn_another.parent().removeClass('col-md-offset-2').addClass('col-md-offset-4');
            
            btn.parent().removeClass('col-md-4').hide();
            btn_another.button("loading");

            if(!$('#question-form').valid()) {
                setTimeout(function(){
                    btn_another.parent().removeClass('col-md-offset-4').addClass('col-md-offset-2');
                    btn.parent().addClass('col-md-4').show();
                    btn_another.button("reset");
                }, '300');
                return false;
            }
        });*/
    });
</script>
@include('Client::notify')
@stopModules/Client/Views/layouts.blade.php000066400000032261152434100730013753 0ustar00<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="csrf-token" content="{{ csrf_token() }}" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>MIP CMS- {{ isset($pageTitle) ? $pageTitle :'Dashboard' }}</title>
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        <!-- jquery ui 1.11.2 -->
        <link href="{{ get_template('plugins/tablednd/tablednd.css') }}" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" href="{{ get_template('plugins/jquery-ui-1.11.2/jquery-ui.min.css') }}">
        <!-- bootstrap 3.0.2 -->
        <link href="{{ get_template('plugins/bootstrap-3.3.7/css/bootstrap.min.css') }}" rel="stylesheet" type="text/css" />
        <!-- font Awesome -->
        <link href="{{ get_template('font-awesome-4.7.0/css/font-awesome.min.css') }}" rel="stylesheet" type="text/css" />
        <!-- Ionicons -->
        <link href="{{ get_template('ionicons-2.0.1/css/ionicons.min.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('plugins/sweetalert2/dist/sweetalert2.min.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('plugins/iCheck/square/_all.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('plugins/intlnum/css/intlTelInput.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('plugins/bootstrap-tokenfield/dist/css/bootstrap-tokenfield.min.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('plugins/bootstrap-tokenfield/dist/css/tokenfield-typeahead.min.css') }}" rel="stylesheet" type="text/css" />
        <!-- Select 2 -->
        <link href="{{ get_template('plugins/select2/select2.min.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('plugins/select2/select2.bootstrap.min.css') }}" rel="stylesheet" type="text/css" />
        <!-- Datatables -->
        <link href="{{ get_template('plugins/DataTables-1.10.12/media/css/dataTables.bootstrap.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('dist/css/AdminLTE.min.css') }}" rel="stylesheet" type="text/css" />
        <link rel="stylesheet" href="{{ get_template('dist/css/skins/_all-skins.min.css') }}">
        <!-- custom style -->
        <link href="{{ get_template('plugins/notifyjs/notifyjs.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('dist/css/custom.css') }}" rel="stylesheet" type="text/css" />
       <!--  <link href="{{ get_template('plugins/daterangepicker/daterangepicker-bs3.css') }}" rel="stylesheet" type="text/css" /> -->
        <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.css" />
        
        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
          <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
        <![endif]-->       
        @yield('page-css')
    </head>
    <body class="hold-transition sidebar-mini fixed skin-{{ config('template.skin') }}" data-url="{{ url('/') }}" 
        data-datepicker-format="{{ auth('client')->user()->client->date_picker['date_picker'] }}"
        data-datepicker-date="{{ date(auth('client')->user()->client->date_picker['php']) }}"
        data-datepicker-mask="{{ auth('client')->user()->client->date_picker['mask'] }}">

         <div class="wrapper">
            <header class="main-header">
                <a href="{{ url('client/dashboard') }}" class="logo">
                    <span class="logo-mini"><b>MIP </b><!-- <img src="{{ url('img/dashboard-logo.png') }}"  class="img-responsive" style="margin-top: 10px;"> --></span>
                    <span class="logo-lg"><b>MIP </b>CMS<!-- <img src="{{ url('img/dashboard-logo.png') }}"  class="img-responsive"> --></span>
                </a>
                <nav class="navbar navbar-static-top">
                    <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
                        <span class="sr-only">Toggle navigation</span>
                    </a>
                    <div class="navbar-custom-menu">
                        <ul class="nav navbar-nav">
                            <li class="dropdown user user-menu">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                  <img src="{{ asset('img/user-avatar-male.png') }}" class="user-image" alt="User Image">
                                  <span class="hidden-xs">{{ auth('client')->user()->name }}</span>
                                </a>
                                <ul class="dropdown-menu">
                                    <li class="user-header">
                                        <img src="{{ asset('img/user-avatar-male.png') }}" class="img-circle" alt="User Image">
                                        <p>
                                            {{ auth('client')->user()->name }}
                                            <small>{{ auth('client')->user()->email }}</small>
                                            <small><b>Version:</b> {{ config('app.version') }}</small>
                                        </p>
                                    </li>
                                    <li class="user-footer">
                                        <div class="pull-left">
                                            <a href="#" class="btn btn-default btn-flat">Profile</a>
                                        </div>
                                        <div class="pull-right">
                                            <a href="{{ url(config('modules.client').'/auth/logout') }}" class="btn btn-default btn-flat"><i class="fa fa-sign-out"></i> Sign out</a>
                                        </div>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                </nav>
            </header>
            <aside class="main-sidebar">
               <section class="sidebar">
<!--                     <div class="user-panel">
                        <div class="pull-left image">
                          <img src="{{ asset('img/user-avatar-male.png') }}" class="img-circle" alt="User Image">
                        </div>
                        <div class="pull-left info">
                            <p>{{ auth('client')->user()->name }}</p>
                            <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
                        </div>
                    </div> -->
                    @if(isset($userPermissions[20]) && $userPermissions[20]['can_access'] == 1)
                        <form action="{{route(config('modules.client').'.search-applicants.index')}}" method="get" class="sidebar-form">
                            <div class="input-group">
                                <input type="text" name="name" class="form-control" placeholder="Search applicant name..." autocomplete="off">
                                <span class="input-group-btn">
                                    <button type="submit" id="search-btn" class="btn btn-flat">
                                        <i class="fa fa-search"></i>
                                    </button>
                                </span>
                            </div>
                        </form>
                    @endif
                    @include('Client::cache.menus.'.auth('client')->user()->client_id.'.custom_'.auth('client')->user()->role_id)
                </section>
            </aside>
            <div class="content-wrapper">
                <!-- <div class="container-fluid"> -->
                    @yield('page-body')
                <!-- </div> -->
            </div>

            <footer class="main-footer">
                <div class="container-fluid">
                    <div class="pull-right hidden-xs">
                        <b>Version:</b> {{ config('app.version') }}
                    </div>
                    <strong>Copyright &copy; 2016-{{ Date('Y') + 1}} <a href="http://www.quantumx.com">Quantum X, Inc</a>.</strong>
                </div>
            </footer>
        </div>

        <script src="{{ get_template('plugins/jQuery/jQuery-2.1.4.min.js') }}"></script>
        <script type="text/javascript">
        $(function(){
            $('ul.sidebar-menu li').each(function(index, el){
                var li = $(el);
                if(li.hasClass('treeview')){
                    var a = li.find('a');
                    var a_text = a.find('span').html();
                    if(a_text.toLowerCase() == 'applicants' ||  a_text.toLowerCase() == 'applicant'){
                        if("{{ Request::path() }}" != "client/applicants"){
                            li.find('ul').remove();
                            a.attr('href', "{{ route(config('modules.client').'.applicants.index') }}");
                        }else{
                            li.addClass('active');
                            $('body #appslidemenu0').removeClass('active');
                        }
                    }
                }
            });
        });
        </script>
        <script src="{{ get_template('plugins/jquery-ui-1.11.2/jquery-ui.min.js') }}" type="text/javascript"></script>
        <script src="{{ get_template('plugins/bootstrap-3.3.7/js/bootstrap.min.js') }}" type="text/javascript"></script>
        <script type="text/javascript" src="{{ get_template('plugins/slimScroll/jquery.slimscroll.min.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('plugins/fastclick/fastclick.js') }}"></script>
        <script src="{{ get_template('/plugins/sweetalert2/dist/sweetalert2.min.js') }}" type="text/javascript"></script>
        <script src="{{ get_template('plugins/select2/select2.full.js') }}" type="text/javascript"></script>    
        <script src="{{ get_template('plugins/intlnum/js/intlTelInput.min.js') }}" type="text/javascript"></script>    
        <script src="{{ get_template('plugins/DataTables-1.10.12/media/js/jquery.dataTables.js') }}" type="text/javascript"></script>
        <script src="{{ get_template('plugins/DataTables-1.10.12/media/js/dataTables.bootstrap.js') }}" type="text/javascript"></script>
        <script type="text/javascript" src="{{ get_template('plugins/DataTables-1.10.12/extensions/Pagination/input_old.js') }}"></script>
        <script src="{{ get_template('plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js') }}" type="text/javascript"></script>
        <script src="{{ get_template('plugins/iCheck/icheck.min.js') }}" type="text/javascript"></script>
        <!-- notifyjs -->
        <script src="{{ get_template('plugins/notifyjs/notify.min.js') }}" type="text/javascript"></script>
        <!-- token input -->
        <script type="text/javascript" src="{{ get_template('plugins/bootstrap-tokenfield/dist/bootstrap-tokenfield.min.js') }}"></script>
        <!-- input mask -->
        <script type="text/javascript" src="{{ get_template('plugins/input-mask/jquery.inputmask.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('plugins/input-mask/jquery.inputmask.date.extensions.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('plugins/input-mask/jquery.inputmask.extensions.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('plugins/tablednd/jquery.tablednd.0.7.min.js') }}"></script>
        <!-- <script type="text/javascript" src="{{ get_template('plugins/daterangepicker/daterangepicker.js') }}"></script> -->
        <script type="text/javascript" src="{{ get_template('plugins/daterangepicker/moment.min.js') }}"></script>
        <script type="text/javascript" src="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.js"></script>
        <script type="text/javascript" src="{{ get_template('plugins/ckeditor/ckeditor.js') }}"></script>
        <script src="{{ asset('vendor/laravel-filemanager/js/lfm.js') }}"></script>


        <!-- AdminLTE App -->
        <script type="text/javascript" src="{{ asset('vendor/datatables/jquery.jeditable.min.js')}}"></script>
        <script src="{{ get_template('dist/js/app.min.js') }}" type="text/javascript"></script>       
        <script type="text/javascript">
        $.ajaxSetup({
            headers: { 
                'X-CSRF-Token' : $('meta[name=csrf-token]').attr('content'),
            }
        });
        $(function () {
          $('[data-toggle="tooltip"]').tooltip();
        });

        $(document).ready(function(){
            $('select').find('option:eq(0)').removeAttr('hidden');
            $('select').find('option:eq(0)').removeAttr('disabled');
        });
        </script>
        <script type="text/javascript" src="{{ get_template('dist/js/helpers.js') }}"></script>
        @yield('page-js')
    </body>
</html>Modules/Client/Views/subject/create.blade.php000066400000006564152434100730015164 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-plus"></i> Add {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.subject.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>
            <li class="active">Add</li>            
        </ol>
    </section>

    <section class="content"> 
        @include('Client::message')
        {!! Form::open(array('route' => config('modules.client').'.subject.store', 'class' => 'form-horizontal', 'method' => 'POST', 'id' => 'subject-form')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::subject.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-primary save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save</button>
            </div>
        </div>
        {!! Form::close() !!}
    </section>
@stop
@section('page-css')
<style type="text/css">
    .form-group label{
        text-align: left !important;
    }
    /*.checkbox label, .radio label {
        min-height: 20px;
         padding-left: 0px !important; 
        margin-bottom: 0;
        font-weight: bold !important;
        cursor: pointer;
    }*/
</style>
@stop
@section('page-js')
@include('Client::subject.includes.js')

<script type="text/javascript">
    $(function(){
       /* $('#add-another-question-btn').on('click', function(){
            var btn_another = $(this);
            var btn = $('#add-question-btn');

            btn_another.parent().addClass('col-md-offset-4');

            btn.parent().removeClass('col-md-4').hide();
            btn_another.button("loading");

            if(!$('#question-form').valid()) {
                setTimeout(function(){
                    btn_another.parent().removeClass('col-md-offset-4');
                    
                    btn.parent().addClass('col-md-4').show();
                    btn_another.button("reset");
                }, '300');
                return false;
            }
        });

         $('#add-question-btn').on('click', function(){
            var btn_another = $(this);
            var btn = $('#add-another-question-btn');

            btn_another.parent().removeClass('col-md-offset-2').addClass('col-md-offset-4');
            
            btn.parent().removeClass('col-md-4').hide();
            btn_another.button("loading");

            if(!$('#question-form').valid()) {
                setTimeout(function(){
                    btn_another.parent().removeClass('col-md-offset-4').addClass('col-md-offset-2');
                    btn.parent().addClass('col-md-4').show();
                    btn_another.button("reset");
                }, '300');
                return false;
            }
        });*/
    });
</script>
@include('Client::notify')
@stopModules/Client/Views/subject/includes/form.blade.php000066400000007444152434100730016470 0ustar00<div class="form-group {{ ($errors->has('name') ? 'has-error':'') }}">
    <label class="control-label col-sm-3">Subject Name: <i class="required">*</i></label>
    <div class="col-sm-8">
        {!! Form::text('name', null, ['class' => 'form-control ', 'placeholder' => 'Enter subject name here.', 'data-focus' => 'true']) !!}
        {!! $errors->first('name', '<span class="text-red">:message</span>') !!}
    </div>
</div>

<div class="form-group {{ ($errors->has('principal_id') ? 'has-error':'') }}">
    <label class="control-label col-sm-3">Client Assignment: <i class="required">*</i></label>
    <div class="col-sm-8">
        {!! Form::select('principal_id', array(), null, array('class' => 'form-control select2', 'style' => 'width:100%', 'data-id' => (isset($subject->principal_id) ? $subject->principal_id:''), 'data-text' => (isset($subject->principal->name) ? $subject->principal->name:'') )) !!}
        {!! $errors->first('principal_id', '<span class="text-red">:message</span>') !!}
    </div>
</div>

<div class="form-group {{ ($errors->has('template_id') ? 'has-error':'') }}">
    <label class="control-label col-sm-3">Questionnaire Assigned: <i class="required">*</i></label>
    <div class="col-sm-8">
        {!! Form::select('template_id', array(), null, array('class' => 'form-control select2', 'style' => 'width:100%', 'data-id' => (isset($subject->template_id) ? $subject->template_id:''), 'data-text' => (isset($subject->template->title) ? $subject->template->title:'') )) !!}
        {!! $errors->first('template_id', '<span class="text-red">:message</span>') !!}
    </div>
</div>

<div class="form-group has-feedback {{ ($errors->has('interview_date') ? 'has-error':'') }}">
    <label class="control-label col-sm-3">Interview Date: <i class="required">*</i></label>
    <div class="col-sm-3">
        {!! Form::text('interview_date', null, ['class' => 'form-control']) !!}
        <span class="fa fa-calendar form-control-feedback" aria-hidden="true"></span>
        {!! $errors->first('interview_date', '<span class="text-red">:message</span>') !!}
    </div>
</div>
<!-- <div class="form-group has-feedback {{ ($errors->has('completion_date') ? 'has-error':'') }}">
    <label class="control-label col-sm-3">Interview Date Completion: <i class="required">*</i></label>
    <div class="col-sm-3">
        {!! Form::text('completion_date', null, ['class' => 'form-control']) !!}
        <span class="fa fa-calendar form-control-feedback" aria-hidden="true"></span>
        {!! $errors->first('completion_date', '<span class="text-red">:message</span>') !!}
    </div>
</div> -->

<div class="form-group {{ ($errors->has('field_officer_assigned') ? 'has-error':'') }}">
    <label class="control-label col-sm-3">Field Officer Assigned: <i class="required">*</i></label>
    <div class="col-sm-8">
        {!! Form::select('field_officer_assigned', array(), null, array('class' => 'form-control select2 unique-all', 'style' => 'width:100%', 'data-id' => (isset($subject->field_officer_assigned) ? $subject->field_officer_assigned:''), 'data-text' => (isset($subject->fieldOfficer->name) ? $subject->fieldOfficer->name:'') )) !!}
        {!! $errors->first('field_officer_assigned', '<span class="text-red">:message</span>') !!}
    </div>
</div>

<div class="form-group {{ ($errors->has('editor_assigned') ? 'has-error':'') }}">
    <label class="control-label col-sm-3">Editor Assigned: <i class="required">*</i></label>
    <div class="col-sm-8">
        {!! Form::select('editor_assigned', array(), null, array('class' => 'form-control select2', 'style' => 'width:100%', 'data-id' => (isset($subject->editor_assigned) ? $subject->editor_assigned:''), 'data-text' => (isset($subject->editor->name) ? $subject->editor->name:''))) !!}
        {!! $errors->first('editor_assigned', '<span class="text-red">:message</span>') !!}
    </div>
</div>Modules/Client/Views/subject/includes/js.blade.php000066400000014462152434100730016137 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Subject\SubjectRequest', 'form#subject-form'); !!}
<script type="text/javascript">
    $(function(){
        var body = $('body');
        var subject_form = $('form#subject-form');

        $('button.save-btn').on('click', function(){
            var btn = $(this);
            btn.button('loading');
            if(subject_form.valid()){
                return true;
            }
            setTimeout(function(){
                btn.button('reset');
            }, 200);
            
        });

        var principal = subject_form.find("select[name='principal_id']").select2({
            maximumSelectionSize:5,
            placeholder: {
                id: '-1', 
                text: ' - Select - '
            },
            ajax: {
                url: "{!! route(config('modules.client').'.principals.select2') !!}",
                delay:400,
                cache:true,
                data: function (params) {
                  return {
                    name: params.term,
                    placeholder: {
                        id: '-1', 
                        text: ' - Select - '
                    },
                  };
                },
                processResults: function (data, page) {
                  return {
                    results: data
                  };
                }
                
            } 
        }).on('change.select2', function(){
            $(this).valid();
        });

        if(principal.data('id') != '' && typeof principal.data('id') !== 'undefined' && principal.data('id') != null) {
            principal.append($('<option>', {
                value: principal.data('id'), text: principal.data('text')
            }));
        }

 
        var template = subject_form.find("select[name='template_id']").select2({
            maximumSelectionSize:5,
            placeholder: {
                id: '-1', 
                text: ' - Select - '
            },
            ajax: {
                url: "{!! route(config('modules.client').'.questionnaire.select2') !!}",
                delay:400,
                cache:true,
                data: function (params) {
                  return {
                    title: params.term,
                    placeholder: {'text':' - Select -'}
                  };
                },
                processResults: function (data, page) {
                  return {
                    results: data
                  };
                }
            }
        }).on('change.select2', function(){
            $(this).valid();
        });

        if(template.data('id') != '' && typeof template.data('id') !== 'undefined' && template.data('id') != null) {
            template.append($('<option>', {
                value: template.data('id'), text: template.data('text')
            }));
            //template.select2('val', template.data('id'));
        }

        var field_officer = subject_form.find("select[name='field_officer_assigned']").select2({
            maximumSelectionSize:5,
            placeholder: {
                id: '-1', 
                text: ' - Select - '
            },
            ajax: {
                url: "{!! route(config('modules.client').'.users.select2') !!}",
                delay:400,
                cache:true,
                data: function (params) {
                  return {
                    title: params.term,
                    user_type: 'field_officer',
                    placeholder: {'text':' - Select -'}
                  };
                },
                processResults: function (data, page) {
                  return {
                    results: data
                  };
                }
            }
        }).on('change.select2', function(){
            $(this).valid();
        });

        principal.on('change.select2', function() {
            var val = field_officer.val();
            field_officer.val('-1').trigger('change');
            //field_officer.valid();
        });

        template.on('change.select2', function(){
            var val = field_officer.val();
            field_officer.val('-1').trigger('change');
            //field_officer.valid();
        });

        if(field_officer.data('id') != '' && typeof field_officer.data('id') !== 'undefined' && field_officer.data('id') != null) {
            field_officer.append($('<option>', {
                value: field_officer.data('id'), text: field_officer.data('text')
            }));
        }

        var editor = subject_form.find("select[name='editor_assigned']").select2({
            maximumSelectionSize:5,
            placeholder: {
                id: '-1', 
                text: ' - Select - '
            },
            ajax: {
                url: "{!! route(config('modules.client').'.users.select2') !!}",
                delay:400,
                cache:true,
                data: function (params) {
                  return {
                    title: params.term,
                    user_type: 'editor',
                    placeholder: {'text':' - Select -'}
                  };
                },
                processResults: function (data, page) {
                  return {
                    results: data
                  };
                }
            }
        }).on('change.select2', function(){
            $(this).valid();
        });
        

        if(editor.data('id') != '' && typeof editor.data('id') !== 'undefined' && editor.data('id') != null) {
            editor.append($('<option>', {
                value: editor.data('id'), text: editor.data('text')
            }));
        }



        subject_form.find("input[name='interview_date']").inputmask(body.data('datepicker-mask'), {"placeholder": body.data('datepicker-mask')});
        subject_form.find("input[name='interview_date']").datepicker({ 
            yearRange: "2017:+1",
            changeMonth: true,
            changeYear: true
        });

        subject_form.find("input[name='completion_date']").inputmask(body.data('datepicker-mask'), {"placeholder": body.data('datepicker-mask')});
        subject_form.find("input[name='completion_date']").datepicker({ 
            yearRange: "2017:+2",
            changeMonth: true,
            changeYear: true
        });
    });
</script>Modules/Client/Views/subject/index.blade.php000066400000010035152434100730015014 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}" aria-hidden="true"></i> {{$pageTitle}}
            <br>
            <small>{{$pageDescription}}</small>
        </h1>
        <ol class="breadcrumb">
            <li class="active"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</li>           
        </ol>
    </section>
    <!-- Main content -->
    <section class="content"> 
        @include('Client::message')
        <div class="box box-default">
            <div class="box-header with-border">
                @can('create', $permissions)
                    <span class="pull-right">
                        <a href="{{ route(config('modules.client').'.subject.create') }}" class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add {{$pageModuleName}}</a>
                    </span>
                @endcan
            </div>
            <div class="box-body">
                <table class="table table-bordered table-striped table-hover" id="subject-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Details</th>
                            <th>Assigned To</th>
                            <th>Action</th>
                        </tr>
                    </thead>
               </table>
            </div>                
        </div>
        @include('Client::logs')
    </section>
@stop
@section('page-js')
@include('Client::questionnaire.template.js')
<script type="text/javascript">
$(function() {
    var subjectTable = $('#subject-table').DataTable({
        processing: true,
        serverSide: true,
        "pagingType": "input",
        rowReorder: true,
        ajax: {
            url:'{!! url(config('modules.client').'/subject/get-datatables-index') !!}',            
        },
        columns: [
            {
                width:'10px', searchable: false, orderable: false,
                render: function (data, type, row, meta) {
                    return meta.row + meta.settings._iDisplayStart + 1;
                }
            },
            { data: 'details', name: 'details', orderable:true, searchable: true},
            { data: 'assigned_to', name: 'assigned_to', orderable: false, searchable: false},
            { data: 'action', name: 'action', orderable: false, searchable: false, width:'100px', className:'text-center'},
        ],
        fnDrawCallback: function ( oSettings ) {
            $('[data-toggle="tooltip"]').tooltip();
            subjectTable.$("td").on("click", 'a#btn-delete', function() {
                var action = $(this).data('action');
                swal({
                    title: 'Are you sure you want to delete?',
                    text: "This will be permanently deleted.",
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: 'Yes'
                    }).then(function () {                    
                    $.ajax({
                        type: "DELETE",
                        url: action,
                        dataType: 'json',
                        success: function(data) {
                            if(data.type == "success") {
                                subjectTable.draw();
                                swal(data.message, '', 'success')
                           }else{
                                swal(data.message, '', 'error')
                           }
                        },
                        error :function( jqXhr ) {
                            swal('Unable to delete.', 'Please try again.', 'error')
                        }
                    });
                })
            });

        
        },
        "order": [[1, "desc"]],
    });
});
</script>
@include('Client::notify')
@stopModules/Client/Views/subject/edit.blade.php000066400000007223152434100730014637 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-plus"></i> Edit {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.subject.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>               
            <li class="active">Edit</li>            
        </ol>
    </section>

    <section class="content"> 
        @include('Client::message')
        {!! Form::model($subject, array('route' => [config('modules.client').'.subject.update', $subject->hashid] , 'class' => 'form-horizontal', 'method' => 'PUT', 'id' => 'subject-form')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::subject.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-4 col-sm-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-warning save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..."><i class="fa fa-save"></i> Save Changes</button>
            </div>
        </div>
        {!! Form::close() !!}
        <br>
        @include('Client::logs')
    </section>
@stop
@section('page-css')
<style type="text/css">
    .form-group label{
        text-align: left !important;
    }
    /*.checkbox label, .radio label {
        min-height: 20px;
         padding-left: 0px !important; 
        margin-bottom: 0;
        font-weight: bold !important;
        cursor: pointer;
    }*/
</style>
@stop
@section('page-js')
@include('Client::subject.includes.js')

<script type="text/javascript">
    $(function(){
        //var principal = $('form#subject-form').find('select[name="principal_id"]');


      
       // var questionnaire = $('form#subject-form').find('select[name="template_id"]');

       /* $('#add-another-question-btn').on('click', function(){
            var btn_another = $(this);
            var btn = $('#add-question-btn');

            btn_another.parent().addClass('col-md-offset-4');

            btn.parent().removeClass('col-md-4').hide();
            btn_another.button("loading");

            if(!$('#question-form').valid()) {
                setTimeout(function(){
                    btn_another.parent().removeClass('col-md-offset-4');
                    
                    btn.parent().addClass('col-md-4').show();
                    btn_another.button("reset");
                }, '300');
                return false;
            }
        });

         $('#add-question-btn').on('click', function(){
            var btn_another = $(this);
            var btn = $('#add-another-question-btn');

            btn_another.parent().removeClass('col-md-offset-2').addClass('col-md-offset-4');
            
            btn.parent().removeClass('col-md-4').hide();
            btn_another.button("loading");

            if(!$('#question-form').valid()) {
                setTimeout(function(){
                    btn_another.parent().removeClass('col-md-offset-4').addClass('col-md-offset-2');
                    btn.parent().addClass('col-md-4').show();
                    btn_another.button("reset");
                }, '300');
                return false;
            }
        });*/
    });
</script>
@include('Client::notify')
@stopModules/Client/Views/no-data.blade.php000066400000002514152434100730013574 0ustar00@extends('Client::reports-layout')
@section('page-body')
    <!-- Content Header (Page header) -->
    <!-- Main content -->
    <section class="content"> 
        <div class="col-md-8" style="margin-top:50px; margin-left: 15%;">
            <div class="box box-danger">
                <div class="box-body">
                    <div class="col-md-12">
                        <center>
                        <h2><i class="fa fa-warning text-yellow"></i> Oops! No result found.</h2>
                          <p>
                            We could not find the logs you were looking for.
                            Try again using different filter.
                          </p>
                        </center>
                        <form class='search-form' style="width: 100%">
                            <div class='input-group' style="width: 100%;">
                                <div class="input-group-btn">
                                <center><button type="submit" name="submit" class="btn btn-danger btn-flat btn-sm" onclick="window.close();"><i class="fa fa-times"></i> Close</button></center>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </section>
@stop
@section('page-js')
@stopModules/Client/Views/questionnaire/template/action.blade.php000066400000002652152434100730020232 0ustar00<div class="btn-group dropup">
    <button type="button" class="btn btn-warning btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
        Action <span class="caret"></span>
        <span class="sr-only">Toggle Dropdown</span>
    </button>
    <ul class="dropdown-menu dropdown-menu-right">
        @can('update', $permissions)
        <li><a href="{{ url(config('modules.client').'/questionnaire/'.$template->hashid.'/edit') }} "><i class="fa fa-pencil"></i> Edit Template</a></li>
        <li><a href="{{ url(config('modules.client').'/questionnaire/'.$template->hashid.'/copy') }} " id="copy-template"><i class="fa fa-copy"></i> Duplicate</a></li>
        @endcan
        @can('delete', $permissions)
        <li role="separator" class="divider"></li>
        <li><a href="#delete-{{ $template->hashid }} " id="btn-delete" data-action="{{ url(config('modules.client').'/questionnaire/'.$template->hashid) }}"><i class="fa fa-trash-o"></i> Delete</a></li>
        @endcan
        <li role="separator" class="divider"></li>
        @can('update', $permissions)
        <li><a href="{{ route(config('modules.client').'.questionnaire.question.create', $template->hashid) }}"><i class="fa fa-plus-circle"></i> Add Question</a></li>
        @endcan
        <li><a href="{{ route(config('modules.client').'.questionnaire.preview', $template->hashid) }}"><i class="fa fa-eye"></i> Preview</a></li>
    </ul>
</div>Modules/Client/Views/questionnaire/template/form.blade.php000066400000001341152434100730017712 0ustar00<div class="form-group {{ $errors->has('title') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Title: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::text('title', null , ['class'=>'form-control', 'placeholder'=>'Questionnaire template title...', 'autocomplete'=>'off']) !!}
    </div>
</div>

<div class="form-group {{ $errors->has('description') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Description: <i class="required">*</i></label>
    <div class="col-md-9">
        {!! Form::textarea('description', null , ['class'=>'form-control wysihtml5', 'placeholder'=>'Questionnaire template short description here...', 'autocomplete'=>'off']) !!}
    </div>
</div>Modules/Client/Views/questionnaire/template/js.blade.php000066400000002140152434100730017361 0ustar00<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyB4CBr0reSrrQ9EuBFxPVM_TzbuV3uBow4&libraries=places"></script>
<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Questionnaire\TemplateRequest', 'form#add-questionnaire-template-modal-form'); !!}
<script type="text/javascript">
    $.validator.setDefaults({ ignore: '' });
    $(function(){
        $('textarea[name="description"]').wysihtml5({
            toolbar: {
                "font-styles": true, // Font styling, e.g. h1, h2, etc.
                "emphasis": true, // Italics, bold, etc.
                "lists": false, // (Un)ordered lists, e.g. Bullets, Numbers.
                "html": false, // Button which allows you to edit the generated HTML.
                "link": false, // Button to insert a link.
                "image": false, // Button to insert an image.
                "color": false, // Button to change color of font
                "blockquote": false, // Blockquote
            }
        });
    });

    
</script>

Modules/Client/Views/questionnaire/template/preview.blade.php000066400000010420152434100730020426 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-pencil"></i> Preview Questionnaire
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.questionnaire.index') }}"><i class="fa fa-question-circle-o"></i> Questionnaire</a></li>            
            <li class="active">Edit</li>            
        </ol>
    </section>
    <!-- Main content -->
    <section class="content"> 
        @include('Client::message')
       
       
        <div class="row">
            <div class="col-sm-3">
                 @include('Client::questionnaire.nav', array('nav' => 'preview'))
            </div>
            <div class="col-sm-9">
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                      <li class="active"><a href="#web_view" data-toggle="tab"><i class="fa fa-globe"></i> Web View</a></li>
                      <li><a href="#mobile_view" data-toggle="tab"><i class="fa fa-mobile"></i> Mobile View</a></li>
                    </ul>
                    <div class="tab-content">
                        <div class="tab-pane active fade in" id="web_view">
                            @include('Client::questionnaire.template.includes.browser')
                        </div>
                        <div class="tab-pane" id="mobile_view">
                            @include('Client::questionnaire.template.includes.mobile')
                        </div>
                    </div>
                </div>
                <input type="text" name="loc_lat">
                <input type="text" name="loc_long">
            </div>
        </div>
       
        
    </section>
@stop
@section('page-css')
@include('Client::questionnaire.template.includes.css')
@stop
@section('page-js')
<script type="text/javascript" src="{{ get_template('plugins/survey-jquery/survey.jquery.min.js') }}"></script>
<script type="text/javascript">
Survey.Survey.cssType = "bootstrap";
var myCss = {
   // "root":'box box-primary',
    "header": "text-center",
    //"body": "box-body",
    "footer": "box-footer  text-center",
   /* "pageTitle":'box-title',*/
   "navigation": {
        "complete": "btn-success",
        "prev": "btn-primary",
        "next": "btn-warning"
    },
    "error": {
        "root": "",
        "icon": "glyphicon glyphicon-exclamation-sign",
        "item": "text-danger"
    },
    navigationButton: "btn btn-lg btn-flat"   
};

function loadSurvey(element)
{
    $.ajax({
        url: '/api/get-questionnaire',
        type: 'GET',
        data: {'template_id': '{{ $template->id }}'},
    })
    .done(function(response) {
        var survey = new Survey.Model(response);
        $("#" + element).Survey({
            model:survey,
            onComplete:sendDataToServer,
            css:myCss
        });
    })
    .fail(function() {
        console.log("error");
    })
    .always(function() {
        console.log("complete");
    });
    
}

loadSurvey('css-device--browser-container');
$('a[data-toggle="tab"').on('shown.bs.tab', function (e) {
    var active = $(e.target);
    var tab = active.attr('href');
    if(tab == '#mobile_view') loadSurvey('css-device--mobile-container');
    else  loadSurvey('css-device--browser-container');
    
})
function sendDataToServer(survey) {
    var resultAsString = JSON.stringify(survey.data);
    var pos = {
        loc_lat:$('input[name="loc_lat"]').val(),
        loc_long:$('input[name="loc_lat"]').val(),
    }
    $.ajax({
    url: '/api/save-participant',
        type: 'GET',
        data: {
            answers:survey.data,
            template_id: '{{ $template->id }}',
            pos:pos
        }
    })
    .done(function(response) {
        
    })
    .fail(function() {
        console.log("error");
    })
    .always(function() {
        console.log("complete");
    });
}


    function initMap() {

        if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function(position) {
                $('input[name="loc_lat"]').val(position.coords.latitude);
                $('input[name="loc_long"]').val(position.coords.longitude);
            });
        } 
    }

   initMap();
</script>



@include('Client::notify')
@stopModules/Client/Views/questionnaire/template/includes/css.blade.php000066400000011413152434100730021346 0ustar00<style type="text/css">
  .box-header>.fa, .box-header>.glyphicon, .box-header>.ion, .box-header .box-title, .box-header h3 {
      display: inline-block;
      font-size: 18px;
      margin: 0;
      line-height: 1;
  }
</style>


<style type="text/css">
    /* =============================================================================
  COMMON STUFF FOR CSS DEVICES
============================================================================= */
.css-device {
  position: relative;
  margin: 0 auto;
  min-height: 500px;
}

.css-device__image {
  display: block;
  margin: 0;
  padding: 0;
  width: 100%;
  height: auto;
}

/* =============================================================================
  BROWSER
============================================================================= */
.css-device--browser {
  width: 100%;
  /* max-width: 100%; set max width here if you need to. */
  border-top: solid 36px #dfdfdf;
  border-right: solid 2px #dfdfdf;
  border-left: solid 2px #dfdfdf;
  border-bottom: solid 2px #dfdfdf;
  border-radius: 4px 4px 0 0;
}

.css-device--browser::before {
  display: block;
  position: absolute;
  top: -24px;
  left: 12px;
  width: 12px;
  height: 12px;
  background-color: #ff3366;
  border-radius: 12px;
  box-shadow: 0 0 0 0 #ff3366, 16px 0 0 0 #ffcc99, 32px 0 0 0 #33ff66;
  content: "";
}

.css-device--browser::after {
  display: block;
  overflow: hidden;
  position: absolute;
  top: -27px;
  right: 12px;
  padding: 0 4px;
  width: 180px;
  height: 18px;
  color: #b3b3b3;
  background-color: #fff;
  font-size: 12px;
  font-style: italic;
  line-height: 18px;
  border-radius: 2px;
  content: attr(data-url);
}

@media all and (min-width: 480px) {
  .css-device--browser {
    border-top: solid 48px #dfdfdf;
  }

  .css-device--browser::before {
    top: -30px;
    box-shadow: 0 0 0 0 #ff3366, 24px 0 0 0 #ffcc99, 48px 0 0 0 #33ff66;
  }

  .css-device--browser::after {
    top: -36px;
    right: 12px;
    padding: 0 8px;
    width: 240px;
    height: 24px;
    line-height: 24px;
  }
}
/* =============================================================================
  TABLET
============================================================================= */
.css-device--tablet {
  position: relative;
  width: 264px;
  border-top: solid 48px #ddd;
  border-left: solid 12px #ddd;
  border-right: solid 12px #ddd;
  border-bottom: solid 48px #ddd;
  border-radius: 12px;
}

.css-device--tablet::before {
  display: block;
  position: absolute;
  top: -26px;
  left: 50%;
  margin-left: -2px;
  width: 4px;
  height: 4px;
  background-color: #bbb;
  border-radius: 4px;
  content: "";
}

.css-device--tablet::after {
  display: block;
  position: absolute;
  bottom: -36px;
  left: 50%;
  margin-left: -12px;
  width: 24px;
  height: 24px;
  background-color: #bbb;
  border-radius: 12px;
  content: "";
}

@media all and (min-width: 720px) {
  .css-device--tablet {
    width: 396px;
    border-top: solid 72px #ddd;
    border-left: solid 18px #ddd;
    border-right: solid 18px #ddd;
    border-bottom: solid 72px #ddd;
    border-radius: 18px;
  }

  .css-device--tablet::before {
    top: -39px;
    margin-left: -3px;
    width: 6px;
    height: 6px;
    border-radius: 6px;
  }

  .css-device--tablet::after {
    bottom: -54px;
    margin-left: -18px;
    width: 36px;
    height: 36px;
    border-radius: 18px;
    content: "";
  }
}
/* =============================================================================
  MOBILE
============================================================================= */
.css-device--mobile {
  width: 184px;
  border-top: solid 24px #ddd;
  border-left: solid 12px #ddd;
  border-right: solid 12px #ddd;
  border-bottom: solid 48px #ddd;
  border-radius: 12px;
}

.css-device--mobile::before {
  display: block;
  position: absolute;
  top: 12px;
  left: -14px;
  width: 2px;
  height: 12px;
  background-color: #bbb;
  box-shadow: 0 0 0 0 #bbb, 0 24px 0 0 #bbb;
  border-radius: 2px 0 0 2px;
  content: "";
}

.css-device--mobile::after {
  display: block;
  position: absolute;
  bottom: -36px;
  left: 50%;
  margin-left: -12px;
  width: 24px;
  height: 24px;
  background-color: #bbb;
  border-radius: 12px;
  content: "";
}

@media all and (min-width: 720px) {
  .css-device--mobile {
    width: 276px;
    border-top: solid 36px #ddd;
    border-left: solid 18px #ddd;
    border-right: solid 18px #ddd;
    border-bottom: solid 72px #ddd;
    border-radius: 18px;
  }

  .css-device--mobile::before {
    top: 18px;
    left: -21px;
    width: 3px;
    height: 18px;
    background-color: #bbb;
    box-shadow: 0 0 0 0 #bbb, 0 36px 0 0 #bbb;
    border-radius: 3px 0 0 3px;
    content: "";
  }

  .css-device--mobile::after {
    bottom: -54px;
    margin-left: -18px;
    width: 36px;
    height: 36px;
    border-radius: 18px;
    content: "";
  }
}

</style>Modules/Client/Views/questionnaire/template/includes/browser.blade.php000066400000000461152434100730022242 0ustar00<div class="component">
  <div class="css-device css-device--browser" data-url="http://">
        <div class="row" style="margin-top:60px;">
            <div class="col-md-8 col-md-offset-2">
                <div id="css-device--browser-container" ></div>
            </div>
        </div>
  </div>
</div>Modules/Client/Views/questionnaire/template/includes/mobile.blade.php000066400000000370152434100730022025 0ustar00<div class="component">
  <div class="css-device css-device--mobile">
    <div class="row" style="margin-top:60px;">
        <div class="col-md-12">
            <div id="css-device--mobile-container"></div>
        </div>
    </div>
  </div>
</div>Modules/Client/Views/questionnaire/template/create-modal.blade.php000066400000002074152434100730021310 0ustar00{!! Form::open(['route' => config('modules.client').'.questionnaire.store', 'method' => 'POST', 'class' => 'form-horizontal', 'id' => 'add-questionnaire-template-modal-form']) !!}
<div class="modal fade" id="add-questionnaire-template-modal" tabindex="-1" role="dialog" aria-labelledby="myAddQuestionnaireTemplateModal">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myAddQuestionnaireTemplateModal"><i class="fa fa-plus"></i> Add Questionnaire Template</h4>
            </div>
            <div class="modal-body">
                @include('Client::questionnaire.template.form')
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-flat btn-primary"><i class="fa fa-save"></i> Save </button>
            </div>
        </div>
    </div>
</div>
{!! Form::close() !!}Modules/Client/Views/questionnaire/template/index.blade.php000066400000012674152434100730020071 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}" aria-hidden="true"></i> {{$pageTitle}}
            <br>
            <small>{{$pageDescription}}</small>
        </h1>
        <ol class="breadcrumb">
            <li class="active"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</li>           
        </ol>
    </section>
    <!-- Main content -->
    <section class="content"> 
        @include('Client::message')
        <div class="box box-default">
            <div class="box-header with-border">
                <h3 class="box-title">List of Questionnaire Template</h3>
                @can('create', $permissions)
                    <span class="pull-right">
                        <a href="#add-questionnaire-template-modal" data-toggle="modal" title="Add Questionnaire Template"><button class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add {{$pageModuleName}}</button></a>
                    </span>
                @endcan
            </div>
            <div class="box-body">
                <table class="table table-bordered table-striped table-hover" id="questionnaire-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Title</th>
                            <th>Created At</th>
                            <th>Action</th>
                        </tr>
                    </thead>
               </table>
            </div>                
        </div>
        @include('Client::logs')
    </section>
    @include('Client::questionnaire.template.create-modal')
@stop
@section('page-js')
@include('Client::questionnaire.template.js')
<script type="text/javascript">
$(function() {
    var questionnaireTable = $('#questionnaire-table').DataTable({
        processing: true,
        serverSide: true,
        "pagingType": "input",
        rowReorder: true,
        ajax: {
            url:'{!! url(config('modules.client').'/questionnaire/get-template-data') !!}',            
        },
        columns: [
            {
                width:'10px', searchable: false, orderable: false,
                render: function (data, type, row, meta) {
                    return meta.row + meta.settings._iDisplayStart + 1;
                }
            },
            { data: 'description', name: 'description', orderable: false, searchable: false},
            { data: 'created_at', name: 'created_at', width:'100px', className:'text-center'},
            { data: 'action', name: 'action', orderable: false, searchable: false, width:'100px', className:'text-center'},
        ],
        fnDrawCallback: function ( oSettings ) {
            $('[data-toggle="tooltip"]').tooltip();
            questionnaireTable.$("td").on("click", 'a#btn-delete', function() {
                var action = $(this).data('action');
                swal({
                    title: 'Are you sure you want to delete?',
                    text: "This will be permanently deleted.",
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: 'Yes'
                    }).then(function () {                    
                    $.ajax({
                        type: "DELETE",
                        url: action,
                        dataType: 'json',
                        success: function(data) {
                            if(data.type == "success") {
                                questionnaireTable.draw();
                                swal(data.message, '', 'success')
                           }else{
                                swal(data.message, '', 'error')
                           }
                        },
                        error :function( jqXhr ) {
                            swal('Unable to delete.', 'Please try again.', 'error')
                        }
                    });
                })
            });

            questionnaireTable.$("td").on("click", 'a#copy-template', function() {
                    var action = $(this).attr('href');
                    swal({
                        title: '',
                        text: "Are you sure you want to make a copy of this template?",
                        type: 'warning',
                        showCancelButton: true,
                        confirmButtonColor: '#3085d6',
                        cancelButtonColor: '#d33',
                        confirmButtonText: 'Yes'
                        }).then(function () {             
                            $.ajax({
                                type: "POST",
                                url: action,
                                dataType: 'json',
                                success: function(data) {
                                    questionnaireTable.draw();
                                },
                                error :function( jqXhr ) {
                                    swal('Unable to copy.', 'Please try again.', 'error')
                                }
                            });
                        });
                    return false;
                });
        },
        "order": [[2, "desc"]],
    });
});
</script>
@include('Client::notify')
@stopModules/Client/Views/questionnaire/template/edit.blade.php000066400000004764152434100730017710 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-pencil"></i> Edit Questionnaire
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.questionnaire.index') }}"><i class="fa fa-question-circle-o"></i> Questionnaire</a></li>            
            <li class="active">Edit</li>            
        </ol>
    </section>
    <!-- Main content -->
    <section class="content"> 
        @include('Client::message')
       
        {!! Form::model($template, array('route' => [config('modules.client').'.questionnaire.update', $template->hashid], 'class' => 'form-horizontal', 'method' => 'PUT', 'id' => 'questionnaire-template-form')) !!}
        <div class="row">
            <div class="col-sm-3">
                 @include('Client::questionnaire.nav', array('nav' => 'options'))
            </div>
            <div class="col-sm-9">
                <div class="box box-default">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                        @include('Client::questionnaire.template.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-offset-9 col-md-3">
                <button class="btn btn-flat btn-warning btn-lg btn-block" data-loading-text="<i class='fa fa-spin fa-circle-o-notch'></i> Saving.." id="template-save-btn"><i class="fa fa-save"></i> Save Changes</button>
            </div>
        </div>
        {!! Form::close() !!}
        <br>
        @include('Client::logs')
    </section>
    @include('Client::questionnaire.template.create-modal')
@stop
@section('page-js')
@include('Client::questionnaire.template.js')
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Questionnaire\TemplateRequest', 'form#questionnaire-template-form'); !!}
<script type="text/javascript">
    $(function(){
        $('#template-save-btn').on('click', function(){
            var btn = $(this);
            btn.button('loading');
            if(!$('#questionnaire-template-form').valid()){
                setTimeout(function(){
                    btn.button('reset');
                }, 500);
                return false;
            }
        });
    });
</script>
@include('Client::notify')
@stopModules/Client/Views/questionnaire/question/create.blade.php000066400000007652152434100730020261 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-plus"></i> Add Question
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.questionnaire.index') }}"><i class="fa fa-question-circle-o"></i> Questionnaire</a></li> 
            <li><a href="{{ route(config('modules.client').'.questionnaire.question.index', $template->hashid) }}">Question</a></li>              
            <li class="active">Add</li>            
        </ol>
    </section>

    <section class="content"> 
        @include('Client::message')
        {!! Form::open(array('route' => [config('modules.client').'.questionnaire.question.store', $template->hashid],'class' => 'form-horizontal', 'method' => 'POST', 'id' => 'question-form')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-default">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::questionnaire.question.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-2">
                <button class="btn btn-flat btn-lg btn-block btn-primary" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." name="_save" value="add" id="add-question-btn"><i class="fa fa-save"></i> Save New Question</button>
            </div>
            <div class="col-md-4">
                <button class="btn btn-flat btn-lg btn-block btn-default" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." name="_save" value="add_another" id="add-another-question-btn"><i class="fa fa-save"></i> Save & Add New Question</button>
            </div>
        </div>
        {!! Form::close() !!}
    </section>
    @include('Client::questionnaire.template.create-modal')
@stop
@section('page-css')
<style type="text/css">
    .checkbox label, .radio label {
        min-height: 20px;
         padding-left: 0px !important; 
        margin-bottom: 0;
        font-weight: bold !important;
        cursor: pointer;
    }
</style>
@stop
@section('page-js')
@include('Client::questionnaire.template.js')
@include('Client::questionnaire.question.js')
<script type="text/javascript">
    $(function(){
        $('#add-another-question-btn').on('click', function(){
            var btn_another = $(this);
            var btn = $('#add-question-btn');

            btn_another.parent().addClass('col-md-offset-4');

            btn.parent().removeClass('col-md-4').hide();
            btn_another.button("loading");

            if(!$('#question-form').valid()) {
                setTimeout(function(){
                    btn_another.parent().removeClass('col-md-offset-4');
                    
                    btn.parent().addClass('col-md-4').show();
                    btn_another.button("reset");
                }, '300');
                return false;
            }
        });

         $('#add-question-btn').on('click', function(){
            var btn_another = $(this);
            var btn = $('#add-another-question-btn');

            btn_another.parent().removeClass('col-md-offset-2').addClass('col-md-offset-4');
            
            btn.parent().removeClass('col-md-4').hide();
            btn_another.button("loading");

            if(!$('#question-form').valid()) {
                setTimeout(function(){
                    btn_another.parent().removeClass('col-md-offset-4').addClass('col-md-offset-2');
                    btn.parent().addClass('col-md-4').show();
                    btn_another.button("reset");
                }, '300');
                return false;
            }
        });
    });
</script>
@include('Client::notify')
@stopModules/Client/Views/questionnaire/question/form.blade.php000066400000006540152434100730017754 0ustar00<div class="form-group">
    <label class="control-label col-sm-2">Title <i class="required">*</i></label>
    <div class="col-sm-10">
        {!! Form::text('title', null, ['class' => 'form-control ', 'placeholder' => 'Enter question title here.', 'data-focus' => 'true']) !!}
        {!! $errors->first('title', '<span class="text-red">:message</span>') !!}
    </div>
</div>

<div class="form-group">
    <div class="col-sm-offset-2 col-sm-9">
        <div class="checkbox">
            <label>
                {!! Form::checkbox('required', 1, null) !!} Required
            </label>

        </div>
    </div>
</div>

<div class="form-group">
    <label class="control-label col-sm-2">Question Type</label>
    <div class="col-sm-4">
        <div class="input-group" style="{{ (isset($question->question_type) && $question->question_type == '2') ? 'display: table;':'display:block;'  }}">
            {!! Form::select('question_type', $question_types, null , array('class' => 'form-control')) !!}
            <div class="input-group-btn multiple-choice-add-btn" style="{{ (isset($question->question_type) && $question->question_type == '2') ? 'display: table-cell;':'display:none;'  }}">
                <button class="btn btn-primary btn-flat" type="button" id="add-answer-btn"><i class="fa fa-plus"></i></button>
            </div>

        </div>
    </div>
</div>
<div class="multiple-choice" style="{{ (isset($question->question_type) && $question->question_type == '2') ? 'display: block;':'display:none;'  }}">
 
    <div class="choices">
        <div class="form-group">
            <label class="control-label col-sm-2">Choice 1. <i class="required">*</i></label>
            <div class="col-sm-10">
                <!-- <div class="input-group"> -->
                    <input type="text" name="name[{{ ((isset($question->answers[0])) ? $question->answers[0]->id:'new_1') }}]" value="{{ ((isset($question->answers[0])) ? $question->answers[0]->name:null) }}" class="form-control" placeholder="New Choice"/>
                <!-- </div> -->
            </div>
        </div>
        @if(isset($question->answers))
            @if(!empty($question->answers))

                @foreach($question->answers as $ans_key => $answer)
                    @if($ans_key <> 0)
                    <div class="form-group">
                        <label class="control-label col-sm-2">Choice {{ $ans_key + 1 }}. <i class="required">*</i></label>
                        <div class="col-sm-10">
                            <div class="input-group">
                                <input type="text" name="name[{{ $answer->id }}]" value="{{ $answer->name }}" class="form-control"/>
                                <div class="input-group-btn">
                                    <button class="btn btn-danger btn-flat" type="button" id="remove-answer-btn"><i class="fa fa-times"></i></button>
                                </div>
                            </div>
                        </div>
                    </div>
                    @endif
                @endforeach
            @endif
        @endif
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-9">
            <div class="checkbox">
                <label>
                    {!! Form::checkbox('multiple_select', 1, null) !!} Select multiple
                </label>
            </div>
        </div>
    </div>
</div>Modules/Client/Views/questionnaire/question/js.blade.php000066400000005550152434100730017425 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Questionnaire\QuestionRequest', 'form#question-form'); !!}
<script type="text/javascript">
    $(function(){
        $('input').iCheck({
          checkboxClass: 'icheckbox_square-blue',
          radioClass: 'iradio_square-blue',
          increaseArea: '20%' // optional
        });

        $('body').on('click', 'button#add-answer-btn', function(e){
            var counter = $('form#question-form input[name^="name"]').length + 1;

            var limit = 10;
            if (counter > limit)  {
                  alert("You have reached the maximum limit of choices.");
                  return false
            }
            var new_input = "<div class=\"form-group\">";
                    new_input += "<label class=\"control-label col-sm-2\">Choice "+ counter +". <i class=\"required\">*</i></label>";
                    new_input += "<div class=\"col-sm-10\">";
                        new_input += "<div class=\"input-group\">"
                            new_input += "<input type=\"text\" name=\"name[new_"+counter+"]\" class=\"form-control\" placeholder=\"New Choice\">";
                            new_input += "<div class=\"input-group-btn\">";
                                new_input += "<button class=\"btn btn-flat btn-danger\" type=\"button\" id=\"remove-answer-btn\"><i class=\"fa fa-times\"></i></button>";           
                            new_input += "</div>";
                        new_input += "</div>";
                       /* new_input += "<div class=\"input-controls\">";
                            new_input += "<i class=\"remove-submit fa fa-times\"></i>";
                            new_input += "<i class=\"sort-submit fa fa-arrows-v\"></i>";
                        new_input += "</div>";*/
                    new_input += "</div>";
                new_input += "</div>";

            $('.choices').append(new_input);
      
            return false;  
            
        });

        $('body').on('click', 'button#remove-answer-btn', function(e){
            $(this).closest('.form-group').remove();
        });

        $('select[name="question_type"]').on('change', function(){
            var selected = $(this).val();
      
            if(selected=='2')
            {
                $('.multiple-choice').css({'display':'block'});
                $('.multiple-choice-add-btn').css({'display':'table-cell'});
                $('.multiple-choice-add-btn').closest('.input-group').css({'display':'table'});
            } else {
                $('.multiple-choice').css({'display':'none'});
                $('.multiple-choice-add-btn').closest('.input-group').css({'display':'block'});
                $('.multiple-choice-add-btn').css({'display':'none'});
            }
        });
    });
</script>Modules/Client/Views/questionnaire/question/index.blade.php000066400000015737152434100730020130 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-question-circle-o"></i> Manage Questions
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.questionnaire.index') }}"><i class="fa fa-question-circle-o"></i> Questionnaire</a></li>            
            <li class="active">Question</li>            
        </ol>
    </section>
    <!-- Main content -->
    <section class="content"> 

        @include('Client::message')
        
        <div class="row">
            <div class="col-sm-3">
                 @include('Client::questionnaire.nav', array('nav' => 'questions'))
            </div>
            <div class="col-sm-9">
                <div class="box box-default">
                    <div class="box-header">
                        <div class="page-header">
                            <h2>{{ $template->title }}</h2>
                        </div>
                        <h3 class="box-title">List of Questions</h3>
                        @can('create', $permissions)
                            <span class="pull-right">
                                <a href="{{ route(config('modules.client').'.questionnaire.question.create', $template->hashid) }}" data-toggle="modal" title="Add Question"><button class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add Question</button></a>
                            </span>
                        @endcan
                    </div>
                    <div class="box-body">
                       <table class="table table-bordered table-striped table-hover" id="question-table" width="100%">
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th>Title</th>
                                    <th>Question Type</th>
                                    <th>Action</th>
                                </tr>
                            </thead>
                       </table>
                    </div>
                </div>
                @include('Client::questionnaire.question.logs')
            </div>
        </div>
    </section>
    @include('Client::questionnaire.template.create-modal')
@stop
@section('page-js')
@include('Client::questionnaire.template.js')
<script type="text/javascript">
    $(function() {
        var questionTable = $('#question-table').DataTable({
            dom:"<'row'<'col-sm-6'l><'col-sm-6'f>>" +
            "<'row'<'col-sm-12'tr>>" +
            "<'row'<'col-sm-5'i><'col-sm-7'p>>",
            processing: true,
            serverSide: true,
            "pagingType": "input",
            rowReorder: true,
            filter:false,
            paging:false,
            scrollY: 200,
            scrollCollapse: true,
            ajax: {
                url:"{!! url(config('modules.client').'/questionnaire/'.$template->hashid.'/get-question-data') !!}",            
            },
            columns: [
                {
                    width:'10px', searchable: false, orderable: false,
                    render: function (data, type, row, meta) {
                        var no = meta.row + meta.settings._iDisplayStart + 1;
                        return 'Q.' + no.toString();
                    }
                },
                { data: 'title', name: 'title', orderable:false, searchable:false},
                { data: 'question_type_name', name: 'question_type', orderable:false,width:'100px',  searchable:false},
                { data: 'action', name: 'action', orderable: false, searchable: false, width:'100px', className:'text-center'},
            ],
            fnDrawCallback: function ( oSettings ) {
                $('[data-toggle="tooltip"]').tooltip();
                @can('update', $permissions)
                $('#question-table').tableDnD({
                    onDrop: function(table, row) {
                        $.post("{!! route(config('modules.client').'.questionnaire.question.sort', $template->hashid) !!}?", $.tableDnD.serialize(),function(data, status){
                            questionTable.draw(false);
                        });
                    }
                });
                @endcan
                questionTable.$("td").on("click", 'a#copy-question', function() {
                    var action = $(this).attr('href');
                    swal({
                        title: '',
                        text: "Are you sure you want to make a copy of this question?",
                        type: 'warning',
                        showCancelButton: true,
                        confirmButtonColor: '#3085d6',
                        cancelButtonColor: '#d33',
                        confirmButtonText: 'Yes'
                        }).then(function () {             
                            $.ajax({
                                type: "POST",
                                url: action,
                                dataType: 'json',
                                success: function(data) {
                                    questionTable.draw();
                                },
                                error :function( jqXhr ) {
                                    swal('Unable to copy.', 'Please try again.', 'error')
                                }
                            });
                        });
                    return false;
                });
                questionTable.$("td").on("click", 'a#btn-delete', function() {
                    var action = $(this).data('action');
                    swal({
                        title: 'Are you sure you want to delete?',
                        text: "This question and its answers will be permanently deleted.",
                        type: 'warning',
                        showCancelButton: true,
                        confirmButtonColor: '#3085d6',
                        cancelButtonColor: '#d33',
                        confirmButtonText: 'Yes'
                        }).then(function () {                    
                        $.ajax({
                            type: "DELETE",
                            url: action,
                            dataType: 'json',
                            success: function(data) {
                                if(data.type == "success") {
                                    questionTable.draw();
                                    swal(data.message, '', 'success')
                               }else{
                                    swal(data.message, '', 'error')
                               }
                            },
                            error :function( jqXhr ) {
                                swal('Unable to delete.', 'Please try again.', 'error')
                            }
                        });
                    })
                });
            },
            "order": [],
        });
    });
</script>
</script>
@include('Client::notify')
@stopModules/Client/Views/questionnaire/question/edit.blade.php000066400000006201152434100730017730 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-pencil"></i> Edit Question
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.questionnaire.index') }}"><i class="fa fa-question-circle-o"></i> Questionnaire</a></li> 
            <li><a href="{{ route(config('modules.client').'.questionnaire.question.index', $template->hashid) }}">Question</a></li>              
            <li class="active">Edit</li>            
        </ol>
    </section>

    <section class="content">
        @include('Client::message')
        {!! Form::model($question,array('route' => [config('modules.client').'.questionnaire.question.update', $template->hashid, $question->hashid],'class' => 'form-horizontal', 'method' => 'PUT', 'id' => 'question-form')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-default">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                        @include('Client::questionnaire.question.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-2">
                <a href="{{ route(config('modules.client').'.questionnaire.question.index', $template->hashid) }}" class="btn btn-flat btn-default btn-block btn-lg" id="cancel-question-btn"><i class="fa fa-chevron-left"></i> Cancel</a>
            </div>
            <div class="col-md-4">
                <button class="btn btn-flat btn-warning btn-block btn-lg" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." id="add-question-btn"><i class="fa fa-save"></i> Save Changes</button>
            </div>
        </div>
        {!! Form::close() !!}
        <br>
        @include('Client::logs')
    </section>
    @include('Client::questionnaire.template.create-modal')
@stop
@section('page-css')
<style type="text/css">
    .checkbox label, .radio label {
        min-height: 20px;
         padding-left: 0px !important; 
        margin-bottom: 0;
        font-weight: bold !important;
        cursor: pointer;
    }
</style>
@stop
@section('page-js')
@include('Client::questionnaire.template.js')
@include('Client::questionnaire.question.js')
<script type="text/javascript">
    $(function(){

         $('#add-question-btn').on('click', function(){
            var btn = $(this);
            var btn_cancel = $('#cancel-question-btn');

        
            btn_cancel.parent().removeClass('col-md-offset-2');
            btn_cancel.hide();
            btn.button("loading");

            if(!$('#question-form').valid()) {
                setTimeout(function(){
                    btn_cancel.parent().addClass('col-md-offset-2');
                    btn_cancel.show();
                    btn.button("reset");
                }, '300');
                return false;
            }
        });
    });
</script>
@include('Client::notify')
@stopModules/Client/Views/questionnaire/results/index.blade.php000066400000003417152434100730017752 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-pencil"></i> Preview Questionnaire
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.questionnaire.index') }}"><i class="fa fa-question-circle-o"></i> Questionnaire</a></li>            
            <li class="active">Edit</li>            
        </ol>
    </section>
    <!-- Main content -->
    <section class="content"> 
        @include('Client::message')
       
       
        <div class="row">
            <div class="col-sm-3">
                 @include('Client::questionnaire.nav', array('nav' => 'result'))
            </div>
            <div class="col-sm-9">
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                      <li class="active"><a href="#web_view" data-toggle="tab"><i class="fa fa-question-circle"></i> Questions</a></li>
                      <li><a href="#mobile_view" data-toggle="tab"><i class="fa fa-users"></i> Participants</a></li>
                    </ul>
                    <div class="tab-content">
                        <div class="tab-pane active fade in" id="web_view">
                            @include('Client::questionnaire.template.includes.browser')
                        </div>
                        <div class="tab-pane" id="mobile_view">
                            @include('Client::questionnaire.template.includes.mobile')
                        </div>
                    </div>
                </div>

            </div>
        </div>
       
        
    </section>
@stop
@section('page-css')
@stop
@section('page-js')
</script>

@include('Client::notify')
@stopModules/Client/Views/questionnaire/nav.blade.php000066400000002056152434100730015724 0ustar00
<div class="nav-holder">
    <ul class="nav nav-pills nav-stacked " style="background-color:#fff;">
        <li role="presentation" class="{{ ((isset($nav) && $nav == 'options') ? 'active':'') }}"><a href="{{ route(config('modules.client').'.questionnaire.edit', $template->hashid) }}"><i class="fa fa-cogs"></i> Update</a></li>
        <li role="presentation" class="{{ ((isset($nav) && $nav == 'questions') ? 'active':'') }}"><a href="{{ route(config('modules.client').'.questionnaire.question.index', $template->hashid) }}"><i class="fa fa-question-circle"></i> Questions</a></li>
        <li role="presentation" class="{{ ((isset($nav) && $nav == 'preview') ? 'active':'') }}"><a href="{{ route(config('modules.client').'.questionnaire.preview', $template->hashid) }}"><i class="fa fa-eye"></i> Preview</a></li>
        <li role="presentation" class="{{ ((isset($nav) && $nav == 'results') ? 'active':'') }}"><a href="{{ route(config('modules.client').'.questionnaire.result', $template->hashid) }}"><i class="fa fa-bar-chart"></i> Results</a></li>
    </ul>
</div>Modules/Client/Views/directory-store/create.blade.php000066400000003674152434100730016662 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-plus"></i> Add {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.directory.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>             
            <li class="active">Add</li>           
        </ol>
    </section>

    <section class="content"> 
        @include('Client::message')
        {!! Form::open(array('url'=>url(config('modules.client').'/directory-store/store'), 'class' => 'form-horizontal', 'method' => 'POST', 'id' => 'directory-form')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::directory-store.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-primary save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save</button>
            </div>
        </div>
        {!! Form::close() !!}
    </section>
    @include('Client::directory-store.includes.modal-affiliate')
    @include('Client::directory-store.includes.modal-specialization')
@stop
@section('page-js')
@include('Client::directory-store.includes.js')
@include('Client::directory-store.includes.gmaps')
@include('Client::directory-store.includes.js-modal-affiliates')
@include('Client::directory-store.includes.js-modal-specializations')
@include('Client::notify')
@stopModules/Client/Views/directory-store/includes/form.blade.php000066400000023106152434100730020160 0ustar00<input type="hidden" name="_token" value="{{ csrf_token() }}">
    <div class="row">
        <div class="col-md-7">
            <div class="col-md-12">
                <div class="form-group {{ ($errors->has('category') ? 'has-error':'') }}">
                    <label class="control-label col-md-3">Category: <i class="required">*</i></label>
                    <div class="col-md-9">
                        {!! Form::select('category', ['Directory' => 'Directory', 'Store' => 'Store'], null ,['class'=>'input-md form-control', 'id'=>'category']) !!}
                        {!! $errors->first('category', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
                <div class="form-group {{ ($errors->has('affiliate_id') ? 'has-error':'') }}" id="affiliate">
                    <label class="control-label col-md-3">Affiliate: <i class="required">*</i></label>
                    <div class="col-md-9">
                        <div class="input-group">
                           {!! Form::select('affiliate_id', ['' => '-- Select Affiliate'] + $affiliates , null ,  ['id'=>'selectAffiliate', 'class'=>'form-control']) !!}
                           <span class="input-group-btn">
                                <button class="btn btn-primary btn-flat" type="button" data-toggle="tooltip" title="Add Affiliate" style="cursor:pointer" onclick="doModalAddAffiliate();"><i class="fa fa-plus-circle"></i></button>
                                {!! $errors->first('affiliate_id', '<span class="text-red">:message</span>') !!}
                           </span>
                        </div>
                    </div>
                </div>
                <div class="form-group {{ ($errors->has('specialization_id') ? 'has-error':'') }}" id="specialization">
                    <label class="control-label col-md-3">Specialization:</label>
                    <div class="col-md-9">
                        <div class="input-group">
                           {!! Form::select('specialization_id', ['0' => '-- Select Specialization'] + $specializations , null ,  ['id'=>'selectSpecialization', 'class'=>'form-control']) !!}
                           <span class="input-group-btn">
                                <button class="btn btn-primary btn-flat" type="button" data-toggle="tooltip" title="Add Specialization" style="cursor:pointer" onclick="doModalAddSpecialization();"><i class="fa fa-plus-circle"></i></button>
                                {!! $errors->first('specialization_id', '<span class="text-red">:message</span>') !!}
                           </span>
                        </div>
                    </div>
                </div>
                <div class="form-group {{ ($errors->has('name') ? 'has-error':'') }}">
                    <label class="control-label col-md-3" id="nameLabel">Directory Name: <i class="required">*</i></label>
                    <div class="col-md-9">
                        {!! Form::text('name', null , ['class'=>'form-control', 'placeholder'=>'Enter Directory Name', 'autocomplete'=>'off', 'id'=>'name']) !!}
                        {!! $errors->first('name', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
                <div class="form-group {{ ($errors->has('tel_no') ? 'has-error':'') }}">
                    <label class="control-label col-md-3">Telephone no.: <i class="required">*</i></label>
                    <div class="col-md-9">
                        {!! Form::text('tel_no', null , ['class'=>'form-control', 'placeholder'=>'Enter telephone number', 'autocomplete'=>'off']) !!}
                        {!! $errors->first('tel_no', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
                <div class="form-group {{ ($errors->has('email') ? 'has-error':'') }}" id="email">
                    <label class="control-label col-md-3">Email:</label>
                    <div class="col-md-9">
                        {!! Form::email('email', null , ['class'=>'form-control', 'placeholder'=>'Enter Email Address', 'autocomplete'=>'off']) !!}
                        {!! $errors->first('email', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-md-3" id="address">Address: <i class="required">*</i></label>
                    <div class="col-md-9">
                        {!! Form::text('address_number', null , ['class'=>'form-control', 'placeholder'=>'Address #', 'autocomplete'=>'off']) !!}
                    </div>
                </div>
                <div class="form-group">
                <div class="col-md-3"></div>
                    <div class="col-md-4">
                        {!! Form::text('street', null , ['class'=>'form-control', 'placeholder'=>'Street', 'autocomplete'=>'off']) !!}
                        {!! $errors->first('street', '<span class="text-red">:message</span>') !!}
                    </div>
                    <div class="col-md-4">
                        {!! Form::text('barangay', null , ['class'=>'form-control', 'placeholder'=>'Barangay', 'autocomplete'=>'off']) !!}
                        {!! $errors->first('barangay', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
                <div class="form-group {{ ($errors->has('city_id') ? 'has-error':'') }}">
                    <label class="control-label col-md-3">City:</label>
                    <div class="col-md-9">
                        {!! Form::select('city_id', ['0' => '-- Select City'] + $cities , null ,  ['class'=>'form-control']) !!}
                        {!! $errors->first('city_id', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
                <div class="form-group {{ ($errors->has('municipality_id') ? 'has-error':'') }}">
                    <label class="control-label col-md-3">Municipality:</label>
                    <div class="col-md-9">
                        {!! Form::select('municipality_id', ['0' => '-- Select Municipality'] + $municipalities , null ,  ['class'=>'form-control']) !!}
                        {!! $errors->first('municipality_id', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
                <div class="form-group {{ ($errors->has('province_id') ? 'has-error':'') }}">
                    <label class="control-label col-md-3" id="province">Province: <i class="required">*</i></label>
                    <div class="col-md-9">
                        {!! Form::select('province_id', ['' => '-- Select Province'] + $provinces , null ,  ['class'=>'form-control']) !!}
                        {!! $errors->first('province_id', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
                <div class="form-group {{ ($errors->has('zip_code') ? 'has-error':'') }}">
                    <label class="control-label col-md-3">Zip Code:</label>
                    <div class="col-md-9">
                        {!! Form::text('zip_code', null , ['class'=>'form-control', 'autocomplete'=>'off']) !!}
                        {!! $errors->first('zip_code', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
                <div class="form-group {{ $errors->has('details') ? ' has-error' : '' }}">
                    <label class="control-label col-md-3" id="details">Details: <i class="required">*</i></label>
                    <div class="col-md-9">
                        {!! Form::textarea('details', null , ['class'=>'form-control wysihtml5', 'placeholder'=>'Details here...', 'autocomplete'=>'off']) !!}
                        {!! $errors->first('details', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-5">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading">Location</div>
                    <div class="panel-body">
                        <div class="form-group">
                            <input id="search" type="text" placeholder="Search.." style="width: 150px; height: 30px; margin-top: 10px;">
                            <div id="map" style="width: 100%; height: 250px;"></div>
                        </div>
                        <div class="form-group {{ ($errors->has('lat') ? 'has-error':'') }}">
                            <label class="control-label col-md-4">Latitude: <i class="required">*</i></label>
                            <div class="col-md-8">
                                {!! Form::text('lat', null , ['class'=>'form-control', 'id'=>'lat', 'autocomplete'=>'off']) !!}
                                {!! $errors->first('lat', '<span class="text-red">:message</span>') !!}
                            </div>
                        </div>
                        <div class="form-group {{ ($errors->has('lng') ? 'has-error':'') }}">
                            <label class="control-label col-md-4">Longitude: <i class="required">*</i></label>
                            <div class="col-md-8">
                                {!! Form::text('lng', null , ['class'=>'form-control', 'id'=>'lng', 'autocomplete'=>'off']) !!}
                                {!! $errors->first('lng', '<span class="text-red">:message</span>') !!}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>Modules/Client/Views/directory-store/includes/js-modal-affiliates.blade.php000066400000012250152434100730023026 0ustar00<!-- Affiliate js -->
<script type="text/javascript">
var affiliate_datatable;
$( document ).ready( function() {

	$('#addbutton_affiliate').click( function() {
        var name = $('#affiliate_name').val();
		if(name=='') {
			swal("Error!", "Name is required!", "error");
			$('#affiliate_name').focus();
			return false;
		} else {
			$("#hide_onclick_modal").hide();
			$("#show_onclick_modal").show();
			$.ajax({
	        	type: "post",
	          	url: "{{URL::Route('storeAffiliates')}}",
	          	data: {
	            	name: $("#affiliate_name").val()
	          	},
	          	success: function(result) {	    
	          		var table = $('#affiliateTable').DataTable();   
	          		table.ajax.reload(); 	          		   
	          		$("#hide_onclick_modal").show();
					$("#show_onclick_modal").hide();
	            	$('#selectAffiliate').append($('<option>', {
		                value: result.id,
		                text: result.name,
		                selected: true
		            }));
	            	$('#affiliateModal').modal('hide');	            
	          	},
	          	error :function( xhr ) {
	                if( xhr.status === 422 ) {
	                    var errors = JSON.parse(xhr.responseText);
	                    alert(errors['name'][0]);	                    
	                } else {
	                	swal("Error!", "Error occured please try again.", "error");
	                }
	                $("#hide_onclick_modal").show();
					$("#show_onclick_modal").hide();
	            }
	        });
		}
    }); 

});
function initializeAffiliate()
{
		affiliate_datatable = 1;
		table = $('#affiliateTable').DataTable({
        "processing": true,
        "serverSide": true,
        ajax: {
            url:'{{URL::Route("getAffiliatesData")}}', 
            type: 'POST',
        },
		"bAutoWidth": false,
		"iDisplayLength": 10,
		columns: [
			{data: 'name', name: 'name', className:'editable'},
			{data: 'action', name: 'action', orderable:false, searchable:false, width:'60px', className:'text-center'},
		],
		fnDrawCallback: function ( oSettings ) {
			$('#affiliateTable tbody td.editable').editable('/client/modals/affiliates/update', {
                callback: function( sValue, y ) {
		           table.draw();
				},
				onsubmit: function(settings, original) {
		            if ((original.revert == $('input',this).val()) || $('input',this).val() == "") {
		            	original.reset();
		            	$(original).parents('tr').find('td.hide_me').show();
		            	return false;
		        	}
				},
				submitdata: function (value, settings) {
	            	var id = $(this).parents('tr').find('a.btn-edit').data('id');
			        return {
			              'id':id
			        };
				},
				onerror:  function(settings, original, xhr) {
	                if( xhr.status === 422 ) {
	                      var errors = JSON.parse(xhr.responseText);
	                      alert(errors['name'][0]);
	                      original.reset(); 
	                      $(original).parents('tr').find('td.hide_me').show();
	                } else {
	                    swal("Error!", "Error occured please try again.", "error");
	                }
		        },
				onblur:'submit',
				event:'custom_event',
				height:"30px",
				width:'100%',
				name : 'name'
			});

			$("#affiliateTable tbody td").on("click", 'a.btn-edit', function() {
  				$(this).parents('tr').find('td.editable').trigger("custom_event");
  				$(this).parent('td').addClass('hide_me').hide();
			});

			$("#affiliateTable tbody td").on("click", 'a.btn-delete', function() {
				var action = $(this).data('action');
				swal({
                    title: 'Are you sure you want to delete?',
                    text: "This will be permanently deleted",
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: 'Yes'
                    }).then(function () {                    
                    $.ajax({
                        type: "GET",
                        url: action,
                        dataType: 'json',
                        success: function(data) {
                           if(data.success == "yes") {
                                table.draw();
                                swal("Deleted!", "Affiliate successfuly deleted!", "success");
                                $("#selectAffiliate option[value='"+data.id+"']").remove();
                           }else{
                                swal("Error!", "Cannot delete it is being used in database.", "error");
                           }
                        },
                        error :function( jqXhr ) {
                            swal('Unable to delete.', 'Please try again.', 'error')
                        }
                    });
                })  
			});
		}
	});

	$('#affiliate_name').val('');
    $('#affiliateModal').modal({'backdrop':'static'});
}

function doModalAddAffiliate()
{	
	if(affiliate_datatable != 1) {
		initializeAffiliate();
	}
	else {
		$('#affiliate_name').val('');
    	$('#affiliateModal').modal({'backdrop':'static'});
	}
}
</script>
<!-- End of Affiliate js -->Modules/Client/Views/directory-store/includes/gmaps.blade.php000066400000004020152434100730020316 0ustar00<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyB4CBr0reSrrQ9EuBFxPVM_TzbuV3uBow4&libraries=places"></script>
<script>
function initMap(pos) {
	var LatLng = new google.maps.LatLng(pos.lat, pos.lng);
  	map = new google.maps.Map(document.getElementById('map'), {
	    center: LatLng,
	    zoom: 14,
	    mapTypeId: google.maps.MapTypeId.ROADMAP
  	});

  	marker = new google.maps.Marker({
	    position: LatLng,
	    map: map,
	    title: 'Your Location!',
	    draggable:true
  	});

	var input = document.getElementById('search');
  	var searchBox = new google.maps.places.SearchBox(input);
  	map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);

  	// Bias the SearchBox results towards current map's viewport.
  	map.addListener('bounds_changed', function() {
    	searchBox.setBounds(map.getBounds());
  	});

	searchBox.addListener('places_changed', function() {
	    var places = searchBox.getPlaces();

	    if (places.length == 0) {
	      return;
	    }
	    marker.setMap(null);
	  	marker = new google.maps.Marker({
		    position: places[0].geometry.location,
		    map: map,
		    title: 'Store Location!',
		    draggable:true
	  	});
	  	$("#lat").val(marker.getPosition().lat());
        $("#lng").val(marker.getPosition().lng());


	  	map.setCenter(places[0].geometry.location);
  		google.maps.event.addListener(marker, 'dragend', function () {
            $("#lat").val(marker.getPosition().lat());
            $("#lng").val(marker.getPosition().lng());
        });
  	});

  	google.maps.event.addListener(marker, 'dragend', function () {
        $("#lat").val(marker.getPosition().lat());
        $("#lng").val(marker.getPosition().lng());
    });

}

if ($('#map').length)
{
	if ($("input[name=lat").val() && $("input[name=lng").val())
	{
		var lat = $("input[name=lat").val();
		var lng = $("input[name=lng").val();
		var pos = {
	        lat: lat,
	        lng: lng
	    };
      	initMap(pos);
	}
	else {
		var pos = {
        lat: 14.624520,
        lng: 121.055754
      };

      initMap(pos);
	}
}
</script>Modules/Client/Views/directory-store/includes/js.blade.php000066400000006004152434100730017627 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Directory\DirectoryRequest', 'form#directory-form'); !!}
<script type="text/javascript">
    $.validator.setDefaults({ ignore: '' });
    $(function(){
        $('textarea[name="details"]').wysihtml5({
            toolbar: {
                "font-styles": true, // Font styling, e.g. h1, h2, etc.
                "emphasis": false, // Italics, bold, etc.
                "lists": true, // (Un)ordered lists, e.g. Bullets, Numbers.
                "html": false, // Button which allows you to edit the generated HTML.
                "link": false, // Button to insert a link.
                "image": false, // Button to insert an image.
                "color": false, // Button to change color of font
                "blockquote": false, // Blockquote
            }
        });
    });
</script>
<script>
$(document).ready(function() {
    $('#affiliate').show();
    $('#specialization').show();

    var category = $( "#category option:selected" ).val();

    if(category == 'Store'){
            $('#selectAffiliate').val(0);
            $('#affiliate').hide();
            $('#specialization').hide();
            $('#nameLabel').html('Store Name: <i class="required">*</i>');
            $('#details').html('Details:');
            $('#address').html('Address:');
            $('#province').html('Province:');
            $('#title').text(' Edit Store');
            $('#name').attr("placeholder", "Enter Store Name");
        }else{
            $('#affiliate').show();
            $('#specialization').show();
            $('#title').text(' Edit Directory');
            $('#details').html('Details: <i class="required">*</i>');
            $('#address').html('Address: <i class="required">*</i>');
            $('#province').html('Province: <i class="required">*</i>');
            $('#nameLabel').html('Directory Name: <i class="required">*</i>');
            $('#name').attr("placeholder", "Enter Directory Name");
        }

    $('#category').change(function(){
        var value = $(this).val();

        if(value == 'Store'){
            $('#selectAffiliate').val(0);
            $('#affiliate').hide();
            $('#specialization').hide();
            $('#details').html('Details:');
            $('#address').html('Address:');
            $('#province').html('Province:');
            $('#nameLabel').html('Store Name: <i class="required">*</i>');
            $('#name').attr("placeholder", "Enter Store Name");
        }else{
            $('#affiliate').show();
            $('#specialization').show();
            $('#details').html('Details: <i class="required">*</i>');
            $('#address').html('Address: <i class="required">*</i>');
            $('#province').html('Province: <i class="required">*</i>');
            $('#nameLabel').html('Directory Name: <i class="required">*</i>');
            $('#name').attr("placeholder", "Enter Directory Name");
        }
    });
});
</script>Modules/Client/Views/directory-store/includes/modal-specialization.blade.php000066400000004204152434100730023323 0ustar00<!-- Modal for Adding Specialization -->
<div class="modal fade bs-example-modal-md" id="specializationModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog modal-md">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Add New Specialization</h4>
            </div>
            <div class="modal-body form-horizontal">
                <div class="form-group form-group-sm">
                    <label for="inputEmail3" class="col-sm-3 control-label">Specialization Name</label>
                    <div class="col-sm-9">
                        {!! Form::text('name', null, ['class'=>'form-control', 'id'=>'specialization_name', 'autocomplete'=>'off']) !!}
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-9">
                        <div id="hide_onclick_modal">
                            <button type="button" class="btn btn-primary btn-sm" id="addbutton_specialization">Add Specialization</button>
                            <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">Close</button>
                        </div>
                        <div id="show_onclick_modal" style="display:none">
                            <button class="btn btn-sm btn-primary"><span class="fa fa-refresh fa-spin"></span> Loading ...</button>
                        </div>
                    </div>
                </div>
                <hr>
                <table class="table table-bordered table-striped table-hover" id="specializationTable" width="100%">
                <thead>
                <tr>
                    <th>Name</th>
                    <th>Action</th>
                </tr>
                </thead>
                <tbody>            
                </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<!-- Modal for Adding SpecializationModules/Client/Views/directory-store/includes/modal-affiliate.blade.php000066400000004200152434100730022225 0ustar00<!-- Modal for Adding Affiliate -->
<div class="modal fade bs-example-modal-md" id="affiliateModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog modal-md">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Add New Affiliate</h4>
            </div>
            <div class="modal-body form-horizontal">
                <div class="form-group form-group-sm">
                    <label for="inputEmail3" class="col-sm-3 control-label">Affiliate Name</label>
                    <div class="col-sm-9">
                        {!! Form::text('name', null, ['class'=>'form-control', 'id'=>'affiliate_name', 'autocomplete'=> 'off']) !!}
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-9">
                        <div id="hide_onclick_modal">
                            <button type="button" class="btn btn-primary btn-sm" id="addbutton_affiliate">Add Affiliate</button>
                            <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">Close</button>
                        </div>
                        <div id="show_onclick_modal" style="display:none">
                            <button class="btn btn-sm btn-primary"><span class="fa fa-refresh fa-spin"></span> Loading ...</button>
                        </div>
                    </div>
                </div>
                <hr>
                <table class="table table-bordered table-striped table-hover" id="affiliateTable" width="100%">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                <tbody>            
                </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<!-- Modal for Adding AffiliateModules/Client/Views/directory-store/includes/js-modal-specializations.blade.php000066400000012465152434100730024130 0ustar00<!-- Specialization js -->
<script type="text/javascript">
var specialization_datatable;
$( document ).ready( function() {

	$('#addbutton_specialization').click( function() {
        var name = $('#specialization_name').val();
		if(name=='') {
			swal("Error!", "Name is required!", "error");
			$('#specialization_name').focus();
			return false;
		} else {
			$("#hide_onclick_modal").hide();
			$("#show_onclick_modal").show();
			$.ajax({
	        	type: "post",
	          	url: "{{URL::Route('storeSpecializations')}}",
	          	data: {
	            	name: $("#specialization_name").val()
	          	},
	          	success: function(result) {	    
	          		var table = $('#specializationTable').DataTable();   
	          		table.ajax.reload(); 	          		   
	          		$("#hide_onclick_modal").show();
					$("#show_onclick_modal").hide();
	            	$('#selectSpecialization').append($('<option>', {
		                value: result.id,
		                text: result.name,
		                selected: true
		            }));
	            	$('#specializationModal').modal('hide');	            
	          	},
	          	error :function( xhr ) {
	                if( xhr.status === 422 ) {
	                    var errors = JSON.parse(xhr.responseText);
	                    alert(errors['name'][0]);	                    
	                } else {
	                    swal("Error!", "Error occured please try again.", "error");
	                }
	                $("#hide_onclick_modal").show();
					$("#show_onclick_modal").hide();
	            }
	        });
		}
    }); 

});
function initializeSpecialization()
{
		specialization_datatable = 1;
		var table = $('#specializationTable').DataTable( {
		"processing": true,
        "serverSide": true,
        ajax: {
            url:'{{URL::Route("getSpecializationsData")}}', 
            type: 'POST',
        },
		"bAutoWidth": false,
		"iDisplayLength": 10,
		columns: [
			{data: 'name', name: 'name', className:'editable'},
			{data: 'action', name: 'action', orderable:false, searchable:false, width:'60px', className:'text-center'},
		],
		fnDrawCallback: function ( oSettings ) {
			$('#specializationTable tbody td.editable').editable('/client/modals/specialization/update', {
                callback: function( sValue, y ) {
		           table.draw();
				},
				onsubmit: function(settings, original) {
		            if ((original.revert == $('input',this).val()) || $('input',this).val() == "") {
		            	original.reset();
		            	$(original).parents('tr').find('td.hide_me').show();
		            	return false;
		        	}
				},
				submitdata: function (value, settings) {
	            	var id = $(this).parents('tr').find('a.btn-edit').data('id');
			        return {
			              'id':id
			        };
				},
				onerror:  function(settings, original, xhr) {
	                if( xhr.status === 422 ) {
	                      var errors = JSON.parse(xhr.responseText);
	                      alert(errors['name'][0]);
	                      original.reset(); 
	                      $(original).parents('tr').find('td.hide_me').show();
	                } else {
	                    swal("Error!", "Error occured please try again.", "error");
	                }
		        },
				onblur:'submit',
				event:'custom_event',
				height:"30px",
				width:'100%',
				name : 'name'
			});

			$("#specializationTable tbody td").on("click", 'a.btn-edit', function() {
  				$(this).parents('tr').find('td.editable').trigger("custom_event");
  				$(this).parent('td').addClass('hide_me').hide();
			});

			$("#specializationTable tbody td").on("click", 'a.btn-delete', function() {
				var action = $(this).data('action');
				swal({
                    title: 'Are you sure you want to delete?',
                    text: "This will be permanently deleted",
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: 'Yes'
                    }).then(function () {                    
                    $.ajax({
                        type: "GET",
                        url: action,
                        dataType: 'json',
                        success: function(data) {
                           if(data.success == "yes") {
                                table.draw();
                                swal("Deleted!", "Specialization successfuly deleted!", "success");
                                $("#selectSpecialization option[value='"+data.id+"']").remove();
                           }else{
                                swal("Error!", "Cannot delete it is being used in database.", "error");
                           }
                        },
                        error :function( jqXhr ) {
                            swal('Unable to delete.', 'Please try again.', 'error')
                        }
                    });
                })  
			});
		}
	});

	$('#specialization_name').val('');
    $('#specializationModal').modal({'backdrop':'static'});
}

function doModalAddSpecialization()
{	
	if(specialization_datatable != 1) {
		initializeSpecialization();
	}
	else {
		$('#specialization_name').val('');
    	$('#specializationModal').modal({'backdrop':'static'});
	}
}
</script>
<!-- End of Specialization js -->Modules/Client/Views/directory-store/index.blade.php000066400000014371152434100730016522 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}" aria-hidden="true"></i> {{$pageTitle}}
            <br>
            <small>{{$pageDescription}}</small>
        </h1>
        <ol class="breadcrumb">
            <li class="active"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</li>           
        </ol>
    </section>
    <!-- Main content -->
    <section class="content"> 
        @include('Client::message')
        <div class="box box-default">
            <div class="box-header with-border">
                <div class="pull-left">
                    <form action="javascript:void(0)" id="category-filter" method="POST" class="form-inline" role="form">
                        <b>Filter: </b>
                        <div class="form-group">
                            <label class="sr-only" for="">Search Category</label>
                            {!! Form::select('category', $categories, null, ['class' => 'form-control', 'placeholder'=>'All']) !!}
                        </div>
                        <div class="form-group">
                            {!! Form::text('name', null, ['placeholder' => 'Enter Name', 'class' => 'form-control', 'autocomplete' => 'off']) !!}
                        </div>
                        <button type="submit" class="btn btn-primary">Filter</button>
                        <button href="javascript:void(0)" class="btn btn-default" id="reset">Reset</button>
                    </form>
                </div>
                @can('create', $permissions)
                    <div class="pull-right">
                        <a href="/client/directory-store/create" class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add {{$pageModuleName}}</a>
                    </div>
                @endcan
            </div>
            <div class="box-body">
                <table class="table table-bordered table-striped table-hover" id="directory-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Category</th>
                            <th>Name</th>
                            <th>Information</th>
                            <th>Location</th>
                            <th>Contacts</th>
                            <th>Action</th>
                        </tr>
                    </thead>
               </table>
            </div>                
        </div>
        @include('Client::logs')
    </section>
@stop
@section('page-js')
<script type="text/javascript">
    $(document).ready(function() {
        var directoryTable = $('#directory-table').DataTable({
            "processing": true,
            "serverSide": true,
            "pagingType": "input",
            ajax: {
                url:'directory-store/get-directories-data', 
                type: 'POST',
                "data": function(d){
                    d.name = $('#category-filter [name="name"]').val();
                    d.category = $('#category-filter [name="category"]').val();
                }
            },
            "dom": "<'row'<'col-sm-6'i><'col-sm-6 text-right'l>>" +
                "<'row'<'col-sm-12'tr>>" +
                "<'row'<'col-sm-5'><'col-sm-7'p>>",
            columns: [
                {
                    width:'10px', searchable: false, orderable: false,
                    render: function (data, type, row, meta) {
                        return meta.row + meta.settings._iDisplayStart + 1;
                    }
                },
                { data: 'category', name: 'category' },
                { data: 'name', name: 'name' },
                { data: 'affiliates-specializations.name', name: 'affiliates-specializations.name', sortable: false, searchable: false},
                { data: 'locations', name: 'locations', sortable: false, searchable: false},
                { data: 'contacts', name: 'contacts', sortable: false, searchable: false, width:'250px'},
                { data: 'action', name: 'action', orderable: false, searchable: false, width:'60px', className:'text-center'},
            ],
            fnDrawCallback: function ( oSettings ) {
                $('[data-toggle="tooltip"]').tooltip();
                $("#directory-table td").on("click", '.deleted', function() {
                    var action = $(this).data('action');
                    swal({
                        title: 'Are you sure you want to delete?',
                        text: "This will be permanently deleted",
                        type: 'warning',
                        showCancelButton: true,
                        confirmButtonColor: '#3085d6',
                        cancelButtonColor: '#d33',
                        confirmButtonText: 'Yes'
                        }).then(function () {                    
                        $.ajax({
                            type: "GET",
                            url: action,
                            dataType: 'json',
                            success: function(data) {
                                if(data.type == "success") {
                                    directoryTable.draw();
                                    swal(data.message, '', 'success')
                               }else{
                                    swal(data.message, '', 'error')
                               }
                            },
                            error :function( jqXhr ) {
                                swal('Unable to delete.', 'Please try again.', 'error')
                            }
                        });
                    })              
                });            
            },
            "order": [[2, "asc"]],
        });
        $('#category-filter').on('submit', function(){
            directoryTable.draw();
        });
        $('#reset').on('click', function(event) {
            event.preventDefault();
            $('#category-filter [name="name"]').val('');
            $('#category-filter [name="category"]').val('');
            directoryTable.draw();
        });
    });
</script>
@include('Client::directory-store.includes.js')
@include('Client::notify')
@stopModules/Client/Views/directory-store/edit.blade.php000066400000004031152434100730016330 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-pencil"></i> Edit {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.directory.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>             
            <li class="active">Edit</li>
        </ol>
    </section>

    <section class="content"> 
        @include('Client::message')
        {!! Form::model($directory, array('url' => config('modules.client').'/directory-store/update/'.$directory->hashid, 'method' => 'POST', 'class'=>'form-horizontal', 'role' => 'form' , 'id'=>'directory-form')) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::directory-store.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-warning save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save Changes</button>
            </div>
        </div>
        {!! Form::close() !!}
        <br>
        @include('Client::logs')
    </section>
    @include('Client::directory-store.includes.modal-affiliate')
    @include('Client::directory-store.includes.modal-specialization')
@stop
@section('page-js')
@include('Client::directory-store.includes.js')
@include('Client::directory-store.includes.gmaps')
@include('Client::directory-store.includes.js-modal-affiliates')
@include('Client::directory-store.includes.js-modal-specializations')
@include('Client::notify')
@stopModules/Client/Views/reports/audittrail/view.blade.php000066400000006547152434100730017075 0ustar00@extends('Client::reports-layout')
@section('page-body')
    <!-- Content Header (Page header) -->
    <!-- Main content -->
    <section class="content"> 
        <div class="box box-primary">
            <div class="box-body">
            <form method="get" action="{{route(config('modules.client').'.audittrail.excel')}}">
                @can('export', $permissions)
                    @foreach(Input::all() as $input => $value)
                     <input type="hidden" name="{{$input}}" value="{{$value}}">
                    @endforeach
                    <span class="pull-right">
                        <button class="btn btn-danger btn-flat" type="button" onclick="window.close();"><i class="fa fa-times"></i> Close</button>
                        <button class="btn btn-success btn-flat" type="submit"><i class="fa fa-file-excel-o"></i> Export To Excel</button>
                    </span>
                @endcan
                    <h4><b>Audit Trail Report List by {{$type}}</b></h4>
                    <span>From {{$date}}</span>
                </form>
            </div>

        </div>
        <div class="box box-default">
            <div class="box-body">
                <table class="table table-bordered table-striped table-hover data" id="logs-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Date</th>
                            <th>Module</th>
                            <th>Action</th>
                            <th>Name</th>
                            <th>Email</th>
                            <th>IP Address</th>
                        </tr>
                    </thead>
               </table>
            </div>
        </div>
    </section>
@stop
@section('page-js')
<script type="text/javascript">
$(function() {
    var subjectTable = $('#logs-table').DataTable({
        processing: true,
        serverSide: true,
        pagingType: "input",
        iDisplayLength: 25,
        filter: false,
        ajax: {
            url: 'get-user-report-data ',
            method: 'POST',
            "data": function(d){
                d.report_type = "{{Input::get('report_type')}}";
                d.user_id = "{{Input::get('user_id')}}";
                d.start_date = "{{Input::get('start_date')}}";
                d.end_date = "{{Input::get('end_date')}}";
            }
        },
        columns: [
            {
                width:'10px', searchable: false, orderable: false,
                render: function (data, type, row, meta) {
                    return meta.row + meta.settings._iDisplayStart + 1;
                }
            },
            { data: 'created_at', name: 'created_at', sortable: true, searchable: false},
            { data: 'module', name: 'module', sortable: false, searchable: false, visible: '<?php echo $visibleUser?>'},
            { data: 'action', name: 'action', sortable: false, searchable: false, visible: '<?php echo $visibleUser?>'},
            { data: 'user', name: 'user', sortable: false, searchable: false},
            { data: 'username', name: 'username', sortable: false, searchable: false, visible: '<?php echo $visibleLogin?>'},
            { data: 'ipaddress', name: 'ipaddress', sortable: false, searchable: false, visible: '<?php echo $visibleLogin?>'},
        ],
        "order": [[1, "desc"]],
    });
});
</script>
@stopModules/Client/Views/reports/audittrail/includes/form.blade.php000066400000002157152434100730020665 0ustar00<div class="form-group">
    <label class="control-label col-md-3">Report Type:</label>
    <div class="col-md-6">
        {!! Form::select('report_type',  $type , null ,  ['id'=>'selectType', 'class'=>'form-control']) !!}
    </div>
</div>
<div class="form-group">
    <label class="control-label col-md-3">Username:</label>
    <div class="col-md-6">
        {!! Form::select('user_id', ['' => 'All'] + $users , null , ['class'=>'form-control']) !!}
    </div>
</div>
<div class="form-group form-group-md audittrail_report_joyride_step3" id="rangeField">
    <label class="control-label col-md-3">Date:</label>
    <div class="col-md-6">
        <div class="input-group">
            <div class="input-group-addon"><i class="fa fa-calendar"></i></div>
            {!! Form::text('date_range', null , ['class'=>'form-control', 'id'=>'reportrange', 'autocomplete'=>'off']) !!}
        </div>
        {!! Form::hidden('start_date', null , ['class'=>'form-control', 'id'=>'start', 'autocomplete'=>'off']) !!}
        {!! Form::hidden('end_date', null , ['class'=>'form-control', 'id'=>'end', 'autocomplete'=>'off']) !!}
    </div>
</div>Modules/Client/Views/reports/audittrail/includes/js.blade.php000066400000002233152434100730020331 0ustar00<script type="text/javascript">
$(document).ready(function(){
    $('#reportrange').daterangepicker(
        {
            startDate: moment().startOf('week'),
            endDate: moment().endOf('week'),
            showDropdowns: true,
            ranges: {
            'This Week': [moment().startOf('week'), moment().endOf('week')],
            'Last Week': [moment().subtract(1, 'week').startOf('week'), moment().subtract(1, 'week').endOf('week')],
            'This Month': [moment().startOf('month'), moment().endOf('month')],
            'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
            'This Year': [moment().startOf('year'), moment().endOf('year')],
            'Last Year': [moment().subtract(1, 'year').startOf('year'), moment().subtract(1, 'year').endOf('year')]
            },
        },
        function(start, end) {
            $('#start').val(start.format('YYYY-MM-DD'));
            $('#end').val(end.format('YYYY-MM-DD'));
         }
    );
    $('#start').val(moment().startOf('week').format('YYYY-MM-DD'));
    $('#end').val(moment().endOf('week').format('YYYY-MM-DD'));
});
</script>Modules/Client/Views/reports/audittrail/includes/user-logs-table.blade.php000066400000002517152434100730022727 0ustar00@extends('Client::reports-table-layouts')
@section('page-body')
    <table class="table table-bordered table-striped table-hover data" id="logs-table" width="100%">
        <thead>
            <tr>
                <td colspan="5" style="text-align: center;"><h2><strong>Audit Trail Report by {{$type}}</strong></h2></td>
            </tr>
            <tr>
                <td colspan="5" style="text-align: center;">From {{$date}}</td>
            </tr>
            <tr>
                <td colspan="5"></td>
            </tr>
            <tr>
                <th style="text-align: center;">No.</th>
                <th style="text-align: center;">Date</th>
                <th style="text-align: center;">Module</th>
                <th style="text-align: center;">Action</th>
                <th style="text-align: center;">Name</th>
            </tr>
        </thead>
        <tbody>
        @foreach($userLogs as $count => $logs)
            <tr>
                <td width="5" style="text-align: center;">{{++$count}}</td>
                <td width="30">{{$logs->created_at}}</td>
                <td width="25">{{$logs->module->title}}</td>
                <td width="20" style="text-align: center;">{{$logs->action}}</td>
                <td width="20">{{$logs->user->name}}</td>
            </tr>
        @endforeach
        </tbody>
   </table>
@stopModules/Client/Views/reports/audittrail/includes/login-logs-table.blade.php000066400000002512152434100730023054 0ustar00@extends('Client::reports-table-layouts')
@section('page-body')
    <table class="table table-bordered table-striped table-hover data" id="logs-table" width="100%">
        <thead>
            <tr>
                <td colspan="5" style="text-align: center;"><h2><strong>Audit Trail Report by {{$type}}</strong></h2></td>
            </tr>
            <tr>
                <td colspan="5" style="text-align: center;">From {{$date}}</td>
            </tr>
            <tr>
                <td colspan="5"></td>
            </tr>
            <tr>
                <th style="text-align: center;">No.</th>
                <th style="text-align: center;">Date</th>
                <th style="text-align: center;">Name</th>
                <th style="text-align: center;">Email</th>
                <th style="text-align: center;">IP Address</th>
            </tr>
        </thead>
        <tbody>
        @foreach($userLogs as $count => $logs)
            <tr>
                <td width="5" style="text-align: center;">{{++$count}}</td>
                <td width="30">{{$logs->created_at}}</td>
                <td width="20">{{$logs->name}}</td>
                <td width="30">{{$logs->username}}</td>
                <td width="20" style="text-align: center;">{{$logs->ipaddress}}</td>
            </tr>
        @endforeach
        </tbody>
   </table>
@stopModules/Client/Views/reports/audittrail/index.blade.php000066400000002651152434100730017222 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}" aria-hidden="true"></i> {{$pageTitle}}
             <br>
             <small>{{$pageDescription}}</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-file-text-o"></i> Reports</a></li>
            <li class="active"></i> {{$pageTitle}}</li> 
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">        
        @include('Client::message')
        <div class="box box-primary">
            {!! Form::open(array('url'=>url(config('modules.client').'/reports/audittrail/view'), 'class' => 'form-horizontal', 'target' => '_blank', 'method' => 'post', 'id' => 'audit-form')) !!}
            <div class="box-body">
                @include('Client::reports.audittrail.includes.form')
            </div>
            <div class="box-footer text-center">
                <div class="row">
                    <div class="col-md-2 col-md-offset-7">
                        <button class="btn btn-primary btn-flat btn-md btn-block" type="submit">Create</button>
                    </div>
                </div>
           </div> 
           {!! Form::close() !!}
        </div>
    </section>
@stop
@section('page-js')
@include('Client::notify')
@include('Client::reports.audittrail.includes.js')
@stopModules/Client/Views/settings/users/create.blade.php000066400000003221152434100730016511 0ustar00@extends('Client::layouts')
@section('page-body')
     <!-- Content Header (Page header) -->
     <section class="content-header">
        <h1>
            <i class="fa fa-plus-circle" aria-hidden="true"></i> Add {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ url(config('modules.client').'/settings/users') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>
          <li class="active">Add</li>
        </ol>
     </section>
     <!-- Main content -->
     <section class="content">
          @include('Client::errors')
          @include('Client::message')
          {!! Form::open(['url'=>url(config('modules.client').'/settings/users'),'method'=>'POST','class'=>'form-horizontal','role'=>'form','id'=>'user-form']) !!}
          <div class="box box-default">
               <div class="box-header">
                  <h1 class="box-title">@include('Client::all-fields-are-required')</h1>
               </div>
               <div class="box-body">
                    @include('Client::settings.users.includes.form')
               </div>
               <div class="box-footer text-center">
                    <div class="row">
                        <div class="col-md-4 col-md-offset-7">
                           <button class="btn btn-primary btn-flat btn-lg btn-block"><i class="fa fa-save"></i>&nbsp;Save</button>
                        </div>
                    </div>
               </div>
          </div>
          {!! Form::close() !!}
     </section>
@stop
@section('page-js')
    @include('Client::settings.users.includes.js')
    @include('Client::notify')
@stopModules/Client/Views/settings/users/includes/form.blade.php000066400000003752152434100730020030 0ustar00<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Name: <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::text('name', null , ['class'=>'form-control', 'placeholder'=>'Name', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('email') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Email: <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::text('email', null , ['class'=>'form-control', 'placeholder'=>'Email', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('role_id') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Role: <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::select('role_id', $roles, null, ['placeholder' => ' - Select -', 'class'=>'form-control']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('status') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Status: <i class="required">*</i></label>
    <div class="col-md-6">
        {!! Form::select('status', [1=>'Active', 0 => 'Inactive'], null, ['class'=>'form-control']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('password') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Password: <?php if(!isset($id)) {?><i class="required">*</i><?php } ?></label>
    <div class="col-md-6">
        {!! Form::password('password', ['class'=>'form-control', 'id' => 'password', 'placeholder'=>'Password']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
    <label class="control-label col-md-3">Re-type Password: <?php if(!isset($id)) {?><i class="required">*</i><?php } ?></label>
    <div class="col-md-6">
        {!! Form::password('password_confirmation', ['class'=>'form-control', 'id' => 'password_confirmation' ,'placeholder'=>'Re-type Password']) !!}
    </div>
</div>Modules/Client/Views/settings/users/includes/js.blade.php000066400000000311152434100730017465 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Settings\UserRequest', '#user-form'); !!}Modules/Client/Views/settings/users/index.blade.php000066400000010366152434100730016365 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}" aria-hidden="true"></i> {{$pageTitle}}
            <br>
            <small>{{$pageDescription}}</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>            
            <li class="active">User</li>  
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">
        @include('Client::message')
        
        <div class="box box-primary">
            <div class="box-header with-border">
                <h1 class="box-title">List of Users</h1>
                @can('create', $permissions)
                <span class="pull-right">
                    <a href="{{ url(config('modules.client').'/settings/users/create') }}" data-toggle="tooltip" data-placement="top" title="" data-original-title="Add User" class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add User</a>
                </span>
                @endcan
            </div>
            <div class="box-body">
               <table class="table table-condensed table-bordered table-striped table-hover" id="users-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Name</th>
                            <th>Email</th>
                            <th>Role</th>
                            <th>Status</th>
                            <th>Action</th>
                        </tr>
                    </thead>
               </table>
            </div>
        </div>
        @include('Client::logs')
    </section>
@stop
@section('page-js')
<script type="text/javascript">
$(function() {
    var userTable = $('#users-table').DataTable({
        processing: true,
        serverSide: true,
        "pagingType": "input",
        ajax: '{!! url(config('modules.client').'/settings/users/get-users-data') !!}',
        columns: [
            {
                width:'10px', searchable: false, orderable: false,
                render: function (data, type, row, meta) {
                    return meta.row + meta.settings._iDisplayStart + 1;
                }
            },
            { data: 'name', name: 'name' },
            { data: 'email', name: 'email', searchable: false},
            { data: 'role.name', name: 'role.name', searchable: false, orderable: false},
            { data: 'status', name: 'status', searchable: false, orderable: false},
            { data: 'action', name: 'action', orderable: false, searchable: false, width:'50px', className:'text-center'},
        ],
        fnDrawCallback: function ( oSettings ) {
            $('[data-toggle="tooltip"]').tooltip();
            $("#users-table td").on("click", 'a#btn-delete', function() {
                var action = $(this).data('action');
                swal({
                    title: 'Are you sure you want to delete?',
                    text: "This will be permanently deleted",
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: 'Yes'
                    }).then(function () {                    
                    $.ajax({
                        type: "DELETE",
                        url: action,
                        dataType: 'json',
                        success: function(data) {
                            if(data.type == "success") {
                                userTable.draw();
                                swal(data.message, '', 'success')
                           }else{
                                swal(data.message, '', 'error')
                           }
                        },
                        error :function( jqXhr ) {
                            swal('Unable to delete.', 'Please try again.', 'error')
                        }
                    });
                })
            });
        },
        "order": [[1, "asc"]],
    });
});
</script>
@include('Client::notify')
@stopModules/Client/Views/settings/users/edit.blade.php000066400000003502152434100730016175 0ustar00@extends('Client::layouts')
@section('page-body')             
     <!-- Content Header (Page header) -->
     <section class="content-header">
          <h1>
              <i class="fa fa-pencil" aria-hidden="true"></i> Edit {{$pageModuleName}}
          </h1>
          <ol class="breadcrumb">
              <li><a href="{{ url(config('modules.client').'/settings/users') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>
              <li class="active">Edit</li>
          </ol>
     </section>
     <!-- Main content -->
     <section class="content">
          @include('Client::errors')
          @include('Client::message')
              
          {!! Form::model($user, array('url' => config('modules.client').'/settings/users/'.$user->hashid, 'method' => 'PUT', 'class'=>'form-horizontal', 'role' => 'form' , 'id'=>'user-form')) !!}
          <div class="box box-primary">
                <div class="box-header">
                  <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                </div>
               <div class="box-body">                
                    @include('Client::settings.users.includes.form', ['id' => $user->id])
               </div>
               <div class="box-footer text-center">
                    <div class="row">
                         <div class="col-md-4 col-md-offset-7">
                              <button class="btn btn-warning btn-flat btn-lg btn-block"><i class="fa fa-save"></i>&nbsp;Save Changes</button>
                         </div>
                    </div>
               </div>
          </div>
          {!! Form::close() !!}
          <br>
          @include('Client::logs')
     </section>
@stop
@section('page-js') 
    @include('Client::settings.users.includes.js')
    @include('Client::notify')
@stopModules/Client/Views/settings/roles/create.blade.php000066400000003522152434100730016500 0ustar00@extends('Client::layouts')
@section('page-body')             
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-plus-circle" aria-hidden="true"></i> Add Role
            <br>
            <small>Create role and its permissions.</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-cog"></i> Settings</a></li>
            <li><a href="{{ url(config('modules.client').'/settings/roles') }}">Role</a></li>
            <li class="active">Add</li>  
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">
        @include('Client::errors')
        @include('Client::message')
        
        {!! Form::open(['url'=>url(config('modules.client').'/settings/roles'),'method'=>'POST','class'=>'form-horizontal','role'=>'form','id'=>'role-form']) !!}
        <div class="box box-default">
            <div class="box-header">
                <h3 class="box-title"> @include('Client::all-fields-are-required')</h3>
            </div>
            <div class="box-body">                
                @include('Client::settings.roles.includes.form')
                @include('Client::settings.roles.includes.user_permissions')
            </div>
            <div class="box-footer text-center">
                <div class="row">
                    <div class="col-md-4 col-md-offset-7">
                        <button class="btn btn-primary btn-flat btn-lg btn-block"><i class="fa fa-save"></i>&nbsp;Save</button>
                    </div>
                </div>
            </div>
        </div>
        {!! Form::close() !!}
    </section>
@stop
@section('page-css') 
    @include('Client::settings.roles.includes.css')
@stop
@section('page-js') 
    @include('Client::settings.roles.includes.js')
    @include('Client::notify')
@stopModules/Client/Views/settings/roles/includes/form.blade.php000066400000001723152434100730020007 0ustar00<div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
    <label class="control-label col-md-2">Name <span class="required">*</span></label>
    <div class="col-md-4">
        {!! Form::text('name', null , ['class'=>'form-control', 'placeholder'=>'Title', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('display_name') ? ' has-error' : '' }}">
    <label class="control-label col-md-2">Display Name <span class="required">*</span></label>
    <div class="col-md-4">
        {!! Form::text('display_name', null , ['class'=>'form-control', 'placeholder'=>'Display Name', 'autocomplete'=>'off']) !!}
    </div>
</div>
<div class="form-group {{ $errors->has('title') ? ' has-error' : '' }}">
    <label class="control-label col-md-2">Description</label>
    <div class="col-md-4">
        {!! Form::text('description', null , ['class'=>'form-control', 'placeholder'=>'Description', 'autocomplete'=>'off']) !!}
    </div>
</div>Modules/Client/Views/settings/roles/includes/js.blade.php000066400000004113152434100730017454 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Settings\RoleRequest', '#role-form'); !!}
<script type="text/javascript">
$(function () {
    $('input.main-menu').iCheck({
        checkboxClass: 'icheckbox_square-purple',
        radioClass: 'iradio_square-purple',
        increaseArea: '10%' // optional
    }).on('ifChecked', function(e){
       // $(this).parents('.panel').find('input.sub-menu').iCheck('check');
        //$(this).parents('.panel').find('input.icheck').iCheck('check');
    }).on('ifUnchecked', function(e){
       // $(this).parents('.panel').find('input.sub-menu').iCheck('uncheck');
       // $(this).parents('.panel').find('input.icheck').iCheck('uncheck');
    }).end();
    $('input.sub-menu').iCheck({
        checkboxClass: 'icheckbox_square-purple',
        radioClass: 'iradio_square-purple',
        increaseArea: '10%' // optional
    }).on('ifChecked', function() {
       //$(this).closest('.panel').find('input.main-menu').iCheck('check');
       //$(this).closest('.panel').find('input.icheck').iCheck('check');
    }).on('ifUnchecked', function(e){
       //$(this).closest('.panel').find('input.icheck').iCheck('uncheck');
    }).end();

    $('input.icheck').iCheck({
        checkboxClass: 'icheckbox_square-purple',
        radioClass: 'iradio_square-purple',
        increaseArea: '10%' // optional
    }).on('ifChecked', function() {
      // $(this).closest('.panel').find('input.sub-menu').iCheck('check');
      // $(this).closest('.panel').find('input.icheck').iCheck('check');
    }).end();  
});
$(document).ready(function() {
    function getChildren($row) {
        var children = [];
        while($row.next().hasClass('child')) {
             children.push($row.next());
             $row = $row.next();
        }            
        return children;
    }        
    $('.parent').on('click', function() {
        var children = getChildren($(this));
        $.each(children, function() {
            $(this).slideToggle();
        })
    });
})
</script>Modules/Client/Views/settings/roles/includes/css.blade.php000066400000000144152434100730017630 0ustar00<style type="text/css">
.parent{
    cursor: pointer;
}
.parent td {background-color:#ccc;}
</style>Modules/Client/Views/settings/roles/includes/user_permissions.blade.php000066400000000313152434100730022447 0ustar00<div class="row">
    <div class="col-md-12">
        <p class="help-block text-blue">*Note: Please tick the permission that associate to the role.</p>
        {!! $role_permissions !!}
    </div>
</div>Modules/Client/Views/settings/roles/index.blade.php000066400000007224152434100730016347 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-ban"></i> Role Manager
             @include('Client::cache.descriptions.'.$permissions->menu_id)
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-cog"></i> Settings</a></li>
            <li class="active">Role</li>
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">        
        @include('Client::message')
        <div class="box box-default">
            <div class="box-header">
                <h3 class="box-title">List of Roles</h3>
                @can('create', $permissions)
                    <a href="{{ url(config('modules.client').'/settings/roles/create') }}" class="btn btn-primary btn-flat pull-right" data-toggle="tooltip" data-placement="top" title="" data-original-title="Add Role"><i class="fa fa-plus-circle"></i> Add Role</a>
                @endcan
            </div>
            <div class="box-body">
                <table class="table table-condensed table-bordered table-striped table-hover" id="roles-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Name</th>
                            <th>Display Name</th>
                            <th>Action</th>
                        </tr>
                    </thead>
               </table>
            </div>                
        </div>
        @include('Client::logs')
    </section>
@stop
@section('page-js')

<script type="text/javascript">
$(function() {
    var roleTable = $('#roles-table').DataTable({
    processing: true,
    serverSide: true,
    "pagingType": "input",
    ajax: '{!! url(config('modules.client').'/settings/roles/get-roles-data') !!}',
    columns: [
        {
            width:'10px', searchable: false, orderable: false,
            render: function (data, type, row, meta) {
                return meta.row + meta.settings._iDisplayStart + 1;
            }
        },
        { data: 'name', name: 'name' },
        { data: 'display_name', name: 'display_name', sortable: false, searchable: false},
        { data: 'action', name: 'action', orderable: false, searchable: false, width:'50px', className:'text-center'},
    ],
    fnDrawCallback: function ( oSettings ) {
        $('[data-toggle="tooltip"]').tooltip();
        $("#roles-table td").on("click", 'a#btn-delete', function() {
            var action = $(this).data('action');
            swal({
                title: 'Are you sure you want to delete?',
                text: "This will be permanently deleted",
                type: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#3085d6',
                cancelButtonColor: '#d33',
                confirmButtonText: 'Yes'
                }).then(function () {                    
                $.ajax({
                    type: "DELETE",
                    url: action,
                    dataType: 'json',
                    success: function(data) {
                        if(data.type == "success") {
                            roleTable.draw();
                            swal(data.message, '', 'success')
                       }else{
                            swal(data.message, '', 'error')
                       }
                    },
                    error :function( jqXhr ) {
                        swal('Unable to delete.', 'Please try again.', 'error')
                    }
                });
            })                
        });
    },
    "order": [[1, "asc"]],
    });
});
</script>
@include('Client::notify')
@stopModules/Client/Views/settings/roles/edit.blade.php000066400000003630152434100730016162 0ustar00@extends('Client::layouts')
@section('page-body')             
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-pencil" aria-hidden="true"></i> Edit Role
            <br>
            <small>Update role and its permissiosns.</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-cog"></i> Settings</a></li>
            <li><a href="{{ url(config('modules.client').'/settings/roles') }}">Role</a></li>
            <li class="active">Edit</li>  
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">
        @include('Client::errors')
        @include('Client::message')
         
        {!! Form::model($role, array('url' => config('modules.client').'/settings/roles/'.$role->hashid, 'method' => 'PUT', 'class'=>'form-horizontal', 'role' => 'form' , 'id'=>'role-form')) !!}
        <div class="box box-default">
            <div class="box-header">    
                <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
            </div>
            <div class="box-body">
                @include('Client::settings.roles.includes.form')
                @include('Client::settings.roles.includes.user_permissions')
            </div>
            <div class="box-footer text-center">
                <div class="row">
                    <div class="col-md-4 col-md-offset-7">
                        <button class="btn btn-warning btn-flat btn-lg btn-block"><i class="fa fa-save"></i>&nbsp;Save Changes</button>
                    </div>
                </div>
            </div>
        </div>
       {!! Form::close() !!}
       <br>
       @include('Client::logs')
    </section>
@stop
@section('page-css') 
    @include('Client::settings.roles.includes.css')
@stop
@section('page-js') 
    @include('Client::settings.roles.includes.js')
    @include('Client::notify')
@stopModules/Client/Views/errors.blade.php000066400000000410152434100730013556 0ustar00@if (count($errors) > 0)
<div class="callout callout-danger">
    <h4>Oh snap! Change a few things up and try submitting again.</h4>
    <ul>
        @foreach ($errors->all() as $error)
            <li>{{ $error }}</li>
        @endforeach
    </ul>
</div>
@endif Modules/Client/Views/product/create.blade.php000066400000003641152434100730015176 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-plus"></i> Add {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.products.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>             
            <li class="active">Add</li>           
        </ol>
    </section>

    <section class="content"> 
        @include('Client::message')
        {!! Form::open(array('url'=>url(config('modules.client').'/products/store'), 'class' => 'form-horizontal', 'method' => 'POST', 'id' => 'product-form','files' => true)) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::product.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-primary save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save</button>
            </div>
        </div>
        {!! Form::close() !!}
    </section>
    @include('Client::product.includes.modal-brand')
    @include('Client::product.includes.modal-category')
@stop
@section('page-css')
    @include('Client::product.includes.css')
@stop
@section('page-js')
    @include('Client::product.includes.js')
    @include('Client::product.includes.js-modal-brand')
    @include('Client::product.includes.js-modal-category')
    @include('Client::notify')
@stopModules/Client/Views/product/includes/form.blade.php000066400000015010152434100730016475 0ustar00<input type="hidden" name="_token" value="{{ csrf_token() }}">
	<div class="row">
        <div class="col-md-7">
            <div class="col-md-12">
                <div class="form-group {{ ($errors->has('name') ? 'has-error':'') }}">
                    <label class="control-label col-md-3">Product Name: <i class="required">*</i></label>
                    <div class="col-md-9">
                        {!! Form::text('name', null , ['class'=>'form-control', 'placeholder'=>'Enter Product Name', 'autocomplete'=>'off']) !!}
                        {!! $errors->first('name', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
                <div class="form-group {{ ($errors->has('category_id') ? 'has-error':'') }}">
                    <label class="control-label col-md-3">Category: <i class="required">*</i></label>
                    <div class="col-md-9">
                        <div class="input-group">
                           {!! Form::select('category_id',  $category , null ,  ['id'=>'selectCategory', 'class'=>'form-control', 'placeholder'=>'-- Select Category']) !!}
                           <span class="input-group-btn">
                                <button class="btn btn-primary btn-flat" type="button" data-toggle="tooltip" title="Add Category" style="cursor:pointer" onclick="doModalAddCategory();"><i class="fa fa-plus-circle"></i></button>
                           </span>
                        </div>
                    </div>
                </div>
                <div class="form-group {{ ($errors->has('brand_id') ? 'has-error':'') }}">
                    <label class="control-label col-md-3">Brand: <i class="required">*</i></label>
                    <div class="col-md-9">
                        <div class="input-group">
                           {!! Form::select('brand_id',  $brand , null ,  ['id'=>'selectBrand', 'class'=>'form-control', 'placeholder'=>'-- Select Brand']) !!}
                           <span class="input-group-btn">
                                <button class="btn btn-primary btn-flat" type="button" data-toggle="tooltip" title="Add Brand" style="cursor:pointer" onclick="doModalAddBrand();"><i class="fa fa-plus-circle"></i></button>
                                {!! $errors->first('brand_id', '<span class="text-red">:message</span>') !!}
                           </span>
                        </div>
                    </div>
                </div>
                <div class="form-group {{ ($errors->has('price') ? 'has-error':'') }}">
                    <label class="control-label col-md-3">Price:</label>
                    <div class="col-md-9">
                        {!! Form::text('price', null , ['class'=>'form-control', 'placeholder'=>'Enter price', 'autocomplete'=>'off']) !!}
                        {!! $errors->first('price', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
                <div class="form-group {{ $errors->has('details') ? ' has-error' : '' }}">
                    <label class="control-label col-md-3">Details: <i class="required">*</i></label>
                    <div class="col-md-9">
                        {!! Form::textarea('details', null , ['class'=>'form-control wysihtml5', 'placeholder'=>'Details here...', 'autocomplete'=>'off']) !!}
                        {!! $errors->first('details', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-5">
            <div class="col-md-12">
                <div class="panel-group" id="accordion">
                    <div class="panel panel-default" id="panel1">
                        <div class="panel-heading">
                            <h4 class="panel-title">
                                <a data-toggle="collapse" data-target="#collapseOne" style="cursor: pointer;">Product Image
                                </a>
                            </h4>
                        </div>
                        <div id="collapseOne" class="panel-collapse collapse in">
                            <div class="panel-body">
                            @if(isset($product->image))
                                <img src="{{ get_link('products/'.$product->image) }}" id="productImagePreview" alt="Uploaded Image Preview" width="365px" height="290px"/>
                                <br><br>
                                <div class="form-group"> 
                                    <div class="col-md-8"> 
                                        {{ Form::file('image', ['id' => 'image']) }}
                                    </div>
                                </div>
                            @else
                                <img src="" id="productImagePreview" alt="Uploaded Image Preview" width="365px" height="290px"/>
                                <br><br>
                                <div class="form-group">
                                    <div class="col-md-8"> 
                                        {{ Form::file('image', ['id' => 'image']) }}
                                    </div>
                                </div>
                            @endif
                            </div>
                            <div class="panel-body">
                                <div class="form-group">
                                    <label for="posting_from" class="col-sm-2 control-label">Year</label>
                                    <div class="col-sm-10">
                                        {!! Form::text('year', null , ['class'=>'form-control', 'placeholder'=>'Enter year', 'autocomplete'=>'off', 'data-focus' => 'true']) !!}
                                        {!! $errors->first('year', '<span class="text-red">:message</span>') !!}
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="status" class="col-sm-2 control-label">Status</label>
                                    <div class="col-sm-10">
                                        {!! Form::select('status', $status, null, ['class' => 'form-control']) !!}
                                        {!! $errors->first('status', '<span class="text-red">:message</span>') !!}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>Modules/Client/Views/product/includes/js.blade.php000066400000002503152434100730016151 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Products\ProductRequest', 'form#product-form'); !!}
<script type="text/javascript">
    $.validator.setDefaults({ ignore: '' });
    $(function(){
        $('textarea[name="details"]').wysihtml5({
            toolbar: {
                "font-styles": true, // Font styling, e.g. h1, h2, etc.
                "emphasis": false, // Italics, bold, etc.
                "lists": true, // (Un)ordered lists, e.g. Bullets, Numbers.
                "html": false, // Button which allows you to edit the generated HTML.
                "link": false, // Button to insert a link.
                "image": false, // Button to insert an image.
                "color": false, // Button to change color of font
                "blockquote": false, // Blockquote
            }
        });
    });
</script>
<script>
    function readURL(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();
            reader.onload = function(e) {
                $('#productImagePreview').attr('src', e.target.result);
            }
        reader.readAsDataURL(input.files[0]);
        }
    }
    $("#image").change(function() {
        readURL(this);
    });
</script>Modules/Client/Views/product/includes/js-modal-brand.blade.php000066400000012076152434100730020335 0ustar00<!-- Brand js -->
<script type="text/javascript">
var brand_datatable;
$( document ).ready( function() {

	$('#addbutton_brand').click( function() {
        var name = $('#brand_name').val();
		if(name=='') {
			swal("Error!", "Name is required!", "error");
			$('#brand_name').focus();
			return false;
		} else {
			$("#hide_onclick_modal").hide();
			$("#show_onclick_modal").show();
			$.ajax({
	        	type: "post",
	          	url: "/client/modals/brand/store",
	          	data: {
	            	name: $("#brand_name").val()
	          	},
	          	success: function(result) {	    
	          		var table = $('#brandTable').DataTable();   
	          		table.ajax.reload(); 	          		   
	          		$("#hide_onclick_modal").show();
					$("#show_onclick_modal").hide();
	            	$('#selectBrand').append($('<option>', {
		                value: result.id,
		                text: result.name,
		                selected: true
		            }));
	            	$('#brandModal').modal('hide');	            
	          	},
	          	error :function( xhr ) {
	                if( xhr.status === 422 ) {
	                    var errors = JSON.parse(xhr.responseText);
	                    alert(errors['name'][0]);	                    
	                } else {
	                	swal("Error!", "Error occured please try again.", "error");
	                }
	                $("#hide_onclick_modal").show();
					$("#show_onclick_modal").hide();
	            }
	        });
		}
    }); 

});
function initializeBrand()
{
		brand_datatable = 1;
		table = $('#brandTable').DataTable({
        "processing": true,
        "serverSide": true,
        ajax: {
            url:'/client/modals/brand/get-brand-data', 
            type: 'POST',
        },
		"bAutoWidth": false,
		"iDisplayLength": 10,
		columns: [
			{data: 'name', name: 'name', className:'editable'},
			{data: 'action', name: 'action', orderable:false, searchable:false, width:'60px', className:'text-center'},
		],
		fnDrawCallback: function ( oSettings ) {
			$('#brandTable tbody td.editable').editable('/client/modals/brand/update', {
                callback: function( sValue, y ) {
		           table.draw();
				},
				onsubmit: function(settings, original) {
		            if ((original.revert == $('input',this).val()) || $('input',this).val() == "") {
		            	original.reset();
		            	$(original).parents('tr').find('td.hide_me').show();
		            	return false;
		        	}
				},
				submitdata: function (value, settings) {
	            	var id = $(this).parents('tr').find('a.btn-edit').data('id');
			        return {
			              'id':id
			        };
				},
				onerror:  function(settings, original, xhr) {
	                if( xhr.status === 422 ) {
	                      var errors = JSON.parse(xhr.responseText);
	                      alert(errors['name'][0]);
	                      original.reset(); 
	                      $(original).parents('tr').find('td.hide_me').show();
	                } else {
	                    swal("Error!", "Error occured please try again.", "error");
	                }
		        },
				onblur:'submit',
				event:'custom_event',
				height:"30px",
				width:'100%',
				name : 'name'
			});

			$("#brandTable tbody td").on("click", 'a.btn-edit', function() {
  				$(this).parents('tr').find('td.editable').trigger("custom_event");
  				$(this).parent('td').addClass('hide_me').hide();
			});

			$("#brandTable tbody td").on("click", 'a.btn-delete', function() {
				var action = $(this).data('action');
				swal({
                    title: 'Are you sure you want to delete?',
                    text: "This will be permanently deleted",
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: 'Yes'
                    })
					.then(function () {                    
                    $.ajax({
                        type: "GET",
                        url: action,
                        dataType: 'json',
                        success: function(data) {
                           if(data.success == "yes") {
                                table.draw();
                                swal("Deleted!", "Brand successfuly deleted!", "success");
                                $("#selectBrand option[value='"+data.id+"']").remove();
                           }else{
                                swal("Error!", "Cannot delete it is being used in database.", "error");
                           }
                        },
                        error :function( jqXhr ) {
                            swal('Unable to delete.', 'Please try again.', 'error')
                        }
                    });
                })  
			});
		}
	});

	$('#brand_name').val('');
    $('#brandModal').modal({'backdrop':'static'});
}

function doModalAddBrand()
{	
	if(brand_datatable != 1) {
		initializeBrand();
	}
	else {
		$('#brand_name').val('');
    	$('#brandModal').modal({'backdrop':'static'});
	}
}
</script>
<!-- End of Brand js -->Modules/Client/Views/product/includes/modal-brand.blade.php000066400000004136152434100730017721 0ustar00<!-- Modal for Adding Product Brand -->
<div class="modal fade bs-example-modal-md" id="brandModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog modal-md">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Add New Brand</h4>
            </div>
            <div class="modal-body form-horizontal">
                <div class="form-group form-group-sm">
                    <label for="inputEmail3" class="col-sm-3 control-label">Brand Name</label>
                    <div class="col-sm-9">
                        {!! Form::text('name', null, ['class'=>'form-control', 'id'=>'brand_name', 'autocomplete' => 'off']) !!}
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-9">
                        <div id="hide_onclick_modal">
                            <button type="button" class="btn btn-primary btn-sm" id="addbutton_brand">Add Brand</button>
                            <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">Close</button>
                        </div>
                        <div id="show_onclick_modal" style="display:none">
                            <button class="btn btn-sm btn-primary"><span class="fa fa-refresh fa-spin"></span> Loading ...</button>
                        </div>
                    </div>
                </div>
                <hr>
                <table class="table table-condensed table-bordered" id="brandTable">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>            
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<!-- Modal for Adding Product BrandModules/Client/Views/product/includes/css.blade.php000066400000000172152434100730016325 0ustar00<style>
.panel-heading a:after {
    font-family:'Glyphicons Halflings';
    content:"\e114";
    float: right;
}
</style>Modules/Client/Views/product/includes/modal-category.blade.php000066400000004171152434100730020447 0ustar00<!-- Modal for Adding Product Category -->
<div class="modal fade bs-example-modal-md" id="categoryModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog modal-md">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Add New Category</h4>
            </div>
            <div class="modal-body form-horizontal">
                <div class="form-group form-group-sm">
                    <label for="inputEmail3" class="col-sm-3 control-label">Category Name</label>
                    <div class="col-sm-9">
                        {!! Form::text('name', null, ['class'=>'form-control', 'id'=>'category_name', 'autocomplete' => 'off']) !!}
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-9">
                        <div id="hide_onclick_modal">
                            <button type="button" class="btn btn-primary btn-sm" id="addbutton_category">Add Category</button>
                            <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">Close</button>
                        </div>
                        <div id="show_onclick_modal" style="display:none">
                            <button class="btn btn-sm btn-primary"><span class="fa fa-refresh fa-spin"></span> Loading ...</button>
                        </div>
                    </div>
                </div>
                <hr>
                <table class="table table-condensed table-bordered" id="categoryTable">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>            
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<!-- Modal for Adding Product CategoryModules/Client/Views/product/includes/js-modal-category.blade.php000066400000012217152434100730021061 0ustar00<!-- Brand js -->
<script type="text/javascript">
var category_datatable;
$( document ).ready( function() {

	$('#addbutton_category').click( function() {
        var name = $('#category_name').val();
		if(name=='') {
			swal("Error!", "Name is required!", "error");
			$('#category_name').focus();
			return false;
		} else {
			$("#hide_onclick_modal").hide();
			$("#show_onclick_modal").show();
			$.ajax({
	        	type: "post",
	          	url: "/client/modals/category/store",
	          	data: {
	            	name: $("#category_name").val()
	          	},
	          	success: function(result) {	    
	          		var table = $('#categoryTable').DataTable();   
	          		table.ajax.reload(); 	          		   
	          		$("#hide_onclick_modal").show();
					$("#show_onclick_modal").hide();
	            	$('#selectCategory').append($('<option>', {
		                value: result.id,
		                text: result.name,
		                selected: true
		            }));
	            	$('#categoryModal').modal('hide');	            
	          	},
	          	error :function( xhr ) {
	                if( xhr.status === 422 ) {
	                    var errors = JSON.parse(xhr.responseText);
	                    alert(errors['name'][0]);	                    
	                } else {
	                	swal("Error!", "Error occured please try again.", "error");
	                }
	                $("#hide_onclick_modal").show();
					$("#show_onclick_modal").hide();
	            }
	        });
		}
    }); 

});
function initializeCategory()
{
		category_datatable = 1;
		table = $('#categoryTable').DataTable({
        "processing": true,
        "serverSide": true,
        ajax: {
            url:'/client/modals/category/get-category-data', 
            type: 'POST',
        },
		"bAutoWidth": false,
		"iDisplayLength": 10,
		columns: [
			{data: 'name', name: 'name', className:'editable'},
			{data: 'action', name: 'action', orderable:false, searchable:false, width:'60px', className:'text-center'},
		],
		fnDrawCallback: function ( oSettings ) {
			$('#categoryTable tbody td.editable').editable('/client/modals/category/update', {
                callback: function( sValue, y ) {
		           table.draw();
				},
				onsubmit: function(settings, original) {
		            if ((original.revert == $('input',this).val()) || $('input',this).val() == "") {
		            	original.reset();
		            	$(original).parents('tr').find('td.hide_me').show();
		            	return false;
		        	}
				},
				submitdata: function (value, settings) {
	            	var id = $(this).parents('tr').find('a.btn-edit').data('id');
			        return {
			              'id':id
			        };
				},
				onerror:  function(settings, original, xhr) {
	                if( xhr.status === 422 ) {
	                      var errors = JSON.parse(xhr.responseText);
	                      alert(errors['name'][0]);
	                      original.reset(); 
	                      $(original).parents('tr').find('td.hide_me').show();
	                } else {
	                    swal("Error!", "Error occured please try again.", "error");
	                }
		        },
				onblur:'submit',
				event:'custom_event',
				height:"30px",
				width:'100%',
				name : 'name'
			});

			$("#categoryTable tbody td").on("click", 'a.btn-edit', function() {
  				$(this).parents('tr').find('td.editable').trigger("custom_event");
  				$(this).parent('td').addClass('hide_me').hide();
			});

			$("#categoryTable tbody td").on("click", 'a.btn-delete', function() {
				var action = $(this).data('action');
				swal({
                    title: 'Are you sure you want to delete?',
                    text: "This will be permanently deleted",
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: 'Yes'
                    })
					.then(function () {                    
                    $.ajax({
                        type: "GET",
                        url: action,
                        dataType: 'json',
                        success: function(data) {
                           if(data.success == "yes") {
                                table.draw();
                                swal("Deleted!", "Category successfuly deleted!", "success");
                                $("#selectCategory option[value='"+data.id+"']").remove();
                           }else{
                                swal("Error!", "Cannot delete it is being used in database.", "error");
                           }
                        },
                        error :function( jqXhr ) {
                            swal('Unable to delete.', 'Please try again.', 'error')
                        }
                    });
                })  
			});
		}
	});

	$('#category_name').val('');
    $('#categoryModal').modal({'backdrop':'static'});
}

function doModalAddCategory()
{	
	if(category_datatable != 1) {
		initializeCategory();
	}
	else {
		$('#category_name').val('');
    	$('#categoryModal').modal({'backdrop':'static'});
	}
}
</script>
<!-- End of Brand js -->Modules/Client/Views/product/index.blade.php000066400000014721152434100730015043 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}" aria-hidden="true"></i> {{$pageTitle}}
            <br>
            <small>{{$pageDescription}}</small>
        </h1>
        <ol class="breadcrumb">
            <li class="active"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</li>           
        </ol>
    </section>
    <!-- Main content -->
    <section class="content"> 
        @include('Client::message')
        <div class="box box-default">
            <div class="box-header with-border">
                <div class="pull-left">
                    <form action="javascript:void(0)" id="products-filter" method="POST" class="form-inline" role="form">
                        <b>Filter: </b>
                        <div class="form-group">
                            <label class="sr-only" for="">Search Products</label>
                            {!! Form::select('category_id', $category, null, ['class' => 'form-control', 'placeholder'=>'All']) !!}
                        </div>
                        <div class="form-group">
                            {!! Form::select('brand_id', $brand, null, ['class' => 'form-control', 'placeholder'=>'All']) !!}
                        </div>
                        <div class="form-group">
                            {!! Form::text('name', null, ['placeholder' => 'Product Name', 'class' => 'form-control', 'autocomplete' => 'off']) !!}
                        </div>
                        <button type="submit" class="btn btn-primary">Filter</button>
                        <button href="javascript:void(0)" class="btn btn-default" id="reset">Reset</button>
                    </form>
                </div>
                @can('create', $permissions)
                    <div class="pull-right">
                        <a href="/client/products/create" class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add {{$pageModuleName}}</a>
                    </div>
                @endcan
            </div>
            <div class="box-body">
                <table class="table table-bordered table-striped table-hover" id="product-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Image</th>
                            <th>Product</th>
                            <th>Information</th>
                            <th>Others</th>
                            <th>Action</th>
                        </tr>
                    </thead>
               </table>
            </div>                
        </div>
        @include('Client::logs')
    </section>
@stop
@section('page-js')
<script type="text/javascript">
    $(document).ready(function() {
       var productTable = $('#product-table').DataTable({
            "processing": true,
            "serverSide": true,
            "pagingType": "input",
            "bFilter": false,
            ajax: {
                url:'products/get-product-data', 
                type: 'POST',
                "data": function(d){
                    d.name = $('#products-filter [name="name"]').val();
                    d.category_id = $('#products-filter [name="category_id"]').val();
                    d.brand_id = $('#products-filter [name="brand_id"]').val();
                }
            },
            "dom": "<'row'<'col-sm-6'i><'col-sm-6 text-right'l>>" +
                "<'row'<'col-sm-12'tr>>" +
                "<'row'<'col-sm-5'><'col-sm-7'p>>",
            columns: [
                {
                    width:'10px', searchable: false, orderable: false,
                    render: function (data, type, row, meta) {
                        return meta.row + meta.settings._iDisplayStart + 1;
                    }
                },
                { data: 'image', name: 'image', sortable: false, searchable: false, width:'80px', className:'text-center'},
                { data: 'name', name: 'name' },
                { data: 'information', name: 'information', sortable: false, searchable: false},
                { data: 'others', name: 'others', sortable: false, searchable: false},
                { data: 'action', name: 'action', orderable: false, searchable: false, width:'60px', className:'text-center'},
            ],
            fnDrawCallback: function ( oSettings ) {
                $('[data-toggle="tooltip"]').tooltip();
                $("#product-table td").on("click", '.deleted', function() {
                    var action = $(this).data('action');
                    swal({
                        title: 'Are you sure you want to delete?',
                        text: "This will be permanently deleted",
                        type: 'warning',
                        showCancelButton: true,
                        confirmButtonColor: '#3085d6',
                        cancelButtonColor: '#d33',
                        confirmButtonText: 'Yes'
                        }).then(function () {                    
                        $.ajax({
                            type: "GET",
                            url: action,
                            dataType: 'json',
                            success: function(data) {
                                if(data.type == "success") {
                                    productTable.draw();
                                    swal(data.message, '', 'success')
                               }else{
                                    swal(data.message, '', 'error')
                               }
                            },
                            error :function( jqXhr ) {
                                swal('Unable to delete.', 'Please try again.', 'error')
                            }
                        });
                    })              
                });            
            },
            "order": [[2, "asc"]],
        });
        $('#products-filter').on('submit', function(){
            productTable.draw();
        });
        $('#reset').on('click', function(event) {
            event.preventDefault();
            $('#products-filter [name="name"]').val('');
            $('#products-filter [name="category_id"]').val('');
            $('#products-filter [name="brand_id"]').val('');
            productTable.draw();
        });
    });
</script>
@include('Client::product.includes.js')
@include('Client::notify')
@stopModules/Client/Views/product/edit.blade.php000066400000003774152434100730014667 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
         <h1>
            <i class="fa fa-pencil"></i> Edit {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.products.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>             
            <li class="active">Edit</li>
        </ol>
    </section>

    <section class="content"> 
        @include('Client::message')
        {!! Form::model($product, array('url' => config('modules.client').'/products/update/'.$product->hashid, 'method' => 'POST', 'class'=>'form-horizontal', 'role' => 'form' , 'id'=>'product-form', 'files' => true)) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::product.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-warning save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save Changes</button>
            </div>
        </div>
        {!! Form::close() !!}
        <br>
        @include('Client::logs')
    </section>
    @include('Client::product.includes.modal-brand')
    @include('Client::product.includes.modal-category')
@stop
@section('page-css')
    @include('Client::product.includes.css')
@stop
@section('page-js')
    @include('Client::product.includes.js')
    @include('Client::product.includes.js-modal-brand')
    @include('Client::product.includes.js-modal-category')
    @include('Client::notify')
@stopModules/Client/Views/posts/create.blade.php000066400000003441152434100730014664 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
        <h1>
            <i class="fa fa-plus"></i> Add {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.posts.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>             
            <li class="active">Add</li>           
        </ol>
    </section>

    <section class="content"> 
        @include('Client::message')
        {!! Form::open(array('url'=>url(config('modules.client').'/posts/store'), 'class' => 'form-horizontal', 'method' => 'POST', 'id' => 'post-form','files' => true)) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::posts.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-primary save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save</button>
            </div>
        </div>
        {!! Form::close() !!}
    </section>
    @include('Client::posts.includes.modal-category')
@stop
@section('page-css')
    @include('Client::posts.includes.css')
@stop
@section('page-js')
    @include('Client::posts.includes.js')
    @include('Client::posts.includes.js-modal-category')
    @include('Client::notify')
@stopModules/Client/Views/posts/includes/form.blade.php000066400000022762152434100730016201 0ustar00<input type="hidden" name="_token" value="{{ csrf_token() }}">
	<div class="row">
        <div class="col-md-7">
            <div class="col-md-12">
                <div class="form-group {{ ($errors->has('title') ? 'has-error':'') }}">
                    <label class="control-label col-md-2">Title: <i class="required">*</i></label>
                    <div class="col-md-10">
                        {!! Form::text('title', null , ['class'=>'form-control', 'placeholder'=>'Enter Post Title', 'autocomplete'=>'off']) !!}
                        {!! $errors->first('title', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
                <div class="form-group {{ ($errors->has('posts_category_id') ? 'has-error':'') }}">
                    <label class="control-label col-md-2">Category: <i class="required">*</i></label>
                    <div class="col-md-10">
                        <div class="input-group">
                           {!! Form::select('posts_category_id',  $category , null ,  ['id'=>'selectCategory', 'class'=>'form-control', 'placeholder'=>'-- Select Category']) !!}
                           {!! $errors->first('posts_category_id', '<span class="text-red">:message</span>') !!}
                           <span class="input-group-btn">
                                <button class="btn btn-primary btn-flat" type="button" data-toggle="tooltip" title="Add Category" style="cursor:pointer" onclick="doModalAddCategory();"><i class="fa fa-plus-circle"></i></button>
                           </span>
                        </div>
                    </div>
                </div>
                 <div class="form-group {{ ($errors->has('keywords') ? 'has-error':'') }}">
                    <label class="control-label col-md-2">Keywords: </label>
                    <div class="col-md-10">
                        {!! Form::text('keywords', null , ['class'=>'form-control', 'placeholder'=>'Enter keywords', 'autocomplete'=>'off']) !!}
                        <span class="text-aqua">(Note: For multiple keyword, please type your keyword and hit enter.</span>
                        {!! $errors->first('keywords', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
                <div class="form-group {{ $errors->has('content') ? ' has-error' : '' }}">
                    <label class="control-label col-md-2">Content:</label>
                    <div class="col-md-12">
                        {!! Form::textarea('content', null , ['class'=>'form-control content', 'placeholder'=>'Details here...', 'autocomplete'=>'off']) !!}
                        {!! $errors->first('content', '<span class="text-red">:message</span>') !!}
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-5">
            <div class="col-md-12">
                <div class="panel-group" id="accordion">
                    <div class="panel panel-default" id="panel1">
                        <div class="panel-heading">Publish</div>
                        <div class="panel-body">
                            <div class="form-group">
                                <label class="control-label col-md-3">Status: </label>
                                <div class="col-md-9">
                                    {!! Form::select('status',  $status , null ,  ['class'=>'input-sm form-control']) !!}
                                    {!! $errors->first('status', '<span class="text-red">:message</span>') !!}
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3">Visibility: </label>
                                <div class="col-md-9">
                                    {!! Form::select('visibility',  $visibility , null ,  ['class'=>'input-sm form-control']) !!}
                                    {!! $errors->first('visibility', '<span class="text-red">:message</span>') !!}
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputEmail3" class="col-md-3 control-label">Publish At</label>
                                <div class="col-md-9">
                                    <div class="input-group date">
                                        @if(isset($post->published_at))
                                            {!! Form::text('published_at', null, ['class' => 'input-sm form-control', 'id'=>'publish_date', 'data-mask']) !!}
                                        @else
                                            {!! Form::text('published_at', null, ['class' => 'input-sm form-control date', 'id'=>'publish_date', 'data-mask']) !!}
                                        @endif
                                      <div class="input-group-addon">
                                          <span class="fa fa-calendar"></span>
                                      </div>
                                    </div>
                                    {!! $errors->first('published_at', '<span class="text-red">:message</span>') !!}
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputEmail3" class="col-md-3 control-label">Expiring At <a href="javscript:void(0)" class="small" id="clear_expiring_at"><u class="text-warning">Clear date</u></a></label>
                                <div class="col-md-9">
                                    <div class="input-group date">
                                      {!! Form::text('expired_at', null, ['class' => 'input-sm form-control', 'id'=>'expiry_date', 'data-mask']) !!}
                                      <div class="input-group-addon">
                                          <span class="fa fa-calendar"></span>
                                      </div>
                                    </div>
                                    {!! $errors->first('expired_at', '<span class="text-red">:message</span>') !!}
                                    <p class="help-block small"><span class="text-aqua">Leave it blank if no expiring date.</span></p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel-group" id="accordion">
                    <div class="panel panel-default" id="panel1">
                        <div class="panel-heading">
                            <h4 class="panel-title">
                                <a data-toggle="collapse" data-target="#collapseOne" style="cursor: pointer;">Featured Image
                                </a>
                            </h4>
                        </div>
                        <div id="collapseOne" class="panel-collapse collapse in">
                            <div class="panel-body">
                                <div class="form-group">
                                    <div class="col-sm-12">
                                        <div class="input-group">
                                          <span class="input-group-btn">
                                            <a id="image" data-input="featured_image" data-preview="featuredImagePreview" class="btn btn-primary">
                                              <i class="fa fa-picture-o"></i> Choose
                                            </a>
                                          </span>
                                          {!! Form::text('featured_image', null , ['class'=>'form-control', 'id' => 'featured_image', 'readonly' => 'readonly']) !!}
                                        </div>
                                    </div>
                                </div>
                                <br>
                                <div class="text-center">
                                    <img src="{{ get_photo_link((isset($post->featured_image) ? $post->featured_image:''), true) }}" id="featuredImagePreview" alt="" height="200px">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel-group" id="accordion">
                    <div class="panel panel-default" id="panel1">
                        <div class="panel-heading">
                            <h4 class="panel-title">
                                <a data-toggle="collapse" data-target="#collapseTwo" style="cursor: pointer;">Excerpt
                                </a>
                            </h4>
                        </div>
                        <div id="collapseTwo" class="panel-collapse collapse in">
                            <div class="panel-body">
                                <div class="form-group">
                                    <div class="col-sm-12">
                                        {!! Form::textarea('excerpt', null , ['class'=>'form-control', 'placeholder'=>'Enter Excerpt', 'autocomplete'=>'off', 'rows'=>'3', 'style'=>'resize: vertical;']) !!}
                                        {!! $errors->first('excerpt', '<span class="text-red">:message</span>') !!}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>Modules/Client/Views/posts/includes/js.blade.php000064400000002751152434100730015644 0ustar00<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('QxCMS\Modules\Client\Requests\Posts\PostRequest', 'form#post-form'); !!}
<script>
     $('#image').filemanager('image', {prefix: "{{ URL::to('/qxcms/laravel/filemanager') }}"});
</script>
<script type="text/javascript">
    CKEDITOR.replace( 'content', {
        filebrowserImageBrowseUrl: '/qxcms/laravel/filemanager?type=Images',
        filebrowserBrowseUrl: '/qxcms/laravel/filemanager?type=Files',
    });

   /* var path = $('[name="featured_image"]').val();
    $("#featuredImagePreview").attr("src", "{{ get_photo_link() }}"+path);*/
</script>
<script type="text/javascript">
$(function(){
    var body = $('body');
    $("#publish_date, #expiry_date").inputmask(body.data('datepicker-mask'), {"placeholder": body.data('datepicker-mask')});
    $("#publish_date, #expiry_date").datepicker({ 
        yearRange: "1970:+0",
        changeMonth: true,
        changeYear: true,
        minDate: 0,
        dateFormat: body.data('datepicker-format'),
        onSelect: function(datetext){
            $(this).valid();
        }
    });

    $('.date').datepicker("setDate", "0");
    $('input[name="keywords"]').tokenfield();
});
</script>
<script>
$(function(){
    if ($('#clear_expiring_at').length){
        $('#clear_expiring_at').on('click', function(event) {
            event.preventDefault();
            $('[name="expired_at"]').val('');
        });
    }
});
</script>Modules/Client/Views/posts/includes/css.blade.php000066400000000172152434100730016015 0ustar00<style>
.panel-heading a:after {
    font-family:'Glyphicons Halflings';
    content:"\e114";
    float: right;
}
</style>Modules/Client/Views/posts/includes/modal-category.blade.php000066400000004260152434100730020136 0ustar00<!-- Modal for Adding Product Category -->
<div class="modal fade bs-example-modal-md" id="postCategoryModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog modal-md">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Add New Category</h4>
            </div>
            <div class="modal-body form-horizontal">
                <div class="form-group form-group-sm">
                    <label for="inputEmail3" class="col-sm-3 control-label">Category Name</label>
                    <div class="col-sm-9">
                        {!! Form::text('name', null, ['class'=>'form-control', 'id'=>'post_category_name', 'autocomplete' => 'off']) !!}
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-9">
                        <div id="hide_onclick_modal">
                            <button type="button" class="btn btn-primary btn-sm" id="addbutton_category">Add Category</button>
                            <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">Close</button>
                        </div>
                        <div id="show_onclick_modal" style="display:none">
                            <button class="btn btn-sm btn-primary"><span class="fa fa-refresh fa-spin"></span> Loading ...</button>
                        </div>
                    </div>
                </div>
                <hr>
                <table class="table table-condensed table-bordered" id="postCategoryTable">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Slug</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>            
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<!-- Modal for Adding Product CategoryModules/Client/Views/posts/includes/js-modal-category.blade.php000066400000012462152434100730020553 0ustar00<!-- Brand js -->
<script type="text/javascript">
var category_datatable;
$( document ).ready( function() {

	$('#addbutton_category').click( function() {
        var name = $('#post_category_name').val();
		if(name=='') {
			swal("Error!", "Name is required!", "error");
			$('#post_category_name').focus();
			return false;
		} else {
			$("#hide_onclick_modal").hide();
			$("#show_onclick_modal").show();
			$.ajax({
	        	type: "post",
	          	url: "/client/modals/postcategory/store",
	          	data: {
	            	name: $("#post_category_name").val()
	          	},
	          	success: function(result) {
	          		var table = $('#postCategoryTable').DataTable();   
	          		table.ajax.reload(); 	          		   
	          		$("#hide_onclick_modal").show();
					$("#show_onclick_modal").hide();
	            	$('#selectCategory').append($('<option>', {
		                value: result.id,
		                text: result.name,
		                selected: true
		            }));
	            	$('#postCategoryModal').modal('hide');	            
	          	},
	          	error :function( xhr ) {
	                if( xhr.status === 422 ) {
	                    var errors = JSON.parse(xhr.responseText);
	                    alert(errors['name'][0]);	                    
	                } else {
	                	swal("Error!", "Error occured please try again.", "error");
	                }
	                $("#hide_onclick_modal").show();
					$("#show_onclick_modal").hide();
	            }
	        });
		}
    }); 

});
function initializeCategory()
{
		category_datatable = 1;
		table = $('#postCategoryTable').DataTable({
        "processing": true,
        "serverSide": true,
        ajax: {
            url:'/client/modals/postcategory/get-post-category-data', 
            type: 'POST',
        },
		"bAutoWidth": false,
		"iDisplayLength": 10,
		columns: [
			{data: 'name', name: 'name', className:'editable'},
			{data: 'slug', name: 'slug', orderable:false, searchable:false,},
			{data: 'action', name: 'action', orderable:false, searchable:false, width:'60px', className:'text-center'},
		],
		"order": [[0, "asc"]],
		fnDrawCallback: function ( oSettings ) {
			$('#postCategoryTable tbody td.editable').editable('/client/modals/postcategory/update', {
                callback: function( sValue, y ) {
		           table.draw();
				},
				onsubmit: function(settings, original) {
		            if ((original.revert == $('input',this).val()) || $('input',this).val() == "") {
		            	original.reset();
		            	$(original).parents('tr').find('td.hide_me').show();
		            	return false;
		        	}
				},
				submitdata: function (value, settings) {
	            	var id = $(this).parents('tr').find('a.btn-edit').data('id');
			        return {
			              'id':id
			        };
				},
				onerror:  function(settings, original, xhr) {
	                if( xhr.status === 422 ) {
	                      var errors = JSON.parse(xhr.responseText);
	                      alert(errors['name'][0]);
	                      original.reset(); 
	                      $(original).parents('tr').find('td.hide_me').show();
	                } else {
	                    swal("Error!", "Error occured please try again.", "error");
	                }
		        },
				onblur:'submit',
				event:'custom_event',
				height:"30px",
				width:'100%',
				name : 'name'
			});

			$("#postCategoryTable tbody td").on("click", 'a.btn-edit', function() {
  				$(this).parents('tr').find('td.editable').trigger("custom_event");
  				$(this).parent('td').addClass('hide_me').hide();
			});

			$("#postCategoryTable tbody td").on("click", 'a.btn-delete', function() {
				var action = $(this).data('action');
				swal({
                    title: 'Are you sure you want to delete?',
                    text: "This will be permanently deleted",
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: 'Yes'
                    })
					.then(function () {                    
                    $.ajax({
                        type: "GET",
                        url: action,
                        dataType: 'json',
                        success: function(data) {
                           if(data.success == "yes") {
                                table.draw();
                                swal("Deleted!", "Category successfuly deleted!", "success");
                                $("#selectCategory option[value='"+data.id+"']").remove();
                           }else{
                                swal("Error!", "Cannot delete it is being used in database.", "error");
                           }
                        },
                        error :function( jqXhr ) {
                            swal('Unable to delete.', 'Please try again.', 'error')
                        }
                    });
                })  
			});
		}
	});

	$('#post_category_name').val('');
    $('#postCategoryModal').modal({'backdrop':'static'});
}

function doModalAddCategory()
{	
	if(category_datatable != 1) {
		initializeCategory();
	}
	else {
		$('#post_category_name').val('');
    	$('#postCategoryModal').modal({'backdrop':'static'});
	}
}
</script>
<!-- End of Brand js -->Modules/Client/Views/posts/index.blade.php000066400000014270152434100730014532 0ustar00@extends('Client::layouts')
@section('page-body')
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            <i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}" aria-hidden="true"></i> {{$pageTitle}}
            <br>
            <small>{{$pageDescription}}</small>
        </h1>
        <ol class="breadcrumb">
            <li class="active"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</li>           
        </ol>
    </section>
    <!-- Main content -->
    <section class="content"> 
        @include('Client::message')
        <div class="box box-default">
            <div class="box-header with-border">
                <div class="pull-left">
                    <form action="javascript:void(0)" id="post-filter" method="POST" class="form-inline" role="form">
                        <b>Filter: </b>
                        <div class="form-group">
                            <label class="sr-only" for="">Search Posts</label>
                            {!! Form::select('posts_category_id', $category, null, ['class' => 'form-control', 'placeholder'=>'All']) !!}
                        </div>
                        <div class="form-group">
                            {!! Form::text('title', null, ['placeholder' => 'Post Title', 'class' => 'form-control', 'autocomplete' => 'off']) !!}
                        </div>
                        <button type="submit" class="btn btn-primary">Filter</button>
                        <button href="javascript:void(0)" class="btn btn-default" id="reset">Reset</button>
                    </form>
                </div>
                @can('create', $permissions)
                    <div class="pull-right">
                        <a href="/client/posts/create" class="btn btn-primary btn-flat"><i class="fa fa-plus-circle"></i> Add {{$pageModuleName}}</a>
                    </div>
                @endcan
            </div>
            <div class="box-body">
                <table class="table table-bordered table-striped table-hover" id="post-table" width="100%">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Title</th>
                            <th>Category</th>
                            <th>Author</th>
                            <th>Views</th>
                            <th>Date</th>
                            <th>Action</th>
                        </tr>
                    </thead>
               </table>
            </div>                
        </div>
        @include('Client::logs')
    </section>
@stop
@section('page-js')
<script type="text/javascript">
    $(document).ready(function() {
        var postTable = $('#post-table').DataTable({
            "processing": true,
            "serverSide": true,
            "pagingType": "input",
            "bFilter": false,
            ajax: {
                url:'posts/get-post-data', 
                type: 'POST',
                "data": function(d){
                    d.title = $('#post-filter [name="title"]').val();
                    d.posts_category_id = $('#post-filter [name="posts_category_id"]').val();
                }
            },
            "dom": "<'row'<'col-sm-6'i><'col-sm-6 text-right'l>>" +
                "<'row'<'col-sm-12'tr>>" +
                "<'row'<'col-sm-5'><'col-sm-7'p>>",
            columns: [
                {
                    width:'10px', searchable: false, orderable: false,
                    render: function (data, type, row, meta) {
                        return meta.row + meta.settings._iDisplayStart + 1;
                    }
                },
                { data: 'title', name: 'title' },
                { data: 'category', name: 'category', sortable: false, searchable: false},
                { data: 'author', name: 'author', sortable: false, searchable: false},
                { data: 'pageviews', name: 'pageviews', sortable: true, searchable: false},
                { data: 'date', name: 'date', sortable: true, searchable: false, width:'90px'},
                { data: 'action', name: 'action', orderable: false, searchable: false, width:'60px', className:'text-center'},
            ],
            fnDrawCallback: function ( oSettings ) {
                $('[data-toggle="tooltip"]').tooltip();
                $("#post-table td").on("click", '.deleted', function() {
                    var action = $(this).data('action');
                    swal({
                        title: 'Are you sure you want to delete?',
                        text: "This will be permanently deleted",
                        type: 'warning',
                        showCancelButton: true,
                        confirmButtonColor: '#3085d6',
                        cancelButtonColor: '#d33',
                        confirmButtonText: 'Yes'
                        }).then(function () {                    
                        $.ajax({
                            type: "GET",
                            url: action,
                            dataType: 'json',
                            success: function(data) {
                                if(data.type == "success") {
                                    postTable.draw();
                                    swal(data.message, '', 'success')
                               }else{
                                    swal(data.message, '', 'error')
                               }
                            },
                            error :function( jqXhr ) {
                                swal('Unable to delete.', 'Please try again.', 'error')
                            }
                        });
                    })              
                });            
            },
            "order": [[5, "desc"]],
        });
        $('#post-filter').on('submit', function(){
            postTable.draw();
        });
        $('#reset').on('click', function(event) {
            event.preventDefault();
            $('#post-filter [name="title"]').val('');
            $('#post-filter [name="posts_category_id"]').val('');
            postTable.draw();
        });
    });
</script>
@include('Client::posts.includes.js')
@include('Client::notify')
@stopModules/Client/Views/posts/edit.blade.php000066400000003566152434100730014356 0ustar00@extends('Client::layouts')
@section('page-body')

    <section class="content-header">
         <h1>
            <i class="fa fa-pencil"></i> Edit {{$pageModuleName}}
        </h1>
        <ol class="breadcrumb">
            <li><a href="{{ route(config('modules.client').'.posts.index') }}"><i class="fa fa-{{$pageIcon ? $pageIcon : 'angle-double-right'}}"></i> {{$pageTitle}}</a></li>             
            <li class="active">Edit</li>
        </ol>
    </section>

    <section class="content"> 
        @include('Client::message')
        {!! Form::model($post, array('url' => config('modules.client').'/posts/update/'.$post->hashid, 'method' => 'POST', 'class'=>'form-horizontal', 'role' => 'form' , 'id'=>'post-form', 'files' => true)) !!}
        <div class="row">
            <div class="col-sm-12">
                <div class="box box-primary">
                    <div class="box-header">
                        <h3 class="box-title">@include('Client::all-fields-are-required')</h3>
                    </div>
                    <div class="box-body">
                       @include('Client::posts.includes.form')
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-4 col-md-offset-7">
                <button class="btn btn-flat btn-lg btn-block btn-warning save-btn" data-loading-text="<i class='fa fa-circle-o-notch fa-spin'></i> Saving..." ><i class="fa fa-save"></i> Save Changes</button>
            </div>
        </div>
        {!! Form::close() !!}
        <br>
        @include('Client::logs')
    </section>
    @include('Client::posts.includes.modal-category')
@stop
@section('page-css')
    @include('Client::posts.includes.css')
@stop
@section('page-js')
    @include('Client::posts.includes.js')
    @include('Client::posts.includes.js-modal-category')
    @include('Client::notify')
@stopModules/Client/Views/permission/notActivated.blade.php000066400000045550152434100730017075 0ustar00@extends('Client::layouts',['title'=>'Access Forbidden'])
@section('page-body')    
    <!-- Main content -->
    <section class="content">
        <div class="access-denied-content" style="margin-top:8px;">
            <!-- Speech Bubble -->
            <div class="col-md-6">
                <div class="speech-bubble-inner">
                    <!-- Typing animation occurs -->
                    <div class="typist_dialog"></div>
                </div>
            </div>
            <!-- SVG -->
            <div class="col-md-6">
                <div class="svg-container img-responsive">
                    <svg class="img-responsive" version="1.1" id="object" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
                         width="551.109px" height="482.976px" viewBox="0 0 551.109 482.976" style="enable-background:new 0 0 551.109 482.976;"
                         xml:space="preserve">
                    <rect x="226.217" y="38.292" transform="matrix(-1 -0.0095 0.0095 -1 528.0099 224.6138)" style="fill-rule:evenodd;clip-rule:evenodd;fill:#004964;" width="76.642" height="145.524"/>
                    <rect x="236.794" y="301.182" transform="matrix(1 0.0095 -0.0095 1 3.5619 -2.5946)" style="fill-rule:evenodd;clip-rule:evenodd;fill:#C46C23;" width="76.642" height="145.524"/>
                    <rect x="8.533" y="103.593" style="fill:#3D342F;" width="535.426" height="283.486"/>
                    <g>
                        <g>
                            <polygon style="fill:#EEEFEF;" points="65.228,241.162 121.401,241.162 121.401,143.578 45.138,143.578 45.138,221.071         "/>
                            <polygon style="fill:#DEE9EA;" points="65.228,221.071 65.228,241.162 45.138,221.071         "/>
                            <path style="fill:#535E60;" d="M57.746,207.336h52.379c1.132,0,2.05,0.917,2.05,2.05c0,1.132-0.917,2.05-2.05,2.05H57.746
                                c-1.132,0-2.05-0.918-2.05-2.05C55.695,208.253,56.613,207.336,57.746,207.336z"/>
                            <path style="fill:#535E60;" d="M57.746,195.958h52.379c1.132,0,2.05,0.917,2.05,2.05c0,1.132-0.917,2.05-2.05,2.05H57.746
                                c-1.132,0-2.05-0.918-2.05-2.05C55.695,196.875,56.613,195.958,57.746,195.958z"/>
                            <path style="fill:#535E60;" d="M57.746,184.58h52.379c1.132,0,2.05,0.917,2.05,2.05c0,1.132-0.917,2.05-2.05,2.05H57.746
                                c-1.132,0-2.05-0.918-2.05-2.05C55.695,185.497,56.613,184.58,57.746,184.58z"/>
                            <path style="fill:#535E60;" d="M57.746,173.202h52.379c1.132,0,2.05,0.917,2.05,2.05c0,1.132-0.917,2.05-2.05,2.05H57.746
                                c-1.132,0-2.05-0.918-2.05-2.05C55.695,174.119,56.613,173.202,57.746,173.202z"/>
                            <path style="fill:#535E60;" d="M57.746,161.824h52.379c1.132,0,2.05,0.917,2.05,2.05c0,1.132-0.917,2.05-2.05,2.05H57.746
                                c-1.132,0-2.05-0.918-2.05-2.05C55.695,162.741,56.613,161.824,57.746,161.824z"/>
                        </g>
                        <g>
                            <polygon style="fill:#FFFFFF;" points="57.003,248.85 113.175,248.85 113.175,151.266 36.912,151.266 36.912,228.759       "/>
                            <polygon style="fill:#E3E4E5;" points="57.003,228.759 57.003,248.85 36.912,228.759      "/>
                            <path style="fill:#58595B;" d="M49.52,215.024H101.9c1.132,0,2.05,0.917,2.05,2.05c0,1.132-0.918,2.05-2.05,2.05H49.52
                                c-1.132,0-2.05-0.918-2.05-2.05C47.47,215.941,48.388,215.024,49.52,215.024z"/>
                            <path style="fill:#58595B;" d="M49.52,203.646H101.9c1.132,0,2.05,0.917,2.05,2.05c0,1.132-0.918,2.05-2.05,2.05H49.52
                                c-1.132,0-2.05-0.918-2.05-2.05C47.47,204.563,48.388,203.646,49.52,203.646z"/>
                            <path style="fill:#58595B;" d="M49.52,192.268H101.9c1.132,0,2.05,0.917,2.05,2.05c0,1.132-0.918,2.05-2.05,2.05H49.52
                                c-1.132,0-2.05-0.918-2.05-2.05C47.47,193.185,48.388,192.268,49.52,192.268z"/>
                            <path style="fill:#58595B;" d="M49.52,180.89H101.9c1.132,0,2.05,0.917,2.05,2.05c0,1.132-0.918,2.05-2.05,2.05H49.52
                                c-1.132,0-2.05-0.918-2.05-2.05C47.47,181.807,48.388,180.89,49.52,180.89z"/>
                            <path style="fill:#58595B;" d="M49.52,169.512H101.9c1.132,0,2.05,0.917,2.05,2.05c0,1.132-0.918,2.05-2.05,2.05H49.52
                                c-1.132,0-2.05-0.918-2.05-2.05C47.47,170.429,48.388,169.512,49.52,169.512z"/>
                        </g>
                    </g>
                    <g>
                        <g>
                            <polygon style="fill:#FFFFFF;" points="460.732,272.781 516.904,272.781 516.904,175.198 440.641,175.198 440.641,252.691      "/>
                            <polygon style="fill:#E3E4E5;" points="460.732,252.691 460.732,272.781 440.641,252.691      "/>
                            <path style="fill:#58595B;" d="M453.249,238.955h52.38c1.132,0,2.049,0.917,2.049,2.05c0,1.132-0.917,2.05-2.049,2.05h-52.38
                                c-1.132,0-2.05-0.918-2.05-2.05C451.199,239.872,452.117,238.955,453.249,238.955z"/>
                            <path style="fill:#58595B;" d="M453.249,227.577h52.38c1.132,0,2.049,0.917,2.049,2.05c0,1.132-0.917,2.05-2.049,2.05h-52.38
                                c-1.132,0-2.05-0.918-2.05-2.05C451.199,228.494,452.117,227.577,453.249,227.577z"/>
                            <path style="fill:#58595B;" d="M453.249,216.199h52.38c1.132,0,2.049,0.917,2.049,2.05c0,1.132-0.917,2.05-2.049,2.05h-52.38
                                c-1.132,0-2.05-0.918-2.05-2.05C451.199,217.116,452.117,216.199,453.249,216.199z"/>
                            <path style="fill:#58595B;" d="M453.249,204.822h52.38c1.132,0,2.049,0.917,2.049,2.05c0,1.132-0.917,2.05-2.049,2.05h-52.38
                                c-1.132,0-2.05-0.918-2.05-2.05C451.199,205.739,452.117,204.822,453.249,204.822z"/>
                            <path style="fill:#58595B;" d="M453.249,193.444h52.38c1.132,0,2.049,0.917,2.049,2.05c0,1.132-0.917,2.05-2.049,2.05h-52.38
                                c-1.132,0-2.05-0.918-2.05-2.05C451.199,194.361,452.117,193.444,453.249,193.444z"/>
                        </g>
                        <g>
                            <polygon style="fill:#FFFFFF;" points="432.646,235.367 488.819,235.367 488.819,137.783 412.555,137.783 412.555,215.277      "/>
                            <polygon style="fill:#E3E4E5;" points="432.646,215.277 432.646,235.367 412.555,215.277      "/>
                            <path style="fill:#58595B;" d="M425.163,201.541h52.38c1.132,0,2.049,0.917,2.049,2.05c0,1.132-0.917,2.05-2.049,2.05h-52.38
                                c-1.132,0-2.05-0.918-2.05-2.05C423.113,202.458,424.031,201.541,425.163,201.541z"/>
                            <path style="fill:#58595B;" d="M425.163,190.163h52.38c1.132,0,2.049,0.917,2.049,2.05c0,1.132-0.917,2.05-2.049,2.05h-52.38
                                c-1.132,0-2.05-0.918-2.05-2.05C423.113,191.08,424.031,190.163,425.163,190.163z"/>
                            <path style="fill:#58595B;" d="M425.163,178.785h52.38c1.132,0,2.049,0.917,2.049,2.05c0,1.132-0.917,2.05-2.049,2.05h-52.38
                                c-1.132,0-2.05-0.918-2.05-2.05C423.113,179.702,424.031,178.785,425.163,178.785z"/>
                            <path style="fill:#58595B;" d="M425.163,167.407h52.38c1.132,0,2.049,0.917,2.049,2.05c0,1.132-0.917,2.05-2.049,2.05h-52.38
                                c-1.132,0-2.05-0.918-2.05-2.05C423.113,168.324,424.031,167.407,425.163,167.407z"/>
                            <path style="fill:#58595B;" d="M425.163,156.03h52.38c1.132,0,2.049,0.917,2.049,2.05c0,1.132-0.917,2.05-2.049,2.05h-52.38
                                c-1.132,0-2.05-0.918-2.05-2.05C423.113,156.947,424.031,156.03,425.163,156.03z"/>
                        </g>
                    </g>
                    <g>
                        <polygon style="fill:#FFFFFF;" points="292.431,193.695 236.258,193.695 236.258,291.279 312.521,291.279 312.521,213.786  "/>
                        <polygon style="fill:#E3E4E5;" points="292.431,213.786 292.431,193.695 312.521,213.786  "/>
                        <path style="fill:#58595B;" d="M299.913,227.522h-52.379c-1.132,0-2.05-0.917-2.05-2.05c0-1.132,0.918-2.05,2.05-2.05h52.379
                            c1.132,0,2.05,0.918,2.05,2.05C301.963,226.605,301.045,227.522,299.913,227.522z"/>
                        <path style="fill:#58595B;" d="M299.913,238.9h-52.379c-1.132,0-2.05-0.917-2.05-2.05c0-1.132,0.918-2.05,2.05-2.05h52.379
                            c1.132,0,2.05,0.918,2.05,2.05C301.963,237.983,301.045,238.9,299.913,238.9z"/>
                        <path style="fill:#58595B;" d="M299.913,250.278h-52.379c-1.132,0-2.05-0.917-2.05-2.05c0-1.132,0.918-2.05,2.05-2.05h52.379
                            c1.132,0,2.05,0.918,2.05,2.05C301.963,249.361,301.045,250.278,299.913,250.278z"/>
                        <path style="fill:#58595B;" d="M299.913,261.655h-52.379c-1.132,0-2.05-0.917-2.05-2.05c0-1.132,0.918-2.05,2.05-2.05h52.379
                            c1.132,0,2.05,0.918,2.05,2.05C301.963,260.738,301.045,261.655,299.913,261.655z"/>
                        <path style="fill:#58595B;" d="M299.913,273.033h-52.379c-1.132,0-2.05-0.917-2.05-2.05c0-1.132,0.918-2.05,2.05-2.05h52.379
                            c1.132,0,2.05,0.918,2.05,2.05C301.963,272.116,301.045,273.033,299.913,273.033z"/>
                    </g>
                    <path style="fill-rule:evenodd;clip-rule:evenodd;fill:#F4DDC0;" d="M236.515,282.613c-0.75,1.672-1.619,3.72-2.668,6.132
                        l7.912-5.322c3.347-2.251,5.662,0.485,6.198,2.383l-16.783,13.193c-2.34,1.839-6.78,1.354-10.609-0.158
                        c-7.919-3.127-10.521-10.27-6.075-21.069l1.79-8.985c0.786-3.781,6.121-2.633,5.296,1.18l-0.811,3.752
                        c0.218-0.123,0.513-0.209,0.785-0.273l2.361-7.191c1.18-3.722,6.176-1.623,5.211,1.514l-1.847,6c0.16,0.03,0.46,0.151,0.569,0.193
                        l2.965-7.408c1.337-3.342,6.367-1.273,5.029,2.039l-3.439,8.582c0.177,0.213,0.343,0.434,0.503,0.658l8.637-16.408
                        c1.644-3.122,6.504-0.707,4.792,2.548L236.515,282.613z"/>
                    <path style="fill:#F26E25;" d="M210.34,368.09c-1.234-19.22,7.665-39.62,18.006-59.368l-2.151-1.123l4.335-8.27l-18.755-9.829
                        l-4.348,8.295l-1.234-0.645c-12.074,23.058-22.437,47.321-20.814,72.583c1.673,26.049,15.707,51.616,52.696,75.182l13.463-21.133
                        C222.466,405.262,211.525,386.525,210.34,368.09z"/>
                    <path style="fill-rule:evenodd;clip-rule:evenodd;fill:#F4DDC0;" d="M306.98,282.613c0.75,1.672,1.619,3.72,2.668,6.132
                        l-7.911-5.322c-3.348-2.251-5.662,0.485-6.198,2.383l16.783,13.193c2.34,1.839,6.78,1.354,10.609-0.158
                        c7.919-3.127,10.521-10.27,6.075-21.069l-1.789-8.985c-0.786-3.781-6.121-2.633-5.297,1.18l0.811,3.752
                        c-0.218-0.123-0.513-0.209-0.785-0.273l-2.36-7.191c-1.181-3.722-6.177-1.623-5.212,1.514l1.847,6
                        c-0.159,0.03-0.46,0.151-0.568,0.193l-2.966-7.408c-1.337-3.342-6.366-1.273-5.028,2.039l3.438,8.582
                        c-0.177,0.213-0.343,0.434-0.503,0.658l-8.637-16.408c-1.645-3.122-6.504-0.707-4.792,2.548L306.98,282.613z"/>
                    <path style="fill:#F26E25;" d="M337.303,297.151l-1.234,0.645l-4.349-8.295l-18.755,9.829l4.335,8.27l-2.151,1.123
                        c10.341,19.748,19.24,40.148,18.006,59.368c-1.185,18.435-12.127,37.172-41.197,55.692l13.463,21.133
                        c36.99-23.565,51.023-49.133,52.697-75.182C359.739,344.472,349.376,320.208,337.303,297.151z"/>
                    <ellipse style="fill-rule:evenodd;clip-rule:evenodd;fill:#F26E25;" cx="271.724" cy="420.078" rx="54.374" ry="28.334"/>
                    <path style="fill-rule:evenodd;clip-rule:evenodd;fill:#4B2505;" d="M271.41,390.169c8.557-2.366,17.352-1.813,25.215,1.138
                        c-6.039,0.534-9.088-0.005-13.609,2.389c10.141,0.857,15.484-0.475,24.289,6.018c-7.461-1.466-10.511-1.046-12.602,0.216
                        c14.031,6.173,21.773,20.614,22.178,35.311c0.56,20.312-13.586,40.892-45.134,40.892c-31.547,0-46.772-21.293-45.068-42.912
                        c0.984-12.483,8.307-24.866,22.9-32.839c-2.095-1.253-5.146-1.66-12.603-0.166c8.779-6.525,14.129-5.215,24.267-6.114
                        c-4.532-2.374-7.579-1.823-13.621-2.335C255.04,388.951,263.297,388.27,271.41,390.169z"/>
                    <g>
                        <path style="fill-rule:evenodd;clip-rule:evenodd;fill:#F4DDC0;" d="M306.339,189.634c0.75-1.672,1.619-3.72,2.668-6.132
                            l-7.911,5.322c-3.348,2.251-5.662-0.485-6.198-2.383l16.783-13.193c2.34-1.839,6.78-1.355,10.609,0.158
                            c7.92,3.127,10.522,10.27,6.075,21.069l-1.789,8.985c-0.786,3.781-6.121,2.633-5.296-1.18l0.811-3.752
                            c-0.218,0.123-0.513,0.209-0.785,0.273l-2.36,7.191c-1.181,3.722-6.177,1.623-5.212-1.514l1.848-6
                            c-0.16-0.03-0.461-0.151-0.569-0.193l-2.966,7.408c-1.337,3.342-6.366,1.274-5.028-2.039l3.439-8.582
                            c-0.177-0.213-0.343-0.434-0.503-0.658l-8.637,16.408c-1.645,3.122-6.504,0.707-4.792-2.548L306.339,189.634z"/>
                        <path style="fill:#005371;" d="M330.96,119.195c1.234,19.22-7.713,24.394-18.054,44.142l2.15,1.123l-4.334,8.27l18.755,9.829
                            l4.349-8.295l1.234,0.645c12.073-23.058,22.484-32.096,20.862-57.357c-1.673-26.049-15.707-51.616-52.696-75.182l-13.463,21.133
                            C318.834,82.023,329.776,100.76,330.96,119.195z"/>
                    </g>
                    <path style="fill-rule:evenodd;clip-rule:evenodd;fill:#F4DDC0;" d="M232.673,202.384c-0.75-1.672-1.619-3.72-2.668-6.132
                        l7.911,5.322c3.348,2.251,5.662-0.485,6.198-2.383l-16.783-13.193c-2.34-1.839-6.78-1.355-10.609,0.158
                        c-7.919,3.127-10.521,10.27-6.075,21.069l1.789,8.985c0.786,3.781,6.121,2.633,5.297-1.18l-0.811-3.752
                        c0.218,0.123,0.513,0.209,0.785,0.273l2.36,7.191c1.181,3.722,6.177,1.623,5.212-1.514l-1.847-6c0.159-0.03,0.46-0.151,0.568-0.193
                        l2.966,7.408c1.337,3.342,6.366,1.274,5.028-2.039l-3.438-8.582c0.177-0.213,0.343-0.434,0.503-0.658l8.637,16.408
                        c1.645,3.122,6.504,0.707,4.792-2.548L232.673,202.384z"/>
                    <path style="fill:#005371;" d="M202.35,187.847l1.234-0.645l4.349,8.295l18.755-9.829l-4.335-8.27l2.151-1.123
                        c-10.341-19.748-19.24-40.148-18.005-59.368c1.185-18.435,12.127-37.172,41.197-55.692l-13.463-21.133
                        c-36.99,23.565-51.023,49.133-52.697,75.182C179.914,140.526,190.277,164.79,202.35,187.847z"/>
                    <ellipse style="fill-rule:evenodd;clip-rule:evenodd;fill:#005371;" cx="267.93" cy="64.92" rx="54.374" ry="28.334"/>
                    <path style="fill-rule:evenodd;clip-rule:evenodd;fill:#592D09;" d="M268.242,94.829c-8.556,2.366-17.352,1.813-25.214-1.138
                        c6.039-0.534,9.088,0.005,13.609-2.389c-10.141-0.857-15.484,0.475-24.289-6.018c7.461,1.466,10.511,1.046,12.602-0.216
                        c-14.031-6.173-21.773-20.614-22.178-35.312c-0.561-20.312,13.586-40.892,45.134-40.892c31.547,0,46.771,21.293,45.068,42.912
                        c-0.984,12.482-8.308,24.866-22.9,32.839c2.094,1.253,5.145,1.66,12.603,0.166c-8.779,6.525-14.129,5.215-24.267,6.114
                        c4.531,2.374,7.578,1.823,13.621,2.335C284.613,96.047,276.357,96.728,268.242,94.829z"/>
                    <path style="display:none;fill:#3498DB;" d="M191.033,37.931l-10.662-27.094c4.352-8.988,6.715-18.598,6.715-28.587
                        c0-50.117-59.31-90.746-132.473-90.746c-73.162,0-132.472,40.628-132.472,90.746s59.31,90.746,132.472,90.746
                        c45.852,0,86.261-15.959,110.041-40.21L191.033,37.931z"/>
                    <path style="fill:#E74C3C;" d="M291.833,224.39c-0.02-0.022-0.039-0.045-0.06-0.066c-0.045-0.045-0.093-0.087-0.142-0.127
                        c-4.505-4.249-10.574-6.858-17.241-6.858c-13.867,0-25.148,11.282-25.148,25.15c0,6.664,2.607,12.73,6.853,17.234
                        c0.041,0.051,0.084,0.101,0.131,0.148c0.025,0.024,0.05,0.046,0.076,0.069c4.577,4.742,10.994,7.697,18.088,7.697
                        c13.866,0,25.147-11.281,25.147-25.148C299.538,235.388,296.58,228.967,291.833,224.39z M274.39,220.779
                        c5.168,0,9.92,1.817,13.652,4.844l-30.516,30.516c-3.027-3.732-4.843-8.483-4.844-13.651
                        C252.682,230.518,262.42,220.779,274.39,220.779z M274.39,264.196c-5.565,0-10.648-2.107-14.494-5.563l30.64-30.64
                        c3.456,3.846,5.562,8.929,5.562,14.495C296.098,254.458,286.36,264.196,274.39,264.196z"/>
                    <path style="display:none;fill:#3498DB;" d="M152.032,130.978l-21.707,55.159c8.86,18.299,13.67,37.863,13.67,58.199
                        c0,102.032-120.747,184.746-269.696,184.746c-148.948,0-269.695-82.714-269.695-184.746S-274.648,59.591-125.7,59.591
                        c93.349,0,175.615,32.491,224.028,81.862L152.032,130.978z"/>
                    </svg>
                </div>
            </div>
            <div class="write-ups">
                <div class="alert alert-success">
                    <ul class="fa-ul">
                        <li>
                            <i class="fa fa-exclamation-triangle fa-lg fa-li" aria-hidden="true"></i>
                            If you think this is an error. Please contact your MyRA DH Administrator or Quantum X at <a href="mailto:iris@quantumx.com." style="text-decoration:none;"><b>iris@quantumx.com</b></a>.                            
                        </li>
                    </ul>
                 </div>
            </div>
        </div>
    </section>
@stop
@section('page-css')
<link href="{{ get_template('css/notActivated.css') }}" rel="stylesheet" type="text/css" />
@stop
@section('page-js')
<script type="text/javascript" src="{{ get_template('js/jquery.typist.js') }}"></script>
<script type="text/javascript">
jQuery(function($) {
    var dialog = [
        {   
            line: 'one',
            text: 'Your MyRA DH Administrator'
        },
        {
            line: 'two',
            text: 'has not given you permission'
        },                  
        {
            line: 'three',
            text: 'to access this page.'
        }, 
    ];
    function printPhrase() {
        var phrase = dialog.shift();
        if ( !phrase ) {
            return;
        }
        $('<p>')
            .addClass('type-' + phrase.line)
            .appendTo('.typist_dialog')
            .typist({
                text: phrase.text,
                speed: 20
            })
            .typistPause(1)
            .typistStop()
            .on('end_pause.typist', function() {
                printPhrase();
            });
    }
    printPhrase();
});
</script>
@stopModules/Client/Repositories/Principals/ContactNumberRepositoryInterface.php000066400000000157152434100730023367 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Principals;

interface ContactNumberRepositoryInterface
{

}Modules/Client/Repositories/Principals/ContactPersonRepositoryInterface.php000066400000000157152434100730023405 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Principals;

interface ContactPersonRepositoryInterface
{

}Modules/Client/Repositories/Principals/ContactPersonRepository.php000066400000003457152434100730021572 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Principals;

use DB;
use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Principals\ContactPerson;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;

class ContactPersonRepository extends AbstractRepository implements ContactPersonRepositoryInterface
{
    protected $model;
    protected $log;

    function __construct(ContactPerson $model, Log $log)
    {
        $this->model = $model;
        $this->log = $log;
    }


    public function create(array $request)
    {
        $user = auth()->user();
        $model = $this->model->fill($request);
        $model->save();
        $this->log->saveLog(['action' => 'Create', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id, 'sub_menu' => 'Contacts-'.$model->principal_id]);
        return $model;
    }

    public function update($id, array $request)
    {
        $user = auth()->user();
        $model = $this->model->find($id);
        $model->fill($request);

        if($model->isDirty()) {
            $model->save();
            session()->flash('success', 'Successfully updated.');
            $this->log->saveLog(['action' => 'Update', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id, 'sub_menu' => 'Contacts-'.$model->principal_id]);
        }
        return $model;
    }

    public function delete($id)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        $model->numbers()->delete();
        $model->delete();
        $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id, 'sub_menu' => 'Contacts-'.$model->principal_id]);
        return $this->getAjaxResponse('success', 'Successfully deleted.');
    }
}Modules/Client/Repositories/Principals/PrincipalRepository.php000066400000005432152434100730020724 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Principals;

use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Repositories\Principals\PrincipalRepositoryInterface;
use QxCMS\Modules\Client\Models\Principals\Principal;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;
use DB;

class PrincipalRepository extends AbstractRepository implements PrincipalRepositoryInterface
{
    protected $model;
    protected $log;

    function __construct(Principal $model, Log $log)
    {
        $this->model = $model;
        $this->log = $log;
    }

    public function getPrincipalStatusLists()
    {
        return $this->model->principal_status;
    }

    public function create(array $request)
    {
        $user = auth()->user();
        $model = $this->model->fill($request);
        $model->save();
        $this->log->saveLog(['action' => 'Create', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $model;
    }

    public function update($id, array $request)
    {
        $user = auth()->user();
        $model = $this->model->find($id);
        $model->fill($request);
        if($model->isDirty()) {
            $model->save();
            session()->flash('success', 'Successfully updated.');
            $this->log->saveLog(['action' => 'Update', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        }
        return $model;
    }

    public function delete($id)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        $model->contacts->each(function($value){
            $value->numbers()->delete();
        });

        $model->contacts()->delete();
        $model->delete();
        $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $this->getAjaxResponse('success', 'Successfully deleted.');
    }


    public function select2($params = array())
    {
        if(!isset($params['name'])) $params['name'] = '';
        $model = $this->model
                        ->select(['name as text', 'id'])
                        ->searchByName($params['name'])
                        ->get();

        if(isset($params['placeholder'])) {
            $placeholder = array('text' => ' - All -', 'id' => '-1');
            if(isset($params['placeholder']['text'])) $placeholder = array('text' => $params['placeholder']['text'], 'id' => '-1');
             
            return  response(
                   array_prepend($model->toArray(), $placeholder)
                )->header('Content-Type', 'application/json');
        }
       
        return  response(
                       $model->toArray()
                    )->header('Content-Type', 'application/json');

       
    }
}Modules/Client/Repositories/Principals/PrincipalRepositoryInterface.php000066400000000153152434100730022540 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Principals;

interface PrincipalRepositoryInterface
{

}Modules/Client/Repositories/Principals/ContactNumberRepository.php000066400000001745152434100730021552 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Principals;

use DB;
use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Principals\ContactNumber;

class ContactNumberRepository extends AbstractRepository implements ContactNumberRepositoryInterface
{
    protected $model;

    function __construct(ContactNumber $model)
    {
        $this->model = $model;
    }


    public function create(array $request)
    {
        $model = $this->model->create($request);
        return $model;
    }

    public function update($id, array $request)
    {
        $model = $this->model->find($id);
        $model->fill($request);

        if($model->isDirty()) {
            $model->save();
          //  session()->flash('success', 'Successfully updated.');
        }
        return $model;
    }

    public function delete($id)
    {
        $model = $this->findById($id);
        $model->delete();
        return $this->getAjaxResponse('success', 'Successfully deleted.');
    }
}Modules/Client/Repositories/Subject/SubjectRepositoryInterface.php000066400000000152152434100730021510 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Subject;

interface SubjectRepositoryInterface
{
    
}Modules/Client/Repositories/Subject/SubjectRepository.php000066400000004302152434100730017670 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Subject;

use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Subject\Subject;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;

class SubjectRepository extends AbstractRepository implements SubjectRepositoryInterface
{
    protected $model;
    protected $log;

    function __construct(Subject $model, Log $log)
    {
        $this->model = $model;
        $this->log = $log;
    }

    
    public function create(array $request)
    {
        $user = auth()->user();
        $model = $this->model->fill($this->_serialize($request));
        $model->save();
        $this->log->saveLog(['action' => 'Create', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $model;
    }

    public function _serialize(array $request)
    {
        return $request;
    }

    public function update($id, array $request)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        $model->fill($this->_serialize($request));
        if(count($model->getDirty()) > 0) {
            $model->save();
            session()->flash('success', 'Successfully updated.');
            $this->log->saveLog(['action' => 'Update', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        }

        return $model;
    }

    public function delete($id)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        $model->delete();
        $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $this->getAjaxResponse('success', 'Successfully deleted.');
    }


    public function datatablesIndex()
    {
        return $this->model->with(['principal', 'template', 'fieldOfficer', 'editor'])->select(['*']);
    }


    /*
    
    API REQUEST
     */
    public function apiGetSubject(array $request)
    {
        if(!isset($request['user_id'])) return array();
        return $this->model->with(['principal', 'template', 'template.questions', 'template.questions.answers'])->where('field_officer_assigned', $request['user_id'])->get();
    }
}Modules/Client/Repositories/JobOpening/JobOpeningRepositoryInterface.php000066400000000154152434100730022600 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\JobOpening;

interface JobOpeningRepositoryInterface
{

}Modules/Client/Repositories/JobOpening/JobOpeningRepository.php000064400000005625152434100730020765 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\JobOpening;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Illuminate\Http\Request;

use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\JobOpening\JobOpening;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;



class JobOpeningRepository extends AbstractRepository implements JobOpeningRepositoryInterface
{
    protected $model;
    protected $log;

    function __construct(JobOpening $model, Log $log)
    {
        $this->model = $model;
        $this->log = $log;
    }

    public function create(Request $request)
    {
        $user = auth()->user();
        $model = $this->model->fill($request->all());
        $model->slug = Str::slug($request->position);
        $model->save();
        $this->log->saveLog(['action' => 'Create', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $model;
    }

    public function update($id, Request $request)
    {
        $model = $this->findById($id);
        $user = auth()->user();
        $model->fill($request->all());
        $model->slug = Str::slug($request->position);

        if(count($model->getDirty()) > 0) {
            $model->save();
            session()->flash('success', 'Successfully updated.');
            $this->log->saveLog(['action' => 'Update', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        }
        return $model;
    }

    public function delete($id)
    {
        $model = $this->findById($id);
        $user = auth()->user();
        $model->delete();
        $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);

        return $this->getAjaxResponse('success', 'Successfully deleted.');
    }

    public function getAllJob($limit = 10)
    {
        $job = $this->model;
        return $this->getActiveJob($job)->latest()->paginate($limit);
    }

    public function getLatestJob($limit = 10)
    {
        $job = $this->model;
        return $this->getActiveJob($job)->latest()->take($limit)->get();
    }

     protected function getActiveJob($model)
    {
        $date_today = Carbon::now();
        return $model
            ->where('opening_date', '<=', $date_today)
            ->where('status', 'Open')
            ->where(function($query) use ($date_today){
                $query->orWhere('closing_date', '>', $date_today);
                $query->orWhere('closing_date', '=', '0000-00-00');
            });    
    }

    public function findBySlug($slug)
    {
        return $this->model->where('slug', '=', $slug)->get();
    }


    public function apiGetJobOpening(array $request)
    {
        // $job = $this->model->with(['country'])->where('status', 'Open')->orderBy('opening_date', 'desc')->get();
        return $this->model->with(['country'])->where('status', 'Open')->get();
    }
}Modules/Client/Repositories/Officers/OfficerRepositoryInterface.php000066400000000153152434100730021630 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Officers;

interface OfficerRepositoryInterface
{
    
}Modules/Client/Repositories/Officers/OfficerRepository.php000064400000005334152434100730020013 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Officers;
use Illuminate\Support\Arr;
use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Likod\Models\Clients\User;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;

class OfficerRepository extends AbstractRepository implements OfficerRepositoryInterface
{
    protected $model;
    protected $log;
    protected $module_id = 10;

    function __construct(User $model, Log $log)
    {
        $this->model = $model;
        $this->log = $log;
    }

    
    public function create(array $request)
    {
        $user = auth()->user();
        $model = $this->model->fill($this->_serialize($request));
        $model->is_sub_user = 'Yes';
        $model->client_id = auth()->user()->client_id;
        $model->save();
        $this->log->saveLog(['action' => 'Create', 'module_id' => $this->module_id, 'user_id' => $user->id, 'data_id' => $model->id]);
        return $model;
    }

    public function _serialize(array $request)
    {
        $confirm_password = isset($request['password_confirmation']) ? $request['password_confirmation'] : '';
        if(!empty($confirm_password)) {
            $request['password'] = bcrypt($confirm_password);
            return $request;
        } else {
            return Arr::except($request, ['password_confirmation','password']);
        }
      
    }

    public function update($id, array $request)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        $model->fill($this->_serialize($request));
        if(count($model->getDirty()) > 0) {
            $model->save();
            session()->flash('success', 'Successfully updated.');
            $this->log->saveLog(['action' => 'Update', 'module_id' => $this->module_id, 'user_id' => $user->id, 'data_id' => $model->id]);
        }

        return $model;
    }

    public function delete($id)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        $model->delete();
        $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->module_id, 'user_id' => $user->id, 'data_id' => $model->id]);
        return $this->getAjaxResponse('success', 'Successfully deleted.');
    }


    public function datatablesIndex()
    {
        return $this->model->where('client_id', auth()->user()->client->id)->isSubUser()->select(['*']);
    }

    public function getAccessTypes()
    {
        return [
            'Field Officer' => 'Field Officer',
            'Editor' => 'Editor'
        ];
    }

    /*
    
    API REQUEST
     */
    public function apiGetSubject(array $request)
    {
        if(!isset($request['user_id'])) return array();
        return $this->model->where('field_officer_assigned', $request['user_id'])->get();
    }
}Modules/Client/Repositories/Pages/AboutUsRepository.php000064400000004204152434100730017312 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Pages;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Pages\AboutUs;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;

class AboutUsRepository extends AbstractRepository implements AboutUsRepositoryInterface
{
    protected $model;
    protected $log;

    function __construct(AboutUs $model, Log $log)
    {
        $this->model = $model;
        $this->log = $log;
    }

    public function create(Request $request)
    {
        $user = auth()->user();
        $model = $this->model->fill($request->all());
        $title = explode(" ", $request->title);
        $sliced_title = implode(" ", array_splice($title, 0, 15));
        $model->slug = Str::slug($sliced_title);
        $model->save();

        $this->log->saveLog(['action' => 'Create', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $model;
    }

    public function update($id, Request $request)
    {
        $model = $this->findById($id);
        $user = auth()->user();
        $model->fill($request->all());
        $title = explode(" ", $request->title);
        $sliced_title = implode(" ", array_splice($title, 0, 15));
        $model->slug = Str::slug($sliced_title);

        if(count($model->getDirty()) > 0) {
            $model->save();
            session()->flash('success', 'Successfully updated.');
            $this->log->saveLog(['action' => 'Update', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        }
        return $model;
    }

    public function delete($id)
    {
        $model = $this->findById($id);
        $user = auth()->user();
        $model->delete();
        $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);

        return $this->getAjaxResponse('success', 'Successfully deleted.');
    }

    public function apiGetAboutUs(array $request)
    {
        return $this->model->where('status', 'Publish')->orderBy('title', 'asc')->get();
    }
}Modules/Client/Repositories/Pages/PagesRepository.php000064400000004144152434100730016772 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Pages;
use Illuminate\Support\Str;
use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Posts\Posts;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;
use Illuminate\Http\Request;

class PagesRepository extends AbstractRepository implements PagesRepositoryInterface
{
    protected $model;
    protected $log;
    protected $module_id = 12;

    function __construct(Posts $model, Log $log)
    {
        $this->model = $model;
        $this->log = $log;
    }
    
    public function create(Request $request)
    {
        $user = auth()->user();
        $model = $this->model->fill($request->all());
        $model->author_id = $user->id;
        $model->slug = Str::slug($request['title']);
        $model->post_type = 'Page';

        $model->save();
        $this->log->saveLog(['action' => 'Create', 'module_id' => $this->module_id, 'user_id' => $user->id, 'data_id' => $model->id]);
        return $model;
    }

    public function update($id, Request $request)
    {
        $model = $this->findById($id);
        $user = auth()->user();
        $model->fill($request->all());
        $model->slug = Str::slug($request['title']);

        if(count($model->getDirty()) > 0) {
            $model->save();
            session()->flash('success', 'Successfully edited.');
            $this->log->saveLog(['action' => 'Update', 'module_id' => $this->module_id, 'user_id' => $user->id, 'data_id' => $model->id]);
        }
        return $model;
    }

    public function delete($id)
    {
        $model = $this->findById($id);
        $user = auth()->user();
        $model->delete();
        $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->module_id, 'user_id' => $user->id, 'data_id' => $model->id]);

        return $this->getAjaxResponse('success', 'Successfully deleted.');
    }

    public function pagesList($id)
    {
        return
        $this
        ->model
        ->where('post_type', '=', 'Page')
        ->where('id', '<>', $id)
        ->orderBy('title','asc')
        ->pluck('title', 'id')
        ->toArray();
    }
}Modules/Client/Repositories/Pages/FAQRepositoryInterface.php000066400000000140152434100730020155 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Pages;

interface FAQRepositoryInterface
{

}Modules/Client/Repositories/Pages/ContactUsRepository.php000066400000003422152434100730017636 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Pages;

use Illuminate\Http\Request;
use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Pages\ContactUs;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;

class ContactUsRepository extends AbstractRepository implements ContactUsRepositoryInterface
{
    protected $model;
    protected $log;

    function __construct(ContactUs $model, Log $log)
    {
        $this->model = $model;
        $this->log = $log;
    }

    public function create(Request $request)
    {
        $user = auth()->user();
        $model = $this->model->fill($request->all());
        $model->save();

        $this->log->saveLog(['action' => 'Create', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $model;
    }

    public function update($id, Request $request)
    {
        $model = $this->findById($id);
        $user = auth()->user();
        $model->fill($request->all());

        if(count($model->getDirty()) > 0) {
            $model->save();
            session()->flash('success', 'Successfully updated.');
            $this->log->saveLog(['action' => 'Update', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        }
        return $model;
    }

    public function delete($id)
    {
        $model = $this->findById($id);
        $user = auth()->user();
        $model->delete();
        $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);

        return $this->getAjaxResponse('success', 'Successfully deleted.');
    }

    public function apiGetContactUs(array $request)
    {
        return $this->model->where('status', 'Publish')->get();
    }
}Modules/Client/Repositories/Pages/FAQRepository.php000064400000004170152434100730016341 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Pages;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Pages\FAQ;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;

class FAQRepository extends AbstractRepository implements FAQRepositoryInterface
{
    protected $model;
    protected $log;

    function __construct(FAQ $model, Log $log)
    {
        $this->model = $model;
        $this->log = $log;
    }

    public function create(Request $request)
    {
        $user = auth()->user();
        $model = $this->model->fill($request->all());
        $title = explode(" ", $request->title);
        $sliced_title = implode(" ", array_splice($title, 0, 15));
        $model->slug = Str::slug($sliced_title);
        $model->save();
        
        $this->log->saveLog(['action' => 'Create', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $model;
    }

    public function update($id, Request $request)
    {
        $model = $this->findById($id);
        $user = auth()->user();
        $model->fill($request->all());
        $title = explode(" ", $request->title);
        $sliced_title = implode(" ", array_splice($title, 0, 15));
        $model->slug = Str::slug($sliced_title);

        if(count($model->getDirty()) > 0) {
            $model->save();
            session()->flash('success', 'Successfully updated.');
            $this->log->saveLog(['action' => 'Update', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        }
        return $model;
    }

    public function delete($id)
    {
        $model = $this->findById($id);
        $user = auth()->user();
        $model->delete();
        $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);

        return $this->getAjaxResponse('success', 'Successfully deleted.');
    }

    public function apiGetFAQ(array $request)
    {
        return $this->model->where('status', 'Publish')->orderBy('title', 'asc')->get();
    }
}Modules/Client/Repositories/Pages/AboutUsRepositoryInterface.php000066400000000144152434100730021134 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Pages;

interface AboutUsRepositoryInterface
{

}Modules/Client/Repositories/Pages/PagesRepositoryInterface.php000066400000000142152434100730020607 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Pages;

interface PagesRepositoryInterface
{

}Modules/Client/Repositories/Pages/ContactUsRepositoryInterface.php000066400000000146152434100730021457 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Pages;

interface ContactUsRepositoryInterface
{

}Modules/Client/Repositories/Settings/Users/UserRepository.php000064400000014652152434100730020520 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Settings\Users;

use Carbon\Carbon;
use Illuminate\Http\Request;
use QxCMS\Modules\AbstractRepository;
use Illuminate\Support\Arr;
use QxCMS\Modules\Likod\Models\Clients\User;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs;
use QxCMS\Modules\Client\Models\Settings\LoginLogs\LoginLogs;
use QxCMS\Modules\Client\Repositories\Settings\Users\UserRepositoryInterface;

class UserRepository extends AbstractRepository implements UserRepositoryInterface
{
    protected $model;
    protected $log;
    protected $loginlogs;

    function __construct(User $model, UserLogs $log, LoginLogs $loginlogs)
    {
        $this->model = $model;
        $this->log = $log;
        $this->loginlogs = $loginlogs;
    }

    public function tokenInputLists()
    {
        return $this->model->select('id', 'name')->where('status', '1');
    }

    public function create(array $request)
    {
        $user = auth()->user();
        $model = $this->model->fill($this->makeUser($request));
        $model->save();
        $this->log->saveLog(['action' => 'Create', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $model;
    }

    public function makeUser(array $request)
    {
        $request['client_id'] = auth('client')->user()->client->id;
        $request['password'] = bcrypt($request['password_confirmation']);
        return $request;
    }

    public function update($id, array $request)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        $model->fill($this->changePassword($request));
        if(count($model->getDirty()) > 0) {
            $model->save();
            session()->flash('success', 'Successfully updated.');
            $this->log->saveLog(['action' => 'Update', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        }
        return $model;
    }

    public function changePassword(array $request)
    {
        $confirm_password = $request['password_confirmation'];
        if(!empty($confirm_password)) {
            $request['password'] = bcrypt($confirm_password);
            return $request;
        }
        return  Arr::except($request, ['password_confirmation','password']);
    }

    public function delete($id)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        if($model->type_id == 1) {
            return $this->getAjaxResponse('error', 'Primary user connot be deleted.');
        }
        $model->delete();
        $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $this->getAjaxResponse('success', 'Successfully deleted.');
    }


    public function select2($params = array())
    {
        if(!isset($params['name'])) $params['name'] = '';
        if(!isset($params['user_type'])) $params['user_type'] = '';
        $model = $this->model
                        ->select(['name as text', 'id'])
                        ->searchUserType($params['user_type'])
                        ->searchByName($params['name'])
                        ->get();

        if(isset($params['placeholder'])) {
            $placeholder = array('text' => ' - All -', 'id' => '-1');
            if(isset($params['placeholder']['text'])) $placeholder = array('text' => $params['placeholder']['text'], 'id' => '-1');
             
            return  response(array_prepend($model->toArray(), $placeholder))
                            ->header('Content-Type', 'application/json');
        }
        return  response($model->toArray())
                        ->header('Content-Type', 'application/json');
    }

    public function datatablesIndex($params = array())
    {
        $roleIds = array();
        if(auth()->user()->role_id != $params['developer_id'])
        {
            $roleIds = $params['hiddenRoleIds'];
        }

        return $this->model
        ->select(['id', 'role_id', 'name', 'email', 'status'])
        ->with('role')
        ->where('client_id', auth()->user()->client->id)
        ->filterUsersByRole($roleIds)
        ->isNotSubUser();
    }

    public function userLists()
    {
        return $this->model->orderBy('name','asc')->clientUser()->pluck('name', 'id')->toArray();
    }

    public function searchUserUsername($id)
    {
        return $this->model->find($id);
    }

    public function getUserLogType(Request $request)
    {
        if($request->report_type == 1){
             return 'Add, Edit, Delete of Data';
         }else{
            return 'User Access Logs';
         }
    }

    public function getUserLogDate(Request $request)
    {
        $start = Carbon::createFromFormat('Y-m-d', $request->start_date)->format('M j, Y');
        $end = Carbon::createFromFormat('Y-m-d', $request->end_date)->format('M j, Y');
        return $start.' - '.$end;
    }

    public function getUserLog(Request $request)
    {
        if($request->report_type == 1){
             return $this->log->with('user', 'module')->select('*');
         }else if($request->report_type == 2){
            return $this->loginlogs->select('*');
         }
    }

    public function getUserLogCount(Request $request)
    {
        if($request->report_type == 1){
            if($request->user_id == ''){
                return $this->log->with('user')->whereRaw("date_format(created_at, '%Y-%m-%d') >= '{$request->start_date}'")
                ->whereRaw("date_format(created_at, '%Y-%m-%d') <= '{$request->end_date}'")->count();
            }else{
                return $this->log->with('user')->where('user_id', $request->user_id)->whereRaw("date_format(created_at, '%Y-%m-%d') >= '{$request->start_date}'")
                ->whereRaw("date_format(created_at, '%Y-%m-%d') <= '{$request->end_date}'")->count();
            }
        }else if($request->report_type == 2){
            if($request->user_id == ''){
                return $this->loginlogs->whereRaw("date_format(created_at, '%Y-%m-%d') >= '{$request->start_date}'")
                ->whereRaw("date_format(created_at, '%Y-%m-%d') <= '{$request->end_date}'")->count();
            }else{
                $user = $this->model->find($request->user_id);
                return $this->loginlogs->where('username', $user->email)->whereRaw("date_format(created_at, '%Y-%m-%d') >= '{$request->start_date}'")
                ->whereRaw("date_format(created_at, '%Y-%m-%d') <= '{$request->end_date}'")->count();
            }
        }
    }
}Modules/Client/Repositories/Settings/Users/UserRepositoryInterface.php000066400000000152152434100730022331 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Settings\Users;

interface UserRepositoryInterface
{

}Modules/Client/Repositories/Settings/Roles/RoleRepository.php000064400000057443152434100730020473 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Settings\Roles;
use Illuminate\Support\Arr;
use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Repositories\Settings\Roles\RoleRepositoryInterface;
use QxCMS\Modules\Client\Models\Settings\Roles\Role;
use QxCMS\Modules\Client\Models\Settings\Roles\Permission;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;
use DB;
use File;

class RoleRepository extends AbstractRepository implements RoleRepositoryInterface
{
    protected $model;
    protected $permission;
    protected $log;

    function __construct(Role $model, Permission $permission, Log $log)
    {
        $this->model = $model;        
        $this->permission = $permission;
        $this->log = $log;
    }    
    
    function write_menu($client_id, $role_id)
    {
        $db_name = auth('client')->user()->client->database_name;
        $view_path = realpath(app_path()).'/Modules/Client/Views';
        $realpath =  $view_path."/cache/menus/".$client_id."/";
        File::makeDirectory($realpath, 0775, true, true);
        $filename = "custom_".$role_id.".blade.php";
        $contents = $this->build_menu($role_id, $db_name);
        $created = File::put($realpath.$filename, $contents); 
    }

    function build_menu($role_id = 0, $db_name)
    {
        $modules = DB::table(''.config('database.connections.qxcms.database').'.client_modules as clientModules')
            ->select('clientModules.*','ups.can_access','ups.can_delete','ups.can_update', 'ups.can_create', 'ups.can_export', 'ups.can_import', 'ups.can_print')
            ->leftJoin(env('DB_PREFIX', 'qxcms_').$db_name.'.role_permissions as ups', 'clientModules.id', '=', 'ups.menu_id')
            ->where('ups.role_id', $role_id)
            ->where('clientModules.is_parent', 1)
            ->where('clientModules.has_parent', 0)
            ->where('clientModules.parent_id', 0)
            ->where('clientModules.show_menu', "1")
            ->where('clientModules.menu_group_id', 1)            
           // ->orderBy('clientModules.parent_id', 'ASC')
            ->orderBy('clientModules.orderid', 'ASC')
            ->orderBy('clientModules.title', 'ASC')
            ->get();
        $html_out = "\t"."<ul class=\"sidebar-menu\">"."\n";
        $html_out .= "\t\t"."<li class=\"header\">MAIN NAVIGATION</li>"."\n";
        $html_out .= "\t\t"."<li id=\"appslidemenu0\">"."\n";
        $html_out .= "\t\t"."<a href=\"/".config('modules.client').'/dashboard'."\">"."\n";
        $html_out .= "\t\t"."<i class=\"fa fa-dashboard\"></i> <span>Dashboard</span>"."\n";
        $html_out .= "\t\t"."</a>"."\n";
        $html_out .= "\t\t"."</li>"."\n";
        foreach ($modules as $menu_key => $row )
        {            
            $id = $row->id;
            $title = $row->title;
            $link_type = $row->link_type;
            $page_id = $row->page_id;
            $module_name = $row->module_name;
            $url = $row->url;
            $uri = $row->uri;
            $icon = $row->icon;
            $menu_group_id = $row->menu_group_id;
            $position = $row->position;
            $target = $row->target;
            $parent_id = $row->parent_id;
            $is_parent = $row->is_parent;
            $show_menu = $row->show_menu;
            if ($show_menu && $parent_id == 0) {
                if ($is_parent == TRUE)
                {
                    if($url=='#') {
                        $html_out .= "\t\t"."<li id=\"appslidemenu".$id."\" class=\"treeview\">"."\n";
                        $html_out .= "\t\t\t"."<a href=\"#\"><i class=\"fa fa-".$icon."\"></i> <span>".$title."</span> <i class=\"fa fa-angle-left pull-right\"></i></a>"."\n";
                        $html_out .= $this->get_menu_childs($role_id, $id, $db_name);
                    } else {
                        $html_out .= "\t\t"."<li id=\"appslidemenu".$id."\">"."\n";
                        $html_out .= "\t\t\t".'<a href="/'.config('modules.client').'/'.$url.'"><i class="fa fa-'.$icon.'"></i><span>'.$title.'</a></a>'."\n";                        
                    }
                }                
                $html_out .= '</li>'."\n"; 
            }                
        }
        $html_out .= "\t\t".'</ul>' . "\n";
        return $html_out;
    }

    function get_menu_childs($role_id, $id, $db_name)
    {
        $has_subcats = FALSE;
        $html_out  = '';
        $modules = DB::table(''.config('database.connections.qxcms.database').'.client_modules as clientModules')
            ->select('clientModules.*','ups.can_access','ups.can_delete','ups.can_update', 'ups.can_create', 'ups.can_export', 'ups.can_import', 'ups.can_print')
            ->leftJoin(env('DB_PREFIX', 'qxcms_').$db_name.'.role_permissions as ups', 'clientModules.id', '=', 'ups.menu_id')
            ->where('ups.role_id', $role_id)
            ->where('clientModules.is_parent', 0)
            ->where('clientModules.has_parent', 1)
            ->where('clientModules.parent_id', $id)
            ->where('clientModules.show_menu', "1")
            ->where('clientModules.menu_group_id', 1)
            ->orderBy('clientModules.orderid', 'ASC')
            //->orderBy('clientModules.title', 'ASC')
            ->get();
        $html_out = "\t"."<ul class=\"treeview-menu\">"."\n";       
        foreach ($modules as $menu_key => $row )
        {
            $id = $row->id;
            $title = $row->title;
            $link_type = $row->link_type;
            $page_id = $row->page_id;
            $module_name = $row->module_name;
            $url = $row->url;
            $uri = $row->uri;
            $icon = $row->icon;
            $menu_group_id = $row->menu_group_id;
            $position = $row->position;
            $target = $row->target;
            $parent_id = $row->parent_id;
            $is_parent = $row->is_parent;
            $show_menu = $row->can_access;
            $has_subcats = TRUE;
            if($show_menu) {
                $html_out .= "\t\t\t".'<li id="appslidemenu'.$id.'"><a href="/'.config('modules.client').'/'.$url.'"><i class="fa fa-angle-double-right"></i>&nbsp;'.$title.'&nbsp;</a></li>';
            }
        }
        $html_out .= "\t\t".'</ul>' . "\n";
        return ($has_subcats) ? $html_out : FALSE;
    }

    function build_role_permissions($role_id = 0, $disabled = '')
    {
        $db_name = auth('client')->user()->client->database_name;
        $modules = DB::table(''.config('database.connections.qxcms.database').'.client_modules as clientModules')
            ->select('clientModules.*','ups.can_access','ups.can_delete','ups.can_update', 'ups.can_create', 'ups.can_export', 'ups.can_import', 'ups.can_print')
            ->leftJoin(DB::raw('(SELECT * FROM '.env('DB_PREFIX', 'qxcms_').$db_name.'.role_permissions where role_id = '.$role_id.' ) as ups'), 'clientModules.id', '=', 'ups.menu_id')
            ->where('clientModules.is_parent', 1)
            ->where('clientModules.has_parent', 0)
            ->where('clientModules.parent_id', 0)
            ->where('clientModules.show_menu', "1")
            ->where('clientModules.menu_group_id', 1)            
            //->orderBy('clientModules.parent_id', 'ASC')
            //->orderBy('clientModules.id', 'ASC')
            //->orderBy('clientModules.title', 'ASC')
            ->orderBy('clientModules.orderid', 'ASC')
            ->get();        
        $html_out = "<table class=\"table table-condensed table-bordered\">";
        foreach ($modules as $module_key => $row )
        {
            $id = $row->id;
            $title = $row->title;
            $link_type = $row->link_type;
            $page_id = $row->page_id;
            $module_name = $row->module_name;
            $url = $row->url;
            $uri = $row->uri;
            $icon = $row->icon;
            $menu_group_id = $row->menu_group_id;
            $position = $row->position;
            $target = $row->target;
            $parent_id = $row->parent_id;
            $is_parent = $row->is_parent;
            $show_menu = $row->show_menu;
            $has_read = $row->has_read;
            $has_create = $row->has_create;
            $has_update = $row->has_update;
            $has_delete = $row->has_delete;
            $has_export = $row->has_export;
            $has_import = $row->has_import;
            $has_print = $row->has_print;
            $can_access = $row->can_access;
            $can_create = $row->can_create;
            $can_update = $row->can_update;
            $can_delete = $row->can_delete;
            $can_export = $row->can_export;
            $can_import = $row->can_import;
            $can_print = $row->can_print;
            if($module_key == 0) {
                $html_out .= "<thead>";
                $html_out .= "<tr valign='middle'>";
                $html_out .= "<th colspan=\"3\" style=\"text-align:center;\" align=\"center\"> Module Name </th>";                
                $html_out .= "<th colspan=\"7\" style=\"text-align:center !important;\"> <b>Permissions</b> </th>";
                $html_out .= "</tr>"; 
                $html_out .= "</thead>";                    
                $html_out .= "<tbody>";
                $html_out .= "<tr>";
                $html_out .= "<td align=\"center\" colspan=\"3\"></td>";
                $html_out .= "<td align=\"center\"> <b>Activate</b> </td>";
                $html_out .= "<td align=\"center\"> <b>Create</b> </td>";
                $html_out .= "<td align=\"center\"> <b>Update</b> </td>";
                $html_out .= "<td align=\"center\"> <b>Delete</b> </td>";
                $html_out .= "<td align=\"center\"> <b>Export</b> </td>";
                $html_out .= "<td align=\"center\"> <b>Import</b> </td>";
                $html_out .= "<td align=\"center\"> <b>Print</b> </td>";
                $html_out .= "</tr>";
            }
            $html_out .= "<tr class=\"parent\">";
            if($url=='#'){
                $html_out .= "<td colspan=\"3\">&nbsp;<b><span class=\"fa fa-".$icon."\"></span>&nbsp;".$title."</b>&nbsp;&nbsp;<i class=\"fa fa-chevron-right\"></td>";                
                $html_out .= "<td align=\"center\" style=\"background-color:#fff;\">";
                $html_out .= "<label><input name=\"module[".$id."][can_access]\" value=\"1\"  class=\"sub-menu\" type=\"checkbox\" ".(($can_access) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"show\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
                $html_out .= "</td>";
                $html_out .= "<td align=\"center\" colspan=\"6\" style=\"background-color:#fff;\"> <b></b> </td>";
            } else {
                $html_out .= "<td colspan=\"3\">&nbsp;<b><span class=\"fa fa-".$icon."\"></span>&nbsp;".$title."</b></td>";
                $html_out .= "<td align=\"center\" style=\"background-color:#fff;\">";
                $html_out .= "<label><input name=\"module[".$id."][can_access]\" value=\"1\"  class=\"sub-menu\" type=\"checkbox\" ".(($can_access) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"show\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
                $html_out .= "</td>";
                $html_out .= "<td align=\"center\" style=\"background-color:#fff;\">";
                if ($has_create) {
                    $html_out .= "<label><input name=\"module[".$id."][can_create]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_create) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"create\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
                }
                $html_out .= "</td>";
                $html_out .= "<td align=\"center\" style=\"background-color:#fff;\">";
                if ($has_update) {
                   $html_out .= "<label><input name=\"module[".$id."][can_update]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_update) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"update\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
                }
                $html_out .= "</td>";
                $html_out .= "<td align=\"center\" style=\"background-color:#fff;\">";
                if ($has_delete) {
                    $html_out .= "<label><input name=\"module[".$id."][can_delete]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_delete) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"delete\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
                }
                $html_out .= "</td>";
                $html_out .= "<td align=\"center\" style=\"background-color:#fff;\">";
                if ($has_export) {
                    $html_out .= "<label><input name=\"module[".$id."][can_export]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_export) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"export\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
                }
                $html_out .= "</td>";
                $html_out .= "<td align=\"center\" style=\"background-color:#fff;\">";
                if ($has_import) {
                    $html_out .= "<label><input name=\"module[".$id."][can_import]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_import) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"import\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
                }
                $html_out .= "</td>";
                $html_out .= "<td align=\"center\" style=\"background-color:#fff;\">";
                if ($has_print) {
                    $html_out .= "<label><input name=\"module[".$id."][can_print]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_print) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"print\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
                }
                $html_out .= "</td>";                
            }            
            $html_out .= "</tr>";
            $html_out .=   $this->get_childs_role_permissions($db_name, $id, $role_id, $disabled);
        }
        $html_out .= '</table>';
        return $html_out;
    }

    function get_childs_role_permissions($db_name, $id, $role_id, $disabled)
    {
        $has_subcats = FALSE; 
        $html_out  = '';
        $modules = DB::table(''.config('database.connections.qxcms.database').'.client_modules as clientModules')
            ->select('clientModules.*','ups.can_access','ups.can_delete','ups.can_update', 'ups.can_create', 'ups.can_export', 'ups.can_import', 'ups.can_print')
            ->leftJoin(DB::raw('(SELECT * FROM '.env('DB_PREFIX', 'qxcms_').$db_name.'.role_permissions where role_id = '.$role_id.' ) as ups'), 'clientModules.id', '=', 'ups.menu_id')            
            ->where('clientModules.is_parent', 0)
            ->where('clientModules.has_parent', 1)
            ->where('clientModules.parent_id', $id)
            ->where('clientModules.show_menu', "1")
            ->where('clientModules.menu_group_id', 1)
            //->orderBy('clientModules.title', 'ASC')
            ->orderBy('clientModules.orderid', 'ASC')
            ->get();
        foreach ($modules as $module_key => $row )
        {
            $id = $row->id;
            $title = $row->title;
            $link_type = $row->link_type;
            $page_id = $row->page_id;
            $module_name = $row->module_name;
            $url = $row->url;
            $uri = $row->uri;
            $icon = $row->icon;
            $dyn_group_id = $row->menu_group_id;
            $position = $row->position;
            $target = $row->target;
            $parent_id = $row->parent_id;
            $is_parent = $row->is_parent;
            $show_menu = $row->show_menu;
            $has_read = $row->has_read;
            $has_create = $row->has_create;
            $has_update = $row->has_update;
            $has_delete = $row->has_delete;
            $has_export = $row->has_export;
            $has_import = $row->has_import;
            $has_print = $row->has_print;
            $can_access = $row->can_access;
            $can_create = $row->can_create;
            $can_update = $row->can_update;
            $can_delete = $row->can_delete;
            $can_export = $row->can_export;
            $can_import = $row->can_import;
            $can_print = $row->can_print;                    
            $has_subcats = TRUE;                    
            $html_out .= "<tr valign='top' class='child'>";
            $html_out .= "<td  colspan=\"3\" width=\"20%\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"fa fa-".$icon."\"></span>&nbsp;".$title."</td>";                    
            $html_out .= "</td>";
            $html_out .= "<td width=\"10%\" align=\"center\">";
            $html_out .= "<label><input name=\"module[".$id."][can_access]\" value=\"1\"  class=\"sub-menu\" type=\"checkbox\" ".(($can_access) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"show\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
            $html_out .= "</td>";
            $html_out .= "<td width=\"10%\" align=\"center\">";
            if ($has_create) {
                $html_out .= "<label><input name=\"module[".$id."][can_create]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_create) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"create\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
            }
            $html_out .= "</td>";
            $html_out .= "<td width=\"10%\" align=\"center\">";
            if ($has_update) {
                $html_out .= "<label><input name=\"module[".$id."][can_update]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_update) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"update\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
            }
            $html_out .= "</td>";
            $html_out .= "<td width=\"10%\" align=\"center\">";
            if ($has_delete) {
                $html_out .= "<label><input name=\"module[".$id."][can_delete]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_delete) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"delete\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
            }
            $html_out .= "</td>";
            $html_out .= "<td width=\"10%\" align=\"center\">";
            if ($has_export) {
                $html_out .= "<label><input name=\"module[".$id."][can_export]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_export) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"export\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
            }
            $html_out .= "</td>";
            $html_out .= "<td width=\"10%\" align=\"center\">";
            if ($has_import) {
                $html_out .= "<label><input name=\"module[".$id."][can_import]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_import) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"import\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
            }
            $html_out .= "</td>";
            $html_out .= "<td width=\"10%\" align=\"center\">";
            if ($has_print) {
                $html_out .= "<label><input name=\"module[".$id."][can_print]\" value=\"1\" class=\"sub-menu\" type=\"checkbox\" ".(($can_print) ? 'checked':'')." data-id=\"".$id."\" data-permission=\"print\" data-access-id=\"".$role_id."\" ".$disabled."></label>";
            }
            $html_out .= "</td>";
            $html_out .= '</tr>';
        }    
        return ($has_subcats) ? $html_out : FALSE;
    }

    public function getdefaultIDs()
    {
        return $this->model->getdefaultIDs();
    }

    public function makeRolePermissions(array $request, $role_id)
    {
        $modules = isset($request['module']) ? $request['module']:array();
        $this->permission->where('role_id', $role_id)->delete();
        if (count($modules) <= 0) return;
        foreach ($modules as $module_id => $module) {
            $module['role_id'] = $role_id;
            $module['module_id'] = $module_id;
            $this->permission->create($this->makeModulePermissions($module));
        }
        return $module;
    }

    public function makeModulePermissions(array $module)
    {
        return $useroles = [
            'menu_id' => $module['module_id'],
            'role_id' => $module['role_id'],
            'can_access' => (isset($module['can_access']) && !empty($module['can_access'])) ? $module['can_access']:0,
            'can_create' => (isset($module['can_create']) && !empty($module['can_create'])) ? $module['can_create']:0,
            'can_update' => (isset($module['can_update']) && !empty($module['can_update'])) ? $module['can_update']:0,
            'can_delete' => (isset($module['can_delete']) && !empty($module['can_delete'])) ? $module['can_delete']:0,
            'can_export' => (isset($module['can_export']) && !empty($module['can_export'])) ? $module['can_export']:0,
            'can_import' => (isset($module['can_import']) && !empty($module['can_upload'])) ? $module['can_import']:0,
            'can_print' => (isset($module['can_print']) && !empty($module['can_print'])) ? $module['can_print']:0,
        ];   
    }

    public function datatablesIndex($request = array())
    {
        if(auth()->user()->role_id != $this->model->developer_id) {
            return $model = $this->model->select(['id', 'name', 'display_name'])->whereNotIn('id', $this->model->hiddenRoleIds());
        }
        return $model = $this->model->select(['id', 'name', 'display_name']);
    }

    public function getLists()
    {

        if(auth()->user()->role_id != $this->model->developer_id) {
            return $model = $this->model->whereNotIn('id', $this->model->hiddenRoleIds())->pluck('name', 'id')->all();
        }
        return $model = $this->model->pluck('name', 'id')->all();
    }

    public function getHiddenRoleIds()
    {
        return $this->model->hiddenRoleIds();
    }

    public function getDeveloperId()
    {
        return $this->model->developer_id;
    }

    public function getEditorId()
    {
        return $this->model->editor_id;
    }

    public function getFieldOfficerId()
    {
        return $this->model->field_officer_id;
    }

    public function create(array $request)
    {
        $user = auth()->user();
        $model = $this->model->fill(Arr::except($request, ['module']));
        $model->save();
        $this->log->saveLog(['action' => 'Create', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        $this->makeRolePermissions($request, $model->id); 
        $this->write_menu(auth('client')->user()->client->id, $model->id);       
        return $model;
    }

    public function update($id, array $request)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        $model->fill(Arr::except($request, ['module']));
        $model->save();
        session()->flash('success', 'Successfully updated.');
        $this->log->saveLog(['action' => 'Update', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        $this->makeRolePermissions($request, $model->id);
        $this->write_menu(auth('client')->user()->client->id, $id);        
        return $model;
    }

    public function delete($id, $client_id)
    {
        $user = auth()->user();
        if(in_array($id, $this->model->getdefaultIDs())) {
             return $this->getAjaxResponse('error', 'Default role cannot be deleted.');
        }
        $model = $this->model->findOrFail($id);
        if($model->users()->where('client_id',$client_id)->count() > 0) {
            return $this->getAjaxResponse('error', 'Role is currently used and cannot be deleted.');
        }
        $model->permissions()->delete();
        $model->delete();
        $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);

        $view_path = realpath(app_path()).'/Modules/Client/Views';
        $realpath =  $view_path."/cache/menus/".$client_id."/";        
        $filename = $realpath."custom_".$id.".blade.php"; 
        File::delete($filename);
        return $this->getAjaxResponse('success', 'Successfully deleted.');
    }
}Modules/Client/Repositories/Settings/Roles/PermissionRepository.php000066400000004641152434100730021714 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Settings\Roles;

use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Repositories\Settings\Roles\RoleRepositoryInterface;
use QxCMS\Modules\Client\Models\Settings\Roles\Permission;

class PermissionRepository extends AbstractRepository implements PermissionRepositoryInterface
{
    protected $model;

    function __construct(Permission $model)
    {
        $this->model = $model;
    }

    public function getPermission($module_id)
    {
        return $this->model->where('menu_id', $module_id)->where('role_id', \Auth::guard('client')->user()->role_id)->first();
    }

    public function setRolePermission(array $module)
    {
        if(!empty($module)) {
            return $module = [
                'menu_id' => $module['menu_id'],
                'role_id' => $module['role_id'],
                'can_access' => (isset($module['can_access']) && !empty($module['can_access'])) ? $module['can_access']:0,
                'can_create' => (isset($module['can_create']) && !empty($module['can_create'])) ? $module['can_create']:0,
                'can_update' => (isset($module['can_update']) && !empty($module['can_update'])) ? $module['can_update']:0,
                'can_delete' => (isset($module['can_delete']) && !empty($module['can_delete'])) ? $module['can_delete']:0,
                'can_export' => (isset($module['can_export']) && !empty($module['can_export'])) ? $module['can_export']:0,
                'can_import' => (isset($module['can_import']) && !empty($module['can_upload'])) ? $module['can_import']:0,
                'can_print' => (isset($module['can_print']) && !empty($module['can_print'])) ? $module['can_print']:0,
            ];
        } 
        return [];
    }

    public function serializeModules($module)
    {
       return $modules = [
            'menu_id'    => $module->id,
            'can_access' => $module->show_menu,
            'can_create' => $module->has_create,
            'can_update' => $module->has_update,
            'can_delete' => $module->has_delete,
            'can_export' => $module->has_export,
            'can_import' => $module->has_import,
            'can_print'  => $module->has_print,
        ] ;
    }

    public function makeRolePermission($module, $id)
    {
        $modules = $this->serializeModules($module);
        $modules['role_id'] = $id;
        $this->model->create($this->setRolePermission($modules));
    }
}Modules/Client/Repositories/Settings/Roles/RoleRepositoryInterface.php000066400000000152152434100730022277 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Settings\Roles;

interface RoleRepositoryInterface
{

}Modules/Client/Repositories/Settings/Roles/PermissionRepositoryInterface.php000066400000000160152434100730023525 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Settings\Roles;

interface PermissionRepositoryInterface
{

}Modules/Client/Repositories/Applicants/ApplicantRepositoryInterface.php000066400000000153152434100730022524 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Applicants;

interface ApplicantRepositoryInterface
{

}Modules/Client/Repositories/Applicants/ApplicantRepository.php000066400000003531152434100730020706 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Applicants;

use Carbon\Carbon;
use Illuminate\Http\Request;

use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Applicants\Applicant;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;

class ApplicantRepository extends AbstractRepository implements ApplicantRepositoryInterface
{
    protected $model;
    protected $log;

    function __construct(Applicant $model, Log $log)
    {
        $this->model = $model;
        $this->log = $log;
    }

    public function getSourceApplicant(Request $request)
    {
        $applicant = $this->model->with('latestJob', 'latestJob.job')
        ->whereHas('latestJob',function($query){
           $query->where('id', '!=', null);
        })->whereHas('latestJob.job',function($query) use ($request){
            if ($request->has('position_applied')){
                $query->where('position','LIKE',"%{$request->position_applied}%");
            }
        })->where(function($query) use ($request){
            if($request->has('min_yrs')){
                $query->whereRaw("yrs_exp >= '{$request->min_yrs}'");
            }
            if($request->has('max_yrs')){
                $query->whereRaw("yrs_exp <= '{$request->max_yrs}'");
            }
            if($request->has('recent_emp')){
                $query->where('company', 'LIKE', "%{$request->recent_emp}%");
            }
            if($request->has('col_deg')){
                $query->where('college_degree', 'LIKE', "%{$request->col_deg}%");
            }
            if($request->has('school')){
                $query->where('school', 'LIKE', "%{$request->school}%");
            }
            if($request->has('work_location')){
                $query->where('work_location', 'LIKE', "%{$request->work_location}%");
            }
        });
        return $applicant;
    }
}Modules/Client/Repositories/Directory/SpecializationsRepository.php000066400000003123152434100730021777 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Directory;

use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Directory\Specializations;
use QxCMS\Modules\Client\Repositories\Directory\DirectoriesRepositoryInterface as Directory;

use Illuminate\Http\Request;

class SpecializationsRepository extends AbstractRepository implements SpecializationsRepositoryInterface
{

    protected $model;

    function __construct(Specializations $model, Directory $directory)
    {
        $this->model = $model;
        $this->directory = $directory;
    }

    public function create(array $request)
    {
        $specializations = $this->model->fill($request);
        $specializations->save();
        return $specializations;
    }

    public function update(Request $request)
    {
        $id = $request->input('id');
        $name = $request->input('name');

        $specialization = $this->findById($id);
        $specialization->name = $name;
        $specialization->save();
        return $specialization->name;
    }

    public function delete($id)
    {
        $specialization = $this->findById($id);
        if ($specialization->directory->count() > 0) {
            return response()->json(['error' => 'exists', 'id' => $id]);
        } else {
            $specialization->delete();
            return response()->json(['success' => 'yes', 'id' => $id]);
        }            
    }

    public function specializationsList()
    {
        return
            $this
            ->model
            ->orderBy('name','asc')
            ->pluck('name', 'id')
            ->toArray();
    }

}Modules/Client/Repositories/Directory/SpecializationsRepositoryInterface.php000066400000000160152434100730023616 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Directory;

interface SpecializationsRepositoryInterface
{

}Modules/Client/Repositories/Directory/MunicipalitiesRepository.php000066400000001106152434100730021614 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Directory;

use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Directory\Municipalities;

class MunicipalitiesRepository extends AbstractRepository implements MunicipalitiesRepositoryInterface
{
    protected $model;

    function __construct(Municipalities $model)
    {
        $this->model = $model;
    }

    public function municipalitiesList()
    {
        return
            $this
            ->model
            ->orderBy('name','asc')
            ->pluck('name', 'id')
            ->toArray();
    }
}Modules/Client/Repositories/Directory/MunicipalitiesRepositoryInterface.php000066400000000157152434100730023442 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Directory;

interface MunicipalitiesRepositoryInterface
{

}Modules/Client/Repositories/Directory/ProvincesRepository.php000066400000001035152434100730020606 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Directory;

use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Directory\Provinces;

class ProvincesRepository extends AbstractRepository implements ProvincesRepositoryInterface
{
    protected $model;

    function __construct(Provinces $model)
    {
        $this->model = $model;
    }

    public function provincesList()
    {
        return
            $this
            ->model
            ->all()
            ->pluck('name', 'id')
            ->toArray();
    }
}Modules/Client/Repositories/Directory/CitiesRepository.php000066400000001016152434100730020055 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Directory;

use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Directory\Cities;

class CitiesRepository extends AbstractRepository implements CitiesRepositoryInterface
{
    protected $model;

    function __construct(Cities $model)
    {
        $this->model = $model;
    }

    public function citiesList()
    {
        return
            $this
            ->model
            ->all()
            ->pluck('name', 'id')
            ->toArray();
    }
}Modules/Client/Repositories/Directory/DirectoriesRepository.php000066400000003165152434100730021120 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Directory;

use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Directory\Directory;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;

class DirectoriesRepository extends AbstractRepository implements DirectoriesRepositoryInterface
{
    protected $model;
    protected $log;

    function __construct(Directory $model, Log $log)
    {
        $this->model = $model;
        $this->log = $log;
    }

    
    public function create(array $request)
    {
        $user = auth()->user();
        $model = $this->model->fill($request);
        $model->save();
        $this->log->saveLog(['action' => 'Create', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $model;
    }

    public function update($id, array $request)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        $model->fill($request);
        if(count($model->getDirty()) > 0) {
            $model->save();
            session()->flash('success', 'Successfully edited.');
            $this->log->saveLog(['action' => 'Update', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        }
        return $model;
    }

    public function delete($id)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        $model->delete();
        $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $this->getAjaxResponse('success', 'Successfully deleted.');
    }

    
}Modules/Client/Repositories/Directory/CitiesRepositoryInterface.php000066400000000147152434100730021702 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Directory;

interface CitiesRepositoryInterface
{

}Modules/Client/Repositories/Directory/DirectoriesRepositoryInterface.php000066400000000154152434100730022734 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Directory;

interface DirectoriesRepositoryInterface
{

}Modules/Client/Repositories/Directory/ProvincesRepositoryInterface.php000066400000000152152434100730022426 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Directory;

interface ProvincesRepositoryInterface
{

}Modules/Client/Repositories/Directory/AffiliatesRepository.php000066400000003013152434100730020703 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Directory;

use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Directory\Affiliates;
use QxCMS\Modules\Client\Repositories\Directory\DirectoriesRepositoryInterface as Directory;
use Illuminate\Http\Request;

class AffiliatesRepository extends AbstractRepository implements AffiliatesRepositoryInterface
{

    protected $model;

    function __construct(Affiliates $model, Directory $directory)
    {
        $this->model = $model;
        $this->directory = $directory;
    }

    public function create(array $request)
    {
        $affiliates = $this->model->fill($request);
        $affiliates->save();
        return $affiliates;
    }

    public function update(Request $request)
    {
        $id = $request->input('id');
        $name = $request->input('name');

        $affiliates = $this->findById($id);
        $affiliates->name = $name;
        $affiliates->save();
        return $affiliates->name;
    }

    public function delete($id)
    {
        $affiliate = $this->findById($id);
        if ($affiliate->directory->count() > 0) {
            return response()->json(['error' => 'exists', 'id' => $id]);
        } else {
            $affiliate->delete();
            return response()->json(['success' => 'yes', 'id' => $id]);
        }            
    }

    public function affiliatesList()
    {
        return
            $this
            ->model
            ->orderBy('name','asc')
            ->pluck('name', 'id')
            ->toArray();
    }

}Modules/Client/Repositories/Directory/AffiliatesRepositoryInterface.php000066400000000153152434100730022526 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Directory;

interface AffiliatesRepositoryInterface
{

}Modules/Client/Repositories/Participants/ParticipantRepository.php000066400000003573152434100730021622 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Participants;

use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Participants\Participant;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;

class ParticipantRepository extends AbstractRepository implements ParticipantRepositoryInterface
{
    protected $model;
    protected $log;

    function __construct(Participant $model, Log $log)
    {
        $this->model = $model;
        $this->log = $log;
    }

    
    public function create(array $request)
    {

        $model = $this->model->fill($this->_serialize($request));
        $model->save();
        //$this->log->saveLog(['action' => 'Create', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $model;
    }

    public function _serialize(array $request)
    {
        return $request;
    }

    public function update($id, array $request)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        $model->fill($this->_serialize($request));
        if(count($model->getDirty()) > 0) {
            $model->save();
            session()->flash('success', 'Successfully updated.');
           // $this->log->saveLog(['action' => 'Update', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        }

        return $model;
    }

    public function delete($id)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        $model->delete();
      //  $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $this->getAjaxResponse('success', 'Successfully deleted.');
    }


    public function datatablesIndex()
    {
        //return $this->model->with(['principal', 'template', 'fieldOfficer', 'editor'])->select(['*']);
    }

}Modules/Client/Repositories/Participants/ParticipantRepositoryInterface.php000066400000000163152434100730023433 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Participants;

interface ParticipantRepositoryInterface
{
    
}Modules/Client/Repositories/Questionnaire/QuestionRepository.php000066400000010014152434100730021324 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Questionnaire;

use QxCMS\Modules\AbstractRepository;

use QxCMS\Modules\Client\Models\Questionnaire\Question;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;

class QuestionRepository extends AbstractRepository implements QuestionRepositoryInterface
{
    protected $model;
    protected $log;

    function __construct(Question $model, Log $log)
    {
        $this->model = $model;
        $this->log = $log;
    }
    
    public function create(array $request)
    {
        $user = auth()->user();
        $model = $this->model->fill($this->_serialize($request));
        $model->save();
        $this->log->saveLog(['action' => 'Create', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id, 'sub_menu' => 'Questions-'.$model->template_id]);
        return $model;
    }

    public function _serialize(array $request)
    {
        if(isset($request['template_id'])) {
            $order = $this->model->where('template_id', $request['template_id'])->count();
            $request['order'] = $order + 1;
        }
        if(!isset($request['required'])) $request['required'] = false;
        if(!isset($request['multiple_select'])) $request['multiple_select'] = false;

        return $request;
    }

    public function update($id, array $request)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        $model->fill($this->_serialize($request));
        if(count($model->getDirty()) > 0) {
            $model->save();
            session()->flash('success', 'Question is successfully updated.');
            $this->log->saveLog(['action' => 'Update', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id, 'sub_menu' => 'Questions-'.$model->template_id]);
        }

        return $model;
    }

    public function delete($id)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        $model->answers()->delete();
        $model->delete();
        $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id, 'sub_menu' => 'Questions-'.$model->template_id]);

        return $this->getAjaxResponse('success', 'Question and its answers are successfully deleted.');
    }

    public function sort($order = 0, $id = 0)
    {
        if($id <> 0) {
            $model = $this->model->find($id);
            $model->order = $order;
            $model->save();
        } 
        return;
    }

    public function copyQuestion($question = null)
    {
        $user = auth()->user();
        if($question != null)
        {
            $question_input['title'] = $question->title.'(Copy)';
            $question_input['order'] = $question->order;
            $question_input['template_id'] = $question->template_id;
            $question_input['required'] = $question->required;
            $question_input['multiple_select'] = $question->multiple_select;
            $question_input['question_type'] = $question->question_type;

            $new_question = $this->model->create($question_input);
            $this->log->saveLog(['action' => 'Duplicate', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $new_question->id, 'sub_menu' => 'Questions-'.$question->template_id]);

            $answers = array();
            if(count($question->answers) > 0) {
                foreach ($question->answers as $answer) {
                    $answers['question_id'] = $answer->question_id;
                    $answers['name'] = $answer->name; 
                    $answers['order'] = $answer->order; 
                    $new_question->answers()->create($answers);
                }
            }

            return $this->model->find($question->id);
        }
    }

    public function getQuestionTypes()
    {
        return $this->model->questionTypes();
    }

    public function getTypes()
    {
        return [
            1 => 'text',
            2 => 'radiogroup',
            3 => 'checkbox'
        ];
    }
}Modules/Client/Repositories/Questionnaire/AnswerRepositoryInterface.php000066400000000153152434100730022600 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Questionnaire;

interface AnswerRepositoryInterface
{

}Modules/Client/Repositories/Questionnaire/TemplateRepository.php000066400000012771152434100730021304 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Questionnaire;

use QxCMS\Modules\AbstractRepository;

use QxCMS\Modules\Client\Models\Questionnaire\Template;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;
class TemplateRepository extends AbstractRepository implements TemplateRepositoryInterface
{
    protected $model;
    protected $log;

    function __construct(Template $model, Log $log)
    {
        $this->model = $model;
        $this->log = $log;
    }

    
    public function create(array $request)
    {
        $user = auth()->user();
        $model = $this->model->fill($this->_serialize($request));
        $model->save();
        $this->log->saveLog(['action' => 'Create', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $model;
    }

    public function _serialize(array $request)
    {
        return $request;
    }

    public function update($id, array $request)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        $model->fill($this->_serialize($request));
        if(count($model->getDirty()) > 0) {
            $model->save();
            session()->flash('success', 'Template successfully updated.');
            $this->log->saveLog(['action' => 'Update', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        }

        return $model;
    }

    public function delete($id)
    {
        $user = auth()->user();
        $model = $this->findById($id);
        $model->questions->each(function($value){
            $value->answers()->delete();
        });

        $model->questions()->delete();
        $model->delete();
        $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $this->getAjaxResponse('success', 'Template successfully deleted.');
    }

    public function copyTemplate($id)
    {
        $user = auth()->user();
        if($id)
        {
            $model = $this->model->with(['questions','questions.answers'])->find($id);
            if($model)
            {
                $templates['title'] = $model->title.'(Copy)';
                $templates['user_id'] = auth('client')->user()->id;
                $templates['description'] = $model->description;
                $templates['status'] = 'Open';
                $new_template = $this->model->create($templates);
                $this->log->saveLog(['action' => 'Duplicate', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $new_template->id]);

                if(count($model->questions) > 0) {
                    $questions = array();
                    foreach ($model->questions as $question) {
                        $questions['title'] = $question->title;
                        $questions['order'] = $question->order;
                        $questions['template_id'] = $question->template_id;
                        $questions['required'] = $question->required;
                        $questions['multiple_select'] = $question->multiple_select;
                        $questions['question_type'] = $question->question_type;

                        $new_question = $new_template->questions()->create($questions);

                        if(isset($question->answers))
                        {
                            if(count($question->answers) > 0)
                            {
                                $answers = array();
                                foreach ($question->answers  as $answer) {
                                    $answers['question_id'] = $answer->question_id;
                                    $answers['name'] = $answer->name; 
                                    $answers['order'] = $answer->order;
                                    $new_question->answers()->create($answers);
                                }
                            }
                        }
                    }
                }
            }
        }
        return $model;
    }

    public function select2($params = array())
    {
        if(!isset($params['title'])) $params['title'] = '';
        $model = $this->model
                        ->select(['title as text', 'id'])
                        ->searchByTitle($params['title'])
                        ->get();

        if(isset($params['placeholder'])) {
            $placeholder = array('text' => ' - All -', 'id' => '-1');
            if(isset($params['placeholder']['text'])) $placeholder = array('text' => $params['placeholder']['text'], 'id' => '-1');
             
            return  response(
                   array_prepend($model->toArray(), $placeholder)
                )->header('Content-Type', 'application/json');
        }
       
        return  response(
                       $model->toArray()
                    )->header('Content-Type', 'application/json');
    }


    public function findTemplateById($id, $relationships = [])
    {
        if(count($relationships)) {
            return $this->model->with($relationships)->find($id);
        }
        return  $this->model->find($id);
    }
     /*
    
    
    API REQUEST
     */
    public function apiGetQuestionnaire(array $request)
    {
        if(!isset($request['template_id'])) return array();
        return $this->model->with(['questions' => function($query) {
            $query->orderBy('order', 'ASC');
        }, 'questions.answers' => function($query){
            $query->orderBy('order', 'ASC');
        }])->find($request['template_id']);
    }
}Modules/Client/Repositories/Questionnaire/QuestionRepositoryInterface.php000066400000000155152434100730023152 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Questionnaire;

interface QuestionRepositoryInterface
{

}Modules/Client/Repositories/Questionnaire/AnswerRepository.php000066400000002315152434100730020761 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Questionnaire;

use QxCMS\Modules\AbstractRepository;

use QxCMS\Modules\Client\Models\Questionnaire\Answer;

class AnswerRepository extends AbstractRepository implements AnswerRepositoryInterface
{
    protected $model;

    function __construct(Answer $model)
    {
        $this->model = $model;
    }

    
    public function create(array $request)
    {
        $model = $this->model->create($this->_serialize($request));
        return $model;
    }

    public function _serialize(array $request)
    {
        return $request;
    }

    public function update($id, array $request)
    {
        $model = $this->model->find($id);
        $model->fill($this->_serialize($request));
        $model->save();
        return $model;
    }

    public function delete($id)
    {
        $model = $this->findById($id);
        if($model->type_id == 1) {
            return $this->getAjaxResponse('error', 'Primary user connot be deleted.');
        }

        $model->delete();
        return $this->getAjaxResponse('success', 'Template successfully deleted.');
    }

    public function getQuestionTypes()
    {
        
        return $this->model->questionTypes();
    }
}Modules/Client/Repositories/Questionnaire/TemplateRepositoryInterface.php000066400000000161152434100730023113 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Questionnaire;

interface TemplateRepositoryInterface
{
    
}Modules/Client/Repositories/Posts/PostsRepository.php000064400000006244152434100730017117 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Posts;
use Illuminate\Support\Str;
use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Posts\Posts;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;
use Illuminate\Http\Request;
use Carbon\Carbon;

class PostsRepository extends AbstractRepository implements PostsRepositoryInterface
{
    protected $model;
    protected $log;

    function __construct(Posts $model, Log $log)
    {
        $this->model = $model;
        $this->log = $log;
    }
    
    public function create(Request $request)
    {
        $user = auth()->user();
        $model = $this->model->fill($request->all());
        $model->author_id = $user->id;
        $model->slug = Str::slug($request['title']);
        $model->post_type = 'Post';

        $model->save();
        $this->log->saveLog(['action' => 'Create', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $model;
    }

    public function update($id, Request $request)
    {
        $model = $this->findById($id);
        $user = auth()->user();
        $model->fill($request->all());
        $model->slug = Str::slug($request['title']);

        if(count($model->getDirty()) > 0) {
            $model->save();
            session()->flash('success', 'Successfully edited.');
            $this->log->saveLog(['action' => 'Update', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        }

        return $model;
    }

    public function delete($id)
    {
        $model = $this->findById($id);
        $user = auth()->user();
        $model->delete();
        $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);

        return $this->getAjaxResponse('success', 'Successfully deleted.');
    }

    public function getAllPost($limit = 10)
    {
        $post = $this->model;
        return $this->getActivePost($post)->latest()->paginate($limit);
    }

    public function getLatestPost($limit = 10)
    {
        $post = $this->model;
        return $this->getActivePost($post)->latest()->take($limit)->get();
    }

     public function findBySlug($slug)
    {
        return $this->model->where('slug', '=', $slug)->get();
    }

    public function getLatestByCategory($slug, $limit = 4)
    {
        $post = $this->model
            ->whereHas('category', function($query) use($slug) {
                $query->where('slug', '=', $slug);
            });

        return $this->getActivePost($post)->latest()->paginate($limit);
    }

    public function getAllPage()
    {
        return $this->model->where('status', 'Publish')->where('post_type', 'Page')->get();
    }

    protected function getActivePost($model)
    {
        $date_today = Carbon::now();
        return $model
            ->where('published_at', '<=', $date_today)
            ->where('status', 'Publish')
            ->where('post_type', 'Post')
            ->where(function($query) use ($date_today){
                $query->orWhere('expired_at', '>', $date_today);
                $query->orWhere('expired_at', '=', '0000-00-00');
            });
    }
}Modules/Client/Repositories/Posts/PostCategoryRepository.php000064400000003207152434100730020426 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Posts;
use Illuminate\Support\Str;
use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Posts\PostCategory;
use QxCMS\Modules\Client\Repositories\Posts\PostsRepositoryInterface as Posts;

use Illuminate\Http\Request;

class PostCategoryRepository extends AbstractRepository implements PostCategoryRepositoryInterface
{

    protected $model;

    function __construct(PostCategory $model, Posts $posts)
    {
        $this->model = $model;
        $this->posts = $posts;
    }

    public function create(array $request)
    {
        $postCategory = $this->model->fill($request);
        $postCategory->slug = Str::slug($request['name']);
        $postCategory->save();
        return $postCategory;
    }

    public function update(Request $request)
    {
        $id = $request->input('id');
        $name = $request->input('name');

        $postCategory = $this->findById($id);
        $postCategory->name = $name;
        $postCategory->slug = Str::slug($name);
        $postCategory->save();
        return $postCategory->name;
    }

    public function delete($id)
    {
        $postCategory = $this->findById($id);
        if ($postCategory->post->count() > 0) {
            return response()->json(['error' => 'exists', 'id' => $id]);
        } else {
            $postCategory->delete();
            return response()->json(['success' => 'yes', 'id' => $id]);
        }            
    }

    public function postCategoryList()
    {
        return
            $this
            ->model
            ->orderBy('name','asc')
            ->pluck('name', 'id')
            ->toArray();
    }
}Modules/Client/Repositories/Posts/PostCategoryRepositoryInterface.php000066400000000151152434100730022244 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Posts;

interface PostCategoryRepositoryInterface
{

}Modules/Client/Repositories/Posts/PostsRepositoryInterface.php000066400000000142152434100730020731 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Posts;

interface PostsRepositoryInterface
{

}Modules/Client/Repositories/Products/ProductBrandRepositoryInterface.php000066400000000154152434100730022706 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Products;

interface ProductBrandRepositoryInterface
{

}Modules/Client/Repositories/Products/ProductRepository.php000064400000005575152434100730020130 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Products;
use Illuminate\Support\Str;
use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Products\Product;
use QxCMS\Modules\Client\Models\Settings\UserLogs\UserLogs as Log;
use Storage;
use Illuminate\Http\Request;

class ProductRepository extends AbstractRepository implements ProductRepositoryInterface
{
    protected $model;
    protected $log;

    function __construct(Product $model, Log $log)
    {
        $this->model = $model;
        $this->log = $log;
    }

    public function getAllProduct(){
        $allProduct = $this->model->all();
        return $allProduct;
    }
    
    public function create(Request $request)
    {
        $user = auth()->user();
        $model = $this->model->fill($request->except(['image']));

        if( $request->hasFile('image') ) {
            $ext = $request->file('image')->getClientOriginalExtension();
            $path = $request->file('image')->storeAs($user->client->root_dir.'/products', Str::slug($request['name']).'.'.$ext, $user->client->storage_type);
            $model->image = basename($path);
        }
        $model->save();
        $this->log->saveLog(['action' => 'Create', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $model;
    }

    public function update($id, Request $request)
    {
        $model = $this->findById($id);
        $user = auth()->user();
        $model->fill($request->all());
        
        if( $request->hasFile('image') ) {
            Storage::disk($user->client->storage_type)->delete($user->client->root_dir.'/products/'.$model['image']);
            $ext = $request->file('image')->getClientOriginalExtension();
            $path = $request->file('image')->storeAs($user->client->root_dir.'/products', Str::slug($request['name']).'.'.$ext, $user->client->storage_type);
            $model->image = basename($path);
            $this->log->saveLog(['action' => 'Update', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        }   
        if(count($model->getDirty()) > 0) {
            $model->save();
            session()->flash('success', 'Successfully edited.');
            $this->log->saveLog(['action' => 'Update', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        }
        return $model;
    }

    public function delete($id)
    {
        $model = $this->findById($id);
        $user = auth()->user();
        if($model->image <> ''){
            Storage::disk($user->client->storage_type)->delete($user->client->root_dir.'/products/'.$model['image']);
        }
        $model->delete();
        $this->log->saveLog(['action' => 'Delete', 'module_id' => $this->getModuleId(), 'user_id' => $user->id, 'data_id' => $model->id]);
        return $this->getAjaxResponse('success', 'Successfully deleted.');
    }
}Modules/Client/Repositories/Products/ProductBrandRepository.php000066400000003032152434100730021063 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Products;

use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Products\ProductBrand;
use QxCMS\Modules\Client\Repositories\Products\ProductRepositoryInterface as Product;

use Illuminate\Http\Request;

class ProductBrandRepository extends AbstractRepository implements ProductBrandRepositoryInterface
{

    protected $model;

    function __construct(ProductBrand $model, Product $product)
    {
        $this->model = $model;
        $this->product = $product;
    }

    public function create(array $request)
    {
        $productBrand = $this->model->fill($request);
        $productBrand->save();
        return $productBrand;
    }

    public function update(Request $request)
    {
        $id = $request->input('id');
        $name = $request->input('name');

        $productBrand = $this->findById($id);
        $productBrand->name = $name;
        $productBrand->save();
        return $productBrand->name;
    }

    public function delete($id)
    {
        $productBrand = $this->findById($id);
        if ($productBrand->product->count() > 0) {
            return response()->json(['error' => 'exists', 'id' => $id]);
        } else {
            $productBrand->delete();
            return response()->json(['success' => 'yes', 'id' => $id]);
        }            
    }

    public function productBrandList()
    {
        return
            $this
            ->model
            ->orderBy('name','asc')
            ->pluck('name', 'id')
            ->toArray();
    }

}Modules/Client/Repositories/Products/ProductRepositoryInterface.php000066400000000147152434100730021741 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Products;

interface ProductRepositoryInterface
{

}Modules/Client/Repositories/Products/ProductCategoryRepositoryInterface.php000066400000000157152434100730023440 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Products;

interface ProductCategoryRepositoryInterface
{

}Modules/Client/Repositories/Products/ProductCategoryRepository.php000066400000003107152434100730021615 0ustar00<?php

namespace QxCMS\Modules\Client\Repositories\Products;

use QxCMS\Modules\AbstractRepository;
use QxCMS\Modules\Client\Models\Products\ProductCategory;
use QxCMS\Modules\Client\Repositories\Products\ProductRepositoryInterface as Product;

use Illuminate\Http\Request;

class ProductCategoryRepository extends AbstractRepository implements ProductCategoryRepositoryInterface
{

    protected $model;

    function __construct(ProductCategory $model, Product $product)
    {
        $this->model = $model;
        $this->product = $product;
    }

    public function create(array $request)
    {
        $productCategory = $this->model->fill($request);
        $productCategory->save();
        return $productCategory;
    }

    public function update(Request $request)
    {
        $id = $request->input('id');
        $name = $request->input('name');

        $productCategory = $this->findById($id);
        $productCategory->name = $name;
        $productCategory->save();
        return $productCategory->name;
    }

    public function delete($id)
    {
        $productCategory = $this->findById($id);
        if ($productCategory->product->count() > 0) {
            return response()->json(['error' => 'exists', 'id' => $id]);
        } else {
            $productCategory->delete();
            return response()->json(['success' => 'yes', 'id' => $id]);
        }            
    }

    public function productCategoryList()
    {
        return
            $this
            ->model
            ->orderBy('name','asc')
            ->pluck('name', 'id')
            ->toArray();
    }

}Modules/Client/routes.php000066400000055071152434100730011435 0ustar00<?php

Route::group(['namespace'=>'Auth', 'prefix' => 'auth'], function(){
    Route::get('/logout', 'AuthController@logout');
    Route::group(['prefix'=>'login'], function(){
        Route::get('/',  'AuthController@getLogin');
        Route::post('/', 'AuthController@postLogin');
    });
});

Route::group(['middleware'=>['auth.client']], function(){
    Route::get('/', function(){
        return redirect('client/auth/login');
    });
    Route::group(['namespace'=>'Dashboard'], function(){
        Route::group(['prefix'=>'dashboard'], function(){
            Route::get('/', 'DashboardController@dashboard');
        });
    });
    Route::group(['namespace'=>'Settings'], function() {
        Route::group(['prefix'=>'settings'], function() {
            Route::group(['prefix' => 'roles'], function(){
                Route::get('get-roles-data', 'RoleController@getRolesData');
            });
            Route::resource('roles', 'RoleController', 
            [
                'names' => [
                    'index' => config('modules.client').'.settings.roles.index',
                    'create' => config('modules.client').'.settings.roles.create',
                    'store' => config('modules.client').'.settings.roles.store',
                    'show' => config('modules.client').'.settings.roles.show',
                    'edit' => config('modules.client').'.settings.roles.edit',
                    'update' => config('modules.client').'.settings.roles.update',
                    'destroy' => config('modules.client').'.settings.roles.destroy'
                ]
            ]
            );
        });
        Route::group(['prefix'=>'settings'], function() {
            Route::group(['prefix' => 'users'], function(){
                Route::get('get-users-data', 'UserController@getUsersData');
                Route::get('select2', array('as' => config('modules.client').'.users.select2', 'uses' => 'UserController@select2'));
                Route::get('get-tokeninput-user-lists', 'UserController@getTokenInputUserLists');
            });
            Route::resource('users', 'UserController', 
            [
                'names' => [
                    'index' => config('modules.client').'.settings.users.index',
                    'create' => config('modules.client').'.settings.users.create',
                    'store' => config('modules.client').'.settings.users.store',
                    'show' => config('modules.client').'.settings.users.show',
                    'edit' => config('modules.client').'.settings.users.edit',
                    'update' => config('modules.client').'.settings.users.update',
                    'destroy' => config('modules.client').'.settings.users.destroy'
                ]
            ]
            );
        });
    });

    Route::group(['namespace'=>'Principals'], function() {
        Route::group(['prefix'=>'principals'], function() {
            Route::get('get-principals-data', 'PrincipalController@getPrincipalsData');
            Route::get('{principal_id}/get-contact-persons-data', 'ContactPersonController@getContactPersonsData');
            Route::get('select2', array('as' => config('modules.client').'.principals.select2', 'uses' => 'PrincipalController@select2'));
            Route::get('{principal_id}/overview', array('as' => config('modules.client').'.settings.principals.overview', 'uses' => 'PrincipalController@overview'));
            Route::get('{principal_id}/login', 'PrincipalController@login');
        });
        Route::resource('principals', 'PrincipalController', 
        [
            'names' => [
                'index' => config('modules.client').'.settings.principals.index',
                'create' => config('modules.client').'.settings.principals.create',
                'store' => config('modules.client').'.settings.principals.store',
                'show' => config('modules.client').'.settings.principals.show',
                'edit' => config('modules.client').'.settings.principals.edit',
                'update' => config('modules.client').'.settings.principals.update',
                'destroy' => config('modules.client').'.settings.principals.destroy'
            ]
        ]
        );

        Route::resource('principals.contact-persons', 'ContactPersonController',
        [
            'names' => [
                'index' => config('modules.client').'.principals.contact-persons.index',
                'create' => config('modules.client').'.principals.contact-persons.create',
                'store' => config('modules.client').'.principals.contact-persons.store',
                'show' => config('modules.client').'.principals.contact-persons.show',
                'edit' => config('modules.client').'.principals.contact-persons.edit',
                'update' => config('modules.client').'.principals.contact-persons.update',
                'destroy' => config('modules.client').'.principals.contact-persons.destroy'
            ]
        ]);
    });

    
    Route::group(['namespace'=>'Questionnaire'], function() {
        Route::group(['prefix'=>'questionnaire'], function() {
            Route::get('get-template-data', 'TemplateController@getTemplateData');
            Route::get('select2', array('as' => config('modules.client').'.questionnaire.select2', 'uses' => 'TemplateController@select2'));
            Route::get('{template_id}/preview', array('as' => config('modules.client').'.questionnaire.preview', 'uses' => 'TemplateController@preview'));
            Route::get('{template_id}/result', array('as' => config('modules.client').'.questionnaire.result', 'uses' => 'TemplateController@result'));
            
            Route::post('{id}/copy', array('as' => config('modules.client').'.questionnaire.copy', 'uses'=>'TemplateController@copyTemplate'));
            Route::get('{template_id}/get-question-data', 'QuestionController@getQuestionData');
            Route::post('{id}/question/copy', array('as' => config('modules.client').'.questionnaire.question.copy', 'uses'=>'QuestionController@copyQuestion'));
            Route::post('{template_id}/question/sort', array('as' => config('modules.client').'.questionnaire.question.sort', 'uses'=>'QuestionController@sortQuestion'));
           
           /* Route::get('{principal_id}/login', 'PrincipalController@login');*/
        });

        Route::resource('questionnaire', 'TemplateController', 
        [
            'names' => [
                'index' => config('modules.client').'.questionnaire.index',
                'create' => config('modules.client').'.questionnaire.create',
                'store' => config('modules.client').'.questionnaire.store',
                'show' => config('modules.client').'.questionnaire.show',
                'edit' => config('modules.client').'.questionnaire.edit',
                'update' => config('modules.client').'.questionnaire.update',
                'destroy' => config('modules.client').'.questionnaire.destroy'
            ]
        ]);

        Route::resource('questionnaire.question', 'QuestionController', 
        [
            'names' => [
                'index' => config('modules.client').'.questionnaire.question.index',
                'create' => config('modules.client').'.questionnaire.question.create',
                'store' => config('modules.client').'.questionnaire.question.store',
                'show' => config('modules.client').'.questionnaire.question.show',
                'edit' => config('modules.client').'.questionnaire.question.edit',
                'update' => config('modules.client').'.questionnaire.question.update',
                'destroy' => config('modules.client').'.questionnaire.question.destroy'
            ]
        ]);
    });

    Route::group(['namespace'=>'Subject'], function() {
        Route::group(['prefix'=>'subject'], function() {
            Route::get('get-datatables-index', 'SubjectController@getDatatablesIndex');
        });
        Route::resource('subject', 'SubjectController', 
        [
            'names' => [
                'index' => config('modules.client').'.subject.index',
                'create' => config('modules.client').'.subject.create',
                'store' => config('modules.client').'.subject.store',
                'show' => config('modules.client').'.subject.show',
                'edit' => config('modules.client').'.subject.edit',
                'update' => config('modules.client').'.subject.update',
                'destroy' => config('modules.client').'.subject.destroy'
            ]
        ]);
    });

     Route::group(['namespace'=>'Officers'], function() {
        Route::group(['prefix'=>'officers'], function() {
            Route::get('get-datatables-index', 'OfficerController@getDatatablesIndex');
        });

        Route::resource('officers', 'OfficerController', 
        [
            'names' => [
                'index' => config('modules.client').'.officer.index',
                'create' => config('modules.client').'.officer.create',
                'store' => config('modules.client').'.officer.store',
                'show' => config('modules.client').'.officer.show',
                'edit' => config('modules.client').'.officer.edit',
                'update' => config('modules.client').'.officer.update',
                'destroy' => config('modules.client').'.officer.destroy'
            ]
        ]);
    });

    Route::group(['namespace'=>'JobOpening'], function() {
        Route::group(['prefix'=>'job-opening'], function() {
            Route::get('/details/{id}', array('as' => config('modules.client').'.job-opening.details', 'uses' => 'JobOpeningController@details'));
            Route::post('get-job-data', array('as' => config('modules.client').'.job-opening.datatables-index', 'uses' => 'JobOpeningController@getJobData'));
        });

        Route::resource('job-opening', 'JobOpeningController', 
        [
            'names' => [
                'index' => config('modules.client').'.job-opening.index',
                'create' => config('modules.client').'.job-opening.create',
                'store' => config('modules.client').'.job-opening.store',
                'show' => config('modules.client').'.job-opening.show',
                'edit' => config('modules.client').'.job-opening.edit',
                'update' => config('modules.client').'.job-opening.update',
                'destroy' => config('modules.client').'.job-opening.destroy'
            ]
        ]);
    });

    Route::group(['namespace'=>'Applicants'], function() {
        Route::group(['prefix'=>'applicants'], function() {
            Route::get('/', array('as' => config('modules.client').'.applicants.index', 'uses' => 'ApplicantsController@index'));
            Route::get('/{id}/view', array('as' => config('modules.client').'.applicants.view', 'uses' => 'ApplicantsController@view'));
            Route::get('/{id}/excel', array('as' => config('modules.client').'.applicants.excel', 'uses' => 'ApplicantsController@excel'));

            Route::post('get-applicants-data', array('as' => config('modules.client').'.applicants.datatables-index', 'uses' => 'ApplicantsController@getApplicantsData'));
            Route::post('get-applicants-list-data/{id}', array('as' => config('modules.client').'.applicants-list.datatables-index', 'uses' => 'ApplicantsController@getApplicantListData'));

            Route::group(['prefix'=>'search'], function() {
                Route::get('/', array('as' => config('modules.client').'.search-applicants.index', 'uses' => 'SearchApplicantsController@index'));
                Route::post('get-search-applicants-data', array('as' => config('modules.client').'.search-applicants.datatables-index', 'uses' => 'SearchApplicantsController@getSearchApplicantsData'));
            });

            Route::group(['prefix'=>'source'], function() {
                Route::get('/', array('as' => config('modules.client').'.source-applicants.index', 'uses' => 'SourceApplicantsController@index'));
                Route::post('/view', array('as' => config('modules.client').'.source-applicants.show', 'uses' => 'SourceApplicantsController@show'));
                Route::get('/view/excel', array('as' => config('modules.client').'.source-applicants.excel', 'uses' => 'SourceApplicantsController@excel'));
                Route::post('get-source-applicants-data', array('as' => config('modules.client').'.source-applicants.datatables-index', 'uses' => 'SourceApplicantsController@getSourceApplicantsData'));
            });
        });
    });

    Route::group(['namespace'=>'Pages'], function() {
        Route::group(['prefix'=>'pages'], function() {
            //FAQ
            Route::group(['prefix'=>'faq'], function() {
                Route::get('/details/{id}', array('as' => config('modules.client').'.faq.details', 'uses' => 'FAQController@details'));
                Route::post('get-faq-data', array('as' => config('modules.client').'.faq.datatables-index', 'uses' => 'FAQController@getFAQData'));
            });
            Route::resource('faq', 'FAQController', 
            [
                'names' => [
                    'index' => config('modules.client').'.faq.index',
                    'create' => config('modules.client').'.faq.create',
                    'store' => config('modules.client').'.faq.store',
                    'show' => config('modules.client').'.faq.show',
                    'edit' => config('modules.client').'.faq.edit',
                    'update' => config('modules.client').'.faq.update',
                    'destroy' => config('modules.client').'.faq.destroy'
                ]
            ]);

            //About Us
            Route::group(['prefix'=>'about-us'], function() {
                Route::get('/details/{id}', array('as' => config('modules.client').'.about-us.details', 'uses' => 'AboutUsController@details'));
                Route::post('get-about-us-data', array('as' => config('modules.client').'.about-us.datatables-index', 'uses' => 'AboutUsController@getAboutUsData'));
            });
            Route::resource('about-us', 'AboutUsController', 
            [
                'names' => [
                    'index' => config('modules.client').'.about-us.index',
                    'create' => config('modules.client').'.about-us.create',
                    'store' => config('modules.client').'.about-us.store',
                    'show' => config('modules.client').'.about-us.show',
                    'edit' => config('modules.client').'.about-us.edit',
                    'update' => config('modules.client').'.about-us.update',
                    'destroy' => config('modules.client').'.about-us.destroy'
                ]
            ]);

            //Contact Us
            Route::group(['prefix'=>'contact-us'], function() {
                Route::post('get-about-us-data', array('as' => config('modules.client').'.contact-us.datatables-index', 'uses' => 'ContactUsController@getContactUsData'));
            });
            Route::resource('contact-us', 'ContactUsController', 
            [
                'names' => [
                    'index' => config('modules.client').'.contact-us.index',
                    'create' => config('modules.client').'.contact-us.create',
                    'store' => config('modules.client').'.contact-us.store',
                    'show' => config('modules.client').'.contact-us.show',
                    'edit' => config('modules.client').'.contact-us.edit',
                    'update' => config('modules.client').'.contact-us.update',
                    'destroy' => config('modules.client').'.contact-us.destroy'
                ]
            ]);
        });
    });

    Route::group(['namespace'=>'Pages'], function() {
        Route::group(['prefix'=>'pages'], function() {
            Route::get('/', array('uses' => 'PagesController@index', 'as' => config('modules.client').'.pages.index'));
            Route::get('/create', array('uses' => 'PagesController@create', 'as' => 'create'));
            Route::post('/store', array('uses' => 'PagesController@store', 'as' => 'store'));
            Route::get('/edit/{id}', array('uses' => 'PagesController@edit', 'as' => 'edit'));
            Route::post('/update/{id}', array('uses' => 'PagesController@update', 'as' => 'update'));
            Route::get('/destroy/{id}', array('uses' => 'PagesController@destroy', 'as' => 'destroy'));

            Route::post('/get-page-data', array('uses' => 'PagesController@getPagesData', 'as' => 'getPagesData'));
        });
    });

    Route::group(['namespace'=>'Directory'], function() {
        Route::group(['prefix' => 'directory-store'], function() {
            Route::get('/', array('uses' => 'DirectoriesController@index', 'as' => config('modules.client').'.directory.index'));
            Route::get('/create', array('uses' => 'DirectoriesController@create', 'as' => 'create'));
            Route::post('/store', array('uses' => 'DirectoriesController@store', 'as' => 'store'));
            Route::get('/edit/{id}', array('uses' => 'DirectoriesController@edit', 'as' => 'edit'));
            Route::post('/update/{id}', array('uses' => 'DirectoriesController@update', 'as' => 'update'));
            Route::get('/destroy/{id}', array('uses' => 'DirectoriesController@destroy', 'as' => 'destroy'));

            Route::post('/get-directories-data', array('uses' => 'DirectoriesController@getDirectoriesData', 'as' => 'getDirectoriesData'));
        });

        Route::group(['prefix' => 'modals'], function() {
            Route::group(['prefix' => 'affiliates'], function() {
                Route::post('/store', array('uses' => 'AffiliatesController@store', 'as' => 'storeAffiliates'));
                Route::get('/destroy/{id}', array('uses' => 'AffiliatesController@destroy', 'as' => 'destroyAffiliates'));
                Route::post('/update', array('uses' => 'AffiliatesController@update', 'as' => 'update'));

                Route::post('/get-affiliates-data', array('uses' => 'AffiliatesController@getAffiliatesData', 'as' => 'getAffiliatesData'));
            });
            Route::group(['prefix' => 'specialization'], function() {
                Route::post('/store', array('uses' => 'SpecializationsController@store', 'as' => 'storeSpecializations'));
                Route::get('/destroy/{id}', array('uses' => 'SpecializationsController@destroy', 'as' => 'destroySpecializations'));
                Route::post('/update', array('uses' => 'SpecializationsController@update', 'as' => 'update'));

                Route::post('/get-specialization-data', array('uses' => 'SpecializationsController@getSpecializationsData', 'as' => 'getSpecializationsData'));
            });
        });
    });

    Route::group(['namespace'=>'Products'], function() {
        Route::group(['prefix'=>'products'], function() {
            Route::get('/', array('uses' => 'ProductController@index', 'as' => config('modules.client').'.products.index'));
            Route::get('/create', array('uses' => 'ProductController@create', 'as' => 'create'));
            Route::post('/store', array('uses' => 'ProductController@store', 'as' => 'store'));
            Route::get('/edit/{id}', array('uses' => 'ProductController@edit', 'as' => 'edit'));
            Route::post('/update/{id}', array('uses' => 'ProductController@update', 'as' => 'update'));
            Route::get('/destroy/{id}', array('uses' => 'ProductController@destroy', 'as' => 'destroy'));

            Route::post('/get-product-data', array('uses' => 'ProductController@getProductData', 'as' => 'getProductData'));
        });
        Route::group(['prefix' => 'modals'], function() {
            Route::group(['prefix' => 'brand'], function() {
                Route::post('/store', array('uses' => 'ProductBrandController@store', 'as' => 'store'));
                Route::get('/destroy/{id}', array('uses' => 'ProductBrandController@destroy', 'as' => 'destroy'));
                Route::post('/update', array('uses' => 'ProductBrandController@update', 'as' => 'update'));

                Route::post('/get-brand-data', array('uses' => 'ProductBrandController@getproductBrandData', 'as' => 'getproductBrandData'));
            });
            Route::group(['prefix' => 'category'], function() {
                Route::post('/store', array('uses' => 'ProductCategoryController@store', 'as' => 'store'));
                Route::get('/destroy/{id}', array('uses' => 'ProductCategoryController@destroy', 'as' => 'destroy'));
                Route::post('/update', array('uses' => 'ProductCategoryController@update', 'as' => 'update'));

                Route::post('/get-category-data', array('uses' => 'ProductCategoryController@getproductCategoryData', 'as' => 'getproductCategoryData'));
            });
        });
    });

    Route::group(['namespace'=>'Posts'], function() {
        Route::group(['prefix'=>'posts'], function() {
            Route::get('/', array('uses' => 'PostsController@index', 'as' => config('modules.client').'.posts.index'));
            Route::get('/create', array('uses' => 'PostsController@create', 'as' => 'create'));
            Route::post('/store', array('uses' => 'PostsController@store', 'as' => 'store'));
            Route::get('/edit/{id}', array('uses' => 'PostsController@edit', 'as' => 'edit'));
            Route::post('/update/{id}', array('uses' => 'PostsController@update', 'as' => 'update'));
            Route::get('/destroy/{id}', array('uses' => 'PostsController@destroy', 'as' => 'destroy'));

            Route::post('/get-post-data', array('uses' => 'PostsController@getPostsData', 'as' => 'getPostsData'));
        });
        Route::group(['prefix' => 'modals'], function() {
            Route::group(['prefix' => 'postcategory'], function() {
                Route::post('/store', array('uses' => 'PostCategoryController@store', 'as' => 'store'));
                Route::get('/destroy/{id}', array('uses' => 'PostCategoryController@destroy', 'as' => 'destroy'));
                Route::post('/update', array('uses' => 'PostCategoryController@update', 'as' => 'update'));

                Route::post('/get-post-category-data', array('uses' => 'PostCategoryController@getPostCategoryData', 'as' => 'getPostCategoryData'));
            });
        });
    });

    Route::group(['namespace'=>'Reports'], function() {
        Route::group(['prefix'=>'reports'], function() {
            Route::group(['prefix' => 'audittrail'], function(){
                Route::get('/', array('uses' => 'AuditTrailController@index', 'as' => 'index'));
                Route::post('/view', array('uses' => 'AuditTrailController@show', 'as' => 'show'));
                Route::get('/excel', array('uses' => 'AuditTrailController@excel', 'as' => config('modules.client').'.audittrail.excel'));

                Route::post('/get-user-report-data', array('uses' => 'AuditTrailController@getReportsDataByUser', 'as' => 'getReportsDataByUser'));
            });
        });
    });
});Modules/Client/Controllers/Principals/PrincipalController.php000066400000017150152434100730020507 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Principals;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use DB;
use Auth;
use Datatables;

use QxCMS\Modules\Client\Requests\Principals\PrincipalRequest;
use QxCMS\Modules\Client\Repositories\Principals\PrincipalRepositoryInterface as Principal;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;

class PrincipalController extends Controller
{
	protected $principal;
	protected $permission;
	protected $auth;
	protected $prefix_name = '';

	public function __construct(
        Principal $principal,
        Permission $permission
    )
	{
		$this->principal = $principal;
		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->principal->getModuleId());
    }

    public function index()
    {
    	$this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();    
        $data['userLogs'] = $this->principal->getUserLogs($this->principal->getModuleId());    
        return view('Client::principals.index', $data);
    }

    public function show($id)
    {
        $this->authorize('activated', $this->permissions());
    }

    public  function overview($hashid)
    {
        $this->authorize('activated', $this->permissions());
        $data['permissions'] = $this->permissions();  
        $id = decode($hashid);
        $data['principal'] = $this->principal->with(['contacts'])->find($id);

        return view('Client::principals.overview', $data);
    }

    public function create()
    {   
        $this->authorize('create', $this->permissions());
        $data['statuses'] = $this->principal->getPrincipalStatusLists();

        return view('Client::principals.create', $data);
    }

    public function store(PrincipalRequest $request)
    {
        $this->authorize('create', $this->permissions());
        $input = $request->all();
        $input['client_id'] = $this->auth->user()->client->id;
        $principal = $this->principal->create($input);
        if(!$request->ajax()) {         
            session()->flash('success', 'Successfully added.');
            return redirect($this->prefix_name.'/principals/'.$principal->hashid.'/edit');
        }

        return response(
                array('message'=>'Successfully added.','type'=>'success', 'row' => $principal)
            )->header('Content-Type', 'application/json');
    }

    public function edit($hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $data['permissions'] = $this->permissions();
        $data['statuses'] = $this->principal->getPrincipalStatusLists();
        $data['principal'] = $this->principal->findById($id);
        $data['userLogs'] = $this->principal->getUserLogs($this->principal->getModuleId(), $id);
        return view('Client::principals.edit', $data);
    }

    public function update(PrincipalRequest $request, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
      
        $input = $request->all();
        $input['client_id'] = $this->auth->user()->client->id;
        $principal = $this->principal->update($id, $input);

        return redirect($this->prefix_name.'/principals/'.$principal->hashid.'/edit');
    }

    public function destroy($hashid)
    {
        $this->authorize('delete', $this->permissions());
        $id = decode($hashid);
        return $this->principal->delete($id);      
    }

    public function select2(Request $request)
    {   
        return $this->principal->select2($request->all());
    }

    public function login(Request $request, $hashid)
    {
        $id = decode($hashid);
        $client = $this->auth->user()->client;
        $root_dir = $client->root_dir;
        session(['root_dir'=>$root_dir]);        
        if (Auth::guard('employer')->loginUsingId($id)) {
            $user = Auth::guard('employer')->user();
            if($user->status == 'Active')
            {
                return redirect('/employer/'.$root_dir.'/dashboard');
            } else {
                Auth::guard('employer')->logout();
                $request->session()->regenerate();
                session()->flash('error_logout', 'This principal is inactive.');
                return redirect(config('modules.employer').'/'.$root_dir.'/auth/login');
            }
        } else {
            return "not login";
        }
    }

    /*
    * Datatables
    */
    public function getPrincipalsData()
    {           
        $principals = $this->principal->select([
            'principals.id',
            'principals.name',
            'principals.email',
            'principals.status',
            'principals.address',
            'principals.contact_details'
        ]);

        $permissions = $this->permissions();
        return Datatables::of($principals)
            ->editColumn('status', function($principal) {
                if($principal->status == 'Active') return '<span class="label label-success">Active</span>';
                else return '<span class="label label-danger">Inactive</span>';
            })
            ->addColumn('details', function($model) {
                $html_out = '';
                if($model->name != "") {
                    $html_out .= '<a href="'.url($this->prefix_name.'/principals/'.$model->hashid.'/overview').'"><font size="4">'.$model->name.'</font></a>';
                }

                if($model->address != '')
                {
                    $html_out .= "<br /><i class=\"fa fa-map-marker\"></i> ".$model->address;
                }

                if($model->email != '')
                {
                    $html_out .= "<br /><i class=\"fa fa-envelope\"></i> ".$model->email;
                }

                if($model->contact_details != '')
                {
                    if(is_array($model->contact_details)) {

                        $html_out .= "<br /><i class=\"fa fa-phone\"></i> ".implode(', ', $model->contact_details);

                    }
                }
                return $html_out;
            })
            ->filterColumn('details', function($query, $keyword) {
                   $query->whereRaw("name like ?", ["%{$keyword}%"]);
            })
            ->addColumn('action', function ($principal) use ($permissions){
                $html_out = '';
                if($this->auth->user()->can('update', $permissions)) {
                    $html_out .= '<a href="'.url($this->prefix_name.'/principals/'.$principal->hashid.'/edit').'" class="btn btn-xs btn-flat btn-warning" data-toggle="tooltip" data-placement="top" title="Edit"><i class="fa fa-pencil"></i></a>';
                }
                if($this->auth->user()->can('delete', $permissions)) {
                    $html_out .= '&nbsp;&nbsp;<a href="#delete-'.$principal->hashid.'" class="btn btn-xs btn-flat btn-danger" id="btn-delete" data-action="'.url($this->prefix_name).'/principals/'.$principal->hashid.'" data-toggle="tooltip" data-placement="top" title="Delete"><i class="fa fa-trash-o"></i></a>';
                }

               /* if($this->auth->user()->role_id == 1) {
                    $html_out .= '&nbsp;&nbsp;<a href="'.url($this->prefix_name.'/principals/'.$principal->hashid.'/login').'" class="btn btn-xs btn-flat btn-success" data-toggle="tooltip" data-placement="top" title="Login" target="_blank"><i class="fa fa-sign-in"></i></a>';
                }*/
                return $html_out;
            })
            ->orderColumn('details', 'name $1')
			->make(true);
    }
}Modules/Client/Controllers/Principals/ContactPersonController.php000066400000020631152434100730021346 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Principals;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use DB;
use Auth;
use Datatables;

use QxCMS\Modules\Client\Requests\Principals\ContactPersonRequest;
use QxCMS\Modules\Client\Repositories\Principals\ContactPersonRepositoryInterface as ContactPerson;
use QxCMS\Modules\Client\Repositories\Principals\ContactNumberRepositoryInterface as ContactNumber;
use QxCMS\Modules\Client\Repositories\Principals\PrincipalRepositoryInterface as Principal;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;

class ContactPersonController extends Controller
{
	protected $principal;
    protected $person;
    protected $number;
	protected $permission;
	protected $auth;
	protected $prefix_name = '';

	public function __construct(
        Principal $principal,
        ContactNumber $number,
        ContactPerson $person,
        Permission $permission
    )
	{
		$this->principal = $principal;
        $this->person = $person;
        $this->number = $number;
		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->principal->getModuleId());
    }

    public function index($principal_hashid)
    {
    	$this->authorize('activated', $this->permissions());
        $principal_id  = decode($principal_hashid);

    	$data['permissions'] = $this->permissions();       
        $data['principal'] = $this->principal->findById($principal_id);
        $data['userLogs'] = $this->person->getUserLogs($this->person->getModuleId(), '', 'Contacts-'.$principal_id);
        return view('Client::principals.contact-persons.index', $data);
    }

    public function show($id)
    {
        $this->authorize('activated', $this->permissions());
    }

    public function create($principal_hashid)
    {   
        $this->authorize('create', $this->permissions());

        $principal_id  = decode($principal_hashid);
        $data['principal'] = $this->principal->findById($principal_id);
        return view('Client::principals.contact-persons.create', $data);
    }

    public function store(ContactPersonRequest $request, $principal_hashid)
    {
        $this->authorize('create', $this->permissions());
        $principal_id  = decode($principal_hashid);
        $input = $request->except(['contact']);
        $input['principal_id'] = $principal_id;
        $person = $this->person->create($input);

        $contacts = array_filter($request->get('contact'), 'strlen');
        if(!empty($contacts)) {
            foreach ($contacts as $contact_key => $contact) {
               $input_number['contact'] = $contact;
               $input_number['principal_contact_id'] = $person->id;
               $this->number->create($input_number);
            }
        }
        if(!$request->ajax()) {         
            session()->flash('success', 'Successfully added.');
            return redirect($this->prefix_name.'/principals/'.hashid($principal_id).'/contact-persons');
        }

        return response(
                array('message'=>'Successfully added.','type'=>'success', 'row' => $person)
            )->header('Content-Type', 'application/json');
    }

    public function edit($principal_hashid, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $principal_id = decode($principal_hashid);
        $id = decode($hashid);

        $data['principal'] = $this->principal->findById($principal_id);
        $data['contact'] = $this->person->with(['numbers'])->find($id);
        $data['userLogs'] = $this->person->getUserLogs($this->person->getModuleId(), $id, 'Contacts-'.$principal_id);

        return view('Client::principals.contact-persons.edit', $data);
    }

    public function update(ContactPersonRequest $request, $principal_hashid, $hashid)
    {
        $this->authorize('update', $this->permissions());

        $principal_id = decode($principal_hashid);
        $id = decode($hashid);

        $input = $request->except(['contact']);
        $input['principal_id'] = $principal_id;

        $person = $this->person->update($id, $input);


        $contacts = array_filter($request->get('contact'), 'strlen');

       $check = $this->number->where('principal_contact_id', $id)->whereNotIn('id', array_keys($contacts));
        if(count($check->get()) > 0) {
            $check->delete();
            session()->flash('success', 'Successfully updated.');
        }
        if(!empty($contacts)) {
            foreach ($contacts as $contact_key => $contact) {
                $input_number['contact'] = $contact;
                $input_number['principal_contact_id'] = $person->id;

                if(starts_with($contact_key, 'new')) {
                    $this->number->create($input_number);
                    session()->flash('success', 'Successfully updated.');
                } else {
                    $this->number->update($contact_key, $input_number);
                }
            }
        }

        return redirect($this->prefix_name.'/principals/'.hashid($principal_id).'/contact-persons/'.$person->hashid.'/edit');
    }

    public function destroy($principal_hashid, $hashid)
    {
        $this->authorize('delete', $this->permissions());
        $principal_id = decode($principal_hashid);
        $id = decode($hashid);
        return $this->person->delete($id);      
    }

    /*
    * Datatables
    */
    public function getContactPersonsData($principal_hashid)
    {   
        $principal_id = decode($principal_hashid);        
        $contacts = $this->person->select([
            'id',
            'principal_id',
            'name',
            'position',
            'email'
        ])->with(['numbers'])->where(function($query) use ($principal_id){
            if($principal_id) $query->where('principal_id', $principal_id);
        });

        $permissions = $this->permissions();

        return Datatables::of($contacts)
            
            ->addColumn('contact_details', function($model){
                $html_out = "";
                if($model->name != '')
                {
                    $html_out .= '<b>Name:</b>&nbsp;<a href="'.url($this->prefix_name.'/principals/'.hashid($model->principal_id).'/contact-persons/'.$model->hashid.'/edit').'"><font size="4">'.$model->name.'</font></a>';
                    $html_out .= "<br /><b>Position:</b>&nbsp;".$model->position; 
                    $html_out .= "<br /><b>Email:</b>&nbsp;".$model->email; 
                }
                return $html_out;
            })
            ->addColumn('contact_numbers', function($model){
                $html_out = "";
                if(count($model->numbers) > 0) {
                    foreach ($model->numbers as $number_key => $number) {
                        $html_out .= "<i class=\"fa fa-mobile\"></i> ".$number->contact."<br />";
                    }
                }

                return $html_out;
            })
            ->editColumn('name', function($model){
                $html_out = '';
                if($model->name != '')
                {
                    $html_out .= '<a href="'.url($this->prefix_name.'/principals/'.hashid($model->principal_id).'/contact-persons/'.$model->hashid.'/edit').'">'.$model->name.'</a>';
                }
                return $html_out;
            })
            ->addColumn('action', function ($model) use ($permissions){
                $html_out = '';
                if($this->auth->user()->can('update', $permissions)) {
                    $html_out .= '<a href="'.url($this->prefix_name.'/principals/'.hashid($model->principal_id).'/contact-persons/'.$model->hashid.'/edit').'" class="btn btn-xs btn-flat btn-warning" data-toggle="tooltip" data-placement="top" title="Edit"><i class="fa fa-pencil"></i></a>';
                }
                if($this->auth->user()->can('delete', $permissions)) {
                    $html_out .= '&nbsp;&nbsp;<a href="#delete-'.$model->hashid.'" class="btn btn-xs btn-flat btn-danger" id="btn-delete" data-action="'.url($this->prefix_name).'/principals/'.hashid($model->principal_id).'/contact-persons/'.$model->hashid.'" data-toggle="tooltip" data-placement="top" title="Delete"><i class="fa fa-trash-o"></i></a>';
                }                               
              
                return $html_out;
            })
            ->orderColumn('contact_details', 'name $1')
			->make(true);
    }
}Modules/Client/Controllers/Subject/SubjectController.php000066400000014230152434100730017454 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Subject;

use DB;
use Auth;
use Datatables;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Requests\Subject\SubjectRequest;
use QxCMS\Modules\Client\Repositories\Subject\SubjectRepositoryInterface as Subject;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;

class SubjectController extends Controller
{
	protected $subject;
	protected $permission;
	protected $auth;
	protected $prefix_name = '';

	public function __construct(Subject $subject, Permission $permission)
	{
		$this->subject = $subject;
		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        $this->getDetails($this->subject->getModuleId());
	}

	public function permissions()
    {

        return $this->permission->getPermission($this->subject->getModuleId());
    }

    public function index() 
    {
    	$this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();
        $data['userLogs'] = $this->subject->getUserLogs($this->subject->getModuleId());
        return view('Client::subject.index', $data);    	
    }
    public function create()
    {
        $this->authorize('create', $this->permissions());        
        $data['permissions'] = $this->permissions();
        return view('Client::subject.create', $data);
    }

    public function store(SubjectRequest $request)
    {
        $this->authorize('create', $this->permissions());
        $input = $request->all();
        $subject = $this->subject->create($input); 
        session()->flash('success', 'Successfully added.');

        return redirect($this->prefix_name.'/subject');
    }

    public function show($id)
    {
        $this->authorize('activated', $this->permissions());
        return $id;
    }

    public function edit($hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);

        $data['subject'] = $this->subject->with(['principal', 'template', 'fieldOfficer', 'editor'])->find($id);
        $data['permissions'] = $this->permissions();
        $data['userLogs'] = $this->subject->getUserLogs($this->subject->getModuleId(), $id);

        return view('Client::subject.edit', $data);
    }

    public function update(SubjectRequest $request, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $subject = $this->subject->update($id, $request->all());
        return redirect($this->prefix_name.'/subject');
    }

    public function destroy($hashid)
    {
        $this->authorize('delete', $this->permissions());
        $id = decode($hashid);
        return $this->subject->delete($id); 
    }

  
    public function getDatatablesIndex(Request $request)
    {        

        $permissions = $this->permissions();
        $subjects = $this->subject->datatablesIndex();

        return Datatables::of($subjects)
            ->editColumn('status', function($model){
                if($model->status == 'Close') return '<span class="label label-danger">Close</span>';
                return '<span class="label label-success">Open</span>';
            })
            ->editColumn('created_at', function($model){
                return $model->created_at->format('M d, Y');
            })
            ->addColumn('details', function($model){
                $html_out = "";
                $html_out .= "<font size=\"4\"><b>Subject:&nbsp;</b>".$model->name."</font>";

                if(isset($model->principal->name)) {
                    $html_out .= "<br/><b>Client:&nbsp;</b><a href=\"".route(config('modules.client').'.settings.principals.overview', hashid($model->principal_id))."\">".$model->principal->name.'</a>';
                }

                if(isset($model->template->title)) {
                    $html_out .= "<br/><b>Questionnaire:&nbsp;</b><a href=\"".route(config('modules.client').'.questionnaire.question.index', hashid($model->template_id))."\">".$model->template->title."</a>";
                }

                if(!empty($model->interview_date))
                {
                    $html_out .= "<br/><b>Interview Date:&nbsp;</b>".$model->interview_date;
                }

                if(!empty($model->completion_date))
                {
                    $html_out .= "<br/><b>Interview Date Completion:&nbsp;</b>".$model->completion_date;
                }

                return $html_out;
            })
            ->addColumn('assigned_to', function($model) {
                $html_out = "";
                if(isset($model->fieldOfficer->name))
                {
                    $html_out .= "<b>Field Officer:</b>&nbsp;<font size=\"3\">".$model->fieldOfficer->name."</font>";
                }
                if(isset($model->editor->name))
                {
                    $html_out .= "<br /><b>Editor:</b>&nbsp;<font size=\"3\">".$model->editor->name."</font>";
                }
                return $html_out;
            })


            ->addColumn('action', function ($model) use ($permissions) {
                $html_out = '';
                
                if($this->auth->user()->can('update', $permissions)) {
                    $html_out .= '<a href="'.url($this->prefix_name.'/subject/'.$model->hashid.'/edit').'" class="btn btn-xs btn-flat btn-warning" data-toggle="tooltip" data-placement="top" title="Edit"><i class="fa fa-pencil"></i></a>';
                }
                if($this->auth->user()->can('delete', $permissions)) {
                    $html_out .= '&nbsp;&nbsp;<a href="#delete-'.$model->hashid.'" class="btn btn-xs btn-flat btn-danger" id="btn-delete" data-action="'.url($this->prefix_name).'/subject/'.$model->hashid.'" data-toggle="tooltip" data-placement="top" title="Delete"><i class="fa fa-trash-o"></i></a>';
                }
                
                return $html_out;
            })
            ->filterColumn('details', function($query, $keyword) {
                $query->whereRaw("name like ?", ["%{$keyword}%"]);
            })
            ->orderColumn('details', 'interview_date $1, completion_date $1')
            ->make(true);
    }

}Modules/Client/Controllers/JobOpening/JobOpeningController.php000066400000013266152434100730020552 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\JobOpening;

use Auth;
use Session;
use Datatables;
use Carbon\Carbon;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Models\Settings\Country;
use QxCMS\Modules\Client\Requests\JobOpening\JobOpeningRequest;
use QxCMS\Modules\Client\Repositories\JobOpening\JobOpeningRepositoryInterface as JobOpening;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;

class JobOpeningController extends Controller
{
	protected $job_opening;
	protected $permission;
	protected $auth;
    protected $country;
	protected $prefix_name = '';

	public function __construct(Permission $permission, JobOpening $job_opening, Country $country)
	{
        $this->country = $country;
		$this->job_opening = $job_opening;

		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        $this->getDetails($this->job_opening->getModuleId());
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->job_opening->getModuleId());
    }

    public function index() 
    {
    	$this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();
        $data['userLogs'] = $this->job_opening->getUserLogs($this->job_opening->getModuleId());
        return view('Client::job-opening.index', $data, $this->getFormOptions());    	
    }

    public function create()
    {
        $this->authorize('create', $this->permissions());
        $data['permissions'] = $this->permissions();
        return view('Client::job-opening.create', $data, $this->getFormOptions());
    }

    public function store(JobOpeningRequest $request)
    {
        $this->authorize('create', $this->permissions());
        $job_opening = $this->job_opening->create($request); 

        if($request->get('_save') == 'add_another') {
            session()->flash('success', 'Successfully added. Please add another.');
            return redirect($this->prefix_name.'/job-opening/create');
        }

        session()->flash('success', 'Successfully added.');
        return redirect($this->prefix_name.'/job-opening');
    }

    public function show($id)
    {
        //
    }

    public function edit($hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $data['permissions'] = $this->permissions();
        $data['job'] = $this->job_opening->findById($id);
        $data['userLogs'] = $this->job_opening->getUserLogs($this->job_opening->getModuleId(), $id);
        return view('Client::job-opening.edit', $data, $this->getFormOptions());
    }

    public function update(JobOpeningRequest $request, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);

        $pages = $this->job_opening->update($id, $request);
        return redirect($this->prefix_name.'/job-opening');
    }

    public function destroy($hashid)
    {
        $this->authorize('delete', $this->permissions());
        $id = decode($hashid);
        return $this->job_opening->delete($id);
    }

    public function details(Request $request, $hashid)
    {
        $id = decode($hashid);
        $job = $this->job_opening->where('id', $id)->with('country')->first();
        if($request->ajax()) {
            return $job;
        }
    }
  
    public function getJobData(Request $request)
    {
        $job = $this->job_opening->select(['job_opening.*']);
        $permissions = $this->permissions();

        return Datatables::of($job)
            ->filter(function ($query) use ($request) {
                if ($request->has('position')) {
                    $query->where('position', 'like', "%{$request->get('position')}%");
                }
                if ($request->has('status')) {
                    $query->where('status', '=', "{$request->get('status')}");
                }
            })
            ->editColumn('position', function($job){
                return '<span data-toggle="tooltip" data-placement="top" title="View Details"><a href="#job-details-modal" data-toggle="modal" data-details_url="'.route($this->prefix_name.'.job-opening.details', $job->hashid).'">'.$job->position.'</a></span>';
            })
            ->editColumn('opening_date', function($job){
                return Carbon::parse($job->opening_date)->format('M j, Y');
            })
            ->editColumn('closing_date', function($job){
                return Carbon::parse($job->closing_date)->format('M j, Y');
            })
            ->addColumn('action', function($job) use ($permissions){
                $html = '';
                if($this->auth->user()->can('update', $permissions)) {
                    $html .= '<a href="'.route($this->prefix_name.'.job-opening.edit', $job->hashid).'"><button type="button" data-toggle="tooltip" title="Edit" class="btn btn-warning btn-xs btn-flat edited"><span class="glyphicon glyphicon-pencil"></span></button></a>';
                }
                if($this->auth->user()->can('delete', $permissions)) {
                    $html .= '&nbsp;&nbsp;<a href="#delete-'.$job->hashid.'" class="btn btn-xs btn-flat btn-danger" id="btn-delete" data-action="'.route($this->prefix_name.'.job-opening.destroy', $job->hashid).'" data-toggle="tooltip" data-placement="top" title="Delete"><i class="fa fa-trash-o"></i></a>';
                }
                return $html;
            })
            ->make(true);
    }

    protected function getFormOptions()
    {
        $data['status'] = Array('Open' => 'Open', 'Close' => 'Close', 'Draft' => 'Draft');
        $data['country'] = $this->country->pluck('name', 'id');
        return $data;
    }

}Modules/Client/Controllers/Officers/OfficerController.php000066400000014073152434100730017600 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Officers;

use DB;
use Auth;
use Carbon\Carbon;
use Datatables;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Requests\Officers\OfficerRequest;
use QxCMS\Modules\Client\Repositories\Officers\OfficerRepositoryInterface as Officer;
use QxCMS\Modules\Client\Repositories\Settings\Roles\RoleRepositoryInterface as Role;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;

class OfficerController extends Controller
{
	protected $officer;
    protected $role;
	protected $permission;
	protected $auth;
	protected $prefix_name = '';
    protected $module_id = 10;

	public function __construct(Officer $officer, Role $role, Permission $permission)
	{
		$this->officer = $officer;
        $this->role = $role;
		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        $this->getDetails($this->module_id);
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->module_id);
    }

    public function index() 
    {
    	$this->authorize('activated', $this->permissions());
        return view('Client::officers.index', array(), $this->globalData());
    }
    public function create()
    {
        $this->authorize('create', $this->permissions());        
        return view('Client::officers.create', array(), $this->globalData());
    }

    public function store(OfficerRequest $request)
    {
        $this->authorize('create', $this->permissions());
        $input = $request->all();
        $input['role_id'] = ((strtolower($input['access_type']) == 'editor') ? $this->role->getEditorId():$this->role->getFieldOfficerId());

        $officer = $this->officer->create($input); 
        session()->flash('success', 'Successfully added.');

        return redirect($this->prefix_name.'/officers');
    }

    public function show($id)
    {
        $this->authorize('activated', $this->permissions());
        return $id;
    }

    public function edit($hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $data['officer'] = $this->officer->findById($id);
        $data['userLogs'] = $this->officer->getUserLogs($this->module_id, $id);
       
        return view('Client::officers.edit', $data, $this->globalData());
    }

    public function update(OfficerRequest $request, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);

        $input = $request->all();
        $input['role_id'] = ((strtolower($input['access_type']) == 'editor') ? $this->role->getEditorId():$this->role->getFieldOfficerId());

        $officer = $this->officer->update($id, $input);
        return redirect($this->prefix_name.'/officers');
    }

    public function destroy($hashid)
    {
        $this->authorize('delete', $this->permissions());
        $id = decode($hashid);
        return $this->officer->delete($id); 
    }


    public function globalData()
    {
        return [
            'permissions' => $this->permissions(),
            'access_types' => $this->officer->getAccessTypes(),
            'userLogs' => $this->officer->getUserLogs($this->module_id)
        ];
    }
  
    public function getDatatablesIndex(Request $request)
    {        

        $permissions = $this->permissions();
        $officers = $this->officer->datatablesIndex();
        $permissions = $this->permissions();
        $dateformats = getDateFormatConfig('get');
        return Datatables::of($officers)
            ->filter(function($query) use ($request) {
                if($request->get('access_type')){
                    $query->where('access_type', $request->get('access_type'));
                }

                if ($keyword = $request->get('search')['value']) {
                    $query->whereRaw("name like ?", ["%{$keyword}%"]);   
                    $query->whereRaw("email like ?", ["%{$keyword}%"]);   
                }
            })


            ->editColumn('status', function($model){
                if($model->status == 0) return '<span class="label label-danger">Inactive</span>';
                return '<span class="label label-success">Active</span>';
            })
            ->editColumn('validity_date', function($model) use ($dateformats) {
                if($model->validity_date == '') return "<span class=\"label label-warning\">No Access Validity</label>";
                else {
                    $validity_date = Carbon::createFromFormat($dateformats['php'], $model->validity_date);
                    if(!$validity_date->lt(Carbon::now())) {
                        return $model->validity_date;
                    } else {
                        return '<span class="label label-danger">Account Expired</label>';
                    }
                }
            })
            ->editColumn('access_type', function($model) {
                $access_type = strtolower($model->access_type);
                if($access_type == 'field officer') return ucwords($access_type) . '&nbsp;('.$model->access_view.')';
                else return  ucwords($access_type);
            })
            ->addColumn('action', function ($model) use ($permissions) {
                $html_out = '';

                if($this->auth->user()->can('update', $permissions)) {
                    $html_out .= '<a href="'.url($this->prefix_name.'/officers/'.$model->hashid.'/edit').'" class="btn btn-xs btn-flat btn-warning" data-toggle="tooltip" data-placement="top" title="Edit"><i class="fa fa-pencil"></i></a>';
                }

                if($this->auth->user()->can('delete', $permissions)) {
                    $html_out .= '&nbsp;&nbsp;<a href="#delete-'.$model->hashid.'" class="btn btn-xs btn-flat btn-danger" id="btn-delete" data-action="'.url($this->prefix_name).'/officers/'.$model->hashid.'" data-toggle="tooltip" data-placement="top" title="Delete"><i class="fa fa-trash-o"></i></a>';
                }
                
                return $html_out;
            })
            ->make(true);
    }

}Modules/Client/Controllers/Pages/PagesController.php000066400000010633152434100730016557 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Pages;

use Auth;
use Datatables;
use Session;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Requests\Pages\PagesRequest;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;
use QxCMS\Modules\Client\Repositories\Pages\PagesRepositoryInterface as Pages;

class PagesController extends Controller
{
	protected $pages;
	protected $permission;
	protected $auth;
	protected $prefix_name = '';
    protected $module_id = 12;

	public function __construct(Permission $permission, Pages $pages)
	{
		$this->pages = $pages;

		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        $this->getDetails($this->module_id);
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->module_id);
    }

    public function index() 
    {
    	$this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();
        $data['userLogs'] = $this->pages->getUserLogs($this->module_id);
        return view('Client::pages.index', $data);    	
    }

    public function create()
    {
        $this->authorize('create', $this->permissions());        
        $data['permissions'] = $this->permissions();
        return view('Client::pages.create', $data, $this->getFormOptions());
    }

    public function store(PagesRequest $request)
    {

        $this->authorize('create', $this->permissions());
        $pages = $this->pages->create($request); 
        session()->flash('success', 'Successfully added.');

        return redirect($this->prefix_name.'/pages');
    }

    public function show($id)
    {
        //
    }

    public function edit($hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $data['permissions'] = $this->permissions();
        $data['page'] = $this->pages->findById($id);
        $data['userLogs'] = $this->pages->getUserLogs($this->module_id, $id);
        return view('Client::pages.edit', $data, $this->getFormOptions($data['page']));
    }

    public function update(PagesRequest $request, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);

        $pages = $this->pages->update($id, $request);
        return redirect($this->prefix_name.'/pages');
    }

    public function destroy($hashid)
    {
        $this->authorize('delete', $this->permissions());
        $id = decode($hashid);
        return $this->pages->delete($id); 
    }
  
    public function getPagesData(Request $request)
    {
        $pages = $this->pages->select('*')->where('post_type', '=', 'Page')->with('author');

        $permissions = $this->permissions();
        return Datatables::of($pages)
            ->filter(function ($query) use ($request) {
                if ($request->has('title')) {
                    $query->where('title', 'like', "%{$request->get('title')}%");
                }
            })
            ->editColumn('author', function($row) {
                if($row->author == null) return '';
                else return $row->author->name;
            })
            ->addColumn('action', function ($pages) use ($permissions){
                $html = '';
                if($this->auth->user()->can('update', $permissions)) {
                    $html .= '<a href="'.url('client').'/pages/edit/'.$pages->hashid.'"><button type="button" data-toggle="tooltip" title="Update" class="btn btn-warning btn-xs btn-flat edited"><span class="glyphicon glyphicon-pencil"></span></button></a>';
                }
                if($this->auth->user()->can('delete', $permissions)) {
                    $html .= '&nbsp;<button type="button" data-toggle="tooltip" title="Delete" class="btn btn-danger btn-xs btn-flat deleted" data-action="'.url('client').'/pages/destroy/'.$pages->hashid.'"><span class="glyphicon glyphicon-trash"></span></button>';
                }
                return $html;
            })
            ->make(true);
    }

    protected function getFormOptions($page = '')
    {
        $data['pages'] = $this->pages->pagesList($page ? $page->id : '');
        $data['visibility'] = Array('Public' => 'Public', 'Private' => 'Private');
        $data['status'] = Array('Publish' => 'Publish', 'Draft' => 'Draft', 'Inactive' => 'Inactive');
        return $data;
    }

}Modules/Client/Controllers/Pages/FAQController.php000066400000011311152434100730016121 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Pages;

use Auth;
use Session;
use Datatables;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Requests\Pages\FAQRequest;
use QxCMS\Modules\Client\Repositories\Pages\FAQRepositoryInterface as FAQ;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;

class FAQController extends Controller
{
	protected $faq;
	protected $permission;
	protected $auth;
	protected $prefix_name = '';

	public function __construct(Permission $permission, FAQ $faq)
	{
		$this->faq = $faq;

		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        $this->getDetails($this->faq->getModuleId());
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->faq->getModuleId());
    }

    public function index() 
    {
    	$this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();
        $data['userLogs'] = $this->faq->getUserLogs($this->faq->getModuleId());
        return view('Client::pages.faq.index', $data, $this->getFormOptions());
    }

    public function create()
    {
        $this->authorize('create', $this->permissions());
        $data['permissions'] = $this->permissions();
        return view('Client::pages.faq.create', $data, $this->getFormOptions());
    }

    public function store(FAQRequest $request)
    {
        $this->authorize('create', $this->permissions());
        $faq = $this->faq->create($request);
        session()->flash('success', 'Successfully added.');

        return redirect()->route($this->prefix_name.'.faq.index');
    }

    public function show($id)
    {
        //
    }

    public function edit($hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $data['permissions'] = $this->permissions();
        $data['faq'] = $this->faq->findById($id);
        $data['userLogs'] = $this->faq->getUserLogs($this->faq->getModuleId(), $id);
        return view('Client::pages.faq.edit', $data, $this->getFormOptions());
    }

    public function update(FAQRequest $request, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $faq = $this->faq->update($id, $request);
        return redirect()->route($this->prefix_name.'.faq.index');
    }

    public function destroy($hashid)
    {
        $this->authorize('delete', $this->permissions());
        $id = decode($hashid);
        return $this->faq->delete($id);
    }

    public function details(Request $request, $hashid)
    {
        $id = decode($hashid);
        $faq = $this->faq->findById($id);
        if($request->ajax()){
            return $faq;
        }
    }

    public function getFAQData(Request $request)
    {
        $faq = $this->faq->select('*');

        $permissions = $this->permissions();
        return Datatables::of($faq)
            ->filter(function ($query) use ($request){
                if ($request->has('title')){
                    $query->where('title', 'like', "%{$request->get('title')}%");
                }
                if ($request->has('status')){
                    $query->where('status', '=', "{$request->get('status')}");
                }
            })
            ->editColumn('title', function($faq){
                return '<span data-toggle="tooltip" data-placement="top" title="View Details"><a href="#faq-details-modal" data-toggle="modal" data-details_url="'.route($this->prefix_name.'.faq.details', $faq->hashid).'">'.$faq->title.'</a></span>';
            })
            ->addColumn('action', function ($faq) use ($permissions){
                $html = '';
                if($this->auth->user()->can('update', $permissions)){
                    $html .= '<a href="'.route($this->prefix_name.'.faq.edit', $faq->hashid).'"><button type="button" data-toggle="tooltip" title="Edit" class="btn btn-warning btn-xs btn-flat edited"><span class="glyphicon glyphicon-pencil"></span></button></a>';
                }
                if($this->auth->user()->can('delete', $permissions)){
                    $html .= '&nbsp;&nbsp;<a href="#delete-'.$faq->hashid.'" class="btn btn-xs btn-flat btn-danger" id="btn-delete" data-action="'.route($this->prefix_name.'.faq.destroy', $faq->hashid).'" data-toggle="tooltip" data-placement="top" title="Delete"><i class="fa fa-trash-o"></i></a>';
                }
                return $html;
            })
            ->make(true);
    }

    protected function getFormOptions()
    {
        $data['status'] = Array('Publish' => 'Publish', 'Draft' => 'Draft', 'Inactive' => 'Inactive');
        return $data;
    }
}Modules/Client/Controllers/Pages/ContactUsController.php000064400000011677152434100730017432 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Pages;

use Auth;
use Session;
use Datatables;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Requests\Pages\ContactUsRequest;
use QxCMS\Modules\Client\Repositories\Pages\ContactUsRepositoryInterface as ContactUs;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;

class ContactUsController extends Controller
{
	protected $contact_us;
	protected $permission;
	protected $auth;
	protected $prefix_name = '';

	public function __construct(Permission $permission, ContactUs $contact_us)
	{
		$this->contact_us = $contact_us;

		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        $this->getDetails($this->contact_us->getModuleId());
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->contact_us->getModuleId());
    }

    public function index() 
    {
    	$this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();
        $data['userLogs'] = $this->contact_us->getUserLogs($this->contact_us->getModuleId());
        return view('Client::pages.contact-us.index', $data, $this->getFormOptions());
    }

    public function create()
    {
        $this->authorize('create', $this->permissions());
        $data['permissions'] = $this->permissions();
        return view('Client::pages.contact-us.create', $data, $this->getFormOptions());
    }

    public function store(ContactUsRequest $request)
    {
        $this->authorize('create', $this->permissions());
        $contact_us = $this->contact_us->create($request);
        session()->flash('success', 'Successfully added.');

        return redirect()->route($this->prefix_name.'.contact-us.index');
    }

    public function show($id)
    {
        //
    }

    public function edit($hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $data['permissions'] = $this->permissions();
        $data['contact_us'] = $this->contact_us->findById($id);
        $data['userLogs'] = $this->contact_us->getUserLogs($this->contact_us->getModuleId(), $id);
        return view('Client::pages.contact-us.edit', $data, $this->getFormOptions());
    }

    public function update(ContactUsRequest $request, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $contact_us = $this->contact_us->update($id, $request);
        return redirect()->route($this->prefix_name.'.contact-us.index');
    }

    public function destroy($hashid)
    {
        $this->authorize('delete', $this->permissions());
        $id = decode($hashid);
        return $this->contact_us->delete($id);
    }

    public function getContactUsData(Request $request)
    {
        $contact_us = $this->contact_us->select('*');

        $permissions = $this->permissions();
        return Datatables::of($contact_us)
            ->filterColumn('address', function($query, $keyword) {
                $query->whereRaw("CONCAT(building_name,' ',building_floor,' ',rec_number,' ',rec_street,', ',rec_city) like ?", ["%{$keyword}%"]);
            })
            ->addColumn('status_name', function($contact_us){
                return $contact_us->status;
            })
            ->addColumn('address', function($contact_us){
                $html = '';
                $html .= $contact_us->building_floor.($contact_us->building_floor && $contact_us->building_name ? ', ' : '').$contact_us->building_name.($contact_us->building_floor || $contact_us->building_name ? '<br>' : '');
                $html .= $contact_us->rec_number.' '.$contact_us->rec_street.', '.$contact_us->rec_city;
                return $html;
            })
            ->addColumn('action', function ($contact_us) use ($permissions){
                $html = '';
                if($this->auth->user()->can('update', $permissions)){
                    $html .= '<a href="'.route($this->prefix_name.'.contact-us.edit', $contact_us->hashid).'"><button type="button" data-toggle="tooltip" title="Edit" class="btn btn-warning btn-xs btn-flat edited"><span class="glyphicon glyphicon-pencil"></span></button></a>';
                }
                if($this->auth->user()->can('delete', $permissions)){
                    $html .= '&nbsp;&nbsp;<a href="#delete-'.$contact_us->hashid.'" class="btn btn-xs btn-flat btn-danger" id="btn-delete" data-action="'.route($this->prefix_name.'.contact-us.destroy', $contact_us->hashid).'" data-toggle="tooltip" data-placement="top" title="Delete"><i class="fa fa-trash-o"></i></a>';
                }
                return $html;
            })
            ->rawColumns(['action', 'status'])
            ->make(true);
    }

    protected function getFormOptions()
    {
        $data['status'] = Array('Publish' => 'Publish', 'Draft' => 'Draft', 'Inactive' => 'Inactive');
        return $data;
    }
}Modules/Client/Controllers/Pages/AboutUsController.php000064400000012014152434100730017073 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Pages;

use Auth;
use Session;
use Datatables;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Requests\Pages\AboutUsRequest;
use QxCMS\Modules\Client\Repositories\Pages\AboutUsRepositoryInterface as AboutUs;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;

class AboutUsController extends Controller
{
	protected $about_us;
	protected $permission;
	protected $auth;
	protected $prefix_name = '';

	public function __construct(Permission $permission, AboutUs $about_us)
	{
		$this->about_us = $about_us;

		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        $this->getDetails($this->about_us->getModuleId());
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->about_us->getModuleId());
    }

    public function index() 
    {
    	$this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();
        $data['userLogs'] = $this->about_us->getUserLogs($this->about_us->getModuleId());
        return view('Client::pages.about-us.index', $data, $this->getFormOptions());
    }

    public function create()
    {
        $this->authorize('create', $this->permissions());
        $data['permissions'] = $this->permissions();
        return view('Client::pages.about-us.create', $data, $this->getFormOptions());
    }

    public function store(AboutUsRequest $request)
    {
        $this->authorize('create', $this->permissions());
        $about_us = $this->about_us->create($request);
        session()->flash('success', 'Successfully added.');

        return redirect()->route($this->prefix_name.'.about-us.index');
    }

    public function show($id)
    {
        //
    }

    public function edit($hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $data['permissions'] = $this->permissions();
        $data['about_us'] = $this->about_us->findById($id);
        $data['userLogs'] = $this->about_us->getUserLogs($this->about_us->getModuleId(), $id);
        return view('Client::pages.about-us.edit', $data, $this->getFormOptions());
    }

    public function update(AboutUsRequest $request, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $about_us = $this->about_us->update($id, $request);
        return redirect()->route($this->prefix_name.'.about-us.index');
    }

    public function destroy($hashid)
    {
        $this->authorize('delete', $this->permissions());
        $id = decode($hashid);
        return $this->about_us->delete($id);
    }

    public function details(Request $request, $hashid)
    {
        $id = decode($hashid);
        $about_us = $this->about_us->findById($id);
        if($request->ajax()){
            return $about_us;
        }
    }

    public function getAboutUsData(Request $request)
    {
        $about_us = $this->about_us->select('*');

        $permissions = $this->permissions();
        return Datatables::of($about_us)
            ->filter(function ($query) use ($request){
                if ($request->has('title')){
                    $query->where('title', 'like', "%{$request->get('title')}%");
                }
                if ($request->has('status') && !empty($request->get('status'))){
                    $query->where('status', '=', "{$request->get('status')}");
                }
            })
            ->editColumn('title', function($about_us){
                return '<span data-toggle="tooltip" data-placement="top" title="View Details"><a href="#about-us-details-modal" data-toggle="modal" data-details_url="'.route($this->prefix_name.'.about-us.details', $about_us->hashid).'">'.$about_us->title.'</a></span>';
            })
            ->addColumn('action', function ($about_us) use ($permissions){
                $html = '';
                if($this->auth->user()->can('update', $permissions)){
                    $html .= '<a href="'.route($this->prefix_name.'.about-us.edit', $about_us->hashid).'"><button type="button" data-toggle="tooltip" title="Edit" class="btn btn-warning btn-xs btn-flat edited"><span class="glyphicon glyphicon-pencil"></span></button></a>';
                }
                if($this->auth->user()->can('delete', $permissions)){
                    $html .= '&nbsp;&nbsp;<a href="#delete-'.$about_us->hashid.'" class="btn btn-xs btn-flat btn-danger" id="btn-delete" data-action="'.route($this->prefix_name.'.about-us.destroy', $about_us->hashid).'" data-toggle="tooltip" data-placement="top" title="Delete"><i class="fa fa-trash-o"></i></a>';
                }
                return $html;
            })
            ->rawColumns(['action', 'title', 'status_name'])
            ->make(true);
    }

    protected function getFormOptions()
    {
        $data['status'] = Array('Publish' => 'Publish', 'Draft' => 'Draft', 'Inactive' => 'Inactive');
        return $data;
    }
}Modules/Client/Controllers/Auth/AuthController.php000066400000012513152434100730016262 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Auth;

use QxCMS\Modules\Likod\Models\Clients\User;
use Validator;
use JsValidator;
use Auth;
use Artisan;
use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use QxCMS\Modules\Client\Repositories\Settings\Roles\RoleRepositoryInterface as Role;
use QxCMS\Modules\Client\Models\Settings\LoginLogs\LoginLogs;

class AuthController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Registration & Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users, as well as the
    | authentication of existing users. By default, this controller uses
    | a simple trait to add these behaviors. Why don't you explore it?
    |
    */

    use AuthenticatesUsers;

    /**
     * Where to redirect users after login / registration.
     *
     * @var string
     */
    protected $redirectTo = '/client/dashboard';
    protected $guard = 'client';
    protected $redirectAfterLogout = 'client/auth/login';
    protected $role;
    protected $loginlogs;
    /**
     * Create a new authentication controller instance.
     *
     * @return void
     */
    public function __construct(Role $role, LoginLogs $loginlogs)
    {
        $this->middleware('guest.client', ['except' => 'logout']);
        $this->role = $role;
        $this->loginlogs = $loginlogs;
    }

    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => 'required|max:255',
            'email' => 'required|email|max:255|unique:users',
            'password' => 'required|confirmed|min:6',
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return User
     */
    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
        ]);
    }

    public function getLogin()
    {
        $rules = array(
            'email' => 'required|email',
            'password' => 'required',
        );
        $validator = JsValidator::make($rules, array(), array(), '#login-form');
        return view('Client::auth.login', ['validator'=> $validator]);
    }    

    public function postLogin(Request $request)
    {
        return $this->login($request);
    }
    
    protected function authenticated(Request $request, $user)
    {                
        $user = Auth::guard('client')->user();
        if(Auth::guard('client')->user()->client->status==1) {
            if($user->status == 1)
            {
                if(view()->exists('Client::cache.menus.'.$user->client->id.'.custom_'.$user->role_id))
                {
                    //check file modified if already eight hours
                    if(\File::lastModified(app_path().'/Modules/Client/Views/cache/menus/'.$user->client->id.'/custom_'.$user->role_id.'.blade.php')<time() - (8 * 60 * 60)) {
                        $this->role->setConfig($user->client);
                        $this->role->write_menu($user->client->id, $user->role_id, $user->client->database_name);
                    }                
                } else {
                    $this->role->setConfig($user->client);
                    $this->role->write_menu($user->client->id, $user->role_id, $user->client->database_name);
                }
                //run migrate
                $this->role->setConfig($user->client);
                Artisan::call('migrate', array('--database'=>'client','--path'=>'database/migrations/client'));
                //log in logs
                $loginlog = $this->loginlogs;
                $loginlog_details = [
                    'name' => $user->name,
                    'username' => $user->email,
                    'ipaddress' => $_SERVER['REMOTE_ADDR']
                ];
                $loginlog->fill($loginlog_details);                              
                $loginlog->save();
                return redirect($this->redirectTo);
            } else {
                $this->guard()->logout();
                $request->session()->regenerate();
                session()->flash('error', 'You account is inactive.');
                return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
            }
        } else {
            $this->guard()->logout();
            $request->session()->regenerate();
            session()->flash('error', 'This client is inactive.');
            return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
        }      
    }

    public function guard() 
    {
        return Auth::guard('client');
    }

    public function logout(Request $request)
    {
        $this->guard()->logout();
        $request->session()->regenerate();
        session()->flash('logout', 'You have successfully logged out!');
        return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
    }
}Modules/Client/Controllers/Settings/RoleController.php000066400000011020152434100730017151 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Settings;

use DB;
use Auth;
use Datatables;

use QxCMS\Http\Requests;
use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Requests\Settings\RoleRequest;
use QxCMS\Modules\Client\Repositories\Settings\Roles\RoleRepositoryInterface as Role;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;

class RoleController extends Controller
{
	protected $role;
    protected $permission;
    protected $prefix_name = '';

    public function __construct(Role $role, Permission $permission)
    {
    	$this->auth = Auth::guard('client');
    	$this->prefix_name = config('modules.client');
    	$this->role = $role;
    	$this->permission = $permission;
    }

    public function permissions()
    {
        return $this->permission->getPermission($this->role->getModuleId());
    }

    public function index()
    {
        $this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();
        $data['userLogs'] = $this->role->getUserLogs($this->role->getModuleId());
        return view('Client::settings.roles.index', $data);
    }

    public function create()
    {
        $this->authorize('create', $this->permissions());
        $data['permissions'] = $this->permissions();
        $data['role_permissions'] = $this->role->build_role_permissions();
        return view('Client::settings.roles.create', $data);
    }

    public function store(RoleRequest $request)
    {
        $this->authorize('create', $this->permissions());
        $role = $this->role->create($request->all());
        $request->session()->flash('success', 'Successfully added.');
        return redirect($this->prefix_name.'/settings/roles/'.$role->hashid.'/edit');
    }

    public function show($id)
    {
        $this->authorize('activated', $this->permissions());
        $data['permissions'] = $this->permissions();
    }

    public function edit($hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $data['permissions'] = $this->permissions();
        $data['role'] = $this->role->findById($id);
        $data['role_permissions'] = $this->role->build_role_permissions($id);  
        $data['userLogs'] = $this->role->getUserLogs($this->role->getModuleId(), $id);      
        return view('Client::settings.roles.edit',$data);
    }

    public function update(RoleRequest $request, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $role = $this->role->update($id, $request->all());
        return redirect($this->prefix_name.'/settings/roles/'.$role->hashid.'/edit');
    }

    public function destroy($hashid)
    {        
        $this->authorize('delete', $this->permissions());
        $id = decode($hashid);
        return $this->role->delete($id, $this->auth->user()->client->id);   
    }

    /*
    * Datatables
    */
    public function getRolesData(Request $request)
    {        
        $roles = $this->role->datatablesIndex();
        $permissions = $this->permissions();
        return Datatables::of($roles)
            ->addColumn('action', function ($role) use ($permissions) {
                $html_out = '';
                if(!in_array($role->id, $this->role->getdefaultIDs())) {
                    if($this->auth->user()->can('update', $permissions)) {
                        $html_out .= '<a href="'.url($this->prefix_name.'/settings/roles/'.$role->hashid.'/edit').'" class="btn btn-xs btn-flat btn-warning" data-toggle="tooltip" data-placement="top" title="Edit"><i class="fa fa-pencil"></i></a>&nbsp;&nbsp;';
                    }
                    if($this->auth->user()->can('delete', $permissions)) {
                        $html_out .= '<a href="#delete-'.$role->hashid.'" class="btn btn-xs btn-flat btn-danger" id="btn-delete" data-action="'.url($this->prefix_name).'/settings/roles/'.$role->hashid.'" data-toggle="tooltip" data-placement="top" title="Delete"><i class="fa fa-trash-o"></i></a>';
                    } 
                } else {
                    if($this->auth->user()->can('update', $permissions)) {
                        $html_out = '<a href="'.url($this->prefix_name.'/settings/roles/'.$role->hashid.'/edit').'" class="btn btn-xs btn-flat btn-warning" data-toggle="tooltip" data-placement="top" title="Edit"><i class="fa fa-pencil"></i></a>&nbsp;&nbsp;';
                    }
                }
                return $html_out;
            })
            ->make(true);
    }
}Modules/Client/Controllers/Settings/UserController.php000064400000012563152434100730017201 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Settings;

use Illuminate\Http\Request;


use QxCMS\Http\Controllers\Controller;
use QxCMS\Modules\Client\Repositories\Settings\Users\UserRepositoryInterface as User;
use QxCMS\Modules\Client\Repositories\Settings\Roles\RoleRepositoryInterface as Role;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;
use QxCMS\Modules\Client\Requests\Settings\UserRequest;
use Datatables;
use Auth;
use DB;

class UserController extends Controller
{
    protected $user;
	protected $role;
	protected $permission;
	protected $auth;
	protected $prefix_name = '';

	public function __construct(User $user, Role $role, Permission $permission)
	{
		$this->user = $user;
        $this->role = $role;
		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        $this->getDetails($this->user->getModuleId());
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->user->getModuleId());
    }

    public function index()
    {
    	$this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();
        $data['userLogs'] = $this->user->getUserLogs($this->user->getModuleId());
        return view('Client::settings.users.index', $data);    	
    }

    public function create()
    {
        $this->authorize('create', $this->permissions());        
        $data['permissions'] = $this->permissions();
        $data['roles'] = $this->role->getLists();
        return view('Client::settings.users.create', $data);
    }

    public function store(UserRequest $request)
    {
        $this->authorize('create', $this->permissions());
        $user = $this->user->create($request->all()); 
        session()->flash('success', 'Successfully added.');
        return redirect($this->prefix_name.'/settings/users');
    }

    public function show($id)
    {
        $this->authorize('activated', $this->permissions());
    }

    public function edit($hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $data['permissions'] = $this->permissions();
        $data['roles'] = $this->role->getLists();
        $data['user'] = $this->user->findById($id);
        $data['userLogs'] = $this->user->getUserLogs($this->user->getModuleId(), $id);
        return view('Client::settings.users.edit', $data);
    }

    public function update(UserRequest $request, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $this->user->update($id, $request->all());
        return redirect($this->prefix_name.'/settings/users');
    }

    public function destroy($hashid)
    {
        $this->authorize('delete', $this->permissions());
        $id = decode($hashid);
        return $this->user->delete($id); 
    }


    public function select2(Request $request)
    {   
        return $this->user->select2($request->all());
    }


    /*
    * Datatables
    */
    public function getUsersData(Request $request)
    {        
        $params = [
            'hiddenRoleIds' => $this->role->getHiddenRoleIds(),
            'developer_id' => $this->role->getDeveloperId()
        ];

        $users = $this->user->datatablesIndex($params);
        return Datatables::of($users)
        	->editColumn('status',function($client){
                if($client->status == 0) return '<span class="label label-danger">Deactivated</span>';
                return '<span class="label label-success">Activated</span>';
            })
	        ->addColumn('action', function ($user) {
	            $html_out = '';
	            $permissions = $this->permissions();
	            if($user->id != 1) {
	                if($this->auth->user()->can('update', $permissions)) {
	                    $html_out .= '<a href="'.url($this->prefix_name.'/settings/users/'.$user->hashid.'/edit').'" class="btn btn-xs btn-flat btn-warning" data-toggle="tooltip" data-placement="top" title="Edit"><i class="fa fa-pencil"></i></a>';
	                }
	                if($this->auth->user()->can('delete', $permissions)) {
	                    $html_out .= '&nbsp;&nbsp;<a href="#delete-'.$user->hashid.'" class="btn btn-xs btn-flat btn-danger" id="btn-delete" data-action="'.url($this->prefix_name).'/settings/users/'.$user->hashid.'" data-toggle="tooltip" data-placement="top" title="Delete"><i class="fa fa-trash-o"></i></a>';
	                }
	            } else {
	                if($this->auth->user()->can('update', $permissions)) {
	                    $html_out = '<a href="'.url($this->prefix_name.'/settings/users/'.$user->hashid.'/edit').'" class="btn btn-xs btn-flat btn-warning" data-toggle="tooltip" data-placement="top" title="Edit"><i class="fa fa-pencil"></i></a>';
	                }
	            }
	            return $html_out;
	        })
            ->rawColumns(['action', 'status'])
	        ->make(true);
    }

    public function getTokenInputUserLists(Request $request)
    {
        if($request->has('q')) {
            if($request->input('q') <> '') {
                return $this->user->tokenInputLists()->where('name', 'LIKE', '%'.$request->input('q').'%')->where('client_id', $this->auth->user()->client->id)->get();
            }
        }
        return $this->user->tokenInputLists()->where('client_id', $this->auth->user()->client->id)->get();
    }
}Modules/Client/Controllers/Applicants/ApplicantsController.php000066400000011561152434100730020656 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Applicants;

use Auth;
use Excel;
use Session;
use Datatables;
use Carbon\Carbon;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Models\Applicants\JobApplied as JobApplied;
use QxCMS\Modules\Client\Repositories\JobOpening\JobOpeningRepositoryInterface as JobOpening;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;

class ApplicantsController extends Controller
{
    protected $job_applied;
	protected $job_opening;

    protected $auth;
	protected $permission;
	protected $prefix_name = '';
    protected $module_id = 19;

	public function __construct(Permission $permission, JobOpening $job_opening, JobApplied $job_applied)
	{
        $this->job_applied = $job_applied;
		$this->job_opening = $job_opening;

		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        $this->getDetails($this->module_id);
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->module_id);
    }

    public function index() 
    {
    	$this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();
        return view('Client::applicants.index', $data);
    }

    public function view($hashid)
    {
        $this->authorize('activated', $this->permissions());
        $data['permissions'] = $this->permissions();

        $id = decode($hashid);
        $data['job'] = $this->job_opening->findById($id);
        return view('Client::applicants.view', $data);
    }

    public function excel($hashid)
    {
        $id = decode($hashid);
        $data['job'] = $this->job_opening->findById($id);
        $data['applicants'] = $this->job_applied->select(['job_applied.*', 'applicants.first_name', 'applicants.middle_name', 'applicants.last_name', 'applicants.mobile_number'])
                            ->where('job_id', $id)->with('applicant')
                            ->join('applicants', 'applicants.id', '=', 'job_applied.applicant_id')
                            ->orderBy('applicants.last_name', 'asc')->get();
        $data['type'] = 'Applicant Lists';

        Excel::create('Applicant Lists', function($excel) use ($data){
            $excel->setTitle('Applicant Lists');

            $excel->sheet('sheet1', function($sheet) use ($data) {
                $sheet->loadView('Client::applicants.includes.applicant-lists-table', $data);
            });
        })->export('xlsx');
    }

    public function getApplicantsData()
    {
        $dateToday = Carbon::now()->toDateString();
        $job = $this->job_opening->where('status', 'Open')
                                ->where('opening_date', '<=', $dateToday)
                                ->where('closing_date', '>=', $dateToday)
                                ->withCount('applicants');

        return Datatables::of($job)
        ->filterColumn('opening_date', function($query, $keyword) {
            $query->whereRaw("DATE_FORMAT(opening_date,'%b %d, %Y') like ?", ["%$keyword%"]);
        })
        ->filterColumn('closing_date', function($query, $keyword) {
            $query->whereRaw("DATE_FORMAT(closing_date,'%b %d, %Y') like ?", ["%$keyword%"]);
        })
        ->editColumn('opening_date', function($job){
            return Carbon::parse($job->opening_date)->format('M d, Y');
        })
        ->editColumn('closing_date', function($job){
            return Carbon::parse($job->closing_date)->format('M d, Y');
        })
        ->editColumn('applicants_count', function($job){
            if($job->applicants_count != 0){
                return '<a href="'.route($this->prefix_name.'.applicants.view', $job->hashid).'" data-toggle="tooltip" data-placement="top" title="No. Applied" target="_blank">'.$job->applicants_count.'</a>';
            }else{
                return $job->applicants_count;
            }
            
        })
        ->make(true);
    }

    public function getApplicantListData($hashid)
    {
        $id = decode($hashid);
        $applicant = $this->job_applied->select(['job_applied.*', 'applicants.first_name', 'applicants.middle_name', 'applicants.last_name', 'applicants.mobile_number'])->where('job_id', $id)->with('applicant')
                            ->join('applicants', 'applicants.id', '=', 'job_applied.applicant_id');

        return Datatables::of($applicant)
        ->editColumn('full_name', function($applicant){
            return $applicant->applicant->last_name.', '.$applicant->applicant->first_name.' '.$applicant->applicant->middle_name;
        })
        ->editColumn('apply_date', function($applicant){
            return Carbon::parse($applicant->apply_date)->format('M d, Y');
        })
        ->orderColumn('full_name', 'applicants.last_name $1, applicants.first_name $1, applicants.middle_name $1')
        ->make(true);
    }
}Modules/Client/Controllers/Applicants/SearchApplicantsController.php000066400000005304152434100730022002 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Applicants;

use Auth;
use Datatables;
use Carbon\Carbon;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Repositories\Applicants\ApplicantRepositoryInterface as Applicant;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;

class SearchApplicantsController extends Controller
{
    protected $applicant;

    protected $auth;
	protected $permission;
	protected $prefix_name = '';
    protected $module_id = 20;

	public function __construct(Permission $permission, Applicant $applicant)
	{
        $this->applicant = $applicant;

		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        $this->getDetails($this->module_id);
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->module_id);
    }

    public function index() 
    {
    	$this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();
        return view('Client::applicants.search-applicant.index', $data);
    }

    public function getSearchApplicantsData(Request $request)
    {
        $applicant = $this->applicant->select('applicants.*')->with('latestJob')
                                     ->whereHas('latestJob',function($query){
                                       $query->where('id', '!=', null);
                                    })
                                    ->join('job_applied', 'job_applied.applicant_id', '=', 'applicants.id')
                                    ->groupBy('job_applied.applicant_id');

        return Datatables::of($applicant)
        ->filter(function ($query) use ($request){
            if ($request->has('name')) {
                $query->whereRaw("CONCAT(first_name,' ',last_name) like ?", "%{$request->get('name')}%");
                $query->orWhereRaw("CONCAT(last_name,' ',first_name) like ?", ["%{$request->get('name')}%"]);
            }
        })
        ->editColumn('full_name', function($applicant){
            return $applicant->last_name.', '.$applicant->first_name.' '.$applicant->middle_name;
        })
        ->editColumn('position', function($applicant){
            if($applicant->latestJob == null) return '';
            else return $applicant->latestJob->job->position;
        })
        ->editColumn('apply_date', function($applicant){
            if($applicant->latestJob == null) return '';
            else return Carbon::parse($applicant->latestJob->apply_date)->format('M d, Y');
        })
        ->orderColumn('full_name', 'last_name $1, first_name $1, middle_name $1')
        ->make(true);
    }
}Modules/Client/Controllers/Applicants/SourceApplicantsController.php000066400000005266152434100730022044 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Applicants;

use Auth;
use Excel;
use Datatables;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Repositories\Applicants\ApplicantRepositoryInterface as Applicant;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;

class SourceApplicantsController extends Controller
{
    protected $applicant;

    protected $auth;
	protected $permission;
	protected $prefix_name = '';
    protected $module_id = 21;

	public function __construct(Permission $permission, Applicant $applicant)
	{
        $this->applicant = $applicant;

		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        $this->getDetails($this->module_id);
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->module_id);
    }

    public function index()
    {
    	$this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();
        return view('Client::applicants.source-applicant.index', $data);
    }

    public function show(Request $request)
    {
        $this->authorize('activated', $this->permissions());
        $data['permissions'] = $this->permissions();
        $data['count'] = $this->applicant->getSourceApplicant($request)->count();
        if($data['count'] == 0){
            return view('Client::no-data');
        }else{
            return view('Client::applicants.source-applicant.view', $data);
        }
    }

    public function excel(Request $request)
    {
        $data['applicants'] = $this->applicant->getSourceApplicant($request)->orderByRaw("last_name ASC, first_name ASC, middle_name ASC")->get();
        $data['count'] = $this->applicant->getSourceApplicant($request)->count();
        $data['type'] = 'Applicant Source';

        Excel::create('Applicant Source Result', function($excel) use ($data){
            $excel->setTitle('Applicant Source');

            $excel->sheet('sheet1', function($sheet) use ($data) {
                $sheet->loadView('Client::applicants.source-applicant.includes.source-applicant-table', $data);
            });
        })->export('xlsx');
    }

    public function getSourceApplicantsData(Request $request)
    {
        $applicant = $this->applicant->getSourceApplicant($request);

        return Datatables::of($applicant)
        ->editColumn('full_name', function($applicant){
            return $applicant->last_name.', '.$applicant->first_name.' '.$applicant->middle_name;
        })
        ->orderColumn('full_name', 'last_name $1, first_name $1, middle_name $1')
        ->make(true);
    }
}Modules/Client/Controllers/Directory/SpecializationsController.php000066400000003010152434100730021555 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Directory;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;
use Datatables;

use QxCMS\Modules\Client\Repositories\Directory\SpecializationsRepositoryInterface as Specializations;

class SpecializationsController extends Controller
{
    public function __construct(Specializations $specialization)
    {
        $this->specialization = $specialization;
    }

    public function store(Request $request)
    {        
        return $this->specialization->create($request->all());
    }

    public function update(Request $request)
    {
        return $this->specialization->update($request);
    }

    public function destroy($id)
    {
       return $this->specialization->delete($id); 
    }

    public function getSpecializationsData()
    {
        $specialization = $this->specialization->select(['*']);
        return Datatables::of($specialization)
           ->addColumn('action', function($specialization) {
                $html = '<a href="#edit" class="btn btn-xs btn-flat btn-warning btn-edit" data-id="'.$specialization->id.'">
                        <i class="fa fa-pencil"></i>
                    </a>
                    <a href="#delete" class="btn btn-xs btn-flat btn-danger btn-delete" data-id="'.$specialization->id.'" data-action="'.url('client').'/modals/specialization/destroy/'.$specialization->id.'">
                    <i class="fa fa-trash-o"></i>
                    </a>';
            return $html;
            })->make(true);
    }
}
Modules/Client/Controllers/Directory/DirectoriesController.php000066400000015725152434100730020710 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Directory;

use DB;
use Auth;
use Datatables;
use Session;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Requests\Directory\DirectoryRequest;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;
use QxCMS\Modules\Client\Repositories\Directory\DirectoriesRepositoryInterface as Directory;
use QxCMS\Modules\Client\Repositories\Directory\AffiliatesRepositoryInterface as Affiliates;
use QxCMS\Modules\Client\Repositories\Directory\SpecializationsRepositoryInterface as Specializations;
use QxCMS\Modules\Client\Repositories\Directory\CitiesRepositoryInterface as Cities;
use QxCMS\Modules\Client\Repositories\Directory\ProvincesRepositoryInterface as Provinces;
use QxCMS\Modules\Client\Repositories\Directory\MunicipalitiesRepositoryInterface as Municipalities;


class DirectoriesController extends Controller
{
	protected $directory;
	protected $permission;
	protected $auth;
	protected $prefix_name = '';

	public function __construct(Permission $permission, Directory $directory, Affiliates $affiliates, Specializations $specializations, Cities $cities, Provinces $provinces, Municipalities $municipalities)
	{
		$this->directory = $directory;
        $this->affiliates = $affiliates;
        $this->specializations = $specializations;
        $this->cities = $cities;
        $this->provinces = $provinces;
        $this->municipalities = $municipalities;

		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        $this->getDetails($this->directory->getModuleId());
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->directory->getModuleId());
    }

    public function index() 
    {
    	$this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();
        $data['userLogs'] = $this->directory->getUserLogs($this->directory->getModuleId());
        return view('Client::directory-store.index', $data, $this->getFormOptions());    	
    }
    public function create()
    {
        $this->authorize('create', $this->permissions());        
        $data['permissions'] = $this->permissions();
        return view('Client::directory-store.create', $data, $this->getFormOptions());
    }

    public function store(DirectoryRequest $request)
    {
        $this->authorize('create', $this->permissions());
        $subject = $this->directory->create($request->all()); 
        session()->flash('success', 'Successfully added.');

        return redirect($this->prefix_name.'/directory-store');
    }

    public function show($id)
    {
        //
    }

    public function edit($hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $data['permissions'] = $this->permissions();
        $data['directory'] = $this->directory->findById($id);
        $data['userLogs'] = $this->directory->getUserLogs($this->directory->getModuleId(), $id);

        return view('Client::directory-store.edit', $data, $this->getFormOptions());
    }

    public function update(DirectoryRequest $request, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        
        $directory = $this->directory->update($id, $request->all());
        return redirect($this->prefix_name.'/directory-store');
    }

    public function destroy($hashid)
    {
        $this->authorize('delete', $this->permissions());
        $id = decode($hashid);
        return $this->directory->delete($id); 
    }

  
    public function getDirectoriesData(Request $request)
    {
        $directory = $this->directory->select([
            'id', 
            'category', 
            'name', 
            'affiliate_id', 
            'specialization_id', 
            'lat', 
            'lng', 
            'tel_no', 
            'email',
            DB::raw("CONCAT(locations.address_number,' ',locations.street,' ',locations.barangay) AS address")
        ])->with('affiliates', 'specializations');

        $permissions = $this->permissions();
        return Datatables::of($directory)
            ->filter(function ($query) use ($request) {
                if ($request->has('name')) {
                    $query->where('name', 'like', "%{$request->get('name')}%");
                }
                if ($request->has('category')) {
                    $query->where('category', 'like', "%{$request->get('category')}%");
                }
            })
            ->editColumn('affiliates-specializations.name', function($row) {
                if($row->affiliates == null) $html = "<p><b>Affiliate: </b>".'N/A'.'';
                else $html = "<p><b>Affiliates: </b>".$row->affiliates->name.'';

                if($row->specializations == null) $html.= "<br><b>Specialization: </b>".'N/A'.'';
                else $html.= "<br><b>Specialization: </b>".$row->specializations->name.'</p>';
                return $html;
            })
            ->addColumn('locations', function ($directory) {
                $html = "<p><b>Latitude: </b>".$directory->lat."";
                $html.= "<br/><b>Longitude: </b>".$directory->lng."</p>";
                return $html;
            })
            ->addColumn('contacts', function ($directory) {
                $html = "<p><b>Tel. No.: </b>".$directory->tel_no."";
                $html.= "<br/><b>Email: </b>".$directory->email."";
                $html.= "<br/><b>Address: </b>".$directory->address."</p>";
                return $html;
            })
            ->addColumn('action', function ($directory) use ($permissions){
                $html = '';
                if($this->auth->user()->can('update', $permissions)) {
                    $html .= '<a href="'.url('client').'/directory-store/edit/'.$directory->hashid.'"><button type="button" data-toggle="tooltip" title="Update" class="btn btn-warning btn-xs btn-flat edited"><span class="glyphicon glyphicon-pencil"></span></button></a>';
                }
                if($this->auth->user()->can('delete', $permissions)) {
                    $html .= '&nbsp;<button type="button" data-toggle="tooltip" title="Delete" class="btn btn-danger btn-xs btn-flat deleted" data-action="'.url('client').'/directory-store/destroy/'.$directory->hashid.'"><span class="glyphicon glyphicon-trash"></span></button>';
                }
                return $html;
            })
            ->make(true);
    }

    protected function getFormOptions($directories = null)
    {
        $data['affiliates'] = $this->affiliates->affiliatesList();
        $data['specializations'] = $this->specializations->specializationsList();
        $data['cities'] = $this->cities->citiesList();
        $data['provinces'] = $this->provinces->provincesList();
        $data['municipalities'] = $this->municipalities->municipalitiesList();
        $data['categories'] = Array('directory' => 'Directory', 'store' => 'Store');
        return $data;
    }

}Modules/Client/Controllers/Directory/AffiliatesController.php000066400000003007152434100730020471 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Directory;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;
use Datatables;

use QxCMS\Modules\Client\Repositories\Directory\AffiliatesRepositoryInterface as Affiliates;

class AffiliatesController extends Controller
{

    public function __construct(Affiliates $affiliates)
    {
        $this->affiliates = $affiliates;
    }

    public function store(Request $request)
    {        
        return $this->affiliates->create($request->all());
    }

    public function update(Request $request)
    {
         return $this->affiliates->update($request);
    }

    public function destroy($id)
    {
        return $this->affiliates->delete($id); 
    }

    public function getAffiliatesData()
    {
        $affiliates = $this->affiliates->select(['*']);
        return Datatables::of($affiliates)
           ->addColumn('action', function($affiliates) {
                $html = '<a href="#edit" class="btn btn-xs btn-flat btn-warning btn-edit" data-action="'.url('client').'/modals/affiliates/update/'.$affiliates->id.'" data-id="'.$affiliates->id.'">
                        <i class="fa fa-pencil"></i>
                    </a>
                    <a href="#delete" class="btn btn-xs btn-flat btn-danger btn-delete" data-action="'.url('client').'/modals/affiliates/destroy/'.$affiliates->id.'" data-id="'.$affiliates->id.'">
                    <i class="fa fa-trash-o"></i>
                    </a>';
            return $html;
            })->make(true);
    }
}
Modules/Client/Controllers/Dashboard/DashboardController.php000066400000000457152434100730020242 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Dashboard;

use Illuminate\Http\Request;

use QxCMS\Http\Requests;
use QxCMS\Http\Controllers\Controller;

class DashboardController extends Controller
{    
    public function dashboard()
    {
    	return view('Client::dashboard.dashboard');
    }
}
Modules/Client/Controllers/Questionnaire/QuestionController.php000066400000020700152434100730021112 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Questionnaire;

use DB;
use Auth;
use Datatables;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Requests\Questionnaire\QuestionRequest;
use QxCMS\Modules\Client\Repositories\Questionnaire\TemplateRepositoryInterface as Template;
use QxCMS\Modules\Client\Repositories\Questionnaire\QuestionRepositoryInterface as Question;
use QxCMS\Modules\Client\Repositories\Questionnaire\AnswerRepositoryInterface as Answer;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;

class QuestionController extends Controller
{
    protected $template;
	protected $question;
    protected $answer;
	protected $permission;
	protected $auth;
	protected $prefix_name = '';

	public function __construct(
        Template $template, 
        Question $question,
        Answer $answer,
        Permission $permission
    )
	{
        $this->template = $template;
		$this->question = $question;
        $this->answer = $answer;
		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        config(['jsvalidation.view' => 'jsvalidation::bootstrap-modal']);
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->template->getModuleId());
    }

    public function index($template_hashid) 
    {
    	$this->authorize('activated', $this->permissions());
    	
        $data['permissions'] = $this->permissions();
        $template_id = decode($template_hashid);
        $data['template'] = $this->template->findById($template_id);
        $data['userLogs'] = $this->question->getUserLogs($this->template->getModuleId(), '', 'Questions-'.$template_id);
        return view('Client::questionnaire.question.index', $data);    	
    }

    public function create($template_hashid)
    {
        $this->authorize('create', $this->permissions());        
        $data['permissions'] = $this->permissions();

        $template_id = decode($template_hashid);
        $data['template'] = $this->template->findById($template_id);
        $data['question_types'] = $this->question->getQuestionTypes();

        return view('Client::questionnaire.question.create', $data);      
    }

    public function store(Request $request, $template_hashid)
    {
        $this->authorize('create', $this->permissions());
        $template_id = decode($template_hashid);

        $question_input = $request->except(['name']);
        $question_input['template_id'] = $template_id;

        $question = $this->question->create($question_input);

        $choices = array_filter($request->get('name'), 'strlen');
        if(!empty($choices)) {
            $order = 1;
            foreach ($choices as $choice_key => $choice) {
                $input['name'] = $choice;
                $input['question_id'] = $question->id;
                $input['order'] = $order;
                $this->answer->create($input);
                $order = $order + 1;
            }
        }

        if($request->get('_save') == 'add_another') {
            session()->flash('success', 'Question is successfully added. Please add another question.');
            return redirect($this->prefix_name.'/questionnaire/'.hashid($question->template_id).'/question/create');
        }

        session()->flash('success', 'Question is successfully added.');
        return redirect($this->prefix_name.'/questionnaire/'.hashid($question->template_id).'/question');
    }

    public function show($id)
    {
        $this->authorize('activated', $this->permissions());
        return $id;
    }

    public function edit($template_hashid, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $template_id = decode($template_hashid);
        $id = decode($hashid);

        $data['permissions'] = $this->permissions();
        $data['question_types'] = $this->question->getQuestionTypes();

        $data['template'] = $this->template->findById($template_id);
        $data['userLogs'] = $this->question->getUserLogs($this->question->getModuleId(), $id,'Questions-'.$template_id);
        $data['question'] = $this->question->with(['answers' => function($query){
            $query->orderBy('order', 'ASC');
        }])->find($id);
    
        return view('Client::questionnaire.question.edit', $data);
    }

    public function update(QuestionRequest $request, $template_hashid, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $template_id = decode($template_hashid);

        $question = $this->question->update($id, $request->except(['name']));
        $choices = array_filter($request->get('name'), 'strlen');

        $this->answer->where('question_id', $id)->whereNotIn('id', array_keys($choices))->delete();
        if(!empty($choices)) {
            $order = 1;
            foreach ($choices as $choice_key => $choice) {
              //  return $choice_key;
                $input['name'] = $choice;
                $input['question_id'] = $question->id;
                $input['order'] = $order;

                if(starts_with($choice_key, 'new')) {
                    $this->answer->create($input);
                } else {
                    $this->answer->update($choice_key, $input);
                }

                $order = $order + 1;
            }
        }

        return redirect($this->prefix_name.'/questionnaire/'.hashid($question->template_id).'/question');
    }

    public function destroy($template_hashid, $hashid)
    {
        $this->authorize('delete', $this->permissions());
        $id = decode($hashid);
        $template_id = decode($template_hashid);
        return $this->question->delete($id); 
    }


    public function copyQuestion($hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
       
        $question = $this->question->with(['answers'])->find($id);
        return $this->question->copyQuestion($question);
    }

    public function sortQuestion(Request $request)
    {
        $orders = $request->get('question-table');
        foreach ($orders as $order => $id) {
            //if ($key <> 0) {
                $this->question->sort(($order + 1), $id);
           // } 
        }
        return $orders;
    }

    /*
    * Datatables
    */
    public function getQuestionData($template_hashid)
    {        

        $template_id = decode($template_hashid);
        $questions = $this->question->where('template_id', '=', $template_id)->orderBy('order', 'ASC');
        $permissions = $this->permissions();


        return Datatables::of($questions)
            
                
                ->addColumn('action', function ($question) use ($permissions) {
                    $html_out = '';
    	            
                    if($this->auth->user()->can('update', $permissions)) {
                        $html_out .= '<a href="'.url($this->prefix_name.'/questionnaire/'.hashid($question->template_id).'/question/'.$question->hashid.'/edit').'" class="btn btn-xs btn-flat btn-warning" data-toggle="tooltip" data-placement="top" title="Edit"><i class="fa fa-pencil"></i></a>';
                        $html_out .= '&nbsp;&nbsp;<a href="'.url($this->prefix_name.'/questionnaire/'.$question->hashid.'/question/copy').'" id="copy-question" class="btn btn-xs btn-flat btn-info" data-toggle="tooltip" data-placement="top" title="Duplicate"><i class="fa fa-copy"></i></a>';
                    }

                    if($this->auth->user()->can('delete', $permissions)) {
                        $html_out .= '&nbsp;&nbsp;<a href="#delete-'.$question->hashid.'" class="btn btn-xs btn-flat btn-danger" id="btn-delete" data-action="'.url($this->prefix_name).'/questionnaire/'.hashid($question->template_id).'/question/'.$question->hashid.'" data-toggle="tooltip" data-placement="top" title="Delete"><i class="fa fa-trash-o"></i></a>';
                    }
    	            
    	            return $html_out;
    	        })
                ->setRowId('id')

	            ->make(true);
    }

    /*public function getTokenInputUserLists(Request $request)
    {
        if($request->has('q')) {
            if($request->input('q') <> '') {
                return $this->user->tokenInputLists()->where('name', 'LIKE', '%'.$request->input('q').'%')->where('client_id', $this->auth->user()->client->id)->get();
            }
        }
        return $this->user->tokenInputLists()->where('client_id', $this->auth->user()->client->id)->get();
    }*/
}Modules/Client/Controllers/Questionnaire/TemplateController.php000066400000012160152434100730021057 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Questionnaire;

use DB;
use Auth;
use Datatables;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Requests\Questionnaire\TemplateRequest;
use QxCMS\Modules\Client\Repositories\Questionnaire\TemplateRepositoryInterface as Template;
//use QxCMS\Modules\Client\Repositories\Participants\ParticipantRepositoryInterface as Participant;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;

class TemplateController extends Controller
{
	protected $template;
    //protected $
	protected $permission;
	protected $auth;
	protected $prefix_name = '';

	public function __construct(Template $template, Permission $permission)
	{
		$this->template = $template;
		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        config(['jsvalidation.view' => 'jsvalidation::bootstrap-modal']);
        $this->getDetails($this->template->getModuleId());
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->template->getModuleId());
    }

    public function index() 
    {
    	$this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();
        $data['userLogs'] = $this->template->getUserLogs($this->template->getModuleId());
        return view('Client::questionnaire.template.index', $data);    	
    }

    public function create()
    {
        $this->authorize('create', $this->permissions());        
        $data['permissions'] = $this->permissions();
        $data['roles'] = $this->user->getRolelists();
        return view('Client::settings.users.create', $data);
    }

    public function store(TemplateRequest $request)
    {
        $this->authorize('create', $this->permissions());
        $input = $request->all();
        $input['user_id'] = auth('client')->user()->id;
        $template = $this->template->create($input); 
        session()->flash('success', 'Questionnaire template successfully added.');
        return redirect($this->prefix_name.'/questionnaire/'.$template->hashid.'/question');
    }

    public function show($id)
    {
        $this->authorize('activated', $this->permissions());
        return $id;
    }

    public function edit($hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $data['template'] = $this->template->findById($id);
        $data['permissions'] = $this->permissions();
        $data['userLogs'] = $this->template->getUserLogs($this->template->getModuleId(), $id);
        return view('Client::questionnaire.template.edit', $data);
    }

    public function update(TemplateRequest $request, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $template = $this->template->update($id, $request->all());
        return redirect($this->prefix_name.'/questionnaire');
    }

    public function destroy($hashid)
    {
        $this->authorize('delete', $this->permissions());
        $id = decode($hashid);
        return $this->template->delete($id); 
    }

    public function copyTemplate($hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        return $this->template->copyTemplate($id);
    }

    public function select2(Request $request)
    {   
        return $this->template->select2($request->all());
    }

    public function preview(Request $request, $hashid)
    {
        $id = decode($hashid);
        $data['template'] = $this->template->findById($id);
        return view('Client::questionnaire.template.preview', $data);
    }

    public function result(Request $request, $hashid)
    {
        $id = decode($hashid);
        $data['template'] = $this->template->findTemplateById($id, ['questions']);
        return view('Client::questionnaire.results.index', $data);
    }
    /*
    * Datatables
    */
    public function getTemplateData()
    {        
        $templates = $this->template->all();
        $permissions = $this->permissions();


        return Datatables::of($templates)
            ->editColumn('status', function($template){
                if($template->status == 'Close') return '<span class="label label-danger">Close</span>';
                return '<span class="label label-success">Open</span>';
            })
            ->editColumn('created_at', function($template){
                return $template->created_at->format('M d, Y');
            })
            ->addColumn('description', function($template){
                $html_out = "";
                $html_out .= "<a href=\"".url($this->prefix_name.'/questionnaire/'.$template->hashid.'/question')."\">".$template->title."</a>";
               // $html_out .= "<br/>".$template->description;

                return $html_out;
            })
            ->addColumn('action', function ($template) use ($permissions) {
                $html_out = '';
	            return view('Client::questionnaire.template.action', compact('template', 'permissions'))->render();
	        })
	        ->make(true);
    }

}Modules/Client/Controllers/Reports/AuditTrailController.php000066400000014331152434100730020160 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Reports;

use Auth;
use Excel;
use Session;
use Datatables;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Repositories\Settings\Users\UserRepositoryInterface as User;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;

class AuditTrailController extends Controller
{
    protected $auth;
    protected $user;
	protected $permission;
    protected $module_id = 13;
	protected $prefix_name = '';

	public function __construct(Permission $permission, User $user)
	{
        $this->user = $user;
		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        $this->getDetails($this->module_id);
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->module_id);
    }

    public function index() 
    {
    	$this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();
        return view('Client::reports.audittrail.index', $data, $this->getFormOptions());
    }

    public function show(Request $request)
    {
        $this->authorize('activated', $this->permissions());
        $data['permissions'] = $this->permissions();
        $data['type'] = $this->user->getUserLogType($request);
        $data['date'] = $this->user->getUserLogDate($request);
        $count = $this->user->getUserLogCount($request);
        if($request->report_type == 1){
            $data['visibleUser'] = true;
            $data['visibleLogin'] = false;
        }else{
            $data['visibleUser'] = false;
            $data['visibleLogin'] = true;
        }
        if($count == 0){
            return view('Client::no-data');
        }else{
            return view('Client::reports.audittrail.view', $data);
        }
    }

    public function excel(Request $request) {
        $reportType = $request->has('report_type');
        $type = $this->user->getUserLogType($request);
        $date = $this->user->getUserLogDate($request);
        $userLogs = $this->user->getUserLog($request)->where(function($query) use ($request, $reportType){
            if($reportType && $request->report_type == 1){
                if ($request->has('user_id')) {
                    $query->where('user_id', $request->user_id);
                }
            }
            if($reportType && $request->report_type == 2){
                if ($request->has('user_id')) {
                    $user = $this->user->searchUserUsername($request->user_id);
                    $query->where('username', $user->email);
                }
            }
            if ($request->has('start_date') && $request->has('end_date')) {
                $query->whereRaw("date_format(created_at, '%Y-%m-%d') >= '{$request->start_date}'")
                ->whereRaw("date_format(created_at, '%Y-%m-%d') <= '{$request->end_date}'");
            }
        })->orderBy('created_at', 'desc')->get();

        Excel::create('Audit trail report', function($excel) use ($userLogs, $request, $type, $date){
            $excel->setTitle('Audit Trail Report');
            $excel->setCreator('Quantum X, Inc.')->setCompany('Quantum X, Inc.');
            $excel->setDescription('audit trail report');

            $excel->sheet('sheet1', function($sheet) use ($userLogs, $request, $type, $date) {
                if($request->report_type == 1){
                    $sheet->loadView('Client::reports.audittrail.includes.user-logs-table')
                        ->with('userLogs', $userLogs)
                        ->with('type', $type)
                        ->with('date', $date);
                }else{
                    $sheet->loadView('Client::reports.audittrail.includes.login-logs-table')
                        ->with('userLogs', $userLogs)
                        ->with('type', $type)
                        ->with('date', $date);
                }
            });
        })->export('xlsx');
    }
  
    public function getReportsDataByUser(Request $request)
    {
        $userLogs = $this->user->getUserLog($request);
        $reportType = $request->has('report_type');
        return Datatables::of($userLogs)
            ->filter(function ($query) use ($request, $reportType) {
                if($reportType && $request->report_type == 1){
                    if ($request->has('user_id')) {
                        $query->where('user_id', $request->user_id);
                    }
                }
                if($reportType && $request->report_type == 2){
                    if ($request->has('user_id')) {
                        $user = $this->user->searchUserUsername($request->user_id);
                        $query->where('username', $user->email);
                    }
                }
                if ($request->has('start_date') && $request->has('end_date')) {
                    $query->whereRaw("date_format(created_at, '%Y-%m-%d') >= '{$request->start_date}'")
                    ->whereRaw("date_format(created_at, '%Y-%m-%d') <= '{$request->end_date}'");
                }
            })
            ->editColumn('module', function($row) {
                if(!isset($row->module)) return '';
                else return $row->module->title;
            })
            ->editColumn('action', function($row) {
                if(!isset($row->action)) return '';
                else return $row->action;
            })
            ->editColumn('ipaddress', function($row) {
                if(!isset($row->ipaddress)) return '';
                else return $row->ipaddress;
            })
            ->editColumn('username', function($row) {
                if(!isset($row->username)) return '';
                else return $row->username;
            })
            ->editColumn('user', function($row) {
                if($row->user == null) {
                    if(isset($row->name)) return $row->name;
                    else return '';
                }
                else return $row->user->name;
            })
            ->make(true);
    }

    protected function getFormOptions()
    {
        $data['users'] = $this->user->userLists();
        $data['type'] = Array('1' => 'Add, Edit, Delete of Data', '2' => 'User Access Logs');
        return $data;
    }
}Modules/Client/Controllers/Posts/PostCategoryController.php000066400000002727152434100730020221 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Posts;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;
use Datatables;

use QxCMS\Modules\Client\Repositories\Posts\PostCategoryRepositoryInterface as PostCategory;

class PostCategoryController extends Controller
{

    public function __construct(PostCategory $postCategory)
    {
        $this->postCategory = $postCategory;
    }

    public function store(Request $request)
    {        
        return $this->postCategory->create($request->all());
    }

    public function update(Request $request)
    {
        return $this->postCategory->update($request);
    }

    public function destroy($id)
    {
        return $this->postCategory->delete($id); 
    }

    public function getPostCategoryData()
    {
        $postCategory = $this->postCategory->select(['*']);
        return Datatables::of($postCategory)
           ->addColumn('action', function($postCategory) {
                $html = '<a href="#edit" class="btn btn-xs btn-flat btn-warning btn-edit" data-id="'.$postCategory->id.'">
                        <i class="fa fa-pencil"></i>
                    </a>
                    <a href="#delete" class="btn btn-xs btn-flat btn-danger btn-delete" data-action="'.url('client').'/modals/postcategory/destroy/'.$postCategory->id.'" data-id="'.$postCategory->id.'">
                    <i class="fa fa-trash-o"></i>
                    </a>';
            return $html;
            })->make(true);
    }
}
Modules/Client/Controllers/Posts/PostsController.php000066400000012576152434100730016711 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Posts;

use Auth;
use Datatables;
use Session;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Requests\Posts\PostRequest;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;
use QxCMS\Modules\Client\Repositories\Posts\PostsRepositoryInterface as Posts;
use QxCMS\Modules\Client\Repositories\Posts\PostCategoryRepositoryInterface as PostCategory;

class PostsController extends Controller
{
	protected $posts;
	protected $permission;
	protected $auth;
	protected $prefix_name = '';

	public function __construct(Permission $permission, Posts $posts, PostCategory $postCategory)
	{
		$this->posts = $posts;
        $this->postCategory = $postCategory;

		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        $this->getDetails($this->posts->getModuleId());
	}

	public function permissions()
    {
        return $this->permission->getPermission($this->posts->getModuleId());
    }

    public function index() 
    {
    	$this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();
        $data['userLogs'] = $this->posts->getUserLogs($this->posts->getModuleId());
        return view('Client::posts.index', $data, $this->getFormOptions());
    }

    public function create()
    {
        $this->authorize('create', $this->permissions());        
        $data['permissions'] = $this->permissions();
        return view('Client::posts.create', $data, $this->getFormOptions());
    }

    public function store(PostRequest $request)
    {

        $this->authorize('create', $this->permissions());
        $posts = $this->posts->create($request); 
        session()->flash('success', 'Successfully added.');

        return redirect($this->prefix_name.'/posts');
    }

    public function show($id)
    {
        //
    }

    public function edit($hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $data['permissions'] = $this->permissions();
        $data['post'] = $this->posts->findById($id);
        $data['userLogs'] = $this->posts->getUserLogs($this->posts->getModuleId(), $id);
        return view('Client::posts.edit', $data, $this->getFormOptions());
    }

    public function update(PostRequest $request, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);

        $posts = $this->posts->update($id, $request);
        return redirect($this->prefix_name.'/posts');
    }

    public function destroy($hashid)
    {
        $this->authorize('delete', $this->permissions());
        $id = decode($hashid);
        return $this->posts->delete($id);
    }
  
    public function getPostsData(Request $request)
    {
        $posts = $this->posts->select('*')->where('post_type', '=', 'Post')->with('author', 'category');

        $permissions = $this->permissions();
        return Datatables::of($posts)
            ->filter(function ($query) use ($request) {
                if ($request->has('title')) {
                    $query->where('title', 'like', "%{$request->get('title')}%");
                }
                if ($request->has('posts_category_id')) {
                    $query->where('posts_category_id', 'like', "%{$request->get('posts_category_id')}%");
                }
            })
            ->editColumn('category', function($row) {
                if($row->category == null) return 'N/A';
                else return $row->category->name;
            })
            ->editColumn('author', function($row) {
                if($row->author == null) return '';
                else return $row->author->name;
            })
            ->addColumn('date', function ($posts) {
                $html = "<small>Published <br> ".$posts->published_at."";
                if($posts->expired_at <> 0000-00-00){
                    $html.= "<br/>Expiring<br> ".$posts->expired_at."</small>";
                }else{
                    $html.= '';
                }
                return $html;
            })
            ->addColumn('action', function ($posts) use ($permissions){
                $html = '';
                if($this->auth->user()->can('update', $permissions)) {
                    $html .= '<a href="'.url('client').'/posts/edit/'.$posts->hashid.'"><button type="button" data-toggle="tooltip" title="Update" class="btn btn-warning btn-flat btn-xs edited"><span class="glyphicon glyphicon-pencil"></span></button></a>';
                }
                if($this->auth->user()->can('delete', $permissions)) {
                    $html .= '&nbsp;<button type="button" data-toggle="tooltip" title="Delete" class="btn btn-danger btn-xs btn-flat deleted" data-action="'.url('client').'/posts/destroy/'.$posts->hashid.'"><span class="glyphicon glyphicon-trash"></span></button>';
                }
                return $html;
            })
            ->orderColumn('date', 'posts.published_at $1, posts.expired_at $1')
            ->make(true);
    }

    protected function getFormOptions()
    {
        $data['category'] = $this->postCategory->postCategoryList();
        $data['visibility'] = Array('Public' => 'Public', 'Private' => 'Private');
        $data['status'] = Array('Publish' => 'Publish', 'Draft' => 'Draft', 'Inactive' => 'Inactive');
        return $data;
    }

}Modules/Client/Controllers/Products/ProductController.php000066400000014323152434100730017704 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Products;

use DB;
use Auth;
use Datatables;
use Session;
use File;
use Storage;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Requests\Products\ProductRequest;
use QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface as Permission;
use QxCMS\Modules\Client\Repositories\Products\ProductRepositoryInterface as Product;
use QxCMS\Modules\Client\Repositories\Products\ProductBrandRepositoryInterface as ProductBrand;
use QxCMS\Modules\Client\Repositories\Products\ProductCategoryRepositoryInterface as ProductCategory;

class ProductController extends Controller
{
	protected $product;
	protected $permission;
	protected $auth;
	protected $prefix_name = '';

	public function __construct(Permission $permission, Product $product, ProductBrand $productBrand, ProductCategory $productCategory)
	{
		$this->product = $product;
        $this->productBrand = $productBrand;
        $this->productCategory = $productCategory;

		$this->permission = $permission;
		$this->auth = Auth::guard('client');
		$this->prefix_name = config('modules.client');
        $this->getDetails($this->product->getModuleId());
	}

	public function permissions()
    {

        return $this->permission->getPermission($this->product->getModuleId());
    }

    public function index() 
    {
    	$this->authorize('activated', $this->permissions());
    	$data['permissions'] = $this->permissions();
        $data['userLogs'] = $this->product->getUserLogs($this->product->getModuleId());
        return view('Client::product.index', $data, $this->getFormOptions());    	
    }
    public function create()
    {
        $this->authorize('create', $this->permissions());        
        $data['permissions'] = $this->permissions();
        return view('Client::product.create', $data, $this->getFormOptions());
    }

    public function store(ProductRequest $request)
    {
        $this->authorize('create', $this->permissions());
        $product = $this->product->create($request); 
        session()->flash('success', 'Successfully added.');

        return redirect($this->prefix_name.'/products');
    }

    public function show($id)
    {
        //
    }

    public function edit($hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        $data['permissions'] = $this->permissions();
        $data['product'] = $this->product->findById($id);
        $data['userLogs'] = $this->product->getUserLogs($this->product->getModuleId(), $id);

        return view('Client::product.edit', $data, $this->getFormOptions());
    }

    public function update(ProductRequest $request, $hashid)
    {
        $this->authorize('update', $this->permissions());
        $id = decode($hashid);
        
        $product = $this->product->update($id, $request);
        return redirect($this->prefix_name.'/products');
    }

    public function destroy($hashid)
    {
        $this->authorize('delete', $this->permissions());
        $id = decode($hashid);
        return $this->product->delete($id); 
    }

  
    public function getProductData(Request $request)
    {
        $product = $this->product->select('*')->with('brand', 'category');

        $user = auth()->user();
        $permissions = $this->permissions();
        return Datatables::of($product)
            ->filter(function ($query) use ($request) {
                if ($request->has('name')) {
                    $query->where('name', 'like', "%{$request->get('name')}%");
                }
                if ($request->has('category_id')) {
                    $query->where('category_id', 'like', "%{$request->get('category_id')}%");
                }
                if ($request->has('brand_id')) {
                    $query->where('brand_id', 'like', "%{$request->get('brand_id')}%");
                }
            })
            ->editColumn('information', function($row) {
                if($row->category == null) $html = "<p><b>Category: </b>".'N/A'.'';
                else $html = "<p><b>Category: </b>".$row->category->name.'';

                if($row->brand == null) $html.= "<br><b>Brand: </b>".'N/A'.'';
                else $html.= "<br><b>Brand: </b>".$row->brand->name.'</p>';
                return $html;
            })
            ->addColumn('image', function ($product) use ($user){
                if($product->image <> ''){
                    return '<img src="'.Storage::disk($user->client->storage_type)->url($user->client->root_dir.'/products/'.$product->image).'" alt="Not available" width="75px" height="70px" style="border-radius: 50%;"/>';
                }else{
                    return 'Not Available';
                }
            })
            ->addColumn('others', function ($product) {
                $html = "<p><b>Price: </b>".$product->price."";
                $html.= "<br/><b>Year: </b>".$product->year."";
                $html.= "<br/><b>Status: </b>".$product->status."</p>";
                return $html;
            })
            ->addColumn('action', function ($product) use ($permissions){
                $html = '';
                if($this->auth->user()->can('update', $permissions)) {
                    $html .= '<a href="'.url('client').'/products/edit/'.$product->hashid.'"><button type="button" data-toggle="tooltip" title="Update" class="btn btn-warning btn-xs btn-flat edited"><span class="glyphicon glyphicon-pencil"></span></button></a>';
                }
                if($this->auth->user()->can('delete', $permissions)) {
                    $html .= '&nbsp;<button type="button" data-toggle="tooltip" title="Delete" class="btn btn-danger btn-xs btn-flat deleted" data-action="'.url('client').'/products/destroy/'.$product->hashid.'"><span class="glyphicon glyphicon-trash"></span></button>';
                }
                return $html;
            })
            ->make(true);
    }

    protected function getFormOptions()
    {
        $data['brand'] = $this->productBrand->productBrandList();
        $data['category'] = $this->productCategory->productCategoryList();
        $data['products'] = $this->product->all();
        $data['status'] = Array('Publish' => 'Publish', 'Draft' => 'Draft', 'Inactive' => 'Inactive');
        return $data;
    }

}Modules/Client/Controllers/Products/ProductBrandController.php000066400000002726152434100730020657 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Products;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;
use Datatables;

use QxCMS\Modules\Client\Repositories\Products\ProductBrandRepositoryInterface as ProductBrand;

class ProductBrandController extends Controller
{

    public function __construct(ProductBrand $productBrand)
    {
        $this->productBrand = $productBrand;
    }

    public function store(Request $request)
    {        
        return $this->productBrand->create($request->all());
    }

    public function update(Request $request)
    {
        return $this->productBrand->update($request);
    }

    public function destroy($id)
    {
        return $this->productBrand->delete($id); 
    }

    public function getproductBrandData()
    {
        $productBrand = $this->productBrand->select(['*']);
        return Datatables::of($productBrand)
           ->addColumn('action', function($productBrand) {
                $html = '<a href="#edit" class="btn btn-xs btn-flat btn-warning btn-edit" data-id="'.$productBrand->id.'">
                        <i class="fa fa-pencil"></i>
                    </a>
                    <a href="#delete" class="btn btn-xs btn-flat btn-danger btn-delete" data-action="'.url('client').'/modals/brand/destroy/'.$productBrand->id.'" data-id="'.$productBrand->id.'">
                    <i class="fa fa-trash-o"></i>
                    </a>';
            return $html;
            })->make(true);
    }
}
Modules/Client/Controllers/Products/ProductCategoryController.php000066400000003017152434100730021400 0ustar00<?php

namespace QxCMS\Modules\Client\Controllers\Products;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;
use Datatables;

use QxCMS\Modules\Client\Repositories\Products\ProductCategoryRepositoryInterface as ProductCategory;

class ProductCategoryController extends Controller
{

    public function __construct(ProductCategory $productCategory)
    {
        $this->productCategory = $productCategory;
    }

    public function store(Request $request)
    {        
        return $this->productCategory->create($request->all());
    }

    public function update(Request $request)
    {
        return $this->productCategory->update($request);
    }

    public function destroy($id)
    {
        return $this->productCategory->delete($id); 
    }

    public function getproductCategoryData()
    {
        $productCategory = $this->productCategory->select(['*']);
        return Datatables::of($productCategory)
           ->addColumn('action', function($productCategory) {
                $html = '<a href="#edit" class="btn btn-xs btn-flat btn-warning btn-edit" data-id="'.$productCategory->id.'">
                        <i class="fa fa-pencil"></i>
                    </a>
                    <a href="#delete" class="btn btn-xs btn-flat btn-danger btn-delete" data-action="'.url('client').'/modals/category/destroy/'.$productCategory->id.'" data-id="'.$productCategory->id.'">
                    <i class="fa fa-trash-o"></i>
                    </a>';
            return $html;
            })->make(true);
    }
}
Modules/Client/Policies/RolePolicy.php000066400000002326152434100730013737 0ustar00<?php

namespace QxCMS\Modules\Client\Policies;

use QxCMS\Modules\Likod\Models\Clients\User;
use QxCMS\Modules\Client\Models\Settings\Roles\Permission;
use Illuminate\Auth\Access\HandlesAuthorization;

class RolePolicy
{
    use HandlesAuthorization;
    
    public function activated(User $user, Permission $permission)
    {
        return $permission->can_access;
    }

    public function create(User $user, Permission $permission)
    {

        return $permission->can_access == $permission->can_create;
    }

    public function update(User $user, Permission $permission)
    {
        return $permission->can_access == $permission->can_update;
    }

    public function delete(User $user, Permission $permission)
    {
        return $permission->can_access == $permission->can_delete;
    }

    public function export(User $user, Permission $permission)
    {
        return $permission->can_access == $permission->can_export;
    }

    public function import(User $user, Permission $permission)
    {
        return $permission->can_access == $permission->can_import;
    }

    public function prints(User $user, Permission $permission)
    {
        return $permission->can_access == $permission->can_print;
    }    
}Modules/Client/Requests/Principals/ContactPersonRequest.php000066400000001674152434100730020166 0ustar00<?php

namespace QxCMS\Modules\Client\Requests\Principals;

use Illuminate\Foundation\Http\FormRequest;

class ContactPersonRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name'     => 'required|min:3|unique:client.principal_contact_persons,name,'.(($this->getId()) ? $this->getId():'NULL').',id,principal_id,'.decode($this->principal),
            'position' => 'required',
            'email'    => 'required|email',
            'contact' => 'required',
        ];
    }

    public function messages()
    {
        return [
        ];
    }

    public function getId()
    {
        return decode($this->contact_person);
    }
}Modules/Client/Requests/Principals/PrincipalRequest.php000066400000001640152434100730017316 0ustar00<?php

namespace QxCMS\Modules\Client\Requests\Principals;

use Illuminate\Foundation\Http\FormRequest;

class PrincipalRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required|min:3|unique:client.principals,name,'.(($this->getId()) ? $this->getId():'NULL'),
            'address' => 'required',
            'email' => 'required|email|unique:client.principals,email,'.(($this->getId()) ? $this->getId():'NULL')
        ];
    }

    public function messages()
    {
        return [
           
        ];
    }

    public function getId()
    {
        return decode($this->principal);
    }
}Modules/Client/Requests/Subject/SubjectRequest.php000066400000004152152434100730016270 0ustar00<?php

namespace QxCMS\Modules\Client\Requests\Subject;

use Illuminate\Foundation\Http\FormRequest;

class SubjectRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $client = auth('client')->user()->client;
        $dateformat = $client->date_picker;
        $field_officer_assigned = $this->input('field_officer_assigned');
        $template_id = $this->input('template_id');
        $principal_id = $this->input('principal_id');
        return [
            'name' => 'required',
            'principal_id' => 'required',
            'template_id' => 'required',
            'field_officer_assigned' => 'required|unique:client.survey_subjects,field_officer_assigned,'.(($this->getId()) ? $this->getId():'NULL').',id,template_id,'.$template_id.',principal_id,'.$principal_id,
            'editor_assigned' => 'required',
            'interview_date' => 'required|date_format:'.$dateformat['php'],
            //'completion_date' => 'required|date_format:'.$dateformat['php'],

        ];
    }

    public function messages()
    {
        return [
            'name.required' => 'The <i>Subject Name</i> field is required.',
            'principal_id.required' => 'The <i>Client Assignment</> field is required.',
            'template_id.required' => 'The <i><em>Questionnaire Assigned</em></i> field is required.',
            'field_officer_assigned.required' => 'The <i><em>Field Officer Assigned</em></i> field is required.',
            'field_officer_assigned.unique' => 'This field officer is already assigned to same client and questionnaire.',
            'editor_assigned.required' => 'The <i><em>Editor Assigned</em></i> field is required.',
            'completion_date' => 'The <i><em>Interview Date Completion</em></i> field is required.'
        ];
    }


    public function getId()
    {
        return decode($this->subject);
    }
}Modules/Client/Requests/JobOpening/JobOpeningRequest.php000066400000003016152434100730017354 0ustar00<?php

namespace QxCMS\Modules\Client\Requests\JobOpening;

use Input;
use Illuminate\Foundation\Http\FormRequest;

class JobOpeningRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */

    public function rules()
    {
        return [
            'position'     => 'required|min:3|unique:client.job_opening,position,'.($this->getId() ? $this->getId() : NULL).',id',
            'no_position' => 'required|numeric|min:1',
            'min_age' => 'numeric|min:1',
            'max_age' => 'numeric|greater_than_field:min_age|min:1',
            'opening_date' => 'required',
            'closing_date' => 'required|after:opening_date',
            'status' => 'required',
            'location' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'position.required' => 'The position title field is required.',
            'no_position.required' => 'The no of applicant field is required.',
            'no_position.numeric' => 'The no of applicant must be a number.',
            'no_position.min' => 'The no of applicant field must be at least 1.',
            'max_age.greater_than_field' => 'The max age field must be greater than min age.',
        ];
    }

    public function getId()
    {
        return decode($this->job_opening);
    }
}Modules/Client/Requests/Officers/OfficerRequest.php000066400000005070152434100730016407 0ustar00<?php

namespace QxCMS\Modules\Client\Requests\Officers;

use Illuminate\Foundation\Http\FormRequest;

class OfficerRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $client = auth('client')->user()->client;
        $dateformat = $client->date_picker;
 
        if($this->getId()) {
            return [
                'name' => 'required',
                'access_type' => 'required',
                'email' => 'required|email|unique:qxcms.client_users,email,'.(($this->getId()) ? $this->getId():'NULL').',id,client_id,'.auth()->user()->client->id,
                'username' => 'required|unique:qxcms.client_users,username,'.(($this->getId()) ? $this->getId():'NULL').',id,client_id,'.auth()->user()->client->id,
                'status' => 'required',
                'password' => 'min:6',
                'password_confirmation' => 'required_with:password|same:password',
                'validity_date' => 'date_format:'.$dateformat['php'],
            ];
        } 

        return [
                'name' => 'required',
                'access_type' => 'required',
                'email' => 'required|email|unique:qxcms.client_users,email,'.(($this->getId()) ? $this->getId():'NULL').',id,client_id,'.auth()->user()->client->id,
                'username' => 'required|unique:qxcms.client_users,username,'.(($this->getId()) ? $this->getId():'NULL').',id,client_id,'.auth()->user()->client->id,
                'status' => 'required',
                'password' => 'required|min:6',
                'password_confirmation' => 'required|same:password',
                'validity_date' => 'date_format:'.$dateformat['php'],
            ];

    }

    public function messages()
    {
        return [
            'password_confirmation.required' => 'The re-type password field is required.',
            'password_confirmation.required_with' => 'The re-type password field is required when changing password.',
            'password_confirmation.same' => 'The re-type password and password must match.',
            //'validity_date.required' => 'The account period validity field is required.',
            'validity_date.date_format' => 'The account period validity date does not match the format :format.'
        ];
    }


    public function getId()
    {
        return decode($this->officer);
    }
}Modules/Client/Requests/Pages/PagesRequest.php000066400000001222152434100730015363 0ustar00<?php

namespace QxCMS\Modules\Client\Requests\Pages;

use Illuminate\Foundation\Http\FormRequest;

class PagesRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title'     => 'required|min:3',
        ];
    }

    public function messages()
    {
        return [
            'title.required' => 'Title is required.',
        ];
    }
}Modules/Client/Requests/Pages/AboutUsRequest.php000066400000001357152434100730015717 0ustar00<?php

namespace QxCMS\Modules\Client\Requests\Pages;

use Illuminate\Foundation\Http\FormRequest;

class AboutUsRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title'     => 'required',
            'content'     => 'required',
            'status'     => 'required',
        ];
    }

    public function messages()
    {
        return [
            // 'title.required' => 'The Question field is required.',
        ];
    }
}Modules/Client/Requests/Pages/FAQRequest.php000066400000001350152434100730014735 0ustar00<?php

namespace QxCMS\Modules\Client\Requests\Pages;

use Illuminate\Foundation\Http\FormRequest;

class FAQRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title'     => 'required',
            'content'     => 'required',
            'status'     => 'required',
        ];
    }

    public function messages()
    {
        return [
            'title.required' => 'The Question field is required.',
        ];
    }
}Modules/Client/Requests/Pages/ContactUsRequest.php000066400000002243152434100730016233 0ustar00<?php

namespace QxCMS\Modules\Client\Requests\Pages;

use Illuminate\Foundation\Http\FormRequest;

class ContactUsRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name'     => 'required',
            'email'     => 'required|email',
            'contact'     => 'required',
            'rec_street'     => 'required',
            'rec_city'     => 'required',
            // 'lat' => 'required',
            // 'lng' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'contact.required' => 'The contact number field is required.',
            'rec_street.required' => 'The street field is required.',
            'rec_city.required' => 'The city field is required.',
            'lat.required' => 'The latitude field is required.',
            'lng.required' => 'The longitude field is required.',
        ];
    }
}Modules/Client/Requests/Settings/RoleRequest.php000066400000001324152434100730015771 0ustar00<?php

namespace QxCMS\Modules\Client\Requests\Settings;

use Illuminate\Foundation\Http\FormRequest;

class RoleRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required|min:3|unique:client.roles,name,'.($this->getId() ? $this->getId():NULL).',id',
            'display_name' => 'required|min:3'
        ];
    }

    public function getId()
    {
        return decode($this->role);
    }
}Modules/Client/Requests/Settings/UserRequest.php000066400000002552152434100730016012 0ustar00<?php

namespace QxCMS\Modules\Client\Requests\Settings;

use Illuminate\Foundation\Http\FormRequest;

class UserRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        if($this->getId()) {
            return [
                'name' => 'required|min:3',
                'email' => 'required|email|unique:qxcms.client_users,email,'.(($this->getId()) ? $this->getId():'NULL').',id,client_id,'.auth('client')->user()->client->id,
                'role_id' => 'required',
                'password' => 'min:6',
                'password_confirmation' => 'required_with:password|min:6|same:password'
            ];
        }
        return [
            'name' => 'required|min:3',
            'email' => 'required|email|unique:qxcms.client_users,email,'.(($this->getId()) ? $this->getId():'NULL').',id,client_id,'.auth('client')->user()->client->id,
            'role_id' => 'required',
            'password' => 'required|min:6',
            'password_confirmation' => 'required|min:6|same:password'
        ];
    }

    public function getId()
    {
        return decode($this->user);
    }
}Modules/Client/Requests/Directory/DirectoryRequest.php000066400000003276152434100730017210 0ustar00<?php

namespace QxCMS\Modules\Client\Requests\Directory;

use Illuminate\Foundation\Http\FormRequest;

class DirectoryRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name'     => 'required|min:3|unique:client.locations,name,'.($this->getId() ? $this->getId() : NULL).',id',
            'affiliate_id' => 'required_if:category,Directory',
            'tel_no' => 'required',
            'email'    => 'email',
            'street' => 'required_if:category,Directory',
            'barangay' => 'required_if:category,Directory',
            'province_id' => 'required_if:category,Directory',
            'zip_code' => 'numeric',
            'details' => 'required_if:category,Directory',
            'lat' => 'required',
            'lng' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'name.required' => 'Name is required.',
            'tel_no.required' => 'Telephone number is required.',
            'affiliate_id.required_if' => 'Affiliate is required.',
            'street.required_if' => 'Street is required.',
            'barangay.required_if' => 'Barangay is required.',
            'province_id.required_if' => 'Province is required.',
            'lat.required' => 'Latitude is required.',
            'lng.required' => 'Longitude is required.',
        ];
    }

    public function getId()
    {
        return decode($this->id);
    }
}Modules/Client/Requests/Questionnaire/TemplateRequest.php000066400000001224152434100730017670 0ustar00<?php

namespace QxCMS\Modules\Client\Requests\Questionnaire;

use Illuminate\Foundation\Http\FormRequest;

class TemplateRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {

        return [
            'title' => 'required',
            'description' => 'required'
        ];
    }

    public function getId()
    {
        return decode($this->questionnaire);
    }
}Modules/Client/Requests/Questionnaire/QuestionRequest.php000066400000001412152434100730017723 0ustar00<?php

namespace QxCMS\Modules\Client\Requests\Questionnaire;

use Illuminate\Foundation\Http\FormRequest;

class QuestionRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {

        return [
            'title' => 'required',
            'name' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'name.required' => 'This field is required.'
        ];
    }

    public function getId()
    {
        return decode($this->question);
    }
}Modules/Client/Requests/Posts/PostRequest.php000066400000001574152434100730015334 0ustar00<?php

namespace QxCMS\Modules\Client\Requests\Posts;

use Illuminate\Foundation\Http\FormRequest;

class PostRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title'     => 'required|min:3',
            'posts_category_id' => 'required',
            'expired_at' => 'after:published_at'
        ];
    }

    public function messages()
    {
        return [
            'title.required' => 'Title is required.',
            'posts_category_id.required' => 'Category is required.',
            'expired_at.after' => 'This must be after publish date.',
        ];
    }
}Modules/Client/Requests/Products/ProductRequest.php000066400000002403152434100730016512 0ustar00<?php

namespace QxCMS\Modules\Client\Requests\Products;

use Illuminate\Foundation\Http\FormRequest;

class ProductRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name'     => 'required|min:3|unique:client.products,name,'.($this->getId() ? $this->getId() : NULL).',id',
            'brand_id' => 'required',
            'category_id' => 'required',
            'price' => 'numeric',
            'year' => 'numeric',
            'details' => 'required',
            'image' => 'image',
        ];
    }

    public function messages()
    {
        return [
            'name.required' => 'Product name is required.',
            'brand_id.required' => 'Product Brand is required.',
            'category_id.required' => 'Product Category is required.',
            'details.required' => 'Details is required.',
            'image.image' => 'This must be an image.',
        ];
    }

    public function getId()
    {
        return decode($this->id);
    }
}Modules/ClientServiceProvider.php000066400000021120152434100730013134 0ustar00<?php

namespace QxCMS\Modules;

use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;

class ClientServiceProvider extends ServiceProvider
{

    protected $namespace = 'QxCMS\Modules';

    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot(Router $router)
    {
        $modules = config('modules.modules');
        array_filter($modules, function($module) use ($router){
            if($module=='Client')
            {
                $this->registerModuleRoute($router, $module);
                $this->registerModuleView($module);
            }
        });

        view()->composer(['Client::dashboard.*', 'Client::layouts'], function($view){
            if (auth('client')->check())
            {
                $permissions = $this->serializePermission(auth('client')->user()->permissions);
                $view->with('userPermissions', $permissions);
            }
        });
    }

    public function serializePermission($permissions){
        $results = array();
        foreach ($permissions as $k => $permission){
            $results[$permission->menu_id] =  array(
                'can_access' => $permission->can_access,
                'can_update' => $permission->can_update,
                'can_create' => $permission->can_create,
                'can_delete' => $permission->can_delete,
                'can_export' => $permission->can_export,
                'can_import' => $permission->can_import,
                'can_print' => $permission->can_print,
            );
        }
        return $results;
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->setClientInterface();
        $this->mergeConfigFrom(
            __DIR__.'/tables.php', 'tables'
        );
        $this->mergeConfigFrom(
            config_path().'/account.php', 'account'
        );
    }

    public function registerModuleView($module)
    {
        return $this->loadViewsFrom(__DIR__."/$module/Views", $module);
    }

    public function registerModuleRoute($router, $module)
    {
        $router->group([
            'namespace' => $this->namespace.'\\'.$module.'\\'.'Controllers',
            'middleware' => 'web',
            'prefix' => strtolower($module)
        ], function ($router) use ($module) {
                require __DIR__."/$module/routes.php";
        });
    }
    
    public function setClientInterface()
    {
        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Settings\Roles\RoleRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Settings\Roles\RoleRepository::class
        );
        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Settings\Roles\PermissionRepository::class
        );
        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Settings\Users\UserRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Settings\Users\UserRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Principals\PrincipalRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Principals\PrincipalRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Principals\ContactPersonRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Principals\ContactPersonRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Principals\ContactNumberRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Principals\ContactNumberRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Questionnaire\TemplateRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Questionnaire\TemplateRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Questionnaire\QuestionRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Questionnaire\QuestionRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Questionnaire\AnswerRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Questionnaire\AnswerRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Subject\SubjectRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Subject\SubjectRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Officers\OfficerRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Officers\OfficerRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Directory\DirectoriesRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Directory\DirectoriesRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Directory\AffiliatesRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Directory\AffiliatesRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Directory\SpecializationsRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Directory\SpecializationsRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Directory\CitiesRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Directory\CitiesRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Directory\MunicipalitiesRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Directory\MunicipalitiesRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Directory\ProvincesRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Directory\ProvincesRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Products\ProductRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Products\ProductRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Products\ProductBrandRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Products\ProductBrandRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Products\ProductCategoryRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Products\ProductCategoryRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Posts\PostCategoryRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Posts\PostCategoryRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Posts\PostsRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Posts\PostsRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Pages\PagesRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Pages\PagesRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Participants\ParticipantRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Participants\ParticipantRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\JobOpening\JobOpeningRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\JobOpening\JobOpeningRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Pages\FAQRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Pages\FAQRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Pages\AboutUsRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Pages\AboutUsRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Pages\ContactUsRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Pages\ContactUsRepository::class
        );

        $this->app->bind(
            \QxCMS\Modules\Client\Repositories\Applicants\ApplicantRepositoryInterface::class,
            \QxCMS\Modules\Client\Repositories\Applicants\ApplicantRepository::class
        );
    }
}
Modules/ApiServiceProvider.php000066400000002242152434100730012433 0ustar00<?php

namespace QxCMS\Modules;

use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;

class ApiServiceProvider extends ServiceProvider
{

    protected $namespace = 'QxCMS\Modules';

    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot(Router $router)
    {
        $modules = config('modules.modules');
        array_filter($modules, function($module) use ($router) {
            if(strtolower($module)=='api')
            {
                $this->registerModuleRoute($router, $module);
            }
        });
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->mergeConfigFrom(
            __DIR__.'/tables.php', 'tables'
        );
    }

    public function registerModuleRoute($router, $module)
    {
        $router->group([
            'namespace' => $this->namespace.'\\'.$module.'\\'.'Controllers',
            'middleware' => 'cors',
            'prefix' => strtolower($module)
        ], function ($router) use ($module) {
                require __DIR__."/$module/routes.php";
        });
    }
    
}
Modules/Api/Middleware/Cors.php000066400000002272152434100730012365 0ustar00<?php

namespace QxCMS\Modules\Api\Middleware;

use Closure;
use Config;

class Cors
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        Config::set('database.connections.client', array(
            'driver'    => 'mysql',
            'host'      => env('API_DB_HOST'),
            'database'  => env('API_DB_DATABASE'),
            'username'  => env('API_DB_USERNAME'),
            'password'  => env('API_DB_PASSWORD'),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ));
        config(['account.dateformat.default' => 1]);
        config(['account.displaydateformat.default' => 2]);
        return $next($request)
            //->header('Access-Control-Allow-Credentials', true)
            ->header('Access-Control-Allow-Origin' , '*')
            ->header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS, PUT, DELETE')
            ->header('Access-Control-Allow-Headers', 'Content-Type, Accept, Authorization, X-Requested-With');
            
    }
}
Modules/Api/routes.php000066400000002645152434100730010727 0ustar00<?php

//Route::group(['middleware' => 'cors'], function(){
    Route::post('post-login', ['api.post-login','uses' => 'LoginController@postLogin']);
    Route::get('connect', ['api.post-login','uses' => 'LoginController@connect']);
    Route::post('save-profile', ['api.save-profile','uses' => 'ProfileController@saveProfile']);
    Route::post('upload-picture', ['api.upload-picture','uses' => 'ProfileController@uploadPicture']);
    Route::get('get-subject', ['api.get-subject','uses' => 'SubjectController@getSubject']);
    Route::get('get-questionnaire', ['api.get-questionnaire','uses' => 'QuestionnaireController@getQuestionnaire']);
    Route::get('get-job-opening', ['api.get-job-opening','uses' => 'JobOpeningController@getJobOpening']);

    //App - Pages
    Route::get('get-faq-page', ['api.get-faq-page','uses' => 'PagesController@getFAQ']);
    Route::get('get-about-us-page', ['api.get-about-us-page','uses' => 'PagesController@getAboutUs']);
    Route::get('get-contact-us-page', ['api.get-contact-us-page','uses' => 'PagesController@getContactUs']);
    //Applicant
    Route::post('save-applicant', ['as' => 'api.save-applicant', 'uses' => 'ApplicantController@saveApplicant']);
    Route::post('save-job-applied', ['as' => 'api.save-job-applied', 'uses' => 'ApplicantController@saveJobApplied']);

    Route::get('save-participant', ['as' => 'api.save-participant', 'uses' => 'ParticipantController@saveParticipant']);
//});Modules/Api/Controllers/SubjectController.php000066400000002741152434100730015354 0ustar00<?php

namespace QxCMS\Modules\Api\Controllers;

use Illuminate\Http\Request;

use QxCMS\Http\Controllers\Controller;
use QxCMS\Modules\Client\Repositories\Subject\SubjectRepositoryInterface as Subject;
use Auth;
use \Carbon\Carbon;

class SubjectController extends Controller
{
	protected $subject;


	public function __construct(Subject $subject)
	{
		$this->subject = $subject;
	}

    public function getSubject(Request $request)
    {

        $subjects = $this->subject->apiGetSubject($request->all());
        $responses = array();
        foreach ($subjects as $subject_key => $subject) {
            $responses[] =   array(
                                'original_id'            => $subject->id,
                                'name'                   => $subject->name,
                                'principal_id'           => $subject->principal_id,
                                'template_id'            => $subject->template_id,
                                'field_officer_assigned' => $subject->field_officer_assigned,
                                'editor_assigned'        => $subject->editor_assigned,
                                'interview_date'         => Carbon::parse($subject->interview_date)->format('Y-m-d'),
                                'completion_date'        => Carbon::parse($subject->completion_date)->format('Y-m-d'),
                            );
        }

        return response()->json($responses)->withCallback($request->input('callback'));
    }
}Modules/Api/Controllers/PagesController.php000066400000007120152434100730015010 0ustar00<?php

namespace QxCMS\Modules\Api\Controllers;

use Auth;
use Carbon\Carbon;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Repositories\Pages\FAQRepositoryInterface as FAQ;
use QxCMS\Modules\Client\Repositories\Pages\AboutUsRepositoryInterface as AboutUs;
use QxCMS\Modules\Client\Repositories\Pages\ContactUsRepositoryInterface as ContactUs;

class PagesController extends Controller
{
	protected $faq;
    protected $about_us;
    protected $contact_us;

	public function __construct(FAQ $faq, AboutUs $about_us, ContactUs $contact_us)
	{
		$this->faq = $faq;
        $this->about_us = $about_us;
        $this->contact_us = $contact_us;
	}

    public function getFAQ(Request $request)
    {
        $faqs = $this->faq->apiGetFAQ($request->all());
        $responses = array();
        foreach ($faqs as $key => $faq) {
            $responses[] =   array(
                                'id'                     => $faq->id,
                                'question'               => $faq->title,
                                'answer'                 => $faq->content,
                                'status'                 => $faq->status,
                                'slug'                   => $faq->slug,
                            );
        }
        return response()->json($responses)->withCallback($request->input('callback'));
    }

    public function getAboutUs(Request $request)
    {
        $abouts = $this->about_us->apiGetAboutUs($request->all());
        $responses = array();
        foreach ($abouts as $key => $about_us) {
            $responses[] =   array(
                                'id'                     => $about_us->id,
                                'title'                  => $about_us->title,
                                'content'                => $about_us->content,
                                'status'                 => $about_us->status,
                                'slug'                   => $about_us->slug,
                            );
        }
        return response()->json($responses)->withCallback($request->input('callback'));
    }

    public function getContactUs(Request $request)
    {
        $contacts = $this->contact_us->apiGetContactUs($request->all());
        $responses = array();
        foreach ($contacts as $key => $contact_us) {
            $responses[] =  array(
                                'id'                        => $contact_us->id,
                                'name'                      => $contact_us->name,
                                'email'                     => $contact_us->email,
                                'contact'                   => $contact_us->contact,
                                'building_name'             => $contact_us->building_name,
                                'building_floor'            => $contact_us->building_floor,
                                'number'                    => $contact_us->rec_number,
                                'street'                    => $contact_us->rec_street,
                                'city'                      => $contact_us->rec_city,
                                'building'                  => $contact_us->building_floor.($contact_us->building_floor && $contact_us->building_name ? ', ' : '').$contact_us->building_name,
                                'recruitment_address'       => $contact_us->rec_number.' '.$contact_us->rec_street.', '.$contact_us->rec_city,
                            );
        }
        return response()->json($responses)->withCallback($request->input('callback'));
    }
}Modules/Api/Controllers/JobOpeningController.php000066400000004165152434100730016011 0ustar00<?php

namespace QxCMS\Modules\Api\Controllers;

use Auth;
use Carbon\Carbon;

use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;

use QxCMS\Modules\Client\Repositories\JobOpening\JobOpeningRepositoryInterface as JobOpening;

class JobOpeningController extends Controller
{
	protected $job_opening;


	public function __construct(JobOpening $job_opening)
	{
		$this->job_opening = $job_opening;
	}

    public function getJobOpening(Request $request)
    {

        $job_openings = $this->job_opening->apiGetJobOpening($request->all());
        $responses = array();
        foreach ($job_openings as $job_key => $job_opening) {
            $responses[] =   array(
                                'id'                     => $job_opening->id,
                                'type_questionnaire'     => $job_opening->type_questionnaire,
                                'position'               => $job_opening->position,
                                'no_position'            => $job_opening->no_position,
                                'proposed_salary'        => $job_opening->proposed_salary,
                                'gender'                 => $job_opening->gender,
                                'min_age'                => $job_opening->min_age,
                                'max_age'                => $job_opening->max_age,
                                'opening_date'           => Carbon::parse($job_opening->opening_date)->format('F d, Y'),
                                'closing_date'           => Carbon::parse($job_opening->closing_date)->format('F d, Y'),
                                'location'               => $job_opening->location,
                                'country'                => $job_opening->country->name,
                                'status'                 => $job_opening->status,
                                'job_details'            => $job_opening->job_details,
                                'slug'                   => $job_opening->slug,
                            );
        }

        return response()->json($responses)->withCallback($request->input('callback'));
    }
}Modules/Api/Controllers/ApplicantController.php000066400000003541152434100730015667 0ustar00<?php

namespace QxCMS\Modules\Api\Controllers;

use Auth;
use \Carbon\Carbon;
use Illuminate\Http\Request;

use QxCMS\Http\Controllers\Controller;
use QxCMS\Modules\Client\Models\Applicants\Applicant as Applicant;
use QxCMS\Modules\Client\Models\Applicants\JobApplied as JobApplied;

class ApplicantController extends Controller
{
    protected $applicant;
    protected $job_applied;

	public function __construct(Applicant $applicant, JobApplied $job_applied)
	{
		$this->applicant = $applicant;
        $this->job_applied = $job_applied;
	}

    public function saveApplicant(Request $request)
    {
        $applicant_input = array(
            'first_name'            => 'Sample First Name',
            'middle_name'           => 'Sample Middle Name',
            'last_name'             => 'Sample Last Name',
            'mobile_number'         => '09222222222',
            'email'                 => 'sample@only.com',
            'school'                => 'Sample College',
            'college_degree'        => 'Bachelor Degree',
            'company'               => 'Sample Company',
            'position'              => 'Sample Position',
            'yrs_exp'               => '3',
            'work_location'         => 'Quezon City',
        );

        $applicant = $this->applicant->create($applicant_input);
    
        return response()->json($applicant_input)->withCallback($request->input('callback'));
    }

    public function saveJobApplied(Request $request)
    {
        $job_applied_input = array(
            'applicant_id'          => '1',
            'job_id'                => '1',
            'apply_date'            => Carbon::now()->toDateString(),
        );
        
        $job_applied = $this->job_applied->create($job_applied_input);

        return response()->json($job_applied_input)->withCallback($request->input('callback'));
    }
}Modules/Api/Controllers/LoginController.php000066400000002563152434100730015027 0ustar00<?php

namespace QxCMS\Modules\Api\Controllers;

use Illuminate\Http\Request;

use QxCMS\Http\Controllers\Controller;
use QxCMS\Modules\Client\Repositories\Settings\Users\UserRepositoryInterface as User;
use Auth;
class LoginController extends Controller
{
	protected $user;


	public function __construct(User $user)
	{
		$this->user = $user;
	}

    public function postLogin(Request $request)
    {
        $user = array();
        if (Auth::guard('client')->attempt(['email' => $request->get('email'), 'password' => $request->get('password'), 'access_type' => config('role.field_officer')])) {
            $user_login = auth('client')->user();
            $user = array(
                    'client_id'             => $user_login->client_id,
                    'id'                    => $user_login->id,
                    'email'                 => $user_login->email,
                    'name'                  => $user_login->name,
                    'photo'                 => $user_login->photo,
                    'username'              => $user_login->username,
                    'position'              => $user_login->position,
                );
        }

        Auth::guard('client')->logout();
        return $user;
    }

    public function connect(Request $request)
    {
        return response()->json([
                'connected' => true
            ]);
    }
}Modules/Api/Controllers/ProfileController.php000066400000001713152434100730015353 0ustar00<?php

namespace QxCMS\Modules\Api\Controllers;

use Illuminate\Http\Request;

use QxCMS\Http\Controllers\Controller;
use QxCMS\Modules\Client\Repositories\Settings\Users\UserRepositoryInterface as User;
use Auth;


class ProfileController extends Controller
{
	protected $user;


	public function __construct(User $user)
	{
		$this->user = $user;
	}

    public function saveProfile(Request $request)
    {
        $user = $this->user->findById($request->get('id'));
        if(!empty($user)) {
            $user->name = $request->get('name');
            $user->photo = $request->get('photo');
            $user->position = $request->get('position');
            $user->save();
        }
        return $request->all();
    }

    public function uploadPicture(Request $request)
    {
        $filename =  $request->file('file')->getClientOriginalName();
        $path = $request->file('file')->storeAs(
            'avatars', $filename , 'public'
        );   
    }
}Modules/Api/Controllers/QuestionnaireController.php000066400000004171152434100730016602 0ustar00<?php

namespace QxCMS\Modules\Api\Controllers;

use Illuminate\Http\Request;

use QxCMS\Http\Controllers\Controller;
use QxCMS\Modules\Client\Repositories\Questionnaire\QuestionRepositoryInterface as Question;
use QxCMS\Modules\Client\Repositories\Questionnaire\TemplateRepositoryInterface as Template;
use Auth;
use \Carbon\Carbon;

class QuestionnaireController extends Controller
{
    protected $question;
	protected $template;


	public function __construct(Question $question, Template $template)
	{
		$this->question = $question;
        $this->template = $template;
	}

    public function getQuestionnaire(Request $request)
    {


        $types = $this->question->getTypes();

        $template = $this->template->apiGetQuestionnaire($request->all());
        $responses = array();
        $responses['title']  = $template->title;
        /*$responses['pages'] = array();*/
        foreach ($template->questions as $question_key => $question) {

            $type = (($question->multiple_select == true) ? 3:$question->question_type);
            $choices = array();
            if($type == 2 || $type == 3)
            {
                foreach ($question->answers as $answer_key => $answer) {
                    
                    $choices[] =  array('value' => "$answer->id", 'text' => $answer->name);
                }
            }


            $responses['pages'][$question_key] =  array(
                                            'name' => 'page'.$question->id,
                                            'questions' =>  array(array(
                                                'type' => $types[$type],
                                                'name' => 'question'.$question->id,
                                                'title' => $question->title,
                                                'choices' => $choices,
                                                'isRequired' => ($question->required == true) ? true:false
                                            ))
                                        );

        }

        return response()->json($responses)->withCallback($request->input('callback'));
    }
}Modules/Api/Controllers/ParticipantController.php000066400000005345152434100730016236 0ustar00<?php

namespace QxCMS\Modules\Api\Controllers;

use Illuminate\Http\Request;

use QxCMS\Http\Controllers\Controller;
/*use QxCMS\Modules\Client\Repositories\Participants\AnswersRepositoryInterface as Answer;*/
use QxCMS\Modules\Client\Repositories\Questionnaire\QuestionRepositoryInterface as Question;
use QxCMS\Modules\Client\Repositories\Participants\ParticipantRepositoryInterface as Participant;
use Auth;
use \Carbon\Carbon;

class ParticipantController extends Controller
{
    protected $participant;
    protected $question;

	public function __construct(Participant $participant, Question $question)
	{
		$this->participant = $participant;
        $this->question = $question;
	}

    public function saveParticipant(Request $request)
    {
        $location = $request->get('pos');
        $participant_input = array(
            'email' => 'danilo@quantumx.com',
            'name' => 'Danilo R. Dela Cruz',
            'template_id' => $request->get('template_id'),
            'loc_lat' => $location['loc_lat'],
            'loc_long' => $location['loc_long']
        );

        $participant = $this->participant->create($participant_input);
        
        $answers = $request->get('answers');
        $types = $this->question->getTypes();
        $str = 'question';
        $answers_input = [];
        foreach ($answers as $answer_key => $answer) {
            if(starts_with($answer_key, $str)) {
                $question_id = str_replace($str, '', $answer_key);
                $answers_input['question_id'] = $question_id;
                if(!empty($question_id)) {

                    $question = $this->question->findById($question_id);
                    if(!empty($question)) {
                        $type = $question->question_type;
                        if($type == 2 || $type == 3) {
                            if(is_array($answer)) {
                                foreach ($answer as $ans_key => $ans_val) {
                                    $answers_input['answer_id'] = $ans_val;
                                    $participant->answers()->create($answers_input);
                                }
                                continue;
                            }

                            $answers_input['answer_id'] = $answer;
                        }

                        if($type == 1) { 
                            $answers_input['answer'] = $answer;
                        }
                    }

                    $participant->answers()->create($answers_input);
                }
            }
            unset($answers_input);
        }

        return $this->participant->select(['*'])->with(['answers'])->get();
    
        return response()->json($responses)->withCallback($request->input('callback'));
    }
}Modules/Kiosk/routes.php000066400000000000152434100730011255 0ustar00Modules/AbstractRepository.php000066400000005143152434100730012534 0ustar00<?php

namespace QxCMS\Modules;

abstract class AbstractRepository
{
    public function findById($id)
    {
        return $this->model->findOrFail($id);
    }

    public function select($columns = ['*'])
    {
       return $this->model->select($columns);
    }

    public function all()
    {
        return $this->model->all();
    }

    public function where($column, $operator = null, $value = null, $boolean = 'and')
    {
        return $this->model->where($column, $operator, $value, $boolean);
    }

    public function lists($name = 'name', $id = '', $orderBy = array('name', 'asc'))
    {
        if($id != '') return $this->model->orderBy($orderBy[0], $orderBy[1])->lists($name, $id)->all();
        else return $this->model->orderBy($orderBy[0], $orderBy[1])->lists($name)->all();
    }

    public function pluck($name = 'name', $id = '')
    {
        if($id != '') return $this->model->pluck($name, $id);
        else return $this->model->pluck($name);
    }

    public function with($eagers = '')
    {
        return $this->model->with($eagers);
    }

    public function getAjaxResponse($type, $message)
    {
        return  response(
            array('message'=>$message,'type'=>$type)
        )->header('Content-Type', 'application/json');
    }

    public function getModuleId()
    {
        return $this->model->module_id;
    }

    public function setConfig($client)
    {
        \Config::set('database.connections.client', array(
            'driver'    => 'mysql',
            'host'      => $client->database_host,
            'database'  => env('DB_PREFIX', 'qxcms_').$client->database_name,
            'username'  => $client->database_username,
            'password'  => $client->database_password,
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ));
        return config('database.connections.client');
    }

    public function getUserLogs($module_id, $id = null, $sub_menu = null)
    {
        if(($id == null) && ($sub_menu == null)) return $this->log->where('module_id', $module_id)->latest()->take(3)->with('user')->get();
        else if($sub_menu == null) return $this->log->where('module_id', $module_id)->where('data_id', $id)->where('sub_menu', '')->latest()->take(3)->with('user')->get();
        else if(($id == null) && ($sub_menu != null)) return $this->log->where('module_id', $module_id)->where('sub_menu', $sub_menu)->latest()->take(3)->with('user')->get();
        else return $this->log->where('module_id', $module_id)->where('data_id', $id)->where('sub_menu', $sub_menu)->latest()->take(3)->with('user')->get();
    }
}Modules/LikodServiceProvider.php000066400000004174152434100730012772 0ustar00<?php

namespace QxCMS\Modules;

use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;

class LikodServiceProvider extends ServiceProvider
{

    protected $namespace = 'QxCMS\Modules';

    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot(Router $router)
    {
        $modules = config('modules.modules');
        array_filter($modules, function($module) use ($router) {
            if($module=='Likod')
            {
                $this->registerModuleRoute($router, $module);
                $this->registerModuleView($module);
            }
        });
        /*\DB::listen(function($sql) {
            var_dump($sql);
        });*/
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->setLikodInterface();
        $this->mergeConfigFrom(
            __DIR__.'/tables.php', 'tables'
        );
    }

    public function registerModuleView($module)
    {
        return $this->loadViewsFrom(__DIR__."/$module/Views", $module);
    }

    public function registerModuleRoute($router, $module)
    {
        $router->group([
            'namespace' => $this->namespace.'\\'.$module.'\\'.'Controllers',
            'middleware' => 'web',
            'prefix' => strtolower($module)
        ], function ($router) use ($module) {
                require __DIR__."/$module/routes.php";
        });
    }

    public function setLikodInterface()
    {
        $this->app->bind(
            \QxCMS\Modules\Likod\Repositories\Settings\Roles\RoleRepositoryInterface::class,
            \QxCMS\Modules\Likod\Repositories\Settings\Roles\RoleRepository::class
        );
        $this->app->bind(
            \QxCMS\Modules\Likod\Repositories\Settings\Users\UserRepositoryInterface::class,
            \QxCMS\Modules\Likod\Repositories\Settings\Users\UserRepository::class
        );
        $this->app->bind(
            \QxCMS\Modules\Likod\Repositories\Clients\Clients\ClientRepositoryInterface::class,
            \QxCMS\Modules\Likod\Repositories\Clients\Clients\ClientRepository::class
        );
    }
}
Modules/Employer/Middleware/Authenticate.php000066400000004072152434100730015160 0ustar00<?php

namespace QxCMS\Modules\Employer\Middleware;

use Closure;
use Config;
use Illuminate\Support\Facades\Auth;
use QxCMS\Modules\Likod\Models\Clients\Client;

class Authenticate
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  string|null  $guard
     * @return mixed
     */
    public function handle($request, Closure $next, $guard = 'employer')
    {
        $root_dir = strtolower(session('root_dir'));
        $new_root_dir = strtolower($request->segment(2));
        if($root_dir == '')  {
            $root_dir = $new_root_dir;
            session(['root_dir' => $root_dir]);
        }
        if($root_dir != $new_root_dir) return redirect()->route('employer.logout', $root_dir);
        $client = new Client;
        $config = $client->where('root_dir', $root_dir)->get()->first();
        if(count($config) <= 0) return response()->view('errors.404', [], 500);

        config(['auth.defaults.guard' => $guard]);
        Config::set('database.connections.client', array(
            'driver'    => 'mysql',
            'host'      =>  $config->database_host,
            'database'  => 'myradh_'. $config->database_name,
            'username'  =>  $config->database_username,
            'password'  =>  $config->database_password,
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ));
        Config::set('filesystems.disks.s3', array(
            'driver' => 's3',
            'key'    =>  $config->s3_key,
            'secret' =>  $config->s3_secret,
            'region' =>  $config->s3_region,
            'bucket' =>  $config->s3_bucket_name,
            'scheme' => 'http',
        ));

        if (Auth::guard($guard)->guest()) {
            if ($request->ajax() || $request->wantsJson()) {
                return response('Unauthorized.', 401);
            } else {
                return redirect()->guest('employer/'.$new_root_dir.'/auth/login');
            }
        }
        return $next($request);
    }
}Modules/Employer/Middleware/RedirectIfAuthenticated.php000066400000003602152434100730017263 0ustar00<?php

namespace QxCMS\Modules\Employer\Middleware;

use Closure;
use Config;
use Illuminate\Support\Facades\Auth;
use QxCMS\Modules\Likod\Models\Clients\Client;

class RedirectIfAuthenticated
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  string|null  $guard
     * @return mixed
     */
    public function handle($request, Closure $next, $guard = 'employer')
    {
        $root_dir = strtolower($request->segment(2));
        session(['root_dir' => $root_dir]);
        if($root_dir == '')  return response()->view('errors.404', [], 500);
        $client = new Client;
        $config = $client->where('root_dir', $root_dir)->get()->first();
        if(count($config) <= 0) return response()->view('errors.404', [], 500);

        config(['auth.defaults.guard' => $guard]);
        Config::set('database.connections.client', array(
            'driver'    => 'mysql',
            'host'      =>  $config->database_host,
            'database'  => 'myradh_'. $config->database_name,
            'username'  =>  $config->database_username,
            'password'  =>  $config->database_password,
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ));
        Config::set('filesystems.disks.s3', array(
            'driver' => 's3',
            'key'    =>  $config->s3_key,
            'secret' =>  $config->s3_secret,
            'region' =>  $config->s3_region,
            'bucket' =>  $config->s3_bucket_name,
            'scheme' => 'http',
        ));

        if (Auth::guard($guard)->check()) {
            $request->setUserResolver(function () use ($guard) {
                return Auth::guard($guard)->user();
            });
            return redirect('employer/'.$root_dir.'/dashboard');
        }
        return $next($request);
    }
}Modules/Employer/Views/message.blade.php000066400000001502152434100730014247 0ustar00<div id="message-wrapper">
    @if(session('logout'))
        <div class="alert alert-success alert-dismissable fade in" style="padding-top: 4px;padding-bottom: 4px; padding-right: 29px; padding-left: 10px;">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <i class="fa fa-check"></i>&nbsp;
            {{ session('logout') }}
        </div>
    @endif
    @if(session('error_logout'))
        <div class="alert alert-danger alert-dismissable fade in" style="padding-top: 4px;padding-bottom: 4px; padding-right: 29px; padding-left: 10px;">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <i class="fa fa-times"></i>&nbsp;
            {{ session('error_logout') }}
        </div>
    @endif
</div>Modules/Employer/Views/dashboard/dashboard.blade.php000066400000006530152434100730016507 0ustar00@extends('Employer::layouts')
@section('page-body')
	<!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            Dashboard
            <small>Control panel</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li class="active">Dashboard</li>
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">
    	<div class="row">
            <div class="col-lg-3 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-aqua">
                    <div class="inner">
                        <h3>
                            1
                        </h3>
                        <p>
                            Total Users
                        </p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-android-social-user"></i>
                    </div>
                    <a href="#" class="small-box-footer">
                        More info <i class="fa fa-arrow-circle-right"></i>
                    </a>
                </div>
            </div><!-- ./col -->
            <div class="col-lg-3 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-green">
                    <div class="inner">
                        <h3>
                            1
                        </h3>
                        <p>
                            Total Principals
                        </p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-android-contacts"></i>
                    </div>
                    <a href="#" class="small-box-footer">
                        More info <i class="fa fa-arrow-circle-right"></i>
                    </a>
                </div>
            </div><!-- ./col -->
            <div class="col-lg-3 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-yellow">
                    <div class="inner">
                        <h3>
                            1
                        </h3>
                        <p>
                            Total Applicants
                        </p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-android-friends"></i>
                    </div>
                    <a href="#" class="small-box-footer">
                        More info <i class="fa fa-arrow-circle-right"></i>
                    </a>
                </div>
            </div><!-- ./col -->
            <div class="col-lg-3 col-xs-6">
                <!-- small box -->
                <div class="small-box bg-red">
                    <div class="inner">
                        <h3>
                            1
                        </h3>
                        <p>
                            -
                        </p>
                    </div>
                    <div class="icon">
                        <i class="ion ion-android-contact"></i>
                    </div>
                    <a href="#" class="small-box-footer">
                        More info <i class="fa fa-arrow-circle-right"></i>
                    </a>
                </div>
            </div><!-- ./col -->
        </div>
    </section>
@stopModules/Employer/Views/auth/emails/password.blade.php000066400000000242152434100730016700 0ustar00Click here to reset your password: <a href="{{ $link = url('password/reset', $token).'?email='.urlencode($user->getEmailForPasswordReset()) }}"> {{ $link }} </a>
Modules/Employer/Views/auth/register.blade.php000066400000007322152434100730015416 0ustar00@extends('Client::layouts.app')

@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading">Register</div>
                <div class="panel-body">
                    <form class="form-horizontal" role="form" method="POST" action="{{ url('/register') }}">
                        {!! csrf_field() !!}

                        <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">Name</label>

                            <div class="col-md-6">
                                <input type="text" class="form-control" name="name" value="{{ old('name') }}">

                                @if ($errors->has('name'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('name') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">E-Mail Address</label>

                            <div class="col-md-6">
                                <input type="email" class="form-control" name="email" value="{{ old('email') }}">

                                @if ($errors->has('email'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">Password</label>

                            <div class="col-md-6">
                                <input type="password" class="form-control" name="password">

                                @if ($errors->has('password'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">Confirm Password</label>

                            <div class="col-md-6">
                                <input type="password" class="form-control" name="password_confirmation">

                                @if ($errors->has('password_confirmation'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password_confirmation') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <button type="submit" class="btn btn-primary">
                                    <i class="fa fa-btn fa-user"></i>Register
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
Modules/Employer/Views/auth/passwords/email.blade.php000066400000003570152434100730016707 0ustar00@extends('layouts.app')

<!-- Main Content -->
@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading">Reset Password</div>
                <div class="panel-body">
                    @if (session('status'))
                        <div class="alert alert-success">
                            {{ session('status') }}
                        </div>
                    @endif

                    <form class="form-horizontal" role="form" method="POST" action="{{ url('/password/email') }}">
                        {!! csrf_field() !!}

                        <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">E-Mail Address</label>

                            <div class="col-md-6">
                                <input type="email" class="form-control" name="email" value="{{ old('email') }}">

                                @if ($errors->has('email'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <button type="submit" class="btn btn-primary">
                                    <i class="fa fa-btn fa-envelope"></i>Send Password Reset Link
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
Modules/Employer/Views/auth/passwords/reset.blade.php000066400000006203152434100730016736 0ustar00@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading">Reset Password</div>

                <div class="panel-body">
                    <form class="form-horizontal" role="form" method="POST" action="{{ url('/password/reset') }}">
                        {!! csrf_field() !!}

                        <input type="hidden" name="token" value="{{ $token }}">

                        <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">E-Mail Address</label>

                            <div class="col-md-6">
                                <input type="email" class="form-control" name="email" value="{{ $email or old('email') }}">

                                @if ($errors->has('email'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">Password</label>

                            <div class="col-md-6">
                                <input type="password" class="form-control" name="password">

                                @if ($errors->has('password'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">Confirm Password</label>
                            <div class="col-md-6">
                                <input type="password" class="form-control" name="password_confirmation">

                                @if ($errors->has('password_confirmation'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password_confirmation') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <button type="submit" class="btn btn-primary">
                                    <i class="fa fa-btn fa-refresh"></i>Reset Password
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
Modules/Employer/Views/auth/login.blade.php000066400000007377152434100730014714 0ustar00<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>MyRADH | Employer Log-in</title>
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        <link rel="stylesheet" href="{{ get_template('css/bootstrap.min.css') }}">
        <link rel="stylesheet" href="{{ get_template('css/font-awesome.min.css') }}">
        <link rel="stylesheet" href="{{ get_template('css/ionicons.min.css') }}">
        <link rel="stylesheet" href="{{ get_template('css/AdminLTELogin.css') }}">
        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body class="hold-transition login-page">
        <div class="login-box">
            <div class="login-logo">
                <span><b>MyRA DH</b> | Employer</span>
            </div>
            @include('Employer::message')
            <div class="login-box-body">
                <p class="login-box-msg">Sign in to start your session</p>
                <form role="form" method="POST" action="{{ route('employer.get-login', session('root_dir')) }}" id="login-form">
                    {!! csrf_field() !!}
                    <!-- <div class="form-group has-feedback"> -->
                    <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }} has-feedback">
                        <input type="email" name="email" class="form-control" placeholder="Email" value="{{ old('email') }}">
                        <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
                        @if ($errors->has('email'))
                            <span class="help-block">
                                {{ $errors->first('email') }}
                            </span>
                        @endif
                    </div>
                    <!-- <div class="form-group has-feedback"> -->
                    <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }} has-feedback">
                        <input type="password" name="password" class="form-control" placeholder="Password">
                        <span class="glyphicon glyphicon-lock form-control-feedback"></span>
                        @if ($errors->has('password'))
                            <span class="help-block">
                                {{ $errors->first('password') }}
                            </span>
                        @endif
                    </div>
                    <div class="row">
                        <div class="col-xs-8" id="checkbox" style="padding-left:35px;">
                        </div>
                        <div class="col-xs-4">
                          <button type="submit" class="btn btn-primary btn-block btn-flat"><i class="fa fa-sign-in"></i> Sign In</button>
                        </div>
                    </div>
                </form>
                <a href="#"><i class="fa fa-lock"></i> Forgot my password?</a><br>
            </div>
        </div>
        <script type="text/javascript" src="{{ get_template('js/jquery.min.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('js/bootstrap.min.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('js/plugins/iCheck/icheck.min.js') }}"></script>
        <script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
        {!! $validator !!}
    </body>
</html>Modules/Employer/Views/notify.blade.php000066400000010776152434100730014150 0ustar00@if(session('success'))
<script type="text/javascript">
$(function() {
    /* Notify Success */
    $.notify.addStyle('success', {
        html: "<div><i class=\"fa fa-check-circle\" aria-hidden=\"true\"></i>&nbsp;<span data-notify-text/></div>",
        classes: {
            base: {
              "white-space": "nowrap",
              "background-color": "#dff0d8",
              "padding": "5px"
            },
            supersuccess: {
              "color": "#3c763d",
              "background-color": "#dff0d8"
            }
        }
    });
    $.notify('{{ session("success") }}', {
        style: 'success',
        className: 'supersuccess',
        clickToHide: true,
        position:"top right", 
        autoHide: true, 
        autoHideDelay: 3000, 
        showAnimation: 'slideDown',
        showDuration: 400,
        hideAnimation: 'slideUp',
        hideDuration: 200
    });
});
</script>    
@endif

@if(session('error'))
<script type="text/javascript">
$(function() {
    /* Notify Danger */
    $.notify.addStyle('danger', {
        html: "<div><i class=\"fa fa-times-circle\" aria-hidden=\"true\"></i>&nbsp;<span data-notify-text/></div>",
        classes: {
            base: {
              "white-space": "nowrap",
              "background-color": "#f2dede",
              "padding": "5px"
            },
            superdanger: {
              "color": "#a94442",
              "background-color": "#f2dede"
            }
        }
    });
    $.notify('{{ session("error") }}', {
        style: 'danger',
        className: 'superdanger',
        clickToHide: true,
        position:"top right", 
        autoHide: true, 
        autoHideDelay: 3000, 
        showAnimation: 'slideDown',
        showDuration: 400,
        hideAnimation: 'slideUp',
        hideDuration: 200
    });
});
</script>    
@endif

@if(session('danger'))
<script type="text/javascript">
$(function() {
    /* Notify Danger */
    $.notify.addStyle('danger', {
        html: "<div><i class=\"fa fa-times-circle\" aria-hidden=\"true\"></i>&nbsp;<span data-notify-text/></div>",
        classes: {
            base: {
              "white-space": "nowrap",
              "background-color": "#f2dede",
              "padding": "5px"
            },
            superdanger: {
              "color": "#a94442",
              "background-color": "#f2dede"
            }
        }
    });
    $.notify('{{ session("danger") }}', {
        style: 'danger',
        className: 'superdanger',
        clickToHide: true,
        position:"top right", 
        autoHide: true, 
        autoHideDelay: 3000, 
        showAnimation: 'slideDown',
        showDuration: 400,
        hideAnimation: 'slideUp',
        hideDuration: 200
    });
});
</script>    
@endif

@if(session('info'))
<script type="text/javascript">
$(function() {
    /* Notify Info */
    $.notify.addStyle('info', {
        html: "<div><i class=\"fa fa-info-circle\" aria-hidden=\"true\"></i>&nbsp;<span data-notify-text/></div>",
        classes: {
            base: {
              "white-space": "nowrap",
              "background-color": "#d9edf7",
              "padding": "5px"
            },
            superinfo: {
              "color": "#31708f",
              "background-color": "#d9edf7"
            }
        }
    });
    $.notify('{{ session("info") }}', {
        style: 'info',
        className: 'superinfo',
        clickToHide: true,
        position:"top right", 
        autoHide: true, 
        autoHideDelay: 3000, 
        showAnimation: 'slideDown',
        showDuration: 400,
        hideAnimation: 'slideUp',
        hideDuration: 200
    });
});
</script>    
@endif

@if(session('warning'))
<script type="text/javascript">
$(function() {
    /* Notify Warning */
    $.notify.addStyle('warning', {
        html: "<div><i class=\"fa fa-exclamation-circle\" aria-hidden=\"true\"></i>&nbsp;<span data-notify-text/></div>",
        classes: {
            base: {
              "white-space": "nowrap",
              "background-color": "#fcf8e3",
              "padding": "5px"
            },
            superwarning: {
              "color": "#8a6d3b",
              "background-color": "#fcf8e3"
            }
        }
    });
    $.notify('{{ session("warning") }}', {
        style: 'warning',
        className: 'superwarning',
        clickToHide: true,
        position:"top right", 
        autoHide: true, 
        autoHideDelay: 3000, 
        showAnimation: 'slideDown',
        showDuration: 400,
        hideAnimation: 'slideUp',
        hideDuration: 200
    });
});
</script>    
@endifModules/Employer/Views/layouts.blade.php000066400000026040152434100730014327 0ustar00<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="csrf-token" content="{{ csrf_token() }}" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>MyRA DH - {{ isset($title) ? $title:'Dashboard' }}</title>
        <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
        <!-- jquery ui 1.11.2 -->
        <link rel="stylesheet" href="{{ get_template('js/plugins/jquery-ui-1.11.2/jquery-ui.min.css') }}">
        <!-- bootstrap 3.0.2 -->
        <link href="{{ get_template('css/bootstrap.min.css') }}" rel="stylesheet" type="text/css" />
        <!-- font Awesome -->
        <link href="{{ get_template('css/font-awesome.min.css') }}" rel="stylesheet" type="text/css" />
        <!-- Ionicons -->
        <link href="{{ get_template('css/ionicons.min.css') }}" rel="stylesheet" type="text/css" />
        <!-- Morris chart -->
        <link href="{{ get_template('css/morris/morris.css') }}" rel="stylesheet" type="text/css" />
        <!-- jvectormap -->
        <link href="{{ get_template('css/jvectormap/jquery-jvectormap-1.2.2.css') }}" rel="stylesheet" type="text/css" />
        <!-- fullCalendar -->
        <link href="{{ get_template('css/fullcalendar/fullcalendar.css') }}" rel="stylesheet" type="text/css" />
        <!-- Daterange picker -->
        <link href="{{ get_template('css/daterangepicker/daterangepicker-bs3.css') }}" rel="stylesheet" type="text/css" />
        <!-- bootstrap wysihtml5 - text editor -->
        <link href="{{ get_template('css/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css') }}" rel="stylesheet" type="text/css" />
        <!-- Sweet Alert 2 -->
        <link href="{{ get_template('css/sweetalert2/sweetalert2.min.css') }}" rel="stylesheet" type="text/css" />
        <!-- Select 2 -->
        <link href="{{ get_template('css/select2/select2.min.css') }}" rel="stylesheet" type="text/css" />
        <link href="{{ get_template('css/select2/select2-bootstrap.min.css') }}" rel="stylesheet" type="text/css" />
        <!-- Datatables -->
        <link href="{{ get_template('css/datatables/dataTables.bootstrap.css') }}" rel="stylesheet" type="text/css" />
        <!-- int number -->
        <link rel="stylesheet" href="{{ get_template('css/intlnum/css/intlTelInput.css') }}">
        <!-- token input -->
        <link rel="stylesheet" href="{{ get_template('css/tokeninput/token-input.css') }}">
        <link rel="stylesheet" href="{{ get_template('css/tokeninput/token-input-facebook.css') }}">
        <!-- Theme style -->
        <link href="{{ get_template('css/AdminLTE.css') }}" rel="stylesheet" type="text/css" />
        <!-- custom style -->
        <link href="{{ get_template('css/custom.css') }}" rel="stylesheet" type="text/css" />
        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
          <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
        <![endif]-->       
        @yield('page-css')
    </head>
    <body class="skin-{{ config('template.skin') }} fixed" data-url="{{ url('/') }}" 
        data-datepicker-format="{{ auth('employer')->user()->client->date_picker['date_picker'] }}"
        data-datepicker-date="{{ date(auth('employer')->user()->client->date_picker['php']) }}"
        data-datepicker-mask="{{ auth('employer')->user()->client->date_picker['mask'] }}">
        <!-- header logo: style can be found in header.less -->
        <header class="header">
            <a href="{{ url(config('modules.employer').'/'.session('root_dir').'/dashboard') }}" class="logo">
                <!-- Add the class icon to your logo image or logo icon to add the margining -->
                MYRA DH - Employer
            </a>
            <!-- Header Navbar: style can be found in header.less -->
            <nav class="navbar navbar-static-top" role="navigation">
                <!-- Sidebar toggle button-->
                <a href="#" class="navbar-btn sidebar-toggle" data-toggle="offcanvas" role="button">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </a>
                <div class="navbar-right">
                    <ul class="nav navbar-nav">
                        <!-- User Account: style can be found in dropdown.less -->
                        <li class="dropdown user user-menu">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <i class="glyphicon glyphicon-user"></i>
                                <span>{{ auth('employer')->user()->name }} <i class="caret"></i></span>
                            </a>
                            <ul class="dropdown-menu">
                                <!-- User image -->
                                <li class="user-header bg-light-blue" style="height:100px;">
                                    <p>
                                        {{ auth('employer')->user()->name }}
                                        <small>{{ auth('employer')->user()->email }}</small>
                                        <small><b>Version:</b> {{ config('app.version') }}</small>
                                    </p>
                                </li>                                
                                <!-- Menu Footer-->
                                <li class="user-footer">
                                    <div class="pull-left">
                                        <a href="#" class="btn btn-default btn-flat">Profile</a>
                                    </div>
                                    <div class="pull-right">
                                        <a href="{{ url(config('modules.employer').'/'.session('root_dir').'/auth/logout') }}" class="btn btn-default btn-flat">Sign out</a>
                                    </div>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </nav>
        </header>
        <div class="wrapper row-offcanvas row-offcanvas-left">
            <!-- Left side column. contains the logo and sidebar -->
            <aside class="left-side sidebar-offcanvas">
                <!-- sidebar: style can be found in sidebar.less -->
                <section class="sidebar">
                    <form action="#" method="get" class="sidebar-form">
                        <div class="input-group">
                            <input type="text" name="q" class="form-control" placeholder="Search...">
                            <span class="input-group-btn">
                                <button type="submit" name="seach" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i></button>
                            </span>
                        </div>
                    </form>                                     
                    <!-- sidebar menu: : style can be found in sidebar.less -->
                    
                </section>
                <!-- /.sidebar -->
            </aside>
            <!-- Right side column. Contains the navbar and content of the page -->
            <aside class="right-side">
                @yield('page-body')                
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->
        <!-- jQuery 2.0.2 -->
        <script src="{{ get_template('js/jquery.min.js') }}"></script>
        <!-- jQuery UI 1.11.2 -->
        <script src="{{ get_template('js/plugins/jquery-ui-1.11.2/jquery-ui.min.js') }}" type="text/javascript"></script>
        <!-- Bootstrap -->
        <script src="{{ get_template('js/bootstrap.min.js') }}" type="text/javascript"></script>
        <!-- Morris.js charts -->
        <script src="{{ get_template('js/plugins/morris/morris.min.js') }}" type="text/javascript"></script>
        <!-- Sparkline -->
        <script src="{{ get_template('js/plugins/sparkline/jquery.sparkline.min.js') }}" type="text/javascript"></script>
        <!-- jvectormap -->
        <script src="{{ get_template('js/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js') }}" type="text/javascript"></script>
        <script src="{{ get_template('js/plugins/jvectormap/jquery-jvectormap-world-mill-en.js') }}" type="text/javascript"></script>
        <!-- fullCalendar -->
        <script src="{{ get_template('js/plugins/fullcalendar/fullcalendar.min.js') }}" type="text/javascript"></script>
        <!-- jQuery Knob Chart -->
        <script src="{{ get_template('js/plugins/jqueryKnob/jquery.knob.js') }}" type="text/javascript"></script>
        <!-- daterangepicker -->
        <script src="{{ get_template('js/plugins/daterangepicker/daterangepicker.js') }}" type="text/javascript"></script>
        <!-- Bootstrap WYSIHTML5 -->
        <script src="{{ get_template('js/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js') }}" type="text/javascript"></script>
        <!-- Sweet Alert 2 -->
        <script src="{{ get_template('js/plugins/sweetalert2/sweetalert2.min.js') }}" type="text/javascript"></script>
        <!-- Select 2 -->
        <script src="{{ get_template('js/plugins/select2/select2.full.js') }}" type="text/javascript"></script>
        <!-- Datatables -->        
        <script src="{{ get_template('js/plugins/datatables/jquery.dataTables.js') }}" type="text/javascript"></script>
        <script src="{{ get_template('js/plugins/datatables/dataTables.bootstrap.js') }}" type="text/javascript"></script>
        <!-- iCheck -->
        <script src="{{ get_template('js/plugins/iCheck/icheck.min.js') }}" type="text/javascript"></script>
        <!-- notifyjs -->
        <script src="{{ get_template('js/plugins/notifyjs/notify.min.js') }}" type="text/javascript"></script>
        <!-- token input -->
        <script type="text/javascript" src="{{ get_template('js/plugins/tokeninput/jquery.tokeninput.js') }}"></script>
        <!-- input mask -->
        <script type="text/javascript" src="{{ get_template('js/plugins/input-mask/jquery.inputmask.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('js/plugins/input-mask/jquery.inputmask.date.extensions.js') }}"></script>
        <script type="text/javascript" src="{{ get_template('js/plugins/input-mask/jquery.inputmask.extensions.js') }}"></script>
        <!-- AdminLTE App -->
        <script src="{{ get_template('js/AdminLTE/app.js') }}" type="text/javascript"></script>       
        <script type="text/javascript">
        $.ajaxSetup({
            headers: { 
                'X-CSRF-Token' : $('meta[name=csrf-token]').attr('content'),
            }
        });
        $(function () {
          $('[data-toggle="tooltip"]').tooltip();
        });
        </script>
        <script type="text/javascript" src="{{ get_template('js/helpers.js') }}"></script>
        @yield('page-js')
    </body>
</html>Modules/Employer/routes.php000066400000002024152434100730012001 0ustar00<?php
Route::group(['prefix'=>'{root_dir}'], function() {
	Route::group(['namespace'=>'Auth', 'prefix' => 'auth'], function() {
		Route::group(['middleware' => 'auth.employer'], function(){
	        Route::get('/logout', array('as' => 'employer.logout', 'uses' => 'AuthController@logout'));
	    });
	    Route::group(['prefix'=>'login'], function(){
	        Route::get('/',  array('as' => 'employer.get-login', 'uses' => 'AuthController@getLogin'));
	        Route::post('/', array('as' => 'employer.post-login', 'uses' => 'AuthController@postLogin'));
	    });
	});
	
    Route::group(['middleware' => 'auth.employer'], function() {
	    Route::get('/', function(){
	        return redirect()->route('employer.dashboard', session('root_dir'));
	    });
	    Route::group(['namespace'=>'Dashboard'], function(){
            Route::group(['prefix'=>'dashboard'], function(){
                Route::get('/', array('as' => 'employer.dashboard', 'uses' => 'DashboardController@dashboard'));                
            });
        });
	});
});
?>Modules/Employer/Controllers/Auth/AuthController.php000066400000007423152434100730016644 0ustar00<?php

namespace QxCMS\Modules\Employer\Controllers\Auth;

use QxCMS\Modules\Client\Models\Principals\Principal as User;
use QxCMS\Modules\Likod\Models\Clients\Client;
use Validator;
use JsValidator;
use Auth;
use Artisan;
use Illuminate\Http\Request;
use QxCMS\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

class AuthController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Registration & Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users, as well as the
    | authentication of existing users. By default, this controller uses
    | a simple trait to add these behaviors. Why don't you explore it?
    |
    */

    use AuthenticatesUsers;

    /**
     * Where to redirect users after login / registration.
     *
     * @var string
     */    
    protected $redirectTo = '';
    protected $guard = 'employer';
    protected $redirectAfterLogout = '';
    /**
     * Create a new authentication controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest.employer', ['except' => 'logout']);
    }

    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => 'required|max:255',
            'email' => 'required|email|max:255|unique:users',
            'password' => 'required|confirmed|min:6',
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return User
     */
    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
        ]);
    }

    public function getLogin()
    {
        $rules = array(
            'email' => 'required|email',
            'password' => 'required',
        );
        $validator = JsValidator::make($rules, array(), array(), '#login-form');
        return view('Employer::auth.login', ['validator'=> $validator]);
    }    

    public function postLogin(Request $request)
    {
        return $this->login($request);
    }
    
    protected function authenticated(Request $request, $user)
    {
        if($user->status == 'Active')
        {
            $this->redirectTo = 'employer/'.session('root_dir').'/dashboard';
            return redirect($this->redirectTo);
        } else {            
            $this->redirectAfterLogout = 'employer/'.session('root_dir').'/auth/login';
            $this->guard()->logout();
            $request->session()->forget('root_dir');
            $request->session()->regenerate();
            session()->flash('error_logout', 'You account is inactive.');
            return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
        }        
    }

    public function guard() 
    {
        return Auth::guard('employer');
    }

    public function logout(Request $request)
    {
        $this->redirectAfterLogout = 'employer/'.session('root_dir').'/auth/login';
        $this->guard()->logout();
        $request->session()->forget('root_dir');
        $request->session()->regenerate();
        if($request->get('logout') == 'true') session()->flash('logout', 'You have successfully logged out!');
        else session()->flash('error_logout', 'Your session has timed out.');
        return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
    }
}Modules/Employer/Controllers/Dashboard/DashboardController.php000066400000000502152434100730020607 0ustar00<?php

namespace QxCMS\Modules\Employer\Controllers\Dashboard;

use Illuminate\Http\Request;

use QxCMS\Http\Requests;
use QxCMS\Http\Controllers\Controller;
use Auth;

class DashboardController extends Controller
{    
    public function dashboard()
    {    	
    	return view('Employer::dashboard.dashboard');
    }
}
User.php000066400000001010152434100730006164 0ustar00<?php

namespace QxCMS;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{   
    use Notifiable;
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];
}
Requests/ApplyQuickFormRequest.php000066400000001227152434100730013352 0ustar00<?php

namespace QxCMS\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ApplyQuickFormRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'position' => 'required',
            'fname' => 'required',
            'mname' => 'required',
            'lname' => 'required',
            'birthdate' => 'required',
        ];
    }
}
Requests/ApplyNowFormRequest.php000066400000001231152434100730013034 0ustar00<?php

namespace QxCMS\Http\Requests;


use Illuminate\Foundation\Http\FormRequest;


class ApplyNowFormRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'position' => 'required',
            'fname' => 'required',
            'mname' => 'required',
            'lname' => 'required', 
            'birthdate' => 'required',
        ];
    }

}
Exceptions/Handler.php000064400000004411152434100730010752 0ustar00<?php

namespace QxCMS\Exceptions;

use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
    /**
     * A list of the exception types that should not be reported.
     *
     * @var array
     */
    protected $dontReport = [
        \Illuminate\Auth\AuthenticationException::class,
        \Illuminate\Auth\Access\AuthorizationException::class,
        \Symfony\Component\HttpKernel\Exception\HttpException::class,
        \Illuminate\Database\Eloquent\ModelNotFoundException::class,
        \Illuminate\Session\TokenMismatchException::class,
        \Illuminate\Validation\ValidationException::class,
    ];

    /**
     * Report or log an exception.
     *
     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
     *
     * @param  \Exception  $exception
     * @return void
     */
    public function report(Throwable $exception)
    {
        parent::report($exception);
    }

    /**
     * Render an exception into an HTTP response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Exception  $exception
     * @return \Illuminate\Http\Response
     */
    public function render($request, Throwable $exception)
    {
        if ($exception instanceof AuthorizationException) {
            return response()->view('Client::permission.notActivated');
        }
        if ($exception instanceof HttpException) {
            return response()->view('errors.404');
        }
        if ($exception instanceof ModelNotFoundException) {
            return response()->view('errors.404');
        }
        return parent::render($request, $exception);
    }

    /**
     * Convert an authentication exception into an unauthenticated response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Illuminate\Auth\AuthenticationException  $exception
     * @return \Illuminate\Http\Response
     */
    protected function unauthenticated($request, AuthenticationException $exception)
    {
        if ($request->expectsJson()) {
            return response()->json(['error' => 'Unauthenticated.'], 401);
        }

        return redirect()->guest('login');
    }
}
.gitignore000066400000000027152434177630006551 0ustar00*
!public/
!.gitignore
public/.gitignore000066400000000016152434177630010025 0ustar00*
!.gitignore