PKruZ뚩 .gitignorenu[* !.gitignore PKruZOG,,d808cde2134717c771c54fd03c82b4a1d19b63ce.phpnu[startSection('title', __('Not Found')); ?> startSection('code', '404'); ?> startSection('message', __('Not Found')); ?> make('errors::minimal', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>PKruZk,603a20a667e2785f8deac48d80de26bf90d95254.phpnu[startSection('title', __('Page Expired')); ?> startSection('code', '419'); ?> startSection('message', __('Page Expired')); ?> make('errors::minimal', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>PKruZ04 4 ,92efd36a762ce7e45b26c2b6b3d3236f3a0d38fd.phpnu[startSection('content'); ?>
ticketing

Autohub Rating

stopSection(); ?> startSection('javascript'); ?> stopSection(); ?> make('layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>PKruZH~ ,c13bec97b65b6d361bd7665606c170b24132c384.phpnu[ <?php echo e(env('APP_NAME')); ?> yieldContent('css'); ?> guard()->check()): ?> make('navbar.sidenav', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
yieldContent('content'); ?>
yieldContent('javascript'); ?> PKruZnB,a33eaead97f78dcdd1d4aca16c84751703733d9f.phpnu[ <?php echo $__env->yieldContent('title'); ?>
yieldContent('code'); ?>
yieldContent('message'); ?>
PKruZ ,44,fedf7513966a3d1c911c62552b541d74065b6f34.phpnu[ <?php echo e(env('APP_NAME')); ?>
PKRZ=message/message.blade.phpnu[@extends('layouts.layout2') @section('content')
{!! $message !!}
@endsection @section('javascript') @endsectionPKRZ9 8 8message/error.blade.phpnu[ {{env('APP_NAME')}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}}
{{-- @include('navbar.navbar') --}}
{!! $message !!}
PKRZϭDKKwelcome.blade.phpnu[ Laravel
@if (Route::has('login')) @endif
Laravel has wonderful, thorough documentation covering every aspect of the framework. Whether you are new to the framework or have previous experience with Laravel, we recommend reading all of the documentation from beginning to end.
Laracasts offers thousands of video tutorials on Laravel, PHP, and JavaScript development. Check them out, see for yourself, and massively level up your development skills in the process.
Laravel News is a community driven portal and newsletter aggregating all of the latest and most important news in the Laravel ecosystem, including new package releases and tutorials.
Vibrant Ecosystem
Laravel's robust library of first-party tools and libraries, such as Forge, Vapor, Nova, and Envoyer help you take your projects to the next level. Pair them with powerful open source libraries like Cashier, Dusk, Echo, Horizon, Sanctum, Telescope, and more.
Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})
PKRZ{!!users/login.blade.phpnu[@extends('layouts.master') @section('css') @endsection @section('content')
{{--
--}}

{{$disclaimer->content}}

{{--
--}}
Please provide some information before proceeding
{{--
--}}
@endsection @section('javascript') @endsectionPKRZ^&oEoEusers/verify.blade.phpnu[ {{env('APP_NAME')}}

YOU ARE EVALUATING {{$system_title[0]->system_name}}


{!! str_replace("\n", "
", $instruction) !!}

PKRZa mail/response.blade.phpnu[ {{--

--}}

Thank You for filling in {{$info['template']}} Survey


Rater: {{$info['user']}}
Email: {{$info['email']}}
@php $ratings = []; @endphp @foreach ($qs as $item) @php $ratings[] = $item[1]; @endphp @endforeach
Questions Rating
{{ $item[0] }} {{ $item[1] }}
Average:

{{number_format(collect($ratings)->avg(), 1)}}

Comment

{{$comment}}

PKRZمBBmail/reset-password.blade.phpnu[

Click this link to reset your password

{{$link}}
PKRZ[7auth/email_responses.blade.phpnu[
Status
PKRZo77auth/profile.blade.phpnu[@extends('layouts.layout') @section('css') @endsection @section('content')
Edit Profile
{{--
System Setup
--}} {{--
Response Email Management
@include('auth.email_responses')
--}}
@endsection @section('javascript') @endsectionPKRZ`33auth/forget.blade.phpnu[ {{env('APP_NAME')}}
PKRZkkauth/registration.blade.phpnu[@extends('layouts.master') @section('css') @endsection @section('content')

Register

{{--
--}}
@endsection @section('javascript') {{-- --}} @endsectionPKRZ66auth/reset-password.blade.phpnu[ {{env('APP_NAME')}}
{{-- @include('navbar.navbar') --}}
PKRZ auth/index.blade.phpnu[@extends('layouts.master') @section('content')
{{--
--}}
ticketing

Autohub Rating

{{--
--}}
{{-- --}} {{--
--}}
@endsection @section('javascript') @endsectionPKRZ'KDDauth/import.blade.phpnu[ PKRZj-wlayouts/master.blade.phpnu[ {{env('APP_NAME')}} {{-- javascript --}} {{-- css --}} @yield('css') @auth() @include('navbar.sidenav') @endauth
@yield('content')
@yield('javascript') PKRZ[=[=layouts/layout.blade.phpnu[ {{env('APP_NAME')}} @yield('css')
@if(Auth::user() && Auth::user()->type == "admin") @include('navbar.navbar') @endif
@if(Auth::user() && Auth::user()->type == "admin") @endif @if(Auth::user() && Auth::user()->type == "admin") @yield('content') @endif {{-- --}}
@if(Auth::user() && Auth::user()->type == "admin") @yield('javascript') @endif {{--
All rights reserved
--}} PKRZlayouts/footer.blade.phpnu[
PKRZjj layouts/reports/counts.blade.phpnu[ Autohub Rating {{--
--}}
autohub

Blk. 15, Ford Global Building., 32nd St., Cor. Rizal Drive, Crescent Park West, BGC, Taguig City
{{\Carbon\Carbon::now()->format('M. d, Y')}}


@foreach($data as $row)
System Name: {{ $system_name }}
Template Name: {{ $template_name }}
Total Respondents: {{$row->total}}
Scale: (Average = 5 : 'Excellent', Average = 4 : 'Very Satisfactory', Average = 3 : 'Satisfactory', Average = 2 : 'Dissatisfactory', Average = 1 : 'Very Dissatisfactory')
@if(!empty($row->total)) list, function($a, $b) { return $b['rating'] - $a['rating']; // sort by average value in descending order }); for($i = 0; $i < $row->total; $i++) { $average = $row->list[$i]['rating']; $category = ''; // initialize variable for category if ($average == 5) { $category = 'Excellent'; } elseif ($average == 4) { $category = 'Very Satisfactory'; } elseif ($average == 3) { $category = 'Satisfactory'; } elseif ($average == 2) { $category = 'Dissatisfied'; } elseif ($average == 1) { $category = 'Very Dissatisfied'; } if(!isset($grouped_data[$category])) { $grouped_data[$category] = []; } $grouped_data[$category][] = $row->list[$i]; $totals[$average - 1]++; // increment count for category } ?> @if(count($grouped_data) > 0) @foreach ($grouped_data as $category => $group)
{{$category}}: {{ $totals[array_search($category, ['Very Dissatisfied', 'Dissatisfied', 'Satisfactory', 'Very Satisfactory', 'Excellent'])] }}
@foreach ($table_headers as $header) @endforeach @foreach($group as $item) @foreach($table_body as $data) @endforeach @endforeach
{{ $header }}
{{$loop->iteration}}{{ $item[$data] }}
@endforeach @else

No data to show.

@endif @else

No data to show.

@endif @endforeach
{{-- --}} PKRZSe@@@#layouts/reports/questions.blade.phpnu[ Autohub Rating {{--
--}}

Blk. 15, Ford Global Building., 32nd St., Cor. Rizal Drive, Crescent Park West, BGC, Taguig City
{{\Carbon\Carbon::now()->format('M. d, Y')}}


@foreach($data as $row)
Total Questions: {{$row->total}}
@if(!empty($row->total)) @foreach ($table_headers as $header) @endforeach @for($i = 0; $i < $row->total; $i++) @foreach($table_body as $data) @endforeach @endfor
{{ $header }}
{{$i+1}}{{$row->list[$i]->$data}}
@else

No data to show.

@endif @endforeach
{{-- --}} PKRZt.layouts/reports/average_per_question.blade.phpnu[ Autohub Rating
autohub

Blk. 15, Ford Global Building., 32nd St., Cor. Rizal Drive, Crescent Park West, BGC, Taguig City
{{\Carbon\Carbon::now()->format('M. d, Y')}}


@foreach($data as $row) @if(!empty($row->total))
Company Name: {{$company}}
System Name: {{$system_name}}
Template Name: {{$template_name}}
Total: {{$row->total}}

{{-- @for($i = 0; $i < $row->total; $i++) @foreach($row->list[$i]['ratings'] as $rating) @endforeach @endfor
No. Questions
{{$loop->iteration}} {{$rating['questions']}}
--}} {{-- @foreach ($table_headers as $header) @endforeach @php $startIndex = 0; // Start index at 1 @endphp @for($i = 1; $i < $row->total; $i++) @foreach($table_body as $data) @endforeach @endfor
{{ $header }}
{{$startIndex+$i}}{{$row->list[$i][$data]}}
--}} @foreach ($table_headers as $header) @endforeach @php $startIndex = 1; // Start index at 1 @endphp @foreach ($table_body as $row) {{-- @foreach ($row as $cell) @endforeach --}} @endforeach
{{ $header }}
{{ $startIndex++ }} {{$row[0]}} {{$row[1]}} {{$row[2]}} {{$row[3]}}{{ $cell }}
@else

No data to show.

@endif @endforeach {{--

the second page

--}}
{{-- --}} PKRZ!t^^'layouts/reports/questionnaire.blade.phpnu[ Autohub Rating {{--
--}}

Blk. 15, Ford Global Building., 32nd St., Cor. Rizal Drive, Crescent Park West, BGC, Taguig City
{{\Carbon\Carbon::now()->format('M. d, Y')}}


@foreach($data as $row)
@if(!($date_from) || !($date_to)) Date Filter: None
@else Date Filter: {{$date_from}} - {{$date_to}}
@endif Total Survey Form: {{$row->total}}
@if(!empty($row->total)) @foreach ($table_headers as $header) @endforeach @for($i = 0; $i < $row->total; $i++) @foreach($table_body as $data) @endforeach @endfor
{{ $header }}
{{$i+1}}{{$row->list[$i]->$data}}
@else

No data to show.

@endif @endforeach
{{-- --}} PKRZ)layouts/reports/comment_summary.blade.phpnu[ Autohub Rating {{--
--}}

Blk. 15, Ford Global Building., 32nd St., Cor. Rizal Drive, Crescent Park West, BGC, Taguig City
{{\Carbon\Carbon::now()->format('M. d, Y')}}


@foreach($data as $row)
System Name: {{ $system_name }}
Template Name: {{ $template_name }}
Total Response: {{$row->total}}
@if(!empty($row->total)) @foreach ($table_headers as $header) @endforeach @for($i = 0; $i < $row->total; $i++) @foreach($table_body as $data) {{-- --}} @endforeach @endfor
{{ $header }}
{{$i+1}}{{dd($row->list[$i])}}{{$row->list[$i][$data] }}
@else

No data to show.

@endif @endforeach {{--

the second page

--}}
{{-- --}} PKRZ×-layouts/reports/templates_questions.blade.phpnu[ Autohub Rating Prepared By: {{Auth::user()->f_name . " " . Auth::user()->l_name}}

Blk. 15, Ford Global Building., 32nd St., Cor. Rizal Drive, Crescent Park West, BGC, Taguig City
{{\Carbon\Carbon::now()->format('M. d, Y')}}


{{-- @foreach($data as $row)
Total Questions Template: {{$row->total}}
@if(!empty($row->total)) @foreach ($table_headers as $header) @endforeach @for($i = 0; $i < $row->total; $i++) @foreach($table_body as $data) @endforeach @endfor
{{ $header }}
{{$i+1}}{{$row->list[$i]->$data}}
@else

No data to show.

@endif @endforeach --}} @foreach($data as $row)
{{-- Total Templates: {{$row->total}} --}} Template: {{$template_title}}
@if(!empty($row->total)) @foreach ($table_headers as $header) @endforeach @php $count = 1; @endphp @foreach($row->list as $template) @foreach ($template->questions as $item) {{-- --}} @endforeach @endforeach
{{ $header }}
{{$count++}} {{--
    @foreach($template->questions as $question) --}} {{$item['title']}} {{-- @endforeach --}} {{--
--}}
{{ \Carbon\Carbon::parse($item['created_at'])->format('M. d, Y') }}{{ $item['created_at']->format('Y-m-d') }}
@else

No data to show.

@endif @endforeach
{{-- --}} PKRZdvv!layouts/reports/reviews.blade.phpnu[ Autohub Rating
autohub

Blk. 15, Ford Global Building., 32nd St., Cor. Rizal Drive, Crescent Park West, BGC, Taguig City
{{\Carbon\Carbon::now()->format('M. d, Y')}}


@foreach($data as $row) @if(!empty($row->total))
Company Name: {{$company}}
System Name: {{$system_name}}
Template Name: {{$template_name}}
Total Respondents: {{$row->total}}

{{-- @for($i = 0; $i < $row->total; $i++) @foreach($row->list[$i]['ratings'] as $rating) @endforeach @endfor
No. Questions
{{$loop->iteration}} {{$rating['questions']}}
--}} @foreach ($table_headers as $header) @endforeach @for($i = 0; $i < $row->total; $i++) @foreach($table_body as $data) @endforeach @endfor
{{ $header }}
{{$i+1}}{{$row->list[$i][$data]}} @php $ratings = collect($row->list[$i]['ratings']); $avgRating = $ratings->avg('rating'); @endphp @foreach($row->list[$i]['ratings'] as $rating) @endforeach {{-- --}} @foreach($row->list[$i]['ratings'] as $rating) @endforeach
Question No: {{$rating['id']}} Average: Rating
Rating: {{$rating['rating']}}{{number_format($avgRating,1)}}
@else

No data to show.

@endif @endforeach {{--

the second page

--}}
{{-- --}} PKRZJ@JJ!layouts/reports/systems.blade.phpnu[ Autohub Rating {{--
--}}

Blk. 15, Ford Global Building., 32nd St., Cor. Rizal Drive, Crescent Park West, BGC, Taguig City
{{\Carbon\Carbon::now()->format('M. d, Y')}}


@foreach($data as $row)
Total Systems: {{$row->total}}
@if(!empty($row->total)) @foreach ($table_headers as $header) @endforeach @for($i = 0; $i < $row->total; $i++) @foreach($table_body as $data) @endforeach @endfor
{{ $header }}
{{$i+1}}{{$row->list[$i]->$data}}
@else

No data to show.

@endif @endforeach {{--

the second page

--}}
{{-- --}} PKRZW}&&,layouts/reports/questions_template.blade.phpnu[ Autohub Rating {{--
--}}

Blk. 15, Ford Global Building., 32nd St., Cor. Rizal Drive, Crescent Park West, BGC, Taguig City
{{\Carbon\Carbon::now()->format('M. d, Y')}}


@foreach($data as $row)
Total Questions Template: {{$row->total}}
@if(!empty($row->total)) @foreach ($table_headers as $header) @endforeach @for($i = 0; $i < $row->total; $i++) {{-- --}} @foreach($table_body as $data) {{-- @if($data == 'templateTitles') @else --}} {{-- @endif --}} @endforeach @endfor
{{ $header }}
{{$i+1}}{{dd($row)}}{{ implode(', ', $row->list[$i]->$data) }}{{$row->list[$i]->$data}}
@else

No data to show.

@endif @endforeach
{{-- --}} PKRZJujj#layouts/reports/templates.blade.phpnu[ Autohub Rating {{--
--}}

Blk. 15, Ford Global Building., 32nd St., Cor. Rizal Drive, Crescent Park West, BGC, Taguig City
{{\Carbon\Carbon::now()->format('M. d, Y')}}


@foreach($data as $row)
Total Templates: {{$row->total}}
@if(!empty($row->total)) @foreach ($table_headers as $header) @endforeach @for($i = 0; $i < $row->total; $i++) @foreach($table_body as $data) @endforeach @endfor
{{ $header }}
{{$i+1}}{{$row->list[$i]->$data}}
@else

No data to show.

@endif @endforeach {{--

the second page

--}}
{{-- --}} PKRZɑ'<*<*layouts/layout2.blade.phpnu[ {{env('APP_NAME')}} @yield('css')
@yield('content')
@yield('javascript') {{-- --}} PKRZerror/error.blade.phpnu[PKRZsadmin/systems/system.blade.phpnu[{{-- @extends('layouts.master') --}} @extends('layouts.layout') @section('content')
{{--
--}}
@include('admin.systems.system_create') @endsection @section('javascript') @endsectionPKRZa%admin/systems/system_create.blade.phpnu[PKRZ(/admin/user_management/email_responses.blade.phpnu[@extends('layouts.layout') @section('content')
Status
@endsection @section('javascript') @endsectionPKRZb/admin/user_management/user_management.blade.phpnu[{{-- @extends('layouts.master') --}} @extends('layouts.layout') @section('content')
{{-- @include('admin.templates.create') --}} @endsection @section('javascript') @endsectionPKRZ buu+admin/user_management/assign_role.blade.phpnu[@extends('layouts.layout') @section('content') @endsection @section('javascript') @endsectionPKRZ`.q(admin/user_management/add_role.blade.phpnu[@extends('layouts.layout') @section('content')
@endsection @section('javascript') @endsectionPKRZ )admin/user_management/edit_role.blade.phpnu[@extends('layouts.layout') @section('content') @endsection @section('javascript') @endsectionPKRZ ;()admin/user_management/edit_user.blade.phpnu[{{-- @extends('layouts.master') --}} @extends('layouts.layout') @section('content') {{-- @include('admin.templates.create') --}} @endsection @section('javascript') @endsectionPKRZ)admin/user_management/abilities.blade.phpnu[PKRZK~%admin/user_management/roles.blade.phpnu[{{-- @extends('layouts.master') --}} @extends('layouts.layout') @section('content')
{{-- @include('admin.templates.create') --}} @endsection @section('javascript') @endsectionPKRZӐ, ,admin/user_management/system_setup.blade.phpnu[{{-- @extends('layouts.master') --}} @extends('layouts.layout') @section('content')
{{-- @include('admin.templates.create') --}} @endsection @section('javascript') {{-- --}} @endsectionPKRZC)admin/questions/question_create.blade.phpnu[PKRZ&3 3 #admin/questions/questions.blade.phpnu[@extends('layouts.layout') @section('content')
{{--
--}}
@include('admin.questions.question_create') @endsection @section('javascript') @endsectionPKRZzz admin/disclaimer/index.blade.phpnu[@extends('layouts.layout') @section('content')
@csrf
@endsection @section('javascript') @endsectionPKRZT`KK#admin/questionnaires/edit.blade.phpnu[@extends('layouts.layout') @section('css') @endsection @section('content')
{{--
--}}

Template Name:

System Name:

Survey Link:

Instruction:

Question List

{{--
--}}
{{--
--}}
@endsection @section('javascript') @endsectionPKRZE^T T %admin/questionnaires/create.blade.phpnu[@extends('layouts.layout') {{-- @extends('layouts.master') --}} @section('css') @endsection @section('content')

Template Name:

{{-- --}}

System Name:

Instruction:

Questions List

@endsection @section('javascript') @endsection PKRZE)l+ + $admin/questionnaires/index.blade.phpnu[@extends('layouts.layout') @section('content')
{{--
--}}
{{-- @include('admin.systems.system_create') --}} @endsection @section('javascript') @endsectionPKRZ@~DD(admin/reports/count_per_system.blade.phpnu[

Counts Masterfile


* required
PKRZR.p p &admin/reports/qst_masterfile.blade.phpnu[

Survey Form Masterfile


PKRZݾHH*admin/reports/tmpqstn_masterfile.blade.phpnu[

Template Questions Masterfile


* required
PKRZtKRR'admin/reports/comment_summary.blade.phpnu[

Comment Summary Masterfile


* required
PKRZIR_ &admin/reports/tmp_masterfile.blade.phpnu[

Templates Masterfile


PKRZ4admin/reports/reviews.blade.phpnu[

Reviews Masterfile


* required
{{-- * required --}}
PKRZG &admin/reports/sys_masterfile.blade.phpnu[

Systems Masterfile


{{--
--}}
PKRZ{q +admin/reports/qstn_tmp_masterfile.blade.phpnu[

Templates Questions Masterfile


PKRZ:A$admin/reports/avg_per_qstn.blade.phpnu[

Average Per Question Masterfile


* required
{{-- * required --}}
PKRZ3)^` ` admin/reports/index.blade.phpnu[@extends('layouts.layout') @section('css') @endsection @section('content')
  • Survery Form
    • Masterfile
  • Questions
    • Masterfile
    • Average Per Question Masterfile
    {{--
    • Templates per Question
    --}}
  • Systems
    • Masterfile
  • Templates
    • Masterfile
    • Template Questions Masterfile
  • Reviews
    • Masterfile
    • Respondents Count per Questionnaire
    • Comment Summary Report
@endsection @section('javascript') @endsectionPKRZadmin/reports/blank.blade.phpnu[PKRZ빪 'admin/reports/qstn_masterfile.blade.phpnu[

Questions Masterfile


PKRZ[zzzadmin/templates/edit.blade.phpnu[@extends('layouts.layout') @section('css') @endsection @section('content')
{{--
--}} {{--

Template Name:

--}}

Question List

@endsection @section('javascript') @endsectionPKRZ'SMM admin/templates/create.blade.phpnu[@extends('layouts.layout') @section('css') @endsection @section('content') {{--

Question List

@foreach ($questions as $item)
@endforeach

Template Name:

--}}
{{--
--}}
{{-- --}}

Question List

@foreach ($questions as $item)
@endforeach
@endsection @section('javascript') @endsectionPKRZBHadmin/templates/index.blade.phpnu[{{-- @extends('layouts.master') --}} @extends('layouts.layout') @section('content')
{{-- @include('admin.templates.create') --}} @endsection @section('javascript') @endsectionPKRZ>XXnavbar/sidenav.blade.phpnu[PKRZ;knavbar/navbar.blade.phpnu[PKRZ$Ǹm1m1index.blade.phpnu[@extends('layouts.layout') @section('css') @endsection @section('content')

{{$questions}}

Questions

More info

{{$templates}}

Templates
{{--
--}} {{--
--}}
More info

{{$systems}}

Systems

More info

{{$qst}}

Survey Forms

More info
{{--
Select Template:
--}}

TOP 5 HIGHEST RATED SYSTEMS PER TEMPLATE

{{--
Top 5 highest rated systems per template
--}}
{{--
--}}
RESPONDENTS COUNT PER SYSTEM
{{--
Respondents Count per System
--}}
{{--
--}}

RESPONDENTS COUNTS PER COMPANY

{{--
Top 5 highest rated systems per template
--}}
{{--

DEVICES USED



{{$devices ? $devices->mobile : '0'}}



{{$devices ? $devices->pc : '0'}}



{{$devices ? $devices->tablet : '0'}}

--}} {{--
Start Date:
End Date:
--}} @endsection @section('javascript') @endsectionPK+Z`la\33 leads.phpnu[ PK+ZeKC preloader.phpnu[
logo
PK+Z u config.phpnu[ PK+ZY2  common/footer.phpnu[ PK+Zcommon/scripts/signup.jsnu[var init_signup = function() { init_toastr(); return $.ajax({ url: "resources/views/signup.php", data: {}, type: "POST", beforeSend: function() { show_hide_preloader(true); }, success: function(data) { document.title = 'Sign up'; side_menu_loaded = false; $('#header_content').html(''); $('#main_content').html(data); $("#dealer").select2({ // tags:true, // multiple: true, placeholder: "Select dealer", allowClear: true, escapeMarkup: function(markup) { return markup; }, ajax: { url: 'app/models/dealer.php', dataType: 'json', delay: 250, data: function(data) { return { model: 'dealer_list', api: true, search: data.term // search term }; }, processResults: function(response) { return { results: response }; }, cache: true } }); $("#position").select2({ // tags:true, // multiple: true, placeholder: "Select position", allowClear: true, escapeMarkup: function(markup) { return markup; }, ajax: { url: 'app/models/position.php', dataType: 'json', delay: 250, data: function(data) { return { model: 'position_list', api: true, search: data.term // search term }; }, processResults: function(response) { return { results: response }; }, cache: true } }); $('#id_no').on('keyup',function() { str = $(this).val().trim() str = str.replace(/\s/g, '') $(this).val(str) }); $('#login_account').on('click', function() { init_signin(); }); $('#btn_signup').on('click', function() { if (check_if_empty_field($('#dealer'), 'Dealer is required.')) { return; } if (check_if_empty_field($('#id_no'), 'ID number is required.')) { return; } if (check_if_empty_field($('#firstname'), 'Firstname is required.')) { return; } if (check_if_empty_field($('#lastname'), 'Lastname is required.')) { return; } if (check_if_empty_field($('#email'), 'Email address is required.')) { return; } if (!isValidEmailAddress($('#email').val().trim())) { $('#email').focus(); toastr.remove(); toastr.error('Invalid email address.'); return; } if (check_if_empty_field($('#mobile'), 'Mobile is required.')) { return; } if ($('#mobile').val().trim().length < 10) { $('#mobile').focus(); toastr.remove(); toastr.error('Invalid mobile format.'); return; } if (check_if_empty_field($('#password'), 'Password is required.')) { return; } if ($('#password').val().trim().length < 6) { $('#password').focus(); toastr.remove(); toastr.error('Password must be 6 characters and above.'); return; } var $element = $("[json-signup]"); var json_data = generate_json('json-signup', $element); return $.ajax({ url: "app/models/user.php", data: { model: 'signup', api: true, json_data: json_data }, type: "POST", dataType: 'json', beforeSend: function() { toastr.remove(); toastr.info("Signing up."); }, success: function(result) { if (parseInt(result.status) === 1) { toastr.remove(); toastr.success(result.message); init_signin(); } else { toastr.remove(); toastr.error(result.message); } }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); }); show_hide_preloader(false); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); };PK+Z=common/scripts/common.jsnu[ function defaultFunctions() { initToolTip() } function initToolTip() { $('.tooltip-me').bstooltip(); $('.tooltip-me').on('click', function() { $(this).bstooltip('hide') }) } function show_hide_preloader(show) { if (show) { $(".preloader").css("height", ""); $(".animation__wobble").css("display", ""); } else { $(".preloader").css("height", "0px"); $(".animation__wobble").css("display", "none"); } } function get_user_login_info() { return $.ajax({ url: "app/models/user.php", data: { model: 'user_login_info' }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) { // console.log(result` ) }, error: function(result) { // console.log(result) toastr.remove(); // toastr.error("Error has occurred. Try again."); toastr.error(result.responseText); init_signin(); } }); } function get_user_notification_info() { return $.ajax({ url: "app/models/user.php", data: { model: 'user_notification_info' }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) { // console.log(result) }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function delay(callback, ms) { var timer = 0; return function() { var context = this, args = arguments; clearTimeout(timer); timer = setTimeout(function() { callback.apply(context, args); }, ms || 0); }; } function get_user_notifications() {} function get_user_messages() {} function add_content_close_listener(elmnt_id) { var count = 0; $("#" + elmnt_id + " button[data-card-widget]").each(function() { if (this.getAttribute("data-card-widget") == "remove") { $(this).on('click', function() { $("#" + elmnt_id + " > .card").each(function() { if ($(this).css('display').toLowerCase() != 'none') { count++; } }); if (count == 1) { $("#" + elmnt_id).css("display", "none"); if (elmnt_id == 'center_content') { $("#right_content,#left_content").toggleClass('col-md-3') .toggleClass('col-md'); side_menu_loaded = false; } } count = 0; }); } }); } function generate_json(attribute, $element) { var /* Create an object. */ obj = {}, /* Create a variable that references the current object (default → obj). */ ref = obj; /* Iterate over every input. */ $element.each(function() { /* Cache the id of the input. */ var id = this.id; /* Check whether the nodetype attribute is set to 'parent'. */ if (this.getAttribute(attribute) == "parent") { /* Set a new object to the property and set ref to refer to it. */ ref = obj[id] = {}; } else { /* Set the value of the input to the referred object. */ if (this.getAttribute(attribute) == "true") { if (isEmpty($(this).val())) { ref[id] = ''; } else { ref[id] = $(this).val().trim(); } } } }); /* Stringify the object and return it. */ return JSON.stringify(obj); } function isValidEmailAddress(emailAddress) { var pattern = /^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ \t]+)?")@(([a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.)+([a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.?$/i; return pattern.test(emailAddress); } function isEmpty(string) { var flag = false; try { if (string.trim() == '') { flag = true; } else if (string == null) { flag = true; } else if (typeof string === 'undefined') { flag = true; } } catch (err) { console.log(err); flag = true; } return flag; } function check_if_empty_field($element, msg) { if (isEmpty($element.val())) { $element.focus(); toastr.remove(); toastr.error(msg); return true; } else { return false; } } function customSelectOption($el,id,text){ if(!isEmpty(id)){ var newOption = new Option(text, id, true, true); $el.append(newOption).trigger('change'); } } function init_function(type){ switch(type){ case 0: break; case 'lead_profile': init_leadprofile_page(); break; case 'refresh_lead_table': refreshLeadfileTable(); break; } } function upper_first_letter(data){ return data.toLowerCase() .replace(/\b[a-z]/g, function( letter) { return letter.toUpperCase(); }); } function init_destroy_session() { return $.ajax({ url: "app/models/user.php", data: { model: 'signout', api: 1 }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) {}, error: function() { // toastr.remove(); // toastr.error("Error has occurred. Try again.") } }); } function addSearchTransition($searchEl,$searchElDiv){ //groupfile member tab $searchEl.focusin(function() { $searchElDiv.removeClass( 'default-search-size'); $searchElDiv.addClass( 'expand-search-size'); }); $searchEl.focusout(function() { if (isEmpty($(this).val())) { $searchElDiv.removeClass( 'expand-search-size'); $searchElDiv.addClass( 'default-search-size'); } }); } function resetGroupOwners(){ selected_group = []; selected_group_owner = []; selected_group_owner.push({ owner_id: 0, owner_name: 'My', }); } function accessManagement(code){ if(!global_menu_access.includes(code)){ return false; } switch(parseInt(code)){ case 1 : //settings $('#nav_config').show(); $('#nav_config_divider').show(); break; case 2: //mastefile $('#master_add_company').show(); $('.masterfile_action_remove').show(); break; case 3: //user groups $('#nav_groups').show(); $('#nav_groups_divider').show(); break; } } PK+ZѣCCcommon/scripts/groupfile.jsnu[//START ROLES FILE////////////////////////////////////////////////////////////////////////// function init_groupfile_page() { init_header(); if (side_menu_loaded) { init_groupfile(); } else { $.when(init_side_content()).done(function(ajax1Results) { init_groupfile(); }); } } var init_groupfile = function() { if(!global_menu_access.includes(3)){ return false; } return $.ajax({ url: "resources/views/groupfile.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { document.title = 'My Groups'; $('#center_content').html(data); add_content_close_listener('center_content'); defaultFunctions(); if(selected_group_owner.length > 1){ $('#groupfile_back').on('click', function() { selected_group_owner.pop(); // init_masterfile_page(); init_group_member_page(); }); }else{ $('#groupfile_back').hide(); } $('#group_owner_name').text(selected_group_owner.slice(-1)[0].owner_name); addSearchTransition($('#groupfile-search'),$('#groupfile-search-div')); $('#groupfile-search').on('keyup',delay(function(e) { refreshGroupfileTableSilent(); }, 500)); // if(selected_group_owner.length > 1) { // // $('#nav_groupfile_add_groupfile').html(' '); // $('#nav_groupfile_add_groupfile').html('Group List'); // } $(document).on('click', '.groupfile-list-filter', function(e) { e.stopPropagation(); }); $('#groupfile_add_groupfile').on('click', function() { $.when(init_group_modal()/*,create_temporary_group()*/).done(function(ajax1Results/*,ajax2Results*/) { // alert(ajax2Results.id) // created_group_id = ajax2Results[0].id; // alert(created_group_id) $('#group_modal').modal('show'); $('#group_modal').on('hidden.bs.modal', function() { // remove_temporary_group(created_group_id); $('#group_modal').remove(); }); addSearchTransition($('#group-member-search'),$('#group-member-search-div')); //groupfile member tab //*update $('#group-member-search').on('keyup',delay(function(e) { refreshGroupMemberTableSilent(); }, 500)); //end groupfile tab $('#txt_group_name').focus(); $('#btn_group_save').on('click', function() { if (check_if_empty_field($('#txt_group_name'), 'Group name is required.')) { return; } var $element = $("[json-group-modal]"); var json_data = generate_json('json-group-modal', $element); update_group(0, json_data,'') // console.log(json_data); }); refreshGroupMemberTable(); }); }); refreshGroupfileTable(); $('#table_groupfile').on('click-cell.bs.table', function(field, value, row, $el) { if (value != "action" && value != "update") { var selected_group_id = $el.id; var selected_group_name = $el.name; selected_group.push({ group_id: selected_group_id, group_name: selected_group_name, }); // console.log("Groups: "); // console.log(selected_group); init_group_member_page(); } }); show_hide_preloader(false); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function init_group_modal() { return $.ajax({ url: "resources/views/modals/group_modal.php", data: {}, type: "POST", beforeSend: function() { selected_group_member = []; //remove all previous selected in group }, success: function(data) { $('#center_content').append(data); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function update_group(group_id, json_data,type ) { return $.ajax({ url: "app/models/group.php", data: { model: 'update_group', id: group_id, owner_id: selected_group_owner.slice(-1)[0].owner_id, json_data: json_data, group_members : JSON.stringify(selected_group_member), }, type: "POST", dataType: 'json', beforeSend: function() { $('#btn_group_save').prop( 'disabled', true); toastr.remove(); toastr.info("Saving group."); }, success: function(result) { if (parseInt(result.status) === 1) { if(type == 'group_member'){ var json_data_obj = JSON.parse(json_data) var group_name = json_data_obj.txt_group_name.toUpperCase() selected_group_owner.slice(-1)[0].owner_name = group_name $('#selected_group_name').text(group_name); document.title = group_name; refreshGroupMemberTableFile(); }else{ refreshGroupfileTable(); } toastr.remove(); toastr.success(result.message); // refreshGroupfileDealerfileTable(); $('#group_modal').off('hidden.bs.modal').on('hidden.bs.modal', function() {}); $('#group_modal').modal( 'hide'); $('#group_modal').remove(); } else { $('#btn_group_save').prop( 'disabled', false); toastr.remove(); toastr.error(result.message); } }, error: function() { $('#btn_group_save').prop( 'disabled', false); toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function create_temporary_group() { return $.ajax({ url: "app/models/group.php", data: { model: 'add_temporary_group' }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) { // console.log(result) return result; }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function remove_temporary_group(group_id) { return $.ajax({ url: "app/models/group.php", data: { model: 'remove_temporary_group', id: group_id }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) { }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function refreshGroupfileTable() { initGroupfileList(); var $table = $('#table_groupfile') $(function() { $table.bootstrapTable('refresh', { url: 'app/models/group.php' }); }) } function refreshGroupfileTableSilent() { var $table = $('#table_groupfile') $(function() { $table.bootstrapTable('refresh', { url: 'app/models/group.php' }); }) } function initGroupfileList() { var $table = $('#table_groupfile'); $table.bootstrapTable('destroy').bootstrapTable({ sidePagination: 'server', formatSearch: function() { return 'Search...' }, onLoadSuccess: function() { if(selected_group_owner.length > 1) { // $('.btn_groupfile_update').hide(); // $('.btn_groupfile_remove').hide(); // alert('') } }, exportOptions: { fileName: function() { return 'titile' } } }); } function groupfileQueryParams(params) { return { search: $('#groupfile-search').val(), offset: params.offset, limit: params.limit, sort: params.sort, order: params.order, added_by: selected_group_owner.slice(-1)[0].owner_id, model: 'group_table', }; } function updateGroupfileFormatter(value, row, index) { if(selected_group_owner.length > 1) { // return ''; } return ''; } function removeGroupfileFormatter(value, row, index) { if(selected_group_owner.length > 1) { // return ''; } return ''; } window.removeGroupfileEvent = { 'click i': function(e, value, row, index) { // if (parseInt(row.user_count) > 0) { // toastr.remove(); // toastr.error('Groupfile is currently active in some users.'); // return; // } if(!global_menu_access.includes(3)){ return false; } Swal.fire({ icon: 'warning', html: 'Are you sure you want to remove this group?', showDenyButton: false, showCancelButton: true, confirmButtonText: `Yes`, cancelButtonText: `No`, denyButtonText: `Don't Confirm`, showClass: { backdrop: 'swal2-noanimation', // disable backdrop animation popup: '', // disable popup animation icon: '' // disable icon animation }, hideClass: { popup: '', // disable popup fade-out animation }, customClass: 'swal-height' }).then((result) => { if (result.isConfirmed) { $.ajax({ url: "app/models/group.php", method: "POST", dataType: 'json', data: { model: 'remove_group', id: row.id }, beforeSend: function() { toastr.remove(); toastr.info('Removing...') }, success: function(result) { if (parseInt(result.status) === 1) { toastr.remove(); toastr.success(result.message); refreshGroupfileTable(); } else { toastr.remove(); toastr.error(result.message); } }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } else if (result.isDenied) {} else {} }) } }; window.updateGroupfileEvent = { 'click i': function(e, value, row, index) { updateGroupfileEventFunc(row.id,row.name,'') } }; function updateGroupfileEventFunc(group_id,group_name,type){ if(!global_menu_access.includes(3)){ return false; } $.when(init_group_modal()).done(function(ajax1Results) { created_group_id = group_id; $('#group_modal').modal('show'); $('#group_modal').on('hidden.bs.modal', function() { $('#group_modal').remove(); }); addSearchTransition($('#group-member-search'),$('#group-member-search-div')); //*update $('#group-member-search').on('keyup',delay(function(e) { refreshGroupMemberTableSilent(); }, 500)); //end groupfile tab $('#txt_group_name').focus(); $('#txt_group_name').val(group_name); $('#btn_group_save').on('click', function() { if (check_if_empty_field($('#txt_group_name'), 'Group name is required.')) { return; } var $element = $("[json-group-modal]"); var json_data = generate_json('json-group-modal', $element); update_group(created_group_id, json_data,type) // console.log(json_data); }); refreshGroupMemberTable(); }); } ////START group member function refreshGroupMemberTable() { initGroupMemberTable(); var $table = $('#table_group_member') $(function() { $table.bootstrapTable('refresh', { url: 'app/models/group.php' }); }) } function refreshGroupMemberTableSilent() { var $table = $('#table_group_member') $(function() { $table.bootstrapTable('refresh', { url: 'app/models/group.php' }); }) } function initGroupMemberTable() { var $table = $('#table_group_member'); $table.bootstrapTable('destroy').bootstrapTable({ sidePagination: 'server', formatSearch: function() { return 'Search...' }, formatNoMatches: function () { return 'User has no group not found.'; }, onLoadSuccess: function() {}, exportOptions: { fileName: function() { return 'titile' } } }); } function groupMemberQueryParams(params) { return { search: $('#group-member-search').val(), offset: params.offset, limit: params.limit, sort: params.sort, order: params.order, group_id : created_group_id, owner_id : selected_group_owner.slice(-1)[0].owner_id, model: 'group_user_table', group_members : JSON.stringify(selected_group_member), }; } function groupMemberFormatter(value, row, index) { var html = ''; if (parseInt(row.status) === 1) { html = ''; } return html; } window.groupMemberEvent = { 'click input': function(e, value, row, index) { if(selected_group_member.includes(row.id) ){ const index = selected_group_member.indexOf(row.id); if (index > -1) { selected_group_member.splice(index, 1); } }else{ selected_group_member.push(row.id) } // alert(JSON.stringify(selected_group_member)); refreshGroupMemberTableSilent(); //get selected id // $.ajax({ // url: "app/models/group.php", // method: "POST", // dataType: 'json', // data: { // model: 'group_member_status', // user_id: row.id, // group_id: created_group_id // }, // beforeSend: function() { // // toastr.remove(); // // toastr.info('Updating...') // }, // success: function(result) { // if (parseInt(result.status) === 1) { // // toastr.remove(); // // toastr.success(result.message); // refreshGroupMemberTableSilent(); // } else { // toastr.remove(); // toastr.error(result.message); // } // }, // error: function() { // toastr.remove(); // toastr.error( // "Error has occurred. Try again." // ) // } // }); } }; ////END ROLE DEALER //END ROLES FILE////////////////////////////////////////////////////////////////////////////////////PK+Z OOcommon/scripts/notification.jsnu[//START CONFIG FILE///////////////////////////////////////////////////////////////////////////////////////////////////// function init_notification_page() { init_header(); if (side_menu_loaded) { init_notification(); // console.log('asd') } else { $.when(init_side_content()).done(function(ajax1Results) { init_notification(); }); } } var init_notification = function() { return $.ajax({ url: "resources/views/notification.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { document.title = 'Notifications'; $('#center_content').html(data); add_content_close_listener('center_content'); notification_display_limit = notification_display_limit_const; $.when(user_notification()).done(function(ajax2Results) { // console.log(ajax2Results['data']) //reset notification_display_limit notification_display_limit = notification_display_limit + notification_display_limit_const; //init objects $('#notification_list_div').html(''); $('#notification_view_more').on('click', function() { $.when(user_notification()).done(function(ajax1Results2) { var result_notification2 = ajax1Results2['data']; notification_display_limit = notification_display_limit + notification_display_limit_const; notification_display(result_notification2); }); }); //ajax when area var result_notification = ajax2Results['data']; notification_display(result_notification); mark_as_read_notification(); show_hide_preloader(false); }); show_hide_preloader(false); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function refresh_notification() { $.when(get_user_notification_info()).done(function(ajax2Results) { // console.log(); var notif_count = parseInt(ajax2Results.total); if(notif_count){ $('#notif_count_badge').text(notif_count); if(notif_count > 1){ $('#notif_count').text(notif_count+ ' Notifications'); }else{ $('#notif_count').text(notif_count+ ' Notification'); } $('#notif_div_container').html('') //display notification per category $.each(ajax2Results['data'], function(i, n) { // console.log(n['type']) $('#notif_div_container').append(` `+n['count']+ ' ' +n['type']+` `+n['ago']+ ` `) }); }else{ $('#notif_count').text('0 Notification'); } $("[notification-header]").each(function() { $(this).off('click').on('click', function() { global_in_notif_section = true; selected_notification_category = $(this).attr('notification-header'); // console.log(selected_notification_category) init_notification_page(); }); }); }); } function mark_as_read_notification(){ return $.ajax({ url: "app/models/user.php", data: { model: 'mark_as_read_notification', type_id: selected_notification_category, }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) { // console.log(result) // setTimeout(function(){ refresh_notification(); global_in_notif_section = false; // }, 3000); }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function user_notification() { return $.ajax({ url: "app/models/user.php", data: { model: 'user_notification', type_id: selected_notification_category, offset: notification_display_limit - notification_display_limit_const, limit: notification_display_limit_const }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) { // console.log(result) }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function notification_display(ajaxResult) { $.each(ajaxResult, function(i, n) { var data = ajaxResult[i]; // console.log(data); var is_read = parseInt(data['is_read']) === 0? 'border-primary' : '' ; $('#notification_list_div').append(`
`+n['description']+`
`+n['date_added']+`
`); }); }PK+Z5common/scripts/scripts.phpnu[ PK+Z##common/scripts/configuration.jsnu[//START CONFIG FILE///////////////////////////////////////////////////////////////////////////////////////////////////// function init_config_page() { init_header(); if (side_menu_loaded) { init_config(); } else { $.when(init_side_content()).done(function(ajax1Results) { init_config(); }); } } var init_config = function() { if(!global_menu_access.includes(1)){ return false; } return $.ajax({ url: "resources/views/config.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { document.title = 'Configurations'; $('#center_content').html(data); add_content_close_listener('center_content'); $('#config_user_roles').on('click', function() { init_rolefile_page(); }); $('#config_sms').on('click', function() { $.when(init_sms_modal(),get_activated_sms_api()).done(function(ajax1Results,ajax2Results) { $('#sms_modal').modal('show'); $('#sms_modal').on('hidden.bs.modal', function() { $('#sms_modal').remove(); }); $('#dd_sms_api').select2({ placeholder: "Select API", allowClear: true, minimumResultsForSearch: -1, // allowClear: true, ajax: { url: 'app/models/sms.php?model=api_list', dataType: 'json' } }); $('#btn_sms_save').on('click', function() { var $element = $("[json-sms-modal]"); var json_data = generate_json('json-sms-modal', $element); return $.ajax({ url: "app/models/sms.php", data: { model: 'set_activated_api', json_data: json_data }, type: "POST", dataType: 'json', beforeSend: function() { $('#btn_sms_save').prop( 'disabled', true); toastr.remove(); toastr.info("Saving..."); }, success: function(result) { if (parseInt(result.status) === 1) { toastr.remove(); toastr.success(result.message); $('#sms_modal').modal( 'hide'); $('#sms_modal').remove(); } else { $('#btn_sms_save').prop( 'disabled', false); toastr.remove(); toastr.error(result.message); } }, error: function() { $('#btn_sms_save').prop( 'disabled', false); toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); }); var api_information = ajax2Results[0]; // console.log(api_information); // set sms api customSelectOption($("#dd_sms_api"), api_information['id'], api_information['name']); }); }); $('#config_system').on('click', function() { $.when(init_system_settings_modal(),get_system_settings()).done(function(ajax1Results,ajax2Results) { $('#system_settings_modal').modal('show'); $('#system_settings_modal').on('hidden.bs.modal', function() { $('#system_settings_modal').remove(); }); var result_system_settings = ajax2Results[0]; $.each(result_system_settings, function(i, n) { $("#" + i).text(n); $("#" + i).val(n); $("#" + i).trigger('change') }); $('#btn_system_settings_save').on('click', function() { var $element = $("[json-system-settings-modal]"); var json_data = generate_json('json-system-settings-modal', $element); return $.ajax({ url: "app/models/system_settings.php", data: { model: 'update', json_data: json_data }, type: "POST", dataType: 'json', beforeSend: function() { $('#btn_sms_save').prop( 'disabled', true); toastr.remove(); toastr.info("Saving..."); }, success: function(result) { if (parseInt(result.status) === 1) { toastr.remove(); toastr.success(result.message); $('#system_settings_modal').modal( 'hide'); $('#system_settings_modal').remove(); } else { $('#btn_sms_save').prop( 'disabled', false); toastr.remove(); toastr.error(result.message); } }, error: function() { $('#btn_sms_save').prop( 'disabled', false); toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); }); }); }); show_hide_preloader(false); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function init_sms_modal() { return $.ajax({ url: "resources/views/modals/sms_modal.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { $('#center_content').append(data); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function init_system_settings_modal() { return $.ajax({ url: "resources/views/modals/system_settings_modal.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { $('#center_content').append(data); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function get_system_settings(){ return $.ajax({ url: "app/models/system_settings.php", data: { model: 'get_system_settings' }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) {}, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function get_activated_sms_api() { return $.ajax({ url: "app/models/sms.php", data: { model: 'activated_api' }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) {}, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } //END CONFIG FILE/////////////////////////////////////////////////////////////////////////////////////////////////////PK+Zzcommon/scripts/group_member.jsnu[//START ROLES FILE////////////////////////////////////////////////////////////////////////// function init_group_member_page() { init_header(); if (side_menu_loaded) { init_group_member(); } else { $.when(init_side_content()).done(function(ajax1Results) { init_group_member(); }); } } var init_group_member = function() { if(!global_menu_access.includes(3)){ return false; } return $.ajax({ url: "resources/views/group_member.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { var selected__group = selected_group.slice(-1)[0]; document.title = selected__group.group_name; $('#center_content').html(data); add_content_close_listener('center_content'); defaultFunctions(); $('#selected_group_name').text(selected__group.group_name); $('#group_member_back').on('click', function() { //remove last element in var selected_group selected_group.pop(); init_groupfile_page(); }); // if(selected_group.length > 1) { // $('#nav_group_member_add_group_member').html('Member List'); // } addSearchTransition($('#group-member-file-search'),$('#group-member-file-search-div')); //*update $('#group-member-file-search').on('keyup',delay(function(e) { refreshGroupMemberTableFileSilent(); }, 500)); $(document).on('click', '.groupfile-list-filter', function(e) { e.stopPropagation(); }); $('#group_member_add_group_member').on('click', function() { updateGroupfileEventFunc(selected__group.group_id,selected__group.group_name,'group_member'); }); refreshGroupMemberTableFile(); $('#table_group_member_file').on('click-cell.bs.table', function(field, value, row, $el) { // console.log($el);return; // var selected_group_id = $el.id; var selected_group_owner_id = $el.id; var selected_group_owner_name = $el.name; // var selected_group_name = $el.name; if (value == "groups" ) { selected_group_owner.push({ owner_id: selected_group_owner_id, owner_name: selected_group_owner_name, }); init_groupfile_page(); }else if (value == "leads" ) { selected_group_owner.push({ owner_id: selected_group_owner_id, owner_name: selected_group_owner_name, }); init_leadfile_page(); } }); show_hide_preloader(false); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function refreshGroupMemberTableFile() { initGroupMemberList(); var $table = $('#table_group_member_file') $(function() { $table.bootstrapTable('refresh', { url: 'app/models/group.php' }); }) } function refreshGroupMemberTableFileSilent() { var $table = $('#table_group_member_file'); $(function() { $table.bootstrapTable('refresh', { url: 'app/models/group.php' }); }) } function initGroupMemberList() { var $table = $('#table_group_member_file'); $table.bootstrapTable('destroy').bootstrapTable({ sidePagination: 'server', formatSearch: function() { return 'Search...' }, onLoadSuccess: function() { if(selected_group.length > 1) { // $('.btn_group_member_file_remove').hide(); // alert('231') } }, exportOptions: { fileName: function() { return 'titile' } } }); } function groupMemberFileQueryParams(params) { return { search: $('#group-member-file-search').val(), offset: params.offset, limit: params.limit, sort: params.sort, order: params.order, group_id : selected_group.slice(-1)[0].group_id, model: 'group_member_table', }; } function removeGroupMemberFormatter(value, row, index) { // if(selected_group.length > 1) { // return ''; // } return ''; } function memberGroupsFormatter(value, row, index) { return 'Groups'; } function memberLeadsFormatter(value, row, index) { return 'Leads'; } window.removeGroupMemberEvent = { 'click i': function(e, value, row, index) { if(!global_menu_access.includes(3)){ return false; } Swal.fire({ icon: 'warning', html: 'Are you sure you want to remove this member?', showDenyButton: false, showCancelButton: true, confirmButtonText: `Yes`, cancelButtonText: `No`, denyButtonText: `Don't Confirm`, showClass: { backdrop: 'swal2-noanimation', // disable backdrop animation popup: '', // disable popup animation icon: '' // disable icon animation }, hideClass: { popup: '', // disable popup fade-out animation }, customClass: 'swal-height' }).then((result) => { if (result.isConfirmed) { $.ajax({ url: "app/models/group.php", method: "POST", dataType: 'json', data: { model: 'group_member_status', user_id: row.id, group_id : selected_group.slice(-1)[0].group_id }, beforeSend: function() { toastr.remove(); toastr.info('Removing...') }, success: function(result) { if (parseInt(result.status) === 1) { toastr.remove(); toastr.success(result.message); refreshGroupMemberTableFileSilent(); } else { toastr.remove(); toastr.error(result.message); } }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } else if (result.isDenied) {} else {} }) } }; PK+ZƍDqDqcommon/scripts/lead_list.jsnu[//START LEADS FILE////////////////////////////////////////////////////////////////////////// function init_leadfile_page() { init_header(); if (side_menu_loaded) { init_leadfile(); } else { $.when(init_side_content()).done(function(ajax1Results) { init_leadfile(); }); } } var init_leadfile = function() { return $.ajax({ url: "resources/views/leads.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { document.title = 'Leads'; $('#center_content').html(data); add_content_close_listener('center_content'); defaultFunctions(); $('#lead_back').on('click', function() { if(selected_group_owner.length > 1){ selected_group_owner.pop(); init_group_member_page(); }else{ init_masterfile_page(); } }); if(selected_group_owner.length > 1) { $('#leads_owner_name').text( selected_group_owner.slice(-1)[0].owner_name+' Leads'); }else{ $('#leads_owner_name').text('Leads Summary'); } $('#lead-search').focusin(function() { $('#lead-search-div').removeClass('default-search-size'); $('#lead-search-div').addClass('expand-search-size'); }); $('#lead-search').focusout(function() { if (isEmpty($(this).val())) { $('#lead-search-div').removeClass('expand-search-size'); $('#lead-search-div').addClass('default-search-size'); } }); $('#lead-search').on('keyup',delay(function(e) { refreshLeadfileTableSilent(); }, 500)); $(document).on('click', '.lead-list-filter', function(e) { e.stopPropagation(); }); $(".lead-list-filter li").each(function() { $(this).on('click', function() { $(this).toggleClass("active"); var active_items = $('.lead-list-filter').find('li.active').map( function() { var item = {}; // item.id = this.value; item.status = $(this).text(); return item; }); var active_items_arr = []; $.each(active_items, function(i, n) { active_items_arr.push(n.status) }); if (active_items_arr.length > 1) { $("#selected_filter").text('Multiple Filter'); } else if (active_items_arr.length == 1) { $("#selected_filter").text($('.lead-list-filter').find( 'li.active').text()); } else { $("#selected_filter").text(''); } lead_selected_filters = JSON.stringify(active_items_arr); refreshLeadfileTable(); }); }); $('#lead_add_lead').on('click', function() { display_lead_modal('refresh_lead_table','add'); }); refreshLeadfileTable(); $('#table_leadfile').on('click-cell.bs.table', function(field, value, row, $el) { selected_lead = $el.id; selected_lead_inquiry = $el.inquiry_id; if (value != "action") { init_leadprofile_page(); } }); show_hide_preloader(false); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function init_lead_modal() { return $.ajax({ url: "resources/views/modals/lead_modal.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { $('#center_content').append(data); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function leadActionFormatter(value, row, index) { return `
`; } function leadNameFormatter(value, row, index) { // return value; var inactive_label = (parseInt(row.inactive_lead) === 0) ? `` : ` Inactive`; return ``+value+inactive_label+``; } function refreshLeadfileTable() { initLeadfileList(); var $table = $('#table_leadfile') $(function() { $table.bootstrapTable('refresh', { url: 'app/models/lead.php' }); }) } function refreshLeadfileTableSilent() { var $table = $('#table_leadfile') $(function() { $table.bootstrapTable('refresh', { url: 'app/models/lead.php' }); }) } function initLeadfileList() { var $table = $('#table_leadfile'); $table.bootstrapTable('destroy').bootstrapTable({ sidePagination: 'server', formatSearch: function() { return 'Search...' }, onLoadSuccess: function() {}, exportOptions: { fileName: function() { return 'titile' } } }); } function leadfileQueryParams(params) { return { model: 'lead_table', search: $('#lead-search').val(), offset: params.offset, limit: params.limit, sort: params.sort, order: params.order, filters: lead_selected_filters, company: selected_company, owner_id: selected_group_owner.slice(-1)[0].owner_id }; } function display_lead_modal(init__function,type){ $.when(init_lead_modal(),get_user_dealers()).done(function(ajax1Results,user_dealers_result) { $('#lead_modal').modal('show'); $('#lead_modal').on('hidden.bs.modal', function() { $('#lead_modal').remove(); }); defaultFunctions(); $("[lead-alert]").each(function() { $(this).on('change', function() { if (this.checked) { $(this).val("1"); } else { $(this).val("0"); } }); }); $('#type_person').on('click',function() { if ($('#type_person').is(':checked')) { $('.company-field').hide(); $('.person-field').show(); $('#type_person').val('1'); $('#type_company').val('0'); } }); $('#type_company').on('click',function() { if ($('#type_company').is(':checked')) { $('.person-field').hide(); $('.company-field').show(); $('#type_person').val('0'); $('#type_company').val('1'); } }); $('#dd_lead_gender').select2({ placeholder: "Select gender", allowClear: true, minimumResultsForSearch: -1, // allowClear: true, ajax: { url: 'app/models/general.php?model=gender_list', dataType: 'json' } }); $("#dd_lead_brand").select2({ // tags:true, placeholder: "Select brand", allowClear: true, escapeMarkup: function(markup) { return markup; }, ajax: { url: 'app/models/brand.php', dataType: 'json', delay: 250, data: function(data) { return { model: 'brand_list', search: data.term // search term }; }, processResults: function(response) { return { results: response }; }, cache: true } }); // $('#dd_lead_brand').on('select2:select', function(e) { $('#dd_lead_brand').on('change', function(e) { var brand_name = $('#dd_lead_brand').val(); $("#dd_lead_model").val(''); $("#dd_lead_model").select2('destroy').select2({ // tags:true, placeholder: "Select model", allowClear: true, escapeMarkup: function(markup) { return markup; }, ajax: { url: 'app/models/model.php', dataType: 'json', delay: 250, data: function(data) { return { model: 'model_list', brand_name: brand_name, search: data .term // search term }; }, processResults: function(response) { return { results: response }; }, cache: true } }); }); $('#dd_lead_model').select2({ placeholder: "Select brand first", minimumResultsForSearch: -1 }); $("#dd_lead_color").select2({ tags: true, placeholder: "Select color", allowClear: true, escapeMarkup: function(markup) { return markup; }, ajax: { url: 'app/models/color.php', dataType: 'json', delay: 250, data: function(data) { return { model: 'color_list', search: data.term // search term }; }, processResults: function(response) { return { results: response }; }, cache: true } }); //display this if multiple dealer // console.log(JSON.parse(user_dealers_result)) $("#dd_lead_dealer").select2({ // tags:true, // multiple: true, placeholder: "Select dealer", allowClear: true, escapeMarkup: function(markup) { return markup; }, ajax: { url: 'app/models/dealer.php', dataType: 'json', delay: 250, data: function(data) { return { model: 'dealer_list_by_ids', // company_id: selected_company, // api: true, search: data.term // search term }; }, processResults: function(response) { return { results: response }; }, cache: true } }); if(user_dealers_result[0].length > 1){ $("#dd_lead_dealer_div").show(); } $('#role-search').on('keyup',delay(function(e) { refreshRolefileTableSilent(); }, 500)); // Advanced 1 var xhr = null; $('#txt_lead_company').autoComplete({ resolver: 'custom', noResultsText: '', events: { search: function(qry, callback) { // let's do a custom ajax call if (xhr != null) { //kill the request xhr.abort() } xhr = $.ajax( 'app/models/lead.php', { data: { 'search': qry, 'model': 'lead_company_list' } } ).done(function(res) { results = JSON.parse(res) callback(results.data) }); } } }); $('#txt_lead_company').on('autocomplete.select', function(evt, item) { $("#txt_lead_company_id").val(item.id); }); $("#txt_lead_company").on("keyup change", function(e) { $("#txt_lead_company_id").val(''); }) // $('#txt_lead_fname').focus(); $('#txt_lead_fname').trigger('focus'); $('#btn_lead_save').on('click', function() { if ($('#type_company').is(':checked')) { if (check_if_empty_field($('#txt_lead_company'), 'Company name is required.')) { return; } if (isEmpty($('#txt_lead_mobile').val() .trim()) && isEmpty($('#txt_lead_landline').val() .trim()) ) { $('#txt_lead_mobile').focus(); toastr.remove(); toastr.error('Mobile or Landline is required.'); return; } if (!isEmpty($('#txt_lead_mobile').val() .trim())) { if ($('#txt_lead_mobile').val() .trim().length < 10 || !$( '#txt_lead_mobile').val() .trim().startsWith('9')) { $('#txt_lead_mobile').focus(); toastr.remove(); toastr.error('Invalid mobile.'); return; } } if (!isEmpty($('#txt_lead_landline').val() .trim())) { if ($('#txt_lead_landline').val() .trim().length < 4) { $('#txt_lead_landline').focus(); toastr.remove(); toastr.error('Invalid landline.'); return; } } } if ($('#type_person').is(':checked')) { if (check_if_empty_field($('#txt_lead_fname'), 'Firstname is required.')) { return; } if (check_if_empty_field($('#txt_lead_lname'), 'Lastname is required.')) { return; } if (check_if_empty_field($('#dd_lead_gender'), 'Gender required.')) { return; } if (check_if_empty_field($('#txt_lead_mobile'), 'Mobile is required.')) { return; } if (!isEmpty($('#txt_lead_mobile').val() .trim())) { if ($('#txt_lead_mobile').val() .trim().length < 10 || !$( '#txt_lead_mobile').val() .trim().startsWith('9')) { $('#txt_lead_mobile').focus(); toastr.remove(); toastr.error('Invalid mobile.'); return; } } if (!isEmpty($('#txt_lead_landline').val() .trim())) { if ($('#txt_lead_landline').val() .trim().length < 4) { $('#txt_lead_landline').focus(); toastr.remove(); toastr.error('Invalid landline.'); return; } } } if (check_if_empty_field($('#txt_lead_email'), 'Email is required.')) { return; } if (!isValidEmailAddress($('#txt_lead_email').val() .trim())) { $('#txt_lead_email').focus(); toastr.remove(); toastr.error('Invalid email address.'); return; } if (check_if_empty_field($('#dd_lead_brand'), 'Select brand.')) { return; } if (check_if_empty_field($('#dd_lead_model'), 'Select model.')) { return; } var $element = $("[json-lead-modal]"); var json_data = generate_json('json-lead-modal', $element); // console.log(json_data); // return; return $.ajax({ url: "app/models/lead.php", data: { model: type, json_data: json_data, lead_id: selected_lead, inquire_id: selected_lead_inquiry, owner_id: selected_group_owner.slice(-1)[0].owner_id }, type: "POST", dataType: 'json', beforeSend: function() { $('#btn_lead_save').prop( 'disabled', true); toastr.remove(); toastr.info("Saving lead."); }, success: function(result) { if (parseInt(result.status) === 1) { toastr.remove(); toastr.success(result.message); // refreshLeadfileTable(); init_function(init__function) $('#lead_modal').modal( 'hide'); $('#lead_modal').remove(); } else { $('#btn_lead_save').prop( 'disabled', false); toastr.remove(); toastr.error(result.message); } }, error: function() { $('#btn_lead_save').prop( 'disabled', false); toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); }); if(type == 'update'){ //get data $.when(lead_read_profile_form()).done(function(lead_information) { // console.log(lead_information); $.each(lead_information, function(i, n) { $("#" + i).text(n); $("#" + i).val(n); $("#" + i).trigger('change') }); //set customer type $('#type_category').hide(); if(parseInt(lead_information['lead_type']) === 1){ $('.company-field').hide(); $('.person-field').show(); $('#type_person').val('1'); $('#type_company').val('0'); $('#type_person').attr('checked',true); }else if(parseInt(lead_information['lead_type']) === 2){ $('.person-field').hide(); $('.company-field').show(); $('#type_person').val('0'); $('#type_company').val('1'); $('#type_company').attr('checked',true); } // set dealer customSelectOption($("#dd_lead_dealer"), lead_information['dealer_id'], lead_information['dealer_code']); // set brand customSelectOption($("#dd_lead_brand"), lead_information['brand_name'], lead_information['brand_name']); // set model customSelectOption($("#dd_lead_model"), lead_information['model_name'], lead_information['model_name']); // set color customSelectOption($("#dd_lead_color"), lead_information['color_name'], lead_information['color_name']); // set gender customSelectOption($("#dd_lead_gender"), lead_information['gender_id'], lead_information['gender']); //set alert var json_alert_id = JSON.parse(lead_information['json_alert_id']); $.each(json_alert_id, function(i, n) { $.each(n, function(j, m) { if(parseInt(m) === 1){ $("#" + j).attr('checked',true); } $("#" + j).text(m); $("#" + j).val(m); $("#" + j).trigger('change') }); }); }); } }); } function lead_read_profile_form(){ return $.ajax({ url: "app/models/lead.php", data: { model: 'lead_read_profile_form', // lead_id: selected_lead, inquire_id: selected_lead_inquiry }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) {}, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function get_user_dealers(){ return $.ajax({ url: "app/models/user.php", data: { model: 'get_user_dealers' }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) {}, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } //END LEADS FILE////////////////////////////////////////////////////////////////////////////////////PK+ZdlS<S<common/scripts/lead_profile.jsnu[ //START LEADS PROFILE FILE//////////////////////////////////////////////////////////////////////////////////// function init_leadprofile_page() { init_header(); if (side_menu_loaded) { init_leadprofile(); } else { $.when(init_side_content()).done(function(ajax1Results) { init_leadprofile(); }); } } var init_leadprofile = function() { return $.ajax({ url: "resources/views/lead_profile.php", data: {}, type: "POST", beforeSend: function() { show_hide_preloader(true); }, success: function(data) { document.title = 'Lead Information'; $('#center_content').html(data); add_content_close_listener('center_content'); defaultFunctions(); // $('#lead_activities_div').html(''); lead_activities_display_limit = lead_activities_display_limit_const; $('#lead_profile_back').on('click', function() { init_leadfile_page(); }); $.when(lead_profile(), lead_activities()).done(function(ajax1Results, ajax2Results) { //reset lead_activities_display_limit lead_activities_display_limit = lead_activities_display_limit + lead_activities_display_limit_const; //init objects $('#lead_activities_div').html(''); $('#lead_activity_view_more').on('click', function() { $.when(lead_activities()).done(function(ajax1Results2) { var result_lead_activities2 = ajax1Results2['data']; lead_activities_display_limit = lead_activities_display_limit + lead_activities_display_limit_const; lead_activities_display(result_lead_activities2); }); }); //ajax when area var result_lead_activities = ajax2Results[0]['data']; var result_lead_profile = ajax1Results[0]; //put profiule data to UI $.each(result_lead_profile, function(i, n) { if (i.startsWith('profile_href_')) { $("#" + i).attr("href", n); } else { $("#" + i).text(n); $("#" + i).val(n); $("#" + i).trigger('change') } }); // alert(result_lead_profile['inactive_lead']) //set if active or inactive if(parseInt(result_lead_profile['inactive_lead']) === 1){ $("#profile_inactive_label").show(); } //set progress bar for (var i = 1; i <= parseInt(result_lead_profile[ 'profile_progress_type_level']); i++) { $("#lead_progress_" + i).toggleClass('text-secondary').toggleClass( 'text-primary'); } //display latest activities $.each(result_lead_activities, function(i, n) { var data = result_lead_activities[i]; $('#latest_activity_type').text(data['type'] + ':'); $('#latest_activity_owner').text(data['owner']); $('#latest_activity_description').html(data['description']); return false; }); //set html classes & attributes progress_type_class_obj = (JSON.parse(result_lead_profile.html_class)); var progress_type_class_final = progress_type_class_obj.text.join(' '); $('#profile_progress_type').addClass(progress_type_class_final); //display all lead activities lead_activities_display(result_lead_activities); // action buttons //LEAD ADD PROGRESS $('#lead_profile_add_progress').on('click', function() { display_progress_modal('lead_profile','') }); // LEAD ADD NOTE $('#lead_profile_add_notes').on('click', function() { display_note_modal('lead_profile','') }); // LEAD ADD CALL $('#lead_profile_add_call').on('click', function() { display_call_modal('lead_profile','') }); // TAG INACTIVE LEAD $('#lead_profile_action_inactive').on('click', function() { display_inactive_modal('lead_profile','') }); $('#lead_profile_view').on('click', function() { display_lead_modal('lead_profile','update'); }); $('#lead_profile_send_sms').on('click', function() { display_sms_lead_modal('lead_profile','') }); $('#lead_profile_send_email').on('click', function() { display_mail_lead_modal('lead_profile','') }); show_hide_preloader(false); }); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function lead_profile() { return $.ajax({ url: "app/models/lead.php", data: { model: 'lead_profile_v2', lead_id: selected_lead }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) {}, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function lead_activities() { console.log("offset: " + (lead_activities_display_limit - lead_activities_display_limit_const)) console.log("limit: " + (lead_activities_display_limit_const)) return $.ajax({ url: "app/models/lead.php", data: { model: 'lead_activities', inquire_id: selected_lead_inquiry, offset: lead_activities_display_limit - lead_activities_display_limit_const, limit: lead_activities_display_limit_const }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) { // console.log(result) }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function lead_activities_display(ajaxResult) { $.each(ajaxResult, function(i, n) { var data = ajaxResult[i]; // console.log(data); var activity_action = ''; if(data['activity_type'] == 'progress' && data['description'] == 'NEW LEAD'){ activity_action = ''; }else{ activity_action = `View    Remove `; } $('#lead_activities_div').append(`
` + data['type_letter'] + `
` + data['type'] + `: ` + data['owner'] + `
` + data['description'] + `
`); }); } function view_lead_activity(id,type){ switch(type){ case 'inactive': display_inactive_modal('lead_profile',id); break; case 'email': display_mail_lead_modal('lead_profile',id); break; case 'sms': display_sms_lead_modal('lead_profile',id); break; case 'call': display_call_modal('lead_profile',id); break; case 'note': display_note_modal('lead_profile',id) break; case 'progress': display_progress_modal('lead_profile',id) break; } } function remove_lead_activity(id,type){ Swal.fire({ icon: 'warning', html: 'Are you sure you want to remove this activity?', showDenyButton: false, showCancelButton: true, confirmButtonText: `Yes`, cancelButtonText: `No`, denyButtonText: `Don't Confirm`, showClass: { backdrop: 'swal2-noanimation', // disable backdrop animation popup: '', // disable popup animation icon: '' // disable icon animation }, hideClass: { popup: '', // disable popup fade-out animation }, customClass: 'swal-height' }).then((result) => { if (result.isConfirmed) { $.ajax({ url: "app/models/lead.php", method: "POST", dataType: 'json', data: { model: 'remove_activity', type : type, activity_id: id, inquire_id: selected_lead_inquiry }, beforeSend: function() { toastr.remove(); toastr.info('Removing...') }, success: function(result) { if (parseInt(result.status) === 1) { toastr.remove(); toastr.success(result.message); init_function('lead_profile'); } else { toastr.remove(); toastr.error(result.message); } } }); } else if (result.isDenied) {} else {} }) // switch(type){ // case 'inactive': // display_inactive_modal('lead_profile',id); // break; // case 'email': // display_mail_lead_modal('lead_profile',id); // break; // case 'sms': // display_sms_lead_modal('lead_profile',id); // break; // case 'call': // display_call_modal('lead_profile',id); // break; // case 'note': // display_note_modal('lead_profile',id) // break; // case 'progress': // display_progress_modal('lead_profile',id) // break; // } } function init_note_modal() { return $.ajax({ url: "resources/views/modals/note_modal.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { $('#center_content').append(data); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function init_call_modal() { return $.ajax({ url: "resources/views/modals/call_modal.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { $('#center_content').append(data); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function init_inactive_modal() { return $.ajax({ url: "resources/views/modals/inactive_modal.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { $('#center_content').append(data); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function init_progress_modal() { return $.ajax({ url: "resources/views/modals/progress_modal.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { $('#center_content').append(data); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function display_progress_modal(type,activity_id) { $.when(init_progress_modal(),progress_list_json(),get_progress_data(activity_id)).done(function(init_progress_modal_result,progress_list_json_result,progress_data_result) { $('#progress_modal').modal('show'); $('#progress_modal').on('hidden.bs.modal', function() { $('#progress_modal').remove(); }); $('#progress_type_div').html(''); $('#btn_lead_progress_save').on('click', function() { var selected_progress_type = $( 'input[name=lead_update_progress]:checked' ).val(); var lead_progress_description = $( '#txt_lead_progress_description') .val(); if (isEmpty(selected_progress_type) || parseInt(selected_progress_type) === 1 /*prevent selecting default status*/ ) { toastr.remove(); toastr.error( 'Please select a progress type'); return false; } $.when(add_lead_progress(selected_progress_type,lead_progress_description,activity_id)).done(function(ajax1Results4) { init_function(type); }); }); // $.when(progress_list_json()).done(function( // ajax1Results3) { var results = JSON.parse(progress_list_json_result[0]); $.each(results, function(i, n) { var title_class = isEmpty(n[0][ 'type_class' ]) ? '{"badge":["badge-primary"],"text":["text-primary"]}' : n[0][ 'type_class' ]; title_class_obj = (JSON.parse( title_class)); var title_class_final = title_class_obj.badge.join( ' '); $('#progress_type_div').append(`
` + i + `
`); $.each(results[i], function(j, m) { // alert(results[i][j]['id']+' ' +results[i][j]['name']); $('#progress_type_' + i).append(`
`); }); }); //disable newly added lead status or default status $('#progress_type_1').prop( 'disabled', true); // }); if(!isEmpty(activity_id)){ var progress_data = progress_data_result[0][0]; $.each(progress_data, function(i, n) { // alert(i+ ' ' +n) if(i == 'progress_type'){ // alert('#progress_type_'+n) $('#progress_type_'+n).prop('checked', true); }else{ $("#" + i).text(n); $("#" + i).val(n); $("#" + i).trigger('change') } }); } }); } function get_progress_data(activity_id){ if(isEmpty(activity_id)){ return false; } return $.ajax({ url: "app/models/lead.php", data: { model: 'get_progress_data', activity_id: activity_id }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) { // console.log(result) }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function add_lead_progress(selected_progress_type, lead_progress_description,activity_id) { var activity_type = isEmpty(activity_id) ? 'add_lead_progress' : 'update_lead_progress' ; return $.ajax({ url: "app/models/lead.php", data: { model: activity_type, progress_type: selected_progress_type, description: lead_progress_description, inquire_id: selected_lead_inquiry, activity_id:activity_id }, type: "POST", dataType: 'json', beforeSend: function() { $('#btn_lead_progress_save').prop( 'disabled', true); toastr.remove(); toastr.info("Saving..."); }, success: function(result) { if (parseInt(result.status) === 1) { toastr.remove(); toastr.success(result .message); $('#progress_modal').modal( 'hide'); $('#progress_modal') .remove(); } else { $('#btn_lead_progress_save').prop( 'disabled', false); toastr.remove(); toastr.error(result .message); } }, error: function() { $('#btn_lead_progress_save').prop( 'disabled', false); toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function display_note_modal(type,activity_id){ $.when(init_note_modal(),get_note_data(activity_id)).done(function(ajax1Results4,note_data_result) { $('#note_modal').modal('show'); $('#note_modal').on('hidden.bs.modal', function() { $('#note_modal').remove(); }); $('#txt_reminder_time_div').datetimepicker({ format: 'LT' }) $('#txt_reminder_date_div').datetimepicker({ format: 'MM/DD/YYYY', minDate:moment() }); $("[lead-note-copy]").each(function() { $(this).on('change', function() { if (this.checked) { $(this).val("1"); } else { $(this).val("0"); } }); }); $('#btn_lead_note_save').on('click', function() { if (check_if_empty_field($( '#txt_lead_note_description'), 'Note is required.')) { return false; } if (!isEmpty($('#txt_reminder_date').val() .trim()) && isEmpty($( '#txt_reminder_time').val() .trim())) { $('#txt_reminder_time').focus(); toastr.remove(); toastr.error('Please enter time.') return false; } if (isEmpty($('#txt_reminder_date').val() .trim()) && !isEmpty($( '#txt_reminder_time').val() .trim())) { $('#txt_reminder_date').focus(); toastr.remove(); toastr.error('Please enter date.') return false; } var $element = $("[json-lead-note-modal]"); var json_data = generate_json( 'json-lead-note-modal', $element); // alert(json_data); $.when(add_lead_note(json_data,activity_id)).done(function(ajax1Results5) { init_function(type); }); }); // if(!isEmpty(activity_id)){ $("[lead-note-copy]").each(function() { $(this).prop('disabled',true); }); var note_data = note_data_result[0][0]; $.each(note_data, function(i, n) { $("#" + i).text(n); $("#" + i).val(n); $("#" + i).trigger('change') }); var selected_copy = JSON.parse(note_data.note_copy_json); $.each(selected_copy, function(i, n) { $.each(n, function(j, m) { if(parseInt(m) === 1){ $('#'+j).prop('checked', true); $('#'+j).val('1'); } }); }); } }); } function get_note_data(activity_id){ if(isEmpty(activity_id)){ return false; } return $.ajax({ url: "app/models/lead.php", data: { model: 'get_note_data', activity_id: activity_id }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) { // console.log(result) }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function add_lead_note(json_data,activity_id){ var activity_type = isEmpty(activity_id) ? 'add_lead_note' : 'update_lead_note' ; return $.ajax({ url: "app/models/lead.php", data: { model: activity_type, json_data: json_data, inquire_id: selected_lead_inquiry, activity_id : activity_id }, type: "POST", dataType: 'json', beforeSend: function() { $('#btn_lead_note_save') .prop( 'disabled', true ); toastr.remove(); toastr.info( "Adding..."); }, success: function(result) { if (parseInt(result .status) === 1) { toastr.remove(); toastr.success( result .message); // init_leadprofile_page(); $('#note_modal') .modal( 'hide'); $('#note_modal') .remove(); } else { $('#btn_lead_note_save') .prop( 'disabled', false); toastr.remove(); toastr.error(result .message); } }, error: function() { $('#btn_lead_note_save') .prop( 'disabled', false); toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function display_call_modal(type,activity_id){ $.when(init_call_modal(),lead_profile(),get_call_data(activity_id)).done(function(ajax1Results1,ajax1Results2,call_data_result) { $('#call_modal').modal('show'); $('#call_modal').on('hidden.bs.modal', function() { $('#call_modal').remove(); }); // alert(ajaxResults3) var result_lead_profile = ajax1Results2[0]; //store lead contactss const lead_contacts = { mobile: result_lead_profile['profile_mobile'], viber: result_lead_profile['profile_viber'], landline: result_lead_profile['profile_landline'], email: result_lead_profile['profile_email'], }; $('#txt_follow_up_time_div').datetimepicker({ format: 'LT' }) $('#txt_follow_up_date_div').datetimepicker({ format: 'MM/DD/YYYY', minDate:moment() }); $.each(lead_contacts, function(i, n) { if (!isEmpty(n) && i != 'email') { var call_via_type = upper_first_letter(i); $('#lead_call_via_div').append(`
`); } }); $("[lead-call-via]").each(function() { $(this).on('change', function() { if (this.checked) { $(this).val("1"); } else { $(this).val("0"); } }); }); $('#btn_lead_call_save').on('click', function() { if (check_if_empty_field($( '#txt_lead_call_description'), 'Description is required.')) { return false; } if (!isEmpty($('#txt_follow_up_date').val() .trim()) && isEmpty($( '#txt_follow_up_time').val() .trim())) { $('#txt_follow_up_time').focus(); toastr.remove(); toastr.error('Please enter time.') return false; } if (isEmpty($('#txt_follow_up_date').val() .trim()) && !isEmpty($( '#txt_follow_up_time').val() .trim())) { $('#txt_follow_up_date').focus(); toastr.remove(); toastr.error('Please enter date.') return false; } var $element = $("[json-lead-call-modal]"); var json_data = generate_json( 'json-lead-call-modal', $element); // alert(json_data); $.when(add_lead_call(json_data,activity_id)).done(function(ajax1Results6) { init_function(type); }); }); if(!isEmpty(activity_id)){ var call_data = call_data_result[0][0]; $.each(call_data, function(i, n) { $("#" + i).text(n); $("#" + i).val(n); $("#" + i).trigger('change') }); var selected_via_call = JSON.parse(call_data.call_via_json); $.each(selected_via_call, function(i, n) { $.each(n, function(j, m) { if(parseInt(m) === 1){ $('#'+j).prop('checked', true); $('#'+j).val('1'); } }); }); } }); } function get_call_data(activity_id){ if(isEmpty(activity_id)){ return false; } return $.ajax({ url: "app/models/lead.php", data: { model: 'get_call_data', activity_id: activity_id }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) { // console.log(result) }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function add_lead_call(json_data,activity_id){ var activity_type = isEmpty(activity_id) ? 'add_lead_call' : 'update_lead_call' ; return $.ajax({ url: "app/models/lead.php", data: { model: activity_type, json_data: json_data, inquire_id: selected_lead_inquiry, activity_id:activity_id }, type: "POST", dataType: 'json', beforeSend: function() { $('#btn_lead_call_save') .prop( 'disabled', true ); toastr.remove(); toastr.info( "Saving..."); }, success: function(result) { if (parseInt(result .status) === 1) { toastr.remove(); toastr.success( result .message); // init_leadprofile_page(); $('#call_modal') .modal( 'hide'); $('#call_modal') .remove(); } else { $('#btn_lead_call_save') .prop( 'disabled', false); toastr.remove(); toastr.error(result .message); } }, error: function() { $('#btn_lead_call_save') .prop( 'disabled', false); toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function formatState (state) { // console.log(state);return false; if (!state.id) { return state.text; } var $state = $( ' ' + state.text + ''+ ' ' + ' ' + state.type + '' ); return $state; } function display_mail_lead_modal(type,activity_id){ $.when(init_mail_lead_modal(),get_mail_data(activity_id)).done(function(ajax1Results1,ajax2Results) { $('#mail_lead_modal').on('shown.bs.modal', function() { }) $('#mail_lead_modal').on('hidden.bs.modal', function() { $('#mail_lead_modal').remove(); }); $('#mail_lead_modal').modal('show'); init_mail_template_list(); $('#txt_lead_mail_lead_description').summernote({ placeholder: 'Compose a message', tabsize: 2, height: 200, dialogsInBody: true, tooltip: false, toolbar: [ // [groupName, [list of button]] ['style', ['bold', 'italic', 'underline', 'clear']], ['font', ['strikethrough', 'superscript', 'subscript']], ['fontsize', ['fontsize']], ['color', ['color']], ['para', ['ul', 'ol', 'paragraph']], ['height', ['height']], ['insert', ['picture', 'video','link']], ['view', ['fullscreen']] ] }); $('#btn_lead_mail_lead_save').on('click', function() { //alert conformation if (check_if_empty_field($( '#txt_lead_mail_lead_subject' ), 'Subject is required.')) { return false; } if ( $('#txt_lead_mail_lead_description').summernote('code') == '


' || $('#txt_lead_mail_lead_description').summernote('code') == '') { $('#txt_lead_mail_lead_description').summernote('focus'); toastr.remove(); toastr.error('Message is required.') return false; } if ($('#txt_lead_mail_lead_description').val().trim().length <= 5) { $('#txt_lead_mail_lead_description').trigger('focus') toastr.remove(); toastr.error('Your message is too short.') return false; } var $element = $( "[json-mail-lead-modal]"); var json_data = generate_json( 'json-mail-lead-modal', $element); $.when(add_lead_mail(json_data,activity_id)).done(function(ajax1Results5) { init_function(type); }); }); $("[lead-mail-parameter]").each(function() { $(this).on('click', function() { set_mail_message($(this).text()); }); }); $('#remove_mail_lead_save_template').on('click', function() { Swal.fire({ icon: 'warning', html: 'Are you sure you want to remove this template?', showDenyButton: false, showCancelButton: true, confirmButtonText: `Yes`, cancelButtonText: `No`, denyButtonText: `Don't Confirm`, showClass: { backdrop: 'swal2-noanimation', // disable backdrop animation popup: '', // disable popup animation icon: '' // disable icon animation }, hideClass: { popup: '', // disable popup fade-out animation }, customClass: 'swal-height' }).then((result) => { if (result.isConfirmed) { var mail_template_id = $('#dd_mail_lead_template').val(); $.ajax({ url: "app/models/lead.php", data: { model: 'remove_mail_template', mail_template_id : mail_template_id }, type: "POST", dataType: 'json', beforeSend: function() { toastr.remove(); toastr.info( "Removing..."); }, success: function(result) { if (parseInt(result .status) === 1) { toastr.remove(); toastr.success( result .message); // $('#dd_mail_lead_template').select2('destroy'); // $('#dd_mail_lead_template').off('change'); // init_mail_template_list(); $('#dd_mail_lead_template').val('').trigger('change'); } else { toastr.remove(); toastr.error(result .message); } }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } else if (result.isDenied) {} else {} }) }); $("[lead-mail-chk]").each(function() { $(this).on('change', function() { if (this.checked) { $(this).val("1"); } else { $(this).val("0"); } }); }); $('#mail_lead_save_template').on('change', function() { if (this.checked) { Swal.fire({ text: "Template name", input: 'text', showCancelButton: true, preConfirm: (value) => { if (!value) { Swal.showValidationMessage( 'Template name is required' ) }else{ $(this).val(value); } } }).then(function(result){ if(result.value){ }else if(result.isDismissed){ $('#mail_lead_save_template').prop('checked', false); } }); } else { $(this).val(""); } }); $('#clear_mail_lead_description').on('click', function() { $('#txt_lead_mail_lead_description').summernote('reset'); $('#txt_lead_mail_lead_description').summernote('focus'); $('#dd_mail_lead_template').val('').trigger('change'); }); //get activity description if any // return false; if(!isEmpty(activity_id)){ var mail_data = ajax2Results[0][0] //hide elements $('#txt_lead_mail_lead_description').summernote('destroy'); $('#txt_lead_mail_lead_subject').attr('readonly', true); $('#txt_lead_mail_lead_subject').css('background-color', 'white'); $('#mail-template-section').hide(); $('#mail-parameter-section').hide(); $('#mail-save-template-section').hide(); $('#mail-bcc-section').hide(); $('#mail-clear-section').hide(); $('#btn_lead_mail_lead_save').off('click'); $('#btn_lead_mail_lead_save').hide(); $('#btn_lead_mail_lead_cancel').html('Close'); $('#txt_lead_mail_lead_description').summernote({ placeholder: 'Compose a message', tabsize: 2, height: 350, dialogsInBody: true, tooltip: false, toolbar: [] }); $('#txt_lead_mail_lead_description').summernote('disable'); $('.note-editor.note-airframe .note-editing-area .note-editable[contenteditable=false], .note-editor.note-frame .note-editing-area .note-editable[contenteditable=false]').css('background-color', 'white'); $.each(mail_data, function(i, n) { if(i == 'txt_lead_mail_lead_description'){ $('#txt_lead_mail_lead_description').summernote('code', n); }else{ $("#" + i).text(n); $("#" + i).val(n); $("#" + i).trigger('change') } }); } }); } function get_mail_data(activity_id){ if(isEmpty(activity_id)){ return false; } return $.ajax({ url: "app/models/lead.php", data: { model: 'get_mail_data', activity_id: activity_id }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) { // console.log(result) }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function set_mail_message(text){ $('#txt_lead_mail_lead_description').summernote('saveRange'); // // Editor loses selected range (e.g after blur) $('#txt_lead_mail_lead_description').summernote('restoreRange'); $('#txt_lead_mail_lead_description').summernote('focus'); $('#txt_lead_mail_lead_description').summernote('insertText', text); } function init_mail_template_list(){ $('#dd_mail_lead_template').select2({ placeholder: "Select Template", allowClear: true, minimumResultsForSearch: -1, templateResult: formatState, // allowClear: true, ajax: { url: 'app/models/lead.php?model=my_mail_template_list', dataType: 'json' } }); $('#dd_mail_lead_template').on('change', function(e) { var mail_template_id = $('#dd_mail_lead_template').val(); if(isEmpty(mail_template_id)){ $('#remove_mail_lead_save_template').hide(); return false; }else{ $('#remove_mail_lead_save_template').show(); } $.ajax({ url: "app/models/lead.php", data: { model: 'get_mail_template', mail_template_id : mail_template_id }, type: "POST", dataType: 'json', beforeSend: function() { toastr.remove(); toastr.info( "Fetching..."); }, success: function(result) { if (parseInt(result .status) === 1) { toastr.remove(); toastr.success( result .message); // set text to field $('#txt_lead_mail_lead_subject').val(result.subject); // set_mail_message(result.content) $('#txt_lead_mail_lead_description').summernote('code', result.content); } else { toastr.remove(); toastr.error(result .message); } }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); }); } function init_mail_lead_modal() { return $.ajax({ url: "resources/views/modals/mail_lead_modal.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { $('#center_content').append(data); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function add_lead_mail(json_data){ return $.ajax({ url: "app/models/lead.php", data: { model: 'add_lead_mail', json_data: json_data, inquire_id: selected_lead_inquiry }, type: "POST", dataType: 'json', beforeSend: function() { $('#btn_lead_mail_lead_save') .prop( 'disabled', true ); toastr.remove(); toastr.info( "Processing..."); }, success: function(result) { if (parseInt(result .status) === 1) { toastr.remove(); toastr.success( result .message); // init_leadprofile_page(); $('#mail_lead_modal') .modal( 'hide'); $('#mail_lead_modal') .remove(); } else { $('#btn_lead_mail_lead_save') .prop( 'disabled', false); toastr.remove(); toastr.error(result .message); } }, error: function() { $('#btn_lead_mail_lead_save') .prop( 'disabled', false); toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function display_sms_lead_modal(type,activity_id){ $.when(init_sms_lead_modal(),get_sms_data(activity_id)).done(function(ajax1Results1,sms_data_result) { $('#sms_lead_modal').modal('show'); $('#sms_lead_modal').on('hidden.bs.modal', function() { $('#sms_lead_modal').remove(); }); init_sms_template_list(); $('#btn_lead_sms_lead_save').on('click', function() { //alert conformation if (check_if_empty_field($( '#txt_lead_sms_lead_description' ), 'Message is required.')) { return false; } if ($('#txt_lead_sms_lead_description').val().trim().length <= 5) { $('#txt_lead_sms_lead_description').trigger('focus') toastr.remove(); toastr.error('Your message is too short.') return false; } var $element = $( "[json-sms-lead-modal]"); var json_data = generate_json( 'json-sms-lead-modal', $element); $.when(add_lead_sms(json_data)).done(function(ajax1Results5) { init_function(type); }); }); $("[lead-sms-parameter]").each(function() { $(this).on('click', function() { // $('#txt_lead_sms_lead_description').val($('#txt_lead_sms_lead_description').val()+$(this).text()); $('#txt_lead_sms_lead_description').insertAtCaret($(this).text()); $('#txt_lead_sms_lead_description').trigger('focus'); }); }); $('#remove_sms_lead_save_template').on('click', function() { Swal.fire({ icon: 'warning', html: 'Are you sure you want to remove this template?', showDenyButton: false, showCancelButton: true, confirmButtonText: `Yes`, cancelButtonText: `No`, denyButtonText: `Don't Confirm`, showClass: { backdrop: 'swal2-noanimation', // disable backdrop animation popup: '', // disable popup animation icon: '' // disable icon animation }, hideClass: { popup: '', // disable popup fade-out animation }, customClass: 'swal-height' }).then((result) => { if (result.isConfirmed) { var sms_template_id = $('#dd_sms_lead_template').val(); $.ajax({ url: "app/models/lead.php", data: { model: 'remove_sms_template', sms_template_id : sms_template_id }, type: "POST", dataType: 'json', beforeSend: function() { toastr.remove(); toastr.info( "Removing..."); }, success: function(result) { if (parseInt(result .status) === 1) { toastr.remove(); toastr.success( result .message); // $('#dd_sms_lead_template').select2('destroy'); // $('#dd_sms_lead_template').off('change'); // init_sms_template_list(); $('#dd_sms_lead_template').val('').trigger('change'); } else { toastr.remove(); toastr.error(result .message); } }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } else if (result.isDenied) {} else {} }) }); $('#sms_lead_save_template').on('change', function() { if (this.checked) { Swal.fire({ text: "Template name", input: 'text', showCancelButton: true, preConfirm: (value) => { if (!value) { Swal.showValidationMessage( 'Template name is required' ) }else{ $(this).val(value); } } }).then(function(result){ if(result.value){ }else if(result.isDismissed){ $('#sms_lead_save_template').prop('checked', false); } }); } else { $(this).val(""); } }); $('#clear_sms_lead_description').on('click', function() { $('#txt_lead_sms_lead_description').val(''); $('#dd_sms_lead_template').val('').trigger('change'); }); if(!isEmpty(activity_id)){ var mail_data = sms_data_result[0][0]; $('#clear_sms_lead_description').hide(); $('#sms-template-section').hide(); $('#sms-save-template-section').hide(); $('#sms-parameter-section').hide(); $('#txt_lead_sms_lead_description').attr('readonly', true); $('#txt_lead_sms_lead_description').css('background-color', 'white'); $('#btn_lead_sms_lead_save').off('click'); $('#btn_lead_sms_lead_save').hide(); $('#btn_lead_sms_lead_cancel').html('Close'); $.each(mail_data, function(i, n) { $("#" + i).text(n); $("#" + i).val(n); $("#" + i).trigger('change') }); } }); } function get_sms_data(activity_id){ if(isEmpty(activity_id)){ return false; } return $.ajax({ url: "app/models/lead.php", data: { model: 'get_sms_data', activity_id: activity_id }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) { // console.log(result) }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function init_sms_lead_modal() { return $.ajax({ url: "resources/views/modals/sms_lead_modal.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { $('#center_content').append(data); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function add_lead_sms(json_data){ return $.ajax({ url: "app/models/lead.php", data: { model: 'add_lead_sms', json_data: json_data, inquire_id: selected_lead_inquiry }, type: "POST", dataType: 'json', beforeSend: function() { $('#btn_lead_sms_lead_save') .prop( 'disabled', true ); toastr.remove(); toastr.info( "Processing..."); }, success: function(result) { if (parseInt(result .status) === 1) { toastr.remove(); toastr.success( result .message); // init_leadprofile_page(); $('#sms_lead_modal') .modal( 'hide'); $('#sms_lead_modal') .remove(); } else { $('#btn_lead_sms_lead_save') .prop( 'disabled', false); toastr.remove(); toastr.error(result .message); } }, error: function() { $('#btn_lead_sms_lead_save') .prop( 'disabled', false); toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function init_sms_template_list(){ $('#dd_sms_lead_template').select2({ placeholder: "Select Template", allowClear: true, minimumResultsForSearch: -1, templateResult: formatState, // allowClear: true, ajax: { url: 'app/models/lead.php?model=my_sms_template_list', dataType: 'json' } }); $('#dd_sms_lead_template').on('change', function(e) { var sms_template_id = $('#dd_sms_lead_template').val(); if(isEmpty(sms_template_id)){ $('#remove_sms_lead_save_template').hide(); return false; }else{ $('#remove_sms_lead_save_template').show(); } $.ajax({ url: "app/models/lead.php", data: { model: 'get_sms_template', sms_template_id : sms_template_id }, type: "POST", dataType: 'json', beforeSend: function() { toastr.remove(); toastr.info( "Fetching..."); }, success: function(result) { if (parseInt(result .status) === 1) { toastr.remove(); toastr.success( result .message); // set text to field $('#txt_lead_sms_lead_description').val(result.content); } else { toastr.remove(); toastr.error(result .message); } }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); }); } function display_inactive_modal(type,activity_id){ $.when(init_inactive_modal(),get_inactive_data(activity_id)).done(function(ajax1Results1,inactive_data_result) { $('#inactive_modal').modal('show'); $('#inactive_modal').on('hidden.bs.modal', function() { $('#inactive_modal').remove(); }); $('#txt_revisit_date_div').datetimepicker({ format: 'MM/DD/YYYY', minDate:moment() }); $('#btn_lead_inactive_save').on('click', function() { //alert conformation if (check_if_empty_field($( '#txt_lead_inactive_description' ), 'Reason is required.')) { return false; } var $element = $( "[json-lead-inactive-modal]"); var json_data = generate_json( 'json-lead-inactive-modal', $element); $.when(add_lead_inactive(json_data,activity_id)).done(function(ajax1Results5) { if(parseInt(ajax1Results5.status) === 1){ init_function(type); } }); }); //get activity description if any if(!isEmpty(activity_id)){ var inactive_data = inactive_data_result[0][0] $.each(inactive_data, function(i, n) { $("#" + i).text(n); $("#" + i).val(n); $("#" + i).trigger('change') }); } }); } function get_inactive_data(activity_id){ if(isEmpty(activity_id)){ return false; } return $.ajax({ url: "app/models/lead.php", data: { model: 'get_inactive_data', activity_id: activity_id }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) { // console.log(result) }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function add_lead_inactive(json_data,activity_id){ var activity_type = isEmpty(activity_id) ? 'add_lead_inactive' : 'update_lead_inactive' ; return $.ajax({ url: "app/models/lead.php", data: { model: activity_type, json_data: json_data, inquire_id: selected_lead_inquiry, activity_id : activity_id }, type: "POST", dataType: 'json', beforeSend: function() { $('#btn_lead_inactive_save') .prop( 'disabled', true ); toastr.remove(); toastr.info( "Saving..."); }, success: function(result) { if (parseInt(result .status) === 1) { toastr.remove(); toastr.success( result .message); // init_leadprofile_page(); $('#inactive_modal') .modal( 'hide'); $('#inactive_modal') .remove(); } else { $('#btn_lead_inactive_save') .prop( 'disabled', false); toastr.remove(); toastr.error(result .message); } }, error: function() { $('#btn_lead_inactive_save') .prop( 'disabled', false); toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } function progress_list_json() { return $.ajax({ url: "app/models/lead.php", data: { model: 'lead_progress_list' }, type: "POST", beforeSend: function() {}, success: function(data) { }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } //END LEADS PROFILE FILE////////////////////////////////////////////////////////////////////////////////////PK+ZT3j33common/scripts/masterfile.jsnu[ //MASTER FILE///////////////////////////////////////////////////////////////////////////////////////////////////// function init_masterfile_page() { init_header(); if (side_menu_loaded) { init_masterfile(); } else { $.when(init_side_content()).done(function(ajax1Results) { init_masterfile(); }); } } var init_masterfile = function() { return $.ajax({ url: "resources/views/masterfile.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { document.title = 'Masterfile'; $('#center_content').html(data); add_content_close_listener('center_content'); $('#master_add_company').on('click', function() { if(!global_menu_access.includes(2)){ return false; } $.when(init_company_modal()).done(function(ajax1Results) { $('#company_modal').modal('show'); $('#company_modal').on('hidden.bs.modal', function() { $('#company_modal').remove(); }); var selected_tab = 1; $('#txt_company_code').focus(); $('#company-modal-company-tab').on('click', function() { selected_tab = 1; }); $('#company-modal-dealer-tab').on('click', function() { selected_tab = 2; }); $("#dd_dealer_company").select2({ // tags:true, // multiple: true, placeholder: "Select company", allowClear: true, escapeMarkup: function(markup) { return markup; }, ajax: { url: 'app/models/company.php', dataType: 'json', delay: 250, data: function(data) { return { model: 'company_list', api: true, search: data.term // search term }; }, processResults: function(response) { return { results: response }; }, cache: true } }); $('#btn_company_save').on('click', function() { if (parseInt(selected_tab) === 1) { if (check_if_empty_field($('#txt_company_code'), 'Code is required.')) { return; } if (check_if_empty_field($('#txt_company_name'), 'Name is required.')) { return; } var $element = $("[json-company-modal]"); var json_data = generate_json('json-company-modal', $element); return $.ajax({ url: "app/models/company.php", data: { model: 'add', json_data: json_data }, type: "POST", dataType: 'json', beforeSend: function() { $('#btn_company_save').prop( 'disabled', true); toastr.remove(); toastr.info("Adding..."); }, success: function(result) { if (parseInt(result.status) === 1) { toastr.remove(); toastr.success(result .message); refreshMasterfileTable(); $('#company_modal').modal( 'hide'); $('#company_modal') .remove(); } else { $('#btn_company_save').prop( 'disabled', false); toastr.remove(); toastr.error(result .message); } }, error: function() { $('#btn_company_save').prop( 'disabled', false); toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } else if (parseInt(selected_tab) === 2) { if (check_if_empty_field($('#dd_dealer_company'), 'Dealer company is required.')) { return; } if (check_if_empty_field($('#txt_dealer_code'), 'Code is required.')) { return; } if (check_if_empty_field($('#txt_dealer_name'), 'Name is required.')) { return; } var $element = $("[json-dealer-modal]"); var json_data = generate_json('json-dealer-modal', $element); return $.ajax({ url: "app/models/dealer.php", data: { model: 'add', json_data: json_data }, type: "POST", dataType: 'json', beforeSend: function() { $('#btn_company_save').prop( 'disabled', true); toastr.remove(); toastr.info("Adding..."); }, success: function(result) { if (parseInt(result.status) === 1) { toastr.remove(); toastr.success(result .message); $('#company_modal').modal( 'hide'); $('#company_modal') .remove(); } else { $('#btn_company_save').prop( 'disabled', false); toastr.remove(); toastr.error(result .message); } }, error: function() { $('#btn_company_save').prop( 'disabled', false); toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } }); }); }); refreshMasterfileTable(); $('#table_masterfile').on('click-cell.bs.table', function(field, row, value, $el) { if (row != "remove") { selected_company = $el.id; init_leadfile_page(); // init_groupfile_page(); } }); accessManagement(2); show_hide_preloader(false); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function init_company_modal() { return $.ajax({ url: "resources/views/modals/company_modal.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { $('#center_content').append(data); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function initMasterfileList() { var $table = $('#table_masterfile'); $table.bootstrapTable('destroy').bootstrapTable({ sidePagination: 'server', formatSearch: function() { return 'Search...' }, onLoadSuccess: function() { $('.masterfile_action_remove').hide(); accessManagement(2) // if(!global_menu_access.includes(2)){ // $('.masterfile_action_remove').hide(); // }else{ // $('.masterfile_action_remove').show(); // } }, exportOptions: { fileName: function() { return 'titile' } } }); } function refreshMasterfileTable() { initMasterfileList(); var $table = $('#table_masterfile') $(function() { $table.bootstrapTable('refresh', { url: 'app/models/company.php' }); }) } function masterFileQueryParams(params) { return { search: params.search, offset: params.offset, limit: params.limit, sort: params.sort, order: params.order, model: 'company_table', }; } function removeCompanyFormatter(value, row, index) { return ''; } window.removeCompanyEvent = { 'click i': function(e, value, row, index) { if(!global_menu_access.includes(2)){ return false; } Swal.fire({ icon: 'warning', html: 'Are you sure you want to remove this company?', showDenyButton: false, showCancelButton: true, confirmButtonText: `Yes`, cancelButtonText: `No`, denyButtonText: `Don't Confirm`, showClass: { backdrop: 'swal2-noanimation', // disable backdrop animation popup: '', // disable popup animation icon: '' // disable icon animation }, hideClass: { popup: '', // disable popup fade-out animation }, customClass: 'swal-height' }).then((result) => { if (result.isConfirmed) { $.ajax({ url: "app/models/company.php", method: "POST", dataType: 'json', data: { model: 'remove', id: row.id }, beforeSend: function() { toastr.remove(); toastr.info('Removing...') }, success: function(result) { if (parseInt(result.status) === 1) { toastr.remove(); toastr.success(result.message); refreshMasterfileTable(); } else { toastr.remove(); toastr.error(result.message); } } }); } else if (result.isDenied) {} else {} }) } }; //MASTER FILE/////////////////////////////////////////////////////////////////////////////////////////////////////PK+Z$-common/scripts/signin.jsnu[var init_signin = function() { init_toastr(); return $.ajax({ url: "resources/views/signin.php", data: {}, type: "POST", beforeSend: function() { show_hide_preloader(true); }, // success: function(data) { // }, success: function(data) { document.title = 'Sign in'; side_menu_loaded = false; init_destroy_session(); $('#header_content').html(''); $('#main_content').html(data); // var conn = new WebSocket('ws://localhost:8080'); // conn.onopen = function(e) { // console.log("Connection established!"); // }; // conn.onmessage = function(e) { // console.log(e.data); // var data = JSON.parse(e.data); // alert(data.msg) // }; // $('#forgot_password').on('click', function(){ // var data = { // userId : 1, // msg : $('#username').val() // }; // conn.send(JSON.stringify(data)); // }); $('#create_account').on('click', function() { init_signup(); }); $('#username').on('keyup',function(e) { if (e.which == 13) { // if ($('#username').is(":focus") || $('#password').is(":focus")) { $('#btn_signin').trigger('click'); return; // } } str = $(this).val().trim() str = str.replace(/\s/g, '') $(this).val(str) }); $('#password').on('keyup',function(e) { if (e.which == 13) { $('#btn_signin').trigger('click'); return; } }); // $(document).on('keypress', function(e) { // console.log(e.which); // if (e.which == 13) { // if ($('#username').is(":focus") || $('#password').is(":focus")) { // $('#btn_signin').trigger('click'); // } // } // }); $('#btn_signin').on('click', function() { if (check_if_empty_field($('#username'), 'ID number or email address is required.')) { return; } if (check_if_empty_field($('#password'), 'Password is required.')) { return; } var $element = $("[json-signin]"); var json_data = generate_json('json-signin', $element); return $.ajax({ url: "app/models/user.php", data: { model: 'signin', api: true, json_data: json_data }, type: "POST", dataType: 'json', beforeSend: function() { toastr.remove(); toastr.info("Signing in."); }, success: function(result) { if (parseInt(result.status) === 1) { toastr.remove(); toastr.success(result.message); init_default_page(); } else { toastr.remove(); toastr.error(result.message); } }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); }); show_hide_preloader(false); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); };PK+ZɅ**!common/scripts/default_options.jsnu[//START CHANGE DEFAULTS/////////////////////////////// function init_toastr() { toastr.options = { "closeButton": true, "debug": false, "progressBar": true, "positionClass": "toast-top-right", "showDuration": "300", "hideDuration": "1000", "timeOut": "3000", "extendedTimeOut": "1000", "showEasing": "swing", "hideEasing": "linear", "showMethod": "fadeIn", "hideMethod": "fadeOut" }; } $.fn.extend({ insertAtCaret: function(myValue) { this.each(function() { if (document.selection) { this.focus(); var sel = document.selection.createRange(); sel.text = myValue; this.focus(); } else if (this.selectionStart || this.selectionStart == '0') { var startPos = this.selectionStart; var endPos = this.selectionEnd; var scrollTop = this.scrollTop; this.value = this.value.substring(0, startPos) + myValue + this.value.substring(endPos,this.value.length); this.focus(); this.selectionStart = startPos + myValue.length; this.selectionEnd = startPos + myValue.length; this.scrollTop = scrollTop; } else { this.value += myValue; this.focus(); } }); return this; } });PK+ZAC@@common/scripts/role.jsnu[//START ROLES FILE////////////////////////////////////////////////////////////////////////// function init_rolefile_page() { init_header(); if (side_menu_loaded) { init_rolefile(); } else { $.when(init_side_content()).done(function(ajax1Results) { init_rolefile(); }); } } var init_rolefile = function() { return $.ajax({ url: "resources/views/roles.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { document.title = 'Roles'; $('#center_content').html(data); add_content_close_listener('center_content'); $('#role_back').on('click', function() { init_config_page(); }); $('#role-search').focusin(function() { $('#role-search-div').removeClass('default-search-size'); $('#role-search-div').addClass('expand-search-size'); }); $('#role-search').focusout(function() { if (isEmpty($(this).val())) { $('#role-search-div').removeClass('expand-search-size'); $('#role-search-div').addClass('default-search-size'); } }); $('#role-search').on('keyup',delay(function(e) { refreshRolefileTableSilent(); }, 500)); $(document).on('click', '.role-list-filter', function(e) { e.stopPropagation(); }); $('#role_add_role').on('click', function() { $.when(init_role_modal(), create_temporary_role()).done(function(ajax1Results, ajax2Results) { // alert(ajax2Results.id) created_role_id = ajax2Results[0].id; $('#role_modal').modal('show'); $('#role_modal').on('hidden.bs.modal', function() { remove_temporary_role(created_role_id); $('#role_modal').remove(); }); $("[role-access]").each(function() { $(this).on('change', function() { if (this.checked) { $(this).val("1"); } else { $(this).val("0"); } }); }); //role dealer tab $('#role-dealer-search').focusin(function() { $('#role-dealer-search-div').removeClass( 'default-search-size'); $('#role-dealer-search-div').addClass( 'expand-search-size'); }); $('#role-dealer-search').focusout(function() { if (isEmpty($(this).val())) { $('#role-dealer-search-div').removeClass( 'expand-search-size'); $('#role-dealer-search-div').addClass( 'default-search-size'); } }); $('#role-dealer-search').on('keyup',delay(function(e) { refreshRoleDealerfileTableSilent(); }, 500)); //end role tab $('#txt_role_name').focus(); $('#btn_role_save').on('click', function() { if (check_if_empty_field($('#txt_role_name'), 'Role name is required.')) { return; } var $element = $("[json-role-modal]"); var json_data = generate_json('json-role-modal', $element); update_role(created_role_id, json_data) // console.log(json_data); }); refreshRoleDealerfileTable(); }); }); refreshRolefileTable(); $('#table_rolefile').on('click-cell.bs.table', function(field, value, row, $el) { if (value != "action") { //update role $.when(init_role_modal()).done(function(ajax1Results) { init_role_modal_elements($el.id,$el.name,$el.menu_access); }); } }); show_hide_preloader(false); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function init_role_modal_elements(role_id,role_name,role_access){ created_role_id = role_id; $('#role_modal').modal('show'); $('#role_modal').on('hidden.bs.modal', function() { $('#role_modal').remove(); }); $("[role-access]").each(function() { $(this).on('change', function() { if (this.checked) { $(this).val("1"); } else { $(this).val("0"); } }); }); //role dealer tab $('#role-dealer-search').focusin(function() { $('#role-dealer-search-div').removeClass( 'default-search-size'); $('#role-dealer-search-div').addClass( 'expand-search-size'); }); $('#role-dealer-search').focusout(function() { if (isEmpty($(this).val())) { $('#role-dealer-search-div').removeClass( 'expand-search-size'); $('#role-dealer-search-div').addClass( 'default-search-size'); } }); $('#role-dealer-search').on('keyup',delay(function(e) { refreshRoleDealerfileTableSilent(); }, 500)); //end role tab $('#txt_role_name').focus(); $('#txt_role_name').val(role_name); $('#btn_role_save').on('click', function() { if (check_if_empty_field($('#txt_role_name'), 'Role name is required.')) { return; } var $element = $("[json-role-modal]"); var json_data = generate_json('json-role-modal', $element); update_role(created_role_id, json_data) // console.log(json_data); }); //set check to menu access const menuobj = JSON.parse(role_access); // console.log(menuobj) $.each(menuobj, function(i, n) { var $current_el = $('#ra_'+n); $current_el.val("1"); $current_el.attr('checked',true); }); refreshRoleDealerfileTable(); } function init_role_modal() { return $.ajax({ url: "resources/views/modals/role_modal.php", data: {}, type: "POST", beforeSend: function() {}, success: function(data) { $('#center_content').append(data); }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function update_role(role_id, json_data) { return $.ajax({ url: "app/models/user.php", data: { model: 'update_role', id: role_id, json_data: json_data }, type: "POST", dataType: 'json', beforeSend: function() { $('#btn_role_save').prop( 'disabled', true); toastr.remove(); toastr.info("Saving role."); }, success: function(result) { if (parseInt(result.status) === 1) { refreshRolefileTable(); toastr.remove(); toastr.success(result.message); // refreshRoleDealerfileTable(); $('#role_modal').off('hidden.bs.modal').on('hidden.bs.modal', function() {}); $('#role_modal').modal( 'hide'); $('#role_modal').remove(); } else { $('#btn_role_save').prop( 'disabled', false); toastr.remove(); toastr.error(result.message); } }, error: function() { $('#btn_role_save').prop( 'disabled', false); toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function create_temporary_role() { return $.ajax({ url: "app/models/user.php", data: { model: 'add_temporary_role' }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) { // console.log(result) return result; }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function remove_temporary_role(role_id) { return $.ajax({ url: "app/models/user.php", data: { model: 'remove_temporary_role', id: role_id }, type: "POST", dataType: 'json', beforeSend: function() {}, success: function(result) { }, error: function() { toastr.remove(); toastr.error("Error has occurred. Try again.") } }); } function refreshRolefileTable() { initRolefileList(); var $table = $('#table_rolefile') $(function() { $table.bootstrapTable('refresh', { url: 'app/models/user.php' }); }) } function refreshRolefileTableSilent() { var $table = $('#table_rolefile') $(function() { $table.bootstrapTable('refresh', { url: 'app/models/user.php' }); }) } function initRolefileList() { var $table = $('#table_rolefile'); $table.bootstrapTable('destroy').bootstrapTable({ sidePagination: 'server', formatSearch: function() { return 'Search...' }, onLoadSuccess: function() {}, exportOptions: { fileName: function() { return 'titile' } } }); } function rolefileQueryParams(params) { return { search: $('#role-search').val(), offset: params.offset, limit: params.limit, sort: params.sort, order: params.order, model: 'role_list', }; } function removeRoleFormatter(value, row, index) { return ''; } window.removeRoleEvent = { 'click i': function(e, value, row, index) { if (parseInt(row.user_count) > 0) { toastr.remove(); toastr.error('Role is currently active in some users.'); return; } Swal.fire({ icon: 'warning', html: 'Are you sure you want to remove this role?', showDenyButton: false, showCancelButton: true, confirmButtonText: `Yes`, cancelButtonText: `No`, denyButtonText: `Don't Confirm`, showClass: { backdrop: 'swal2-noanimation', // disable backdrop animation popup: '', // disable popup animation icon: '' // disable icon animation }, hideClass: { popup: '', // disable popup fade-out animation }, customClass: 'swal-height' }).then((result) => { if (result.isConfirmed) { $.ajax({ url: "app/models/user.php", method: "POST", dataType: 'json', data: { model: 'remove_role', id: row.id }, beforeSend: function() { toastr.remove(); toastr.info('Removing...') }, success: function(result) { if (parseInt(result.status) === 1) { toastr.remove(); toastr.success(result.message); refreshRolefileTable(); } else { toastr.remove(); toastr.error(result.message); } }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } else if (result.isDenied) {} else {} }) } }; ////START ROLE DEALER function refreshRoleDealerfileTable() { initRoleDealerfileList(); var $table = $('#table_role_dealer_file') $(function() { $table.bootstrapTable('refresh', { url: 'app/models/user.php' }); }) } function refreshRoleDealerfileTableSilent() { var $table = $('#table_role_dealer_file') $(function() { $table.bootstrapTable('refresh', { url: 'app/models/user.php' }); }) } function initRoleDealerfileList() { var $table = $('#table_role_dealer_file'); $table.bootstrapTable('destroy').bootstrapTable({ sidePagination: 'server', formatSearch: function() { return 'Search...' }, onLoadSuccess: function() {}, exportOptions: { fileName: function() { return 'titile' } } }); } function roleDealerfileQueryParams(params) { return { search: $('#role-dealer-search').val(), offset: params.offset, limit: params.limit, sort: params.sort, order: params.order, role_id: created_role_id, model: 'role_dealer_list', }; } function roleDealerFormatter(value, row, index) { var html = ''; if (parseInt(row.status) === 1) { html = ''; } return html; } window.roleDealerEvent = { 'click input': function(e, value, row, index) { //get selected id $.ajax({ url: "app/models/user.php", method: "POST", dataType: 'json', data: { model: 'role_change_status', dealer_id: row.d_id, role_id: created_role_id }, beforeSend: function() { // toastr.remove(); // toastr.info('Updating...') }, success: function(result) { if (parseInt(result.status) === 1) { // toastr.remove(); // toastr.success(result.message); refreshRoleDealerfileTableSilent(); } else { toastr.remove(); toastr.error(result.message); } }, error: function() { toastr.remove(); toastr.error( "Error has occurred. Try again." ) } }); } }; ////END ROLE DEALER //END ROLES FILE////////////////////////////////////////////////////////////////////////////////////PK+Z&Le!!common/header_main.phpnu[ PK+Zvcccommon/meta.phpnu[ LMS PK+ZKKlead_profile.phpnu[ PK+Z>  modals/sms_modal.phpnu[ PK+Z'x((modals/note_modal.phpnu[PK+Z̦""modals/mail_lead_modal.phpnu[PK+Z#"^modals/sms_lead_modal.phpnu[PK+Z:TTmodals/progress_modal.phpnu[PK+ZWY''modals/group_modal.phpnu[PK+Ztܷ   modals/system_settings_modal.phpnu[ PK+ZG77modals/inactive_modal.phpnu[PK+Z@,[Jmodals/call_modal.phpnu[PK+Zp8modals/company_modal.phpnu[ PK+Zۥ*A*Amodals/lead_modal.phpnu[ PK+ZY-wG!G!modals/mail_lead_modal copy.phpnu[PK+ZW11modals/role_modal.phpnu[PK+Z&1 dashboard.phpnu[

Dashboard 1

Dashboard 2

PK+Z,*E signup.phpnu[