348 lines
21 KiB
PHP
348 lines
21 KiB
PHP
@extends('Admin.layouts.master')
|
|
@section('title', 'Manage Leads')
|
|
@section('content')
|
|
<div class="d-flex flex-column flex-column-fluid">
|
|
<div id="kt_app_content_container" class="app-container container-xxl">
|
|
<div class="row max-w-100 index_table mt-10">
|
|
<div class="top_header d-flex justify-content-between">
|
|
<p class='fs-2 fw-bold'>Create Lead </p>
|
|
<div class="table_right_options " style="text-align:right">
|
|
<a class="btn btn-primary me-3" href="{{route('manage_leads')}}">Back</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="app-main flex-column flex-row-fluid" id="kt_app_main">
|
|
<div class="d-flex flex-column flex-column-fluid">
|
|
<div id="kt_app_content_container" class="app-container container-xxl">
|
|
<div class="row max-w-100 mt-10 index_table">
|
|
|
|
<div class="dataTable_area my-5 mb-0">
|
|
<div class="card">
|
|
<div class="modal-body scroll-y px-10 px-lg-15 pt-0 pb-15">
|
|
<form id="add-lead-form" class="form py-5 pb-0" action="#">
|
|
@csrf
|
|
<div class="row">
|
|
<div class="col-md-6 fv-row mb-4">
|
|
<label class="required fs-6 fw-semibold mb-2">Lead Owner</label>
|
|
<select name="lead_owner" id="lead_owner" class="form-select lead_owner">
|
|
<option value="">Select a Lead Owner</option>
|
|
@foreach($user as $data)
|
|
<option value="{{$data->id}}">{{$data->name}}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div class="col-md-6 fv-row mb-4">
|
|
<label class="required fs-6 fw-semibold mb-2">Investor</label>
|
|
<select name="users_id" id="investor" class="form-select lead_owner">
|
|
<option value="">Select a investor</option>
|
|
@foreach($investor as $data)
|
|
<option value="{{$data->id}}">{{$data->name}}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
{{--<div class="col-md-6 fv-row mb-4">
|
|
<label class="required fs-6 fw-semibold mb-2">Category</label>
|
|
<select name="category" id="category" class="form-select lead_owner">
|
|
<option value="">Select a category</option>
|
|
@foreach($categories as $data)
|
|
<option value="{{$data->id}}">{{$data->category_name}}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>--}}
|
|
<div class="col-md-6 fv-row mb-4">
|
|
<label class="required fs-6 fw-semibold mb-2">Product</label>
|
|
<select name="products_id" id="product" class="form-select lead_owner">
|
|
<option value="">Select a product</option>
|
|
@foreach(getAllProductNames() as $data)
|
|
<option value="{{$data->id}}">{{$data->product_name}}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<div class="col-md-6 fv-row mb-4">
|
|
<label class=" fs-6 fw-semibold mb-2">Company</label>
|
|
<input type="text" class="form-control form-control-solid" placeholder="Enter Company" name="lead_company" onkeydown="return /^[a-zA-Z\s]+$/i.test(event.key)" />
|
|
</div>
|
|
<div class="col-md-6 fv-row mb-4">
|
|
<label class=" fs-6 fw-semibold mb-2">Email</label>
|
|
<!--pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$"-->
|
|
<input type="email" class="form-control form-control-solid" readonly placeholder="Enter Email" name="email" id="email"/>
|
|
</div>
|
|
<div class="col-md-6 fv-row mb-4">
|
|
<label class=" fs-6 fw-semibold mb-2">Title</label>
|
|
<input type="text" class="form-control form-control-solid" placeholder="Enter Tiltle" name="title" onkeydown="return /^[a-zA-Z\s]+$/i.test(event.key)"/>
|
|
</div>
|
|
<div class="col-md-6 fv-row mb-4">
|
|
<label class=" fs-6 fw-semibold mb-2">Website</label>
|
|
<input type="text" class="form-control form-control-solid" placeholder="" name="website" />
|
|
</div>
|
|
<div class="col-md-6 fv-row mb-4">
|
|
<label class=" fs-6 fw-semibold mb-2">Phone</label>
|
|
<input type="tel" minlength="10" readonly maxlength="10" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*?)\..*/g, '$1');" class="form-control form-control-solid" placeholder="Enter Phone Number" name="phone" id="phone" />
|
|
</div>
|
|
<div class="col-md-6 fv-row mb-4">
|
|
<label class=" fs-6 fw-semibold mb-2">Lead Status</label>
|
|
<select class="form-select form-select-solid lead_status select2-hidden-accessible" data-control="select2" data-hide-search="true" data-placeholder="Select a Lead Status" name="target_assign" tabindex="-1" aria-hidden="true" data-kt-initialized="1">
|
|
<option value="">Select user...</option>
|
|
<option value="New">New</option>
|
|
<option value="Ongoing">Ongoing</option>
|
|
<option value="Completed">Completed</option>
|
|
<option value="Old">Old</option>
|
|
<option value="Lost">Lost</option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-6 fv-row mb-4">
|
|
<label class=" fs-6 fw-semibold mb-2">Full Name</label>
|
|
<input type="text" class="form-control form-control-solid" readonly placeholder="Enter First Name" id="name" name="first_name" onkeydown="return /^[a-zA-Z\s]+$/i.test(event.key)" />
|
|
</div>
|
|
{{--<div class="col-md-6 fv-row mb-4">
|
|
<label class=" fs-6 fw-semibold mb-2">Last Name</label>
|
|
<input type="text" class="form-control form-control-solid" placeholder="Enter Last Name" name="last_name" onkeydown="return /^[a-zA-Z\s]+$/i.test(event.key)" />
|
|
</div>--}}
|
|
|
|
|
|
|
|
<div class="col-md-6 fv-row mb-4">
|
|
<label class=" fs-6 fw-semibold mb-2">Mobile</label>
|
|
<input type="tel" minlength="10" maxlength="10" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*?)\..*/g, '$1');" class="form-control form-control-solid" placeholder="Enter Mobile Number" name="mobile" />
|
|
</div>
|
|
|
|
<div class="col-md-6 fv-row mb-4">
|
|
<label class=" fs-6 fw-semibold mb-2">Annual Revenue</label>
|
|
<input type="number" class="form-control form-control-solid" placeholder="Enter Annual Revenue" name="annual_revenue" />
|
|
</div>
|
|
|
|
<div class="col-md-6 fv-row mb-7">
|
|
<label class=" fs-6 fw-semibold mb-2">Lead Source</label>
|
|
{{-- <select class="form-select form-select-solid lead_source select2-hidden-accessible" data-control="select2" data-hide-search="true" data-placeholder="Select a Lead Source" name="target_assign" tabindex="-1" aria-hidden="true" data-kt-initialized="1"> --}}
|
|
{{-- <option value="">Select user...</option>
|
|
@foreach($user as $data)
|
|
<option value="{{$data->id}}">{{$data->name}}</option>
|
|
@endforeach --}}
|
|
<select id="lead_source" name="lead_source" data-control="select2" class="form-control form-control-solid">
|
|
<option value="" disabled selected>Select Lead Source</option>
|
|
<option value="Direct">Direct</option>
|
|
<option value="Referral">Referral</option>
|
|
<option value="Website Visitor">Website Visitor</option>
|
|
<option value="Email Marketing">Email Marketing</option>
|
|
<option value="Cold calling">Cold calling</option>
|
|
<option value="Social Media">Social Media</option>
|
|
<option value="Third-Party Lead Providers">Third-Party Lead Providers</option>
|
|
<option value="Webinar & Events">Webinar & Events</option>
|
|
<option value="Others">Others</option>
|
|
</select>
|
|
</div>
|
|
|
|
|
|
<div class="col-md-6 fv-row">
|
|
<label class=" fs-6 fw-semibold mb-2">Industry</label>
|
|
<input type="text" class="form-control form-control-solid" placeholder="" name="industry" onkeydown="return /^[a-zA-Z\s]+$/i.test(event.key)" />
|
|
</div>
|
|
|
|
<div class="col-md-6 fv-row">
|
|
<label class=" fs-6 fw-semibold mb-2">No. of Employees</label>
|
|
<input type="number" class="form-control form-control-solid" placeholder="Enter Employees" name="total_employees" />
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="app-main flex-column flex-row-fluid" id="kt_app_main">
|
|
<div class="d-flex flex-column flex-column-fluid">
|
|
<div id="kt_app_content_container" class="app-container container-xxl">
|
|
<div class="row max-w-100 mt-10 index_table">
|
|
<div class="top_header d-flex justify-content-between">
|
|
<p class='fs-2 fw-bold mb-0'>Address Information</p>
|
|
</div>
|
|
<div class="dataTable_area my-5 mb-0">
|
|
<div class="card">
|
|
<div class="modal-body scroll-y px-10 px-lg-15 pt-4 pb-15">
|
|
<div class="row">
|
|
<div class="col-md-6 fv-row">
|
|
<label class=" fs-6 fw-semibold mb-2">Street</label>
|
|
<input type="text" class="form-control form-control-solid" placeholder="Enter Street " name="street" />
|
|
</div>
|
|
<div class="col-md-6 fv-row">
|
|
<label class=" fs-6 fw-semibold mb-2">City</label>
|
|
<input type="text" class="form-control form-control-solid" placeholder="Enter City" onkeydown="return /^[a-zA-Z\s]+$/i.test(event.key)" name="city" />
|
|
</div>
|
|
<div class="col-md-6 fv-row">
|
|
<label class=" fs-6 fw-semibold mb-2">State</label>
|
|
<input type="text" class="form-control form-control-solid" placeholder="Enter state" onkeydown="return /^[a-zA-Z\s]+$/i.test(event.key)" name="state" />
|
|
</div>
|
|
<div class="col-md-6 fv-row">
|
|
<label class=" fs-6 fw-semibold mb-2">Zip Code</label>
|
|
<input type="tel" class="form-control form-control-solid" placeholder="Enter Zip Code" minlength="6" maxlength="6" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*?)\..*/g, '$1');" name="zip_code" />
|
|
</div>
|
|
<div class="col-md-6 fv-row">
|
|
<label class=" fs-6 fw-semibold mb-2">Country</label>
|
|
<input type="text" class="form-control form-control-solid" placeholder="Enter Country " onkeydown="return /^[a-zA-Z\s]+$/i.test(event.key)" name="country" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="app-main flex-column flex-row-fluid" id="kt_app_main">
|
|
<div class="d-flex flex-column flex-column-fluid">
|
|
<div id="kt_app_content_container" class="app-container container-xxl">
|
|
<div class="row max-w-100 mt-10 index_table">
|
|
<div class="top_header d-flex justify-content-between">
|
|
<p class='fs-2 fw-bold'>Description Information</p>
|
|
</div>
|
|
<div class="dataTable_area my-5 mb-5">
|
|
<div class="card">
|
|
<div class="modal-body scroll-y px-10 px-lg-15 pt-0 pb-15">
|
|
<div class="row mb-4">
|
|
<div class="col-md-12 mt-8">
|
|
<label class=" fs-6 fw-semibold mb-2">Description</label>
|
|
<textarea class="form-control form-control form-control-solid min-h-100px" placeholder="Enter Description" data-kt-autosize="true" name="description"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="table_right_options text-center">
|
|
<a type="button" href="{{route('manage_leads')}}" class="btn btn-light-primary me-3">
|
|
Cancel
|
|
</a>
|
|
<button type="submit" id="save-btn" class="btn btn-light-primary me-3">
|
|
Save
|
|
</button>
|
|
<button id="loaderBtn" class="btn btn-light-primary me-3 d-none" type="button">
|
|
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
|
|
Loading...
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
@section('scripts')
|
|
<script>
|
|
$('#investor').on('change',function(){
|
|
id = $(this).val();
|
|
$.ajax({
|
|
url:"{{route('get-investor-detail')}}",
|
|
type:'get',
|
|
data:{'id':id},
|
|
success:function(result){
|
|
if(result.status == 200)
|
|
{
|
|
// console.log(result.data);
|
|
$('#phone').val(result.data.contact_number);
|
|
$('#email').val(result.data.email);
|
|
$('#name').val(result.data.name);
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
$(document).ready(function() {
|
|
$('.lead_status').select2();
|
|
$('.lead_source').select2();
|
|
$('.lead_owner').select2();
|
|
});
|
|
$('#lead_owner').change(function(){
|
|
if ($(this).val()!="")
|
|
{
|
|
$(this).valid();
|
|
}
|
|
});
|
|
$('#investor').change(function(){
|
|
if ($(this).val()!="")
|
|
{
|
|
$(this).valid();
|
|
}
|
|
});
|
|
$('#product').change(function(){
|
|
if ($(this).val()!="")
|
|
{
|
|
$(this).valid();
|
|
}
|
|
});
|
|
|
|
$.validator.addMethod("customEmail", function(value, element) {
|
|
// Regular expression for email validation
|
|
return /^[^\s@]+@[^\s@]+\.[a-zA-Z]{2,}$/.test(value);
|
|
}, "Please enter a valid email address");
|
|
$("#add-lead-form").validate({
|
|
ignore: [],
|
|
debug: false,
|
|
rules: {
|
|
lead_owner: 'required',
|
|
users_id : 'required',
|
|
products_id : 'required',
|
|
// email: {
|
|
// required: true,
|
|
// customEmail: true,
|
|
// },
|
|
},
|
|
messages: {
|
|
lead_owner: {
|
|
required: "Please select lead owner",
|
|
},
|
|
users_id: {
|
|
required: "Please select investor",
|
|
},
|
|
products_id: {
|
|
required: "Please select product",
|
|
},
|
|
// email: {
|
|
// required: "Please enter email",
|
|
// email: 'Please enter a valid email address',
|
|
// },
|
|
},
|
|
submitHandler: function(form) {
|
|
var formData = new FormData(form);
|
|
// $("#save_btn").text("Please wait...");
|
|
// $("#save_btn").attr("disabled", true);
|
|
$.ajax({
|
|
url: "{{route('create-lead')}}",
|
|
type: "POST",
|
|
data: formData,
|
|
beforeSend: function() {
|
|
$('#loaderBtn').removeClass('d-none');
|
|
$('#save-btn').addClass('d-none');
|
|
},
|
|
processData: false,
|
|
contentType: false,
|
|
dataType: "json",
|
|
success: function(result) {
|
|
$('#save-btn').removeClass('d-none');
|
|
$('#loaderBtn').addClass('d-none');
|
|
if (result.status == 200) {
|
|
toastr.success(result.message);
|
|
setTimeout(() => {
|
|
location.replace('{{route("manage_leads")}}');
|
|
}, 1000);
|
|
}
|
|
if (result.status == 400) {
|
|
$('#save-btn').removeClass('d-none');
|
|
$('#loaderBtn').addClass('d-none');
|
|
toastr.warning(result.message);
|
|
}
|
|
},
|
|
error: function(jqXHR) {
|
|
// $("#request_callback_btn").removeClass("d-none");
|
|
// $("#loaderContactBtn").addClass("d-none");
|
|
warning(jqXHR.responseJSON);
|
|
},
|
|
});
|
|
},
|
|
});
|
|
</script>
|
|
@endsection |